From 5e7255baed6d6167546724cc0df0da8f5421d6be Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 9 Oct 2019 17:58:09 -0400 Subject: [PATCH 1/7] Attack of the Astral Fish --- CalPlayer/CalamityPlayer.cs | 51 +++++++++- Items/Fishing/ArcturusAstroidean.cs | 24 +++++ Items/Fishing/ArcturusAstroidean.png | Bin 0 -> 549 bytes Items/Fishing/AstralCrate.cs | 90 ++++++++++++++++++ Items/Fishing/AstralCrate.png | Bin 0 -> 3425 bytes Items/Fishing/GacruxianMollusk.png | Bin 0 -> 651 bytes Items/Fishing/PolarisParrotfish.png | Bin 0 -> 900 bytes Items/Fishing/ProcyonidPrawn.cs | 22 +++++ Items/Fishing/ProcyonidPrawn.png | Bin 0 -> 795 bytes Items/Fishing/TwinklingPollox.cs | 23 +++++ Items/Fishing/TwinklingPollox.png | Bin 0 -> 709 bytes .../{Accessories => Fishing}/UrsaSergeant.cs | 2 +- .../{Accessories => Fishing}/UrsaSergeant.png | Bin NPCs/AstralBiomeNPCs/Twinkler.cs | 1 + Tiles/Astral/AstralCrate.cs | 52 ++++++++++ Tiles/Astral/AstralCrate.png | Bin 0 -> 930 bytes Utilities/CalamityRecipes.cs | 14 +++ 17 files changed, 276 insertions(+), 3 deletions(-) create mode 100644 Items/Fishing/ArcturusAstroidean.cs create mode 100644 Items/Fishing/ArcturusAstroidean.png create mode 100644 Items/Fishing/AstralCrate.cs create mode 100644 Items/Fishing/AstralCrate.png create mode 100644 Items/Fishing/GacruxianMollusk.png create mode 100644 Items/Fishing/PolarisParrotfish.png create mode 100644 Items/Fishing/ProcyonidPrawn.cs create mode 100644 Items/Fishing/ProcyonidPrawn.png create mode 100644 Items/Fishing/TwinklingPollox.cs create mode 100644 Items/Fishing/TwinklingPollox.png rename Items/{Accessories => Fishing}/UrsaSergeant.cs (96%) rename Items/{Accessories => Fishing}/UrsaSergeant.png (100%) create mode 100644 Tiles/Astral/AstralCrate.cs create mode 100644 Tiles/Astral/AstralCrate.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index ab3b75c2f7..16f439252f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -6810,9 +6810,56 @@ namespace CalamityMod.CalPlayer #region Fishing public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) { - if (ZoneAstral && Main.rand.NextBool(25)) + if (ZoneAstral) { - caughtType = mod.ItemType("UrsaSergeant"); + if (caughtType == ItemID.WoodenCrate) + { + caughtType = ItemID.WoodenCrate; + } + else if (caughtType == ItemID.IronCrate) + { + caughtType = ItemID.IronCrate; + } + else if (caughtType == ItemID.GoldenCrate) + { + caughtType = ItemID.GoldenCrate; + } + else if (caughtType == ItemID.FrogLeg) + { + caughtType = ItemID.FrogLeg; + } + else if (caughtType == ItemID.BalloonPufferfish) + { + caughtType = ItemID.BalloonPufferfish; + } + else if (caughtType == ItemID.ZephyrFish) + { + caughtType = ItemID.ZephyrFish; + } + else if (Main.rand.NextBool(10)) + { + caughtType = mod.ItemType("ProcyonidPrawn"); + } + else if (Main.rand.NextBool(15)) + { + caughtType = mod.ItemType("ArcturusAstroidean"); + } + else if (player.cratePotion && Main.rand.NextBool(5)) + { + caughtType = mod.ItemType("AstralCrate"); + } + else if (Main.rand.NextBool(10)) + { + caughtType = mod.ItemType("AstralCrate"); + } + else if (Main.rand.NextBool(25)) + { + caughtType = mod.ItemType("UrsaSergeant"); + } + else + { + caughtType = mod.ItemType("TwinklingPollox"); + } } Point point = player.Center.ToTileCoordinates(); bool abyssPosX = false; diff --git a/Items/Fishing/ArcturusAstroidean.cs b/Items/Fishing/ArcturusAstroidean.cs new file mode 100644 index 0000000000..96b50b37ca --- /dev/null +++ b/Items/Fishing/ArcturusAstroidean.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Fishing +{ + public class ArcturusAstroidean : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arcturus Astroidean"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.sellPrice(silver: 10); + item.rare = 3; + item.bait = 40; + } + } +} diff --git a/Items/Fishing/ArcturusAstroidean.png b/Items/Fishing/ArcturusAstroidean.png new file mode 100644 index 0000000000000000000000000000000000000000..71764541fca89def166419d80574e55a8cc574f0 GIT binary patch literal 549 zcmV+=0^0qFP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00DDJL_t(I%e9oTOF~f?#ec7)@R?|d z7V_*3ks*>pVHDxi98plv?pA9<<>+4!wl&z?($E$S5z){Vh-frOA|xm|_@sFB8mEYOsIFmb)>URFp9fclyp?XyS!l5t#`yma0%5qvF1kd)Qx_Wpj2I*17 z9fg}K+W<^@V*vd0J^{FC)d9#Q&H*UwmL=lsm0u|A*JiEZl82fa2cT|LEr9u@6X9L+ zS}4m3&ywi?0HxQC;~@JEMz8R>dT#+-9NbFYnLBGz<72TTGqd6q=oKA+?zGPxg^CtQ zIc9P=3CWj)@NlE-ILKeTbIC&n@(eIOCz8_6Us_H|?abQHHC?Jludv>HlQuL`j*a%O zGv$vd0Doo+fUeO6z^A%(%flO5L@1m{ECBFZ{;-@l!zXji!+%hiV9O@u;(Gu901|XX nSad~LNk%$Pa%p95bYXO9Z*BlFgjnqF00000NkvXXu0mjfO1t92 literal 0 HcmV?d00001 diff --git a/Items/Fishing/AstralCrate.cs b/Items/Fishing/AstralCrate.cs new file mode 100644 index 0000000000..d7877430ff --- /dev/null +++ b/Items/Fishing/AstralCrate.cs @@ -0,0 +1,90 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; +using CalamityMod.Utilities; + +namespace CalamityMod.Items.Fishing +{ + public class AstralCrate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Crate"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 32; + item.height = 32; + item.rare = 2; + item.value = Item.sellPrice(gold: 1); + } + + public override bool CanRightClick() + { + return true; + } + + public override void RightClick(Player player) + { + //Modded materials + DropHelper.DropItem(player, mod.ItemType("Stardust"), 10, 20); + DropHelper.DropItem(player, ItemID.FallenStar, 10, 20); + if (CalamityWorld.downedAstrageldon) + { + DropHelper.DropItemChance(player, mod.ItemType("AstralJelly"), 0.5f, 5, 10); + } + if (CalamityWorld.downedStarGod) + { + DropHelper.DropItemChance(player, mod.ItemType("AstralOre"), 0.5f, 10, 20); + DropHelper.DropItemChance(player, mod.ItemType("AstralBar"), 0.25f, 5, 10); + } + + // Weapons + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f, + mod.ItemType("StellarKnife"), + mod.ItemType("AstralachneaStaff"), + mod.ItemType("TitanArm"), + mod.ItemType("HivePod"), + mod.ItemType("AstralScythe"), + mod.ItemType("StellarCannon")); + + //Bait + DropHelper.DropItemChance(player, mod.ItemType("Twinkler"), 5, 1, 3); + DropHelper.DropItemChance(player, ItemID.EnchantedNightcrawler, 5, 1, 3); + DropHelper.DropItemChance(player, mod.ItemType("ArcturusAstroidean"), 5, 1, 3); + DropHelper.DropItemChance(player, ItemID.Firefly, 3, 1, 3); + + //Potions + DropHelper.DropItemChance(player, ItemID.ObsidianSkinPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.SwiftnessPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.IronskinPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.NightOwlPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.ShinePotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.MiningPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion + if (CalamityWorld.downedStarGod) + { + DropHelper.DropItemChance(player, ItemID.SuperHealingPotion, 2, 5, 10); + } + else + { + DropHelper.DropItemChance(player, ItemID.GreaterHealingPotion, 2, 5, 10); + } + if (CalamityWorld.downedAstrageldon) + { + DropHelper.DropItemChance(player, mod.ItemType("AstralInjection"), 4, 1, 3); + DropHelper.DropItemChance(player, mod.ItemType("GravityNormalizerPotion"), 4, 1, 3); + } + + //Money + DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); + DropHelper.DropItemChance(player, ItemID.GoldCoin, 0.5f, 1, 5); + } + } +} diff --git a/Items/Fishing/AstralCrate.png b/Items/Fishing/AstralCrate.png new file mode 100644 index 0000000000000000000000000000000000000000..71e92191012d8d215c5770fc377d9e7faa0fd43e GIT binary patch literal 3425 zcmV-n4W9CeP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0007vNkl`Pqn1A~QfTyp@CIa90 z0Z1p)0Gv2;&aC^jQ~_YTRBUXruNxVNi38CujhZ5R_HG7%AA1t!d8TU{0I7Yw0CXHk znuuk3K3*z1#sPil;iCfp9Dgxo9G@KOGngwQYqxU%JRh42)~|G!{S@)T&t7=%S{10y z#dc*t*1tb2f={zSCc^)Pu_E7_3GOLZ0hn9=8D2fZ5n(T#aH0xmR;){>FBpeh7
    z4gglB*8v#bnr+E;MSkjF+U&FV)n=ylamEo2G-#hfLr%Q0T{Yp zHEf4!%j$?vST59@sRDI1X}c6obuNsDmoSktco~4gU~oHhwrDa@id2U`_8@TVN;%pM zh52OpWlIdtlQftsa#`WxcK`-P1D0pS`ia*7Y!CewDvOS0AllWU3O7G8WiS@zid>v{ zG<_$?=$CG@-@Jhrpf%z{pFpk?I3Sp8fUtq#?>*e=ZT z%k`Eol;V07ui>T+$TY(#GWBzHHEH{X!mV1i3v-z`l1ZkF9=JCZ3wuqkn&A>hj+u<8 zt4Z586fV5hBA6?3=gx+)%}&Svddh9`i<;Y~Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00G%aL_t(Y$Gz0SOH@%5$MMhPNRE=4 zIR-Imv zWQ#FSc`e?%%1l!`-`TwT?z{K!`~KcJC*vP+U~sJJeKp$%8djF0dgr(3%)q*ixIT9wu6y@ zeRVJ1cz+Yj_TL7#3ccX!@MIuLhaeNY@7+;IOlyeX#ld@EykiRF3#;JMtIt&lhH|ID z)b}zdeVD*{Rc$=M`D2&BqnTm^XU0y%N*2C=zQG|dU3>}pTbe*memj_}jDVBdVh4iv z&AH}u2(m%>$GcC!_)Prl>y8yYoqhmv;YLeO6=A6ydoHP-5S68hbO??PjAo$w>}Uk% zE?%j7aP!24crp1H%#}-3-$NDEMk;*}!JShNvEHFacE+9g{LKuQFVBPCq+@p#dg>;8 z_PV&1I~9WL-okK(zo%g-srN98N{QlH?`xIkJK_#r`0-6D1Z%S>M0+w-ePx#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00PoUL_t(o!{wOGOBGQVho6xP*&-D` zZW419{6rK}v5j8@LT!w4(T8p-2nrH|T14ccMIVbODEtFzqg0U5P9iWhT}4+>#4<&^ zMd~#)HwNakn0d2vn&IBGXsqAnaL%0b&N@5Ufv1i-@*mm=bGOwkpNa_7C=Gg z4TZo^u2avtcK}d-u-7&2;`PT$zc6@Q>GwTv@i(z}a?El_0g&2u7J$j8VF0G~om3|4 zq>A?>0}wsEW)stbA5ODfdTZbu09jd;{;vFSyHZF=g`Ton?FZdsuuWDNsdCQ%W<33EBc+LrUN(mmYC5{Vc(;|kpY{KnGL{&syhHQ zCS)iJKVkvY*0%#NK6f8jza9K;LR*Gd!0SZm!E(bPqmXlvLTaOgborNPx#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00L=AL_t(Y$IX^KXj4%X$A348QM@#^h*Czmk!wEpc*fIeYPD!FU5!4(N(fCeQTYqZG z>RxsZC}IG@F0TN{H>-Pu*w-SiR4ZCeQ`d$xhcDkn*A34clI~MKLRw@LIjvmVPpmXK zei?wYQPT{Q2a6rat+}+-{};8=R{fs+Jp!P%UDp0i)^q)^C}Y&KQz!5>*PL3nr_IOi2cM${n3%G4(hhpX4jE)J|(Mp z&)vDi|2kTUtr`sW34ly#LyMG>ZNz^8$nnr=r67S!0000IbVXQnMOaBjI!|(GWo~p~ ZbZKvH05ODE?C$^o002ovPDHLkV1ifZSWW-{ literal 0 HcmV?d00001 diff --git a/Items/Fishing/TwinklingPollox.cs b/Items/Fishing/TwinklingPollox.cs new file mode 100644 index 0000000000..bd21d4d846 --- /dev/null +++ b/Items/Fishing/TwinklingPollox.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing +{ + public class TwinklingPollox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Twinkling Pollox"); //Bass substitute + Tooltip.SetDefault("The scales gleam like crystals"); + } + + public override void SetDefaults() + { + item.width = 32; + item.height = 28; + item.maxStack = 999; + item.value = Item.sellPrice(silver: 5); + item.rare = 1; + } + } +} diff --git a/Items/Fishing/TwinklingPollox.png b/Items/Fishing/TwinklingPollox.png new file mode 100644 index 0000000000000000000000000000000000000000..4c13640a3ca317692d72365c6ccd7d2454feeeb4 GIT binary patch literal 709 zcmV;$0y_PPP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00I+9L_t(Y$K96COH@%5$3IsT%+#rI znoxWYIUqPP3&Ej9piqleMQ+5MP>aZIt7zH3kXx7HMlkvV3KYVi#ZbEx>zU%HZyX1I z(ZFkQ-?6!`_Xd@LuAR-jmv`^weLv@%?|X^{MQ=K1tUD4t0948we!X)|je3ELhKhSI zbni*sgU4kLfRkWMHnjt=S#k}<`Mb{n$hEcsP&hsWV0m%c4g$?**b|w<)%Mkcey{;p@Mk@rX~e0FvLsLsv-&~mjySwSGS1`diFdVHsy zEct2*fK;{@fS;3JfIs~`f9D8*%zNE5YvoS>c!Rei@BejB!EOQ)otXgz;Jtq117rec z`!=e}C-*V9Xkl4T62k!83Pukz_sVe;fbY6?5K!T-m_+w=?O@{V;^`7`IUaJmjJ0^a zO5f1Ri`xLK7YlX}XeP$%H%mH4;_VV|w?0HFmmCL`@E5VLatSL4=*h%*^p5Rl<)TB>qDd@H*ZmW+hk*2Db#~6LCDGZJ0-)d?8V64MIaJj$R%)PJ3IeA-pd8)zzH9b< z+*eGzJY3c1jek!-CPE^a>I1;rSutv&rs`EAl-oxjOd?zp;WPgYf#1MKyJ*XnXPx#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00QtyL_t(o!|j;OOH@%9#(y`Isf;oy z4V<(ua3NVFt)hj3M4KXM7X(GCXwk<1z*a&Lv}jX)KszCHqL4r<5dvwVVitmZOpehQ zWC>E27SrOKXU21!akgjSySX#>oH;Y+H_!V%@3~R3v7^8SQNMFn1n_I+Hvox50)RM< z3jn#L_Ypv)b=r=!MF4a2a~pn-*4aW}QKJ{vuHSS9KBnIQF!g%c*;yRN0JJ7swX?FH z|F@6>U^q2esItCuKU_k796r(MT(#pDZ)XAcv%ArmKR!JJKzrR*09y7oIpjn{p>aRL zC8QmQ$mv&4or#kNI{@f8cflc+w&SNBUjg9dP{yqDv({NxM4o-g+V|yuPYdm@qfc%G9)ww_`^%`#iN_9rr zB+ZCS!^jN)`X3DfaO;5?_p=EMiIqFuKuKdYW3HB#ydM-Cp-3(*Z&C%;f3Iwkw)(r~ z%_lFJx)ViR5kR3ZRRFkre$*kAI%clQzPRr`0Edz-K*`I3b^Fbz7DWxomF3#LH}!hn zG%|M4EZ}Jfn|+;wX1=mX6?@yVn^)PK$+}=Qw5}i0j(l%Y1y=Sbn~Gt{DEppI+ykKJ zTfMXHr)8H+B9VyJE)y;x)fo{`KO@(cH>m>q9iKEKG7V?y02p{^ys~fAPE@C93CSVC zC8Tqce>zY$WjxoGH>Iq`6w-(^BQolz1{Tfxp&f>-a!pVDV=-F@#v`?*IS*07*qoM6N<$ Ef`S*Fi2wiq literal 0 HcmV?d00001 diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index e2104e6739..270bf8366b 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -78,6 +78,20 @@ namespace CalamityMod.Utilities r.AddTile(TileID.MythrilAnvil); r.SetResult(ItemID.LifeFruit); r.AddRecipe(); + + // Cooked Fish + r = GetNewRecipe(); + r.AddIngredient(null, "TwinklingPollox"); + r.AddTile(TileID.CookingPots); + r.SetResult(2425); + r.AddRecipe(); + + // Cooked Shrimp + r = GetNewRecipe(); + r.AddIngredient(null, "ProcyonidPrawn"); + r.AddTile(TileID.CookingPots); + r.SetResult(2426); + r.AddRecipe(); } // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) From 2b81efc7467fe53824c31126a75d0f50b2d17310 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 9 Oct 2019 23:00:12 -0400 Subject: [PATCH 2/7] added gacruxian mollusk --- CalPlayer/CalamityPlayer.cs | 14 ++- .../GacruxianMollusk.cs | 53 ++++++++++ .../GacruxianMollusk.png | Bin Items/Fishing/ArcturusAstroidean.cs | 1 + Items/Fishing/AstralCrate.cs | 6 ++ Projectiles/Rogue/GacruxianHome.cs | 93 ++++++++++++++++++ Projectiles/Rogue/GacruxianHome.png | Bin 0 -> 651 bytes Projectiles/Rogue/GacruxianProj.cs | 76 ++++++++++++++ Projectiles/Rogue/GacruxianProj.png | Bin 0 -> 651 bytes 9 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs rename Items/{Fishing => CalamityCustomThrowingDamage}/GacruxianMollusk.png (100%) create mode 100644 Projectiles/Rogue/GacruxianHome.cs create mode 100644 Projectiles/Rogue/GacruxianHome.png create mode 100644 Projectiles/Rogue/GacruxianProj.cs create mode 100644 Projectiles/Rogue/GacruxianProj.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 16f439252f..7eb2ab350b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -6810,7 +6810,7 @@ namespace CalamityMod.CalPlayer #region Fishing public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) { - if (ZoneAstral) + if (ZoneAstral && liquidType == 0) //Astral Infection, fishing in water { if (caughtType == ItemID.WoodenCrate) { @@ -6856,6 +6856,10 @@ namespace CalamityMod.CalPlayer { caughtType = mod.ItemType("UrsaSergeant"); } + else if (Main.rand.NextBool(25)) + { + caughtType = mod.ItemType("GacruxianMollusk"); + } else { caughtType = mod.ItemType("TwinklingPollox"); @@ -6946,6 +6950,14 @@ namespace CalamityMod.CalPlayer } } } + + public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel) + { + if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type = mod.ItemType("ArcturusAstroidean")) + { + fishingLevel = (int)(fishingLevel * 1.1f); + } + } #endregion #region Frame Effects diff --git a/Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs b/Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs new file mode 100644 index 0000000000..4c2bcf405f --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class GacruxianMollusk : CalamityDamageItem + { + public static int BaseDamage = 50; + public static float Knockback = 5f; + public static float Speed = 8f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gacruxian Mollusk"); + Tooltip.SetDefault("Releases homing sparks while traveling\n" + + "Stealth strikes release homing snails that create even more sparks"); + } + + public override void SafeSetDefaults() + { + item.damage = BaseDamage; + item.rare = 4; + item.knockBack = Knockback; + item.autoReuse = true; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 1; + item.width = 24; + item.height = 22; + item.UseSound = SoundID.Item1; + item.noMelee = true; + item.noUseGraphic = true; + item.shoot = mod.ProjectileType("GacruxianProj"); + item.shootSpeed = Speed; + item.value = Item.buyPrice(0, 0, 20, 0); + item.GetGlobalItem(mod).rogue = true; + //item.maxStack = 999; not consumable because imagine knowing how to fish up more than one of an item + //item.consumable = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.GetCalamityPlayer().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("GacruxianProj"), damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; + return false; + } + return true; + } + } +} diff --git a/Items/Fishing/GacruxianMollusk.png b/Items/CalamityCustomThrowingDamage/GacruxianMollusk.png similarity index 100% rename from Items/Fishing/GacruxianMollusk.png rename to Items/CalamityCustomThrowingDamage/GacruxianMollusk.png diff --git a/Items/Fishing/ArcturusAstroidean.cs b/Items/Fishing/ArcturusAstroidean.cs index 96b50b37ca..6371d59e2c 100644 --- a/Items/Fishing/ArcturusAstroidean.cs +++ b/Items/Fishing/ArcturusAstroidean.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { DisplayName.SetDefault("Arcturus Astroidean"); + Tooltip.SetDefault("Increases fishing power if used in the Astral Infection or Sulphurous Sea"); } public override void SetDefaults() diff --git a/Items/Fishing/AstralCrate.cs b/Items/Fishing/AstralCrate.cs index d7877430ff..7751341ac0 100644 --- a/Items/Fishing/AstralCrate.cs +++ b/Items/Fishing/AstralCrate.cs @@ -22,6 +22,12 @@ namespace CalamityMod.Items.Fishing item.height = 32; item.rare = 2; item.value = Item.sellPrice(gold: 1); + item.createTile = mod.TileType("AstralCrate"); + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; } public override bool CanRightClick() diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs new file mode 100644 index 0000000000..28fad66f41 --- /dev/null +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -0,0 +1,93 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class GacruxianHome : ModProjectile + { + private int sparkTrailTimer = 10; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 18; + projectile.friendly = true; + projectile.GetGlobalProjectile(mod).rogue = true; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + sparkTrailTimer--; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (sparkTrailTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + } + sparkTrailTimer = 10; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/GacruxianHome.png b/Projectiles/Rogue/GacruxianHome.png new file mode 100644 index 0000000000000000000000000000000000000000..4a4defcff858ba7555f7ec6d00fc65469369c758 GIT binary patch literal 651 zcmV;60(AX}P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00G%aL_t(Y$Gz0SOH@%5$MMhPNRE=4 zIR-Imv zWQ#FSc`e?%%1l!`-`TwT?z{K!`~KcJC*vP+U~sJJeKp$%8djF0dgr(3%)q*ixIT9wu6y@ zeRVJ1cz+Yj_TL7#3ccX!@MIuLhaeNY@7+;IOlyeX#ld@EykiRF3#;JMtIt&lhH|ID z)b}zdeVD*{Rc$=M`D2&BqnTm^XU0y%N*2C=zQG|dU3>}pTbe*memj_}jDVBdVh4iv z&AH}u2(m%>$GcC!_)Prl>y8yYoqhmv;YLeO6=A6ydoHP-5S68hbO??PjAo$w>}Uk% zE?%j7aP!24crp1H%#}-3-$NDEMk;*}!JShNvEHFacE+9g{LKuQFVBPCq+@p#dg>;8 z_PV&1I~9WL-okK(zo%g-srN98N{QlH?`xIkJK_#r`0-6D1Z%S>M0+w-e(mod).rogue = true; + } + + public override void AI() + { + if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + { + sparkTrailTimer--; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (sparkTrailTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("GacruxianHome"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + sparkTrailTimer = 10; + } + } + else + { + sparkTrailTimer--; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (sparkTrailTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + } + sparkTrailTimer = 10; + } + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/GacruxianProj.png b/Projectiles/Rogue/GacruxianProj.png new file mode 100644 index 0000000000000000000000000000000000000000..4a4defcff858ba7555f7ec6d00fc65469369c758 GIT binary patch literal 651 zcmV;60(AX}P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00G%aL_t(Y$Gz0SOH@%5$MMhPNRE=4 zIR-Imv zWQ#FSc`e?%%1l!`-`TwT?z{K!`~KcJC*vP+U~sJJeKp$%8djF0dgr(3%)q*ixIT9wu6y@ zeRVJ1cz+Yj_TL7#3ccX!@MIuLhaeNY@7+;IOlyeX#ld@EykiRF3#;JMtIt&lhH|ID z)b}zdeVD*{Rc$=M`D2&BqnTm^XU0y%N*2C=zQG|dU3>}pTbe*memj_}jDVBdVh4iv z&AH}u2(m%>$GcC!_)Prl>y8yYoqhmv;YLeO6=A6ydoHP-5S68hbO??PjAo$w>}Uk% zE?%j7aP!24crp1H%#}-3-$NDEMk;*}!JShNvEHFacE+9g{LKuQFVBPCq+@p#dg>;8 z_PV&1I~9WL-okK(zo%g-srN98N{QlH?`xIkJK_#r`0-6D1Z%S>M0+w-e Date: Wed, 9 Oct 2019 22:10:10 -0500 Subject: [PATCH 3/7] I wanted to erase the changes to biofusillade i was making but now its forcing me to commit --- Items/Weapons/GammaFusillade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/GammaFusillade.cs b/Items/Weapons/GammaFusillade.cs index d46bcaf24f..984b12ef88 100644 --- a/Items/Weapons/GammaFusillade.cs +++ b/Items/Weapons/GammaFusillade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("GammaLaser"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.GetGlobalItem().postMoonLordRarity = 12; } public override void AddRecipes() From 8a493d474f3de681d93513fe455e06ee2d03e23a Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Wed, 9 Oct 2019 23:17:17 -0400 Subject: [PATCH 4/7] enormous sweeping changes for 0.11.5 --- Buffs/Amidias/AmidiasBlessing.cs | 2 +- Buffs/Amidias/HermitCrab.cs | 2 +- Buffs/Amidias/SnapClamDebuff.cs | 2 +- Buffs/CalamityGlobalBuff.cs | 6 +- Buffs/DoTDebuffs/AbyssalFlames.cs | 4 +- Buffs/DoTDebuffs/AstralInfectionDebuff.cs | 4 +- Buffs/DoTDebuffs/BrimstoneFlames.cs | 4 +- Buffs/DoTDebuffs/BurningBlood.cs | 4 +- Buffs/DoTDebuffs/CrushDepth.cs | 4 +- Buffs/DoTDebuffs/DemonFlames.cs | 2 +- Buffs/DoTDebuffs/GodSlayerInferno.cs | 4 +- Buffs/DoTDebuffs/HolyInferno.cs | 2 +- Buffs/DoTDebuffs/HolyLight.cs | 4 +- Buffs/DoTDebuffs/LethalLavaBurn.cs | 2 +- Buffs/DoTDebuffs/Nightwither.cs | 2 +- Buffs/DoTDebuffs/Plague.cs | 4 +- Buffs/DoTDebuffs/Shadowflame.cs | 2 +- Buffs/DoTDebuffs/Shred.cs | 2 +- Buffs/DoTDebuffs/VulnerabilityHex.cs | 2 +- Buffs/Fabsol/BloodyMary.cs | 2 +- Buffs/Fabsol/BlueSpeedCandle.cs | 2 +- Buffs/Fabsol/CaribbeanRum.cs | 2 +- Buffs/Fabsol/CinnamonRoll.cs | 2 +- Buffs/Fabsol/Everclear.cs | 2 +- Buffs/Fabsol/EvergreenGin.cs | 2 +- Buffs/Fabsol/FabsolVodka.cs | 2 +- Buffs/Fabsol/Fireball.cs | 2 +- Buffs/Fabsol/GrapeBeer.cs | 2 +- Buffs/Fabsol/Margarita.cs | 2 +- Buffs/Fabsol/Moonshine.cs | 2 +- Buffs/Fabsol/MoscowMule.cs | 2 +- Buffs/Fabsol/PinkHealthCandle.cs | 2 +- Buffs/Fabsol/PurpleDefenseCandle.cs | 2 +- Buffs/Fabsol/RedWine.cs | 2 +- Buffs/Fabsol/Rum.cs | 2 +- Buffs/Fabsol/Screwdriver.cs | 2 +- Buffs/Fabsol/StarBeamRye.cs | 2 +- Buffs/Fabsol/Tequila.cs | 2 +- Buffs/Fabsol/TequilaSunrise.cs | 2 +- Buffs/Fabsol/Trippy.cs | 2 +- Buffs/Fabsol/Vodka.cs | 2 +- Buffs/Fabsol/Whiskey.cs | 2 +- Buffs/Fabsol/WhiteWine.cs | 2 +- Buffs/Fabsol/YellowDamageCandle.cs | 4 +- Buffs/MountBuffs/BrimstoneMount.cs | 6 +- Buffs/MountBuffs/Fab.cs | 5 +- Buffs/MountBuffs/GazeOfCrysthamyrBuff.cs | 8 +- Buffs/MountBuffs/SquishyBeanBuff.cs | 6 +- Buffs/PetBuffs/AkatoYharonBuff.cs | 2 +- Buffs/PetBuffs/BearBuff.cs | 2 +- Buffs/PetBuffs/BloodBound.cs | 2 +- Buffs/PetBuffs/BrimlingBuff.cs | 2 +- Buffs/PetBuffs/ChibiiBuff.cs | 2 +- Buffs/PetBuffs/DannyDevito.cs | 2 +- Buffs/PetBuffs/Fox.cs | 2 +- Buffs/PetBuffs/Kendra.cs | 2 +- Buffs/PetBuffs/Levi.cs | 2 +- Buffs/PetBuffs/StrangeOrb.cs | 2 +- Buffs/PetBuffs/ThirdSageBuff.cs | 2 +- Buffs/PotionBuffs/AbyssalWeapon.cs | 2 +- Buffs/PotionBuffs/AnechoicCoating.cs | 2 +- Buffs/PotionBuffs/ArmorCrumbling.cs | 2 +- Buffs/PotionBuffs/ArmorShattering.cs | 2 +- Buffs/PotionBuffs/AstralInjectionBuff.cs | 2 +- Buffs/PotionBuffs/BoundingBuff.cs | 2 +- Buffs/PotionBuffs/Cadence.cs | 2 +- Buffs/PotionBuffs/CalciumBuff.cs | 2 +- Buffs/PotionBuffs/CeaselessHunger.cs | 2 +- Buffs/PotionBuffs/DraconicSurgeBuff.cs | 2 +- Buffs/PotionBuffs/GravityNormalizerBuff.cs | 2 +- Buffs/PotionBuffs/HolyWrathBuff.cs | 2 +- Buffs/PotionBuffs/Invincible.cs | 2 +- Buffs/PotionBuffs/Omniscience.cs | 2 +- Buffs/PotionBuffs/PenumbraBuff.cs | 2 +- Buffs/PotionBuffs/PhotosynthesisBuff.cs | 2 +- Buffs/PotionBuffs/ProfanedRageBuff.cs | 2 +- Buffs/PotionBuffs/Soaring.cs | 2 +- Buffs/PotionBuffs/TitanScale.cs | 2 +- Buffs/PotionBuffs/TriumphBuff.cs | 2 +- Buffs/PotionBuffs/YharimPower.cs | 2 +- Buffs/PotionBuffs/Zen.cs | 2 +- Buffs/PotionBuffs/Zerg.cs | 2 +- Buffs/Shrines/ChiBuff.cs | 2 +- Buffs/Shrines/CorruptionEffigyBuff.cs | 2 +- Buffs/Shrines/CrimsonEffigyBuff.cs | 2 +- Buffs/Shrines/GladiatorSwords.cs | 2 +- Buffs/Shrines/OnyxExcavatorBuff.cs | 8 +- Buffs/Shrines/TundraLeashBuff.cs | 8 +- Buffs/StatBuffs/AbyssalDivingSuitPlates.cs | 2 +- Buffs/StatBuffs/AdrenalineMode.cs | 2 +- Buffs/StatBuffs/Afflicted.cs | 2 +- Buffs/StatBuffs/ChaosCandle.cs | 2 +- Buffs/StatBuffs/CosmicFreeze.cs | 2 +- Buffs/StatBuffs/GodSlayerCooldown.cs | 2 +- Buffs/StatBuffs/GraxDefense.cs | 2 +- Buffs/StatBuffs/HeartAttack.cs | 2 +- Buffs/StatBuffs/IceShieldBuff.cs | 2 +- Buffs/StatBuffs/Molten.cs | 2 +- Buffs/StatBuffs/Mushy.cs | 2 +- Buffs/StatBuffs/RageMode.cs | 2 +- Buffs/StatBuffs/ReaverRage.cs | 2 +- Buffs/StatBuffs/ScarfMeleeBoost.cs | 2 +- Buffs/StatBuffs/ShellBoost.cs | 2 +- Buffs/StatBuffs/SirenWaterSpeed.cs | 2 +- Buffs/StatBuffs/TarraLifeRegen.cs | 2 +- Buffs/StatBuffs/TranquilityCandle.cs | 2 +- Buffs/StatBuffs/TyrantsFury.cs | 2 +- Buffs/StatBuffs/XerocRage.cs | 2 +- Buffs/StatBuffs/XerocWrath.cs | 2 +- .../AbyssalDivingSuitPlatesBroken.cs | 2 +- Buffs/StatDebuffs/ArmorCrunch.cs | 4 +- Buffs/StatDebuffs/BurntOut.cs | 2 +- Buffs/StatDebuffs/Enraged.cs | 4 +- Buffs/StatDebuffs/ExoFreeze.cs | 2 +- Buffs/StatDebuffs/ExtremeGrav.cs | 2 +- Buffs/StatDebuffs/ExtremeGravity.cs | 2 +- Buffs/StatDebuffs/FishAlert.cs | 2 +- Buffs/StatDebuffs/GlacialState.cs | 4 +- Buffs/StatDebuffs/Horror.cs | 2 +- Buffs/StatDebuffs/IceShieldBrokenBuff.cs | 2 +- Buffs/StatDebuffs/Irradiated.cs | 4 +- Buffs/StatDebuffs/MarkedforDeath.cs | 4 +- Buffs/StatDebuffs/ScarfCooldown.cs | 2 +- Buffs/StatDebuffs/SilvaStun.cs | 2 +- Buffs/StatDebuffs/TemporalSadness.cs | 2 +- Buffs/StatDebuffs/TimeSlow.cs | 2 +- Buffs/StatDebuffs/WarCleave.cs | 2 +- Buffs/StatDebuffs/Warped.cs | 2 +- Buffs/StatDebuffs/WeakPetrification.cs | 2 +- Buffs/StatDebuffs/WhisperingDeath.cs | 4 +- Buffs/SummonBuffs/AngryChicken.cs | 2 +- Buffs/SummonBuffs/AquaticStar.cs | 2 +- Buffs/SummonBuffs/BloodClot.cs | 2 +- Buffs/SummonBuffs/BrimstoneWaifu.cs | 2 +- Buffs/SummonBuffs/BrittleStar.cs | 2 +- Buffs/SummonBuffs/Calamari.cs | 2 +- Buffs/SummonBuffs/CalamitasEyes.cs | 2 +- Buffs/SummonBuffs/ChaosSpirit.cs | 2 +- Buffs/SummonBuffs/CloudyWaifu.cs | 2 +- Buffs/SummonBuffs/Corroslime.cs | 2 +- Buffs/SummonBuffs/CosmicEnergy.cs | 2 +- Buffs/SummonBuffs/Cosmilamp.cs | 2 +- Buffs/SummonBuffs/Crimslime.cs | 2 +- Buffs/SummonBuffs/DaedalusCrystal.cs | 2 +- Buffs/SummonBuffs/DankCreeper.cs | 2 +- Buffs/SummonBuffs/DrewsSandyWaifu.cs | 2 +- Buffs/SummonBuffs/ElementalAxe.cs | 2 +- Buffs/SummonBuffs/FungalClump.cs | 2 +- Buffs/SummonBuffs/GuardianDefense.cs | 2 +- Buffs/SummonBuffs/GuardianHealer.cs | 2 +- Buffs/SummonBuffs/GuardianOffense.cs | 2 +- Buffs/SummonBuffs/Herring.cs | 2 +- Buffs/SummonBuffs/HotE.cs | 2 +- Buffs/SummonBuffs/IceClasper.cs | 2 +- Buffs/SummonBuffs/Mechworm.cs | 2 +- Buffs/SummonBuffs/Phantom.cs | 2 +- Buffs/SummonBuffs/ReaverOrb.cs | 2 +- Buffs/SummonBuffs/RedDevil.cs | 2 +- .../SummonBuffs/ResurrectionButterflyBuff.cs | 2 +- Buffs/SummonBuffs/Sandnado.cs | 2 +- Buffs/SummonBuffs/SandyWaifu.cs | 2 +- Buffs/SummonBuffs/SilvaCrystal.cs | 2 +- Buffs/SummonBuffs/SirenLure.cs | 2 +- Buffs/SummonBuffs/SlimeGod.cs | 2 +- Buffs/SummonBuffs/SolarSpirit.cs | 2 +- Buffs/SummonBuffs/SolarSpiritGod.cs | 2 +- Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs | 2 +- Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs | 2 +- Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs | 2 +- Buffs/SummonBuffs/Urchin.cs | 2 +- Buffs/SummonBuffs/Valkyrie.cs | 2 +- Buffs/SunkenSea/Clamity.cs | 2 +- Buffs/SunkenSea/PearlAura.cs | 2 +- Buffs/SunkenSea/Shellfish.cs | 2 +- Buffs/SunkenSea/ShellfishEating.cs | 2 +- CalPlayer/CalamityPlayer.cs | 186 +++++++++--------- CalPlayer/CalamityPlayerLifeRegen.cs | 4 +- CalamityMod.cs | 2 +- Items/AbyssItems/AbyssalAmulet.cs | 2 +- Items/AbyssItems/AbyssalDivingGear.cs | 2 +- Items/AbyssItems/AnechoicPlating.cs | 2 +- Items/AbyssItems/DepthCharm.cs | 2 +- Items/AbyssItems/IronBoots.cs | 2 +- Items/AbyssItems/LumenousAmulet.cs | 2 +- Items/AbyssItems/ReaperToothNecklace.cs | 2 +- Items/Accessories/AlchemicalFlask.cs | 2 +- Items/Accessories/AmalgamatedBrain.cs | 2 +- Items/Accessories/AmbrosialAmpoule.cs | 2 +- Items/Accessories/AmidiasSpark.cs | 2 +- Items/Accessories/AngelTreads.cs | 2 +- Items/Accessories/ArcanumoftheVoid.cs | 4 +- Items/Accessories/AsgardianAegis.cs | 4 +- Items/Accessories/AsgardsValor.cs | 2 +- Items/Accessories/AstralArcanum.cs | 4 +- Items/Accessories/AstralBulwark.cs | 2 +- Items/Accessories/BadgeofBravery.cs | 4 +- Items/Accessories/BloodflareCore.cs | 2 +- Items/Accessories/BurdenBreaker.cs | 2 +- Items/Accessories/CelestialJewel.cs | 2 +- Items/Accessories/CheatTestThing.cs | 2 +- Items/Accessories/CoinofDeceit.cs | 4 +- Items/Accessories/CoreOfTheBloodGod.cs | 2 +- Items/Accessories/CounterScarf.cs | 2 +- Items/Accessories/CrownJewel.cs | 2 +- Items/Accessories/DarkSunRing.cs | 4 +- Items/Accessories/DeificAmulet.cs | 2 +- Items/Accessories/DimensionalSoulArtifact.cs | 4 +- Items/Accessories/DraedonsHeart.cs | 4 +- Items/Accessories/EclipseMirror.cs | 2 +- Items/Accessories/EldritchSoulArtifact.cs | 4 +- Items/Accessories/ElementalGauntlet.cs | 4 +- Items/Accessories/ElementalQuiver.cs | 4 +- Items/Accessories/EtherealTalisman.cs | 4 +- Items/Accessories/EyeoftheStorm.cs | 4 +- Items/Accessories/FrigidBulwark.cs | 2 +- Items/Accessories/FrostBarrier.cs | 2 +- Items/Accessories/FrostFlare.cs | 2 +- Items/Accessories/FungalCarapace.cs | 2 +- Items/Accessories/GiantShell.cs | 2 +- Items/Accessories/GodlySoulArtifact.cs | 4 +- Items/Accessories/GoldBurdenBreaker.cs | 2 +- Items/Accessories/HarpyRing.cs | 2 +- Items/Accessories/HeartofDarkness.cs | 2 +- Items/Accessories/HeartoftheElements.cs | 6 +- Items/Accessories/HoneyDew.cs | 2 +- Items/Accessories/Laudanum.cs | 2 +- Items/Accessories/MagicLevelMeter.cs | 6 +- Items/Accessories/MeleeLevelMeter.cs | 6 +- Items/Accessories/MoonstoneCrown.cs | 2 +- Items/Accessories/Nanotech.cs | 10 +- Items/Accessories/NecklaceofVexation.cs | 2 +- Items/Accessories/OldDie.cs | 2 +- Items/Accessories/PlagueHive.cs | 2 +- Items/Accessories/PsychoticAmulet.cs | 2 +- Items/Accessories/RaidersTalisman.cs | 2 +- Items/Accessories/RampartofDeities.cs | 4 +- Items/Accessories/RangedLevelMeter.cs | 6 +- Items/Accessories/RareVariants/DeepDiver.cs | 4 +- .../RareVariants/FabledTortoiseShell.cs | 4 +- .../RareVariants/HideofAstrumDeus.cs | 4 +- Items/Accessories/RareVariants/Regenator.cs | 4 +- .../Accessories/RareVariants/SamuraiBadge.cs | 4 +- Items/Accessories/RareVariants/TheBee.cs | 4 +- .../Accessories/RareVariants/TheEvolution.cs | 4 +- .../RareVariants/TheTransformer.cs | 4 +- Items/Accessories/RogueEmblem.cs | 2 +- Items/Accessories/RogueLevelMeter.cs | 6 +- Items/Accessories/SpiritGenerator.cs | 2 +- Items/Accessories/Sponge.cs | 4 +- Items/Accessories/StatisBeltOfCurses.cs | 10 +- Items/Accessories/StatisBlessing.cs | 2 +- Items/Accessories/StatisCurse.cs | 2 +- Items/Accessories/StatisNinjaBelt.cs | 2 +- Items/Accessories/StressPills.cs | 2 +- Items/Accessories/SummonLevelMeter.cs | 6 +- Items/Accessories/TheAbsorber.cs | 2 +- Items/Accessories/TheAmalgam.cs | 4 +- Items/Accessories/TheCommunity.cs | 4 +- Items/Accessories/TheFirstShadowflame.cs | 2 +- Items/Accessories/VoidofExtinction.cs | 4 +- Items/Accessories/WifeinaBottle.cs | 4 +- Items/Accessories/WifeinaBottlewithBoobs.cs | 4 +- Items/Accessories/Wings/AureateWings.cs | 2 +- Items/Accessories/Wings/CelestialTracers.cs | 4 +- Items/Accessories/Wings/DiscordianWings.cs | 2 +- Items/Accessories/Wings/DrewsWings.cs | 2 +- Items/Accessories/Wings/ElysianTracers.cs | 4 +- Items/Accessories/Wings/HadarianWings.cs | 2 +- Items/Accessories/Wings/InfinityBoots.cs | 4 +- Items/Accessories/Wings/StarlightWings.cs | 2 +- Items/Accessories/Wings/TarragonWings.cs | 2 +- Items/Accessories/Wings/XerocWings.cs | 6 +- Items/Accessories/YharimsInsignia.cs | 4 +- Items/AquaticScourge/AquaticEmblem.cs | 2 +- Items/AquaticScourge/Seafood.cs | 2 +- Items/Armor/AerospecBreastplate.cs | 2 +- Items/Armor/AerospecHat.cs | 2 +- Items/Armor/AerospecHeadgear.cs | 8 +- Items/Armor/AerospecHelm.cs | 2 +- Items/Armor/AerospecHelmet.cs | 2 +- Items/Armor/AerospecHood.cs | 2 +- Items/Armor/AstralHelm.cs | 4 +- Items/Armor/AtaxiaHeadgear.cs | 2 +- Items/Armor/AtaxiaHelm.cs | 4 +- Items/Armor/AtaxiaHelmet.cs | 2 +- Items/Armor/AtaxiaHood.cs | 12 +- Items/Armor/AtaxiaMask.cs | 2 +- Items/Armor/AtaxiaSubligar.cs | 2 +- Items/Armor/AuricTeslaBodyArmor.cs | 4 +- Items/Armor/AuricTeslaCuisses.cs | 2 +- Items/Armor/AuricTeslaHelm.cs | 6 +- Items/Armor/AuricTeslaHoodedFacemask.cs | 6 +- Items/Armor/AuricTeslaPlumedHelm.cs | 10 +- Items/Armor/AuricTeslaSpaceHelmet.cs | 6 +- Items/Armor/AuricTeslaWireHemmedVisage.cs | 6 +- Items/Armor/BloodflareBodyArmor.cs | 2 +- Items/Armor/BloodflareCuisses.cs | 2 +- Items/Armor/BloodflareHelm.cs | 8 +- Items/Armor/BloodflareHelmet.cs | 4 +- Items/Armor/BloodflareHornedHelm.cs | 4 +- Items/Armor/BloodflareHornedMask.cs | 4 +- Items/Armor/BloodflareMask.cs | 4 +- Items/Armor/DaedalusHat.cs | 2 +- Items/Armor/DaedalusHeadgear.cs | 2 +- Items/Armor/DaedalusHelm.cs | 2 +- Items/Armor/DaedalusHelmet.cs | 2 +- Items/Armor/DaedalusLeggings.cs | 2 +- Items/Armor/DaedalusVisor.cs | 12 +- Items/Armor/DemonshadeBreastplate.cs | 4 +- Items/Armor/DemonshadeGreaves.cs | 4 +- Items/Armor/DemonshadeHelm.cs | 4 +- Items/Armor/GodSlayerChestplate.cs | 4 +- Items/Armor/GodSlayerHelm.cs | 4 +- Items/Armor/GodSlayerHelmet.cs | 4 +- Items/Armor/GodSlayerHornedHelm.cs | 4 +- Items/Armor/GodSlayerLeggings.cs | 2 +- Items/Armor/GodSlayerMask.cs | 8 +- Items/Armor/GodSlayerVisage.cs | 4 +- Items/Armor/MolluskShellmet.cs | 2 +- Items/Armor/OmegaBlueChestplate.cs | 2 +- Items/Armor/OmegaBlueHelmet.cs | 4 +- Items/Armor/OmegaBlueLeggings.cs | 2 +- Items/Armor/ReaverCap.cs | 12 +- Items/Armor/ReaverCuisses.cs | 2 +- Items/Armor/ReaverHelm.cs | 2 +- Items/Armor/ReaverHelmet.cs | 2 +- Items/Armor/ReaverMask.cs | 2 +- Items/Armor/ReaverVisage.cs | 2 +- Items/Armor/ShroomiteVisage.cs | 4 +- Items/Armor/SilvaArmor.cs | 2 +- Items/Armor/SilvaHelm.cs | 4 +- Items/Armor/SilvaHelmet.cs | 4 +- Items/Armor/SilvaHornedHelm.cs | 4 +- Items/Armor/SilvaLeggings.cs | 2 +- Items/Armor/SilvaMask.cs | 8 +- Items/Armor/SilvaMaskedCap.cs | 4 +- Items/Armor/StatigelArmor.cs | 2 +- Items/Armor/StatigelCap.cs | 2 +- Items/Armor/StatigelHeadgear.cs | 2 +- Items/Armor/StatigelHelm.cs | 2 +- Items/Armor/StatigelHood.cs | 2 +- Items/Armor/StatigelMask.cs | 10 +- Items/Armor/TarragonBreastplate.cs | 2 +- Items/Armor/TarragonHelm.cs | 4 +- Items/Armor/TarragonHelmet.cs | 8 +- Items/Armor/TarragonHornedHelm.cs | 4 +- Items/Armor/TarragonLeggings.cs | 2 +- Items/Armor/TarragonMask.cs | 4 +- Items/Armor/TarragonVisage.cs | 4 +- Items/Armor/VictideBreastplate.cs | 2 +- Items/Armor/VictideHeadgear.cs | 6 +- Items/Armor/VictideHelm.cs | 2 +- Items/Armor/VictideHelmet.cs | 2 +- Items/Armor/VictideMask.cs | 2 +- Items/Armor/VictideVisage.cs | 2 +- Items/Armor/WulfrumArmor.cs | 2 +- Items/Armor/WulfrumMask.cs | 4 +- Items/Armor/XerocCuisses.cs | 4 +- Items/Armor/XerocMask.cs | 12 +- Items/Armor/XerocPlateMail.cs | 4 +- Items/BrimstoneWaifu/CharredIdol.cs | 2 +- Items/BrimstoneWaifu/RoseStone.cs | 4 +- Items/Bumblefuck/EffulgentFeather.cs | 2 +- Items/Calamitas/CalamityRing.cs | 4 +- .../AccretionDisk.cs | 4 +- .../AdamantiteThrowingAxe.cs | 2 +- .../BallisticPoisonBomb.cs | 2 +- .../BlastBarrel.cs | 6 +- .../BloodsoakedCrasher.cs | 8 +- .../BouncingEyeball.cs | 6 +- .../BrackishFlask.cs | 2 +- .../CalamityCustomThrowingDamage/Brimblade.cs | 2 +- .../CalamityDamageItem.cs | 8 +- .../CelestialReaper.cs | 6 +- .../CalamityCustomThrowingDamage/Celestus.cs | 4 +- .../CalamityCustomThrowingDamage/Cinquedea.cs | 6 +- .../CobaltKunai.cs | 2 +- .../ConsecratedWater.cs | 6 +- .../CosmicKunai.cs | 4 +- .../CraniumSmasher.cs | 2 +- .../CrushsawCrasher.cs | 2 +- .../CrystalPiercer.cs | 2 +- .../Crystalline.cs | 2 +- .../CursedDagger.cs | 2 +- .../DuststormInABottle.cs | 2 +- .../EclipsesFall.cs | 8 +- .../EmpyreanKnivesThrown.cs | 4 +- .../Eradicator.cs | 4 +- .../ExecutionersBlade.cs | 4 +- .../FeatherKnife.cs | 2 +- .../FlameScythe.cs | 2 +- .../FrostyFlare.cs | 2 +- .../GalaxySmasherRogue.cs | 6 +- Items/CalamityCustomThrowingDamage/GelDart.cs | 2 +- .../GhoulishGouger.cs | 4 +- Items/CalamityCustomThrowingDamage/Glaive.cs | 8 +- .../HeavenfallenStardisk.cs | 2 +- Items/CalamityCustomThrowingDamage/IceStar.cs | 2 +- .../Icebreaker.cs | 2 +- .../IchorSpear.cs | 2 +- .../IronFrancisca.cs | 4 +- Items/CalamityCustomThrowingDamage/Kylie.cs | 6 +- .../LeadTomahawk.cs | 4 +- .../CalamityCustomThrowingDamage/Lionfish.cs | 2 +- .../CalamityCustomThrowingDamage/Malachite.cs | 4 +- .../MangroveChakram.cs | 2 +- .../MeteorFist.cs | 2 +- .../MoltenAmputator.cs | 4 +- .../MonkeyDarts.cs | 11 +- .../CalamityCustomThrowingDamage/Mycoroot.cs | 2 +- .../MythrilKnife.cs | 2 +- .../NanoblackReaperRogue.cs | 6 +- .../OrichalcumSpikedGemstone.cs | 2 +- .../PalladiumJavelin.cs | 2 +- .../Patreon/CorpusAvertor.cs | 6 +- .../Patreon/DeepSeaDumbbell.cs | 6 +- .../Patreon/KelvinCatalyst.cs | 4 +- .../Patreon/Plaguenade.cs | 4 +- .../Patreon/TimeBolt.cs | 4 +- .../Prismalline.cs | 2 +- .../ProfanedTrident.cs | 4 +- .../Pwnagehammer.cs | 2 +- .../RadiantStar.cs | 2 +- .../RareVariants/DuneHopper.cs | 4 +- .../RareVariants/Quasar.cs | 4 +- .../RareVariants/SpearofDestiny.cs | 4 +- .../RareVariants/TheReaper.cs | 4 +- Items/CalamityCustomThrowingDamage/RotBall.cs | 2 +- .../RoyalKnives.cs | 4 +- .../SandDollar.cs | 2 +- .../ScarletDevil.cs | 4 +- .../ScourgeoftheCosmosThrown.cs | 4 +- .../ScourgeoftheDesert.cs | 2 +- .../ScourgeoftheSeas.cs | 6 +- .../SeafoamBomb.cs | 2 +- .../SeashellBoomerang.cs | 2 +- .../ShatteredSun.cs | 4 +- .../CalamityCustomThrowingDamage/SnapClam.cs | 2 +- .../SpearofPaleolith.cs | 2 +- .../StellarContemptRogue.cs | 6 +- .../StellarKnife.cs | 2 +- .../StormfrontRazor.cs | 6 +- .../TarragonThrowingDart.cs | 4 +- .../ThrowingBrick.cs | 6 +- .../TitaniumShuriken.cs | 2 +- .../CalamityCustomThrowingDamage/ToothBall.cs | 2 +- ...TriactisTruePaladinianMageHammerofMight.cs | 4 +- .../TruePaladinsHammer.cs | 2 +- .../UrchinStinger.cs | 2 +- .../UtensilPoker.cs | 8 +- .../Valediction.cs | 4 +- .../WulfrumKnife.cs | 2 +- .../XerocPitchfork.cs | 2 +- Items/CalamityGlobalItem.cs | 96 ++++----- Items/Crabulon/FungalClump.cs | 4 +- Items/Cryogen/SoulofCryogen.cs | 2 +- Items/DevourerMunsters/ArmoredShell.cs | 2 +- Items/DevourerMunsters/DarkPlasma.cs | 2 +- Items/DevourerMunsters/RuneofCos.cs | 2 +- Items/DevourerMunsters/TwistingNether.cs | 2 +- Items/Fishing/AstralCrate.cs | 6 +- Items/Fishing/UrsaSergeant.cs | 2 +- Items/HiveMind/RottenBrain.cs | 2 +- Items/LoreItems/KnowledgeAquaticScourge.cs | 2 +- Items/LoreItems/KnowledgeAstrumAureus.cs | 2 +- Items/LoreItems/KnowledgeAstrumDeus.cs | 2 +- .../LoreItems/KnowledgeBrimstoneElemental.cs | 2 +- Items/LoreItems/KnowledgeBumblebirb.cs | 2 +- Items/LoreItems/KnowledgeCalamitas.cs | 4 +- Items/LoreItems/KnowledgeCalamitasClone.cs | 2 +- Items/LoreItems/KnowledgeCryogen.cs | 2 +- Items/LoreItems/KnowledgeDesertScourge.cs | 4 +- Items/LoreItems/KnowledgeDestroyer.cs | 2 +- Items/LoreItems/KnowledgeDevourerofGods.cs | 4 +- Items/LoreItems/KnowledgeDukeFishron.cs | 2 +- Items/LoreItems/KnowledgeEaterofWorlds.cs | 2 +- Items/LoreItems/KnowledgeGolem.cs | 2 +- Items/LoreItems/KnowledgeHiveMind.cs | 2 +- Items/LoreItems/KnowledgeLeviathanandSiren.cs | 2 +- Items/LoreItems/KnowledgeLunaticCultist.cs | 2 +- Items/LoreItems/KnowledgeMoonLord.cs | 2 +- Items/LoreItems/KnowledgePerforators.cs | 2 +- .../KnowledgePlaguebringerGoliath.cs | 2 +- Items/LoreItems/KnowledgePlantera.cs | 2 +- Items/LoreItems/KnowledgePolterghast.cs | 4 +- Items/LoreItems/KnowledgeProfanedGuardians.cs | 2 +- Items/LoreItems/KnowledgeProvidence.cs | 4 +- Items/LoreItems/KnowledgeQueenBee.cs | 2 +- Items/LoreItems/KnowledgeRavager.cs | 2 +- Items/LoreItems/KnowledgeSentinels.cs | 2 +- Items/LoreItems/KnowledgeSkeletron.cs | 2 +- Items/LoreItems/KnowledgeSkeletronPrime.cs | 2 +- Items/LoreItems/KnowledgeWallofFlesh.cs | 2 +- Items/LoreItems/KnowledgeYharon.cs | 4 +- Items/Materials/Bloodstone.cs | 2 +- Items/Materials/BloodstoneCore.cs | 2 +- Items/Materials/CalamitousEssence.cs | 2 +- Items/Materials/DarksunFragment.cs | 2 +- Items/Materials/EndothermicEnergy.cs | 2 +- Items/Materials/HellcasterFragment.cs | 2 +- Items/Materials/NightmareFuel.cs | 2 +- Items/Materials/Phantoplasm.cs | 2 +- Items/Materials/ShadowspecBar.cs | 2 +- Items/Materials/UeliaceBar.cs | 2 +- Items/Mounts/Fab.cs | 2 +- Items/Mounts/OnyxExcavator.cs | 2 +- Items/Patreon/AngelicShotgun.cs | 2 +- Items/Patreon/ApronOfAffection.cs | 2 +- Items/Patreon/Ataraxia.cs | 2 +- Items/Patreon/BloodyVein.cs | 2 +- Items/Patreon/CorpusAvertorMelee.cs | 2 +- Items/Patreon/DarkSpark.cs | 2 +- Items/Patreon/DevilsSunrise.cs | 2 +- Items/Patreon/DivineRetribution.cs | 2 +- Items/Patreon/DodusHandcannon.cs | 2 +- Items/Patreon/DragonPow.cs | 2 +- Items/Patreon/FaceMelter.cs | 2 +- Items/Patreon/ForgottenDragonEgg.cs | 2 +- Items/Patreon/GazeOfCrysthamyr.cs | 2 +- Items/Patreon/HandheldTank.cs | 2 +- Items/Patreon/Karasawa.cs | 2 +- Items/Patreon/Keelhaul.cs | 2 +- Items/Patreon/KelvinCatalystMelee.cs | 2 +- Items/Patreon/LightGodsBrilliance.cs | 2 +- Items/Patreon/MadAlchemistsCocktailGlove.cs | 2 +- Items/Patreon/Nadir.cs | 2 +- Items/Patreon/NormalityRelocator.cs | 4 +- Items/Patreon/Oracle.cs | 2 +- Items/Patreon/ProfanedSoulArtifact.cs | 4 +- Items/Patreon/ResurrectionButterfly.cs | 2 +- Items/Patreon/Roxcalibur.cs | 2 +- Items/Patreon/TheLastMourning.cs | 2 +- Items/Patreon/ThePack.cs | 2 +- Items/Patreon/YateveoBloom.cs | 2 +- Items/Perforator/BloodyWormTooth.cs | 2 +- Items/PermanentBoosters/BloodOrange.cs | 4 +- Items/PermanentBoosters/CometShard.cs | 4 +- Items/PermanentBoosters/Dragonfruit.cs | 6 +- Items/PermanentBoosters/Ectoheart.cs | 6 +- Items/PermanentBoosters/Elderberry.cs | 4 +- Items/PermanentBoosters/ElectrolyteGelPack.cs | 4 +- Items/PermanentBoosters/EtherealCore.cs | 4 +- Items/PermanentBoosters/InfernalBlood.cs | 4 +- Items/PermanentBoosters/MLGRune2.cs | 4 +- Items/PermanentBoosters/MiracleFruit.cs | 4 +- Items/PermanentBoosters/MushroomPlasmaRoot.cs | 4 +- Items/PermanentBoosters/PhantomHeart.cs | 6 +- .../RedLightningContainer.cs | 6 +- Items/PermanentBoosters/StarlightFuelCell.cs | 4 +- Items/Pets/CosmicPlushie.cs | 2 +- Items/Placeables/AuricOre.cs | 2 +- Items/Placeables/DraedonsForge.cs | 2 +- Items/PlaguebringerGoliath/BloomStone.cs | 2 +- Items/Polterghast/Affliction.cs | 2 +- Items/Polterghast/NecroplasmicBeacon.cs | 2 +- Items/Polterghast/RuinousSoul.cs | 2 +- Items/Potions/DraconicElixir.cs | 2 +- Items/Potions/OmegaHealingPotion.cs | 2 +- Items/Potions/RevivifyPotion.cs | 2 +- Items/Potions/SupremeHealingPotion.cs | 2 +- Items/Potions/SupremeManaPotion.cs | 2 +- Items/ProfanedGuardian/ProfanedShard.cs | 2 +- Items/Providence/DivineGeode.cs | 2 +- Items/Providence/ElysianAegis.cs | 4 +- Items/Providence/ElysianWings.cs | 4 +- Items/Providence/ProfanedCore.cs | 2 +- Items/Providence/ProfanedCoreUnlimited.cs | 2 +- Items/Providence/UnholyEssence.cs | 2 +- Items/Scavenger/BloodPact.cs | 2 +- Items/Scavenger/FleshTotem.cs | 2 +- Items/ShrineItems/FungalSymbiote.cs | 2 +- Items/ShrineItems/GladiatorsLocket.cs | 4 +- Items/ShrineItems/LuxorsGift.cs | 2 +- Items/ShrineItems/TrinketofChi.cs | 2 +- Items/ShrineItems/UnstablePrism.cs | 2 +- Items/SlimeGod/ManaOverloader.cs | 2 +- Items/SunkenSea/GiantPearl.cs | 2 +- Items/SupremeCalamitas/EyeofExtinction.cs | 2 +- Items/TheDevourerofGods/CosmicWorm.cs | 2 +- Items/TheDevourerofGods/CosmiliteBar.cs | 2 +- Items/TheDevourerofGods/DevourerofGodsBag.cs | 2 +- Items/TheDevourerofGods/NebulousCore.cs | 2 +- Items/Tools/BlossomPickaxe.cs | 2 +- Items/Tools/CrystylCrusher.cs | 2 +- Items/Tools/GallantPickaxe.cs | 2 +- Items/Weapons/AMR.cs | 2 +- Items/Weapons/AbyssWeapons/CalamarisLament.cs | 2 +- Items/Weapons/AbyssWeapons/EidolicWail.cs | 2 +- Items/Weapons/AbyssWeapons/SoulEdge.cs | 2 +- .../AbyssWeapons/SulphuricAcidCannon.cs | 2 +- Items/Weapons/AccretionDiskMelee.cs | 2 +- Items/Weapons/AegisBlade.cs | 2 +- Items/Weapons/AethersWhisper.cs | 2 +- Items/Weapons/Alluvion.cs | 4 +- Items/Weapons/AlphaRay.cs | 2 +- Items/Weapons/Animus.cs | 2 +- Items/Weapons/ApoctosisArray.cs | 2 +- Items/Weapons/Apotheosis.cs | 2 +- Items/Weapons/AquaticDissolution.cs | 2 +- Items/Weapons/ArkoftheAncients.cs | 2 +- Items/Weapons/ArkoftheCosmos.cs | 2 +- Items/Weapons/ArkoftheElements.cs | 2 +- Items/Weapons/ArterialAssault.cs | 2 +- Items/Weapons/AsteroidStaff.cs | 2 +- Items/Weapons/AuguroftheElements.cs | 2 +- Items/Weapons/Azathoth.cs | 2 +- Items/Weapons/BladedgeGreatbow.cs | 2 +- Items/Weapons/BloodfireArrow.cs | 2 +- Items/Weapons/BlossomFlux.cs | 2 +- Items/Weapons/BlushieStaff.cs | 2 +- Items/Weapons/BrinyBaron.cs | 2 +- Items/Weapons/Bumblebirb/GildedProboscis.cs | 2 +- Items/Weapons/Bumblebirb/GoldenEagle.cs | 2 +- Items/Weapons/Bumblebirb/RougeSlash.cs | 2 +- Items/Weapons/ClaretCannon.cs | 2 +- Items/Weapons/CleansingBlaze.cs | 2 +- Items/Weapons/Climax.cs | 2 +- Items/Weapons/ClockworkBow.cs | 2 +- Items/Weapons/CometQuasher.cs | 2 +- Items/Weapons/Contagion.cs | 2 +- Items/Weapons/CosmicDischarge.cs | 2 +- Items/Weapons/CosmicImmaterializer.cs | 4 +- Items/Weapons/Cosmilamp.cs | 2 +- Items/Weapons/Crabulon/HyphaeRod.cs | 2 +- Items/Weapons/Cryogen/GlacialCrusher.cs | 2 +- Items/Weapons/Devastation.cs | 2 +- Items/Weapons/DevilsDevastation.cs | 2 +- .../Weapons/DevourerofGods/DeathhailStaff.cs | 2 +- Items/Weapons/DevourerofGods/Deathwind.cs | 2 +- .../Weapons/DevourerofGods/EradicatorMelee.cs | 2 +- Items/Weapons/DevourerofGods/Excelsus.cs | 2 +- .../DevourerofGods/StaffoftheMechworm.cs | 2 +- .../Weapons/DevourerofGods/TheObliterator.cs | 2 +- Items/Weapons/DraconicDestruction.cs | 2 +- Items/Weapons/DraedonsExoblade.cs | 2 +- Items/Weapons/Drataliornus.cs | 2 +- Items/Weapons/Earth.cs | 2 +- Items/Weapons/Effervescence.cs | 2 +- Items/Weapons/ElementalAxe.cs | 2 +- Items/Weapons/ElementalBlaster.cs | 2 +- Items/Weapons/ElementalEruption.cs | 2 +- Items/Weapons/ElementalExcalibur.cs | 2 +- Items/Weapons/ElementalRay.cs | 2 +- Items/Weapons/ElementalShortsword.cs | 2 +- Items/Weapons/ElysianArrow.cs | 2 +- Items/Weapons/EmpyreanKnives.cs | 2 +- Items/Weapons/EnergyStaff.cs | 2 +- Items/Weapons/EssenceFlayer.cs | 2 +- Items/Weapons/Fabstaff.cs | 2 +- Items/Weapons/FiniteUse/Bazooka.cs | 10 +- Items/Weapons/FiniteUse/ElephantKiller.cs | 12 +- Items/Weapons/FiniteUse/Hydra.cs | 10 +- Items/Weapons/FiniteUse/LightningHawk.cs | 10 +- Items/Weapons/FiniteUse/Magnum.cs | 10 +- Items/Weapons/FirestormCannon.cs | 4 +- Items/Weapons/FlameburstShortsword.cs | 2 +- Items/Weapons/Floodtide.cs | 2 +- Items/Weapons/FourSeasonsGalaxia.cs | 2 +- Items/Weapons/GalacticaBlade.cs | 2 +- Items/Weapons/GalaxySmasherMelee.cs | 4 +- Items/Weapons/GammaFusillade.cs | 2 +- Items/Weapons/Genisis.cs | 2 +- Items/Weapons/Grax.cs | 2 +- Items/Weapons/GreatswordofBlah.cs | 2 +- Items/Weapons/GreatswordofJudgement.cs | 2 +- Items/Weapons/HalleysInferno.cs | 2 +- Items/Weapons/HeavenlyGale.cs | 2 +- Items/Weapons/HeliumFlash.cs | 2 +- Items/Weapons/InfernaCutter.cs | 2 +- Items/Weapons/Interfacer.cs | 2 +- Items/Weapons/Judgement.cs | 2 +- Items/Weapons/Lacerator.cs | 2 +- Items/Weapons/Leviathan/LureofEnthrallment.cs | 4 +- Items/Weapons/LifefruitScythe.cs | 2 +- Items/Weapons/LunicEye.cs | 2 +- Items/Weapons/MagneticMeltdown.cs | 2 +- Items/Weapons/MantisClaws.cs | 2 +- Items/Weapons/MarkedMagnum.cs | 2 +- Items/Weapons/Megafleet.cs | 2 +- Items/Weapons/Minigun.cs | 2 +- Items/Weapons/MirrorBlade.cs | 2 +- Items/Weapons/Mistlestorm.cs | 2 +- Items/Weapons/MolecularManipulator.cs | 2 +- Items/Weapons/Monsoon.cs | 2 +- Items/Weapons/Mourningstar.cs | 2 +- Items/Weapons/Murasama.cs | 2 +- Items/Weapons/NanoblackReaperMelee.cs | 4 +- Items/Weapons/NeptunesBounty.cs | 2 +- Items/Weapons/NettlelineGreatbow.cs | 2 +- Items/Weapons/NuclearFury.cs | 2 +- Items/Weapons/OmegaBiomeBlade.cs | 2 +- Items/Weapons/OnyxChainBlaster.cs | 2 +- Items/Weapons/Onyxia.cs | 2 +- Items/Weapons/Phangasm.cs | 2 +- Items/Weapons/PhantasmalFury.cs | 2 +- Items/Weapons/PhoenixBlade.cs | 2 +- Items/Weapons/Photoviscerator.cs | 2 +- Items/Weapons/PlagueKeeper.cs | 4 +- Items/Weapons/PlanetaryAnnihilation.cs | 2 +- Items/Weapons/PlasmaRifle.cs | 2 +- Items/Weapons/Polterghast/BansheeHook.cs | 2 +- Items/Weapons/Polterghast/DaemonsFlame.cs | 2 +- .../Weapons/Polterghast/EtherealSubjugator.cs | 2 +- Items/Weapons/Polterghast/FatesReveal.cs | 2 +- Items/Weapons/Polterghast/GhastlyVisage.cs | 2 +- Items/Weapons/Polterghast/TerrorBlade.cs | 2 +- Items/Weapons/PrimordialAncient.cs | 2 +- .../Weapons/Providence/BlissfulBombardier.cs | 2 +- Items/Weapons/Providence/HolyCollider.cs | 2 +- Items/Weapons/Providence/PurgeGuzzler.cs | 2 +- Items/Weapons/Providence/SolarFlare.cs | 2 +- Items/Weapons/Providence/TelluricGlare.cs | 2 +- Items/Weapons/RareVariants/Arbalest.cs | 2 +- Items/Weapons/RareVariants/Carnage.cs | 2 +- Items/Weapons/RareVariants/ClothiersWrath.cs | 4 +- Items/Weapons/RareVariants/Cryophobia.cs | 2 +- Items/Weapons/RareVariants/EvilSmasher.cs | 2 +- Items/Weapons/RareVariants/EyeofMagnus.cs | 2 +- Items/Weapons/RareVariants/GrandDad.cs | 2 +- Items/Weapons/RareVariants/Hellborn.cs | 2 +- Items/Weapons/RareVariants/Infinity.cs | 2 +- Items/Weapons/RareVariants/LeadWizard.cs | 2 +- Items/Weapons/RareVariants/Norfleet.cs | 2 +- Items/Weapons/RareVariants/PearlGod.cs | 2 +- Items/Weapons/RareVariants/Skullmasher.cs | 2 +- Items/Weapons/RareVariants/Swordsplosion.cs | 2 +- Items/Weapons/RareVariants/ThornBlossom.cs | 2 +- Items/Weapons/RareVariants/Thunderstorm.cs | 2 +- .../RareVariants/TrueConferenceCall.cs | 2 +- Items/Weapons/RareVariants/VoidVortex.cs | 2 +- Items/Weapons/RedSun.cs | 2 +- Items/Weapons/RoyalKnivesMelee.cs | 2 +- Items/Weapons/SDFMG.cs | 2 +- Items/Weapons/SHPC.cs | 2 +- Items/Weapons/SanguineFlare.cs | 2 +- Items/Weapons/ScourgeoftheCosmos.cs | 2 +- Items/Weapons/Seadragon.cs | 2 +- Items/Weapons/ShadowboltStaff.cs | 2 +- Items/Weapons/Shredder.cs | 2 +- Items/Weapons/SlimeGod/Goobow.cs | 2 +- Items/Weapons/SolsticeClaymore.cs | 2 +- Items/Weapons/SomaPrime.cs | 2 +- Items/Weapons/SoulPiercer.cs | 2 +- Items/Weapons/SpatialLance.cs | 2 +- Items/Weapons/SpectralstormCannon.cs | 4 +- Items/Weapons/SpectreRifle.cs | 2 +- Items/Weapons/SporeKnife.cs | 2 +- Items/Weapons/Spyker.cs | 2 +- Items/Weapons/StarCannonEX.cs | 2 +- Items/Weapons/Starfleet.cs | 2 +- Items/Weapons/StarfleetMK2.cs | 2 +- Items/Weapons/StellarContemptMelee.cs | 4 +- Items/Weapons/StellarStriker.cs | 4 +- Items/Weapons/StormDragoon.cs | 2 +- Items/Weapons/StreamGouge.cs | 2 +- Items/Weapons/SubsumingVortex.cs | 2 +- Items/Weapons/Svantechnical.cs | 2 +- Items/Weapons/T1000.cs | 2 +- Items/Weapons/TheEnforcer.cs | 2 +- Items/Weapons/TheMutilator.cs | 2 +- Items/Weapons/TheStorm.cs | 2 +- Items/Weapons/TheSwarmer.cs | 4 +- Items/Weapons/TheWand.cs | 2 +- ...tisTruePaladinianMageHammerofMightMelee.cs | 2 +- Items/Weapons/Trinity.cs | 2 +- Items/Weapons/TrueArkoftheAncients.cs | 2 +- Items/Weapons/TrueTyrantYharimsUltisword.cs | 2 +- Items/Weapons/UltraLiquidator.cs | 2 +- Items/Weapons/VanquisherArrow.cs | 2 +- Items/Weapons/VenusianTrident.cs | 2 +- Items/Weapons/Verdant.cs | 2 +- Items/Weapons/Vesuvius.cs | 2 +- Items/Weapons/Viscera.cs | 2 +- Items/Weapons/VividClarity.cs | 2 +- Items/Weapons/YharimsCrystal.cs | 2 +- Items/Weapons/Yharon/AngryChickenStaff.cs | 2 +- Items/Weapons/Yharon/ChickenCannon.cs | 2 +- Items/Weapons/Yharon/DragonRage.cs | 2 +- Items/Weapons/Yharon/DragonsBreath.cs | 2 +- Items/Weapons/Yharon/PhoenixFlameBarrage.cs | 2 +- Items/Weapons/Yharon/TheBurningSky.cs | 2 +- Items/Yharon/ChickenEgg.cs | 2 +- NPCs/AbyssNPCs/AquaticScourgeBody.cs | 2 +- NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs | 2 +- NPCs/AbyssNPCs/AquaticScourgeHead.cs | 6 +- NPCs/AbyssNPCs/AquaticScourgeTail.cs | 2 +- NPCs/AbyssNPCs/AquaticSeekerHead.cs | 2 +- NPCs/AbyssNPCs/AquaticUrchin.cs | 2 +- NPCs/AbyssNPCs/Bloatfish.cs | 2 +- NPCs/AbyssNPCs/BobbitWormHead.cs | 4 +- NPCs/AbyssNPCs/BobbitWormSegment.cs | 2 +- NPCs/AbyssNPCs/BoxJellyfish.cs | 4 +- NPCs/AbyssNPCs/Catfish.cs | 2 +- NPCs/AbyssNPCs/ChaoticPuffer.cs | 2 +- NPCs/AbyssNPCs/ColossalSquid.cs | 6 +- NPCs/AbyssNPCs/Cuttlefish.cs | 4 +- NPCs/AbyssNPCs/DevilFish.cs | 4 +- NPCs/AbyssNPCs/EidolonWyrmHead.cs | 8 +- NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs | 2 +- NPCs/AbyssNPCs/Flounder.cs | 2 +- NPCs/AbyssNPCs/Frogfish.cs | 2 +- NPCs/AbyssNPCs/GiantSquid.cs | 6 +- NPCs/AbyssNPCs/Gnasher.cs | 4 +- NPCs/AbyssNPCs/GulperEelHead.cs | 6 +- NPCs/AbyssNPCs/Laserfish.cs | 6 +- NPCs/AbyssNPCs/LuminousCorvina.cs | 2 +- NPCs/AbyssNPCs/MantisShrimp.cs | 4 +- NPCs/AbyssNPCs/Mauler.cs | 4 +- NPCs/AbyssNPCs/MirageJelly.cs | 2 +- NPCs/AbyssNPCs/MorayEel.cs | 6 +- NPCs/AbyssNPCs/OarfishHead.cs | 8 +- NPCs/AbyssNPCs/Reaper.cs | 6 +- NPCs/AbyssNPCs/SeaUrchin.cs | 2 +- NPCs/AbyssNPCs/ToxicMinnow.cs | 6 +- NPCs/AbyssNPCs/Trasher.cs | 2 +- NPCs/AbyssNPCs/Viperfish.cs | 6 +- NPCs/Astrageldon/Astrageldon.cs | 2 +- NPCs/AstralBiomeNPCs/Aries.cs | 2 +- NPCs/AstralBiomeNPCs/AstralProbe.cs | 4 +- NPCs/AstralBiomeNPCs/AstralachneaGround.cs | 2 +- NPCs/AstralBiomeNPCs/AstralachneaWall.cs | 2 +- NPCs/AstralBiomeNPCs/Atlas.cs | 2 +- NPCs/AstralBiomeNPCs/BigSightseer.cs | 2 +- NPCs/AstralBiomeNPCs/FusionFeeder.cs | 2 +- NPCs/AstralBiomeNPCs/Hadarian.cs | 2 +- NPCs/AstralBiomeNPCs/Hive.cs | 2 +- NPCs/AstralBiomeNPCs/Mantis.cs | 2 +- NPCs/AstralBiomeNPCs/Nova.cs | 2 +- NPCs/AstralBiomeNPCs/SmallSightseer.cs | 2 +- NPCs/AstralBiomeNPCs/StellarCulex.cs | 2 +- NPCs/AstrumDeus/AstrumDeusBody.cs | 2 +- NPCs/AstrumDeus/AstrumDeusHead.cs | 6 +- NPCs/AstrumDeus/AstrumDeusProbe3.cs | 2 +- NPCs/AstrumDeus/AstrumDeusTail.cs | 2 +- NPCs/BrimstoneWaifu/Brimling.cs | 4 +- NPCs/BrimstoneWaifu/BrimstoneElemental.cs | 6 +- NPCs/Calamitas/Calamitas.cs | 2 +- NPCs/Calamitas/CalamitasRun.cs | 6 +- NPCs/Calamitas/CalamitasRun2.cs | 6 +- NPCs/Calamitas/CalamitasRun3.cs | 6 +- NPCs/Calamitas/SoulSeeker.cs | 2 +- NPCs/CalamityAI.cs | 6 +- NPCs/CalamityBiomeNPCs/CultistAssassin.cs | 2 +- NPCs/CalamityBiomeNPCs/DespairStone.cs | 4 +- NPCs/CalamityBiomeNPCs/Scryllar.cs | 2 +- NPCs/CalamityBiomeNPCs/ScryllarRage.cs | 2 +- NPCs/CalamityBiomeNPCs/SoulSlurper.cs | 4 +- NPCs/CalamityGlobalAI.cs | 40 ++-- NPCs/CalamityGlobalNPC.cs | 96 ++++----- NPCs/CalamityGlobalNPCLoot.cs | 6 +- NPCs/CeaselessVoid/CeaselessVoid.cs | 2 +- NPCs/CosmicWraith/CosmicWraith.cs | 4 +- NPCs/Crabulon/CrabulonIdle.cs | 4 +- NPCs/Cryogen/Cryogen.cs | 2 +- NPCs/Cryogen/CryogenIce.cs | 2 +- NPCs/DesertScourge/DesertScourgeBody.cs | 4 +- NPCs/DesertScourge/DesertScourgeHead.cs | 4 +- NPCs/DesertScourge/DesertScourgeTail.cs | 2 +- NPCs/GreatSandShark/GreatSandShark.cs | 2 +- NPCs/HiveMind/HiveMind.cs | 2 +- NPCs/Leviathan/Leviathan.cs | 8 +- NPCs/Leviathan/LeviathanStart.cs | 2 +- NPCs/Leviathan/Siren.cs | 6 +- NPCs/Leviathan/SirenIce.cs | 2 +- NPCs/NormalNPCs/AeroSlime.cs | 4 +- NPCs/NormalNPCs/AngryDog.cs | 2 +- NPCs/NormalNPCs/ArmoredDiggerBody.cs | 2 +- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 2 +- NPCs/NormalNPCs/ArmoredDiggerTail.cs | 2 +- NPCs/NormalNPCs/BlightedEye.cs | 2 +- NPCs/NormalNPCs/BloomSlime.cs | 4 +- NPCs/NormalNPCs/CalamityEye.cs | 2 +- NPCs/NormalNPCs/Cnidrion.cs | 4 +- NPCs/NormalNPCs/CosmicElemental.cs | 2 +- NPCs/NormalNPCs/CrawlerAmber.cs | 2 +- NPCs/NormalNPCs/CrawlerAmethyst.cs | 2 +- NPCs/NormalNPCs/CrawlerCrystal.cs | 2 +- NPCs/NormalNPCs/CrawlerDiamond.cs | 2 +- NPCs/NormalNPCs/CrawlerEmerald.cs | 2 +- NPCs/NormalNPCs/CrawlerRuby.cs | 2 +- NPCs/NormalNPCs/CrawlerSapphire.cs | 2 +- NPCs/NormalNPCs/CrawlerTopaz.cs | 2 +- NPCs/NormalNPCs/CrimulanBlightSlime.cs | 2 +- NPCs/NormalNPCs/CryoSlime.cs | 4 +- NPCs/NormalNPCs/Cryon.cs | 4 +- NPCs/NormalNPCs/EbonianBlightSlime.cs | 2 +- NPCs/NormalNPCs/Eidolist.cs | 2 +- NPCs/NormalNPCs/FearlessGoldfishWarrior.cs | 2 +- NPCs/NormalNPCs/Horse.cs | 6 +- NPCs/NormalNPCs/IceClasper.cs | 2 +- NPCs/NormalNPCs/IrradiatedSlime.cs | 2 +- NPCs/NormalNPCs/KingSlimeJewel.cs | 2 +- NPCs/NormalNPCs/OverloadedSoldier.cs | 6 +- NPCs/NormalNPCs/PerennialSlime.cs | 4 +- NPCs/NormalNPCs/PhantomDebris.cs | 6 +- NPCs/NormalNPCs/Piggy.cs | 2 +- NPCs/NormalNPCs/Pitbull.cs | 2 +- NPCs/NormalNPCs/PlagueBee.cs | 2 +- NPCs/NormalNPCs/PlagueBeeLarge.cs | 2 +- NPCs/NormalNPCs/PlaguedDerpling.cs | 2 +- NPCs/NormalNPCs/PlaguedFlyingFox.cs | 2 +- NPCs/NormalNPCs/PlaguedJungleSlime.cs | 4 +- NPCs/NormalNPCs/PlaguedTortoise.cs | 2 +- NPCs/NormalNPCs/ProfanedEnergyBody.cs | 2 +- NPCs/NormalNPCs/SandTortoise.cs | 4 +- NPCs/NormalNPCs/ScornEater.cs | 2 +- NPCs/NormalNPCs/ShockstormShuttle.cs | 2 +- NPCs/NormalNPCs/StormlionCharger.cs | 2 +- NPCs/NormalNPCs/SunBat.cs | 4 +- NPCs/NormalNPCs/ThiccWaifu.cs | 2 +- NPCs/NormalNPCs/WulfrumDrone.cs | 2 +- NPCs/NormalNPCs/WulfrumSlime.cs | 2 +- .../PlaguebringerGoliath.cs | 12 +- NPCs/PlaguebringerShade/PlaguebringerShade.cs | 2 +- NPCs/Polterghast/Polterghast.cs | 24 +-- .../ProfanedGuardianBoss.cs | 2 +- .../ProfanedGuardianBoss2.cs | 2 +- .../ProfanedGuardianBoss3.cs | 2 +- NPCs/Providence/ProvSpawnDefense.cs | 2 +- NPCs/Providence/ProvSpawnHealer.cs | 2 +- NPCs/Providence/ProvSpawnOffense.cs | 2 +- NPCs/Providence/Providence.cs | 14 +- NPCs/Scavenger/ScavengerBody.cs | 12 +- NPCs/Scavenger/ScavengerClawLeft.cs | 2 +- NPCs/Scavenger/ScavengerClawRight.cs | 2 +- NPCs/Scavenger/ScavengerHead.cs | 2 +- NPCs/Scavenger/ScavengerLegLeft.cs | 2 +- NPCs/Scavenger/ScavengerLegRight.cs | 2 +- NPCs/SlimeGod/SlimeGodCore.cs | 6 +- NPCs/StormWeaver/StasisProbe.cs | 2 +- NPCs/StormWeaver/StormWeaverHead.cs | 2 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 2 +- NPCs/SunkenSeaNPCs/BlindedAngler.cs | 4 +- NPCs/SunkenSeaNPCs/Clam.cs | 6 +- NPCs/SunkenSeaNPCs/EutrophicRay.cs | 4 +- NPCs/SunkenSeaNPCs/GhostBell.cs | 2 +- NPCs/SunkenSeaNPCs/GhostBellSmall.cs | 2 +- NPCs/SunkenSeaNPCs/GiantClam.cs | 4 +- NPCs/SunkenSeaNPCs/PrismTurtle.cs | 4 +- NPCs/SunkenSeaNPCs/SeaFloaty.cs | 2 +- NPCs/SunkenSeaNPCs/SeaMinnow.cs | 2 +- NPCs/SunkenSeaNPCs/SeaSerpent1.cs | 4 +- NPCs/SupremeCalamitas/SoulSeekerSupreme.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 34 ++-- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 2 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsBody.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsBody2.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs | 2 +- NPCs/Yharon/Yharon.cs | 12 +- Projectiles/Amidias/HermitCrab.cs | 12 +- Projectiles/Amidias/SandDollarProj.cs | 2 +- Projectiles/Amidias/SnapClamProj.cs | 2 +- Projectiles/Amidias/UrchinBall.cs | 2 +- Projectiles/Astral/HeavenfallenEnergy.cs | 2 +- Projectiles/Astral/HeavenfallenStardisk.cs | 2 +- Projectiles/Astral/Hive.cs | 10 +- Projectiles/Astral/Quasar.cs | 2 +- Projectiles/Astral/Quasar2.cs | 2 +- Projectiles/Astral/RadiantExplosion.cs | 2 +- Projectiles/Astral/RadiantStar.cs | 2 +- Projectiles/Astral/RadiantStar2.cs | 2 +- Projectiles/Astral/StellarKnife.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 94 ++++----- Projectiles/Healing/FungalHeal.cs | 2 +- Projectiles/Magic/AetherBeam.cs | 2 +- Projectiles/Magic/HolyLaser.cs | 2 +- Projectiles/Magic/SolarBeam2.cs | 2 +- Projectiles/Melee/CosmicDischarge.cs | 2 +- Projectiles/Melee/Cyclone.cs | 2 +- .../Melee/EradicatorMeleeProjectile.cs | 2 +- .../Melee/FlameScytheProjectileMelee.cs | 2 +- Projectiles/Melee/Galaxia.cs | 24 +-- Projectiles/Melee/Galaxia2.cs | 24 +-- Projectiles/Melee/IceBombFriendly.cs | 4 +- Projectiles/Melee/Icebreaker.cs | 2 +- Projectiles/Melee/LaserFountain.cs | 2 +- Projectiles/Melee/Mourningstar.cs | 2 +- Projectiles/Melee/Murasama.cs | 2 +- Projectiles/Melee/Nebulash.cs | 2 +- Projectiles/Melee/OPHammerMelee.cs | 2 +- Projectiles/Melee/ScourgeoftheCosmos.cs | 2 +- Projectiles/Melee/ScourgeoftheCosmosMini.cs | 2 +- Projectiles/Melee/Spears/AstralPike.cs | 4 +- Projectiles/Melee/Spears/Brimlance.cs | 2 +- Projectiles/Melee/Spears/DiseasedPike.cs | 2 +- Projectiles/Melee/Spears/EarthenPike.cs | 2 +- .../Spears/ExsanguinationLanceProjectile.cs | 4 +- .../Melee/Spears/FulgurationHalberd.cs | 2 +- Projectiles/Melee/Spears/GildedProboscis.cs | 2 +- .../Melee/Spears/HeartRapierProjectile.cs | 2 +- .../Melee/Spears/MarniteSpearProjectile.cs | 2 +- Projectiles/Melee/Spears/SausageMaker.cs | 2 +- Projectiles/Melee/Tumbleweed.cs | 2 +- Projectiles/Melee/Yoyos/ChaotrixProjectile.cs | 2 +- .../Melee/Yoyos/CnidarianProjectile.cs | 2 +- Projectiles/Melee/Yoyos/QuagmireProjectile.cs | 6 +- .../Melee/Yoyos/ShimmersparkProjectile.cs | 2 +- Projectiles/Melee/Yoyos/SolarFlareYoyo.cs | 2 +- .../Melee/Yoyos/TheGodsGambitProjectile.cs | 2 +- Projectiles/Melee/Yoyos/TheObliterator.cs | 2 +- Projectiles/Melee/Yoyos/VerdantProjectile.cs | 2 +- Projectiles/Patreon/Akato.cs | 2 +- Projectiles/Patreon/CorpusAvertor.cs | 2 +- Projectiles/Patreon/CorpusAvertorClone.cs | 2 +- Projectiles/Patreon/DeepSeaDumbbell1.cs | 2 +- Projectiles/Patreon/DeepSeaDumbbell2.cs | 2 +- Projectiles/Patreon/DeepSeaDumbbell3.cs | 2 +- Projectiles/Patreon/DeepSeaDumbbellWeight.cs | 2 +- Projectiles/Patreon/DevilsSunrise.cs | 4 +- Projectiles/Patreon/DevilsSunriseCyclone.cs | 4 +- Projectiles/Patreon/KelvinCatalyst.cs | 2 +- Projectiles/Patreon/MiniGuardianAttack.cs | 2 +- Projectiles/Patreon/MiniGuardianDefense.cs | 2 +- Projectiles/Patreon/MiniGuardianHealer.cs | 2 +- Projectiles/Patreon/PerforaMini.cs | 2 +- Projectiles/Patreon/PinkButterfly.cs | 12 +- Projectiles/Patreon/PlagueBee.cs | 2 +- Projectiles/Patreon/Plaguenade.cs | 2 +- Projectiles/Patreon/PurpleButterfly.cs | 12 +- Projectiles/Patreon/TimeBolt.cs | 2 +- Projectiles/Patreon/YateveoBloom.cs | 2 +- Projectiles/Patreon/YateveoBloomSpear.cs | 2 +- Projectiles/Permafrost/FrostShardFriendly.cs | 2 +- Projectiles/Permafrost/FrostyFlare.cs | 2 +- Projectiles/Permafrost/IceSentry.cs | 10 +- Projectiles/Pets/Bear.cs | 2 +- Projectiles/Pets/Brimling.cs | 2 +- Projectiles/Pets/ChibiiDoggo.cs | 2 +- Projectiles/Pets/ChibiiDoggoFly.cs | 2 +- Projectiles/Pets/DannyDevito.cs | 2 +- Projectiles/Pets/Fox.cs | 2 +- Projectiles/Pets/Kendra.cs | 2 +- Projectiles/Pets/Levi.cs | 2 +- Projectiles/Pets/SirenYoung.cs | 2 +- Projectiles/Pets/ThirdSage.cs | 2 +- Projectiles/Ranged/BeeRPG.cs | 2 +- Projectiles/Ranged/DragonBurst.cs | 2 +- Projectiles/Ranged/DrataliornusFlame.cs | 2 +- Projectiles/Ranged/ExplodingStake.cs | 2 +- Projectiles/Ranged/GoliathRocket.cs | 2 +- Projectiles/Ranged/HiveBomb.cs | 2 +- Projectiles/Ranged/HiveMissile.cs | 2 +- Projectiles/Ranged/HolyFireBullet.cs | 2 +- Projectiles/Ranged/NebulaShot.cs | 4 +- Projectiles/Ranged/PlagueArrow.cs | 2 +- Projectiles/Ranged/StarfleetMK2.cs | 2 +- Projectiles/Rogue/AccretionDisk.cs | 2 +- Projectiles/Rogue/AccretionDisk2.cs | 2 +- .../Rogue/AdamantiteThrowingAxeProjectile.cs | 2 +- Projectiles/Rogue/BallisticPoisonBomb.cs | 2 +- Projectiles/Rogue/BallisticPoisonBombSpike.cs | 2 +- Projectiles/Rogue/BarrelShrapnel.cs | 2 +- Projectiles/Rogue/BlastBarrelProjectile.cs | 8 +- Projectiles/Rogue/BloodsoakedCrashax.cs | 4 +- .../Rogue/BouncingEyeballProjectile.cs | 2 +- .../BouncingEyeballProjectileStealthStrike.cs | 2 +- Projectiles/Rogue/BrackishFlask.cs | 2 +- Projectiles/Rogue/BrackishWater.cs | 2 +- Projectiles/Rogue/BrackishWaterBlast.cs | 2 +- Projectiles/Rogue/Brick.cs | 4 +- Projectiles/Rogue/BrickFragment.cs | 2 +- Projectiles/Rogue/Brimblade.cs | 2 +- Projectiles/Rogue/Brimblade2.cs | 2 +- Projectiles/Rogue/ButcherKnife.cs | 2 +- Projectiles/Rogue/CarvingFork.cs | 2 +- Projectiles/Rogue/Celestus.cs | 2 +- Projectiles/Rogue/Celestus2.cs | 2 +- Projectiles/Rogue/CinquedeaProj.cs | 2 +- Projectiles/Rogue/CobaltKunaiProjectile.cs | 2 +- Projectiles/Rogue/CosmicKunai.cs | 2 +- Projectiles/Rogue/CraniumSmasher.cs | 2 +- Projectiles/Rogue/CraniumSmasherExplosive.cs | 2 +- Projectiles/Rogue/Crushax.cs | 2 +- Projectiles/Rogue/CrystalPiercerProjectile.cs | 2 +- Projectiles/Rogue/Crystalline.cs | 2 +- Projectiles/Rogue/Crystalline2.cs | 2 +- Projectiles/Rogue/CursedDagger.cs | 2 +- Projectiles/Rogue/DuststormCloud.cs | 2 +- Projectiles/Rogue/DuststormInABottle.cs | 2 +- Projectiles/Rogue/EclipsesFallMain.cs | 2 +- Projectiles/Rogue/EclipsesSmol.cs | 2 +- Projectiles/Rogue/EclipsesStealth.cs | 2 +- Projectiles/Rogue/EmpyreanKnives.cs | 2 +- Projectiles/Rogue/EradicatorProjectile.cs | 4 +- Projectiles/Rogue/ExecutionersBlade.cs | 2 +- Projectiles/Rogue/FeatherKnifeProjectile.cs | 2 +- Projectiles/Rogue/FlameScytheProjectile.cs | 4 +- Projectiles/Rogue/Fork.cs | 2 +- Projectiles/Rogue/FossilShardThrown.cs | 2 +- Projectiles/Rogue/GelDartProjectile.cs | 2 +- Projectiles/Rogue/GhoulishGouger.cs | 2 +- Projectiles/Rogue/GlaiveProj.cs | 2 +- Projectiles/Rogue/IceStarProjectile.cs | 2 +- Projectiles/Rogue/IchorSpear.cs | 2 +- Projectiles/Rogue/IchorSpear2.cs | 2 +- Projectiles/Rogue/Knife.cs | 2 +- Projectiles/Rogue/Lionfish.cs | 2 +- Projectiles/Rogue/Malachite.cs | 2 +- Projectiles/Rogue/MalachiteBolt.cs | 2 +- .../Rogue/MangroveChakramProjectile.cs | 2 +- Projectiles/Rogue/MeteorFist.cs | 2 +- Projectiles/Rogue/MoltenAmputator.cs | 2 +- Projectiles/Rogue/MoltenBlobThrown.cs | 2 +- Projectiles/Rogue/MonkeyDart.cs | 4 +- Projectiles/Rogue/Mycoroot.cs | 2 +- Projectiles/Rogue/MythrilKnifeProjectile.cs | 2 +- Projectiles/Rogue/OPHammer.cs | 4 +- .../OrichalcumSpikedGemstoneProjectile.cs | 2 +- .../Rogue/PalladiumJavelinProjectile.cs | 2 +- Projectiles/Rogue/ProfanedTrident.cs | 2 +- Projectiles/Rogue/Pwnagehammer.cs | 2 +- Projectiles/Rogue/RotBallProjectile.cs | 2 +- Projectiles/Rogue/RoyalKnife.cs | 2 +- Projectiles/Rogue/ScarletBlast.cs | 2 +- Projectiles/Rogue/ScarletDevilBullet.cs | 2 +- Projectiles/Rogue/ScarletDevilProjectile.cs | 8 +- Projectiles/Rogue/ScourgeVenomCloud.cs | 2 +- Projectiles/Rogue/ScourgeoftheDesert.cs | 2 +- Projectiles/Rogue/ScourgeoftheDesert2.cs | 2 +- .../Rogue/ScourgeoftheSeasProjectile.cs | 2 +- Projectiles/Rogue/ScourgeoftheSeasStealth.cs | 2 +- .../Rogue/SeashellBoomerangProjectile.cs | 2 +- Projectiles/Rogue/ShatteredExplosion.cs | 2 +- Projectiles/Rogue/ShatteredSun.cs | 2 +- Projectiles/Rogue/ShatteredSun2.cs | 2 +- Projectiles/Rogue/ShatteredSun3.cs | 2 +- Projectiles/Rogue/SpearofPaleolith.cs | 2 +- Projectiles/Rogue/Stormfrontproj.cs | 2 +- Projectiles/Rogue/Stormfrontspark.cs | 2 +- .../Rogue/TarragonThrowingDartProjectile.cs | 2 +- .../Rogue/TitaniumShurikenProjectile.cs | 2 +- Projectiles/Rogue/ToothBallProjectile.cs | 2 +- Projectiles/Rogue/TriactisOPHammer.cs | 2 +- Projectiles/Rogue/UrchinStinger.cs | 2 +- Projectiles/Rogue/Valediction.cs | 2 +- Projectiles/Rogue/Valediction2.cs | 2 +- Projectiles/Rogue/WulfrumKnife.cs | 2 +- Projectiles/Rogue/XerocPitchforkProjectile.cs | 2 +- Projectiles/Shrines/GladiatorSword.cs | 2 +- Projectiles/Shrines/GladiatorSword2.cs | 2 +- Projectiles/Shrines/LuxorsGiftRogue.cs | 2 +- Projectiles/Shrines/LuxorsGiftSummon.cs | 12 +- Projectiles/Summon/AngryChicken.cs | 12 +- Projectiles/Summon/AquaticStar.cs | 12 +- Projectiles/Summon/BigBustyRose.cs | 14 +- Projectiles/Summon/BlackHawkSummon.cs | 10 +- Projectiles/Summon/BloodClotMinion.cs | 12 +- Projectiles/Summon/BrittleStar.cs | 12 +- Projectiles/Summon/Calamari.cs | 12 +- Projectiles/Summon/Calamitamini.cs | 12 +- Projectiles/Summon/Cataclymini.cs | 12 +- Projectiles/Summon/Catastromini.cs | 12 +- Projectiles/Summon/ChaosSpirit.cs | 12 +- Projectiles/Summon/CloudyWaifu.cs | 12 +- Projectiles/Summon/Corroslime.cs | 12 +- Projectiles/Summon/CosmicEnergy.cs | 12 +- Projectiles/Summon/Cosmilamp.cs | 12 +- Projectiles/Summon/Crimslime.cs | 12 +- Projectiles/Summon/DaedalusCrystal.cs | 12 +- Projectiles/Summon/DankCreeper.cs | 12 +- Projectiles/Summon/DreadmineTurret.cs | 10 +- Projectiles/Summon/DrewsSandyWaifu.cs | 12 +- Projectiles/Summon/ElementalAxe.cs | 12 +- Projectiles/Summon/FungalClump.cs | 12 +- Projectiles/Summon/GhostlyMine.cs | 10 +- Projectiles/Summon/Herring.cs | 12 +- Projectiles/Summon/IceClasper.cs | 12 +- Projectiles/Summon/MechwormBody.cs | 2 +- Projectiles/Summon/MechwormBody2.cs | 2 +- Projectiles/Summon/MechwormHead.cs | 2 +- Projectiles/Summon/MechwormTail.cs | 2 +- Projectiles/Summon/PhantomGuy.cs | 12 +- Projectiles/Summon/ProfanedEnergy.cs | 10 +- Projectiles/Summon/ReaverOrb.cs | 12 +- Projectiles/Summon/RedDevil.cs | 2 +- Projectiles/Summon/Sandnado.cs | 12 +- Projectiles/Summon/SandyWaifu.cs | 12 +- Projectiles/Summon/SilvaCrystal.cs | 12 +- Projectiles/Summon/SirenLure.cs | 12 +- Projectiles/Summon/SlimeGod.cs | 12 +- Projectiles/Summon/SlimeGodAlt.cs | 12 +- Projectiles/Summon/SolarGod.cs | 12 +- Projectiles/Summon/SolarPixie.cs | 12 +- Projectiles/Summon/Spikecrag.cs | 10 +- Projectiles/Summon/Urchin.cs | 12 +- Projectiles/Summon/Valkyrie.cs | 12 +- Projectiles/SunkenSea/ClamCrusherFlail.cs | 2 +- Projectiles/SunkenSea/Prismalline.cs | 2 +- Projectiles/SunkenSea/Prismalline2.cs | 2 +- Projectiles/SunkenSea/Prismalline3.cs | 2 +- Projectiles/SunkenSea/SeafoamBomb.cs | 2 +- Projectiles/SunkenSea/SeafoamBubble.cs | 2 +- Projectiles/SunkenSea/Shellfish.cs | 12 +- Projectiles/Typeless/AstralStar.cs | 2 +- Projectiles/Typeless/NanoblackMain.cs | 2 +- Projectiles/Typeless/StellarContemptHammer.cs | 2 +- Tiles/FurniturePlaguedPlate/PlagueInfuser.cs | 2 +- Tiles/FurnitureStatigel/StaticRefiner.cs | 2 +- Utilities/CalamityUtils.cs | 53 +++-- Waters/AbyssWater.cs | 2 +- Waters/AstralWater.cs | 2 +- Waters/SulphuricWater.cs | 2 +- Waters/SunkenSeaWater.cs | 2 +- World/CalamityWorld.cs | 24 +-- 1206 files changed, 2198 insertions(+), 2199 deletions(-) diff --git a/Buffs/Amidias/AmidiasBlessing.cs b/Buffs/Amidias/AmidiasBlessing.cs index 0522bdc277..8e559d721a 100644 --- a/Buffs/Amidias/AmidiasBlessing.cs +++ b/Buffs/Amidias/AmidiasBlessing.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.Amidias public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().amidiasBlessing = true; + player.Calamity().amidiasBlessing = true; player.breath = player.breathMax + 91; } } diff --git a/Buffs/Amidias/HermitCrab.cs b/Buffs/Amidias/HermitCrab.cs index a9b6ccd0b6..9d36e37aa3 100644 --- a/Buffs/Amidias/HermitCrab.cs +++ b/Buffs/Amidias/HermitCrab.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Amidias public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("HermitCrab")] > 0) { modPlayer.hCrab = true; diff --git a/Buffs/Amidias/SnapClamDebuff.cs b/Buffs/Amidias/SnapClamDebuff.cs index 9f94645cff..817d931bae 100644 --- a/Buffs/Amidias/SnapClamDebuff.cs +++ b/Buffs/Amidias/SnapClamDebuff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.Amidias public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).clamDebuff = true; + npc.Calamity().clamDebuff = true; } } } diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 12378258a7..253e917458 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Buffs { if (type == BuffID.Shine) { - player.GetCalamityPlayer().shine = true; + player.Calamity().shine = true; } else if (type == BuffID.IceBarrier) { @@ -23,11 +23,11 @@ namespace CalamityMod.Buffs } else if (type == BuffID.Rage) { - player.GetCalamityPlayer().throwingCrit += 10; + player.Calamity().throwingCrit += 10; } else if (type == BuffID.WellFed) { - player.GetCalamityPlayer().throwingCrit += 2; + player.Calamity().throwingCrit += 2; } else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3) { diff --git a/Buffs/DoTDebuffs/AbyssalFlames.cs b/Buffs/DoTDebuffs/AbyssalFlames.cs index 894a08bca7..593b96a958 100644 --- a/Buffs/DoTDebuffs/AbyssalFlames.cs +++ b/Buffs/DoTDebuffs/AbyssalFlames.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().aFlames = true; + player.Calamity().aFlames = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).aFlames = true; + npc.Calamity().aFlames = true; } } } diff --git a/Buffs/DoTDebuffs/AstralInfectionDebuff.cs b/Buffs/DoTDebuffs/AstralInfectionDebuff.cs index 4c373e65bb..c946b63eb6 100644 --- a/Buffs/DoTDebuffs/AstralInfectionDebuff.cs +++ b/Buffs/DoTDebuffs/AstralInfectionDebuff.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().astralInfection = true; + player.Calamity().astralInfection = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).astralInfection = true; + npc.Calamity().astralInfection = true; } } } diff --git a/Buffs/DoTDebuffs/BrimstoneFlames.cs b/Buffs/DoTDebuffs/BrimstoneFlames.cs index 5f93e3f89f..c9fbfdc180 100644 --- a/Buffs/DoTDebuffs/BrimstoneFlames.cs +++ b/Buffs/DoTDebuffs/BrimstoneFlames.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().bFlames = true; + player.Calamity().bFlames = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).bFlames = true; + npc.Calamity().bFlames = true; } } } diff --git a/Buffs/DoTDebuffs/BurningBlood.cs b/Buffs/DoTDebuffs/BurningBlood.cs index af4cea580b..ce9d82aa0e 100644 --- a/Buffs/DoTDebuffs/BurningBlood.cs +++ b/Buffs/DoTDebuffs/BurningBlood.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().bBlood = true; + player.Calamity().bBlood = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).bBlood = true; + npc.Calamity().bBlood = true; } } } diff --git a/Buffs/DoTDebuffs/CrushDepth.cs b/Buffs/DoTDebuffs/CrushDepth.cs index 4770373236..8a6c13f73b 100644 --- a/Buffs/DoTDebuffs/CrushDepth.cs +++ b/Buffs/DoTDebuffs/CrushDepth.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().cDepth = true; + player.Calamity().cDepth = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).cDepth = true; + npc.Calamity().cDepth = true; } } } diff --git a/Buffs/DoTDebuffs/DemonFlames.cs b/Buffs/DoTDebuffs/DemonFlames.cs index 2e24cd7169..9f7248fc26 100644 --- a/Buffs/DoTDebuffs/DemonFlames.cs +++ b/Buffs/DoTDebuffs/DemonFlames.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).dFlames = true; + npc.Calamity().dFlames = true; } } } diff --git a/Buffs/DoTDebuffs/GodSlayerInferno.cs b/Buffs/DoTDebuffs/GodSlayerInferno.cs index 3d7e001811..6c0d344e0f 100644 --- a/Buffs/DoTDebuffs/GodSlayerInferno.cs +++ b/Buffs/DoTDebuffs/GodSlayerInferno.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().gsInferno = true; + player.Calamity().gsInferno = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).gsInferno = true; + npc.Calamity().gsInferno = true; } } } diff --git a/Buffs/DoTDebuffs/HolyInferno.cs b/Buffs/DoTDebuffs/HolyInferno.cs index 4ff0c1bd4f..2e8788f880 100644 --- a/Buffs/DoTDebuffs/HolyInferno.cs +++ b/Buffs/DoTDebuffs/HolyInferno.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().hInferno = true; + player.Calamity().hInferno = true; } } } diff --git a/Buffs/DoTDebuffs/HolyLight.cs b/Buffs/DoTDebuffs/HolyLight.cs index fbdf8173da..1b7c0d73e0 100644 --- a/Buffs/DoTDebuffs/HolyLight.cs +++ b/Buffs/DoTDebuffs/HolyLight.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().hFlames = true; + player.Calamity().hFlames = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).hFlames = true; + npc.Calamity().hFlames = true; } } } diff --git a/Buffs/DoTDebuffs/LethalLavaBurn.cs b/Buffs/DoTDebuffs/LethalLavaBurn.cs index 46809485b3..da7b0e3470 100644 --- a/Buffs/DoTDebuffs/LethalLavaBurn.cs +++ b/Buffs/DoTDebuffs/LethalLavaBurn.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().lethalLavaBurn = true; + player.Calamity().lethalLavaBurn = true; } } } diff --git a/Buffs/DoTDebuffs/Nightwither.cs b/Buffs/DoTDebuffs/Nightwither.cs index 867977fd58..2ed20afb44 100644 --- a/Buffs/DoTDebuffs/Nightwither.cs +++ b/Buffs/DoTDebuffs/Nightwither.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).nightwither = true; + npc.Calamity().nightwither = true; } } } diff --git a/Buffs/DoTDebuffs/Plague.cs b/Buffs/DoTDebuffs/Plague.cs index 6b442c4b5f..e7429527c9 100644 --- a/Buffs/DoTDebuffs/Plague.cs +++ b/Buffs/DoTDebuffs/Plague.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().pFlames = true; + player.Calamity().pFlames = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).pFlames = true; + npc.Calamity().pFlames = true; } } } diff --git a/Buffs/DoTDebuffs/Shadowflame.cs b/Buffs/DoTDebuffs/Shadowflame.cs index 42fb1a565d..7b4d64b87a 100644 --- a/Buffs/DoTDebuffs/Shadowflame.cs +++ b/Buffs/DoTDebuffs/Shadowflame.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().shadowflame = true; + player.Calamity().shadowflame = true; } } } diff --git a/Buffs/DoTDebuffs/Shred.cs b/Buffs/DoTDebuffs/Shred.cs index 8a40458271..bdcafebe14 100644 --- a/Buffs/DoTDebuffs/Shred.cs +++ b/Buffs/DoTDebuffs/Shred.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).pShred = true; + npc.Calamity().pShred = true; } } } diff --git a/Buffs/DoTDebuffs/VulnerabilityHex.cs b/Buffs/DoTDebuffs/VulnerabilityHex.cs index c2ea60f8f1..0e8521f7a1 100644 --- a/Buffs/DoTDebuffs/VulnerabilityHex.cs +++ b/Buffs/DoTDebuffs/VulnerabilityHex.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.DoTDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().vHex = true; + player.Calamity().vHex = true; } } } diff --git a/Buffs/Fabsol/BloodyMary.cs b/Buffs/Fabsol/BloodyMary.cs index ef2a2f837c..6362864e80 100644 --- a/Buffs/Fabsol/BloodyMary.cs +++ b/Buffs/Fabsol/BloodyMary.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().bloodyMary = true; + player.Calamity().bloodyMary = true; } } } diff --git a/Buffs/Fabsol/BlueSpeedCandle.cs b/Buffs/Fabsol/BlueSpeedCandle.cs index 63fb770e09..e983edebbc 100644 --- a/Buffs/Fabsol/BlueSpeedCandle.cs +++ b/Buffs/Fabsol/BlueSpeedCandle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().blueCandle = true; + player.Calamity().blueCandle = true; } } } diff --git a/Buffs/Fabsol/CaribbeanRum.cs b/Buffs/Fabsol/CaribbeanRum.cs index cd95ae3816..9a5d55ec57 100644 --- a/Buffs/Fabsol/CaribbeanRum.cs +++ b/Buffs/Fabsol/CaribbeanRum.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().caribbeanRum = true; + player.Calamity().caribbeanRum = true; } } } diff --git a/Buffs/Fabsol/CinnamonRoll.cs b/Buffs/Fabsol/CinnamonRoll.cs index ad6bac44c8..6fb706b8d6 100644 --- a/Buffs/Fabsol/CinnamonRoll.cs +++ b/Buffs/Fabsol/CinnamonRoll.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().cinnamonRoll = true; + player.Calamity().cinnamonRoll = true; } } } diff --git a/Buffs/Fabsol/Everclear.cs b/Buffs/Fabsol/Everclear.cs index 8d9ffe4a03..bdb6d5f7ee 100644 --- a/Buffs/Fabsol/Everclear.cs +++ b/Buffs/Fabsol/Everclear.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().everclear = true; + player.Calamity().everclear = true; } } } diff --git a/Buffs/Fabsol/EvergreenGin.cs b/Buffs/Fabsol/EvergreenGin.cs index 1b00ef9c81..9f6972916f 100644 --- a/Buffs/Fabsol/EvergreenGin.cs +++ b/Buffs/Fabsol/EvergreenGin.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().evergreenGin = true; + player.Calamity().evergreenGin = true; } } } diff --git a/Buffs/Fabsol/FabsolVodka.cs b/Buffs/Fabsol/FabsolVodka.cs index 5265f67d63..9c655eb322 100644 --- a/Buffs/Fabsol/FabsolVodka.cs +++ b/Buffs/Fabsol/FabsolVodka.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().fabsolVodka = true; + player.Calamity().fabsolVodka = true; } } } diff --git a/Buffs/Fabsol/Fireball.cs b/Buffs/Fabsol/Fireball.cs index f1e65b8f7b..c2742b0963 100644 --- a/Buffs/Fabsol/Fireball.cs +++ b/Buffs/Fabsol/Fireball.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().fireball = true; + player.Calamity().fireball = true; } } } diff --git a/Buffs/Fabsol/GrapeBeer.cs b/Buffs/Fabsol/GrapeBeer.cs index e77170d3ba..44fff50885 100644 --- a/Buffs/Fabsol/GrapeBeer.cs +++ b/Buffs/Fabsol/GrapeBeer.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().grapeBeer = true; + player.Calamity().grapeBeer = true; } } } diff --git a/Buffs/Fabsol/Margarita.cs b/Buffs/Fabsol/Margarita.cs index ba36717fdc..be4da633b4 100644 --- a/Buffs/Fabsol/Margarita.cs +++ b/Buffs/Fabsol/Margarita.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().margarita = true; + player.Calamity().margarita = true; } } } diff --git a/Buffs/Fabsol/Moonshine.cs b/Buffs/Fabsol/Moonshine.cs index fe4cb44b04..eab65b9311 100644 --- a/Buffs/Fabsol/Moonshine.cs +++ b/Buffs/Fabsol/Moonshine.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().moonshine = true; + player.Calamity().moonshine = true; } } } diff --git a/Buffs/Fabsol/MoscowMule.cs b/Buffs/Fabsol/MoscowMule.cs index ccc5b1637d..8409e83942 100644 --- a/Buffs/Fabsol/MoscowMule.cs +++ b/Buffs/Fabsol/MoscowMule.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().moscowMule = true; + player.Calamity().moscowMule = true; } } } diff --git a/Buffs/Fabsol/PinkHealthCandle.cs b/Buffs/Fabsol/PinkHealthCandle.cs index b858cee671..bbc6e7e89e 100644 --- a/Buffs/Fabsol/PinkHealthCandle.cs +++ b/Buffs/Fabsol/PinkHealthCandle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().pinkCandle = true; + player.Calamity().pinkCandle = true; } } } diff --git a/Buffs/Fabsol/PurpleDefenseCandle.cs b/Buffs/Fabsol/PurpleDefenseCandle.cs index d9645887b6..9d6ac5e555 100644 --- a/Buffs/Fabsol/PurpleDefenseCandle.cs +++ b/Buffs/Fabsol/PurpleDefenseCandle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().purpleCandle = true; + player.Calamity().purpleCandle = true; } } } diff --git a/Buffs/Fabsol/RedWine.cs b/Buffs/Fabsol/RedWine.cs index ea029c9ba4..b2bb26229d 100644 --- a/Buffs/Fabsol/RedWine.cs +++ b/Buffs/Fabsol/RedWine.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().redWine = true; + player.Calamity().redWine = true; } } } diff --git a/Buffs/Fabsol/Rum.cs b/Buffs/Fabsol/Rum.cs index 8efa9a9cf6..bce074815b 100644 --- a/Buffs/Fabsol/Rum.cs +++ b/Buffs/Fabsol/Rum.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().rum = true; + player.Calamity().rum = true; } } } diff --git a/Buffs/Fabsol/Screwdriver.cs b/Buffs/Fabsol/Screwdriver.cs index dde74e4ec6..0303f2a9b8 100644 --- a/Buffs/Fabsol/Screwdriver.cs +++ b/Buffs/Fabsol/Screwdriver.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().screwdriver = true; + player.Calamity().screwdriver = true; } } } diff --git a/Buffs/Fabsol/StarBeamRye.cs b/Buffs/Fabsol/StarBeamRye.cs index 6f0427f1d7..03dfca941f 100644 --- a/Buffs/Fabsol/StarBeamRye.cs +++ b/Buffs/Fabsol/StarBeamRye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().starBeamRye = true; + player.Calamity().starBeamRye = true; } } } diff --git a/Buffs/Fabsol/Tequila.cs b/Buffs/Fabsol/Tequila.cs index f8d5bce822..aadf7891fe 100644 --- a/Buffs/Fabsol/Tequila.cs +++ b/Buffs/Fabsol/Tequila.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().tequila = true; + player.Calamity().tequila = true; } } } diff --git a/Buffs/Fabsol/TequilaSunrise.cs b/Buffs/Fabsol/TequilaSunrise.cs index 76bb13d736..0397304cea 100644 --- a/Buffs/Fabsol/TequilaSunrise.cs +++ b/Buffs/Fabsol/TequilaSunrise.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().tequilaSunrise = true; + player.Calamity().tequilaSunrise = true; } } } diff --git a/Buffs/Fabsol/Trippy.cs b/Buffs/Fabsol/Trippy.cs index f58d98f17c..d6ecae3090 100644 --- a/Buffs/Fabsol/Trippy.cs +++ b/Buffs/Fabsol/Trippy.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().trippy = true; + player.Calamity().trippy = true; } } } diff --git a/Buffs/Fabsol/Vodka.cs b/Buffs/Fabsol/Vodka.cs index 2a84e8704c..cca197c7af 100644 --- a/Buffs/Fabsol/Vodka.cs +++ b/Buffs/Fabsol/Vodka.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().vodka = true; + player.Calamity().vodka = true; } } } diff --git a/Buffs/Fabsol/Whiskey.cs b/Buffs/Fabsol/Whiskey.cs index fbcd24a2ed..88621b2906 100644 --- a/Buffs/Fabsol/Whiskey.cs +++ b/Buffs/Fabsol/Whiskey.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().whiskey = true; + player.Calamity().whiskey = true; } } } diff --git a/Buffs/Fabsol/WhiteWine.cs b/Buffs/Fabsol/WhiteWine.cs index 2f93e7d19f..210b7e5c51 100644 --- a/Buffs/Fabsol/WhiteWine.cs +++ b/Buffs/Fabsol/WhiteWine.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().whiteWine = true; + player.Calamity().whiteWine = true; } } } diff --git a/Buffs/Fabsol/YellowDamageCandle.cs b/Buffs/Fabsol/YellowDamageCandle.cs index 920aec402a..8ba4d9b4e2 100644 --- a/Buffs/Fabsol/YellowDamageCandle.cs +++ b/Buffs/Fabsol/YellowDamageCandle.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Buffs.Fabsol public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().yellowCandle = true; + player.Calamity().yellowCandle = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).yellowCandle = true; + npc.Calamity().yellowCandle = true; } } } diff --git a/Buffs/MountBuffs/BrimstoneMount.cs b/Buffs/MountBuffs/BrimstoneMount.cs index c830ad16cb..4c55eb89e5 100644 --- a/Buffs/MountBuffs/BrimstoneMount.cs +++ b/Buffs/MountBuffs/BrimstoneMount.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.Items.Mounts; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.MountBuffs { @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.MountBuffs public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(mod.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; } } diff --git a/Buffs/MountBuffs/Fab.cs b/Buffs/MountBuffs/Fab.cs index 0ffba356d7..0568ecd12f 100644 --- a/Buffs/MountBuffs/Fab.cs +++ b/Buffs/MountBuffs/Fab.cs @@ -1,6 +1,5 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.MountBuffs { @@ -16,9 +15,9 @@ namespace CalamityMod.Buffs.MountBuffs public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(mod.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; - player.GetCalamityPlayer().fab = true; + player.Calamity().fab = true; } } } diff --git a/Buffs/MountBuffs/GazeOfCrysthamyrBuff.cs b/Buffs/MountBuffs/GazeOfCrysthamyrBuff.cs index 6a8f9b70ff..dd0caed250 100644 --- a/Buffs/MountBuffs/GazeOfCrysthamyrBuff.cs +++ b/Buffs/MountBuffs/GazeOfCrysthamyrBuff.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.Items.Mounts; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.MountBuffs { @@ -16,9 +16,9 @@ namespace CalamityMod.Buffs.MountBuffs public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(mod.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; - player.GetCalamityPlayer().crysthamyr = true; + player.Calamity().crysthamyr = true; } } } diff --git a/Buffs/MountBuffs/SquishyBeanBuff.cs b/Buffs/MountBuffs/SquishyBeanBuff.cs index d5b606a7b9..1ff9bb7b33 100644 --- a/Buffs/MountBuffs/SquishyBeanBuff.cs +++ b/Buffs/MountBuffs/SquishyBeanBuff.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.Items.Mounts; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.MountBuffs { @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.MountBuffs public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(mod.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; } } diff --git a/Buffs/PetBuffs/AkatoYharonBuff.cs b/Buffs/PetBuffs/AkatoYharonBuff.cs index 17c29d7c7c..8dbd1e8867 100644 --- a/Buffs/PetBuffs/AkatoYharonBuff.cs +++ b/Buffs/PetBuffs/AkatoYharonBuff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().akato = true; + player.Calamity().akato = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Akato")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/BearBuff.cs b/Buffs/PetBuffs/BearBuff.cs index 629512ecd6..bb40be2620 100644 --- a/Buffs/PetBuffs/BearBuff.cs +++ b/Buffs/PetBuffs/BearBuff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().bearPet = true; + player.Calamity().bearPet = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Bear")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/BloodBound.cs b/Buffs/PetBuffs/BloodBound.cs index 0b6ad68241..862053dd30 100644 --- a/Buffs/PetBuffs/BloodBound.cs +++ b/Buffs/PetBuffs/BloodBound.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().perfmini = true; + player.Calamity().perfmini = true; bool PetProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("PerforaMini")] <= 0; if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/BrimlingBuff.cs b/Buffs/PetBuffs/BrimlingBuff.cs index f555cbe093..9c18ff452f 100644 --- a/Buffs/PetBuffs/BrimlingBuff.cs +++ b/Buffs/PetBuffs/BrimlingBuff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().brimling = true; + player.Calamity().brimling = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Brimling")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/ChibiiBuff.cs b/Buffs/PetBuffs/ChibiiBuff.cs index 88403daec0..c9b9e12bf9 100644 --- a/Buffs/PetBuffs/ChibiiBuff.cs +++ b/Buffs/PetBuffs/ChibiiBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PetBuffs { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().chibii = true; + player.Calamity().chibii = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggo")] <= 0; diff --git a/Buffs/PetBuffs/DannyDevito.cs b/Buffs/PetBuffs/DannyDevito.cs index 0fa135d63c..17eeafcd59 100644 --- a/Buffs/PetBuffs/DannyDevito.cs +++ b/Buffs/PetBuffs/DannyDevito.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().trashMan = true; + player.Calamity().trashMan = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("DannyDevito")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/Fox.cs b/Buffs/PetBuffs/Fox.cs index 746d78d82f..cf88184259 100644 --- a/Buffs/PetBuffs/Fox.cs +++ b/Buffs/PetBuffs/Fox.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().fox = true; + player.Calamity().fox = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Fox")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/Kendra.cs b/Buffs/PetBuffs/Kendra.cs index 1fac249453..ed75b0f748 100644 --- a/Buffs/PetBuffs/Kendra.cs +++ b/Buffs/PetBuffs/Kendra.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().kendra = true; + player.Calamity().kendra = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Kendra")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/Levi.cs b/Buffs/PetBuffs/Levi.cs index 3b890d1757..96d12239b9 100644 --- a/Buffs/PetBuffs/Levi.cs +++ b/Buffs/PetBuffs/Levi.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().leviPet = true; + player.Calamity().leviPet = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Levi")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/StrangeOrb.cs b/Buffs/PetBuffs/StrangeOrb.cs index f9ee64c071..42104b0c83 100644 --- a/Buffs/PetBuffs/StrangeOrb.cs +++ b/Buffs/PetBuffs/StrangeOrb.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().sirenPet = true; + player.Calamity().sirenPet = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("SirenYoung")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PetBuffs/ThirdSageBuff.cs b/Buffs/PetBuffs/ThirdSageBuff.cs index 4e30eaa3a5..cda2908ca2 100644 --- a/Buffs/PetBuffs/ThirdSageBuff.cs +++ b/Buffs/PetBuffs/ThirdSageBuff.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Buffs.PetBuffs public override void Update(Player player, ref int buffIndex) { player.buffTime[buffIndex] = 18000; - player.GetCalamityPlayer().thirdSage = true; + player.Calamity().thirdSage = true; bool PetProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ThirdSage")] <= 0; if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) { diff --git a/Buffs/PotionBuffs/AbyssalWeapon.cs b/Buffs/PotionBuffs/AbyssalWeapon.cs index 9aa2ca35c3..6a38578294 100644 --- a/Buffs/PotionBuffs/AbyssalWeapon.cs +++ b/Buffs/PotionBuffs/AbyssalWeapon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().aWeapon = true; + player.Calamity().aWeapon = true; } } } diff --git a/Buffs/PotionBuffs/AnechoicCoating.cs b/Buffs/PotionBuffs/AnechoicCoating.cs index 7a577e87f7..436dbe289a 100644 --- a/Buffs/PotionBuffs/AnechoicCoating.cs +++ b/Buffs/PotionBuffs/AnechoicCoating.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().anechoicCoating = true; + player.Calamity().anechoicCoating = true; } } } diff --git a/Buffs/PotionBuffs/ArmorCrumbling.cs b/Buffs/PotionBuffs/ArmorCrumbling.cs index a05659823f..c1f42b6581 100644 --- a/Buffs/PotionBuffs/ArmorCrumbling.cs +++ b/Buffs/PotionBuffs/ArmorCrumbling.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().armorCrumbling = true; + player.Calamity().armorCrumbling = true; } } } diff --git a/Buffs/PotionBuffs/ArmorShattering.cs b/Buffs/PotionBuffs/ArmorShattering.cs index 0c7ba95afa..f43869ad1f 100644 --- a/Buffs/PotionBuffs/ArmorShattering.cs +++ b/Buffs/PotionBuffs/ArmorShattering.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().armorShattering = true; + player.Calamity().armorShattering = true; } } } diff --git a/Buffs/PotionBuffs/AstralInjectionBuff.cs b/Buffs/PotionBuffs/AstralInjectionBuff.cs index 2f02af5c0a..2c1f34a6e2 100644 --- a/Buffs/PotionBuffs/AstralInjectionBuff.cs +++ b/Buffs/PotionBuffs/AstralInjectionBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().astralInjection = true; + player.Calamity().astralInjection = true; } } } diff --git a/Buffs/PotionBuffs/BoundingBuff.cs b/Buffs/PotionBuffs/BoundingBuff.cs index 6b86dbd48a..2fe718a8a6 100644 --- a/Buffs/PotionBuffs/BoundingBuff.cs +++ b/Buffs/PotionBuffs/BoundingBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().bounding = true; + player.Calamity().bounding = true; } } } diff --git a/Buffs/PotionBuffs/Cadence.cs b/Buffs/PotionBuffs/Cadence.cs index 37b5add9b2..7868a948ec 100644 --- a/Buffs/PotionBuffs/Cadence.cs +++ b/Buffs/PotionBuffs/Cadence.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().cadence = true; + player.Calamity().cadence = true; } } } diff --git a/Buffs/PotionBuffs/CalciumBuff.cs b/Buffs/PotionBuffs/CalciumBuff.cs index 7920ec79d4..6d3f999e96 100644 --- a/Buffs/PotionBuffs/CalciumBuff.cs +++ b/Buffs/PotionBuffs/CalciumBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().calcium = true; + player.Calamity().calcium = true; } } } diff --git a/Buffs/PotionBuffs/CeaselessHunger.cs b/Buffs/PotionBuffs/CeaselessHunger.cs index 8ca4442dce..c37af3faf9 100644 --- a/Buffs/PotionBuffs/CeaselessHunger.cs +++ b/Buffs/PotionBuffs/CeaselessHunger.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().ceaselessHunger = true; + player.Calamity().ceaselessHunger = true; } } } diff --git a/Buffs/PotionBuffs/DraconicSurgeBuff.cs b/Buffs/PotionBuffs/DraconicSurgeBuff.cs index a839892e88..a6560e460e 100644 --- a/Buffs/PotionBuffs/DraconicSurgeBuff.cs +++ b/Buffs/PotionBuffs/DraconicSurgeBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().draconicSurge = true; + player.Calamity().draconicSurge = true; } } } diff --git a/Buffs/PotionBuffs/GravityNormalizerBuff.cs b/Buffs/PotionBuffs/GravityNormalizerBuff.cs index e4797d4d3d..a10576f7c5 100644 --- a/Buffs/PotionBuffs/GravityNormalizerBuff.cs +++ b/Buffs/PotionBuffs/GravityNormalizerBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().gravityNormalizer = true; + player.Calamity().gravityNormalizer = true; } } } diff --git a/Buffs/PotionBuffs/HolyWrathBuff.cs b/Buffs/PotionBuffs/HolyWrathBuff.cs index 234392c3ef..234c0ee07c 100644 --- a/Buffs/PotionBuffs/HolyWrathBuff.cs +++ b/Buffs/PotionBuffs/HolyWrathBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().holyWrath = true; + player.Calamity().holyWrath = true; } } } diff --git a/Buffs/PotionBuffs/Invincible.cs b/Buffs/PotionBuffs/Invincible.cs index 81bfbea659..0a082c4f6a 100644 --- a/Buffs/PotionBuffs/Invincible.cs +++ b/Buffs/PotionBuffs/Invincible.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().invincible = true; + player.Calamity().invincible = true; } } } diff --git a/Buffs/PotionBuffs/Omniscience.cs b/Buffs/PotionBuffs/Omniscience.cs index 71a53ff88e..a11cf66921 100644 --- a/Buffs/PotionBuffs/Omniscience.cs +++ b/Buffs/PotionBuffs/Omniscience.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().omniscience = true; + player.Calamity().omniscience = true; } } } diff --git a/Buffs/PotionBuffs/PenumbraBuff.cs b/Buffs/PotionBuffs/PenumbraBuff.cs index c379b76c6e..4fdc3b6b50 100644 --- a/Buffs/PotionBuffs/PenumbraBuff.cs +++ b/Buffs/PotionBuffs/PenumbraBuff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().penumbra = true; + player.Calamity().penumbra = true; } } } diff --git a/Buffs/PotionBuffs/PhotosynthesisBuff.cs b/Buffs/PotionBuffs/PhotosynthesisBuff.cs index 24a6b7ee41..39c5954a0d 100644 --- a/Buffs/PotionBuffs/PhotosynthesisBuff.cs +++ b/Buffs/PotionBuffs/PhotosynthesisBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().photosynthesis = true; + player.Calamity().photosynthesis = true; } } } diff --git a/Buffs/PotionBuffs/ProfanedRageBuff.cs b/Buffs/PotionBuffs/ProfanedRageBuff.cs index cff1772139..6264f48266 100644 --- a/Buffs/PotionBuffs/ProfanedRageBuff.cs +++ b/Buffs/PotionBuffs/ProfanedRageBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().profanedRage = true; + player.Calamity().profanedRage = true; } } } diff --git a/Buffs/PotionBuffs/Soaring.cs b/Buffs/PotionBuffs/Soaring.cs index 1180a64788..5f80de1655 100644 --- a/Buffs/PotionBuffs/Soaring.cs +++ b/Buffs/PotionBuffs/Soaring.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().soaring = true; + player.Calamity().soaring = true; } } } diff --git a/Buffs/PotionBuffs/TitanScale.cs b/Buffs/PotionBuffs/TitanScale.cs index 1510457359..374dd3711b 100644 --- a/Buffs/PotionBuffs/TitanScale.cs +++ b/Buffs/PotionBuffs/TitanScale.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().tScale = true; + player.Calamity().tScale = true; } } } diff --git a/Buffs/PotionBuffs/TriumphBuff.cs b/Buffs/PotionBuffs/TriumphBuff.cs index 2fbc256012..ec596244f1 100644 --- a/Buffs/PotionBuffs/TriumphBuff.cs +++ b/Buffs/PotionBuffs/TriumphBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().triumph = true; + player.Calamity().triumph = true; } } } diff --git a/Buffs/PotionBuffs/YharimPower.cs b/Buffs/PotionBuffs/YharimPower.cs index 2b06339b62..4031d44a8a 100644 --- a/Buffs/PotionBuffs/YharimPower.cs +++ b/Buffs/PotionBuffs/YharimPower.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().yPower = true; + player.Calamity().yPower = true; } } } diff --git a/Buffs/PotionBuffs/Zen.cs b/Buffs/PotionBuffs/Zen.cs index 6e5367da88..e82d14cdb3 100644 --- a/Buffs/PotionBuffs/Zen.cs +++ b/Buffs/PotionBuffs/Zen.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().zen = true; + player.Calamity().zen = true; } } } diff --git a/Buffs/PotionBuffs/Zerg.cs b/Buffs/PotionBuffs/Zerg.cs index b445051521..673e467142 100644 --- a/Buffs/PotionBuffs/Zerg.cs +++ b/Buffs/PotionBuffs/Zerg.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.PotionBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().zerg = true; + player.Calamity().zerg = true; } } } diff --git a/Buffs/Shrines/ChiBuff.cs b/Buffs/Shrines/ChiBuff.cs index 19f4ad224a..0b53e7c9b0 100644 --- a/Buffs/Shrines/ChiBuff.cs +++ b/Buffs/Shrines/ChiBuff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Shrines public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().trinketOfChiBuff = true; + player.Calamity().trinketOfChiBuff = true; } } } diff --git a/Buffs/Shrines/CorruptionEffigyBuff.cs b/Buffs/Shrines/CorruptionEffigyBuff.cs index 046e23907d..f82a2ef9f2 100644 --- a/Buffs/Shrines/CorruptionEffigyBuff.cs +++ b/Buffs/Shrines/CorruptionEffigyBuff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Shrines public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().corrEffigy = true; + player.Calamity().corrEffigy = true; } } } diff --git a/Buffs/Shrines/CrimsonEffigyBuff.cs b/Buffs/Shrines/CrimsonEffigyBuff.cs index bdb90fdfda..8f806f287a 100644 --- a/Buffs/Shrines/CrimsonEffigyBuff.cs +++ b/Buffs/Shrines/CrimsonEffigyBuff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Shrines public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().crimEffigy = true; + player.Calamity().crimEffigy = true; } } } diff --git a/Buffs/Shrines/GladiatorSwords.cs b/Buffs/Shrines/GladiatorSwords.cs index 9013218fdb..e412098e6e 100644 --- a/Buffs/Shrines/GladiatorSwords.cs +++ b/Buffs/Shrines/GladiatorSwords.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Shrines public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("GladiatorSword")] > 0) { modPlayer.glSword = true; diff --git a/Buffs/Shrines/OnyxExcavatorBuff.cs b/Buffs/Shrines/OnyxExcavatorBuff.cs index c5e75b3581..92d840f53b 100644 --- a/Buffs/Shrines/OnyxExcavatorBuff.cs +++ b/Buffs/Shrines/OnyxExcavatorBuff.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.Items.Mounts; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Shrines { @@ -16,9 +16,9 @@ namespace CalamityMod.Buffs.Shrines public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(mod.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; - player.GetCalamityPlayer().onyxExcavator = true; + player.Calamity().onyxExcavator = true; } } } diff --git a/Buffs/Shrines/TundraLeashBuff.cs b/Buffs/Shrines/TundraLeashBuff.cs index 7335f5f026..2420eda673 100644 --- a/Buffs/Shrines/TundraLeashBuff.cs +++ b/Buffs/Shrines/TundraLeashBuff.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.Items.Mounts; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Shrines { @@ -16,9 +16,9 @@ namespace CalamityMod.Buffs.Shrines public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(mod.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; - player.GetCalamityPlayer().angryDog = true; + player.Calamity().angryDog = true; } } } diff --git a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs index 14b70894a0..9ec35174bc 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().abyssalDivingSuitPlates = true; + player.Calamity().abyssalDivingSuitPlates = true; } } } diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index 7e1723da74..3e5d8d4593 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().adrenalineMode = true; + player.Calamity().adrenalineMode = true; } public override void ModifyBuffTip(ref string tip, ref int rare) diff --git a/Buffs/StatBuffs/Afflicted.cs b/Buffs/StatBuffs/Afflicted.cs index 22ce65f351..4a6ea38c30 100644 --- a/Buffs/StatBuffs/Afflicted.cs +++ b/Buffs/StatBuffs/Afflicted.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().afflicted = true; + player.Calamity().afflicted = true; } } } diff --git a/Buffs/StatBuffs/ChaosCandle.cs b/Buffs/StatBuffs/ChaosCandle.cs index e620a0d456..80bf7b6b5d 100644 --- a/Buffs/StatBuffs/ChaosCandle.cs +++ b/Buffs/StatBuffs/ChaosCandle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().chaosCandle = true; + player.Calamity().chaosCandle = true; } } } diff --git a/Buffs/StatBuffs/CosmicFreeze.cs b/Buffs/StatBuffs/CosmicFreeze.cs index 812efe09d2..e1a9ab5ff2 100644 --- a/Buffs/StatBuffs/CosmicFreeze.cs +++ b/Buffs/StatBuffs/CosmicFreeze.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().cFreeze = true; + player.Calamity().cFreeze = true; } } } diff --git a/Buffs/StatBuffs/GodSlayerCooldown.cs b/Buffs/StatBuffs/GodSlayerCooldown.cs index 990016e016..518bd2ae20 100644 --- a/Buffs/StatBuffs/GodSlayerCooldown.cs +++ b/Buffs/StatBuffs/GodSlayerCooldown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().godSlayerCooldown = true; + player.Calamity().godSlayerCooldown = true; } } } diff --git a/Buffs/StatBuffs/GraxDefense.cs b/Buffs/StatBuffs/GraxDefense.cs index e0166ea143..6c45122957 100644 --- a/Buffs/StatBuffs/GraxDefense.cs +++ b/Buffs/StatBuffs/GraxDefense.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().graxDefense = true; + player.Calamity().graxDefense = true; } } } diff --git a/Buffs/StatBuffs/HeartAttack.cs b/Buffs/StatBuffs/HeartAttack.cs index c6731aa2e0..b5b47217fc 100644 --- a/Buffs/StatBuffs/HeartAttack.cs +++ b/Buffs/StatBuffs/HeartAttack.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().hAttack = true; + player.Calamity().hAttack = true; } } } diff --git a/Buffs/StatBuffs/IceShieldBuff.cs b/Buffs/StatBuffs/IceShieldBuff.cs index b420c61d90..211c321e52 100644 --- a/Buffs/StatBuffs/IceShieldBuff.cs +++ b/Buffs/StatBuffs/IceShieldBuff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().sirenIce = true; + player.Calamity().sirenIce = true; } } } diff --git a/Buffs/StatBuffs/Molten.cs b/Buffs/StatBuffs/Molten.cs index 7db68bec2a..7d43519dbd 100644 --- a/Buffs/StatBuffs/Molten.cs +++ b/Buffs/StatBuffs/Molten.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().molten = true; + player.Calamity().molten = true; } } } diff --git a/Buffs/StatBuffs/Mushy.cs b/Buffs/StatBuffs/Mushy.cs index 7fddae82a0..0abce57ab5 100644 --- a/Buffs/StatBuffs/Mushy.cs +++ b/Buffs/StatBuffs/Mushy.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().mushy = true; + player.Calamity().mushy = true; } } } diff --git a/Buffs/StatBuffs/RageMode.cs b/Buffs/StatBuffs/RageMode.cs index 62d0ff9c3d..31846541cd 100644 --- a/Buffs/StatBuffs/RageMode.cs +++ b/Buffs/StatBuffs/RageMode.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().rageMode = true; + player.Calamity().rageMode = true; } public override void ModifyBuffTip(ref string tip, ref int rare) diff --git a/Buffs/StatBuffs/ReaverRage.cs b/Buffs/StatBuffs/ReaverRage.cs index 28beeb4824..5d8952a766 100644 --- a/Buffs/StatBuffs/ReaverRage.cs +++ b/Buffs/StatBuffs/ReaverRage.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().rRage = true; + player.Calamity().rRage = true; } } } diff --git a/Buffs/StatBuffs/ScarfMeleeBoost.cs b/Buffs/StatBuffs/ScarfMeleeBoost.cs index 60f15c2b55..ba9981ec1a 100644 --- a/Buffs/StatBuffs/ScarfMeleeBoost.cs +++ b/Buffs/StatBuffs/ScarfMeleeBoost.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().sMeleeBoost = true; + player.Calamity().sMeleeBoost = true; } } } diff --git a/Buffs/StatBuffs/ShellBoost.cs b/Buffs/StatBuffs/ShellBoost.cs index f1468e32fa..de8f4c196e 100644 --- a/Buffs/StatBuffs/ShellBoost.cs +++ b/Buffs/StatBuffs/ShellBoost.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().shellBoost = true; + player.Calamity().shellBoost = true; } } } diff --git a/Buffs/StatBuffs/SirenWaterSpeed.cs b/Buffs/StatBuffs/SirenWaterSpeed.cs index 9066a497cf..d558f3c884 100644 --- a/Buffs/StatBuffs/SirenWaterSpeed.cs +++ b/Buffs/StatBuffs/SirenWaterSpeed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().sirenWaterBuff = true; + player.Calamity().sirenWaterBuff = true; } } } diff --git a/Buffs/StatBuffs/TarraLifeRegen.cs b/Buffs/StatBuffs/TarraLifeRegen.cs index 2b1424df03..5448e6d1f9 100644 --- a/Buffs/StatBuffs/TarraLifeRegen.cs +++ b/Buffs/StatBuffs/TarraLifeRegen.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().tRegen = true; + player.Calamity().tRegen = true; } } } diff --git a/Buffs/StatBuffs/TranquilityCandle.cs b/Buffs/StatBuffs/TranquilityCandle.cs index 8f32282d16..22cd1014c4 100644 --- a/Buffs/StatBuffs/TranquilityCandle.cs +++ b/Buffs/StatBuffs/TranquilityCandle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().tranquilityCandle = true; + player.Calamity().tranquilityCandle = true; } } } diff --git a/Buffs/StatBuffs/TyrantsFury.cs b/Buffs/StatBuffs/TyrantsFury.cs index 4349bc2e57..98be55d9e7 100644 --- a/Buffs/StatBuffs/TyrantsFury.cs +++ b/Buffs/StatBuffs/TyrantsFury.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().tFury = true; + player.Calamity().tFury = true; } } } diff --git a/Buffs/StatBuffs/XerocRage.cs b/Buffs/StatBuffs/XerocRage.cs index 9ab0fc3124..feec7a258a 100644 --- a/Buffs/StatBuffs/XerocRage.cs +++ b/Buffs/StatBuffs/XerocRage.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().xRage = true; + player.Calamity().xRage = true; } } } diff --git a/Buffs/StatBuffs/XerocWrath.cs b/Buffs/StatBuffs/XerocWrath.cs index d73383a7d5..cc0cc8b00e 100644 --- a/Buffs/StatBuffs/XerocWrath.cs +++ b/Buffs/StatBuffs/XerocWrath.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().xWrath = true; + player.Calamity().xWrath = true; } } } diff --git a/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs b/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs index 02dc9d1848..de39675b32 100644 --- a/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs +++ b/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().abyssalDivingSuitCooldown = true; + player.Calamity().abyssalDivingSuitCooldown = true; } } } diff --git a/Buffs/StatDebuffs/ArmorCrunch.cs b/Buffs/StatDebuffs/ArmorCrunch.cs index 62656ef4c3..b0289f89f3 100644 --- a/Buffs/StatDebuffs/ArmorCrunch.cs +++ b/Buffs/StatDebuffs/ArmorCrunch.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).aCrunch = true; + npc.Calamity().aCrunch = true; } public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().aCrunch = true; + player.Calamity().aCrunch = true; } } } diff --git a/Buffs/StatDebuffs/BurntOut.cs b/Buffs/StatDebuffs/BurntOut.cs index ba1120acef..03f1feebcf 100644 --- a/Buffs/StatDebuffs/BurntOut.cs +++ b/Buffs/StatDebuffs/BurntOut.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().bOut = true; + player.Calamity().bOut = true; } } } diff --git a/Buffs/StatDebuffs/Enraged.cs b/Buffs/StatDebuffs/Enraged.cs index 2e66875fd6..6bc0573b34 100644 --- a/Buffs/StatDebuffs/Enraged.cs +++ b/Buffs/StatDebuffs/Enraged.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().enraged = true; + player.Calamity().enraged = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).enraged = true; + npc.Calamity().enraged = true; } } } diff --git a/Buffs/StatDebuffs/ExoFreeze.cs b/Buffs/StatDebuffs/ExoFreeze.cs index c11629f817..cb15bbc19d 100644 --- a/Buffs/StatDebuffs/ExoFreeze.cs +++ b/Buffs/StatDebuffs/ExoFreeze.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).eFreeze = true; + npc.Calamity().eFreeze = true; } } } diff --git a/Buffs/StatDebuffs/ExtremeGrav.cs b/Buffs/StatDebuffs/ExtremeGrav.cs index f883e4e6c9..ffec873fd3 100644 --- a/Buffs/StatDebuffs/ExtremeGrav.cs +++ b/Buffs/StatDebuffs/ExtremeGrav.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().eGrav = true; + player.Calamity().eGrav = true; } } } diff --git a/Buffs/StatDebuffs/ExtremeGravity.cs b/Buffs/StatDebuffs/ExtremeGravity.cs index d651b1c1ea..13e4b4a9f4 100644 --- a/Buffs/StatDebuffs/ExtremeGravity.cs +++ b/Buffs/StatDebuffs/ExtremeGravity.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().eGravity = true; + player.Calamity().eGravity = true; } } } diff --git a/Buffs/StatDebuffs/FishAlert.cs b/Buffs/StatDebuffs/FishAlert.cs index 9bf1b91d5a..2fda86562e 100644 --- a/Buffs/StatDebuffs/FishAlert.cs +++ b/Buffs/StatDebuffs/FishAlert.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().fishAlert = true; + player.Calamity().fishAlert = true; } } } diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index 1203765e31..6d815095fe 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().gState = true; + player.Calamity().gState = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).gState = true; + npc.Calamity().gState = true; } } } diff --git a/Buffs/StatDebuffs/Horror.cs b/Buffs/StatDebuffs/Horror.cs index 4afbc2f4ab..f2da405693 100644 --- a/Buffs/StatDebuffs/Horror.cs +++ b/Buffs/StatDebuffs/Horror.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().horror = true; + player.Calamity().horror = true; } } } diff --git a/Buffs/StatDebuffs/IceShieldBrokenBuff.cs b/Buffs/StatDebuffs/IceShieldBrokenBuff.cs index 74171d9392..76ecbf194b 100644 --- a/Buffs/StatDebuffs/IceShieldBrokenBuff.cs +++ b/Buffs/StatDebuffs/IceShieldBrokenBuff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().sirenIceCooldown = true; + player.Calamity().sirenIceCooldown = true; } } } diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index 2afa91a9f7..e3ba7cac19 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().irradiated = true; + player.Calamity().irradiated = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).irradiated = true; + npc.Calamity().irradiated = true; } } } diff --git a/Buffs/StatDebuffs/MarkedforDeath.cs b/Buffs/StatDebuffs/MarkedforDeath.cs index 2b1785a2d2..61079d7b30 100644 --- a/Buffs/StatDebuffs/MarkedforDeath.cs +++ b/Buffs/StatDebuffs/MarkedforDeath.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).marked = true; + npc.Calamity().marked = true; } public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().marked = true; + player.Calamity().marked = true; } } } diff --git a/Buffs/StatDebuffs/ScarfCooldown.cs b/Buffs/StatDebuffs/ScarfCooldown.cs index 2bb7e8b4f3..1c16d4a6b2 100644 --- a/Buffs/StatDebuffs/ScarfCooldown.cs +++ b/Buffs/StatDebuffs/ScarfCooldown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().scarfCooldown = true; + player.Calamity().scarfCooldown = true; } } } diff --git a/Buffs/StatDebuffs/SilvaStun.cs b/Buffs/StatDebuffs/SilvaStun.cs index ef3f970275..203e75f8bb 100644 --- a/Buffs/StatDebuffs/SilvaStun.cs +++ b/Buffs/StatDebuffs/SilvaStun.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).silvaStun = true; + npc.Calamity().silvaStun = true; } } } diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index 26245fb832..2bba3cd86a 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).tSad = true; + npc.Calamity().tSad = true; } } } diff --git a/Buffs/StatDebuffs/TimeSlow.cs b/Buffs/StatDebuffs/TimeSlow.cs index d4883d66ff..4b0ffd4162 100644 --- a/Buffs/StatDebuffs/TimeSlow.cs +++ b/Buffs/StatDebuffs/TimeSlow.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).timeSlow = true; + npc.Calamity().timeSlow = true; } /*public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatDebuffs/WarCleave.cs b/Buffs/StatDebuffs/WarCleave.cs index 366bee9b82..294d22a71e 100644 --- a/Buffs/StatDebuffs/WarCleave.cs +++ b/Buffs/StatDebuffs/WarCleave.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).wCleave = true; + npc.Calamity().wCleave = true; } } } diff --git a/Buffs/StatDebuffs/Warped.cs b/Buffs/StatDebuffs/Warped.cs index 8fe99b4f56..a19b8ba2c0 100644 --- a/Buffs/StatDebuffs/Warped.cs +++ b/Buffs/StatDebuffs/Warped.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().warped = true; + player.Calamity().warped = true; } } } diff --git a/Buffs/StatDebuffs/WeakPetrification.cs b/Buffs/StatDebuffs/WeakPetrification.cs index 8feb36cd87..9b4030d389 100644 --- a/Buffs/StatDebuffs/WeakPetrification.cs +++ b/Buffs/StatDebuffs/WeakPetrification.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().weakPetrification = true; + player.Calamity().weakPetrification = true; } } } diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index 14c71f5c52..2901538c13 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().wDeath = true; + player.Calamity().wDeath = true; } public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).wDeath = true; + npc.Calamity().wDeath = true; } } } diff --git a/Buffs/SummonBuffs/AngryChicken.cs b/Buffs/SummonBuffs/AngryChicken.cs index 27c6e9a61f..0b10369a34 100644 --- a/Buffs/SummonBuffs/AngryChicken.cs +++ b/Buffs/SummonBuffs/AngryChicken.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] > 0) { modPlayer.aChicken = true; diff --git a/Buffs/SummonBuffs/AquaticStar.cs b/Buffs/SummonBuffs/AquaticStar.cs index d206ef0d5a..a2a3b98d84 100644 --- a/Buffs/SummonBuffs/AquaticStar.cs +++ b/Buffs/SummonBuffs/AquaticStar.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("AquaticStar")] > 0) { modPlayer.aStar = true; diff --git a/Buffs/SummonBuffs/BloodClot.cs b/Buffs/SummonBuffs/BloodClot.cs index 98a0ae9182..e4ae2f4f06 100644 --- a/Buffs/SummonBuffs/BloodClot.cs +++ b/Buffs/SummonBuffs/BloodClot.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("BloodClotMinion")] > 0) { modPlayer.bClot = true; diff --git a/Buffs/SummonBuffs/BrimstoneWaifu.cs b/Buffs/SummonBuffs/BrimstoneWaifu.cs index 75a9f6b171..a2dd1d4c14 100644 --- a/Buffs/SummonBuffs/BrimstoneWaifu.cs +++ b/Buffs/SummonBuffs/BrimstoneWaifu.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 0) { modPlayer.bWaifu = true; diff --git a/Buffs/SummonBuffs/BrittleStar.cs b/Buffs/SummonBuffs/BrittleStar.cs index c89809e048..b05e03494e 100644 --- a/Buffs/SummonBuffs/BrittleStar.cs +++ b/Buffs/SummonBuffs/BrittleStar.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("BrittleStar")] > 0) { modPlayer.bStar = true; diff --git a/Buffs/SummonBuffs/Calamari.cs b/Buffs/SummonBuffs/Calamari.cs index 24f5877a08..f17890e545 100644 --- a/Buffs/SummonBuffs/Calamari.cs +++ b/Buffs/SummonBuffs/Calamari.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Calamari")] > 0) { modPlayer.calamari = true; diff --git a/Buffs/SummonBuffs/CalamitasEyes.cs b/Buffs/SummonBuffs/CalamitasEyes.cs index 74c0844487..bcc5ff4e4e 100644 --- a/Buffs/SummonBuffs/CalamitasEyes.cs +++ b/Buffs/SummonBuffs/CalamitasEyes.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Calamitamini")] > 0) { modPlayer.cEyes = true; diff --git a/Buffs/SummonBuffs/ChaosSpirit.cs b/Buffs/SummonBuffs/ChaosSpirit.cs index 33e0f1ffbf..9b41fa9fb7 100644 --- a/Buffs/SummonBuffs/ChaosSpirit.cs +++ b/Buffs/SummonBuffs/ChaosSpirit.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("ChaosSpirit")] > 0) { modPlayer.cSpirit = true; diff --git a/Buffs/SummonBuffs/CloudyWaifu.cs b/Buffs/SummonBuffs/CloudyWaifu.cs index 50254c9604..0e2162fbe0 100644 --- a/Buffs/SummonBuffs/CloudyWaifu.cs +++ b/Buffs/SummonBuffs/CloudyWaifu.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 0) { modPlayer.cWaifu = true; diff --git a/Buffs/SummonBuffs/Corroslime.cs b/Buffs/SummonBuffs/Corroslime.cs index 603ee9f403..640fb2a3e9 100644 --- a/Buffs/SummonBuffs/Corroslime.cs +++ b/Buffs/SummonBuffs/Corroslime.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Corroslime")] > 0) { modPlayer.cSlime = true; diff --git a/Buffs/SummonBuffs/CosmicEnergy.cs b/Buffs/SummonBuffs/CosmicEnergy.cs index 0241aadd13..185a78d4d9 100644 --- a/Buffs/SummonBuffs/CosmicEnergy.cs +++ b/Buffs/SummonBuffs/CosmicEnergy.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("CosmicEnergy")] > 0) { modPlayer.cEnergy = true; diff --git a/Buffs/SummonBuffs/Cosmilamp.cs b/Buffs/SummonBuffs/Cosmilamp.cs index 51724c064b..7f78147a01 100644 --- a/Buffs/SummonBuffs/Cosmilamp.cs +++ b/Buffs/SummonBuffs/Cosmilamp.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Cosmilamp")] > 0) { modPlayer.cLamp = true; diff --git a/Buffs/SummonBuffs/Crimslime.cs b/Buffs/SummonBuffs/Crimslime.cs index 282ed7fccd..d0349e398c 100644 --- a/Buffs/SummonBuffs/Crimslime.cs +++ b/Buffs/SummonBuffs/Crimslime.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Crimslime")] > 0) { modPlayer.cSlime2 = true; diff --git a/Buffs/SummonBuffs/DaedalusCrystal.cs b/Buffs/SummonBuffs/DaedalusCrystal.cs index adbbcfed5e..aa9c30fa0d 100644 --- a/Buffs/SummonBuffs/DaedalusCrystal.cs +++ b/Buffs/SummonBuffs/DaedalusCrystal.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("DaedalusCrystal")] > 0) { modPlayer.dCrystal = true; diff --git a/Buffs/SummonBuffs/DankCreeper.cs b/Buffs/SummonBuffs/DankCreeper.cs index 60d5333319..a3d8ca36e7 100644 --- a/Buffs/SummonBuffs/DankCreeper.cs +++ b/Buffs/SummonBuffs/DankCreeper.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("DankCreeper")] > 0) { modPlayer.dCreeper = true; diff --git a/Buffs/SummonBuffs/DrewsSandyWaifu.cs b/Buffs/SummonBuffs/DrewsSandyWaifu.cs index 20162fda5b..ff9e1337fb 100644 --- a/Buffs/SummonBuffs/DrewsSandyWaifu.cs +++ b/Buffs/SummonBuffs/DrewsSandyWaifu.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 0) { modPlayer.dWaifu = true; diff --git a/Buffs/SummonBuffs/ElementalAxe.cs b/Buffs/SummonBuffs/ElementalAxe.cs index 3f1c9a6e60..b4a23a5c8e 100644 --- a/Buffs/SummonBuffs/ElementalAxe.cs +++ b/Buffs/SummonBuffs/ElementalAxe.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("ElementalAxe")] > 0) { modPlayer.eAxe = true; diff --git a/Buffs/SummonBuffs/FungalClump.cs b/Buffs/SummonBuffs/FungalClump.cs index c16372bb94..8d85b17a2b 100644 --- a/Buffs/SummonBuffs/FungalClump.cs +++ b/Buffs/SummonBuffs/FungalClump.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 0) { modPlayer.fClump = true; diff --git a/Buffs/SummonBuffs/GuardianDefense.cs b/Buffs/SummonBuffs/GuardianDefense.cs index 32deea73d7..096d4ea539 100644 --- a/Buffs/SummonBuffs/GuardianDefense.cs +++ b/Buffs/SummonBuffs/GuardianDefense.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianDefense")] > 0) { modPlayer.gDefense = true; diff --git a/Buffs/SummonBuffs/GuardianHealer.cs b/Buffs/SummonBuffs/GuardianHealer.cs index 783da565fc..deca6b9dd6 100644 --- a/Buffs/SummonBuffs/GuardianHealer.cs +++ b/Buffs/SummonBuffs/GuardianHealer.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianHealer")] > 0) { modPlayer.gHealer = true; diff --git a/Buffs/SummonBuffs/GuardianOffense.cs b/Buffs/SummonBuffs/GuardianOffense.cs index 9c4c91070f..651ac6ab56 100644 --- a/Buffs/SummonBuffs/GuardianOffense.cs +++ b/Buffs/SummonBuffs/GuardianOffense.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianAttack")] > 0) { modPlayer.gOffense = true; diff --git a/Buffs/SummonBuffs/Herring.cs b/Buffs/SummonBuffs/Herring.cs index 1ea30fd9b0..14a8c0999f 100644 --- a/Buffs/SummonBuffs/Herring.cs +++ b/Buffs/SummonBuffs/Herring.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Herring")] > 0) { modPlayer.herring = true; diff --git a/Buffs/SummonBuffs/HotE.cs b/Buffs/SummonBuffs/HotE.cs index bd8bcead63..1b52dcb67a 100644 --- a/Buffs/SummonBuffs/HotE.cs +++ b/Buffs/SummonBuffs/HotE.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.allWaifus) { diff --git a/Buffs/SummonBuffs/IceClasper.cs b/Buffs/SummonBuffs/IceClasper.cs index 88ef96c50f..ce79148c44 100644 --- a/Buffs/SummonBuffs/IceClasper.cs +++ b/Buffs/SummonBuffs/IceClasper.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("IceClasper")] > 0) { modPlayer.iClasper = true; diff --git a/Buffs/SummonBuffs/Mechworm.cs b/Buffs/SummonBuffs/Mechworm.cs index 1ed46978ad..d0ec90328d 100644 --- a/Buffs/SummonBuffs/Mechworm.cs +++ b/Buffs/SummonBuffs/Mechworm.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] > 0) { modPlayer.mWorm = true; diff --git a/Buffs/SummonBuffs/Phantom.cs b/Buffs/SummonBuffs/Phantom.cs index 1ef1ac6bd1..14db043b47 100644 --- a/Buffs/SummonBuffs/Phantom.cs +++ b/Buffs/SummonBuffs/Phantom.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("PhantomGuy")] > 0) { modPlayer.pGuy = true; diff --git a/Buffs/SummonBuffs/ReaverOrb.cs b/Buffs/SummonBuffs/ReaverOrb.cs index 9563153f67..14f257f9ac 100644 --- a/Buffs/SummonBuffs/ReaverOrb.cs +++ b/Buffs/SummonBuffs/ReaverOrb.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("ReaverOrb")] > 0) { modPlayer.rOrb = true; diff --git a/Buffs/SummonBuffs/RedDevil.cs b/Buffs/SummonBuffs/RedDevil.cs index 0742e69bf0..e8b9754973 100644 --- a/Buffs/SummonBuffs/RedDevil.cs +++ b/Buffs/SummonBuffs/RedDevil.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] > 0) { modPlayer.rDevil = true; diff --git a/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs b/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs index 32e2918012..c0374ae659 100644 --- a/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs +++ b/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("PinkButterfly")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("PurpleButterfly")] > 0) { modPlayer.resButterfly = true; diff --git a/Buffs/SummonBuffs/Sandnado.cs b/Buffs/SummonBuffs/Sandnado.cs index 6562310ea5..64093a35e8 100644 --- a/Buffs/SummonBuffs/Sandnado.cs +++ b/Buffs/SummonBuffs/Sandnado.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Sandnado")] > 0) { modPlayer.sandnado = true; diff --git a/Buffs/SummonBuffs/SandyWaifu.cs b/Buffs/SummonBuffs/SandyWaifu.cs index b81923e3e0..1ad87a5ae4 100644 --- a/Buffs/SummonBuffs/SandyWaifu.cs +++ b/Buffs/SummonBuffs/SandyWaifu.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 0) { modPlayer.sWaifu = true; diff --git a/Buffs/SummonBuffs/SilvaCrystal.cs b/Buffs/SummonBuffs/SilvaCrystal.cs index 57af4df67f..c1c8ed44af 100644 --- a/Buffs/SummonBuffs/SilvaCrystal.cs +++ b/Buffs/SummonBuffs/SilvaCrystal.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] > 0) { modPlayer.sCrystal = true; diff --git a/Buffs/SummonBuffs/SirenLure.cs b/Buffs/SummonBuffs/SirenLure.cs index ec26aa10ef..44ed75f8d2 100644 --- a/Buffs/SummonBuffs/SirenLure.cs +++ b/Buffs/SummonBuffs/SirenLure.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 0) { modPlayer.slWaifu = true; diff --git a/Buffs/SummonBuffs/SlimeGod.cs b/Buffs/SummonBuffs/SlimeGod.cs index e5828c8030..a9a9002012 100644 --- a/Buffs/SummonBuffs/SlimeGod.cs +++ b/Buffs/SummonBuffs/SlimeGod.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGodAlt")] > 0) { modPlayer.sGod = true; diff --git a/Buffs/SummonBuffs/SolarSpirit.cs b/Buffs/SummonBuffs/SolarSpirit.cs index e0703f15ce..a6e77ad69d 100644 --- a/Buffs/SummonBuffs/SolarSpirit.cs +++ b/Buffs/SummonBuffs/SolarSpirit.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("SolarPixie")] > 0) { modPlayer.SP = true; diff --git a/Buffs/SummonBuffs/SolarSpiritGod.cs b/Buffs/SummonBuffs/SolarSpiritGod.cs index cc9419371f..484f15813a 100644 --- a/Buffs/SummonBuffs/SolarSpiritGod.cs +++ b/Buffs/SummonBuffs/SolarSpiritGod.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("SolarGod")] > 0) { modPlayer.SPG = true; diff --git a/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs b/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs index 6992600d9c..375bdd5e76 100644 --- a/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs +++ b/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().sPower = true; + player.Calamity().sPower = true; } } } diff --git a/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs b/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs index ffe891cbe0..c997806868 100644 --- a/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs +++ b/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().sDefense = true; + player.Calamity().sDefense = true; } } } diff --git a/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs b/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs index c25c6d29e0..fe51919e10 100644 --- a/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs +++ b/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().sRegen = true; + player.Calamity().sRegen = true; } } } diff --git a/Buffs/SummonBuffs/Urchin.cs b/Buffs/SummonBuffs/Urchin.cs index 7b30ea77ce..d945733ecc 100644 --- a/Buffs/SummonBuffs/Urchin.cs +++ b/Buffs/SummonBuffs/Urchin.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Urchin")] > 0) { modPlayer.vUrchin = true; diff --git a/Buffs/SummonBuffs/Valkyrie.cs b/Buffs/SummonBuffs/Valkyrie.cs index 32c962f23e..9206903790 100644 --- a/Buffs/SummonBuffs/Valkyrie.cs +++ b/Buffs/SummonBuffs/Valkyrie.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Valkyrie")] > 0) { modPlayer.aValkyrie = true; diff --git a/Buffs/SunkenSea/Clamity.cs b/Buffs/SunkenSea/Clamity.cs index 9b9fdce197..49d30ab2ed 100644 --- a/Buffs/SunkenSea/Clamity.cs +++ b/Buffs/SunkenSea/Clamity.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.SunkenSea public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().clamity = true; + player.Calamity().clamity = true; } } } diff --git a/Buffs/SunkenSea/PearlAura.cs b/Buffs/SunkenSea/PearlAura.cs index 9f137147d2..d06b948a35 100644 --- a/Buffs/SunkenSea/PearlAura.cs +++ b/Buffs/SunkenSea/PearlAura.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.SunkenSea public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).pearlAura = true; + npc.Calamity().pearlAura = true; } } } diff --git a/Buffs/SunkenSea/Shellfish.cs b/Buffs/SunkenSea/Shellfish.cs index d63eb95fa8..2d80366f7e 100644 --- a/Buffs/SunkenSea/Shellfish.cs +++ b/Buffs/SunkenSea/Shellfish.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SunkenSea public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("Shellfish")] > 0) { modPlayer.shellfish = true; diff --git a/Buffs/SunkenSea/ShellfishEating.cs b/Buffs/SunkenSea/ShellfishEating.cs index 8f895bf729..438be73529 100644 --- a/Buffs/SunkenSea/ShellfishEating.cs +++ b/Buffs/SunkenSea/ShellfishEating.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.SunkenSea public override void Update(NPC npc, ref int buffIndex) { - npc.GetGlobalNPC(mod).shellfishVore = true; + npc.Calamity().shellfishVore = true; } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 16f439252f..53892332ca 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1,4 +1,6 @@ using CalamityMod.Items; +using CalamityMod.Items.Armor; +using CalamityMod.Items.Permafrost; using CalamityMod.NPCs; using CalamityMod.Projectiles; using CalamityMod.UI; @@ -1550,7 +1552,7 @@ namespace CalamityMod.CalPlayer public override bool CustomBiomesMatch(Player other) { - CalamityPlayer modOther = other.GetCalamityPlayer(); + CalamityPlayer modOther = other.Calamity(); return ZoneCalamity == modOther.ZoneCalamity || ZoneAstral == modOther.ZoneAstral || ZoneAbyss == modOther.ZoneAbyss || ZoneAbyssLayer1 == modOther.ZoneAbyssLayer1 || ZoneAbyssLayer2 == modOther.ZoneAbyssLayer2 || ZoneAbyssLayer3 == modOther.ZoneAbyssLayer3 || ZoneAbyssLayer4 == modOther.ZoneAbyssLayer4 || @@ -1559,7 +1561,7 @@ namespace CalamityMod.CalPlayer public override void CopyCustomBiomesTo(Player other) { - CalamityPlayer modOther = other.GetCalamityPlayer(); + CalamityPlayer modOther = other.Calamity(); modOther.ZoneCalamity = ZoneCalamity; modOther.ZoneAstral = ZoneAstral; modOther.ZoneSulphur = ZoneSulphur; @@ -2154,22 +2156,22 @@ namespace CalamityMod.CalPlayer for (int n = 13; n < 18 + player.extraAccessorySlots; n++) { Item item = player.armor[n]; - if (item.type == mod.ItemType()) + if (item.type == ModContent.ItemType()) { snowmanHide = false; snowmanForce = true; } - else if (item.type == mod.ItemType()) + else if (item.type == ModContent.ItemType()) { abyssalDivingSuitHide = false; abyssalDivingSuitForce = true; } - else if (item.type == mod.ItemType()) + else if (item.type == ModContent.ItemType()) { sirenBoobsHide = false; sirenBoobsForce = true; } - else if (item.type == mod.ItemType()) + else if (item.type == ModContent.ItemType()) { sirenBoobsAltHide = false; sirenBoobsAltForce = true; @@ -2268,12 +2270,12 @@ namespace CalamityMod.CalPlayer { if (player.whoAmI == Main.myPlayer && !snowmanNoseless) { - player.AddBuff(mod.BuffType(), 60, true); + player.AddBuff(ModContent.BuffType(), 60, true); } } if (abyssalDivingSuit) { - player.AddBuff(mod.BuffType(), 60, true); + player.AddBuff(ModContent.BuffType(), 60, true); if (player.whoAmI == Main.myPlayer) { if (abyssalDivingSuitCooldown) @@ -2297,11 +2299,11 @@ namespace CalamityMod.CalPlayer } if (sirenBoobs) { - player.AddBuff(mod.BuffType(), 60, true); + player.AddBuff(ModContent.BuffType(), 60, true); } else if (sirenBoobsAlt) { - player.AddBuff(mod.BuffType(), 60, true); + player.AddBuff(ModContent.BuffType(), 60, true); } if ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) { @@ -2974,7 +2976,7 @@ namespace CalamityMod.CalPlayer if (!tentaclesPresent[i]) { float modifier = player.meleeDamage + player.magicDamage + player.rangedDamage + - player.GetCalamityPlayer().throwingDamage + player.minionDamage; + player.Calamity().throwingDamage + player.minionDamage; modifier /= 5f; int damage = (int)(666 * modifier); Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; @@ -3130,7 +3132,7 @@ namespace CalamityMod.CalPlayer bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); if (shouldAffect) { - player.GetCalamityPlayer().throwingDamage += 0.1f; + player.Calamity().throwingDamage += 0.1f; } } } @@ -3189,7 +3191,7 @@ namespace CalamityMod.CalPlayer } if (raiderTalisman) { - player.GetCalamityPlayer().throwingDamage += ((float)raiderStack / 250f) * 0.25f; + player.Calamity().throwingDamage += ((float)raiderStack / 250f) * 0.25f; } if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon) { @@ -3687,8 +3689,8 @@ namespace CalamityMod.CalPlayer if (player.mount.Active) modStealth = 1f; } - player.GetCalamityPlayer().throwingDamage += (1f - modStealth) * 0.2f; - player.GetCalamityPlayer().throwingCrit += (int)((1f - modStealth) * 10f); + player.Calamity().throwingDamage += (1f - modStealth) * 0.2f; + player.Calamity().throwingCrit += (int)((1f - modStealth) * 10f); player.aggro -= (int)((1f - modStealth) * 750f); if (modStealthTimer > 0) modStealthTimer--; @@ -3810,15 +3812,15 @@ namespace CalamityMod.CalPlayer } if (armorCrumbling) { - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; player.meleeCrit += 5; } if (armorShattering) { if (player.FindBuffIndex(mod.BuffType("ArmorCrumbling")) > -1) { player.ClearBuff(mod.BuffType("ArmorCrumbling")); } - player.GetCalamityPlayer().throwingDamage += 0.08f; + player.Calamity().throwingDamage += 0.08f; player.meleeDamage += 0.08f; - player.GetCalamityPlayer().throwingCrit += 8; + player.Calamity().throwingCrit += 8; player.meleeCrit += 8; } if (holyWrath) @@ -4344,12 +4346,12 @@ namespace CalamityMod.CalPlayer { if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) { - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; player.statDefense += 30; } else { - player.GetCalamityPlayer().throwingDamage += 0.1f; + player.Calamity().throwingDamage += 0.1f; } } if (bloodflareSummon) @@ -4427,9 +4429,9 @@ namespace CalamityMod.CalPlayer { if (player.statLife >= player.statLifeMax2) { - player.GetCalamityPlayer().throwingCrit += 10; - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingVelocity += 0.1f; + player.Calamity().throwingCrit += 10; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingVelocity += 0.1f; } } if (tarraSummon) @@ -4581,7 +4583,7 @@ namespace CalamityMod.CalPlayer if (eArtifact) { player.manaCost *= 0.85f; - player.GetCalamityPlayer().throwingDamage += 0.15f; + player.Calamity().throwingDamage += 0.15f; player.maxMinions += 2; } if (gArtifact) @@ -5017,13 +5019,13 @@ namespace CalamityMod.CalPlayer { if (silvaRanged) { - if (item.ranged && !item.GetGlobalItem(mod).rogue && item.useTime > 3) + if (item.ranged && !item.Calamity().rogue && item.useTime > 3) return (auricSet ? 1.2f : 1.1f); } if (silvaThrowing) { if (player.statLife > (int)((double)player.statLifeMax2 * 0.5) && - item.GetGlobalItem(mod).rogue && item.useTime > 3) + item.Calamity().rogue && item.useTime > 3) return 1.1f; } return 1f; @@ -5058,7 +5060,7 @@ namespace CalamityMod.CalPlayer if (theBee && player.statLife >= player.statLifeMax2) { - if (item.melee || item.ranged || item.magic || item.GetGlobalItem(mod).rogue) + if (item.melee || item.ranged || item.magic || item.Calamity().rogue) { double useTimeBeeMultiplier = (double)(item.useTime * item.useAnimation) / 3600.0; //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 = 21.7% boost if (item.type == mod.ItemType("ScarletDevil")) @@ -5366,7 +5368,7 @@ namespace CalamityMod.CalPlayer } if (armorCrumbling || armorShattering) { - if (item.melee || item.GetGlobalItem(mod).rogue) + if (item.melee || item.Calamity().rogue) { if (Main.rand.NextBool(4)) { @@ -5530,7 +5532,7 @@ namespace CalamityMod.CalPlayer } if (armorCrumbling || armorShattering) { - if (proj.melee || proj.GetGlobalProjectile(mod).rogue) + if (proj.melee || proj.Calamity().rogue) { if (Main.rand.NextBool(4)) { @@ -5562,7 +5564,7 @@ namespace CalamityMod.CalPlayer { target.AddBuff(mod.BuffType("HolyLight"), 420, false); } - if (proj.GetGlobalProjectile(mod).rogue) + if (proj.Calamity().rogue) { if (player.meleeEnchant > 0) { @@ -5844,7 +5846,7 @@ namespace CalamityMod.CalPlayer } if (armorCrumbling || armorShattering) { - if (proj.melee || proj.GetGlobalProjectile(mod).rogue) + if (proj.melee || proj.Calamity().rogue) { if (Main.rand.NextBool(4)) { @@ -5876,7 +5878,7 @@ namespace CalamityMod.CalPlayer { target.AddBuff(mod.BuffType("HolyLight"), 420, false); } - if (proj.GetGlobalProjectile(mod).rogue) + if (proj.Calamity().rogue) { if (player.meleeEnchant > 0) { @@ -5962,7 +5964,7 @@ namespace CalamityMod.CalPlayer if (oldDie) { float diceMult = Main.rand.NextFloat(0.8824f, 1.1565f); - if (item.GetGlobalItem(mod).rogue || wearingRogueArmor) + if (item.Calamity().rogue || wearingRogueArmor) { float roll2 = Main.rand.NextFloat(0.8824f, 1.1565f); diceMult = roll2 > diceMult ? roll2 : diceMult; @@ -6098,13 +6100,13 @@ namespace CalamityMod.CalPlayer public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - bool isTrueMelee = proj.GetGlobalProjectile(mod).trueMelee; + bool isTrueMelee = proj.Calamity().trueMelee; bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); - bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.GetGlobalProjectile(mod).rogue; + bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; - if (proj.GetGlobalProjectile(mod).rogue) + if (proj.Calamity().rogue) { - crit = (Main.rand.Next(1, 101) < player.GetCalamityPlayer().throwingCrit); + crit = (Main.rand.Next(1, 101) < player.Calamity().throwingCrit); } #region MultiplierBoosts @@ -6117,7 +6119,7 @@ namespace CalamityMod.CalPlayer !player.inventory[player.selectedItem].melee && !player.inventory[player.selectedItem].ranged && !player.inventory[player.selectedItem].magic && - !player.inventory[player.selectedItem].GetGlobalItem(mod).rogue) || + !player.inventory[player.selectedItem].Calamity().rogue) || player.inventory[player.selectedItem].hammer > 0 || player.inventory[player.selectedItem].pick > 0 || player.inventory[player.selectedItem].axe > 0) @@ -6150,7 +6152,7 @@ namespace CalamityMod.CalPlayer } if (auricSet) { - if (silvaThrowing && proj.GetGlobalProjectile(mod).rogue && + if (silvaThrowing && proj.Calamity().rogue && crit && player.statLife > (int)((double)player.statLifeMax2 * 0.5)) { damageMult += 0.25; @@ -6174,7 +6176,7 @@ namespace CalamityMod.CalPlayer { damageMult += 0.4; } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.GetGlobalProjectile(mod).rogue) + if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.Calamity().rogue) { damageMult += 0.1; } @@ -6231,7 +6233,7 @@ namespace CalamityMod.CalPlayer if (oldDie) { float diceMult = Main.rand.NextFloat(0.8824f, 1.1565f); - if (proj.GetGlobalProjectile(mod).rogue || wearingRogueArmor) + if (proj.Calamity().rogue || wearingRogueArmor) { float roll2 = Main.rand.NextFloat(0.8824f, 1.1565f); diceMult = roll2 > diceMult ? roll2 : diceMult; @@ -6266,7 +6268,7 @@ namespace CalamityMod.CalPlayer (player.inventory[player.selectedItem].melee || player.inventory[player.selectedItem].ranged || player.inventory[player.selectedItem].magic || - player.inventory[player.selectedItem].GetGlobalItem(mod).rogue) && + player.inventory[player.selectedItem].Calamity().rogue) && player.inventory[player.selectedItem].hammer == 0 && player.inventory[player.selectedItem].pick == 0 && player.inventory[player.selectedItem].axe == 0) @@ -6303,14 +6305,14 @@ namespace CalamityMod.CalPlayer tarraCrits++; } if (tarraThrowing && tarraThrowingCritTimer <= 0 && tarraThrowingCrits < 25 && crit && - proj.GetGlobalProjectile(mod).rogue) + proj.Calamity().rogue) { tarraThrowingCrits++; } if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) { - if (theBeeDamage > 0 && (proj.melee || proj.ranged || proj.magic || proj.GetGlobalProjectile(mod).rogue)) + if (theBeeDamage > 0 && (proj.melee || proj.ranged || proj.magic || proj.Calamity().rogue)) { Main.PlaySound(2, (int)proj.position.X, (int)proj.position.Y, 110); } @@ -6379,7 +6381,7 @@ namespace CalamityMod.CalPlayer Main.projectile[FUCKYOU].netUpdate = true; } } - if (bloodflareThrowing && proj.GetGlobalProjectile(mod).rogue && crit && Main.rand.NextBool(2)) + if (bloodflareThrowing && proj.Calamity().rogue && crit && Main.rand.NextBool(2)) { if (target.canGhostHeal) { @@ -6514,7 +6516,7 @@ namespace CalamityMod.CalPlayer LevelPacket(false, 3); } } - else if (proj.GetGlobalProjectile(mod).rogue && rogueLevel <= 12500) + else if (proj.Calamity().rogue && rogueLevel <= 12500) { if (!Main.hardMode && rogueLevel >= 1500) { @@ -6535,7 +6537,7 @@ namespace CalamityMod.CalPlayer } } } - if (raiderTalisman && raiderStack < 250 && proj.GetGlobalProjectile(mod).rogue && crit) + if (raiderTalisman && raiderStack < 250 && proj.Calamity().rogue && crit) { raiderStack++; } @@ -8783,7 +8785,7 @@ namespace CalamityMod.CalPlayer } Player drawPlayer = drawInfo.drawPlayer; Mod mod = ModLoader.GetMod("CalamityMod"); - CalamityPlayer modPlayer = drawPlayer.GetCalamityPlayer(); + CalamityPlayer modPlayer = drawPlayer.Calamity(); if (modPlayer.sirenIce) { Texture2D texture = mod.GetTexture("ExtraTextures/IceShield"); @@ -8965,8 +8967,8 @@ namespace CalamityMod.CalPlayer { Mod mod = ModLoader.GetMod("CalamityMod"); Player drawPlayer = edi.drawPlayer; - if (drawPlayer.mount != null && (drawPlayer.GetCalamityPlayer().fab || drawPlayer.GetCalamityPlayer().crysthamyr || - drawPlayer.GetCalamityPlayer().onyxExcavator)) + if (drawPlayer.mount != null && (drawPlayer.Calamity().fab || drawPlayer.Calamity().crysthamyr || + drawPlayer.Calamity().onyxExcavator)) { drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, edi.position, edi.mountColor, edi.spriteEffects, edi.shadow); } @@ -9400,7 +9402,7 @@ namespace CalamityMod.CalPlayer player.rangedCrit += boost; player.magicCrit += boost; player.thrownCrit += boost; - player.GetCalamityPlayer().throwingCrit += boost; + player.Calamity().throwingCrit += boost; } #endregion @@ -9459,7 +9461,7 @@ namespace CalamityMod.CalPlayer private void ProvideStealthStatBonuses() { - CalamityPlayer roguePlayer = player.GetCalamityPlayer(); + CalamityPlayer roguePlayer = player.Calamity(); // At full stealth, you get 100% of the max possible bonus. Partial stealth only gives you 75% of the partial bonus you have. if (rogueStealth >= rogueStealthMax) @@ -10543,85 +10545,85 @@ namespace CalamityMod.CalPlayer #region RogueLevelBoosts if (rogueLevel >= 12500) { - player.GetCalamityPlayer().throwingDamage += 0.12f; - player.GetCalamityPlayer().throwingVelocity += 0.12f; - player.GetCalamityPlayer().throwingCrit += 6; + player.Calamity().throwingDamage += 0.12f; + player.Calamity().throwingVelocity += 0.12f; + player.Calamity().throwingCrit += 6; } else if (rogueLevel >= 10500) { - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingVelocity += 0.1f; - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingVelocity += 0.1f; + player.Calamity().throwingCrit += 5; } else if (rogueLevel >= 9100) { - player.GetCalamityPlayer().throwingDamage += 0.09f; - player.GetCalamityPlayer().throwingVelocity += 0.09f; - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingDamage += 0.09f; + player.Calamity().throwingVelocity += 0.09f; + player.Calamity().throwingCrit += 5; } else if (rogueLevel >= 7800) { - player.GetCalamityPlayer().throwingDamage += 0.08f; - player.GetCalamityPlayer().throwingVelocity += 0.08f; - player.GetCalamityPlayer().throwingCrit += 4; + player.Calamity().throwingDamage += 0.08f; + player.Calamity().throwingVelocity += 0.08f; + player.Calamity().throwingCrit += 4; } else if (rogueLevel >= 6600) { - player.GetCalamityPlayer().throwingDamage += 0.07f; - player.GetCalamityPlayer().throwingVelocity += 0.07f; - player.GetCalamityPlayer().throwingCrit += 4; + player.Calamity().throwingDamage += 0.07f; + player.Calamity().throwingVelocity += 0.07f; + player.Calamity().throwingCrit += 4; } else if (rogueLevel >= 5500) { - player.GetCalamityPlayer().throwingDamage += 0.06f; - player.GetCalamityPlayer().throwingVelocity += 0.06f; - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingDamage += 0.06f; + player.Calamity().throwingVelocity += 0.06f; + player.Calamity().throwingCrit += 3; } else if (rogueLevel >= 4500) { - player.GetCalamityPlayer().throwingDamage += 0.05f; - player.GetCalamityPlayer().throwingVelocity += 0.05f; - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingVelocity += 0.05f; + player.Calamity().throwingCrit += 3; } else if (rogueLevel >= 3600) { - player.GetCalamityPlayer().throwingDamage += 0.05f; - player.GetCalamityPlayer().throwingVelocity += 0.05f; - player.GetCalamityPlayer().throwingCrit += 2; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingVelocity += 0.05f; + player.Calamity().throwingCrit += 2; } else if (rogueLevel >= 2800) { - player.GetCalamityPlayer().throwingDamage += 0.04f; - player.GetCalamityPlayer().throwingVelocity += 0.04f; - player.GetCalamityPlayer().throwingCrit += 2; + player.Calamity().throwingDamage += 0.04f; + player.Calamity().throwingVelocity += 0.04f; + player.Calamity().throwingCrit += 2; } else if (rogueLevel >= 2100) { - player.GetCalamityPlayer().throwingDamage += 0.04f; - player.GetCalamityPlayer().throwingVelocity += 0.03f; - player.GetCalamityPlayer().throwingCrit += 1; + player.Calamity().throwingDamage += 0.04f; + player.Calamity().throwingVelocity += 0.03f; + player.Calamity().throwingCrit += 1; } else if (rogueLevel >= 1500) { - player.GetCalamityPlayer().throwingDamage += 0.03f; - player.GetCalamityPlayer().throwingVelocity += 0.02f; - player.GetCalamityPlayer().throwingCrit += 1; + player.Calamity().throwingDamage += 0.03f; + player.Calamity().throwingVelocity += 0.02f; + player.Calamity().throwingCrit += 1; } else if (rogueLevel >= 1000) { - player.GetCalamityPlayer().throwingDamage += 0.03f; - player.GetCalamityPlayer().throwingVelocity += 0.01f; - player.GetCalamityPlayer().throwingCrit += 1; + player.Calamity().throwingDamage += 0.03f; + player.Calamity().throwingVelocity += 0.01f; + player.Calamity().throwingCrit += 1; } else if (rogueLevel >= 600) { - player.GetCalamityPlayer().throwingDamage += 0.02f; - player.GetCalamityPlayer().throwingVelocity += 0.01f; + player.Calamity().throwingDamage += 0.02f; + player.Calamity().throwingVelocity += 0.01f; } else if (rogueLevel >= 300) - player.GetCalamityPlayer().throwingDamage += 0.02f; + player.Calamity().throwingDamage += 0.02f; else if (rogueLevel >= 100) - player.GetCalamityPlayer().throwingDamage += 0.01f; + player.Calamity().throwingDamage += 0.01f; #endregion } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index ffcd4e0e2c..e9e015bebd 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -14,7 +14,7 @@ namespace CalamityMod.CalPlayer public static void CalamityUpdateBadLifeRegen(Player player, Mod mod) { Point point = player.Center.ToTileCoordinates(); - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); //Initial Debuffs @@ -402,7 +402,7 @@ namespace CalamityMod.CalPlayer #region Update Life Regen public static void CalamityUpdateLifeRegen(Player player, Mod mod) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!player.shinyStone) { diff --git a/CalamityMod.cs b/CalamityMod.cs index e444b2b22f..8029067ec4 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -2328,7 +2328,7 @@ namespace CalamityMod { layers.Insert(index, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () { - if (Main.LocalPlayer.GetCalamityPlayer().drawBossHPBar) + if (Main.LocalPlayer.Calamity().drawBossHPBar) { BossHealthBarManager.Update(); BossHealthBarManager.Draw(Main.spriteBatch); diff --git a/Items/AbyssItems/AbyssalAmulet.cs b/Items/AbyssItems/AbyssalAmulet.cs index 84a1448152..a2bdb18eab 100644 --- a/Items/AbyssItems/AbyssalAmulet.cs +++ b/Items/AbyssItems/AbyssalAmulet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.abyssalAmulet = true; } } diff --git a/Items/AbyssItems/AbyssalDivingGear.cs b/Items/AbyssItems/AbyssalDivingGear.cs index db82190724..fe8b00c3d4 100644 --- a/Items/AbyssItems/AbyssalDivingGear.cs +++ b/Items/AbyssItems/AbyssalDivingGear.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.depthCharm = true; modPlayer.jellyfishNecklace = true; player.arcticDivingGear = true; diff --git a/Items/AbyssItems/AnechoicPlating.cs b/Items/AbyssItems/AnechoicPlating.cs index 0d1d7c5e9d..052f35c78e 100644 --- a/Items/AbyssItems/AnechoicPlating.cs +++ b/Items/AbyssItems/AnechoicPlating.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.anechoicPlating = true; } } diff --git a/Items/AbyssItems/DepthCharm.cs b/Items/AbyssItems/DepthCharm.cs index 3d1c4c9a0b..5c020205b5 100644 --- a/Items/AbyssItems/DepthCharm.cs +++ b/Items/AbyssItems/DepthCharm.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.depthCharm = true; } } diff --git a/Items/AbyssItems/IronBoots.cs b/Items/AbyssItems/IronBoots.cs index c66ff107b8..d94c67fd4b 100644 --- a/Items/AbyssItems/IronBoots.cs +++ b/Items/AbyssItems/IronBoots.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ironBoots = true; } } diff --git a/Items/AbyssItems/LumenousAmulet.cs b/Items/AbyssItems/LumenousAmulet.cs index 74760a4b51..291930cc07 100644 --- a/Items/AbyssItems/LumenousAmulet.cs +++ b/Items/AbyssItems/LumenousAmulet.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.abyssalAmulet = true; modPlayer.lumenousAmulet = true; } diff --git a/Items/AbyssItems/ReaperToothNecklace.cs b/Items/AbyssItems/ReaperToothNecklace.cs index 6b72eb4090..d6fb39becf 100644 --- a/Items/AbyssItems/ReaperToothNecklace.cs +++ b/Items/AbyssItems/ReaperToothNecklace.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.reaperToothNecklace = true; player.armorPenetration += 100; } diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index befdd2c77a..e3cb0bd45c 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.alchFlask = true; player.buffImmune[mod.BuffType("Plague")] = true; } diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 333047307d..9be864bcde 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aBrain = true; if (player.immune) { diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 2dc6d38526..914d2bea3b 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.beeResist = true; modPlayer.aAmpoule = true; } diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index 4550afd594..96a20bcbae 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aSpark = true; } } diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index 3a91847884..fcf0bd16e3 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.harpyRing = true; player.accRunSpeed = 8f; player.rocketBoots = 3; diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 433965096c..8ab7053ace 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.projRef = true; } } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index a6812f2c4d..0deeb09e1a 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -28,12 +28,12 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(0, 90, 0, 0); //30 gold reforge item.defense = 10; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!hideVisual) { modPlayer.dashMod = 4; } modPlayer.elysianAegis = true; player.noKnockback = true; diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 0e7823addb..251d410f56 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!hideVisual) { modPlayer.dashMod = 2; } player.buffImmune[46] = true; player.buffImmune[44] = true; diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index dc64433b4e..5cf1fa8fd7 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.astralArcanum = true; modPlayer.aBulwark = true; modPlayer.projRef = true; diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs index b81f29580e..ffea86ee61 100644 --- a/Items/Accessories/AstralBulwark.cs +++ b/Items/Accessories/AstralBulwark.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aBulwark = true; player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; } diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 29a595794e..d24011da22 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories item.height = 30; item.value = Item.buyPrice(0, 21, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.badgeOfBravery = true; } diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 91d6d01e02..529cdd5b00 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareCore = true; } } diff --git a/Items/Accessories/BurdenBreaker.cs b/Items/Accessories/BurdenBreaker.cs index ab7a63beea..2e7dcd2f02 100644 --- a/Items/Accessories/BurdenBreaker.cs +++ b/Items/Accessories/BurdenBreaker.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories player.lavaImmune = false; if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) { - player.GetCalamityPlayer().KillPlayer(); + player.Calamity().KillPlayer(); } else if (player.immune) { diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index c8ddb93a10..387a62477f 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.celestialJewel = true; } diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index 7692ada038..c01980e63f 100644 --- a/Items/Accessories/CheatTestThing.cs +++ b/Items/Accessories/CheatTestThing.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); bool canUse = (player.name == "Fabsol" || player.name == "Totalbiscuit") && player.townNPCs <= 1; if (canUse) { diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index fc37a9a979..346f76bbe9 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); - player.GetCalamityPlayer().throwingCrit += 6; + CalamityPlayer modPlayer = player.Calamity(); + player.Calamity().throwingCrit += 6; } public override void AddRecipes() diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index c4dcf7769e..4025a88932 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.coreOfTheBloodGod = true; modPlayer.fleshTotem = true; } diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index c33ddee3c1..9b21797b1e 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dodgeScarf = true; modPlayer.dashMod = 1; } diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index 45e4e67c9f..75e02694ad 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.crownJewel = true; } } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 071925da85..237af15ed1 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Accessories item.defense = 10; item.lifeRegen = 1; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.darkSunRing = true; } diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 02fe367f2b..23b3f42782 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dAmulet = true; modPlayer.jellyfishNecklace = true; } diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 6b1f462fb8..64577385dc 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(1, 50, 0, 0); item.accessory = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dArtifact = true; } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 2ef9570d72..17f27d37e1 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.draedonsHeart = true; player.buffImmune[mod.BuffType("Horror")] = true; modPlayer.draedonsStressGain = true; diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 207c7a6f6c..ff4606fb6e 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = Item.buyPrice(0, 22, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; item.accessory = true; } diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 5c653bc7ec..3d02f4a28b 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(1, 50, 0, 0); item.accessory = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.eArtifact = true; } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 865aeb51ae..640aaeb5e4 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Items.Accessories item.height = 38; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.eGauntlet = true; } diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 38c150ef41..0fe34b3d41 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.eQuiver = true; player.rangedDamage += 0.1f; player.rangedCrit += 5; diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 1a6e203fe3..db24091f4e 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.eTalisman = true; player.findTreasure = true; if (!hideVisual) diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 0171ae6fd8..1200f24b0c 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.elementalHeart) { return false; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.cloudWaifu = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs index a7e58904de..300575980a 100644 --- a/Items/Accessories/FrigidBulwark.cs +++ b/Items/Accessories/FrigidBulwark.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fBulwark = true; } diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index 3e9b9862f5..a28388bb9b 100644 --- a/Items/Accessories/FrostBarrier.cs +++ b/Items/Accessories/FrostBarrier.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fBarrier = true; player.buffImmune[46] = true; } diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index 58af05518e..b1e798b5da 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.frostFlare = true; } } diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs index d001ef10c8..6f3aa9d11a 100644 --- a/Items/Accessories/FungalCarapace.cs +++ b/Items/Accessories/FungalCarapace.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fCarapace = true; } } diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 67155be556..4a8efa8966 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.moveSpeed -= 0.15f; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.gShell = true; } } diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/GodlySoulArtifact.cs index 98e0fd5c6e..3a4c6afa25 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/GodlySoulArtifact.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(1, 50, 0, 0); item.accessory = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.gArtifact = true; } diff --git a/Items/Accessories/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs index d99671faa0..9b01647074 100644 --- a/Items/Accessories/GoldBurdenBreaker.cs +++ b/Items/Accessories/GoldBurdenBreaker.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(0, 21, 0, 0); item.rare = 10; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index 181ed56e06..0580dffe7e 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.harpyRing = true; } diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index ad89f38b9f..04bdecd78d 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.heartOfDarkness = true; } } diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 6af1ff8cd4..f9d8040ab1 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -31,12 +31,12 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 9; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.brimstoneWaifu || modPlayer.sandWaifu || modPlayer.sandBoobWaifu || modPlayer.cloudWaifu || modPlayer.sirenWaifu) { return false; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.allWaifus = !hideVisual; modPlayer.elementalHeart = true; if (!hideVisual) diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index 953b2247c6..633f5ae0df 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.beeResist = true; if (player.ZoneJungle) { diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index f11d701a58..41d682ca71 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.laudanum = true; player.buffImmune[mod.BuffType("Horror")] = true; } diff --git a/Items/Accessories/MagicLevelMeter.cs b/Items/Accessories/MagicLevelMeter.cs index d6a4fa10c6..937f186978 100644 --- a/Items/Accessories/MagicLevelMeter.cs +++ b/Items/Accessories/MagicLevelMeter.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - int level = Main.player[Main.myPlayer].GetCalamityPlayer().magicLevel; - int exactLevel = Main.player[Main.myPlayer].GetCalamityPlayer().exactMagicLevel; + int level = Main.player[Main.myPlayer].Calamity().magicLevel; + int exactLevel = Main.player[Main.myPlayer].Calamity().exactMagicLevel; int damageGain = 0; int manaUsage = 0; int critGain = 0; @@ -122,7 +122,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fasterMagicLevel = true; } } diff --git a/Items/Accessories/MeleeLevelMeter.cs b/Items/Accessories/MeleeLevelMeter.cs index 70e98e712d..aa3dc8c7ba 100644 --- a/Items/Accessories/MeleeLevelMeter.cs +++ b/Items/Accessories/MeleeLevelMeter.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - int level = Main.player[Main.myPlayer].GetCalamityPlayer().meleeLevel; - int exactLevel = Main.player[Main.myPlayer].GetCalamityPlayer().exactMeleeLevel; + int level = Main.player[Main.myPlayer].Calamity().meleeLevel; + int exactLevel = Main.player[Main.myPlayer].Calamity().exactMeleeLevel; int damageGain = 0; int meleeSpeed = 0; int critGain = 0; @@ -122,7 +122,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fasterMeleeLevel = true; } } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 225f6fa7f6..957cea9e12 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = Item.buyPrice(0, 18, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; item.accessory = true; } diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 9b5b3adc03..8ef1017227 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -25,17 +25,17 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.nanotech = true; modPlayer.raiderTalisman = true; - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingCrit += 5; - player.GetCalamityPlayer().throwingVelocity += 0.15f; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingCrit += 5; + player.Calamity().throwingVelocity += 0.15f; } public override void AddRecipes() diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index f787de8ec3..7fe2d6eac8 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.vexation = true; } diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index 4305c1df0b..fb96d9336c 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.oldDie = true; } } diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 90e3a27599..f227581132 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.buffImmune[mod.BuffType("Plague")] = true; player.bee = true; modPlayer.uberBees = true; diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index 4343ff9ac2..9c0288c4e6 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.pAmulet = true; player.shroomiteStealth = true; modPlayer.throwingDamage += 0.05f; diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 14a326b08d..2f2f08e61f 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.raiderTalisman = true; } diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 803a56216e..beb43c7b38 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 12; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dAmulet = true; modPlayer.rampartOfDeities = true; modPlayer.jellyfishNecklace = true; diff --git a/Items/Accessories/RangedLevelMeter.cs b/Items/Accessories/RangedLevelMeter.cs index 9e7f87f9bd..1ad46d86c2 100644 --- a/Items/Accessories/RangedLevelMeter.cs +++ b/Items/Accessories/RangedLevelMeter.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - int level = Main.player[Main.myPlayer].GetCalamityPlayer().rangedLevel; - int exactLevel = Main.player[Main.myPlayer].GetCalamityPlayer().exactRangedLevel; + int level = Main.player[Main.myPlayer].Calamity().rangedLevel; + int exactLevel = Main.player[Main.myPlayer].Calamity().exactRangedLevel; int damageGain = 0; int moveSpeed = 0; int critGain = 0; @@ -122,7 +122,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fasterRangedLevel = true; } } diff --git a/Items/Accessories/RareVariants/DeepDiver.cs b/Items/Accessories/RareVariants/DeepDiver.cs index 8c421a7ca8..0574dc1816 100644 --- a/Items/Accessories/RareVariants/DeepDiver.cs +++ b/Items/Accessories/RareVariants/DeepDiver.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Accessories.RareVariants item.rare = 2; item.defense = 2; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.deepDiver = true; modPlayer.dashMod = 5; } diff --git a/Items/Accessories/RareVariants/FabledTortoiseShell.cs b/Items/Accessories/RareVariants/FabledTortoiseShell.cs index f83785ed36..1a14b9068d 100644 --- a/Items/Accessories/RareVariants/FabledTortoiseShell.cs +++ b/Items/Accessories/RareVariants/FabledTortoiseShell.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.Accessories.RareVariants item.value = Item.buyPrice(0, 9, 0, 0); item.rare = 5; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fabledTortoise = true; player.moveSpeed -= 0.5f; player.thorns = 0.25f; diff --git a/Items/Accessories/RareVariants/HideofAstrumDeus.cs b/Items/Accessories/RareVariants/HideofAstrumDeus.cs index efbcc6b8c3..d5dfa85d2c 100644 --- a/Items/Accessories/RareVariants/HideofAstrumDeus.cs +++ b/Items/Accessories/RareVariants/HideofAstrumDeus.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.Accessories.RareVariants item.height = 26; item.value = Item.buyPrice(0, 30, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aBulwark = true; player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; modPlayer.aBulwarkRare = true; diff --git a/Items/Accessories/RareVariants/Regenator.cs b/Items/Accessories/RareVariants/Regenator.cs index 299ac4e4bf..da74034304 100644 --- a/Items/Accessories/RareVariants/Regenator.cs +++ b/Items/Accessories/RareVariants/Regenator.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories.RareVariants item.rare = 5; item.defense = 6; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.regenator = true; } } diff --git a/Items/Accessories/RareVariants/SamuraiBadge.cs b/Items/Accessories/RareVariants/SamuraiBadge.cs index b9fe6661fe..c0124666a3 100644 --- a/Items/Accessories/RareVariants/SamuraiBadge.cs +++ b/Items/Accessories/RareVariants/SamuraiBadge.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories.RareVariants item.height = 30; item.value = Item.buyPrice(0, 21, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.badgeOfBraveryRare = true; } } diff --git a/Items/Accessories/RareVariants/TheBee.cs b/Items/Accessories/RareVariants/TheBee.cs index 2c1551f950..8f391ae44e 100644 --- a/Items/Accessories/RareVariants/TheBee.cs +++ b/Items/Accessories/RareVariants/TheBee.cs @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Accessories.RareVariants item.value = Item.buyPrice(0, 9, 0, 0); item.rare = 4; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { player.starCloak = true; player.bee = true; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.theBee = true; } } diff --git a/Items/Accessories/RareVariants/TheEvolution.cs b/Items/Accessories/RareVariants/TheEvolution.cs index abe4ae0906..a48119373f 100644 --- a/Items/Accessories/RareVariants/TheEvolution.cs +++ b/Items/Accessories/RareVariants/TheEvolution.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories.RareVariants item.height = 26; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.projRefRare = true; } } diff --git a/Items/Accessories/RareVariants/TheTransformer.cs b/Items/Accessories/RareVariants/TheTransformer.cs index ddc81bc3b8..d942f08258 100644 --- a/Items/Accessories/RareVariants/TheTransformer.cs +++ b/Items/Accessories/RareVariants/TheTransformer.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.Accessories.RareVariants item.value = Item.buyPrice(0, 3, 0, 0); item.rare = 1; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aSparkRare = true; modPlayer.aSpark = true; } diff --git a/Items/Accessories/RogueEmblem.cs b/Items/Accessories/RogueEmblem.cs index 9ebc2c98ff..7dd74b044c 100644 --- a/Items/Accessories/RogueEmblem.cs +++ b/Items/Accessories/RogueEmblem.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.throwingDamage += 0.15f; } } diff --git a/Items/Accessories/RogueLevelMeter.cs b/Items/Accessories/RogueLevelMeter.cs index e4fc3d98b2..66c276a657 100644 --- a/Items/Accessories/RogueLevelMeter.cs +++ b/Items/Accessories/RogueLevelMeter.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - int level = Main.player[Main.myPlayer].GetCalamityPlayer().rogueLevel; - int exactLevel = Main.player[Main.myPlayer].GetCalamityPlayer().exactRogueLevel; + int level = Main.player[Main.myPlayer].Calamity().rogueLevel; + int exactLevel = Main.player[Main.myPlayer].Calamity().exactRogueLevel; int damageGain = 0; int velocityGain = 0; int critGain = 0; @@ -122,7 +122,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fasterRogueLevel = true; } } diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs index 456ff59b8d..40413953b6 100644 --- a/Items/Accessories/SpiritGenerator.cs +++ b/Items/Accessories/SpiritGenerator.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.sGenerator = true; } diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index e5b14d0aa0..80ca2f8382 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -31,12 +31,12 @@ namespace CalamityMod.Items.Accessories item.height = 20; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.beeResist = true; modPlayer.aSpark = true; modPlayer.gShell = true; diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index ab83669233..dc5ba0419a 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.statisBeltOfCurses = true; modPlayer.shadowMinions = true; modPlayer.tearMinions = true; @@ -45,9 +45,9 @@ namespace CalamityMod.Items.Accessories player.blackBelt = true; player.dash = 1; player.spikedBoots = 2; - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingCrit += 5; - player.GetCalamityPlayer().throwingVelocity += 0.1f; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingCrit += 5; + player.Calamity().throwingVelocity += 0.1f; } public override void AddRecipes() diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 29a7b807fb..7e8c12adf0 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tearMinions = true; player.minionKB += 2.5f; player.minionDamage += 0.1f; diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index dd84707ef0..c6c4a6830c 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.shadowMinions = true; modPlayer.tearMinions = true; player.minionKB += 2.5f; diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index f3fcc3d64d..4aab837151 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.autoJump = true; player.jumpSpeedBoost += 0.4f; player.extraFall += 35; diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index 61c4b1b173..2e98034e33 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.stressPills = true; } } diff --git a/Items/Accessories/SummonLevelMeter.cs b/Items/Accessories/SummonLevelMeter.cs index adacae5700..3294e8510d 100644 --- a/Items/Accessories/SummonLevelMeter.cs +++ b/Items/Accessories/SummonLevelMeter.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - int level = Main.player[Main.myPlayer].GetCalamityPlayer().summonLevel; - int exactLevel = Main.player[Main.myPlayer].GetCalamityPlayer().exactSummonLevel; + int level = Main.player[Main.myPlayer].Calamity().summonLevel; + int exactLevel = Main.player[Main.myPlayer].Calamity().exactSummonLevel; int damageGain = 0; int minionKB = 0; int minionSlots = 0; @@ -120,7 +120,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fasterSummonLevel = true; } } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index e8e01bee90..46efc1bbef 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aSpark = true; modPlayer.gShell = true; modPlayer.fCarapace = true; diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index b0cf6d2943..d5b95f3688 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.fungalClump) { return false; @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aBrain = true; modPlayer.fungalClump = true; if (player.whoAmI == Main.myPlayer) diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index 98c3855ad0..ebe8bc9627 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Accessories item.height = 20; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.community = true; } } diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index 7493b0de5a..8a650aaf4f 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.shadowMinions = true; } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index 14c64034d7..63065c90e6 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.calamityRing) { return false; @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; player.lavaRose = true; player.lavaMax += 240; diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index a5bb90b0c7..257d361b6e 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.elementalHeart) { return false; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.sandWaifu = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index d7b74ce96a..0ccb55f109 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.elementalHeart) { return false; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.sandBoobWaifu = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index de90dcdd77..07a54930fb 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.reaverDoubleTap || modPlayer.reaverBurst || modPlayer.reaverOrb || modPlayer.reaverBlast || modPlayer.reaverSpore) { diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index 2b3298cd95..f467d31e74 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories.Wings item.height = 32; item.value = Item.buyPrice(1, 20, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.accRunSpeed = 12f; player.rocketBoots = 3; player.moveSpeed += 0.5f; diff --git a/Items/Accessories/Wings/DiscordianWings.cs b/Items/Accessories/Wings/DiscordianWings.cs index a158290da6..9359168856 100644 --- a/Items/Accessories/Wings/DiscordianWings.cs +++ b/Items/Accessories/Wings/DiscordianWings.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.ataxiaBlaze) { diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index be952ecc4e..00c5b47d65 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 22; item.height = 20; item.value = Item.buyPrice(1, 0, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; item.accessory = true; } diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index a95ff90a2e..de21876b65 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories.Wings item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.accRunSpeed = 10.5f; player.rocketBoots = 3; player.moveSpeed += 0.36f; diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 2eefc9829c..4e18e0eb61 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.astralStarRain) { diff --git a/Items/Accessories/Wings/InfinityBoots.cs b/Items/Accessories/Wings/InfinityBoots.cs index 032bfa5088..aecd29e19f 100644 --- a/Items/Accessories/Wings/InfinityBoots.cs +++ b/Items/Accessories/Wings/InfinityBoots.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories.Wings item.height = 32; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.accRunSpeed = 9.25f; player.rocketBoots = 3; player.moveSpeed += 0.24f; diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index a3b7372ad0..d66bf2a040 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.daedalusReflect || modPlayer.daedalusCrystal || modPlayer.daedalusAbsorb || modPlayer.daedalusShard || modPlayer.daedalusSplit) { diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index cb0ed6fa19..d80aa172cb 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.tarraSet) { diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index 6fab33895c..ad3beb1c86 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -54,12 +54,12 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.xerocSet) { - player.GetCalamityPlayer().throwingDamage += 0.05f; - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingCrit += 5; } ascentWhenFalling = 0.75f; diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 67b7c2ec17..83d7d7c31d 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.Accessories item.height = 38; item.value = Item.buyPrice(0, 30, 0, 0); item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.yInsignia = true; } diff --git a/Items/AquaticScourge/AquaticEmblem.cs b/Items/AquaticScourge/AquaticEmblem.cs index 8b508a3c99..0281f2cfc3 100644 --- a/Items/AquaticScourge/AquaticEmblem.cs +++ b/Items/AquaticScourge/AquaticEmblem.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.AquaticScourge public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aquaticEmblem = true; player.npcTypeNoAggro[65] = true; player.npcTypeNoAggro[220] = true; diff --git a/Items/AquaticScourge/Seafood.cs b/Items/AquaticScourge/Seafood.cs index 334b0338aa..86246f8b78 100644 --- a/Items/AquaticScourge/Seafood.cs +++ b/Items/AquaticScourge/Seafood.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.AquaticScourge public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); return modPlayer.ZoneSulphur && !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead")); } diff --git a/Items/Armor/AerospecBreastplate.cs b/Items/Armor/AerospecBreastplate.cs index e40b57d748..cd6a94e29a 100644 --- a/Items/Armor/AerospecBreastplate.cs +++ b/Items/Armor/AerospecBreastplate.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor player.meleeCrit += 3; player.rangedCrit += 3; player.magicCrit += 3; - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; } public override void AddRecipes() diff --git a/Items/Armor/AerospecHat.cs b/Items/Armor/AerospecHat.cs index 637f4b63b1..0da2786c8c 100644 --- a/Items/Armor/AerospecHat.cs +++ b/Items/Armor/AerospecHat.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "5% increased movement speed and magic critical strike chance\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aeroSet = true; player.noFallDmg = true; player.moveSpeed += 0.05f; diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index 6fae64a91e..1ba9ff38bb 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.cs @@ -48,18 +48,18 @@ namespace CalamityMod.Items.Armor "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aeroSet = true; modPlayer.rogueStealthMax = 1f; player.noFallDmg = true; player.moveSpeed += 0.05f; - player.GetCalamityPlayer().throwingCrit += 5; - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().throwingCrit += 5; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingDamage += 0.08f; + player.Calamity().throwingDamage += 0.08f; player.moveSpeed += 0.05f; } diff --git a/Items/Armor/AerospecHelm.cs b/Items/Armor/AerospecHelm.cs index e2fdc6537a..70f8e0020a 100644 --- a/Items/Armor/AerospecHelm.cs +++ b/Items/Armor/AerospecHelm.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "5% increased movement speed and melee critical strike chance\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aeroSet = true; player.noFallDmg = true; player.moveSpeed += 0.05f; diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index ce29b56913..f35f99b85c 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor "Summons a valkyrie to protect you\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.valkyrie = true; modPlayer.aeroSet = true; player.noFallDmg = true; diff --git a/Items/Armor/AerospecHood.cs b/Items/Armor/AerospecHood.cs index a3671fa2f8..796bb9f2c3 100644 --- a/Items/Armor/AerospecHood.cs +++ b/Items/Armor/AerospecHood.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "5% increased movement speed and ranged critical strike chance\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aeroSet = true; player.noFallDmg = true; player.moveSpeed += 0.05f; diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs index e483578d91..61c1341e36 100644 --- a/Items/Armor/AstralHelm.cs +++ b/Items/Armor/AstralHelm.cs @@ -39,12 +39,12 @@ namespace CalamityMod.Items.Armor "28% increased damage and 21% increased critical strike chance\n" + "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + "This effect has a 1 second cooldown before it can trigger again"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.astralStarRain = true; player.moveSpeed += 0.25f; player.allDamage += 0.28f; modPlayer.AllCritBoost(21); - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs index 8c51e2d16b..b0c1e14442 100644 --- a/Items/Armor/AtaxiaHeadgear.cs +++ b/Items/Armor/AtaxiaHeadgear.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Armor "Inferno effect when below 50% life\n" + "You have a 50% chance to fire a homing chaos flare when using ranged weapons\n" + "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaBolt = true; player.rangedDamage += 0.05f; diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs index 1f6734f56c..bb83aa71e5 100644 --- a/Items/Armor/AtaxiaHelm.cs +++ b/Items/Armor/AtaxiaHelm.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor "Inferno effect when below 50% life\n" + "Melee attacks and projectiles cause chaos flames to erupt on enemy hits\n" + "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaGeyser = true; player.meleeDamage += 0.05f; @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaFire = true; player.meleeSpeed += 0.12f; player.moveSpeed += 0.12f; diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index 5b6cc794b0..0d6026b5d8 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor "Inferno effect when below 50% life\n" + "Summons a chaos spirit to protect you\n" + "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.chaosSpirit = true; if (player.whoAmI == Main.myPlayer) diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index f1b983fc25..25fd1bbcf9 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -45,19 +45,19 @@ namespace CalamityMod.Items.Armor "Rogue stealth builds while not attacking and not moving, up to a max of 120\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaVolley = true; modPlayer.rogueStealthMax = 1.2f; - player.GetCalamityPlayer().throwingDamage += 0.05f; - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingAmmoCost50 = true; - player.GetCalamityPlayer().throwingDamage += 0.12f; - player.GetCalamityPlayer().throwingCrit += 10; + player.Calamity().throwingAmmoCost50 = true; + player.Calamity().throwingDamage += 0.12f; + player.Calamity().throwingCrit += 10; player.moveSpeed += 0.15f; player.lavaMax += 240; player.buffImmune[BuffID.OnFire] = true; diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index bda4abafc4..ab937a9a94 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor "Inferno effect when below 50% life\n" + "Magic attacks summon damaging and healing flare orbs on hit\n" + "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaMage = true; player.magicDamage += 0.05f; diff --git a/Items/Armor/AtaxiaSubligar.cs b/Items/Armor/AtaxiaSubligar.cs index 9388968fe4..13bf660ea4 100644 --- a/Items/Armor/AtaxiaSubligar.cs +++ b/Items/Armor/AtaxiaSubligar.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor player.meleeCrit += 3; player.magicCrit += 3; player.rangedCrit += 3; - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; player.moveSpeed += 0.15f; } diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index e6905244fd..85b462681f 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(1, 44, 0, 0); item.defense = 48; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fBarrier = true; modPlayer.godSlayerReflect = true; player.statLifeMax2 += 100; diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index 4ed63c4f3f..6c26cf6bf7 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(1, 8, 0, 0); item.defense = 44; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index 87aabce0bb..797325a617 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(1, 80, 0, 0); item.defense = 54; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + "Your melee damage is multiplied based on how high your HP is; at full HP this effect is at max"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMelee = true; modPlayer.bloodflareSet = true; @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; player.meleeDamage += 0.2f; player.meleeCrit += 20; diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index 67e05eddc6..0de269f60e 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(1, 80, 0, 0); item.defense = 40; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Ranged Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraRanged = true; modPlayer.bloodflareSet = true; @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; player.rangedDamage += 0.3f; player.rangedCrit += 30; diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index 8d1e8f56e5..edc8a87ab7 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(1, 80, 0, 0); item.defense = 34; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor "Rogue stealth builds while not attacking and not moving, up to a max of 160\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; modPlayer.bloodflareSet = true; @@ -68,10 +68,10 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; - player.GetCalamityPlayer().throwingDamage += 0.2f; - player.GetCalamityPlayer().throwingCrit += 20; + player.Calamity().throwingDamage += 0.2f; + player.Calamity().throwingCrit += 20; player.moveSpeed += 0.25f; } diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 9a8201e2b7..5f34cad403 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(1, 80, 0, 0); item.defense = 12; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + "+1 max minion and 120% increased minion damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraSummon = true; modPlayer.bloodflareSet = true; @@ -197,7 +197,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; player.maxMinions += 7; } diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index 74fd30a46e..9f856f6075 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(1, 80, 0, 0); item.defense = 24; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Magic Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMage = true; modPlayer.bloodflareSet = true; @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; player.manaCost *= 0.8f; player.magicDamage += 0.2f; diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs index e837ffa24d..19928906bd 100644 --- a/Items/Armor/BloodflareBodyArmor.cs +++ b/Items/Armor/BloodflareBodyArmor.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 48, 0, 0); item.defense = 35; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs index 741caab7d4..f5cb67c375 100644 --- a/Items/Armor/BloodflareCuisses.cs +++ b/Items/Armor/BloodflareCuisses.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 36, 0, 0); item.defense = 29; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index bc5c364835..df79a66b96 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 28; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareThrowing = true; modPlayer.rogueStealthMax = 1.35f; @@ -59,8 +59,8 @@ namespace CalamityMod.Items.Armor { player.lavaMax += 240; player.ignoreWater = true; - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingCrit += 10; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingCrit += 10; player.moveSpeed += 0.15f; } diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index 86361aa0d9..cc6abc858b 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 16; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareSummon = true; player.setBonus = "55% increased minion damage\n" + diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs index 0eacca3292..710e3f2275 100644 --- a/Items/Armor/BloodflareHornedHelm.cs +++ b/Items/Armor/BloodflareHornedHelm.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 34; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareRanged = true; player.setBonus = "Greatly increases life regen\n" + diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index 46981db00c..e12c43b049 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 22; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareMage = true; player.setBonus = "Greatly increases life regen\n" + diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index eb2c522804..9ed8487f16 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 49; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareMelee = true; player.setBonus = "Greatly increases life regen\n" + diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index c5eddc6091..5594925252 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "5% increased magic damage\n" + "You have a 10% chance to absorb physical attacks and projectiles when hit\n" + "If you absorb an attack you are healed for 1/2 of that attack's damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusAbsorb = true; player.magicDamage += 0.05f; } diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index 9cd868c5d1..57c23ffb02 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "20% increased minion damage\n" + "A daedalus crystal floats above you to protect you"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusCrystal = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs index 64897edebb..99c0d22603 100644 --- a/Items/Armor/DaedalusHelm.cs +++ b/Items/Armor/DaedalusHelm.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "5% increased melee damage\n" + "You have a 33% chance to reflect projectiles back at enemies\n" + "If you reflect a projectile you are also healed for 1/5 of that projectile's damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusReflect = true; player.meleeDamage += 0.05f; } diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs index a1b7fc399d..846dec62db 100644 --- a/Items/Armor/DaedalusHelmet.cs +++ b/Items/Armor/DaedalusHelmet.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "5% increased ranged damage\n" + "Getting hit causes you to emit a blast of crystal shards"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusShard = true; player.rangedDamage += 0.05f; } diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs index 3dd466cc90..560d9e0af8 100644 --- a/Items/Armor/DaedalusLeggings.cs +++ b/Items/Armor/DaedalusLeggings.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor player.meleeCrit += 3; player.magicCrit += 3; player.rangedCrit += 3; - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; player.moveSpeed += 0.1f; } diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index b03f70efec..6e259cb65a 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -49,18 +49,18 @@ namespace CalamityMod.Items.Armor "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusSplit = true; modPlayer.rogueStealthMax = 1.1f; - player.GetCalamityPlayer().throwingDamage += 0.05f; - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingVelocity += 0.15f; - player.GetCalamityPlayer().throwingDamage += 0.13f; - player.GetCalamityPlayer().throwingCrit += 7; + player.Calamity().throwingVelocity += 0.15f; + player.Calamity().throwingDamage += 0.13f; + player.Calamity().throwingCrit += 7; player.moveSpeed += 0.17f; } diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs index 2595fe24ef..256075a177 100644 --- a/Items/Armor/DemonshadeBreastplate.cs +++ b/Items/Armor/DemonshadeBreastplate.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(4, 0, 0, 0); item.defense = 50; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.shadeRegen = true; player.thorns = 100f; player.statLifeMax2 += 200; diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs index 3293d42dea..60c4461e27 100644 --- a/Items/Armor/DemonshadeGreaves.cs +++ b/Items/Armor/DemonshadeGreaves.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(3, 0, 0, 0); item.defense = 50; //15 - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.shadowSpeed = true; player.moveSpeed += 1f; } diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 02ca3048c9..112d6e87ca 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(5, 0, 0, 0); item.defense = 50; //15 - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor "A friendly red devil follows you around\n" + "Press Y to enrage nearby enemies with a dark magic spell for 10 seconds\n" + "This makes them do 25% more damage but they also take 125% more damage"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dsSetBonus = true; modPlayer.wearingRogueArmor = true; if (player.whoAmI == Main.myPlayer && !modPlayer.chibii) diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index 0c6cfe5c28..c3bd6a5da9 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 41; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayerReflect = true; player.thorns += 0.5f; player.statLifeMax2 += 60; diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index 2f22fafacd..96297475a1 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 75, 0, 0); item.defense = 48; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerDamage = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 92f6d696c3..044b0f62ae 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 75, 0, 0); item.defense = 35; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerRanged = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + diff --git a/Items/Armor/GodSlayerHornedHelm.cs b/Items/Armor/GodSlayerHornedHelm.cs index d4f17053c9..a0919bfd5c 100644 --- a/Items/Armor/GodSlayerHornedHelm.cs +++ b/Items/Armor/GodSlayerHornedHelm.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 75, 0, 0); item.defense = 12; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerSummon = true; if (player.whoAmI == Main.myPlayer) diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index b9203a8c72..4a5a69474d 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 45, 0, 0); item.defense = 35; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 25abc597c1..b891071918 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 75, 0, 0); item.defense = 29; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerThrowing = true; modPlayer.rogueStealthMax = 1.4f; @@ -52,8 +52,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingDamage += 0.14f; - player.GetCalamityPlayer().throwingCrit += 14; + player.Calamity().throwingDamage += 0.14f; + player.Calamity().throwingCrit += 14; player.moveSpeed += 0.18f; } diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs index 2e0fa69365..df40a0186f 100644 --- a/Items/Armor/GodSlayerVisage.cs +++ b/Items/Armor/GodSlayerVisage.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 75, 0, 0); item.defense = 21; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerMage = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index 998a6f243e..d500f3b108 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Armor Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Shellfish"), (int)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); } } - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().wearingRogueArmor = true; } public override void AddRecipes() diff --git a/Items/Armor/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlueChestplate.cs index 47d84d779d..afef4bf8f7 100644 --- a/Items/Armor/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlueChestplate.cs @@ -23,7 +23,7 @@ No positive life regen"); item.value = Item.sellPrice(0, 38, 0, 0); item.rare = 10; item.defense = 28; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlueHelmet.cs index b77bc1fae3..641a6cbb9e 100644 --- a/Items/Armor/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlueHelmet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.value = Item.sellPrice(0, 35, 0, 0); item.rare = 10; item.defense = 19; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateEquip(Player player) @@ -57,7 +57,7 @@ Abyssal madness increases damage, critical strike chance, and tentacle aggressio This effect has a 30 second cooldown"; player.armorPenetration += 50; - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().wearingRogueArmor = true; //raise rev caps player.GetModPlayer().omegaBlueSet = true; diff --git a/Items/Armor/OmegaBlueLeggings.cs b/Items/Armor/OmegaBlueLeggings.cs index b5dc037c5a..2c21c97eef 100644 --- a/Items/Armor/OmegaBlueLeggings.cs +++ b/Items/Armor/OmegaBlueLeggings.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.value = Item.sellPrice(0, 35, 25, 0); item.rare = 10; item.defense = 22; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs index a124da966c..cca0e8e74a 100644 --- a/Items/Armor/ReaverCap.cs +++ b/Items/Armor/ReaverCap.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.reaverSpore = true; modPlayer.rogueStealthMax = 1.15f; player.setBonus = "5% increased rogue damage\n" + @@ -46,16 +46,16 @@ namespace CalamityMod.Items.Armor "Rogue stealth builds while not attacking and not moving, up to a max of 115\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - player.GetCalamityPlayer().throwingDamage += 0.05f; - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { player.ignoreWater = true; - player.GetCalamityPlayer().throwingDamage += 0.15f; - player.GetCalamityPlayer().throwingCrit += 5; - player.GetCalamityPlayer().throwingVelocity += 0.05f; + player.Calamity().throwingDamage += 0.15f; + player.Calamity().throwingCrit += 5; + player.Calamity().throwingVelocity += 0.05f; player.moveSpeed += 0.2f; } diff --git a/Items/Armor/ReaverCuisses.cs b/Items/Armor/ReaverCuisses.cs index 964f5befc0..cc08780c7b 100644 --- a/Items/Armor/ReaverCuisses.cs +++ b/Items/Armor/ReaverCuisses.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor player.meleeCrit += 5; player.magicCrit += 5; player.rangedCrit += 5; - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; player.moveSpeed += 0.12f; } diff --git a/Items/Armor/ReaverHelm.cs b/Items/Armor/ReaverHelm.cs index 9165f2a1b9..ff91fccfe5 100644 --- a/Items/Armor/ReaverHelm.cs +++ b/Items/Armor/ReaverHelm.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.thorns += 0.33f; modPlayer.reaverBlast = true; player.setBonus = "5% increased melee damage\n" + diff --git a/Items/Armor/ReaverHelmet.cs b/Items/Armor/ReaverHelmet.cs index 669bb9a1a9..1faa1e3265 100644 --- a/Items/Armor/ReaverHelmet.cs +++ b/Items/Armor/ReaverHelmet.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "16% increased minion damage\n" + "Summons a reaver orb that emits spore gas when enemies are near"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.reaverOrb = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Armor/ReaverMask.cs b/Items/Armor/ReaverMask.cs index c3315ad8e7..027b958446 100644 --- a/Items/Armor/ReaverMask.cs +++ b/Items/Armor/ReaverMask.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.reaverBurst = true; player.setBonus = "5% increased magic damage\n" + "Your magic projectiles emit a burst of spore gas on enemy hits"; diff --git a/Items/Armor/ReaverVisage.cs b/Items/Armor/ReaverVisage.cs index 00e6676bc3..e85438d661 100644 --- a/Items/Armor/ReaverVisage.cs +++ b/Items/Armor/ReaverVisage.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.reaverDoubleTap = true; player.setBonus = "5% increased ranged damage\n" + "While using a ranged weapon you have a 10% chance to fire a powerful rocket"; diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs index a4c1fa4b4c..6cd474c42d 100644 --- a/Items/Armor/ShroomiteVisage.cs +++ b/Items/Armor/ShroomiteVisage.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.shroomiteStealth = true; player.setBonus = "Ranged stealth while standing still"; } public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.flamethrowerBoost = true; } diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 9cd9f56fd7..73aec8794f 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 72, 0, 0); item.defense = 44; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs index 1ad7aa811f..4cf426b225 100644 --- a/Items/Armor/SilvaHelm.cs +++ b/Items/Armor/SilvaHelm.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 52; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaMelee = true; player.setBonus = "You are immune to almost all debuffs\n" + diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index 11cac34370..f46c623a9b 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 13; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaSummon = true; player.setBonus = "75% increased minion damage\n" + diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs index 890e12b448..fe8ced1149 100644 --- a/Items/Armor/SilvaHornedHelm.cs +++ b/Items/Armor/SilvaHornedHelm.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 36; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaRanged = true; player.setBonus = "You are immune to almost all debuffs\n" + diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index 569ae54d2b..ed9b63a7ea 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 54, 0, 0); item.defense = 39; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index 667df5caae..e8f40f2548 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 30; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaThrowing = true; modPlayer.rogueStealthMax = 1.5f; @@ -56,8 +56,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingDamage += 0.13f; - player.GetCalamityPlayer().throwingCrit += 13; + player.Calamity().throwingDamage += 0.13f; + player.Calamity().throwingCrit += 13; player.moveSpeed += 0.2f; } diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index 1cc941454e..6f5ba9b842 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 21; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaMage = true; player.setBonus = "You are immune to almost all debuffs\n" + diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index 7da0f41ba0..f9a04ae922 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor player.meleeCrit += 5; player.magicCrit += 5; player.rangedCrit += 5; - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; } public override void AddRecipes() diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index 9b31f3379a..fba1c1ec2d 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; player.jumpBoost = true; diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index 2b18f9e56b..47985415d6 100644 --- a/Items/Armor/StatigelHeadgear.cs +++ b/Items/Armor/StatigelHeadgear.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; player.jumpBoost = true; diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index d203f701e8..e9ef53008b 100644 --- a/Items/Armor/StatigelHelm.cs +++ b/Items/Armor/StatigelHelm.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; player.jumpBoost = true; diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index 6fe85bd7ce..66f88e7dda 100644 --- a/Items/Armor/StatigelHood.cs +++ b/Items/Armor/StatigelHood.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor "Summons a mini slime god to fight for you, the type depends on what world evil you have\n" + "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.slimeGod = true; player.doubleJumpSail = true; diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index fd61ef926c..6cb21af2a9 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -37,19 +37,19 @@ namespace CalamityMod.Items.Armor "Rogue stealth builds while not attacking and not moving, up to a max of 105\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.rogueStealthMax = 1.05f; player.doubleJumpSail = true; player.jumpBoost = true; - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingAmmoCost66 = true; - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingCrit += 7; + player.Calamity().throwingAmmoCost66 = true; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingCrit += 7; player.moveSpeed += 0.12f; } diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 3a03577846..17b11524e5 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor item.lifeRegen = 2; item.value = Item.buyPrice(0, 40, 0, 0); item.defense = 37; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs index dbc535cee4..e9cbc2fd1a 100644 --- a/Items/Armor/TarragonHelm.cs +++ b/Items/Armor/TarragonHelm.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 50, 0, 0); item.defense = 33; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMelee = true; player.setBonus = "Increased heart pickup range\n" + diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index 4a1250d5a6..9cd9c4da7a 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 50, 0, 0); item.defense = 15; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; modPlayer.rogueStealthMax = 1.3f; @@ -58,8 +58,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingCrit += 10; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingCrit += 10; player.moveSpeed += 0.12f; player.endurance += 0.05f; player.lavaMax += 240; diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs index 20ff6a14c4..d911e06915 100644 --- a/Items/Armor/TarragonHornedHelm.cs +++ b/Items/Armor/TarragonHornedHelm.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 50, 0, 0); item.defense = 3; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraSummon = true; player.setBonus = "+1 max minion and 55% increased minion damage\n" + diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs index 95abcacf1e..b828434338 100644 --- a/Items/Armor/TarragonLeggings.cs +++ b/Items/Armor/TarragonLeggings.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); item.defense = 32; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index 6fad1f5318..aa814236bd 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 50, 0, 0); item.defense = 10; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMage = true; player.setBonus = "Reduces enemy spawn rates\n" + diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs index baad826d3b..e1bbc4149c 100644 --- a/Items/Armor/TarragonVisage.cs +++ b/Items/Armor/TarragonVisage.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 50, 0, 0); item.defense = 21; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraRanged = true; player.setBonus = "Reduces enemy spawn rates\n" + diff --git a/Items/Armor/VictideBreastplate.cs b/Items/Armor/VictideBreastplate.cs index 4e323b9952..fa6437eb9f 100644 --- a/Items/Armor/VictideBreastplate.cs +++ b/Items/Armor/VictideBreastplate.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor player.endurance += 0.05f; player.meleeCrit += 5; player.rangedCrit += 5; - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; player.magicCrit += 5; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index 3b4bdaba19..31c0f6fcae 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -38,21 +38,21 @@ namespace CalamityMod.Items.Armor "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; modPlayer.rogueStealthMax = 1f; modPlayer.wearingRogueArmor = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.GetCalamityPlayer().throwingDamage += 0.1f; + player.Calamity().throwingDamage += 0.1f; player.lifeRegen += 3; } } public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingDamage += 0.05f; + player.Calamity().throwingDamage += 0.05f; } public override void AddRecipes() diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 644cd6461a..2bdf2db8ee 100644 --- a/Items/Armor/VictideHelm.cs +++ b/Items/Armor/VictideHelm.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 422807f722..dfb67413a5 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; modPlayer.urchin = true; if (player.whoAmI == Main.myPlayer) diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index cb79b40fbe..78b3cb1e86 100644 --- a/Items/Armor/VictideMask.cs +++ b/Items/Armor/VictideMask.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index 639942f16d..c22e4a1543 100644 --- a/Items/Armor/VictideVisage.cs +++ b/Items/Armor/VictideVisage.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs index d620708cc1..476d797602 100644 --- a/Items/Armor/WulfrumArmor.cs +++ b/Items/Armor/WulfrumArmor.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor player.meleeCrit += 3; player.magicCrit += 3; player.rangedCrit += 3; - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; } public override void AddRecipes() diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index 21a4d8d249..db75ff49e2 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -37,12 +37,12 @@ namespace CalamityMod.Items.Armor { player.statDefense += 5; //14 } - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingDamage += 0.03f; + player.Calamity().throwingDamage += 0.03f; } public override void AddRecipes() diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index cfc90d157c..eb456ebb12 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingCrit += 5; - player.GetCalamityPlayer().throwingDamage += 0.05f; + player.Calamity().throwingCrit += 5; + player.Calamity().throwingDamage += 0.05f; player.moveSpeed += 0.2f; } diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 02e924b01d..9e848f76ab 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.xerocSet = true; modPlayer.rogueStealthMax = 1.25f; player.setBonus = "9% increased rogue damage and velocity\n" + @@ -53,15 +53,15 @@ namespace CalamityMod.Items.Armor player.AddBuff(BuffID.Wrath, 2); player.AddBuff(BuffID.Rage, 2); } - player.GetCalamityPlayer().throwingDamage += 0.09f; - player.GetCalamityPlayer().throwingVelocity += 0.09f; - player.GetCalamityPlayer().wearingRogueArmor = true; + player.Calamity().throwingDamage += 0.09f; + player.Calamity().throwingVelocity += 0.09f; + player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetCalamityPlayer().throwingDamage += 0.11f; - player.GetCalamityPlayer().throwingCrit += 11; + player.Calamity().throwingDamage += 0.11f; + player.Calamity().throwingCrit += 11; player.moveSpeed += 0.22f; player.lavaMax += 240; player.buffImmune[BuffID.OnFire] = true; diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index 0ba853ec04..f4a497afd7 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Armor { player.statLifeMax2 += 20; player.moveSpeed += 0.06f; - player.GetCalamityPlayer().throwingCrit += 7; - player.GetCalamityPlayer().throwingDamage += 0.07f; + player.Calamity().throwingCrit += 7; + player.Calamity().throwingDamage += 0.07f; } public override void AddRecipes() diff --git a/Items/BrimstoneWaifu/CharredIdol.cs b/Items/BrimstoneWaifu/CharredIdol.cs index fa392ec7df..947e523eb0 100644 --- a/Items/BrimstoneWaifu/CharredIdol.cs +++ b/Items/BrimstoneWaifu/CharredIdol.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.BrimstoneWaifu public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); return modPlayer.ZoneCalamity && !NPC.AnyNPCs(mod.NPCType("BrimstoneElemental")); } diff --git a/Items/BrimstoneWaifu/RoseStone.cs b/Items/BrimstoneWaifu/RoseStone.cs index d0b8d32a50..b4cc06c94f 100644 --- a/Items/BrimstoneWaifu/RoseStone.cs +++ b/Items/BrimstoneWaifu/RoseStone.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.BrimstoneWaifu public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.elementalHeart) { return false; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.BrimstoneWaifu player.lifeRegen += 1; player.statLifeMax2 += 20; player.allDamage += 0.03f; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.brimstoneWaifu = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Bumblefuck/EffulgentFeather.cs b/Items/Bumblefuck/EffulgentFeather.cs index 7a538ce05b..00a96bb8f0 100644 --- a/Items/Bumblefuck/EffulgentFeather.cs +++ b/Items/Bumblefuck/EffulgentFeather.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Bumblefuck item.maxStack = 999; item.value = Item.buyPrice(0, 6, 50, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } } } diff --git a/Items/Calamitas/CalamityRing.cs b/Items/Calamitas/CalamityRing.cs index 6801e5b120..6af8404083 100644 --- a/Items/Calamitas/CalamityRing.cs +++ b/Items/Calamitas/CalamityRing.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Calamitas public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.calamityRing) { return false; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Calamitas public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; player.allDamage += 0.15f; player.endurance -= 0.3f; diff --git a/Items/CalamityCustomThrowingDamage/AccretionDisk.cs b/Items/CalamityCustomThrowingDamage/AccretionDisk.cs index d0ba61590e..be82ba8906 100644 --- a/Items/CalamityCustomThrowingDamage/AccretionDisk.cs +++ b/Items/CalamityCustomThrowingDamage/AccretionDisk.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("AccretionDisk"); item.shootSpeed = 13f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs index 4b36a38eeb..52596d972c 100644 --- a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs +++ b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("AdamantiteThrowingAxeProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs index 1221c69069..d8783a00e9 100644 --- a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs +++ b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("BallisticPoisonBomb"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/BlastBarrel.cs b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs index d3323b3745..13d4da7a28 100644 --- a/Items/CalamityCustomThrowingDamage/BlastBarrel.cs +++ b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("BlastBarrelProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -42,8 +42,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage //unitY additive is do it doesn't exploe initially int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type,damage,knockBack,player.whoAmI); - if (player.GetCalamityPlayer().StealthStrikeAvailable()) - Main.projectile[p].GetCalamityProj().stealthStrike = true; + if (player.Calamity().StealthStrikeAvailable()) + Main.projectile[p].Calamity().stealthStrike = true; return false; } } diff --git a/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs b/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs index 7dc164d93a..c22d2b6bab 100644 --- a/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs +++ b/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs @@ -30,18 +30,18 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.height = 64; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; item.shoot = mod.ProjectileType("BloodsoakedCrashax"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) //setting the stealth strike + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("BloodsoakedCrashax"), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs index d606ebd2b1..2c3cd7a4c7 100644 --- a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs +++ b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 3.5f; item.rare = 1; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; item.noUseGraphic = true; item.UseSound = SoundID.Item1; item.shoot = mod.ProjectileType("BouncingEyeballProjectile"); @@ -42,11 +42,11 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { knockBack *= 3f; } - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { initialVelocity *= 2f; int p = Projectile.NewProjectile(position, initialVelocity, mod.ProjectileType("BouncingEyeballProjectileStealthStrike"),damage,knockBack,player.whoAmI); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; } else { diff --git a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs index 03ab930de6..20b4decf0b 100644 --- a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs +++ b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("BrackishFlask"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Brimblade.cs b/Items/CalamityCustomThrowingDamage/Brimblade.cs index 130536e981..c2fe486935 100644 --- a/Items/CalamityCustomThrowingDamage/Brimblade.cs +++ b/Items/CalamityCustomThrowingDamage/Brimblade.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 6; item.shoot = mod.ProjectileType("Brimblade"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs index 9f59cb3f1c..83718b51de 100644 --- a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs +++ b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs @@ -24,13 +24,13 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage // 5E-06 to prevent downrounding is not needed anymore, added by TML itself public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { - add += player.GetCalamityPlayer().throwingDamage - 1f; + add += player.Calamity().throwingDamage - 1f; } // Calculates a rogue weapon's crit chance using the player's rogue crit chance. public override void GetWeaponCrit(Player player, ref int crit) { - crit = (item.crit + player.GetCalamityPlayer().throwingCrit); + crit = (item.crit + player.Calamity().throwingCrit); } // Not needed because the weapon is now internally thrown instead of ranged @@ -62,12 +62,12 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool ConsumeItem(Player player) { - if (player.GetCalamityPlayer().throwingAmmoCost50) + if (player.Calamity().throwingAmmoCost50) { if (Main.rand.Next(1, 101) > 50) return false; } - if (player.GetCalamityPlayer().throwingAmmoCost66) + if (player.Calamity().throwingAmmoCost66) { if (Main.rand.Next(1, 101) > 66) return false; diff --git a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs index 36f9cfe918..fbd0c9cd12 100644 --- a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs +++ b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 velocity = new Vector2(speedX, speedY); - float strikeValue = player.GetCalamityPlayer().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true + float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true int p = Projectile.NewProjectile(position, velocity, mod.ProjectileType("CelestialReaperProjectile"), damage, knockBack, player.whoAmI, strikeValue); - if (player.GetCalamityPlayer().StealthStrikeAvailable()) - Main.projectile[p].GetCalamityProj().stealthStrike = true; + if (player.Calamity().StealthStrikeAvailable()) + Main.projectile[p].Calamity().stealthStrike = true; return false; } } diff --git a/Items/CalamityCustomThrowingDamage/Celestus.cs b/Items/CalamityCustomThrowingDamage/Celestus.cs index 027435c583..b05f09e65c 100644 --- a/Items/CalamityCustomThrowingDamage/Celestus.cs +++ b/Items/CalamityCustomThrowingDamage/Celestus.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("Celestus"); item.shootSpeed = 25f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 15; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Cinquedea.cs b/Items/CalamityCustomThrowingDamage/Cinquedea.cs index 21bef889e2..4feaa4f23d 100644 --- a/Items/CalamityCustomThrowingDamage/Cinquedea.cs +++ b/Items/CalamityCustomThrowingDamage/Cinquedea.cs @@ -34,15 +34,15 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shoot = mod.ProjectileType("CinquedeaProj"); item.shootSpeed = Speed; item.value = Item.buyPrice(0, 9, 0, 0); - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("CinquedeaProj"), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs index 5691a62a9d..aace887e85 100644 --- a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs +++ b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("CobaltKunaiProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs index 217ebd3dca..06385bd20b 100644 --- a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs +++ b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs @@ -38,10 +38,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 velocity = new Vector2(speedX, speedY); - float strikeValue = player.GetCalamityPlayer().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true + float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true int p = Projectile.NewProjectile(position, velocity, mod.ProjectileType("ConsecratedWaterProjectile"), damage, knockBack, player.whoAmI, ai1:strikeValue); - if (player.GetCalamityPlayer().StealthStrikeAvailable()) - Main.projectile[p].GetCalamityProj().stealthStrike = true; + if (player.Calamity().StealthStrikeAvailable()) + Main.projectile[p].Calamity().stealthStrike = true; return false; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/CosmicKunai.cs b/Items/CalamityCustomThrowingDamage/CosmicKunai.cs index f21b99b66c..ea4a713c94 100644 --- a/Items/CalamityCustomThrowingDamage/CosmicKunai.cs +++ b/Items/CalamityCustomThrowingDamage/CosmicKunai.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shoot = mod.ProjectileType("CosmicKunai"); item.shootSpeed = 28f; item.rare = 9; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs b/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs index dbfd41ba10..67499d85ea 100644 --- a/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs +++ b/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("CraniumSmasher"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs index cdc1c06cf8..25a6b0dd0a 100644 --- a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs +++ b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("Crushax"); item.shootSpeed = 11f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs index 25d86df33e..a97371f27a 100644 --- a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs +++ b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("CrystalPiercerProjectile"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Crystalline.cs b/Items/CalamityCustomThrowingDamage/Crystalline.cs index 33bd46e1fb..14732561bd 100644 --- a/Items/CalamityCustomThrowingDamage/Crystalline.cs +++ b/Items/CalamityCustomThrowingDamage/Crystalline.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("Crystalline"); item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/CursedDagger.cs b/Items/CalamityCustomThrowingDamage/CursedDagger.cs index d050fa5c04..0c3d055534 100644 --- a/Items/CalamityCustomThrowingDamage/CursedDagger.cs +++ b/Items/CalamityCustomThrowingDamage/CursedDagger.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("CursedDagger"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs b/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs index cbf49b0f4e..4431561fd2 100644 --- a/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs +++ b/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("DuststormInABottle"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs index b9f7e111a6..cf5352562d 100644 --- a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs +++ b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs @@ -35,18 +35,18 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.height = 72; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; item.shoot = mod.ProjectileType("EclipsesFallMain"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("EclipsesStealth"), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; } else { diff --git a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs index 43dde3910d..01cb29b2d7 100644 --- a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs +++ b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("EmpyreanKnives"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/Eradicator.cs b/Items/CalamityCustomThrowingDamage/Eradicator.cs index 3b05ade02a..27cdaf5511 100644 --- a/Items/CalamityCustomThrowingDamage/Eradicator.cs +++ b/Items/CalamityCustomThrowingDamage/Eradicator.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("EradicatorProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs b/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs index 5ef7e37104..0ba30879ff 100644 --- a/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs +++ b/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("ExecutionersBlade"); item.shootSpeed = 26f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs index 2319990569..8e3440780e 100644 --- a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs +++ b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("FeatherKnifeProjectile"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/FlameScythe.cs b/Items/CalamityCustomThrowingDamage/FlameScythe.cs index 23e598dc29..60657dc6b0 100644 --- a/Items/CalamityCustomThrowingDamage/FlameScythe.cs +++ b/Items/CalamityCustomThrowingDamage/FlameScythe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("FlameScytheProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs index 08a888a244..c09712950f 100644 --- a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs +++ b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shootSpeed = 22f; item.maxStack = 999; item.consumable = true; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs b/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs index d4ccc5de77..f33b4fa42d 100644 --- a/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs +++ b/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs @@ -33,10 +33,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.UseSound = SoundID.Item1; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; item.value = Item.buyPrice(1, 80, 0, 0); - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; item.shoot = mod.ProjectileType("GalaxySmasherHammer"); item.shootSpeed = Speed; } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + Main.projectile[proj].Calamity().forceRogue = true; return false; } diff --git a/Items/CalamityCustomThrowingDamage/GelDart.cs b/Items/CalamityCustomThrowingDamage/GelDart.cs index 1be63d07d0..b53c30a820 100644 --- a/Items/CalamityCustomThrowingDamage/GelDart.cs +++ b/Items/CalamityCustomThrowingDamage/GelDart.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("GelDartProjectile"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs b/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs index 369f9601f5..a20f8d4375 100644 --- a/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs +++ b/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("GhoulishGouger"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; } } } diff --git a/Items/CalamityCustomThrowingDamage/Glaive.cs b/Items/CalamityCustomThrowingDamage/Glaive.cs index 4194f87b34..2d26b2ff04 100644 --- a/Items/CalamityCustomThrowingDamage/Glaive.cs +++ b/Items/CalamityCustomThrowingDamage/Glaive.cs @@ -22,7 +22,7 @@ Stealth strikes are super fast and pierce infinitely"); { item.damage = BaseDamage; item.crit = 4; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; item.noMelee = true; item.noUseGraphic = true; item.width = 1; @@ -43,7 +43,7 @@ Stealth strikes are super fast and pierce infinitely"); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float ai1 = 0f; - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { speedX *= StealthSpeedMult; speedY *= StealthSpeedMult; @@ -51,8 +51,8 @@ Stealth strikes are super fast and pierce infinitely"); } int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, ai1); - if (player.GetCalamityPlayer().StealthStrikeAvailable()) - Main.projectile[p].GetCalamityProj().stealthStrike = true; + if (player.Calamity().StealthStrikeAvailable()) + Main.projectile[p].Calamity().stealthStrike = true; return false; } diff --git a/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs b/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs index e71fc21b8c..ab026fac95 100644 --- a/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs +++ b/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("HeavenfallenStardisk"); item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/IceStar.cs b/Items/CalamityCustomThrowingDamage/IceStar.cs index e12da4eced..56238e0ba4 100644 --- a/Items/CalamityCustomThrowingDamage/IceStar.cs +++ b/Items/CalamityCustomThrowingDamage/IceStar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("IceStarProjectile"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Icebreaker.cs b/Items/CalamityCustomThrowingDamage/Icebreaker.cs index e61e1a9d7a..0c70e363d9 100644 --- a/Items/CalamityCustomThrowingDamage/Icebreaker.cs +++ b/Items/CalamityCustomThrowingDamage/Icebreaker.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("Icebreaker"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/IchorSpear.cs b/Items/CalamityCustomThrowingDamage/IchorSpear.cs index 99a98d45ab..ef0fa8ba07 100644 --- a/Items/CalamityCustomThrowingDamage/IchorSpear.cs +++ b/Items/CalamityCustomThrowingDamage/IchorSpear.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("IchorSpear"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/IronFrancisca.cs b/Items/CalamityCustomThrowingDamage/IronFrancisca.cs index 4dba7088e7..80749caa4a 100644 --- a/Items/CalamityCustomThrowingDamage/IronFrancisca.cs +++ b/Items/CalamityCustomThrowingDamage/IronFrancisca.cs @@ -37,10 +37,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/Kylie.cs b/Items/CalamityCustomThrowingDamage/Kylie.cs index de41639f7b..bf6645e76c 100644 --- a/Items/CalamityCustomThrowingDamage/Kylie.cs +++ b/Items/CalamityCustomThrowingDamage/Kylie.cs @@ -31,12 +31,12 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shoot = mod.ProjectileType("KylieBoomerang"); item.noMelee = true; item.noUseGraphic = true; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - CalamityPlayer p = Main.player[Main.myPlayer].GetCalamityPlayer(); + CalamityPlayer p = Main.player[Main.myPlayer].Calamity(); //If stealth is full, shoot a spread of 3 boomerangs with reduced range if(p.StealthStrikeAvailable()) { @@ -45,7 +45,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType("Kylieproj"), item.damage, item.knockBack, player.whoAmI,0f,1f); - Main.projectile[proj].GetCalamityProj().stealthStrike = true; + Main.projectile[proj].Calamity().stealthStrike = true; spread -= 10; } return false; diff --git a/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs b/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs index 89b96a0d92..5873386bcc 100644 --- a/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs +++ b/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs @@ -37,10 +37,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/Lionfish.cs b/Items/CalamityCustomThrowingDamage/Lionfish.cs index e5a18e8171..c82757607a 100644 --- a/Items/CalamityCustomThrowingDamage/Lionfish.cs +++ b/Items/CalamityCustomThrowingDamage/Lionfish.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("Lionfish"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/Malachite.cs b/Items/CalamityCustomThrowingDamage/Malachite.cs index a95ab7970d..7b4ecee5f0 100644 --- a/Items/CalamityCustomThrowingDamage/Malachite.cs +++ b/Items/CalamityCustomThrowingDamage/Malachite.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("Malachite"); item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 17; } public override bool AltFunctionUse(Player player) diff --git a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs index 6b32bd4bb4..3584911d83 100644 --- a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs +++ b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("MangroveChakramProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/MeteorFist.cs b/Items/CalamityCustomThrowingDamage/MeteorFist.cs index 24e783710d..416a32cba4 100644 --- a/Items/CalamityCustomThrowingDamage/MeteorFist.cs +++ b/Items/CalamityCustomThrowingDamage/MeteorFist.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("MeteorFist"); item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs b/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs index b468bb1240..ceda6992ac 100644 --- a/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs +++ b/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("MoltenAmputator"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; } } } diff --git a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs index 97bf32eda2..b779989618 100644 --- a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs +++ b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -32,20 +33,20 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shootSpeed = 10.5f; item.shoot = mod.ProjectileType("MonkeyDart"); item.autoReuse = true; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //Checks if stealth is avalaible to shoot a spread of 3 darts - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { float spread = 7; for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX * 1.4f, speedY * 1.4f).RotatedBy(MathHelper.ToRadians(spread)); - int p = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType(), item.damage, item.knockBack, player.whoAmI,1); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + int p = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), item.damage, item.knockBack, player.whoAmI,1); + Main.projectile[p].Calamity().stealthStrike = true; spread -= 7; } return false; diff --git a/Items/CalamityCustomThrowingDamage/Mycoroot.cs b/Items/CalamityCustomThrowingDamage/Mycoroot.cs index 11d3e96303..bed7ffd799 100644 --- a/Items/CalamityCustomThrowingDamage/Mycoroot.cs +++ b/Items/CalamityCustomThrowingDamage/Mycoroot.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.value = Item.buyPrice(0, 2, 0, 0); item.shoot = mod.ProjectileType("Mycoroot"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs index 4e062d5542..fc545b09ac 100644 --- a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs +++ b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("MythrilKnifeProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs b/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs index 90a7f93ed6..dce9de3e60 100644 --- a/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs +++ b/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs @@ -34,10 +34,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.UseSound = SoundID.Item18; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; item.value = Item.buyPrice(5, 0, 0, 0); - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; item.shoot = mod.ProjectileType("NanoblackMain"); item.shootSpeed = Speed; } @@ -45,7 +45,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + Main.projectile[proj].Calamity().forceRogue = true; return false; } diff --git a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs index 8e7053b2cf..e231ee6b98 100644 --- a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs +++ b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("OrichalcumSpikedGemstoneProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs index 3a4dfaab4b..3f58d821e0 100644 --- a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs +++ b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("PalladiumJavelinProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs b/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs index 1ea38908f0..9c48b05721 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs @@ -26,17 +26,17 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon item.autoReuse = true; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.shoot = mod.ProjectileType("CorpusAvertor"); item.shootSpeed = 5f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } // Gains 20% of missing health as base damage. public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.2f * player.GetCalamityPlayer().throwingDamage; + flat += lifeAmount * 0.2f * player.Calamity().throwingDamage; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs b/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs index 769575d67e..356d445407 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon item.rare = 10; item.shoot = mod.ProjectileType("DeepSeaDumbbell1"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 21; } public override bool AltFunctionUse(Player player) @@ -75,7 +75,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon if (player.altFunctionUse == 2) return false; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * player.GetCalamityPlayer().throwingDamage), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * player.Calamity().throwingDamage), knockBack, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs b/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs index b7a60821eb..150fcc4f21 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon item.rare = 6; item.shoot = mod.ProjectileType("KelvinCatalyst"); item.shootSpeed = 8f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 21; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs index bb6aa481c9..69031fc4f4 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon item.rare = 8; item.shoot = mod.ProjectileType("Plaguenade"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 21; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs b/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs index 39f28248f8..bcc67e58a6 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs @@ -27,10 +27,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon item.autoReuse = true; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.shoot = mod.ProjectileType("TimeBolt"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/Prismalline.cs b/Items/CalamityCustomThrowingDamage/Prismalline.cs index c2c449aaa6..4f2d254282 100644 --- a/Items/CalamityCustomThrowingDamage/Prismalline.cs +++ b/Items/CalamityCustomThrowingDamage/Prismalline.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("Prismalline"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs b/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs index c16189ddf9..4f457a28cb 100644 --- a/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs +++ b/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("ProfanedTrident"); item.shootSpeed = 28f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; } } } diff --git a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs index 68555e1d29..c5f843f4d5 100644 --- a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs +++ b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 6; item.shoot = mod.ProjectileType("Pwnagehammer"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/RadiantStar.cs b/Items/CalamityCustomThrowingDamage/RadiantStar.cs index 5de4217bee..b3683133f9 100644 --- a/Items/CalamityCustomThrowingDamage/RadiantStar.cs +++ b/Items/CalamityCustomThrowingDamage/RadiantStar.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 9; item.shoot = mod.ProjectileType("RadiantStar"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs index 4124bb3250..40f6d5bd62 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants item.rare = 2; item.shoot = mod.ProjectileType("ScourgeoftheDesert2"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; } } } diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs index ce05c7ff49..fb6635393a 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants item.rare = 9; item.shoot = mod.ProjectileType("Quasar"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs index 8012843281..9e32cad648 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants item.rare = 5; item.shoot = mod.ProjectileType("IchorSpear"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs index adc4f831c6..09b3bddb07 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants item.rare = 10; item.shoot = mod.ProjectileType("Valediction2"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; } } } diff --git a/Items/CalamityCustomThrowingDamage/RotBall.cs b/Items/CalamityCustomThrowingDamage/RotBall.cs index b6aeaeef72..0d53e27d07 100644 --- a/Items/CalamityCustomThrowingDamage/RotBall.cs +++ b/Items/CalamityCustomThrowingDamage/RotBall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("RotBallProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs index 430cb1042a..41f1db996c 100644 --- a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs +++ b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("RoyalKnife"); item.shootSpeed = 9f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 16; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/SandDollar.cs b/Items/CalamityCustomThrowingDamage/SandDollar.cs index 061676a8b5..999c701db4 100644 --- a/Items/CalamityCustomThrowingDamage/SandDollar.cs +++ b/Items/CalamityCustomThrowingDamage/SandDollar.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SandDollarProj"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool CanUseItem(Player player) diff --git a/Items/CalamityCustomThrowingDamage/ScarletDevil.cs b/Items/CalamityCustomThrowingDamage/ScarletDevil.cs index afba28fb57..91255163c2 100644 --- a/Items/CalamityCustomThrowingDamage/ScarletDevil.cs +++ b/Items/CalamityCustomThrowingDamage/ScarletDevil.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("ScarletDevilProjectile"); item.shootSpeed = 30f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs index fbe4a35316..6b689bf8c3 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs index 1576909b0a..9af9d4637d 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("ScourgeoftheDesert"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs index cd4e448294..271d45f478 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs @@ -37,15 +37,15 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("ScourgeoftheSeasProjectile"); item.shootSpeed = 8f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ScourgeoftheSeasStealth"), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; } else { diff --git a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs index e5588a1467..bf97dd57fb 100644 --- a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs +++ b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SeafoamBomb"); item.shootSpeed = 8f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs index c7df3b84a7..dd9bc14356 100644 --- a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs +++ b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SeashellBoomerangProjectile"); item.shootSpeed = 11.5f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/ShatteredSun.cs b/Items/CalamityCustomThrowingDamage/ShatteredSun.cs index 928926710b..9bdf917983 100644 --- a/Items/CalamityCustomThrowingDamage/ShatteredSun.cs +++ b/Items/CalamityCustomThrowingDamage/ShatteredSun.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("ShatteredSun"); item.shootSpeed = 25f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/SnapClam.cs b/Items/CalamityCustomThrowingDamage/SnapClam.cs index 1edd5e5f6f..f9d401e8c3 100644 --- a/Items/CalamityCustomThrowingDamage/SnapClam.cs +++ b/Items/CalamityCustomThrowingDamage/SnapClam.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SnapClamProj"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs index dad1e7e6f5..d16e4aec66 100644 --- a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs +++ b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("SpearofPaleolith"); item.shootSpeed = 35f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs b/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs index dd1e7bb5e3..96d1a03606 100644 --- a/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs +++ b/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs @@ -33,10 +33,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.UseSound = SoundID.Item1; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; item.value = Item.buyPrice(1, 20, 0, 0); - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; item.shoot = mod.ProjectileType("StellarContemptHammer"); item.shootSpeed = Speed; } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + Main.projectile[proj].Calamity().forceRogue = true; return false; } diff --git a/Items/CalamityCustomThrowingDamage/StellarKnife.cs b/Items/CalamityCustomThrowingDamage/StellarKnife.cs index 1103c138a0..1a5cb094fb 100644 --- a/Items/CalamityCustomThrowingDamage/StellarKnife.cs +++ b/Items/CalamityCustomThrowingDamage/StellarKnife.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("StellarKnife"); item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs b/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs index ad414c9556..a1e084673f 100644 --- a/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs +++ b/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.knockBack = 7f; item.shoot = mod.ProjectileType("Stormfrontproj"); item.shootSpeed = 7f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() @@ -55,10 +55,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position, new Vector2(speedX * 1.6f, speedY * 1.6f), mod.ProjectileType("Stormfrontproj"), damage, knockBack, player.whoAmI, 0, 40f); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; return false; } else diff --git a/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs b/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs index 1ef29bf34a..66035dbddb 100644 --- a/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs +++ b/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.value = 25000; item.shoot = mod.ProjectileType("TarragonThrowingDartProjectile"); item.shootSpeed = 24f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs b/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs index 581c28c5ad..b5b8e6d713 100644 --- a/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs +++ b/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs @@ -32,15 +32,15 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.consumable = true; item.noMelee = true; item.noUseGraphic = true; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //Check if stealth is full - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Brick"), item.damage, item.knockBack, player.whoAmI, 1); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs index fbba67fbaa..3377cfd958 100644 --- a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs +++ b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("TitaniumShurikenProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/ToothBall.cs b/Items/CalamityCustomThrowingDamage/ToothBall.cs index 035243eb11..c930d7e6a3 100644 --- a/Items/CalamityCustomThrowingDamage/ToothBall.cs +++ b/Items/CalamityCustomThrowingDamage/ToothBall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("ToothBallProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs b/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs index c12c2b6ae2..bea55ad1bd 100644 --- a/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("TriactisOPHammer"); item.shootSpeed = 25f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs index ed5848624b..b8c6688827 100644 --- a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs +++ b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("OPHammer"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs index d20b1fa20c..a18d86f963 100644 --- a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs +++ b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 1; item.shoot = mod.ProjectileType("UrchinStinger"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/UtensilPoker.cs b/Items/CalamityCustomThrowingDamage/UtensilPoker.cs index 9d9c5b0ea5..bb2bf57843 100644 --- a/Items/CalamityCustomThrowingDamage/UtensilPoker.cs +++ b/Items/CalamityCustomThrowingDamage/UtensilPoker.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.width = 44; item.height = 66; item.damage = 750; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; item.knockBack = 8f; item.noMelee = true; item.noUseGraphic = true; @@ -32,17 +32,17 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.autoReuse = true; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; item.shoot = mod.ProjectileType("Fork"); item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.GetCalamityPlayer().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, (int) ((double)speedX * 1.2), (int) ((double)speedY * 1.2), mod.ProjectileType("ButcherKnife"), (int) ((double)damage * 3), knockBack, Main.myPlayer); - Main.projectile[p].GetCalamityProj().stealthStrike = true; + Main.projectile[p].Calamity().stealthStrike = true; if (Main.rand.NextBool(3)) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Fork"), (int) ((double)damage * 1.1), knockBack * 2f, Main.myPlayer); diff --git a/Items/CalamityCustomThrowingDamage/Valediction.cs b/Items/CalamityCustomThrowingDamage/Valediction.cs index d18964c91e..d6663734c8 100644 --- a/Items/CalamityCustomThrowingDamage/Valediction.cs +++ b/Items/CalamityCustomThrowingDamage/Valediction.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("Valediction"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; } } } diff --git a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs index 7433af2540..06f7a7444d 100644 --- a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs +++ b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 1; item.shoot = mod.ProjectileType("WulfrumKnife"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs index 1975969af4..c2fba3005f 100644 --- a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs +++ b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 9; item.shoot = mod.ProjectileType("XerocPitchforkProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; + item.Calamity().rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 844b90fab5..64869b54ac 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -117,10 +117,10 @@ namespace CalamityMod.Items { if (rogue) { - speedX *= player.GetCalamityPlayer().throwingVelocity; - speedY *= player.GetCalamityPlayer().throwingVelocity; + speedX *= player.Calamity().throwingVelocity; + speedY *= player.Calamity().throwingVelocity; } - if (player.GetCalamityPlayer().luxorsGift) + if (player.Calamity().luxorsGift) { // useTime 9 = 0.9 useTime 2 = 0.2 double damageMult = 1.0; @@ -147,36 +147,36 @@ namespace CalamityMod.Items Projectile.NewProjectile(position.X, position.Y, 0f, 0f, mod.ProjectileType("LuxorsGiftSummon"), damage, 0f, player.whoAmI, 0f, 0f); } } - if (player.GetCalamityPlayer().eArtifact && item.ranged && !rogue) + if (player.Calamity().eArtifact && item.ranged && !rogue) { speedX *= 1.25f; speedY *= 1.25f; } - if (player.GetCalamityPlayer().bloodflareMage) //0 - 99 + if (player.Calamity().bloodflareMage) //0 - 99 { if (item.magic && Main.rand.Next(0, 100) >= 95) { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * (player.GetCalamityPlayer().auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * (player.Calamity().auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); } } } - if (player.GetCalamityPlayer().bloodflareRanged) //0 - 99 + if (player.Calamity().bloodflareRanged) //0 - 99 { if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 98) { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * (player.GetCalamityPlayer().auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * (player.Calamity().auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); } } } - if (player.GetCalamityPlayer().tarraMage) + if (player.Calamity().tarraMage) { - if (player.GetCalamityPlayer().tarraCrits >= 5 && player.whoAmI == Main.myPlayer) + if (player.Calamity().tarraCrits >= 5 && player.whoAmI == Main.myPlayer) { - player.GetCalamityPlayer().tarraCrits = 0; + player.Calamity().tarraCrits = 0; int num106 = 9 + Main.rand.Next(3); for (int num107 = 0; num107 < num106; num107++) { @@ -191,7 +191,7 @@ namespace CalamityMod.Items } } } - if (player.GetCalamityPlayer().ataxiaBolt) + if (player.Calamity().ataxiaBolt) { if (item.ranged && !rogue && Main.rand.NextBool(2)) { @@ -201,17 +201,17 @@ namespace CalamityMod.Items } } } - if (player.GetCalamityPlayer().godSlayerRanged) //0 - 99 + if (player.Calamity().godSlayerRanged) //0 - 99 { if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 95) { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * (player.GetCalamityPlayer().auricSet ? 3.2 : 2.1)), 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * (player.Calamity().auricSet ? 3.2 : 2.1)), 2f, player.whoAmI, 0f, 0f); } } } - if (player.GetCalamityPlayer().ataxiaVolley) + if (player.Calamity().ataxiaVolley) { if (rogue && Main.rand.NextBool(10)) { @@ -233,7 +233,7 @@ namespace CalamityMod.Items } } } - if (player.GetCalamityPlayer().reaverDoubleTap) //0 - 99 + if (player.Calamity().reaverDoubleTap) //0 - 99 { if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 90) { @@ -243,7 +243,7 @@ namespace CalamityMod.Items } } } - if (player.GetCalamityPlayer().victideSet) + if (player.Calamity().victideSet) { if ((item.ranged || item.melee || item.magic || rogue || item.summon) && item.rare < 8 && Main.rand.NextBool(10)) @@ -329,7 +329,7 @@ namespace CalamityMod.Items { if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) { - bool boostedHeart = player.GetCalamityPlayer().photosynthesis; + bool boostedHeart = player.Calamity().photosynthesis; if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) { player.statLife -= (boostedHeart ? 5 : 10); @@ -354,7 +354,7 @@ namespace CalamityMod.Items #region Use Item Changes public override bool CanUseItem(Item item, Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (item.type == ItemID.MonkStaffT1) { for (int i = 0; i < 1000; ++i) @@ -1812,11 +1812,11 @@ namespace CalamityMod.Items player.pickSpeed -= 0.4f; else if (set == "Gladiator") { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.rogueStealthMax = 1f; modPlayer.wearingRogueArmor = true; - player.GetCalamityPlayer().throwingDamage += 0.1f; - player.GetCalamityPlayer().throwingVelocity += 0.1f; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingVelocity += 0.1f; player.statDefense += 5; player.setBonus = "+5 defense\n" + "10% increased rogue damage and velocity\n" + @@ -1826,11 +1826,11 @@ namespace CalamityMod.Items } else if (set == "Obsidian") { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.rogueStealthMax = 1f; modPlayer.wearingRogueArmor = true; - player.GetCalamityPlayer().throwingDamage += 0.05f; - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingCrit += 5; player.statDefense += 2; player.fireWalk = true; player.lavaMax += 180; @@ -1857,7 +1857,7 @@ namespace CalamityMod.Items if (item.type == ItemID.SpectreHood) player.magicDamage += 0.2f; else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) - player.GetCalamityPlayer().throwingDamage += 0.05f; + player.Calamity().throwingDamage += 0.05f; else if (item.type == ItemID.ApprenticeHat) player.minionDamage += 0.3f; else if (item.type == ItemID.SquireGreatHelm) @@ -1898,21 +1898,21 @@ namespace CalamityMod.Items #region Body if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; else if (item.type == ItemID.PalladiumBreastplate) - player.GetCalamityPlayer().throwingCrit += 2; + player.Calamity().throwingCrit += 2; else if (item.type == ItemID.CobaltBreastplate) - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; else if (item.type == ItemID.OrichalcumBreastplate) - player.GetCalamityPlayer().throwingCrit += 6; + player.Calamity().throwingCrit += 6; else if (item.type == ItemID.TitaniumBreastplate) - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; else if (item.type == ItemID.HallowedPlateMail) - player.GetCalamityPlayer().throwingCrit += 7; + player.Calamity().throwingCrit += 7; else if (item.type == ItemID.ChlorophytePlateMail) - player.GetCalamityPlayer().throwingCrit += 7; + player.Calamity().throwingCrit += 7; else if (item.type == ItemID.Gi) - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; else if (item.type == ItemID.ApprenticeRobe) player.minionDamage -= 0.2f; else if (item.type == ItemID.SquirePlating) @@ -1942,17 +1942,17 @@ namespace CalamityMod.Items #region Legs if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) - player.GetCalamityPlayer().throwingVelocity += 0.05f; + player.Calamity().throwingVelocity += 0.05f; else if (item.type == ItemID.PalladiumLeggings) - player.GetCalamityPlayer().throwingCrit += 1; + player.Calamity().throwingCrit += 1; else if (item.type == ItemID.MythrilGreaves) - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; else if (item.type == ItemID.AdamantiteLeggings) - player.GetCalamityPlayer().throwingCrit += 4; + player.Calamity().throwingCrit += 4; else if (item.type == ItemID.TitaniumLeggings) - player.GetCalamityPlayer().throwingCrit += 3; + player.Calamity().throwingCrit += 3; else if (item.type == ItemID.ChlorophyteGreaves) - player.GetCalamityPlayer().throwingCrit += 8; + player.Calamity().throwingCrit += 8; else if (item.type == ItemID.ApprenticeTrousers) { player.magicCrit -= 20; @@ -1994,7 +1994,7 @@ namespace CalamityMod.Items #region Accessory Changes public override void UpdateAccessory(Item item, Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (item.type == ItemID.AngelWings) // Boost to max life, defense, and life regen { @@ -2189,14 +2189,14 @@ namespace CalamityMod.Items if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell || (item.type == ItemID.MoonStone && !Main.dayTime) || (item.type == ItemID.SunStone && Main.dayTime)) { - player.GetCalamityPlayer().throwingCrit += 2; + player.Calamity().throwingCrit += 2; } if (item.type == ItemID.DestroyerEmblem) - player.GetCalamityPlayer().throwingCrit += 8; + player.Calamity().throwingCrit += 8; if (item.type == ItemID.EyeoftheGolem) - player.GetCalamityPlayer().throwingCrit += 10; + player.Calamity().throwingCrit += 10; if (item.type == ItemID.PutridScent) - player.GetCalamityPlayer().throwingCrit += 5; + player.Calamity().throwingCrit += 5; // Hard / Guarding / Armored / Warding give 0.25% / 0.5% / 0.75% / 1% DR if (item.prefix == 62) @@ -2215,7 +2215,7 @@ namespace CalamityMod.Items player.rangedCrit -= 1; player.magicCrit -= 1; player.thrownCrit -= 1; - player.GetCalamityPlayer().throwingCrit += (item.prefix == 68 ? 3 : 1); + player.Calamity().throwingCrit += (item.prefix == 68 ? 3 : 1); } } #endregion @@ -2223,7 +2223,7 @@ namespace CalamityMod.Items #region WingChanges public override void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); float flightSpeedMult = 1f + (modPlayer.soaring ? 0.1f : 0f) + (modPlayer.holyWrath ? 0.05f : 0f) + @@ -2246,7 +2246,7 @@ namespace CalamityMod.Items #region GrabChanges public override void GrabRange(Item item, Player player, ref int grabRange) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); int itemGrabRangeBoost = 0 + (modPlayer.wallOfFleshLore ? 10 : 0) + (modPlayer.planteraLore ? 20 : 0) + diff --git a/Items/Crabulon/FungalClump.cs b/Items/Crabulon/FungalClump.cs index d8472813a2..41a2ceca7e 100644 --- a/Items/Crabulon/FungalClump.cs +++ b/Items/Crabulon/FungalClump.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Crabulon public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.fungalClump) { return false; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Crabulon public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fungalClump = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Cryogen/SoulofCryogen.cs b/Items/Cryogen/SoulofCryogen.cs index 3742c19c93..0ccedec399 100644 --- a/Items/Cryogen/SoulofCryogen.cs +++ b/Items/Cryogen/SoulofCryogen.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Cryogen public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.cryogenSoul = true; player.pickSpeed -= 0.05f; player.allDamage += 0.05f; diff --git a/Items/DevourerMunsters/ArmoredShell.cs b/Items/DevourerMunsters/ArmoredShell.cs index 81f102ce3f..7df699d3c6 100644 --- a/Items/DevourerMunsters/ArmoredShell.cs +++ b/Items/DevourerMunsters/ArmoredShell.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.DevourerMunsters item.height = 30; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } } } diff --git a/Items/DevourerMunsters/DarkPlasma.cs b/Items/DevourerMunsters/DarkPlasma.cs index f563932447..00359615a7 100644 --- a/Items/DevourerMunsters/DarkPlasma.cs +++ b/Items/DevourerMunsters/DarkPlasma.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.DevourerMunsters item.height = 12; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/DevourerMunsters/RuneofCos.cs b/Items/DevourerMunsters/RuneofCos.cs index 8604c0492e..a66f2638e1 100644 --- a/Items/DevourerMunsters/RuneofCos.cs +++ b/Items/DevourerMunsters/RuneofCos.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.DevourerMunsters item.UseSound = SoundID.Item44; item.consumable = false; item.shoot = mod.ProjectileType("VoidSpawn"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) diff --git a/Items/DevourerMunsters/TwistingNether.cs b/Items/DevourerMunsters/TwistingNether.cs index d8396c548b..fab14fe9c1 100644 --- a/Items/DevourerMunsters/TwistingNether.cs +++ b/Items/DevourerMunsters/TwistingNether.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.DevourerMunsters item.maxStack = 999; item.rare = 10; item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Fishing/AstralCrate.cs b/Items/Fishing/AstralCrate.cs index d7877430ff..8bd36e1b39 100644 --- a/Items/Fishing/AstralCrate.cs +++ b/Items/Fishing/AstralCrate.cs @@ -52,13 +52,13 @@ namespace CalamityMod.Items.Fishing mod.ItemType("HivePod"), mod.ItemType("AstralScythe"), mod.ItemType("StellarCannon")); - + //Bait DropHelper.DropItemChance(player, mod.ItemType("Twinkler"), 5, 1, 3); DropHelper.DropItemChance(player, ItemID.EnchantedNightcrawler, 5, 1, 3); DropHelper.DropItemChance(player, mod.ItemType("ArcturusAstroidean"), 5, 1, 3); DropHelper.DropItemChance(player, ItemID.Firefly, 3, 1, 3); - + //Potions DropHelper.DropItemChance(player, ItemID.ObsidianSkinPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.SwiftnessPotion, 10, 1, 3); @@ -81,7 +81,7 @@ namespace CalamityMod.Items.Fishing DropHelper.DropItemChance(player, mod.ItemType("AstralInjection"), 4, 1, 3); DropHelper.DropItemChance(player, mod.ItemType("GravityNormalizerPotion"), 4, 1, 3); } - + //Money DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); DropHelper.DropItemChance(player, ItemID.GoldCoin, 0.5f, 1, 5); diff --git a/Items/Fishing/UrsaSergeant.cs b/Items/Fishing/UrsaSergeant.cs index 0c9ff16352..9932757c7f 100644 --- a/Items/Fishing/UrsaSergeant.cs +++ b/Items/Fishing/UrsaSergeant.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Fishing public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ursaSergeant = true; player.statDefense += 20; player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; diff --git a/Items/HiveMind/RottenBrain.cs b/Items/HiveMind/RottenBrain.cs index 3a270cf6d0..2c7fd1a4b0 100644 --- a/Items/HiveMind/RottenBrain.cs +++ b/Items/HiveMind/RottenBrain.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.HiveMind } } } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.rBrain = true; } } diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index 85906e1e17..c181220180 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.aquaticScourgeLore = true; } } diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index 7d21949886..01e19d6f54 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.astrumAureusLore = true; } } diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index d82e9a6976..f1b3407f1a 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.astrumDeusLore = true; } } diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index d55faba0c6..b9c3d7794b 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.brimstoneElementalLore = true; } } diff --git a/Items/LoreItems/KnowledgeBumblebirb.cs b/Items/LoreItems/KnowledgeBumblebirb.cs index 4430ecd6cd..c3d885cd4f 100644 --- a/Items/LoreItems/KnowledgeBumblebirb.cs +++ b/Items/LoreItems/KnowledgeBumblebirb.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index c6a56c67e2..0a45109fa7 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool CanUseItem(Player player) @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.SCalLore = true; } } diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs index 70cb5322c3..53a674779d 100644 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ b/Items/LoreItems/KnowledgeCalamitasClone.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamitasLore = true; } } diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index 3d257c531b..729591d34b 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dashMod = 6; player.statDefense -= 10; } diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index c2655dcc39..c5be7ff32c 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneDesert || player.GetCalamityPlayer().ZoneSunkenSea) + if (player.ZoneDesert || player.Calamity().ZoneSunkenSea) { - player.GetCalamityPlayer().desertScourgeLore = true; + player.Calamity().desertScourgeLore = true; } } } diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index 19e4ca7a81..a905af024a 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.destroyerLore = true; } } diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index 0a5c6f609a..2611635260 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.DoGLore = true; } } diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index 6af46ea5e3..f95a33522a 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems { if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dukeFishronLore = true; } } diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 7b41dbf629..87e74f0201 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.eaterOfWorldsLore = true; } } diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index d8de70cadc..e4c8ec5f12 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.golemLore = true; } } diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index e01703d5b5..73b948fa79 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems { if (player.ZoneCorrupt) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.hiveMindLore = true; } } diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index c3b64bf937..84f6aa07c2 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.leviathanAndSirenLore = true; } } diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 3e3912169a..6e1e6873d5 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems { if (NPC.LunarApocalypseIsUp) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.lunaticCultistLore = true; } } diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index af3d190608..33c35b1db3 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.moonLordLore = true; } } diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index 0a8599cb9c..3a558b115e 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems { if (player.ZoneCrimson) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.perforatorLore = true; } } diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index 38a35a42bf..e55e923644 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.plaguebringerGoliathLore = true; } } diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index 8c64d25ff3..574c564058 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.planteraLore = true; } } diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index eb2c33cdb3..78dbfd2c7f 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.polterghastLore = true; } } diff --git a/Items/LoreItems/KnowledgeProfanedGuardians.cs b/Items/LoreItems/KnowledgeProfanedGuardians.cs index f273ea535f..27bbe91bce 100644 --- a/Items/LoreItems/KnowledgeProfanedGuardians.cs +++ b/Items/LoreItems/KnowledgeProfanedGuardians.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 68713ca699..244993c56a 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.providenceLore = true; } } diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index 1dcf9584db..11fa4f3295 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.queenBeeLore = true; } } diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index 8089e3bbf4..1081c3ea05 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.ravagerLore = true; } } diff --git a/Items/LoreItems/KnowledgeSentinels.cs b/Items/LoreItems/KnowledgeSentinels.cs index 5983eedf98..3490c851ab 100644 --- a/Items/LoreItems/KnowledgeSentinels.cs +++ b/Items/LoreItems/KnowledgeSentinels.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index f7ec26eec7..395c115155 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems { if (player.ZoneDungeon) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.skeletronLore = true; } } diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index 5447cedaf4..aaaeaf57aa 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.skeletronPrimeLore = true; } } diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index 6097861555..71468c9539 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.wallOfFleshLore = true; } } diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index 0fcc5e959a..e1d91ef2b7 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.LoreItems item.height = 20; item.rare = 10; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool CanUseItem(Player player) @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.yharonLore = true; } } diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index 1ef00796a8..139d0ce17c 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.value = Item.sellPrice(silver: 60); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } } } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 61f8ae6f5e..b280271bd6 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 4); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Materials/CalamitousEssence.cs b/Items/Materials/CalamitousEssence.cs index eed037d1c7..f5bad0a802 100644 --- a/Items/Materials/CalamitousEssence.cs +++ b/Items/Materials/CalamitousEssence.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 24); - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } } } diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index f0ad4a760a..15d7f0b565 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 12); - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } } } diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 4a1e491f96..6a8ef1147d 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 2); - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } } } diff --git a/Items/Materials/HellcasterFragment.cs b/Items/Materials/HellcasterFragment.cs index 1d0d4e832c..cb4ded03bd 100644 --- a/Items/Materials/HellcasterFragment.cs +++ b/Items/Materials/HellcasterFragment.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Materials item.height = 14; item.maxStack = 999; item.value = Item.sellPrice(gold: 16); - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } } } diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 3133b572d7..6979da451e 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 2); - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } } } diff --git a/Items/Materials/Phantoplasm.cs b/Items/Materials/Phantoplasm.cs index 2b0f22529a..2d8ca85228 100644 --- a/Items/Materials/Phantoplasm.cs +++ b/Items/Materials/Phantoplasm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 1); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Color? GetAlpha(Color lightColor) diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 401bf43a5c..28e55c4df4 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 27, silver: 50); - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void AddRecipes() diff --git a/Items/Materials/UeliaceBar.cs b/Items/Materials/UeliaceBar.cs index 473bed0719..cd59823024 100644 --- a/Items/Materials/UeliaceBar.cs +++ b/Items/Materials/UeliaceBar.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = 10; item.value = Item.sellPrice(gold: 3); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Mounts/Fab.cs b/Items/Mounts/Fab.cs index 8f282b2dd3..95b8b53c18 100644 --- a/Items/Mounts/Fab.cs +++ b/Items/Mounts/Fab.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Mounts public override void UpdateEffects(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.fabsolVodka) { player.allDamage += 0.1f; diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 51edadad6a..91672a8ace 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Items.Mounts tile.type != TileID.GreenDungeonBrick && tile.type != TileID.PinkDungeonBrick && tile.type != TileID.DemonAltar && (tile.type != (ushort)mod.TileType("AstralOre") || CalamityWorld.downedStarGod) && ((tile.type != (ushort)mod.TileType("Tenebris") && tile.type != (ushort)mod.TileType("PlantyMush")) || NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && - (!player.GetCalamityPlayer().ZoneSunkenSea || CalamityWorld.downedDesertScourge) && + (!player.Calamity().ZoneSunkenSea || CalamityWorld.downedDesertScourge) && (Main.tileValue[tile.type] < tileValueLimit || tile.type == TileID.Heart || tile.type == TileID.LifeFruit) && !player.noBuilding && tile.type != TileID.ElderCrystalStand && tile.type != TileID.Containers) { diff --git a/Items/Patreon/AngelicShotgun.cs b/Items/Patreon/AngelicShotgun.cs index 6f43c52abf..60be188e3e 100644 --- a/Items/Patreon/AngelicShotgun.cs +++ b/Items/Patreon/AngelicShotgun.cs @@ -37,7 +37,7 @@ Fighting 'til the war's won"); item.rare = 10; item.value = Item.buyPrice(1, 40, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.shootSpeed = BulletSpeed; item.shoot = mod.ProjectileType("IlluminatedBullet"); diff --git a/Items/Patreon/ApronOfAffection.cs b/Items/Patreon/ApronOfAffection.cs index 0979d7b79b..5ed39240ca 100644 --- a/Items/Patreon/ApronOfAffection.cs +++ b/Items/Patreon/ApronOfAffection.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Patreon item.width = 18; item.height = 18; item.rare = 5; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(0, 15, 0, 0); item.vanity = true; } diff --git a/Items/Patreon/Ataraxia.cs b/Items/Patreon/Ataraxia.cs index cbff686094..2f39aba1e0 100644 --- a/Items/Patreon/Ataraxia.cs +++ b/Items/Patreon/Ataraxia.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Patreon item.UseSound = SoundID.Item1; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(2, 50, 0, 0); item.shoot = mod.ProjectileType("AtaraxiaMain"); diff --git a/Items/Patreon/BloodyVein.cs b/Items/Patreon/BloodyVein.cs index 8f7a08d873..ae3e77d394 100644 --- a/Items/Patreon/BloodyVein.cs +++ b/Items/Patreon/BloodyVein.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Patreon item.shoot = mod.ProjectileType("PerforaMini"); item.buffType = mod.BuffType("BloodBound"); item.rare = 3; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override void UseStyle(Player player) diff --git a/Items/Patreon/CorpusAvertorMelee.cs b/Items/Patreon/CorpusAvertorMelee.cs index 047abde0a5..c6aa89e0c4 100644 --- a/Items/Patreon/CorpusAvertorMelee.cs +++ b/Items/Patreon/CorpusAvertorMelee.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Patreon item.autoReuse = true; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.shoot = mod.ProjectileType("CorpusAvertor"); item.shootSpeed = 5f; item.melee = true; diff --git a/Items/Patreon/DarkSpark.cs b/Items/Patreon/DarkSpark.cs index 575fd79ae8..c7c5c44029 100644 --- a/Items/Patreon/DarkSpark.cs +++ b/Items/Patreon/DarkSpark.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Patreon item.rare = 10; item.shoot = mod.ProjectileType("DarkSpark"); item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Patreon/DevilsSunrise.cs b/Items/Patreon/DevilsSunrise.cs index 9e2f040ab4..e2cae03fbe 100644 --- a/Items/Patreon/DevilsSunrise.cs +++ b/Items/Patreon/DevilsSunrise.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Patreon item.useStyle = 5; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(1, 40, 0, 0); item.shoot = mod.ProjectileType("DevilsSunrise"); diff --git a/Items/Patreon/DivineRetribution.cs b/Items/Patreon/DivineRetribution.cs index 178984b60b..7c6687a1b4 100644 --- a/Items/Patreon/DivineRetribution.cs +++ b/Items/Patreon/DivineRetribution.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Patreon item.autoReuse = true; item.shootSpeed = 19f; item.shoot = mod.ProjectileType("DivineRetribution"); - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Patreon/DodusHandcannon.cs b/Items/Patreon/DodusHandcannon.cs index 9704e0a57a..d508a3a0c7 100644 --- a/Items/Patreon/DodusHandcannon.cs +++ b/Items/Patreon/DodusHandcannon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Patreon item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); diff --git a/Items/Patreon/DragonPow.cs b/Items/Patreon/DragonPow.cs index c504262328..ba6195aed6 100644 --- a/Items/Patreon/DragonPow.cs +++ b/Items/Patreon/DragonPow.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Patreon item.channel = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(2, 50, 0, 0); item.shoot = mod.ProjectileType("DragonPowFlail"); diff --git a/Items/Patreon/FaceMelter.cs b/Items/Patreon/FaceMelter.cs index db6e3f46e0..26f5d35ecf 100644 --- a/Items/Patreon/FaceMelter.cs +++ b/Items/Patreon/FaceMelter.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Patreon item.noMelee = true; item.knockBack = 5f; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(1, 80, 0, 0); item.shoot = mod.ProjectileType("MelterNote1"); item.UseSound = SoundID.Item47; diff --git a/Items/Patreon/ForgottenDragonEgg.cs b/Items/Patreon/ForgottenDragonEgg.cs index 580d39caca..0268e3741e 100644 --- a/Items/Patreon/ForgottenDragonEgg.cs +++ b/Items/Patreon/ForgottenDragonEgg.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Patreon item.shoot = mod.ProjectileType("Akato"); item.buffType = mod.BuffType("AkatoYharonBuff"); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override void UseStyle(Player player) diff --git a/Items/Patreon/GazeOfCrysthamyr.cs b/Items/Patreon/GazeOfCrysthamyr.cs index 03edb297e9..e2bc6a1d7b 100644 --- a/Items/Patreon/GazeOfCrysthamyr.cs +++ b/Items/Patreon/GazeOfCrysthamyr.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Patreon item.UseSound = SoundID.NPCHit56; item.noMelee = true; item.mountType = mod.MountType("Crysthamyr"); - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override void AddRecipes() diff --git a/Items/Patreon/HandheldTank.cs b/Items/Patreon/HandheldTank.cs index fe474e45d8..33bb4ad629 100644 --- a/Items/Patreon/HandheldTank.cs +++ b/Items/Patreon/HandheldTank.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Patreon item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.shoot = mod.ProjectileType("HandheldTankShell"); item.shootSpeed = 6f; diff --git a/Items/Patreon/Karasawa.cs b/Items/Patreon/Karasawa.cs index 37a6201aeb..3b162fe528 100644 --- a/Items/Patreon/Karasawa.cs +++ b/Items/Patreon/Karasawa.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Patreon item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.shoot = mod.ProjectileType("KarasawaShot"); item.shootSpeed = 1f; diff --git a/Items/Patreon/Keelhaul.cs b/Items/Patreon/Keelhaul.cs index 6acdd3ce97..1ff2c2cf36 100644 --- a/Items/Patreon/Keelhaul.cs +++ b/Items/Patreon/Keelhaul.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Patreon item.UseSound = SoundID.Item102; item.autoReuse = true; item.rare = 8; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(0, 80, 0, 0); item.shoot = mod.ProjectileType("KeelhaulBubble"); item.shootSpeed = 15f; diff --git a/Items/Patreon/KelvinCatalystMelee.cs b/Items/Patreon/KelvinCatalystMelee.cs index f705bea52b..17c436f956 100644 --- a/Items/Patreon/KelvinCatalystMelee.cs +++ b/Items/Patreon/KelvinCatalystMelee.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Patreon item.shoot = mod.ProjectileType("KelvinCatalyst"); item.shootSpeed = 8f; item.melee = true; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Patreon/LightGodsBrilliance.cs b/Items/Patreon/LightGodsBrilliance.cs index 5e08148372..9eff64bcc8 100644 --- a/Items/Patreon/LightGodsBrilliance.cs +++ b/Items/Patreon/LightGodsBrilliance.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Patreon item.autoReuse = true; item.shoot = mod.ProjectileType("LightBead"); item.shootSpeed = 25f; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Patreon/MadAlchemistsCocktailGlove.cs b/Items/Patreon/MadAlchemistsCocktailGlove.cs index ab8bd4e704..c1411dbb76 100644 --- a/Items/Patreon/MadAlchemistsCocktailGlove.cs +++ b/Items/Patreon/MadAlchemistsCocktailGlove.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Patreon item.autoReuse = true; item.shoot = mod.ProjectileType("MadAlchemistsCocktailRed"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override bool AltFunctionUse(Player player) diff --git a/Items/Patreon/Nadir.cs b/Items/Patreon/Nadir.cs index 177d73d1dd..0e470ce195 100644 --- a/Items/Patreon/Nadir.cs +++ b/Items/Patreon/Nadir.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Patreon item.UseSound = SoundID.Item1; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(1, 80, 0, 0); item.shoot = mod.ProjectileType("NadirSpear"); diff --git a/Items/Patreon/NormalityRelocator.cs b/Items/Patreon/NormalityRelocator.cs index b51f2d4c67..63a92e7528 100644 --- a/Items/Patreon/NormalityRelocator.cs +++ b/Items/Patreon/NormalityRelocator.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Items.Patreon item.height = 38; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.normalityRelocator = true; } diff --git a/Items/Patreon/Oracle.cs b/Items/Patreon/Oracle.cs index aac6a3b9b1..3f5b9d0a52 100644 --- a/Items/Patreon/Oracle.cs +++ b/Items/Patreon/Oracle.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Patreon item.channel = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(2, 50, 0, 0); item.shoot = mod.ProjectileType("OracleYoyo"); diff --git a/Items/Patreon/ProfanedSoulArtifact.cs b/Items/Patreon/ProfanedSoulArtifact.cs index 04e5b62fb6..7ac3e89360 100644 --- a/Items/Patreon/ProfanedSoulArtifact.cs +++ b/Items/Patreon/ProfanedSoulArtifact.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.Patreon item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.pArtifact = true; } diff --git a/Items/Patreon/ResurrectionButterfly.cs b/Items/Patreon/ResurrectionButterfly.cs index e812ed031a..92bf9d6809 100644 --- a/Items/Patreon/ResurrectionButterfly.cs +++ b/Items/Patreon/ResurrectionButterfly.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Patreon item.knockBack = 1f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = mod.ProjectileType("PinkButterfly"); diff --git a/Items/Patreon/Roxcalibur.cs b/Items/Patreon/Roxcalibur.cs index d218903490..9071276132 100644 --- a/Items/Patreon/Roxcalibur.cs +++ b/Items/Patreon/Roxcalibur.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Patreon item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; } public override void AddRecipes() diff --git a/Items/Patreon/TheLastMourning.cs b/Items/Patreon/TheLastMourning.cs index 0d21f9f5ab..06bd1faf29 100644 --- a/Items/Patreon/TheLastMourning.cs +++ b/Items/Patreon/TheLastMourning.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Patreon item.UseSound = SoundID.Item1; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(1, 40, 0, 0); } diff --git a/Items/Patreon/ThePack.cs b/Items/Patreon/ThePack.cs index d412869e0f..7bf38c37d0 100644 --- a/Items/Patreon/ThePack.cs +++ b/Items/Patreon/ThePack.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Patreon item.knockBack = 7.5f; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shootSpeed = 24f; diff --git a/Items/Patreon/YateveoBloom.cs b/Items/Patreon/YateveoBloom.cs index 9be33d5e97..03312e72e7 100644 --- a/Items/Patreon/YateveoBloom.cs +++ b/Items/Patreon/YateveoBloom.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Patreon item.UseSound = SoundID.Item1; item.rare = 2; - item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(0, 2, 0, 0); item.shoot = mod.ProjectileType("YateveoBloom"); diff --git a/Items/Perforator/BloodyWormTooth.cs b/Items/Perforator/BloodyWormTooth.cs index d5951e5ef0..123d81161a 100644 --- a/Items/Perforator/BloodyWormTooth.cs +++ b/Items/Perforator/BloodyWormTooth.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Perforator public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodyWormTooth = true; } } diff --git a/Items/PermanentBoosters/BloodOrange.cs b/Items/PermanentBoosters/BloodOrange.cs index 689ad680b1..31907e4873 100644 --- a/Items/PermanentBoosters/BloodOrange.cs +++ b/Items/PermanentBoosters/BloodOrange.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.bOrange || player.statLifeMax < 500) { return false; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.PermanentBoosters { player.HealEffect(25); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bOrange = true; } return true; diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index 61982b51ed..78720e27bd 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.cShard) { return false; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.PermanentBoosters { player.ManaEffect(50); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.cShard = true; } return true; diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index 0c9c400be7..810452e53f 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Items.PermanentBoosters item.UseSound = SoundID.Item4; item.consumable = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.dFruit || player.statLifeMax < 500) { return false; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.PermanentBoosters { player.HealEffect(25); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.dFruit = true; } return true; diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index 06d843d8b3..206c401ac2 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.PermanentBoosters item.UseSound = SoundID.Item122; item.consumable = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.adrenalineBoostThree) { return false; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.PermanentBoosters if (player.itemAnimation > 0 && player.itemTime == 0) { player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.adrenalineBoostThree = true; } return true; diff --git a/Items/PermanentBoosters/Elderberry.cs b/Items/PermanentBoosters/Elderberry.cs index 210205195b..42a35b52b3 100644 --- a/Items/PermanentBoosters/Elderberry.cs +++ b/Items/PermanentBoosters/Elderberry.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.eBerry || player.statLifeMax < 500) { return false; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.PermanentBoosters { player.HealEffect(25); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.eBerry = true; } return true; diff --git a/Items/PermanentBoosters/ElectrolyteGelPack.cs b/Items/PermanentBoosters/ElectrolyteGelPack.cs index 5368044faf..a04eda5d77 100644 --- a/Items/PermanentBoosters/ElectrolyteGelPack.cs +++ b/Items/PermanentBoosters/ElectrolyteGelPack.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.adrenalineBoostOne) { return false; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.PermanentBoosters if (player.itemAnimation > 0 && player.itemTime == 0) { player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.adrenalineBoostOne = true; } return true; diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index c7a439cf24..6e46b60369 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.eCore) { return false; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.PermanentBoosters { player.ManaEffect(50); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.eCore = true; } return true; diff --git a/Items/PermanentBoosters/InfernalBlood.cs b/Items/PermanentBoosters/InfernalBlood.cs index 278dd55906..5489c49cb0 100644 --- a/Items/PermanentBoosters/InfernalBlood.cs +++ b/Items/PermanentBoosters/InfernalBlood.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.rageBoostTwo) { return false; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.PermanentBoosters if (player.itemAnimation > 0 && player.itemTime == 0) { player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.rageBoostTwo = true; } return true; diff --git a/Items/PermanentBoosters/MLGRune2.cs b/Items/PermanentBoosters/MLGRune2.cs index 9edbfc0119..dc8b86f181 100644 --- a/Items/PermanentBoosters/MLGRune2.cs +++ b/Items/PermanentBoosters/MLGRune2.cs @@ -30,7 +30,7 @@ Consuming it does something that cannot be reversed"); public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.extraAccessoryML) { return false; @@ -40,7 +40,7 @@ Consuming it does something that cannot be reversed"); public override bool UseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) { player.itemTime = item.useTime; diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 9821fb012f..705ca65fbc 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.mFruit || player.statLifeMax < 500) { return false; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.PermanentBoosters { player.HealEffect(25); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.mFruit = true; } return true; diff --git a/Items/PermanentBoosters/MushroomPlasmaRoot.cs b/Items/PermanentBoosters/MushroomPlasmaRoot.cs index 5389ef182b..f76c3d3587 100644 --- a/Items/PermanentBoosters/MushroomPlasmaRoot.cs +++ b/Items/PermanentBoosters/MushroomPlasmaRoot.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.rageBoostOne) { return false; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.PermanentBoosters if (player.itemAnimation > 0 && player.itemTime == 0) { player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.rageBoostOne = true; } return true; diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index 8e665e926e..a18cf43966 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.PermanentBoosters item.UseSound = SoundID.Item29; item.consumable = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.pHeart) { return false; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.PermanentBoosters { player.ManaEffect(50); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.pHeart = true; } return true; diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index 46aef20f1a..31ffbc8e17 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.PermanentBoosters item.UseSound = SoundID.Item122; item.consumable = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.rageBoostThree) { return false; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.PermanentBoosters if (player.itemAnimation > 0 && player.itemTime == 0) { player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.rageBoostThree = true; } return true; diff --git a/Items/PermanentBoosters/StarlightFuelCell.cs b/Items/PermanentBoosters/StarlightFuelCell.cs index 5698819a5d..fa56ddb981 100644 --- a/Items/PermanentBoosters/StarlightFuelCell.cs +++ b/Items/PermanentBoosters/StarlightFuelCell.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.PermanentBoosters public override bool CanUseItem(Player player) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.adrenalineBoostTwo) { return false; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.PermanentBoosters if (player.itemAnimation > 0 && player.itemTime == 0) { player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.adrenalineBoostTwo = true; } return true; diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index cc04095835..7b7c74e18d 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Pets item.buffType = mod.BuffType("ChibiiBuff"); item.rare = 10; item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void UseStyle(Player player) diff --git a/Items/Placeables/AuricOre.cs b/Items/Placeables/AuricOre.cs index 808e9076b5..476f69f99a 100644 --- a/Items/Placeables/AuricOre.cs +++ b/Items/Placeables/AuricOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(gold: 2); - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } } } diff --git a/Items/Placeables/DraedonsForge.cs b/Items/Placeables/DraedonsForge.cs index 2f4c98f36d..1febd4982b 100644 --- a/Items/Placeables/DraedonsForge.cs +++ b/Items/Placeables/DraedonsForge.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Placeables item.value = 5000000; item.rare = 10; item.createTile = mod.TileType("DraedonsForge"); - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void AddRecipes() diff --git a/Items/PlaguebringerGoliath/BloomStone.cs b/Items/PlaguebringerGoliath/BloomStone.cs index 65d1db8e2f..d620b2b507 100644 --- a/Items/PlaguebringerGoliath/BloomStone.cs +++ b/Items/PlaguebringerGoliath/BloomStone.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.PlaguebringerGoliath public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.25f, 0.4f, 0.2f); player.allDamage += 0.03f; int bloomCounter = 0; diff --git a/Items/Polterghast/Affliction.cs b/Items/Polterghast/Affliction.cs index 74a28d012f..e1a14a4a70 100644 --- a/Items/Polterghast/Affliction.cs +++ b/Items/Polterghast/Affliction.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Polterghast public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.affliction = true; if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) { diff --git a/Items/Polterghast/NecroplasmicBeacon.cs b/Items/Polterghast/NecroplasmicBeacon.cs index 85ff8fb7d5..f76659fd54 100644 --- a/Items/Polterghast/NecroplasmicBeacon.cs +++ b/Items/Polterghast/NecroplasmicBeacon.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Polterghast item.useTime = 45; item.useStyle = 4; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) diff --git a/Items/Polterghast/RuinousSoul.cs b/Items/Polterghast/RuinousSoul.cs index f745eb0fb1..8a211e87d0 100644 --- a/Items/Polterghast/RuinousSoul.cs +++ b/Items/Polterghast/RuinousSoul.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Polterghast item.height = 20; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } } } diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index 9866d8259b..feb9aab53f 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Potions public override bool CanUseItem(Player player) { - return player.GetCalamityPlayer().draconicSurgeCooldown == 0; + return player.Calamity().draconicSurgeCooldown == 0; } public override void AddRecipes() diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index 996ec9c45b..55afb6b8f2 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Potions item.potion = true; item.rare = 10; item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Potions/RevivifyPotion.cs b/Items/Potions/RevivifyPotion.cs index 2b6d04c293..0623a1e66e 100644 --- a/Items/Potions/RevivifyPotion.cs +++ b/Items/Potions/RevivifyPotion.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Potions if (player.itemAnimation > 0 && player.itemTime == 0) { player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.revivifyTimer = 900; } return true; diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index f91216e152..695a544437 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Potions item.potion = true; item.rare = 10; item.value = Item.buyPrice(0, 6, 50, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index 9f1ae9215e..a3f2d4bab7 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Potions item.consumable = true; item.rare = 10; item.value = Item.buyPrice(0, 6, 50, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/ProfanedGuardian/ProfanedShard.cs b/Items/ProfanedGuardian/ProfanedShard.cs index fbded09cd4..4313eac320 100644 --- a/Items/ProfanedGuardian/ProfanedShard.cs +++ b/Items/ProfanedGuardian/ProfanedShard.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.ProfanedGuardian item.useTime = 45; item.useStyle = 4; item.consumable = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/Providence/DivineGeode.cs b/Items/Providence/DivineGeode.cs index e36a879f5c..be1a60268d 100644 --- a/Items/Providence/DivineGeode.cs +++ b/Items/Providence/DivineGeode.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Providence item.maxStack = 999; item.rare = 10; item.value = Item.buyPrice(0, 6, 50, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Providence/ElysianAegis.cs b/Items/Providence/ElysianAegis.cs index 87821bf75c..3ef79c8bf1 100644 --- a/Items/Providence/ElysianAegis.cs +++ b/Items/Providence/ElysianAegis.cs @@ -25,14 +25,14 @@ namespace CalamityMod.Items.Providence item.height = 42; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; item.defense = 8; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!hideVisual) { modPlayer.dashMod = 3; } modPlayer.elysianAegis = true; player.noKnockback = true; diff --git a/Items/Providence/ElysianWings.cs b/Items/Providence/ElysianWings.cs index 06758ea52a..d5009757a3 100644 --- a/Items/Providence/ElysianWings.cs +++ b/Items/Providence/ElysianWings.cs @@ -22,13 +22,13 @@ namespace CalamityMod.Items.Providence item.height = 32; item.value = Item.buyPrice(0, 45, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.moveSpeed += 0.4f; player.lavaMax += 240; player.wingTimeMax = 180; diff --git a/Items/Providence/ProfanedCore.cs b/Items/Providence/ProfanedCore.cs index 5f9b0ec286..82283e68aa 100644 --- a/Items/Providence/ProfanedCore.cs +++ b/Items/Providence/ProfanedCore.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Providence item.useStyle = 4; item.consumable = true; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/Providence/ProfanedCoreUnlimited.cs b/Items/Providence/ProfanedCoreUnlimited.cs index 3916ca77f5..b38f61fdee 100644 --- a/Items/Providence/ProfanedCoreUnlimited.cs +++ b/Items/Providence/ProfanedCoreUnlimited.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Providence item.useStyle = 4; item.consumable = false; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/Providence/UnholyEssence.cs b/Items/Providence/UnholyEssence.cs index a9911dcd54..710bd1f40a 100644 --- a/Items/Providence/UnholyEssence.cs +++ b/Items/Providence/UnholyEssence.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Providence item.maxStack = 999; item.rare = 10; item.value = Item.buyPrice(0, 6, 50, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Scavenger/BloodPact.cs b/Items/Scavenger/BloodPact.cs index 52bcda2ad0..ab8ba21898 100644 --- a/Items/Scavenger/BloodPact.cs +++ b/Items/Scavenger/BloodPact.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Scavenger public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodPact = true; } } diff --git a/Items/Scavenger/FleshTotem.cs b/Items/Scavenger/FleshTotem.cs index cf6b65b703..5831edd8bb 100644 --- a/Items/Scavenger/FleshTotem.cs +++ b/Items/Scavenger/FleshTotem.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Scavenger public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fleshTotem = true; } } diff --git a/Items/ShrineItems/FungalSymbiote.cs b/Items/ShrineItems/FungalSymbiote.cs index 2a3ad12df4..7ee066bd3f 100644 --- a/Items/ShrineItems/FungalSymbiote.cs +++ b/Items/ShrineItems/FungalSymbiote.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.ShrineItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.fungalSymbiote = true; } } diff --git a/Items/ShrineItems/GladiatorsLocket.cs b/Items/ShrineItems/GladiatorsLocket.cs index 4267ee87c7..5da751112f 100644 --- a/Items/ShrineItems/GladiatorsLocket.cs +++ b/Items/ShrineItems/GladiatorsLocket.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.ShrineItems public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); //there might be an upgrade sometime later? + CalamityPlayer modPlayer = player.Calamity(); //there might be an upgrade sometime later? if (modPlayer.gladiatorSword) { return false; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.ShrineItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.gladiatorSword = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/ShrineItems/LuxorsGift.cs b/Items/ShrineItems/LuxorsGift.cs index d9f74251a1..25948eca9d 100644 --- a/Items/ShrineItems/LuxorsGift.cs +++ b/Items/ShrineItems/LuxorsGift.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.ShrineItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.luxorsGift = true; } } diff --git a/Items/ShrineItems/TrinketofChi.cs b/Items/ShrineItems/TrinketofChi.cs index a1bae1345e..3d5519b0a1 100644 --- a/Items/ShrineItems/TrinketofChi.cs +++ b/Items/ShrineItems/TrinketofChi.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.ShrineItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.trinketOfChi = true; } } diff --git a/Items/ShrineItems/UnstablePrism.cs b/Items/ShrineItems/UnstablePrism.cs index 6f922f23d2..0c8ca5dd17 100644 --- a/Items/ShrineItems/UnstablePrism.cs +++ b/Items/ShrineItems/UnstablePrism.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.ShrineItems public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.unstablePrism = true; } } diff --git a/Items/SlimeGod/ManaOverloader.cs b/Items/SlimeGod/ManaOverloader.cs index 78315a659f..99511ab5da 100644 --- a/Items/SlimeGod/ManaOverloader.cs +++ b/Items/SlimeGod/ManaOverloader.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.SlimeGod public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.manaOverloader = true; player.statManaMax2 += 50; } diff --git a/Items/SunkenSea/GiantPearl.cs b/Items/SunkenSea/GiantPearl.cs index 00737cf460..fa4d8c8093 100644 --- a/Items/SunkenSea/GiantPearl.cs +++ b/Items/SunkenSea/GiantPearl.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.SunkenSea public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.giantPearl = true; Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.45f, 0.8f, 0.8f); } diff --git a/Items/SupremeCalamitas/EyeofExtinction.cs b/Items/SupremeCalamitas/EyeofExtinction.cs index cfea0e774e..76da29d737 100644 --- a/Items/SupremeCalamitas/EyeofExtinction.cs +++ b/Items/SupremeCalamitas/EyeofExtinction.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.SupremeCalamitas item.useTime = 45; item.useStyle = 4; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool CanUseItem(Player player) diff --git a/Items/TheDevourerofGods/CosmicWorm.cs b/Items/TheDevourerofGods/CosmicWorm.cs index deacb77caf..07fa3f18ce 100644 --- a/Items/TheDevourerofGods/CosmicWorm.cs +++ b/Items/TheDevourerofGods/CosmicWorm.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.TheDevourerofGods item.useTime = 45; item.useStyle = 4; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) diff --git a/Items/TheDevourerofGods/CosmiliteBar.cs b/Items/TheDevourerofGods/CosmiliteBar.cs index c918e50a5d..63c3b24d2d 100644 --- a/Items/TheDevourerofGods/CosmiliteBar.cs +++ b/Items/TheDevourerofGods/CosmiliteBar.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.TheDevourerofGods item.height = 24; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/TheDevourerofGods/DevourerofGodsBag.cs b/Items/TheDevourerofGods/DevourerofGodsBag.cs index 6103503423..d2af0d2fd8 100644 --- a/Items/TheDevourerofGods/DevourerofGodsBag.cs +++ b/Items/TheDevourerofGods/DevourerofGodsBag.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.TheDevourerofGods // Equipment DropHelper.DropItem(player, mod.ItemType("NebulousCore")); - bool vodka = player.GetCalamityPlayer().fabsolVodka; + bool vodka = player.Calamity().fabsolVodka; DropHelper.DropItemCondition(player, mod.ItemType("Fabsol"), CalamityWorld.revenge && vodka); // Vanity diff --git a/Items/TheDevourerofGods/NebulousCore.cs b/Items/TheDevourerofGods/NebulousCore.cs index 78f970293c..77a8c6010b 100644 --- a/Items/TheDevourerofGods/NebulousCore.cs +++ b/Items/TheDevourerofGods/NebulousCore.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.TheDevourerofGods public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.nCore = true; player.allDamage += 0.12f; int damage = 1500; diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 6068d52968..8500ac212a 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 6; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 8d139af935..0753d4bdfa 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Tools item.rare = 10; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override bool AltFunctionUse(Player player) diff --git a/Items/Tools/GallantPickaxe.cs b/Items/Tools/GallantPickaxe.cs index 13c2c298c5..92e60c1d87 100644 --- a/Items/Tools/GallantPickaxe.cs +++ b/Items/Tools/GallantPickaxe.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 5; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/AMR.cs b/Items/Weapons/AMR.cs index bb472edefc..6eb7271a81 100644 --- a/Items/Weapons/AMR.cs +++ b/Items/Weapons/AMR.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/AbyssWeapons/CalamarisLament.cs b/Items/Weapons/AbyssWeapons/CalamarisLament.cs index feedd9f632..08fd79669f 100644 --- a/Items/Weapons/AbyssWeapons/CalamarisLament.cs +++ b/Items/Weapons/AbyssWeapons/CalamarisLament.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.shoot = mod.ProjectileType("Calamari"); item.shootSpeed = 10f; item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/AbyssWeapons/EidolicWail.cs b/Items/Weapons/AbyssWeapons/EidolicWail.cs index da1f79e81b..794085844d 100644 --- a/Items/Weapons/AbyssWeapons/EidolicWail.cs +++ b/Items/Weapons/AbyssWeapons/EidolicWail.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.autoReuse = true; item.shootSpeed = 5f; item.shoot = mod.ProjectileType("EidolicWail"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/AbyssWeapons/SoulEdge.cs b/Items/Weapons/AbyssWeapons/SoulEdge.cs index fe4baeed89..462221dcca 100644 --- a/Items/Weapons/AbyssWeapons/SoulEdge.cs +++ b/Items/Weapons/AbyssWeapons/SoulEdge.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.rare = 10; item.shoot = mod.ProjectileType("GhastlySoulLarge"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs index a96b06fb29..26d819c04d 100644 --- a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs +++ b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.UseSound = SoundID.Item95; item.shoot = mod.ProjectileType("SulphuricAcidCannon2"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/AccretionDiskMelee.cs b/Items/Weapons/AccretionDiskMelee.cs index bc5d1eb3b1..6a590e9d4b 100644 --- a/Items/Weapons/AccretionDiskMelee.cs +++ b/Items/Weapons/AccretionDiskMelee.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("AccretionDiskMelee"); item.shootSpeed = 13f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/AegisBlade.cs b/Items/Weapons/AegisBlade.cs index 007e4fbe03..71bb7fe818 100644 --- a/Items/Weapons/AegisBlade.cs +++ b/Items/Weapons/AegisBlade.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 7; item.value = Item.buyPrice(0, 60, 0, 0); item.shootSpeed = 14f; - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().postMoonLordRarity = 17; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/AethersWhisper.cs b/Items/Weapons/AethersWhisper.cs index 8d785c604b..600ee3cdd2 100644 --- a/Items/Weapons/AethersWhisper.cs +++ b/Items/Weapons/AethersWhisper.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shootSpeed = 12f; item.shoot = mod.ProjectileType("AetherBeam"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Alluvion.cs b/Items/Weapons/Alluvion.cs index 029fdae546..ad1ef08eed 100644 --- a/Items/Weapons/Alluvion.cs +++ b/Items/Weapons/Alluvion.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 1; item.shootSpeed = 17f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons type = mod.ProjectileType("TyphoonArrow"); } int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num121].Calamity().forceRanged = true; Main.projectile[num121].noDropItem = true; } else diff --git a/Items/Weapons/AlphaRay.cs b/Items/Weapons/AlphaRay.cs index 3f713c9d96..e9b4735499 100644 --- a/Items/Weapons/AlphaRay.cs +++ b/Items/Weapons/AlphaRay.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shootSpeed = 6f; item.shoot = mod.ProjectileType("ParticleBeamofDoom"); - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Animus.cs b/Items/Weapons/Animus.cs index 5c6fd2d96c..b72936035b 100644 --- a/Items/Weapons/Animus.cs +++ b/Items/Weapons/Animus.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons item.height = 90; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/Weapons/ApoctosisArray.cs b/Items/Weapons/ApoctosisArray.cs index ae0af77395..17be2d8edf 100644 --- a/Items/Weapons/ApoctosisArray.cs +++ b/Items/Weapons/ApoctosisArray.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("IonBlast"); item.shootSpeed = 8f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Apotheosis.cs b/Items/Weapons/Apotheosis.cs index b53a0035c3..aaf60f5c47 100644 --- a/Items/Weapons/Apotheosis.cs +++ b/Items/Weapons/Apotheosis.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("ApothMark"); item.shootSpeed = 15; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/AquaticDissolution.cs b/Items/Weapons/AquaticDissolution.cs index 71009ecc89..fd04db1ea4 100644 --- a/Items/Weapons/AquaticDissolution.cs +++ b/Items/Weapons/AquaticDissolution.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("OceanBeam"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ArkoftheAncients.cs b/Items/Weapons/ArkoftheAncients.cs index 394e8e3b04..874b41e64b 100644 --- a/Items/Weapons/ArkoftheAncients.cs +++ b/Items/Weapons/ArkoftheAncients.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage / 2, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/ArkoftheCosmos.cs b/Items/Weapons/ArkoftheCosmos.cs index 8dc43b5228..2c20c615c9 100644 --- a/Items/Weapons/ArkoftheCosmos.cs +++ b/Items/Weapons/ArkoftheCosmos.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("EonBeam"); item.shootSpeed = 28f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ArkoftheElements.cs b/Items/Weapons/ArkoftheElements.cs index 36fb4767fd..ccd8e2f686 100644 --- a/Items/Weapons/ArkoftheElements.cs +++ b/Items/Weapons/ArkoftheElements.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("EonBeam"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ArterialAssault.cs b/Items/Weapons/ArterialAssault.cs index 371814cc7d..061bd257f0 100644 --- a/Items/Weapons/ArterialAssault.cs +++ b/Items/Weapons/ArterialAssault.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("BloodfireArrow"); item.shootSpeed = 30f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/AsteroidStaff.cs b/Items/Weapons/AsteroidStaff.cs index 258746a422..3bf2141bd5 100644 --- a/Items/Weapons/AsteroidStaff.cs +++ b/Items/Weapons/AsteroidStaff.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Asteroid"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/AuguroftheElements.cs b/Items/Weapons/AuguroftheElements.cs index 7f1224a1bd..401444dc63 100644 --- a/Items/Weapons/AuguroftheElements.cs +++ b/Items/Weapons/AuguroftheElements.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("ElementTentacle"); item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/Azathoth.cs b/Items/Weapons/Azathoth.cs index b4c731834f..d96b5080a2 100644 --- a/Items/Weapons/Azathoth.cs +++ b/Items/Weapons/Azathoth.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("AzathothProjectile"); - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/Weapons/BladedgeGreatbow.cs b/Items/Weapons/BladedgeGreatbow.cs index 604f4c4982..172aefe7a0 100644 --- a/Items/Weapons/BladedgeGreatbow.cs +++ b/Items/Weapons/BladedgeGreatbow.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons value9 -= vector7; } int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage, 0f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[projectile].Calamity().forceRanged = true; } return false; } diff --git a/Items/Weapons/BloodfireArrow.cs b/Items/Weapons/BloodfireArrow.cs index 520ea56ef6..554e3f2893 100644 --- a/Items/Weapons/BloodfireArrow.cs +++ b/Items/Weapons/BloodfireArrow.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("BloodfireArrow"); item.shootSpeed = 10f; item.ammo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/BlossomFlux.cs b/Items/Weapons/BlossomFlux.cs index 154725cc7d..98e3769776 100644 --- a/Items/Weapons/BlossomFlux.cs +++ b/Items/Weapons/BlossomFlux.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("LeafArrow"); item.shootSpeed = 10f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().postMoonLordRarity = 17; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/BlushieStaff.cs b/Items/Weapons/BlushieStaff.cs index 578ae56cd1..17e36ad2dd 100644 --- a/Items/Weapons/BlushieStaff.cs +++ b/Items/Weapons/BlushieStaff.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("BlushieStaffProj"); item.mana = 200; item.shootSpeed = 0f; - item.GetGlobalItem(mod).postMoonLordRarity = 19; + item.Calamity().postMoonLordRarity = 19; } public override void AddRecipes() diff --git a/Items/Weapons/BrinyBaron.cs b/Items/Weapons/BrinyBaron.cs index 2faadc5632..e0f0be08c0 100644 --- a/Items/Weapons/BrinyBaron.cs +++ b/Items/Weapons/BrinyBaron.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; item.shootSpeed = 4f; - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().postMoonLordRarity = 17; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/Bumblebirb/GildedProboscis.cs b/Items/Weapons/Bumblebirb/GildedProboscis.cs index b51f72b7b2..248d265b50 100644 --- a/Items/Weapons/Bumblebirb/GildedProboscis.cs +++ b/Items/Weapons/Bumblebirb/GildedProboscis.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Bumblebirb item.rare = 10; item.shoot = mod.ProjectileType("GildedProboscis"); item.shootSpeed = 13f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Bumblebirb/GoldenEagle.cs b/Items/Weapons/Bumblebirb/GoldenEagle.cs index 35395959b8..d382adba64 100644 --- a/Items/Weapons/Bumblebirb/GoldenEagle.cs +++ b/Items/Weapons/Bumblebirb/GoldenEagle.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Bumblebirb item.shoot = 10; item.shootSpeed = 20f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Bumblebirb/RougeSlash.cs b/Items/Weapons/Bumblebirb/RougeSlash.cs index 41b3d44a11..413f2449be 100644 --- a/Items/Weapons/Bumblebirb/RougeSlash.cs +++ b/Items/Weapons/Bumblebirb/RougeSlash.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Bumblebirb item.autoReuse = true; item.shoot = mod.ProjectileType("RougeSlashLarge"); item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ClaretCannon.cs b/Items/Weapons/ClaretCannon.cs index 7626bcb653..57bf6fe8fd 100644 --- a/Items/Weapons/ClaretCannon.cs +++ b/Items/Weapons/ClaretCannon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 24f; item.shoot = mod.ProjectileType("BloodfireBullet"); item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/CleansingBlaze.cs b/Items/Weapons/CleansingBlaze.cs index bc2f8af1e6..1ad7c85b69 100644 --- a/Items/Weapons/CleansingBlaze.cs +++ b/Items/Weapons/CleansingBlaze.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("EssenceFire"); item.shootSpeed = 14f; item.useAmmo = 23; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Climax.cs b/Items/Weapons/Climax.cs index 36009057ae..d679f5b62a 100644 --- a/Items/Weapons/Climax.cs +++ b/Items/Weapons/Climax.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Climax"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ClockworkBow.cs b/Items/Weapons/ClockworkBow.cs index 0cc82248e8..4c7b6be98e 100644 --- a/Items/Weapons/ClockworkBow.cs +++ b/Items/Weapons/ClockworkBow.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 30f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/CometQuasher.cs b/Items/Weapons/CometQuasher.cs index c28bffb1a8..bd6fca1323 100644 --- a/Items/Weapons/CometQuasher.cs +++ b/Items/Weapons/CometQuasher.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Items.Weapons float num114 = num78; float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } diff --git a/Items/Weapons/Contagion.cs b/Items/Weapons/Contagion.cs index 90d2cbd61c..d06f6fba2d 100644 --- a/Items/Weapons/Contagion.cs +++ b/Items/Weapons/Contagion.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("Contagion"); item.shootSpeed = 20f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/Weapons/CosmicDischarge.cs b/Items/Weapons/CosmicDischarge.cs index 84f1510ec4..be6724f9a6 100644 --- a/Items/Weapons/CosmicDischarge.cs +++ b/Items/Weapons/CosmicDischarge.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shootSpeed = 24f; item.shoot = mod.ProjectileType("CosmicDischarge"); - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().postMoonLordRarity = 17; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/CosmicImmaterializer.cs b/Items/Weapons/CosmicImmaterializer.cs index b88fb7fa4b..7c5531df76 100644 --- a/Items/Weapons/CosmicImmaterializer.cs +++ b/Items/Weapons/CosmicImmaterializer.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("CosmicEnergy"); item.shootSpeed = 10f; item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool CanUseItem(Player player) @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon; player.itemTime = item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Cosmilamp.cs b/Items/Weapons/Cosmilamp.cs index faefaf9078..e87aefd42a 100644 --- a/Items/Weapons/Cosmilamp.cs +++ b/Items/Weapons/Cosmilamp.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("Cosmilamp"); item.shootSpeed = 10f; item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Crabulon/HyphaeRod.cs b/Items/Weapons/Crabulon/HyphaeRod.cs index b299237d17..c908d4bec8 100644 --- a/Items/Weapons/Crabulon/HyphaeRod.cs +++ b/Items/Weapons/Crabulon/HyphaeRod.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Items.Weapons.Crabulon float speedX4 = num78 + (float)Main.rand.Next(-180, 181) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); - Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; + Main.projectile[proj].Calamity().forceMagic = true; } return false; } diff --git a/Items/Weapons/Cryogen/GlacialCrusher.cs b/Items/Weapons/Cryogen/GlacialCrusher.cs index 9202fd1c2d..b0f098a3fc 100644 --- a/Items/Weapons/Cryogen/GlacialCrusher.cs +++ b/Items/Weapons/Cryogen/GlacialCrusher.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Cryogen damage *= 2; knockBack *= 2f; } - else if (target.GetGlobalNPC(mod).gState) + else if (target.Calamity().gState) { damage *= 3; knockBack *= 3f; diff --git a/Items/Weapons/Devastation.cs b/Items/Weapons/Devastation.cs index 9545992ade..2dbbf299dd 100644 --- a/Items/Weapons/Devastation.cs +++ b/Items/Weapons/Devastation.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("GalaxyBlast"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/DevilsDevastation.cs b/Items/Weapons/DevilsDevastation.cs index f8e0d6bcba..08c1fedb96 100644 --- a/Items/Weapons/DevilsDevastation.cs +++ b/Items/Weapons/DevilsDevastation.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("Oathblade"); item.shootSpeed = 28f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/DevourerofGods/DeathhailStaff.cs b/Items/Weapons/DevourerofGods/DeathhailStaff.cs index 5dbd09a08f..69a7732eea 100644 --- a/Items/Weapons/DevourerofGods/DeathhailStaff.cs +++ b/Items/Weapons/DevourerofGods/DeathhailStaff.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.autoReuse = true; item.shoot = mod.ProjectileType("MagicNebulaShot"); item.shootSpeed = 18f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/DevourerofGods/Deathwind.cs b/Items/Weapons/DevourerofGods/Deathwind.cs index 5bd1bde2d7..50e02cb851 100644 --- a/Items/Weapons/DevourerofGods/Deathwind.cs +++ b/Items/Weapons/DevourerofGods/Deathwind.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.shoot = mod.ProjectileType("NebulaShot"); item.shootSpeed = 20f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/DevourerofGods/EradicatorMelee.cs b/Items/Weapons/DevourerofGods/EradicatorMelee.cs index 581ca3485c..dc4b3281d6 100644 --- a/Items/Weapons/DevourerofGods/EradicatorMelee.cs +++ b/Items/Weapons/DevourerofGods/EradicatorMelee.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.rare = 10; item.shoot = mod.ProjectileType("EradicatorMeleeProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/DevourerofGods/Excelsus.cs b/Items/Weapons/DevourerofGods/Excelsus.cs index 871ac8b10a..1a7e2d22f2 100644 --- a/Items/Weapons/DevourerofGods/Excelsus.cs +++ b/Items/Weapons/DevourerofGods/Excelsus.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.rare = 10; item.shoot = mod.ProjectileType("Excelsus"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs index f4c4079ba0..1089d3c3b7 100644 --- a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs +++ b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.shoot = mod.ProjectileType("MechwormHead"); item.shootSpeed = 10f; item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/DevourerofGods/TheObliterator.cs b/Items/Weapons/DevourerofGods/TheObliterator.cs index 2e36fc8514..72c8981fac 100644 --- a/Items/Weapons/DevourerofGods/TheObliterator.cs +++ b/Items/Weapons/DevourerofGods/TheObliterator.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("TheObliterator"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } } } diff --git a/Items/Weapons/DraconicDestruction.cs b/Items/Weapons/DraconicDestruction.cs index 50c2d509f0..40ca2f9ab2 100644 --- a/Items/Weapons/DraconicDestruction.cs +++ b/Items/Weapons/DraconicDestruction.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("DracoBeam"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/Weapons/DraedonsExoblade.cs b/Items/Weapons/DraedonsExoblade.cs index 5a855aa33b..a38ffb8a79 100644 --- a/Items/Weapons/DraedonsExoblade.cs +++ b/Items/Weapons/DraedonsExoblade.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("Exobeam"); item.shootSpeed = 19f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } // Gains 100% of missing health as base damage. diff --git a/Items/Weapons/Drataliornus.cs b/Items/Weapons/Drataliornus.cs index f91a4880bd..2c8f297b6f 100644 --- a/Items/Weapons/Drataliornus.cs +++ b/Items/Weapons/Drataliornus.cs @@ -39,7 +39,7 @@ Right click to fire two devastating barrages of five empowered fireballs. item.useTurn = false; item.useAmmo = AmmoID.Arrow; item.autoReuse = true; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/Earth.cs b/Items/Weapons/Earth.cs index 501daf4cc4..98a81454ae 100644 --- a/Items/Weapons/Earth.cs +++ b/Items/Weapons/Earth.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.height = 104; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Effervescence.cs b/Items/Weapons/Effervescence.cs index 69af5c6079..9e14902d9d 100644 --- a/Items/Weapons/Effervescence.cs +++ b/Items/Weapons/Effervescence.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shootSpeed = 13f; item.shoot = mod.ProjectileType("UberBubble"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ElementalAxe.cs b/Items/Weapons/ElementalAxe.cs index 93eb351dbd..b2825eac32 100644 --- a/Items/Weapons/ElementalAxe.cs +++ b/Items/Weapons/ElementalAxe.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("ElementalAxe"); item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/ElementalBlaster.cs b/Items/Weapons/ElementalBlaster.cs index 74f60f4ad4..9010dd55f9 100644 --- a/Items/Weapons/ElementalBlaster.cs +++ b/Items/Weapons/ElementalBlaster.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("RainbowBlast"); item.shootSpeed = 18f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/ElementalEruption.cs b/Items/Weapons/ElementalEruption.cs index 4ab56317f4..bc7060cb42 100644 --- a/Items/Weapons/ElementalEruption.cs +++ b/Items/Weapons/ElementalEruption.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("TerraFireGreen2"); item.shootSpeed = 10f; item.useAmmo = 23; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ElementalExcalibur.cs b/Items/Weapons/ElementalExcalibur.cs index 61c77a29b9..a24418040d 100644 --- a/Items/Weapons/ElementalExcalibur.cs +++ b/Items/Weapons/ElementalExcalibur.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("ElementalExcaliburBeam"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 20; + item.Calamity().postMoonLordRarity = 20; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/ElementalRay.cs b/Items/Weapons/ElementalRay.cs index 284127de2d..056b4d7ca0 100644 --- a/Items/Weapons/ElementalRay.cs +++ b/Items/Weapons/ElementalRay.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("ElementRay"); item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/ElementalShortsword.cs b/Items/Weapons/ElementalShortsword.cs index 2523c59e50..9d5314c44f 100644 --- a/Items/Weapons/ElementalShortsword.cs +++ b/Items/Weapons/ElementalShortsword.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 14f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ElysianArrow.cs b/Items/Weapons/ElysianArrow.cs index 914df58bf8..8ba8603ded 100644 --- a/Items/Weapons/ElysianArrow.cs +++ b/Items/Weapons/ElysianArrow.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("ElysianArrow"); item.shootSpeed = 10f; item.ammo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/EmpyreanKnives.cs b/Items/Weapons/EmpyreanKnives.cs index e44f981f98..a9ffc51252 100644 --- a/Items/Weapons/EmpyreanKnives.cs +++ b/Items/Weapons/EmpyreanKnives.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("EmpyreanKnives"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/EnergyStaff.cs b/Items/Weapons/EnergyStaff.cs index b13156f073..40eaa8cd1e 100644 --- a/Items/Weapons/EnergyStaff.cs +++ b/Items/Weapons/EnergyStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("ProfanedEnergy"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/EssenceFlayer.cs b/Items/Weapons/EssenceFlayer.cs index b929a44fec..b73ae2c9c7 100644 --- a/Items/Weapons/EssenceFlayer.cs +++ b/Items/Weapons/EssenceFlayer.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("EssenceScythe"); item.shootSpeed = 21f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Fabstaff.cs b/Items/Weapons/Fabstaff.cs index 9b745bf5c8..752055d22b 100644 --- a/Items/Weapons/Fabstaff.cs +++ b/Items/Weapons/Fabstaff.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("FabRay"); item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 18; + item.Calamity().postMoonLordRarity = 18; } public override void AddRecipes() diff --git a/Items/Weapons/FiniteUse/Bazooka.cs b/Items/Weapons/FiniteUse/Bazooka.cs index 4ebe44f49a..e17b78a4e4 100644 --- a/Items/Weapons/FiniteUse/Bazooka.cs +++ b/Items/Weapons/FiniteUse/Bazooka.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse item.useAmmo = mod.ItemType("GrenadeRounds"); if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 2; + item.Calamity().timesUsed = 2; } } @@ -43,14 +43,14 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 2; + item.Calamity().timesUsed = 2; } return true; } public override bool CanUseItem(Player player) { - return item.GetGlobalItem(mod).timesUsed < 2; + return item.Calamity().timesUsed < 2; } public override Vector2? HoldoutOffset() @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (!CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 0; + item.Calamity().timesUsed = 0; } } @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (player.inventory[i].type == item.type) { - player.inventory[i].GetGlobalItem(mod).timesUsed++; + player.inventory[i].Calamity().timesUsed++; } } } diff --git a/Items/Weapons/FiniteUse/ElephantKiller.cs b/Items/Weapons/FiniteUse/ElephantKiller.cs index 15edd3e7ea..3fdacba176 100644 --- a/Items/Weapons/FiniteUse/ElephantKiller.cs +++ b/Items/Weapons/FiniteUse/ElephantKiller.cs @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Weapons.FiniteUse item.shootSpeed = 12f; item.shoot = mod.ProjectileType("MagnumRound"); item.useAmmo = mod.ItemType("MagnumRounds"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 3; + item.Calamity().timesUsed = 3; } } @@ -45,14 +45,14 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 3; + item.Calamity().timesUsed = 3; } return true; } public override bool CanUseItem(Player player) { - return item.GetGlobalItem(mod).timesUsed < 3; + return item.Calamity().timesUsed < 3; } public override Vector2? HoldoutOffset() @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (!CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 0; + item.Calamity().timesUsed = 0; } } @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (player.inventory[i].type == item.type) { - player.inventory[i].GetGlobalItem(mod).timesUsed++; + player.inventory[i].Calamity().timesUsed++; } } } diff --git a/Items/Weapons/FiniteUse/Hydra.cs b/Items/Weapons/FiniteUse/Hydra.cs index 8a22ef27d9..3fe1041a2c 100644 --- a/Items/Weapons/FiniteUse/Hydra.cs +++ b/Items/Weapons/FiniteUse/Hydra.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse item.useAmmo = mod.ItemType("ExplosiveShells"); if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 1; + item.Calamity().timesUsed = 1; } } @@ -43,14 +43,14 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 1; + item.Calamity().timesUsed = 1; } return true; } public override bool CanUseItem(Player player) { - return item.GetGlobalItem(mod).timesUsed < 1; + return item.Calamity().timesUsed < 1; } public override Vector2? HoldoutOffset() @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (!CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 0; + item.Calamity().timesUsed = 0; } } @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (player.inventory[i].type == item.type) { - player.inventory[i].GetGlobalItem(mod).timesUsed++; + player.inventory[i].Calamity().timesUsed++; } } } diff --git a/Items/Weapons/FiniteUse/LightningHawk.cs b/Items/Weapons/FiniteUse/LightningHawk.cs index 59cf9997e0..fc426ee13d 100644 --- a/Items/Weapons/FiniteUse/LightningHawk.cs +++ b/Items/Weapons/FiniteUse/LightningHawk.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse item.useAmmo = mod.ItemType("MagnumRounds"); if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 3; + item.Calamity().timesUsed = 3; } } @@ -44,14 +44,14 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 3; + item.Calamity().timesUsed = 3; } return true; } public override bool CanUseItem(Player player) { - return item.GetGlobalItem(mod).timesUsed < 3; + return item.Calamity().timesUsed < 3; } public override Vector2? HoldoutOffset() @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (!CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 0; + item.Calamity().timesUsed = 0; } } @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (player.inventory[i].type == item.type) { - player.inventory[i].GetGlobalItem(mod).timesUsed++; + player.inventory[i].Calamity().timesUsed++; } } } diff --git a/Items/Weapons/FiniteUse/Magnum.cs b/Items/Weapons/FiniteUse/Magnum.cs index 339a1302b5..d23e3fade1 100644 --- a/Items/Weapons/FiniteUse/Magnum.cs +++ b/Items/Weapons/FiniteUse/Magnum.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse item.useAmmo = mod.ItemType("MagnumRounds"); if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 3; + item.Calamity().timesUsed = 3; } } @@ -44,14 +44,14 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 3; + item.Calamity().timesUsed = 3; } return true; } public override bool CanUseItem(Player player) { - return item.GetGlobalItem(mod).timesUsed < 3; + return item.Calamity().timesUsed < 3; } public override Vector2? HoldoutOffset() @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (!CalamityPlayer.areThereAnyDamnBosses) { - item.GetGlobalItem(mod).timesUsed = 0; + item.Calamity().timesUsed = 0; } } @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.FiniteUse { if (player.inventory[i].type == item.type) { - player.inventory[i].GetGlobalItem(mod).timesUsed++; + player.inventory[i].Calamity().timesUsed++; } } } diff --git a/Items/Weapons/FirestormCannon.cs b/Items/Weapons/FirestormCannon.cs index 34aceee5dd..1231f3592e 100644 --- a/Items/Weapons/FirestormCannon.cs +++ b/Items/Weapons/FirestormCannon.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[flare].penetrate = 1; Main.projectile[flare].timeLeft = 600; - Main.projectile[flare].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[flare].Calamity().forceRanged = true; } return false; } @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[projectile].Calamity().forceRanged = true; Main.projectile[projectile].timeLeft = 200; } return false; diff --git a/Items/Weapons/FlameburstShortsword.cs b/Items/Weapons/FlameburstShortsword.cs index 05f8cefa14..68290b6e6d 100644 --- a/Items/Weapons/FlameburstShortsword.cs +++ b/Items/Weapons/FlameburstShortsword.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons if (target.life <= (target.lifeMax * 0.5f)) { int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; } } } diff --git a/Items/Weapons/Floodtide.cs b/Items/Weapons/Floodtide.cs index 808dfdb76d..f086147567 100644 --- a/Items/Weapons/Floodtide.cs +++ b/Items/Weapons/Floodtide.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/FourSeasonsGalaxia.cs b/Items/Weapons/FourSeasonsGalaxia.cs index 14c73d202a..f4b971d5d5 100644 --- a/Items/Weapons/FourSeasonsGalaxia.cs +++ b/Items/Weapons/FourSeasonsGalaxia.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("Galaxia"); item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void AddRecipes() diff --git a/Items/Weapons/GalacticaBlade.cs b/Items/Weapons/GalacticaBlade.cs index bab853dbb7..db38230e9f 100644 --- a/Items/Weapons/GalacticaBlade.cs +++ b/Items/Weapons/GalacticaBlade.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("GalacticaComet"); item.shootSpeed = 23f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/GalaxySmasherMelee.cs b/Items/Weapons/GalaxySmasherMelee.cs index 5d681e6809..f109e26c91 100644 --- a/Items/Weapons/GalaxySmasherMelee.cs +++ b/Items/Weapons/GalaxySmasherMelee.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.UseSound = SoundID.Item1; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; item.value = Item.buyPrice(1, 80, 0, 0); item.shoot = mod.ProjectileType("GalaxySmasherHammer"); @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; return false; } diff --git a/Items/Weapons/GammaFusillade.cs b/Items/Weapons/GammaFusillade.cs index d46bcaf24f..6ac9ce5644 100644 --- a/Items/Weapons/GammaFusillade.cs +++ b/Items/Weapons/GammaFusillade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("GammaLaser"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/Genisis.cs b/Items/Weapons/Genisis.cs index 959a22c9ac..c4c1dabe86 100644 --- a/Items/Weapons/Genisis.cs +++ b/Items/Weapons/Genisis.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shootSpeed = 6f; item.shoot = mod.ProjectileType("BigBeamofDeath"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Grax.cs b/Items/Weapons/Grax.cs index 0358185a60..0c0e0fd911 100644 --- a/Items/Weapons/Grax.cs +++ b/Items/Weapons/Grax.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.tileBoost += 5; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/GreatswordofBlah.cs b/Items/Weapons/GreatswordofBlah.cs index 2de6aa012d..08fc11d53e 100644 --- a/Items/Weapons/GreatswordofBlah.cs +++ b/Items/Weapons/GreatswordofBlah.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("JudgementBlah"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void AddRecipes() diff --git a/Items/Weapons/GreatswordofJudgement.cs b/Items/Weapons/GreatswordofJudgement.cs index 1709ae0f0d..b9cc06b301 100644 --- a/Items/Weapons/GreatswordofJudgement.cs +++ b/Items/Weapons/GreatswordofJudgement.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("Judgement"); item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/HalleysInferno.cs b/Items/Weapons/HalleysInferno.cs index 5348a74fc6..c9a556cb04 100644 --- a/Items/Weapons/HalleysInferno.cs +++ b/Items/Weapons/HalleysInferno.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.UseSound = SoundID.Item34; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; item.autoReuse = true; item.shoot = mod.ProjectileType("HalleysComet"); item.shootSpeed = 14.6f; diff --git a/Items/Weapons/HeavenlyGale.cs b/Items/Weapons/HeavenlyGale.cs index 7ac62521e4..25e4163c42 100644 --- a/Items/Weapons/HeavenlyGale.cs +++ b/Items/Weapons/HeavenlyGale.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 1; item.shootSpeed = 17f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/HeliumFlash.cs b/Items/Weapons/HeliumFlash.cs index 684fd8d988..f285d414b1 100644 --- a/Items/Weapons/HeliumFlash.cs +++ b/Items/Weapons/HeliumFlash.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons item.UseSound = SoundID.Item73; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; item.value = Item.buyPrice(1, 80, 0, 0); item.shoot = mod.ProjectileType("VolatileStarcore"); diff --git a/Items/Weapons/InfernaCutter.cs b/Items/Weapons/InfernaCutter.cs index 520e0593ad..ad8289702b 100644 --- a/Items/Weapons/InfernaCutter.cs +++ b/Items/Weapons/InfernaCutter.cs @@ -123,7 +123,7 @@ namespace CalamityMod.Items.Weapons if (crit) { int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; } target.AddBuff(BuffID.OnFire, 300); target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); diff --git a/Items/Weapons/Interfacer.cs b/Items/Weapons/Interfacer.cs index 6493aca9bc..9a6bb89e34 100644 --- a/Items/Weapons/Interfacer.cs +++ b/Items/Weapons/Interfacer.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 13f; item.shoot = 10; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Judgement.cs b/Items/Weapons/Judgement.cs index 2b8899306b..a52db6bad7 100644 --- a/Items/Weapons/Judgement.cs +++ b/Items/Weapons/Judgement.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("WhiteFlame"); item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/Weapons/Lacerator.cs b/Items/Weapons/Lacerator.cs index 0b729dfe9b..66f4875d1e 100644 --- a/Items/Weapons/Lacerator.cs +++ b/Items/Weapons/Lacerator.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("LaceratorProjectile"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/Leviathan/LureofEnthrallment.cs b/Items/Weapons/Leviathan/LureofEnthrallment.cs index 23491f5f57..cda355357f 100644 --- a/Items/Weapons/Leviathan/LureofEnthrallment.cs +++ b/Items/Weapons/Leviathan/LureofEnthrallment.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Leviathan public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.elementalHeart) { return false; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Leviathan public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.sirenWaifu = true; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Weapons/LifefruitScythe.cs b/Items/Weapons/LifefruitScythe.cs index d7ecf7b1d6..e0750845a6 100644 --- a/Items/Weapons/LifefruitScythe.cs +++ b/Items/Weapons/LifefruitScythe.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("LifeScythe"); item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/LunicEye.cs b/Items/Weapons/LunicEye.cs index 3f05defe65..ed00ba6681 100644 --- a/Items/Weapons/LunicEye.cs +++ b/Items/Weapons/LunicEye.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons formula += player.rangedDamage - 1f; formula += player.magicDamage - 1f; formula += player.minionDamage - 1f; - formula += player.GetCalamityPlayer().throwingDamage - 1f; + formula += player.Calamity().throwingDamage - 1f; add += formula; } diff --git a/Items/Weapons/MagneticMeltdown.cs b/Items/Weapons/MagneticMeltdown.cs index 2225c4e090..260391c550 100644 --- a/Items/Weapons/MagneticMeltdown.cs +++ b/Items/Weapons/MagneticMeltdown.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("MagneticOrb"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/MantisClaws.cs b/Items/Weapons/MantisClaws.cs index d2e07e22ed..c87123ae89 100644 --- a/Items/Weapons/MantisClaws.cs +++ b/Items/Weapons/MantisClaws.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), 0, knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; } } } diff --git a/Items/Weapons/MarkedMagnum.cs b/Items/Weapons/MarkedMagnum.cs index dcca601142..e483af17b4 100644 --- a/Items/Weapons/MarkedMagnum.cs +++ b/Items/Weapons/MarkedMagnum.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons formula += player.rangedDamage - 1f; formula += player.magicDamage - 1f; formula += player.minionDamage - 1f; - formula += player.GetCalamityPlayer().throwingDamage - 1f; + formula += player.Calamity().throwingDamage - 1f; add += formula; } diff --git a/Items/Weapons/Megafleet.cs b/Items/Weapons/Megafleet.cs index 05ab9e4600..618d750a6e 100644 --- a/Items/Weapons/Megafleet.cs +++ b/Items/Weapons/Megafleet.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 18f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Minigun.cs b/Items/Weapons/Minigun.cs index 779ec2cb4c..8e934405ce 100644 --- a/Items/Weapons/Minigun.cs +++ b/Items/Weapons/Minigun.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 22f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/MirrorBlade.cs b/Items/Weapons/MirrorBlade.cs index b59aa7d97e..565ce612d0 100644 --- a/Items/Weapons/MirrorBlade.cs +++ b/Items/Weapons/MirrorBlade.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shootSpeed = 9f; item.shoot = mod.ProjectileType("MirrorBlast"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Mistlestorm.cs b/Items/Weapons/Mistlestorm.cs index 8d7b18bc9e..4e3e2a7148 100644 --- a/Items/Weapons/Mistlestorm.cs +++ b/Items/Weapons/Mistlestorm.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = 336; item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/MolecularManipulator.cs b/Items/Weapons/MolecularManipulator.cs index cc829baa92..9eb14db0df 100644 --- a/Items/Weapons/MolecularManipulator.cs +++ b/Items/Weapons/MolecularManipulator.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shootSpeed = 25f; item.shoot = mod.ProjectileType("NullShot2"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Monsoon.cs b/Items/Weapons/Monsoon.cs index 25b3bce6b1..b5d4800205 100644 --- a/Items/Weapons/Monsoon.cs +++ b/Items/Weapons/Monsoon.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons type = mod.ProjectileType("TyphoonArrow"); } int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num121].Calamity().forceRanged = true; Main.projectile[num121].noDropItem = true; } else diff --git a/Items/Weapons/Mourningstar.cs b/Items/Weapons/Mourningstar.cs index 3b40d54400..65ef721910 100644 --- a/Items/Weapons/Mourningstar.cs +++ b/Items/Weapons/Mourningstar.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shootSpeed = 24f; item.shoot = mod.ProjectileType("Mourningstar"); - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void AddRecipes() diff --git a/Items/Weapons/Murasama.cs b/Items/Weapons/Murasama.cs index aa469d769f..d0a67736e0 100644 --- a/Items/Weapons/Murasama.cs +++ b/Items/Weapons/Murasama.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("Murasama"); item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/NanoblackReaperMelee.cs b/Items/Weapons/NanoblackReaperMelee.cs index b6ef465c9a..f77d8a737b 100644 --- a/Items/Weapons/NanoblackReaperMelee.cs +++ b/Items/Weapons/NanoblackReaperMelee.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons item.UseSound = SoundID.Item18; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; item.value = Item.buyPrice(5, 0, 0, 0); item.shoot = mod.ProjectileType("NanoblackMain"); @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; return false; } diff --git a/Items/Weapons/NeptunesBounty.cs b/Items/Weapons/NeptunesBounty.cs index 0103ccf591..c013b8953b 100644 --- a/Items/Weapons/NeptunesBounty.cs +++ b/Items/Weapons/NeptunesBounty.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("NeptuneOrb"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/NettlelineGreatbow.cs b/Items/Weapons/NettlelineGreatbow.cs index d75dd78f82..31bdef922b 100644 --- a/Items/Weapons/NettlelineGreatbow.cs +++ b/Items/Weapons/NettlelineGreatbow.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 16f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/NuclearFury.cs b/Items/Weapons/NuclearFury.cs index 2e90564604..aebc34faf0 100644 --- a/Items/Weapons/NuclearFury.cs +++ b/Items/Weapons/NuclearFury.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("NuclearFuryProjectile"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/OmegaBiomeBlade.cs b/Items/Weapons/OmegaBiomeBlade.cs index e1b28966fe..9b45c610dd 100644 --- a/Items/Weapons/OmegaBiomeBlade.cs +++ b/Items/Weapons/OmegaBiomeBlade.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("OmegaBiomeOrb"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/OnyxChainBlaster.cs b/Items/Weapons/OnyxChainBlaster.cs index 384449f82f..ba4200a7ef 100644 --- a/Items/Weapons/OnyxChainBlaster.cs +++ b/Items/Weapons/OnyxChainBlaster.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 24f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Onyxia.cs b/Items/Weapons/Onyxia.cs index cf826a7d96..58a51c3ff3 100644 --- a/Items/Weapons/Onyxia.cs +++ b/Items/Weapons/Onyxia.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 28f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Phangasm.cs b/Items/Weapons/Phangasm.cs index f09ad52621..a1ba3043c3 100644 --- a/Items/Weapons/Phangasm.cs +++ b/Items/Weapons/Phangasm.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("Phangasm"); item.shootSpeed = 20f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/PhantasmalFury.cs b/Items/Weapons/PhantasmalFury.cs index 7a046c00ce..4fa31c9168 100644 --- a/Items/Weapons/PhantasmalFury.cs +++ b/Items/Weapons/PhantasmalFury.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("PhantasmalFury"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/PhoenixBlade.cs b/Items/Weapons/PhoenixBlade.cs index 6f572ebbf4..f7aff53664 100644 --- a/Items/Weapons/PhoenixBlade.cs +++ b/Items/Weapons/PhoenixBlade.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons if (target.life <= 0) { int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), damage, knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; float randomSpeedX = (float)Main.rand.Next(5); float randomSpeedY = (float)Main.rand.Next(3, 7); Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("PhoenixHeal"), item.damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Photoviscerator.cs b/Items/Weapons/Photoviscerator.cs index 9927ccb0a1..61fb34c704 100644 --- a/Items/Weapons/Photoviscerator.cs +++ b/Items/Weapons/Photoviscerator.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("ExoFire"); item.shootSpeed = 6f; item.useAmmo = 23; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/PlagueKeeper.cs b/Items/Weapons/PlagueKeeper.cs index 85227841b0..8ab4540e04 100644 --- a/Items/Weapons/PlagueKeeper.cs +++ b/Items/Weapons/PlagueKeeper.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("PlagueBeeDust"); item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, player.beeType(), player.beeDamage(item.damage / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); Main.projectile[bee].penetrate = 1; - Main.projectile[bee].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[bee].Calamity().forceMelee = true; } } } diff --git a/Items/Weapons/PlanetaryAnnihilation.cs b/Items/Weapons/PlanetaryAnnihilation.cs index 47bd8448b3..904eb03441 100644 --- a/Items/Weapons/PlanetaryAnnihilation.cs +++ b/Items/Weapons/PlanetaryAnnihilation.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("TerraBallBow"); item.shootSpeed = 12f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/PlasmaRifle.cs b/Items/Weapons/PlasmaRifle.cs index 55dffea277..55f1abe302 100644 --- a/Items/Weapons/PlasmaRifle.cs +++ b/Items/Weapons/PlasmaRifle.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shootSpeed = 12f; item.shoot = mod.ProjectileType("PlasmaShot"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Polterghast/BansheeHook.cs b/Items/Weapons/Polterghast/BansheeHook.cs index 5122870b5f..89dacf360b 100644 --- a/Items/Weapons/Polterghast/BansheeHook.cs +++ b/Items/Weapons/Polterghast/BansheeHook.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Polterghast item.rare = 10; item.shoot = mod.ProjectileType("BansheeHook"); item.shootSpeed = 42f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Polterghast/DaemonsFlame.cs b/Items/Weapons/Polterghast/DaemonsFlame.cs index 20eac6062a..58ec52d98e 100644 --- a/Items/Weapons/Polterghast/DaemonsFlame.cs +++ b/Items/Weapons/Polterghast/DaemonsFlame.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Polterghast item.shoot = mod.ProjectileType("DaemonsFlame"); item.shootSpeed = 20f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Polterghast/EtherealSubjugator.cs b/Items/Weapons/Polterghast/EtherealSubjugator.cs index 0a8c1793c8..e7768eef19 100644 --- a/Items/Weapons/Polterghast/EtherealSubjugator.cs +++ b/Items/Weapons/Polterghast/EtherealSubjugator.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Polterghast item.shoot = mod.ProjectileType("PhantomGuy"); item.shootSpeed = 10f; item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Polterghast/FatesReveal.cs b/Items/Weapons/Polterghast/FatesReveal.cs index 642d4c26fb..2afcf34918 100644 --- a/Items/Weapons/Polterghast/FatesReveal.cs +++ b/Items/Weapons/Polterghast/FatesReveal.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Polterghast item.autoReuse = true; item.shoot = mod.ProjectileType("FatesReveal"); item.shootSpeed = 1f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Polterghast/GhastlyVisage.cs b/Items/Weapons/Polterghast/GhastlyVisage.cs index 631abe7657..14c4dca6d0 100644 --- a/Items/Weapons/Polterghast/GhastlyVisage.cs +++ b/Items/Weapons/Polterghast/GhastlyVisage.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Polterghast item.rare = 10; item.shootSpeed = 9f; item.shoot = mod.ProjectileType("GhastlyVisage"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Polterghast/TerrorBlade.cs b/Items/Weapons/Polterghast/TerrorBlade.cs index a6139f6940..141309a273 100644 --- a/Items/Weapons/Polterghast/TerrorBlade.cs +++ b/Items/Weapons/Polterghast/TerrorBlade.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Polterghast item.rare = 10; item.shoot = mod.ProjectileType("TerrorBeam"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/PrimordialAncient.cs b/Items/Weapons/PrimordialAncient.cs index bd6d092c1f..4986e2a1cd 100644 --- a/Items/Weapons/PrimordialAncient.cs +++ b/Items/Weapons/PrimordialAncient.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Ancient"); item.shootSpeed = 8f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void AddRecipes() diff --git a/Items/Weapons/Providence/BlissfulBombardier.cs b/Items/Weapons/Providence/BlissfulBombardier.cs index 883beb0f12..55ec3f442b 100644 --- a/Items/Weapons/Providence/BlissfulBombardier.cs +++ b/Items/Weapons/Providence/BlissfulBombardier.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Providence item.shootSpeed = 24f; item.shoot = mod.ProjectileType("Nuke"); item.useAmmo = 771; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Providence/HolyCollider.cs b/Items/Weapons/Providence/HolyCollider.cs index 655a802603..158769b4c7 100644 --- a/Items/Weapons/Providence/HolyCollider.cs +++ b/Items/Weapons/Providence/HolyCollider.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Providence item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Providence/PurgeGuzzler.cs b/Items/Weapons/Providence/PurgeGuzzler.cs index 0d2bad6d68..077b941cb2 100644 --- a/Items/Weapons/Providence/PurgeGuzzler.cs +++ b/Items/Weapons/Providence/PurgeGuzzler.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Providence item.autoReuse = true; item.shoot = mod.ProjectileType("HolyLaser"); item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Providence/SolarFlare.cs b/Items/Weapons/Providence/SolarFlare.cs index 1fb4fc1f7f..cf6d3af2bb 100644 --- a/Items/Weapons/Providence/SolarFlare.cs +++ b/Items/Weapons/Providence/SolarFlare.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Providence item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("SolarFlareYoyo"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } } } diff --git a/Items/Weapons/Providence/TelluricGlare.cs b/Items/Weapons/Providence/TelluricGlare.cs index 984976a1d9..65bee202d4 100644 --- a/Items/Weapons/Providence/TelluricGlare.cs +++ b/Items/Weapons/Providence/TelluricGlare.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Providence item.shoot = mod.ProjectileType("TelluricGlare"); item.shootSpeed = 12f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/RareVariants/Arbalest.cs b/Items/Weapons/RareVariants/Arbalest.cs index e3324862ed..cdb24cb279 100644 --- a/Items/Weapons/RareVariants/Arbalest.cs +++ b/Items/Weapons/RareVariants/Arbalest.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shoot = 10; item.shootSpeed = 10f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/RareVariants/Carnage.cs b/Items/Weapons/RareVariants/Carnage.cs index f490677fea..fe0c955716 100644 --- a/Items/Weapons/RareVariants/Carnage.cs +++ b/Items/Weapons/RareVariants/Carnage.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.height = 60; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/RareVariants/ClothiersWrath.cs b/Items/Weapons/RareVariants/ClothiersWrath.cs index d04940f2b3..066aeb61df 100644 --- a/Items/Weapons/RareVariants/ClothiersWrath.cs +++ b/Items/Weapons/RareVariants/ClothiersWrath.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.autoReuse = true; item.shoot = ProjectileID.ClothiersCurse; item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.RareVariants { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); int proj = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; + Main.projectile[proj].Calamity().forceMagic = true; } return false; } diff --git a/Items/Weapons/RareVariants/Cryophobia.cs b/Items/Weapons/RareVariants/Cryophobia.cs index 0b4b0426ca..9c9ea5bd0e 100644 --- a/Items/Weapons/RareVariants/Cryophobia.cs +++ b/Items/Weapons/RareVariants/Cryophobia.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.autoReuse = true; item.shootSpeed = 12f; item.shoot = mod.ProjectileType("CryoBlast"); - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/EvilSmasher.cs b/Items/Weapons/RareVariants/EvilSmasher.cs index fecd91dca7..382138074c 100644 --- a/Items/Weapons/RareVariants/EvilSmasher.cs +++ b/Items/Weapons/RareVariants/EvilSmasher.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.height = 62; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/RareVariants/EyeofMagnus.cs b/Items/Weapons/RareVariants/EyeofMagnus.cs index 360ad97962..ea45d6ecb6 100644 --- a/Items/Weapons/RareVariants/EyeofMagnus.cs +++ b/Items/Weapons/RareVariants/EyeofMagnus.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.value = Item.buyPrice(0, 36, 0, 0); item.shoot = mod.ProjectileType("MagnusBeam"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/GrandDad.cs b/Items/Weapons/RareVariants/GrandDad.cs index 7f3ef2d1c1..b02299985e 100644 --- a/Items/Weapons/RareVariants/GrandDad.cs +++ b/Items/Weapons/RareVariants/GrandDad.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.height = 124; item.value = Item.buyPrice(1, 0, 0, 0); item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/RareVariants/Hellborn.cs b/Items/Weapons/RareVariants/Hellborn.cs index 71c4c7606d..9160cc4130 100644 --- a/Items/Weapons/RareVariants/Hellborn.cs +++ b/Items/Weapons/RareVariants/Hellborn.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shoot = 10; item.shootSpeed = 14f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/RareVariants/Infinity.cs b/Items/Weapons/RareVariants/Infinity.cs index d6b47715c5..8221587180 100644 --- a/Items/Weapons/RareVariants/Infinity.cs +++ b/Items/Weapons/RareVariants/Infinity.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/LeadWizard.cs b/Items/Weapons/RareVariants/LeadWizard.cs index 3f73fb7d74..fdccfb3dc4 100644 --- a/Items/Weapons/RareVariants/LeadWizard.cs +++ b/Items/Weapons/RareVariants/LeadWizard.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shoot = 10; item.shootSpeed = 20f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/Norfleet.cs b/Items/Weapons/RareVariants/Norfleet.cs index f6e750e1f2..05570a30f8 100644 --- a/Items/Weapons/RareVariants/Norfleet.cs +++ b/Items/Weapons/RareVariants/Norfleet.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.useTurn = false; item.useAmmo = 75; item.autoReuse = true; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/PearlGod.cs b/Items/Weapons/RareVariants/PearlGod.cs index 2a7a37b520..6a56ec4e93 100644 --- a/Items/Weapons/RareVariants/PearlGod.cs +++ b/Items/Weapons/RareVariants/PearlGod.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shootSpeed = 24f; item.shoot = mod.ProjectileType("ShockblastRound"); item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/Skullmasher.cs b/Items/Weapons/RareVariants/Skullmasher.cs index 6f3c62d936..c3d1009205 100644 --- a/Items/Weapons/RareVariants/Skullmasher.cs +++ b/Items/Weapons/RareVariants/Skullmasher.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/Swordsplosion.cs b/Items/Weapons/RareVariants/Swordsplosion.cs index 1b320641bd..40dea0f554 100644 --- a/Items/Weapons/RareVariants/Swordsplosion.cs +++ b/Items/Weapons/RareVariants/Swordsplosion.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.rare = 10; item.shoot = mod.ProjectileType("EonBeam"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/RareVariants/ThornBlossom.cs b/Items/Weapons/RareVariants/ThornBlossom.cs index 75e6bf4e2f..1878d853f3 100644 --- a/Items/Weapons/RareVariants/ThornBlossom.cs +++ b/Items/Weapons/RareVariants/ThornBlossom.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.autoReuse = true; item.shoot = mod.ProjectileType("BeamingBolt"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/RareVariants/Thunderstorm.cs b/Items/Weapons/RareVariants/Thunderstorm.cs index aefb57efcf..a10e252d32 100644 --- a/Items/Weapons/RareVariants/Thunderstorm.cs +++ b/Items/Weapons/RareVariants/Thunderstorm.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.autoReuse = true; item.shootSpeed = 6f; item.shoot = mod.ProjectileType("ThunderstormShot"); - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/TrueConferenceCall.cs b/Items/Weapons/RareVariants/TrueConferenceCall.cs index 5e9cf17a59..8d3fced23f 100644 --- a/Items/Weapons/RareVariants/TrueConferenceCall.cs +++ b/Items/Weapons/RareVariants/TrueConferenceCall.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shootSpeed = 18f; item.shoot = 10; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/RareVariants/VoidVortex.cs b/Items/Weapons/RareVariants/VoidVortex.cs index de13ef3818..f97de23c94 100644 --- a/Items/Weapons/RareVariants/VoidVortex.cs +++ b/Items/Weapons/RareVariants/VoidVortex.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.RareVariants item.autoReuse = true; item.shoot = mod.ProjectileType("Climax2"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 22; + item.Calamity().postMoonLordRarity = 22; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/RedSun.cs b/Items/Weapons/RedSun.cs index 2c6ad0b591..314d5fa11f 100644 --- a/Items/Weapons/RedSun.cs +++ b/Items/Weapons/RedSun.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("SolarFlare"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/Weapons/RoyalKnivesMelee.cs b/Items/Weapons/RoyalKnivesMelee.cs index 4e74355e42..ace6648354 100644 --- a/Items/Weapons/RoyalKnivesMelee.cs +++ b/Items/Weapons/RoyalKnivesMelee.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("RoyalKnifeMelee"); item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/SDFMG.cs b/Items/Weapons/SDFMG.cs index f163496208..c4cb7e3ba1 100644 --- a/Items/Weapons/SDFMG.cs +++ b/Items/Weapons/SDFMG.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 16f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/SHPC.cs b/Items/Weapons/SHPC.cs index 0c46dee341..1b08817151 100644 --- a/Items/Weapons/SHPC.cs +++ b/Items/Weapons/SHPC.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("SHPB"); item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().postMoonLordRarity = 17; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/SanguineFlare.cs b/Items/Weapons/SanguineFlare.cs index df290c3e77..d4378b7f51 100644 --- a/Items/Weapons/SanguineFlare.cs +++ b/Items/Weapons/SanguineFlare.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("SanguineFlare"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/ScourgeoftheCosmos.cs b/Items/Weapons/ScourgeoftheCosmos.cs index 290cf90dab..0d385f1156 100644 --- a/Items/Weapons/ScourgeoftheCosmos.cs +++ b/Items/Weapons/ScourgeoftheCosmos.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void AddRecipes() diff --git a/Items/Weapons/Seadragon.cs b/Items/Weapons/Seadragon.cs index 808279b548..3a3334d937 100644 --- a/Items/Weapons/Seadragon.cs +++ b/Items/Weapons/Seadragon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 16f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/ShadowboltStaff.cs b/Items/Weapons/ShadowboltStaff.cs index e796da55c3..1e7674d057 100644 --- a/Items/Weapons/ShadowboltStaff.cs +++ b/Items/Weapons/ShadowboltStaff.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Shadowbolt"); item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/Shredder.cs b/Items/Weapons/Shredder.cs index d9d8395560..34c8eefcca 100644 --- a/Items/Weapons/Shredder.cs +++ b/Items/Weapons/Shredder.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/SlimeGod/Goobow.cs b/Items/Weapons/SlimeGod/Goobow.cs index 5b748fe364..ae5e9f5a1d 100644 --- a/Items/Weapons/SlimeGod/Goobow.cs +++ b/Items/Weapons/SlimeGod/Goobow.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.SlimeGod value9 -= vector7; } int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 0.6f, speedY * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[projectile].Calamity().forceRanged = true; } return true; } diff --git a/Items/Weapons/SolsticeClaymore.cs b/Items/Weapons/SolsticeClaymore.cs index 58a72e8a62..4cf90d4b6e 100644 --- a/Items/Weapons/SolsticeClaymore.cs +++ b/Items/Weapons/SolsticeClaymore.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("SolsticeBeam"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/SomaPrime.cs b/Items/Weapons/SomaPrime.cs index 662e446278..ec88bb56f8 100644 --- a/Items/Weapons/SomaPrime.cs +++ b/Items/Weapons/SomaPrime.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("SlashRound"); item.shootSpeed = 30f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/SoulPiercer.cs b/Items/Weapons/SoulPiercer.cs index a9164f21fd..e30df3d9d3 100644 --- a/Items/Weapons/SoulPiercer.cs +++ b/Items/Weapons/SoulPiercer.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("SoulPiercer"); item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/SpatialLance.cs b/Items/Weapons/SpatialLance.cs index 5c4ad9f52a..d08749ef05 100644 --- a/Items/Weapons/SpatialLance.cs +++ b/Items/Weapons/SpatialLance.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("SpatialLanceProjectile"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs index b3bd203eb8..1978460f05 100644 --- a/Items/Weapons/SpectralstormCannon.cs +++ b/Items/Weapons/SpectralstormCannon.cs @@ -52,10 +52,10 @@ namespace CalamityMod.Items.Weapons float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[projectile].timeLeft = 200; - Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[projectile].Calamity().forceRanged = true; } int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[proj].Calamity().forceRanged = true; return false; } diff --git a/Items/Weapons/SpectreRifle.cs b/Items/Weapons/SpectreRifle.cs index fb911eb947..f97d0643e1 100644 --- a/Items/Weapons/SpectreRifle.cs +++ b/Items/Weapons/SpectreRifle.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[proj].Calamity().forceRanged = true; return false; } diff --git a/Items/Weapons/SporeKnife.cs b/Items/Weapons/SporeKnife.cs index f76dc5a52c..2cd3c977e0 100644 --- a/Items/Weapons/SporeKnife.cs +++ b/Items/Weapons/SporeKnife.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons if (target.life <= 0) { int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } } diff --git a/Items/Weapons/Spyker.cs b/Items/Weapons/Spyker.cs index 0078f6f488..c747049ef7 100644 --- a/Items/Weapons/Spyker.cs +++ b/Items/Weapons/Spyker.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 9f; item.shoot = mod.ProjectileType("Spyker"); item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/StarCannonEX.cs b/Items/Weapons/StarCannonEX.cs index 3f6b8690e1..6d973f91d7 100644 --- a/Items/Weapons/StarCannonEX.cs +++ b/Items/Weapons/StarCannonEX.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons case 2: type = mod.ProjectileType("AstralStar"); break; } int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[star].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[star].Calamity().forceRanged = true; } return false; } diff --git a/Items/Weapons/Starfleet.cs b/Items/Weapons/Starfleet.cs index 517f07add6..d317003c7f 100644 --- a/Items/Weapons/Starfleet.cs +++ b/Items/Weapons/Starfleet.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("PlasmaBlast"); item.shootSpeed = 12f; item.useAmmo = 75; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/StarfleetMK2.cs b/Items/Weapons/StarfleetMK2.cs index 6c307f4f87..e79fd70259 100644 --- a/Items/Weapons/StarfleetMK2.cs +++ b/Items/Weapons/StarfleetMK2.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons item.useTurn = false; item.useAmmo = 75; item.autoReuse = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/StellarContemptMelee.cs b/Items/Weapons/StellarContemptMelee.cs index 8526d4c4d2..60cfc83ab6 100644 --- a/Items/Weapons/StellarContemptMelee.cs +++ b/Items/Weapons/StellarContemptMelee.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.UseSound = SoundID.Item1; item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; item.value = Item.buyPrice(1, 20, 0, 0); item.shoot = mod.ProjectileType("StellarContemptHammer"); @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; return false; } diff --git a/Items/Weapons/StellarStriker.cs b/Items/Weapons/StellarStriker.cs index 8b2a36b071..c545aeb721 100644 --- a/Items/Weapons/StellarStriker.cs +++ b/Items/Weapons/StellarStriker.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons float num114 = num78; float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, 645, (int)((double)((float)item.damage * player.meleeDamage) * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } diff --git a/Items/Weapons/StormDragoon.cs b/Items/Weapons/StormDragoon.cs index 814630a9c0..caf56f2c54 100644 --- a/Items/Weapons/StormDragoon.cs +++ b/Items/Weapons/StormDragoon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 18f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/StreamGouge.cs b/Items/Weapons/StreamGouge.cs index 421def1a2d..9a62eccffd 100644 --- a/Items/Weapons/StreamGouge.cs +++ b/Items/Weapons/StreamGouge.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("StreamGouge"); item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/SubsumingVortex.cs b/Items/Weapons/SubsumingVortex.cs index b0f4f1bb2a..b030e787ba 100644 --- a/Items/Weapons/SubsumingVortex.cs +++ b/Items/Weapons/SubsumingVortex.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Vortex"); item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Svantechnical.cs b/Items/Weapons/Svantechnical.cs index 54827d4eaa..61a65fc8c7 100644 --- a/Items/Weapons/Svantechnical.cs +++ b/Items/Weapons/Svantechnical.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 12f; item.shoot = 10; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/T1000.cs b/Items/Weapons/T1000.cs index c3f04efff3..e6b3690088 100644 --- a/Items/Weapons/T1000.cs +++ b/Items/Weapons/T1000.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("T1000"); item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void AddRecipes() diff --git a/Items/Weapons/TheEnforcer.cs b/Items/Weapons/TheEnforcer.cs index dcddcf44ab..074c68138c 100644 --- a/Items/Weapons/TheEnforcer.cs +++ b/Items/Weapons/TheEnforcer.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("EssenceFireball"); item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/TheMutilator.cs b/Items/Weapons/TheMutilator.cs index b6b24c4472..0a6a2efea4 100644 --- a/Items/Weapons/TheMutilator.cs +++ b/Items/Weapons/TheMutilator.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/TheStorm.cs b/Items/Weapons/TheStorm.cs index 56db3efad9..cac863e28c 100644 --- a/Items/Weapons/TheStorm.cs +++ b/Items/Weapons/TheStorm.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("Bolt"); item.shootSpeed = 28f; item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/TheSwarmer.cs b/Items/Weapons/TheSwarmer.cs index 9f3ecda384..5503597479 100644 --- a/Items/Weapons/TheSwarmer.cs +++ b/Items/Weapons/TheSwarmer.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons float SpeedY = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; int wasps = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, 0f, player.whoAmI, 0f, 0f); Main.projectile[wasps].penetrate = 1; - Main.projectile[wasps].GetGlobalProjectile(mod).forceMagic = true; + Main.projectile[wasps].Calamity().forceMagic = true; } for (int i = 0; i <= 3; i++) { @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons float SpeedY2 = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; int bees = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, player.beeType(), player.beeDamage(item.damage), player.beeKB(0f), player.whoAmI, 0f, 0f); Main.projectile[bees].penetrate = 1; - Main.projectile[bees].GetGlobalProjectile(mod).forceMagic = true; + Main.projectile[bees].Calamity().forceMagic = true; } return false; } diff --git a/Items/Weapons/TheWand.cs b/Items/Weapons/TheWand.cs index 8bdddf3532..694ccecb94 100644 --- a/Items/Weapons/TheWand.cs +++ b/Items/Weapons/TheWand.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("SparkInfernal"); item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override void AddRecipes() diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs index 207d1b3cfd..4e76589984 100644 --- a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("TriactisOPHammerMelee"); item.shootSpeed = 25f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; + item.Calamity().postMoonLordRarity = 16; } public override void AddRecipes() diff --git a/Items/Weapons/Trinity.cs b/Items/Weapons/Trinity.cs index 8a5f88ced5..aeeddb3790 100644 --- a/Items/Weapons/Trinity.cs +++ b/Items/Weapons/Trinity.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6), knockBack, Main.myPlayer, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/TrueArkoftheAncients.cs b/Items/Weapons/TrueArkoftheAncients.cs index 4218f480a7..5737128b69 100644 --- a/Items/Weapons/TrueArkoftheAncients.cs +++ b/Items/Weapons/TrueArkoftheAncients.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Weapons float speedX4 = num78 + (float)Main.rand.Next(-160, 161) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage / 3, num74, i, 0f, (float)Main.rand.Next(10)); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBall"), damage / 3, num74, i, 0f, (float)Main.rand.Next(5)); } return false; diff --git a/Items/Weapons/TrueTyrantYharimsUltisword.cs b/Items/Weapons/TrueTyrantYharimsUltisword.cs index 989f591012..40d7822b10 100644 --- a/Items/Weapons/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/TrueTyrantYharimsUltisword.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("BlazingPhantomBlade"); item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/UltraLiquidator.cs b/Items/Weapons/UltraLiquidator.cs index 1801db73ec..1af4946c8b 100644 --- a/Items/Weapons/UltraLiquidator.cs +++ b/Items/Weapons/UltraLiquidator.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("LiquidBlade"); item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/VanquisherArrow.cs b/Items/Weapons/VanquisherArrow.cs index 043ac9f5ec..f1a7ab24b1 100644 --- a/Items/Weapons/VanquisherArrow.cs +++ b/Items/Weapons/VanquisherArrow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("VanquisherArrow"); item.shootSpeed = 10f; item.ammo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/VenusianTrident.cs b/Items/Weapons/VenusianTrident.cs index 72509cd73c..753680dffb 100644 --- a/Items/Weapons/VenusianTrident.cs +++ b/Items/Weapons/VenusianTrident.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("VenusianBolt"); item.shootSpeed = 19f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/Verdant.cs b/Items/Weapons/Verdant.cs index 64cd3d1fc7..0c55ddac21 100644 --- a/Items/Weapons/Verdant.cs +++ b/Items/Weapons/Verdant.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("VerdantProjectile"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; } public override void AddRecipes() diff --git a/Items/Weapons/Vesuvius.cs b/Items/Weapons/Vesuvius.cs index 7464c5921d..95e36b4425 100644 --- a/Items/Weapons/Vesuvius.cs +++ b/Items/Weapons/Vesuvius.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons item.rare = 8; item.shootSpeed = 20f; item.shoot = mod.ProjectileType("AsteroidMolten"); - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().postMoonLordRarity = 17; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/Viscera.cs b/Items/Weapons/Viscera.cs index 283f952d0e..27b0ba6431 100644 --- a/Items/Weapons/Viscera.cs +++ b/Items/Weapons/Viscera.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Viscera"); item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; + item.Calamity().postMoonLordRarity = 13; } public override void AddRecipes() diff --git a/Items/Weapons/VividClarity.cs b/Items/Weapons/VividClarity.cs index 6c8f547315..fdb3084fea 100644 --- a/Items/Weapons/VividClarity.cs +++ b/Items/Weapons/VividClarity.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("VividClarity"); item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.Calamity().postMoonLordRarity = 15; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/YharimsCrystal.cs b/Items/Weapons/YharimsCrystal.cs index 9c62b4ebdc..7b83cf9cce 100644 --- a/Items/Weapons/YharimsCrystal.cs +++ b/Items/Weapons/YharimsCrystal.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("YharimsCrystal"); item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 17; + item.Calamity().postMoonLordRarity = 17; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Yharon/AngryChickenStaff.cs b/Items/Weapons/Yharon/AngryChickenStaff.cs index 7f48a607e3..a6b8227e17 100644 --- a/Items/Weapons/Yharon/AngryChickenStaff.cs +++ b/Items/Weapons/Yharon/AngryChickenStaff.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Yharon item.shoot = mod.ProjectileType("AngryChicken"); item.shootSpeed = 10f; item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/Yharon/ChickenCannon.cs b/Items/Weapons/Yharon/ChickenCannon.cs index ecc500da4f..fb19935351 100644 --- a/Items/Weapons/Yharon/ChickenCannon.cs +++ b/Items/Weapons/Yharon/ChickenCannon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Yharon item.shootSpeed = 24f; item.shoot = mod.ProjectileType("Chicken"); item.useAmmo = 771; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Yharon/DragonRage.cs b/Items/Weapons/Yharon/DragonRage.cs index 0ef5bba719..0e8d0b08e9 100644 --- a/Items/Weapons/Yharon/DragonRage.cs +++ b/Items/Weapons/Yharon/DragonRage.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Yharon item.rare = 10; item.shoot = mod.ProjectileType("DragonRage"); item.shootSpeed = 14f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Yharon/DragonsBreath.cs b/Items/Weapons/Yharon/DragonsBreath.cs index 3ddd9095d1..6c9857ea8b 100644 --- a/Items/Weapons/Yharon/DragonsBreath.cs +++ b/Items/Weapons/Yharon/DragonsBreath.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Yharon item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs index 6b2ff553cf..a9de9c9364 100644 --- a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Yharon item.autoReuse = true; item.shoot = mod.ProjectileType("HolyFlame"); item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Yharon/TheBurningSky.cs b/Items/Weapons/Yharon/TheBurningSky.cs index 472ff173e2..8c18cfcef6 100644 --- a/Items/Weapons/Yharon/TheBurningSky.cs +++ b/Items/Weapons/Yharon/TheBurningSky.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Yharon item.rare = 10; item.shoot = mod.ProjectileType("BurningMeteor"); item.shootSpeed = 35f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Yharon/ChickenEgg.cs b/Items/Yharon/ChickenEgg.cs index 210862a94e..87603d4a81 100644 --- a/Items/Yharon/ChickenEgg.cs +++ b/Items/Yharon/ChickenEgg.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Yharon item.useTime = 45; item.useStyle = 4; item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.Calamity().postMoonLordRarity = 14; } public override bool CanUseItem(Player player) diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.cs b/NPCs/AbyssNPCs/AquaticScourgeBody.cs index c5f8053c61..7b5bfca24f 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBody.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBody.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 32; npc.height = 32; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs index 413a92daab..9aea741fad 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 32; npc.height = 32; npc.defense = 15; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs index 4757a7e29a..10d6c9c9e3 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeHead.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 100; npc.height = 90; npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.aiStyle = -1; aiType = -1; npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; @@ -145,7 +145,7 @@ namespace CalamityMod.NPCs.AbyssNPCs if (detectsPlayer) { npc.localAI[0] += 1f; - if (npc.localAI[0] >= ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 120f : 180f)) + if (npc.localAI[0] >= ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 120f : 180f)) { int npcPoxX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; int npcPoxY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; @@ -540,7 +540,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) { if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) return 0.01f; diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.cs b/NPCs/AbyssNPCs/AquaticScourgeTail.cs index e2524da01a..137f69f196 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeTail.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeTail.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 30; npc.height = 50; npc.defense = 25; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AbyssNPCs/AquaticSeekerHead.cs b/NPCs/AbyssNPCs/AquaticSeekerHead.cs index f23d217479..f37883dbdf 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerHead.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerHead.cs @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) { if (!NPC.AnyNPCs(mod.NPCType("AquaticSeekerHead"))) return 0.01f; diff --git a/NPCs/AbyssNPCs/AquaticUrchin.cs b/NPCs/AbyssNPCs/AquaticUrchin.cs index 85e436ee30..f691cecf50 100644 --- a/NPCs/AbyssNPCs/AquaticUrchin.cs +++ b/NPCs/AbyssNPCs/AquaticUrchin.cs @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur && spawnInfo.water && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 2) + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 2) { return 0.2f; } diff --git a/NPCs/AbyssNPCs/Bloatfish.cs b/NPCs/AbyssNPCs/Bloatfish.cs index 6d2550e181..0f9344a463 100644 --- a/NPCs/AbyssNPCs/Bloatfish.cs +++ b/NPCs/AbyssNPCs/Bloatfish.cs @@ -177,7 +177,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(mod.NPCType("Bloatfish")) < 3) + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(mod.NPCType("Bloatfish")) < 3) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } diff --git a/NPCs/AbyssNPCs/BobbitWormHead.cs b/NPCs/AbyssNPCs/BobbitWormHead.cs index 66d291053a..309ebadb57 100644 --- a/NPCs/AbyssNPCs/BobbitWormHead.cs +++ b/NPCs/AbyssNPCs/BobbitWormHead.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 80; //324 npc.height = 40; //216 npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = 10000; npc.knockBackResist = 0f; aiType = -1; @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.TargetClosest(true); //if (npc.Center.Y + ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && - if (npc.Center.Y + Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(100f, 50f) > Main.player[npc.target].Center.Y && + if (npc.Center.Y + Main.player[npc.target].Calamity().GetAbyssAggro(100f, 50f) > Main.player[npc.target].Center.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.ai[1] = 0f; diff --git a/NPCs/AbyssNPCs/BobbitWormSegment.cs b/NPCs/AbyssNPCs/BobbitWormSegment.cs index 8d09d6949c..6ad9c11672 100644 --- a/NPCs/AbyssNPCs/BobbitWormSegment.cs +++ b/NPCs/AbyssNPCs/BobbitWormSegment.cs @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer4 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) { if (!NPC.AnyNPCs(mod.NPCType("BobbitWormSegment"))) return SpawnCondition.CaveJellyfish.Chance * 0.3f; diff --git a/NPCs/AbyssNPCs/BoxJellyfish.cs b/NPCs/AbyssNPCs/BoxJellyfish.cs index 1b19ade192..551022681b 100644 --- a/NPCs/AbyssNPCs/BoxJellyfish.cs +++ b/NPCs/AbyssNPCs/BoxJellyfish.cs @@ -178,11 +178,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } diff --git a/NPCs/AbyssNPCs/Catfish.cs b/NPCs/AbyssNPCs/Catfish.cs index 662cbfc68b..87055dedc3 100644 --- a/NPCs/AbyssNPCs/Catfish.cs +++ b/NPCs/AbyssNPCs/Catfish.cs @@ -243,7 +243,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) { return 0.2f; } diff --git a/NPCs/AbyssNPCs/ChaoticPuffer.cs b/NPCs/AbyssNPCs/ChaoticPuffer.cs index 978b5d00b6..0f264a693c 100644 --- a/NPCs/AbyssNPCs/ChaoticPuffer.cs +++ b/NPCs/AbyssNPCs/ChaoticPuffer.cs @@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer4 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/ColossalSquid.cs b/NPCs/AbyssNPCs/ColossalSquid.cs index 4a9dc6dd4d..6109f93018 100644 --- a/NPCs/AbyssNPCs/ColossalSquid.cs +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 180; npc.height = 180; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = 220000; npc.aiStyle = -1; aiType = -1; @@ -325,7 +325,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 300f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(300f, 150f)) || + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(300f, 150f)) || npc.justHit) { hasBeenHit = true; @@ -534,7 +534,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("ColossalSquid"))) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("ColossalSquid"))) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/Cuttlefish.cs b/NPCs/AbyssNPCs/Cuttlefish.cs index 10fe14910f..9b3023c736 100644 --- a/NPCs/AbyssNPCs/Cuttlefish.cs +++ b/NPCs/AbyssNPCs/Cuttlefish.cs @@ -300,11 +300,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/DevilFish.cs b/NPCs/AbyssNPCs/DevilFish.cs index 3e9e72baed..c45b063d5d 100644 --- a/NPCs/AbyssNPCs/DevilFish.cs +++ b/NPCs/AbyssNPCs/DevilFish.cs @@ -294,11 +294,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs index 7f4e770d80..59aac6497a 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHead.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 126; //36 npc.height = 76; //20 npc.defense = 300; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 160000; npc.aiStyle = -1; aiType = -1; @@ -221,7 +221,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { npc.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTail")) || !Main.player[npc.target].GetCalamityPlayer().ZoneAbyss) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTail")) || !Main.player[npc.target].Calamity().ZoneAbyss) { npc.active = false; } @@ -465,12 +465,12 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid"))) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs index e515dc39de..fe7a1d0df9 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -466,7 +466,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && CalamityWorld.downedPolterghast) + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && CalamityWorld.downedPolterghast) { return SpawnCondition.CaveJellyfish.Chance * 0.012f; } diff --git a/NPCs/AbyssNPCs/Flounder.cs b/NPCs/AbyssNPCs/Flounder.cs index 621e498c05..45f0f61e4c 100644 --- a/NPCs/AbyssNPCs/Flounder.cs +++ b/NPCs/AbyssNPCs/Flounder.cs @@ -271,7 +271,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) { return 0.2f; } diff --git a/NPCs/AbyssNPCs/Frogfish.cs b/NPCs/AbyssNPCs/Frogfish.cs index 2f09283333..6581ac46a5 100644 --- a/NPCs/AbyssNPCs/Frogfish.cs +++ b/NPCs/AbyssNPCs/Frogfish.cs @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/AbyssNPCs/GiantSquid.cs b/NPCs/AbyssNPCs/GiantSquid.cs index 23a7350900..ca3f08daa0 100644 --- a/NPCs/AbyssNPCs/GiantSquid.cs +++ b/NPCs/AbyssNPCs/GiantSquid.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(500f, 300f)) || + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(500f, 300f)) || npc.justHit) { hasBeenHit = true; @@ -225,11 +225,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } diff --git a/NPCs/AbyssNPCs/Gnasher.cs b/NPCs/AbyssNPCs/Gnasher.cs index 222468333c..23a62d2ce5 100644 --- a/NPCs/AbyssNPCs/Gnasher.cs +++ b/NPCs/AbyssNPCs/Gnasher.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 50; npc.height = 36; npc.defense = 30; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 35; npc.knockBackResist = 0.25f; npc.aiStyle = 3; @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.player.Calamity().ZoneSulphur) { return 0.2f; } diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs index 4bc9234f25..4c7d9c680f 100644 --- a/NPCs/AbyssNPCs/GulperEelHead.cs +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -66,7 +66,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //if ((Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 100f : 600f) * // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) || - if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(600f, 100f) || + if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(600f, 100f) || npc.justHit) { detectsPlayer = true; @@ -365,11 +365,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/Laserfish.cs b/NPCs/AbyssNPCs/Laserfish.cs index e4434ba93f..a916dc37f6 100644 --- a/NPCs/AbyssNPCs/Laserfish.cs +++ b/NPCs/AbyssNPCs/Laserfish.cs @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 400f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(400f, 200f)) + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(400f, 200f)) { flag14 = true; } @@ -275,11 +275,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } diff --git a/NPCs/AbyssNPCs/LuminousCorvina.cs b/NPCs/AbyssNPCs/LuminousCorvina.cs index def03e1c2b..585fe49ffa 100644 --- a/NPCs/AbyssNPCs/LuminousCorvina.cs +++ b/NPCs/AbyssNPCs/LuminousCorvina.cs @@ -272,7 +272,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/MantisShrimp.cs b/NPCs/AbyssNPCs/MantisShrimp.cs index 41d226d03e..7e0f112d6e 100644 --- a/NPCs/AbyssNPCs/MantisShrimp.cs +++ b/NPCs/AbyssNPCs/MantisShrimp.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 40; npc.height = 24; npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 30; npc.aiStyle = 3; aiType = 67; @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/AbyssNPCs/Mauler.cs b/NPCs/AbyssNPCs/Mauler.cs index dc4452910a..554d4476a3 100644 --- a/NPCs/AbyssNPCs/Mauler.cs +++ b/NPCs/AbyssNPCs/Mauler.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 180; npc.height = 90; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = 165000; npc.aiStyle = -1; aiType = -1; @@ -364,7 +364,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Mauler")) && + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Mauler")) && !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) { if (!Main.hardMode) diff --git a/NPCs/AbyssNPCs/MirageJelly.cs b/NPCs/AbyssNPCs/MirageJelly.cs index 621172beaf..f18893cc4a 100644 --- a/NPCs/AbyssNPCs/MirageJelly.cs +++ b/NPCs/AbyssNPCs/MirageJelly.cs @@ -180,7 +180,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/MorayEel.cs b/NPCs/AbyssNPCs/MorayEel.cs index 33e6c9911e..23b61864f5 100644 --- a/NPCs/AbyssNPCs/MorayEel.cs +++ b/NPCs/AbyssNPCs/MorayEel.cs @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 250f : 300f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(300f, 250f)) + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(300f, 250f)) { flag14 = true; } @@ -252,11 +252,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } diff --git a/NPCs/AbyssNPCs/OarfishHead.cs b/NPCs/AbyssNPCs/OarfishHead.cs index 1391e85e63..7e6a84958d 100644 --- a/NPCs/AbyssNPCs/OarfishHead.cs +++ b/NPCs/AbyssNPCs/OarfishHead.cs @@ -134,7 +134,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(250f, 150f)) + if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(250f, 150f)) { num192 = num47; if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) @@ -169,7 +169,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(250f, 150f)) + if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(250f, 150f)) { for (int num51 = 0; num51 < 200; num51++) { @@ -314,11 +314,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/Reaper.cs b/NPCs/AbyssNPCs/Reaper.cs index cf4f43f921..00fe508500 100644 --- a/NPCs/AbyssNPCs/Reaper.cs +++ b/NPCs/AbyssNPCs/Reaper.cs @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(500f, 300f)) || + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(500f, 300f)) || npc.justHit) { @@ -646,12 +646,12 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper"))) + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper"))) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } diff --git a/NPCs/AbyssNPCs/SeaUrchin.cs b/NPCs/AbyssNPCs/SeaUrchin.cs index 27501fbc49..89c658390d 100644 --- a/NPCs/AbyssNPCs/SeaUrchin.cs +++ b/NPCs/AbyssNPCs/SeaUrchin.cs @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/AbyssNPCs/ToxicMinnow.cs b/NPCs/AbyssNPCs/ToxicMinnow.cs index f6bd3fb6af..68e52a9dc2 100644 --- a/NPCs/AbyssNPCs/ToxicMinnow.cs +++ b/NPCs/AbyssNPCs/ToxicMinnow.cs @@ -242,15 +242,15 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.9f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/Trasher.cs b/NPCs/AbyssNPCs/Trasher.cs index bb91df9eae..7571bae7e1 100644 --- a/NPCs/AbyssNPCs/Trasher.cs +++ b/NPCs/AbyssNPCs/Trasher.cs @@ -337,7 +337,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur || (spawnInfo.player.GetCalamityPlayer().ZoneSulphur && spawnInfo.water)) + if (spawnInfo.player.Calamity().ZoneSulphur || (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water)) { return 0.1f; } diff --git a/NPCs/AbyssNPCs/Viperfish.cs b/NPCs/AbyssNPCs/Viperfish.cs index 7e8371e78c..7dcf128aab 100644 --- a/NPCs/AbyssNPCs/Viperfish.cs +++ b/NPCs/AbyssNPCs/Viperfish.cs @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.AbyssNPCs //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) * // (Main.player[npc.target].GetCalamityPlayer().abyssalMirror ? 0.7f : 1f) * // (Main.player[npc.target].GetCalamityPlayer().eclipseMirror ? 0.3f : 1f)) - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(600f, 200f)) + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(600f, 200f)) { flag14 = true; } @@ -265,11 +265,11 @@ namespace CalamityMod.NPCs.AbyssNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } diff --git a/NPCs/Astrageldon/Astrageldon.cs b/NPCs/Astrageldon/Astrageldon.cs index 0683a2365c..fa25d519c5 100644 --- a/NPCs/Astrageldon/Astrageldon.cs +++ b/NPCs/Astrageldon/Astrageldon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Astrageldon npc.width = 400; npc.height = 280; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.LifeMaxNERD(96000, NPC.downedMoonlord ? 440000 : 122000, 187000, 1400000, 1600000); npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/AstralBiomeNPCs/Aries.cs b/NPCs/AstralBiomeNPCs/Aries.cs index 640edf9b18..5d21fc7825 100644 --- a/NPCs/AstralBiomeNPCs/Aries.cs +++ b/NPCs/AstralBiomeNPCs/Aries.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 54; npc.aiStyle = 41; npc.defense = 14; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 300; npc.knockBackResist = 0.6f; npc.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.cs b/NPCs/AstralBiomeNPCs/AstralProbe.cs index d7a9186b62..59738bec38 100644 --- a/NPCs/AstralBiomeNPCs/AstralProbe.cs +++ b/NPCs/AstralBiomeNPCs/AstralProbe.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.width = 30; //324 npc.height = 30; //216 npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 50; npc.aiStyle = -1; aiType = -1; @@ -302,7 +302,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return (spawnInfo.player.GetCalamityPlayer().ZoneAstral && !spawnInfo.player.ZoneTowerStardust && !spawnInfo.player.ZoneTowerSolar && !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula) ? 0.1f : 0f; + return (spawnInfo.player.Calamity().ZoneAstral && !spawnInfo.player.ZoneTowerStardust && !spawnInfo.player.ZoneTowerSolar && !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula) ? 0.1f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs index 22f97f8a21..a1fbda0772 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = 3; npc.damage = 55; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 500; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.38f; diff --git a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs index 4a94b77840..335e684fe6 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = -1; npc.damage = 55; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 500; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0f; diff --git a/NPCs/AstralBiomeNPCs/Atlas.cs b/NPCs/AstralBiomeNPCs/Atlas.cs index e968ddd212..0b67216e9a 100644 --- a/NPCs/AstralBiomeNPCs/Atlas.cs +++ b/NPCs/AstralBiomeNPCs/Atlas.cs @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 88; npc.damage = 70; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 1200; npc.knockBackResist = 0.08f; npc.value = Item.buyPrice(0, 1, 0, 0); diff --git a/NPCs/AstralBiomeNPCs/BigSightseer.cs b/NPCs/AstralBiomeNPCs/BigSightseer.cs index 46efa64d4c..2d42651488 100644 --- a/NPCs/AstralBiomeNPCs/BigSightseer.cs +++ b/NPCs/AstralBiomeNPCs/BigSightseer.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 56; npc.damage = 50; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 430; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/AstralBiomeNPCs/FusionFeeder.cs b/NPCs/AstralBiomeNPCs/FusionFeeder.cs index 11ae6021e9..405a942946 100644 --- a/NPCs/AstralBiomeNPCs/FusionFeeder.cs +++ b/NPCs/AstralBiomeNPCs/FusionFeeder.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = 103; npc.lifeMax = 400; npc.defense = 12; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.value = Item.buyPrice(0, 0, 20, 0); npc.knockBackResist = 0.8f; npc.behindTiles = true; diff --git a/NPCs/AstralBiomeNPCs/Hadarian.cs b/NPCs/AstralBiomeNPCs/Hadarian.cs index 1ef1836288..48e659074c 100644 --- a/NPCs/AstralBiomeNPCs/Hadarian.cs +++ b/NPCs/AstralBiomeNPCs/Hadarian.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = -1; npc.damage = 50; npc.defense = 8; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 330; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.75f; diff --git a/NPCs/AstralBiomeNPCs/Hive.cs b/NPCs/AstralBiomeNPCs/Hive.cs index 3efc41c3e5..cbbd6ae0d3 100644 --- a/NPCs/AstralBiomeNPCs/Hive.cs +++ b/NPCs/AstralBiomeNPCs/Hive.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = -1; npc.damage = 55; npc.defense = 15; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 470; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0f; diff --git a/NPCs/AstralBiomeNPCs/Mantis.cs b/NPCs/AstralBiomeNPCs/Mantis.cs index 12c90de84a..a278e217e1 100644 --- a/NPCs/AstralBiomeNPCs/Mantis.cs +++ b/NPCs/AstralBiomeNPCs/Mantis.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 58; npc.aiStyle = -1; npc.defense = 6; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 340; npc.knockBackResist = 0.2f; npc.value = Item.buyPrice(0, 0, 15, 0); diff --git a/NPCs/AstralBiomeNPCs/Nova.cs b/NPCs/AstralBiomeNPCs/Nova.cs index 333b4eaf88..c458cff6f9 100644 --- a/NPCs/AstralBiomeNPCs/Nova.cs +++ b/NPCs/AstralBiomeNPCs/Nova.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 50; npc.damage = 45; npc.defense = 15; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 230; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/AstralBiomeNPCs/SmallSightseer.cs b/NPCs/AstralBiomeNPCs/SmallSightseer.cs index ebc1bfd5c7..c3cb82617a 100644 --- a/NPCs/AstralBiomeNPCs/SmallSightseer.cs +++ b/NPCs/AstralBiomeNPCs/SmallSightseer.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 40; npc.damage = 38; npc.defense = 16; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 310; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/AstralBiomeNPCs/StellarCulex.cs b/NPCs/AstralBiomeNPCs/StellarCulex.cs index 3a8cf01279..adda27567d 100644 --- a/NPCs/AstralBiomeNPCs/StellarCulex.cs +++ b/NPCs/AstralBiomeNPCs/StellarCulex.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.npcSlots = 0.5f; //needed? npc.damage = 55; npc.defense = 18; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.knockBackResist = 0.65f; npc.lifeMax = 210; npc.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 0398a864c1..d32588b7c7 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 38; npc.height = 44; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.LifeMaxNERD(12000, 18000, 29100, 360000, 420000); double HPBoost = Config.BossHealthPercentageBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 2b33c2f4b5..a26640646a 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 56; npc.height = 56; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; if (CalamityWorld.death) { @@ -182,7 +182,7 @@ namespace CalamityMod.NPCs.AstrumDeus float speedMult = expertMode ? 1.8f : 1.6f; if (CalamityWorld.death || CalamityWorld.bossRushActive) { - speedMult = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 3f : 2.5f); + speedMult = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 3f : 2.5f); } float life = (float)npc.life; float totalLife = (float)npc.lifeMax; @@ -282,7 +282,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.localAI[1] = 1f; Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int rectX = 300; - int rectY = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200); + int rectY = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200); bool flag95 = true; if (npc.position.Y > Main.player[npc.target].position.Y) { diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index e8b7d3dd55..717d60dcbd 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 30; npc.height = 30; npc.defense = 30; - npc.GetCalamityNPC().RevPlusDR(0.2f); + npc.Calamity().RevPlusDR(0.2f); npc.lifeMax = 1400; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 8124ebbb89..dff51f17fc 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 52; npc.height = 68; npc.defense = 60; - npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; if (CalamityWorld.death) { diff --git a/NPCs/BrimstoneWaifu/Brimling.cs b/NPCs/BrimstoneWaifu/Brimling.cs index e90e33c1da..bb7073c1a2 100644 --- a/NPCs/BrimstoneWaifu/Brimling.cs +++ b/NPCs/BrimstoneWaifu/Brimling.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu npc.width = 60; npc.height = 60; npc.defense = 0; - npc.GetCalamityNPC().DR = normalDR; + npc.Calamity().DR = normalDR; npc.lifeMax = 4000; if (CalamityWorld.death) { @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu } // Set DR based on boost status - npc.GetCalamityNPC().DR = boostDR ? boostedDR : normalDR; + npc.Calamity().DR = boostDR ? boostedDR : normalDR; float num1446 = goIntoShell ? 1f : (CalamityWorld.bossRushActive ? 12f : 6f); int num1447 = 480; diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs index 480a1eb345..76b4fd400a 100644 --- a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs +++ b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu npc.TargetClosest(true); Player player = Main.player[npc.target]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileSpeed = CalamityWorld.bossRushActive ? 7f : 5f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) projectileSpeed += 4f; if (revenge) projectileSpeed += 1f; @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f + 2f * (1f - lifeRatio); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[0] += 2f; if (CalamityWorld.death || !calamity) npc.localAI[0] += 1f; diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index d182eeb36c..0519e566b5 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 15; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.value = 0f; npc.lifeMax = CalamityWorld.revenge ? 51750 : 37500; if (CalamityWorld.death) diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 7ab90d5855..32d737e185 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = CalamityWorld.revenge ? 13200 : 9000; if (CalamityWorld.death) { @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.Calamitas } } - npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); + npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if (npc.ai[2] >= 240f) { npc.ai[1] = 1f; @@ -332,7 +332,7 @@ namespace CalamityMod.NPCs.Calamitas { num870 += 2.5f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num870 += 4f; } diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 5a62afc0a0..cdc6f3cafd 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = CalamityWorld.revenge ? 11025 : 7500; if (CalamityWorld.death) { @@ -270,7 +270,7 @@ namespace CalamityMod.NPCs.Calamitas } } - npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); + npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if (npc.ai[2] >= 180f) { npc.ai[1] = 1f; @@ -333,7 +333,7 @@ namespace CalamityMod.NPCs.Calamitas { num870 += 2.5f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num870 += 4f; } diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 9fc5cbf413..c486e5dc23 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 25; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = CalamityWorld.revenge ? 38812 : 28125; if (CalamityWorld.death) { @@ -332,7 +332,7 @@ namespace CalamityMod.NPCs.Calamitas { npc.localAI[1] = 0f; float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 14f : 12.5f); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num828 += 5f; int num829 = expertMode ? 34 : 42; @@ -408,7 +408,7 @@ namespace CalamityMod.NPCs.Calamitas npc.localAI[1] += 0.5f; if (CalamityWorld.death || CalamityWorld.bossRushActive) npc.localAI[1] += 0.5f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[1] += 0.5f; if (expertMode) npc.localAI[1] += 0.5f; diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index dfa821ad16..dcc0fea2bf 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Calamitas npc.canGhostHeal = false; npc.damage = 40; npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 2500; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 1d4c691ce2..de5ffd0f18 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs // Fire projectiles while walking, teleporting, or falling if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || - npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs laserDamage *= 3; // Fire astral flames while teleporting - if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float spread = 45f * 0.0174f; @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs // Stay vulnerable for a maximum of 1.5 or 2.5 seconds npc.ai[1] += 1f; - if (npc.ai[1] >= ((phase3 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) + if (npc.ai[1] >= ((phase3 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) { // Increase defense npc.defense = 70; diff --git a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs index daace90026..c712c2d6e0 100644 --- a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs +++ b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return (spawnInfo.player.GetCalamityPlayer().ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; + return (spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.cs b/NPCs/CalamityBiomeNPCs/DespairStone.cs index 00219530bf..9fd62483a3 100644 --- a/NPCs/CalamityBiomeNPCs/DespairStone.cs +++ b/NPCs/CalamityBiomeNPCs/DespairStone.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs npc.width = 72; //324 npc.height = 72; //216 npc.defense = 38; - npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = 120; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 5, 0); @@ -339,7 +339,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.GetCalamityPlayer().ZoneCalamity ? 0.25f : 0f; + return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; } public override void NPCLoot() diff --git a/NPCs/CalamityBiomeNPCs/Scryllar.cs b/NPCs/CalamityBiomeNPCs/Scryllar.cs index 7871d8e614..b753f83a73 100644 --- a/NPCs/CalamityBiomeNPCs/Scryllar.cs +++ b/NPCs/CalamityBiomeNPCs/Scryllar.cs @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.GetCalamityPlayer().ZoneCalamity ? 0.25f : 0f; + return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; } public override void NPCLoot() diff --git a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs index 7268f651c6..fda4d50343 100644 --- a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs +++ b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.GetCalamityPlayer().ZoneCalamity ? 0.125f : 0f; + return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; } public override void NPCLoot() diff --git a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs index 2b964ec2e6..f8736d7c78 100644 --- a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs +++ b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs npc.width = 60; //324 npc.height = 40; //216 npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 60; npc.knockBackResist = 0.65f; npc.value = Item.buyPrice(0, 0, 5, 0); @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.GetCalamityPlayer().ZoneCalamity ? 0.25f : 0f; + return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; } public override void AI() diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 224276c403..14a664c40a 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -538,7 +538,7 @@ namespace CalamityMod.NPCs #region Buffed Eye of Cthulhu AI public static bool BuffedEyeofCthulhuAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; float num5 = 20f; @@ -1355,7 +1355,7 @@ namespace CalamityMod.NPCs #region Buffed Eater of Worlds AI public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // Total body segments @@ -2474,7 +2474,7 @@ namespace CalamityMod.NPCs #region Buffed Queen Bee AI public static bool BuffedQueenBeeAI(NPC npc, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Increase bee spawn rate during bee spawning phase based on number of players near the boss int playerNearBoss = 0; @@ -3032,7 +3032,7 @@ namespace CalamityMod.NPCs #region Buffed Skeletron AI public static bool BuffedSkeletronAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // Percent life remaining @@ -3702,7 +3702,7 @@ namespace CalamityMod.NPCs #region Buffed Wall of Flesh AI public static bool BuffedWallofFleshAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // Despawn @@ -4076,7 +4076,7 @@ namespace CalamityMod.NPCs public static bool BuffedWallofFleshEyeAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // Despawn @@ -4205,7 +4205,7 @@ namespace CalamityMod.NPCs #region Buffed Destroyer AI public static bool BuffedDestroyerAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // 8 seconds of reistance to prevent spawn killing @@ -4690,7 +4690,7 @@ namespace CalamityMod.NPCs #region Buffed Twins AI public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // Enrage variable if player is floating upside down @@ -5376,7 +5376,7 @@ namespace CalamityMod.NPCs public static bool BuffedSpazmatismAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // Enrage variable if player is floating upside down @@ -6125,7 +6125,7 @@ namespace CalamityMod.NPCs #region Buffed Skeletron Prime AI public static bool BuffedSkeletronPrimeAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; // Enrage variable if player is floating upside down @@ -7808,7 +7808,7 @@ namespace CalamityMod.NPCs #region Buffed Plantera AI public static bool BuffedPlanteraAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; @@ -9183,7 +9183,7 @@ namespace CalamityMod.NPCs public static bool BuffedGolemHeadFreeAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Die if body is gone if (NPC.golemBoss < 0) @@ -9461,7 +9461,7 @@ namespace CalamityMod.NPCs #region Buffed Duke Fishron AI public static bool BuffedDukeFishronAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Variables float num = 0.6f * Main.damageMultiplier; @@ -10512,7 +10512,7 @@ namespace CalamityMod.NPCs #region Buffed Cultist AI public static bool BuffedCultistAI(NPC npc, bool enraged, Mod mod) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Set contact damage to 0 npc.damage = (npc.defDamage = 0); @@ -11785,11 +11785,11 @@ namespace CalamityMod.NPCs // Take damage if other parts are down bool flag85 = true; - if (Main.npc[(int)npc.localAI[0]].GetGlobalNPC(mod).newAI[0] != 1f) + if (Main.npc[(int)npc.localAI[0]].Calamity().newAI[0] != 1f) flag85 = false; - if (Main.npc[(int)npc.localAI[1]].GetGlobalNPC(mod).newAI[0] != 1f) + if (Main.npc[(int)npc.localAI[1]].Calamity().newAI[0] != 1f) flag85 = false; - if (Main.npc[(int)npc.localAI[2]].GetGlobalNPC(mod).newAI[0] != 1f) + if (Main.npc[(int)npc.localAI[2]].Calamity().newAI[0] != 1f) flag85 = false; if (flag85) @@ -11801,7 +11801,7 @@ namespace CalamityMod.NPCs } } - // Fly near target, take damage + // Fly near target, take damage else if (npc.ai[0] == 1f) { npc.dontTakeDamage = false; @@ -12067,7 +12067,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.MoonLordHead) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Despawn if (!Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.MoonLordCore) @@ -12354,7 +12354,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.MoonLordHand) { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Start attack array NPC.InitializeMoonLordAttacks(); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 7a042a6fc6..a7c4e5d9ae 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -517,7 +517,7 @@ namespace CalamityMod.NPCs { if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) { - Main.LocalPlayer.GetCalamityPlayer().adrenaline = 0; + Main.LocalPlayer.Calamity().adrenaline = 0; } } } @@ -1104,7 +1104,7 @@ namespace CalamityMod.NPCs damage /= 2; } - if (target.GetCalamityPlayer().beeResist) + if (target.Calamity().beeResist) { if (CalamityMod.beeEnemyList.Contains(npc.type)) { @@ -1332,7 +1332,7 @@ namespace CalamityMod.NPCs npc.type == NPCID.BigHornetSpikey || npc.type == NPCID.LittleHornetSpikey || npc.type == NPCID.BigHornetLeafy || npc.type == NPCID.LittleHornetLeafy || npc.type == NPCID.BigHornetHoney || npc.type == NPCID.LittleHornetHoney || npc.type == NPCID.BigHornetFatty || npc.type == NPCID.LittleHornetFatty) { - if (Main.player[npc.target].GetCalamityPlayer().queenBeeLore) + if (Main.player[npc.target].Calamity().queenBeeLore) { CalamityGlobalAI.QueenBeeLoreEffect(npc); return false; @@ -2061,7 +2061,7 @@ namespace CalamityMod.NPCs #region On Hit Player public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) { - if (target.GetCalamityPlayer().snowman) + if (target.Calamity().snowman) { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) { @@ -2317,7 +2317,7 @@ namespace CalamityMod.NPCs } } - if (Main.player[projectile.owner].GetCalamityPlayer().eGauntlet) + if (Main.player[projectile.owner].Calamity().eGauntlet) { if (projectile.melee && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) { @@ -2328,7 +2328,7 @@ namespace CalamityMod.NPCs } } - if (Main.player[projectile.owner].GetCalamityPlayer().eTalisman) + if (Main.player[projectile.owner].Calamity().eTalisman) { if (projectile.magic && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) { @@ -2339,9 +2339,9 @@ namespace CalamityMod.NPCs } } - if (Main.player[projectile.owner].GetCalamityPlayer().nanotech) + if (Main.player[projectile.owner].Calamity().nanotech) { - if (projectile.GetGlobalProjectile(mod).rogue && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + if (projectile.Calamity().rogue && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2350,7 +2350,7 @@ namespace CalamityMod.NPCs } } - if (Main.player[projectile.owner].GetCalamityPlayer().eQuiver) + if (Main.player[projectile.owner].Calamity().eQuiver) { if (projectile.ranged && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) { @@ -2361,7 +2361,7 @@ namespace CalamityMod.NPCs } } - if (Main.player[projectile.owner].GetCalamityPlayer().statisBeltOfCurses) + if (Main.player[projectile.owner].Calamity().statisBeltOfCurses) { if ((projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) { @@ -2377,18 +2377,18 @@ namespace CalamityMod.NPCs #region On Hit By Item public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit) { - if (player.GetCalamityPlayer().bloodflareSet) + if (player.Calamity().bloodflareSet) { if (!npc.SpawnedFromStatue && npc.damage > 0 && (npc.life < npc.lifeMax * 0.5) && - player.GetCalamityPlayer().bloodflareHeartTimer <= 0) + player.Calamity().bloodflareHeartTimer <= 0) { - player.GetCalamityPlayer().bloodflareHeartTimer = 180; + player.Calamity().bloodflareHeartTimer = 180; DropHelper.DropItem(npc, ItemID.Heart); } else if (!npc.SpawnedFromStatue && npc.damage > 0 && (npc.life > npc.lifeMax * 0.5) && - player.GetCalamityPlayer().bloodflareManaTimer <= 0) + player.Calamity().bloodflareManaTimer <= 0) { - player.GetCalamityPlayer().bloodflareManaTimer = 180; + player.Calamity().bloodflareManaTimer = 180; DropHelper.DropItem(npc, ItemID.Star); } } @@ -2400,7 +2400,7 @@ namespace CalamityMod.NPCs { bool isSummon = projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type); - if (Main.player[projectile.owner].GetCalamityPlayer().sGenerator) + if (Main.player[projectile.owner].Calamity().sGenerator) { if (isSummon && npc.damage > 0) { @@ -2424,18 +2424,18 @@ namespace CalamityMod.NPCs } } - if (Main.player[projectile.owner].GetCalamityPlayer().bloodflareSet) + if (Main.player[projectile.owner].Calamity().bloodflareSet) { if (!npc.SpawnedFromStatue && npc.damage > 0 && (npc.life < npc.lifeMax * 0.5) && - Main.player[projectile.owner].GetCalamityPlayer().bloodflareHeartTimer <= 0) + Main.player[projectile.owner].Calamity().bloodflareHeartTimer <= 0) { - Main.player[projectile.owner].GetCalamityPlayer().bloodflareHeartTimer = 180; + Main.player[projectile.owner].Calamity().bloodflareHeartTimer = 180; DropHelper.DropItem(npc, ItemID.Heart); } else if (!npc.SpawnedFromStatue && npc.damage > 0 && (npc.life > npc.lifeMax * 0.5) && - Main.player[projectile.owner].GetCalamityPlayer().bloodflareManaTimer <= 0) + Main.player[projectile.owner].Calamity().bloodflareManaTimer <= 0) { - Main.player[projectile.owner].GetCalamityPlayer().bloodflareManaTimer = 180; + Main.player[projectile.owner].Calamity().bloodflareManaTimer = 180; DropHelper.DropItem(npc, ItemID.Star); } } @@ -2585,7 +2585,7 @@ namespace CalamityMod.NPCs #region Edit Spawn Rate public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns) { - if (player.GetCalamityPlayer().ZoneSulphur) + if (player.Calamity().ZoneSulphur) { spawnRate = (int)(spawnRate * 1.1); maxSpawns = (int)(maxSpawns * 0.8f); @@ -2595,28 +2595,28 @@ namespace CalamityMod.NPCs maxSpawns = (int)(maxSpawns * 1.2f); } } - else if (player.GetCalamityPlayer().ZoneAbyss) + else if (player.Calamity().ZoneAbyss) { spawnRate = (int)(spawnRate * 0.7); maxSpawns = (int)(maxSpawns * 1.1f); } - else if (player.GetCalamityPlayer().ZoneCalamity) + else if (player.Calamity().ZoneCalamity) { spawnRate = (int)(spawnRate * 0.9); maxSpawns = (int)(maxSpawns * 1.1f); } - else if (player.GetCalamityPlayer().ZoneAstral) + else if (player.Calamity().ZoneAstral) { spawnRate = (int)(spawnRate * 0.6); maxSpawns = (int)(maxSpawns * 1.2f); } - else if (player.GetCalamityPlayer().ZoneSunkenSea) + else if (player.Calamity().ZoneSunkenSea) { spawnRate = (int)(spawnRate * 0.9); maxSpawns = (int)(maxSpawns * 1.1f); } - if (player.GetCalamityPlayer().clamity) + if (player.Calamity().clamity) { spawnRate = (int)(spawnRate * 0.02); maxSpawns = (int)(maxSpawns * 1.5f); @@ -2636,36 +2636,36 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 0.75); } - if (player.GetCalamityPlayer().zerg && player.GetCalamityPlayer().chaosCandle) + if (player.Calamity().zerg && player.Calamity().chaosCandle) { spawnRate = (int)(spawnRate * 0.005); maxSpawns = (int)(maxSpawns * 7.5f); } - else if (player.GetCalamityPlayer().zerg) + else if (player.Calamity().zerg) { spawnRate = (int)(spawnRate * 0.01); maxSpawns = (int)(maxSpawns * 5f); } - else if (player.GetCalamityPlayer().chaosCandle) + else if (player.Calamity().chaosCandle) { spawnRate = (int)(spawnRate * 0.02); maxSpawns = (int)(maxSpawns * 2.5f); } - if (player.GetCalamityPlayer().zen && player.GetCalamityPlayer().tranquilityCandle) + if (player.Calamity().zen && player.Calamity().tranquilityCandle) { - spawnRate = (int)(spawnRate * (player.GetCalamityPlayer().ZoneAbyss ? 1.75 : 75)); - maxSpawns = (int)(maxSpawns * (player.GetCalamityPlayer().ZoneAbyss ? 0.625f : 0.005f)); + spawnRate = (int)(spawnRate * (player.Calamity().ZoneAbyss ? 1.75 : 75)); + maxSpawns = (int)(maxSpawns * (player.Calamity().ZoneAbyss ? 0.625f : 0.005f)); } - else if (CalamityPlayer.areThereAnyDamnBosses || player.GetCalamityPlayer().zen || (Config.DisableExpertEnemySpawnsNearHouse && player.townNPCs > 1f && Main.expertMode)) + else if (CalamityPlayer.areThereAnyDamnBosses || player.Calamity().zen || (Config.DisableExpertEnemySpawnsNearHouse && player.townNPCs > 1f && Main.expertMode)) { - spawnRate = (int)(spawnRate * (player.GetCalamityPlayer().ZoneAbyss ? 1.5 : 50)); - maxSpawns = (int)(maxSpawns * (player.GetCalamityPlayer().ZoneAbyss ? 0.75f : 0.01f)); + spawnRate = (int)(spawnRate * (player.Calamity().ZoneAbyss ? 1.5 : 50)); + maxSpawns = (int)(maxSpawns * (player.Calamity().ZoneAbyss ? 0.75f : 0.01f)); } - else if (player.GetCalamityPlayer().tranquilityCandle) + else if (player.Calamity().tranquilityCandle) { - spawnRate = (int)(spawnRate * (player.GetCalamityPlayer().ZoneAbyss ? 1.25 : 25)); - maxSpawns = (int)(maxSpawns * (player.GetCalamityPlayer().ZoneAbyss ? 0.875f : 0.02f)); + spawnRate = (int)(spawnRate * (player.Calamity().ZoneAbyss ? 1.25 : 25)); + maxSpawns = (int)(maxSpawns * (player.Calamity().ZoneAbyss ? 0.875f : 0.02f)); } } #endregion @@ -2673,7 +2673,7 @@ namespace CalamityMod.NPCs #region Edit Spawn Range public override void EditSpawnRange(Player player, ref int spawnRangeX, ref int spawnRangeY, ref int safeRangeX, ref int safeRangeY) { - if (player.GetCalamityPlayer().ZoneAbyss) + if (player.Calamity().ZoneAbyss) { spawnRangeX = (int)(1920 / 16 * 0.5); //0.7 safeRangeX = (int)(1920 / 16 * 0.32); //0.52 @@ -2684,11 +2684,11 @@ namespace CalamityMod.NPCs #region Edit Spawn Pool public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneCalamity || - spawnInfo.player.GetCalamityPlayer().ZoneSulphur || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea || - (spawnInfo.player.GetCalamityPlayer().ZoneAstral && !NPC.LunarApocalypseIsUp)) + if (spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneCalamity || + spawnInfo.player.Calamity().ZoneSulphur || + spawnInfo.player.Calamity().ZoneSunkenSea || + (spawnInfo.player.Calamity().ZoneAstral && !NPC.LunarApocalypseIsUp)) { pool[0] = 0f; } @@ -2913,7 +2913,7 @@ namespace CalamityMod.NPCs public override Color? GetAlpha(NPC npc, Color drawColor) { - if (Main.LocalPlayer.GetCalamityPlayer().trippy) + if (Main.LocalPlayer.Calamity().trippy) { return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); } @@ -2936,7 +2936,7 @@ namespace CalamityMod.NPCs } } - if (Main.LocalPlayer.GetCalamityPlayer().trippy) + if (Main.LocalPlayer.Calamity().trippy) { SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) @@ -3468,7 +3468,7 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.MechanicalWorm, NPC.downedMechBoss1, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.MechanicalEye, NPC.downedMechBoss2, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.MechanicalSkull, NPC.downedMechBoss3, Item.buyPrice(0, 20)); - SetShopItem(ref shop, ref nextSlot, mod.ItemType("AstralSolution"), Main.LocalPlayer.GetCalamityPlayer().ZoneAstral && Main.hardMode, Item.buyPrice(0, 0, 5)); + SetShopItem(ref shop, ref nextSlot, mod.ItemType("AstralSolution"), Main.LocalPlayer.Calamity().ZoneAstral && Main.hardMode, Item.buyPrice(0, 0, 5)); } if (type == NPCID.Wizard) diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 01c6333262..b05ebe4ef6 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -693,7 +693,7 @@ namespace CalamityMod.NPCs { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) { - Main.player[Main.myPlayer].GetCalamityPlayer().adrenaline = 0; + Main.player[Main.myPlayer].Calamity().adrenaline = 0; } } } @@ -1248,7 +1248,7 @@ namespace CalamityMod.NPCs private void ArmorSetLoot(NPC npc, Mod mod) { // Tarragon armor set bonus: 20% chance to drop hearts from all valid enemies - if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetCalamityPlayer().tarraSet) + if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().tarraSet) { if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && npc.lifeMax > 100) { @@ -1259,7 +1259,7 @@ namespace CalamityMod.NPCs // Blood Orb drops: Valid enemy during a blood moon on the Surface if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.bloodMoon && npc.HasPlayerTarget && npc.position.Y / 16D < Main.worldSurface) { - if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].GetCalamityPlayer().bloodflareSet) + if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().bloodflareSet) { DropHelper.DropItemChance(npc, mod.ItemType("BloodOrb"), 2); // 50% chance of 1 orb with Bloodflare } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 855c622e24..7220fc2be5 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.CeaselessVoid { beamPortal += 1; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { beamPortal += 2; } diff --git a/NPCs/CosmicWraith/CosmicWraith.cs b/NPCs/CosmicWraith/CosmicWraith.cs index d6ca66dbd4..14d6db871a 100644 --- a/NPCs/CosmicWraith/CosmicWraith.cs +++ b/NPCs/CosmicWraith/CosmicWraith.cs @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.CosmicWraith { speed = expertMode ? 16f : 14f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed += 3f; } @@ -365,7 +365,7 @@ namespace CalamityMod.NPCs.CosmicWraith if (Main.netMode != NetmodeID.MultiplayerClient) { float num1070 = 15f; //changed from 10 - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1070 += 3f; } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 709c80c8ed..a9ee8e8baf 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -221,7 +221,7 @@ namespace CalamityMod.NPCs.Crabulon num823 = 2f; if (CalamityWorld.bossRushActive) num823 = 12f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num823 = 16f; if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) @@ -400,7 +400,7 @@ namespace CalamityMod.NPCs.Crabulon { num626 += 1f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num626 += 3f; } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index a1c597aa13..a6feb65ce2 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Cryogen npc.width = 80; npc.height = 80; npc.defense = 12; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = CalamityWorld.revenge ? 26300 : 17900; if (CalamityWorld.death) { diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index a471296b47..f7322f17e3 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Cryogen npc.width = 240; npc.height = 240; npc.defense = 0; - npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = 1400; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index df8a86d962..83e1e17283 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.width = 32; npc.height = 36; npc.defense = 6; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; if (CalamityWorld.death) { @@ -98,7 +98,7 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.netMode != NetmodeID.MultiplayerClient && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) { npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.localAI[0] += 4f; } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 3c40797389..8a2440e4ff 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.DesertScourge float speedMult = expertMode ? 1.5f : 1.45f; if (CalamityWorld.death || CalamityWorld.bossRushActive) speedMult = 1.6f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) speedMult = 2f; if (CalamityWorld.bossRushActive) speedMult *= 2f; @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.DesertScourge { npc.localAI[1] = 1f; Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000); + int num954 = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000); if (CalamityWorld.bossRushActive) num954 /= 2; diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 89a943eaa9..a7da54a5a2 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.width = 32; //324 npc.height = 48; //216 npc.defense = 9; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; if (CalamityWorld.death) { diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 40855f0aaf..7f1a291a64 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.GreatSandShark npc.width = 300; npc.height = 120; npc.defense = 60; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = CalamityWorld.revenge ? 11000 : 8000; if (CalamityWorld.death) { diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index b433570761..fa3c1938d9 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -167,7 +167,7 @@ namespace CalamityMod.NPCs.HiveMind int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); int num663 = mod.NPCType("HiveBlob"); - if (Main.rand.NextBool(3) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (Main.rand.NextBool(3) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num663 = mod.NPCType("DankCreeper"); } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 946a221727..9685793de8 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 850; npc.height = 450; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = CalamityWorld.revenge ? 90700 : 69000; if (CalamityWorld.death) { @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.Leviathan num418 = sirenAlive ? 14f : 17f; num419 = 33; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num418 = 22f; } @@ -429,7 +429,7 @@ namespace CalamityMod.NPCs.Leviathan { num1044 += 2f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1044 += 4f; } @@ -462,7 +462,7 @@ namespace CalamityMod.NPCs.Leviathan num1048 += 2f; num1049 += 0.1f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1048 += 3f; num1049 += 0.2f; diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 5fdd707d22..eb7e0a052e 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.AnyNPCs(mod.NPCType("LeviathanStart")) || NPC.AnyNPCs(mod.NPCType("Siren")) || NPC.AnyNPCs(mod.NPCType("Leviathan")) || - spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 72090cface..a67fd6b176 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 100; npc.height = 100; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = CalamityWorld.revenge ? 41600 : 27400; if (CalamityWorld.death) { @@ -392,7 +392,7 @@ namespace CalamityMod.NPCs.Leviathan npc.ai[1] += 1f; bool flag104 = false; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (npc.ai[1] % 10f == 9f) flag104 = true; @@ -418,7 +418,7 @@ namespace CalamityMod.NPCs.Leviathan if (Main.netMode != NetmodeID.MultiplayerClient) { float num1070 = revenge ? 15f : 13f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1070 = 24f; else if (isNotOcean || (!leviAlive && phase2) || CalamityWorld.death || CalamityWorld.bossRushActive) num1070 = revenge ? 17f : 16f; diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index 7968bed16f..fa8c01de18 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 100; npc.height = 100; npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.5f); + npc.Calamity().RevPlusDR(0.5f); npc.lifeMax = 650; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index a5ad4f6304..13face023b 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -38,8 +38,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index ab192314d1..4b8bdc845a 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -627,7 +627,7 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula && !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && + !spawnInfo.player.Calamity().ZoneSunkenSea && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 0fa81d4459..3ffbbe0882 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 38; npc.height = 38; npc.defense = 30; - npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index f76fe9fe21..57998d6063 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 54; npc.height = 54; npc.defense = 15; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 7e460d6ddb..5db9e55704 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 34; npc.height = 34; npc.defense = 45; - npc.GetCalamityNPC().RevPlusDR(0.45f); + npc.Calamity().RevPlusDR(0.45f); npc.lifeMax = 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index a3e5101f71..84ef2c1d1b 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 6a9c4023a0..e0ba45b5a1 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -38,8 +38,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CalamityEye.cs b/NPCs/NormalNPCs/CalamityEye.cs index cd86fd7dad..68a0c3a697 100644 --- a/NPCs/NormalNPCs/CalamityEye.cs +++ b/NPCs/NormalNPCs/CalamityEye.cs @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index b6432f28f2..6aca19a78b 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 160; npc.height = 80; npc.defense = 6; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = 400; npc.knockBackResist = 0.05f; aiType = -1; @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 895b27b67e..8107e28188 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index de505dbc85..106e0534d0 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 26e825690a..66176c6ef2 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 55621b9bd0..8cf1d85214 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 4b96f5a268..0356341d65 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 9ae14b9ddd..642178360b 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 55a1dba25d..dd465e1312 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index a94c151571..06ae1be0cb 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index c144b69623..d9404dda9f 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 98d936711a..678965e67d 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) { return 0f; } diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index a189c49e5b..9269ce7d9b 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -38,8 +38,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index f73aca9838..b38e63852f 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 50; npc.height = 64; npc.defense = 10; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 300; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 5, 0); @@ -345,7 +345,7 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula && !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && + !spawnInfo.player.Calamity().ZoneSunkenSea && Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; } diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index 75caf94692..ac51afc894 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneAbyss) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) { return 0f; } diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index e0ec64b829..c522c08ce7 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -289,7 +289,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - if (spawnInfo.player.GetCalamityPlayer().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return 0.05f; } diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index fc687977a0..2dbca7d16f 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -410,7 +410,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.raining || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || !Main.raining || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index fb3038a998..cb327d47ef 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 230; npc.height = 230; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 3800; npc.aiStyle = -1; aiType = -1; @@ -60,8 +60,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index ef611beebd..2ecc121297 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula && !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && + !spawnInfo.player.Calamity().ZoneSunkenSea && Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; } diff --git a/NPCs/NormalNPCs/IrradiatedSlime.cs b/NPCs/NormalNPCs/IrradiatedSlime.cs index 9c04f46a56..f68df6a674 100644 --- a/NPCs/NormalNPCs/IrradiatedSlime.cs +++ b/NPCs/NormalNPCs/IrradiatedSlime.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.player.GetCalamityPlayer().ZoneSulphur || !Main.raining) + if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining) { return 0f; } diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 7619ad9d58..8505780dea 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 8); int proj = Projectile.NewProjectile(vector62.X, vector62.Y, num506, num507, num511, num510, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceHostile = true; + Main.projectile[proj].Calamity().forceHostile = true; } } } diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 1df44b6b1f..bda612f95e 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 18; npc.height = 40; npc.defense = 18; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 90; npc.knockBackResist = 0.5f; animationType = 77; @@ -40,8 +40,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index dff593bf3f..fa47b49db9 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -37,8 +37,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index 78ad9b4cf8..d0282e98d5 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 44; npc.height = 22; npc.defense = 20; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 80; npc.aiStyle = 3; aiType = 67; @@ -87,8 +87,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index d768181a1f..bbb35718b2 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSulphur || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.player.Calamity().ZoneSulphur || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs index 58f14ef6d7..5e261c3579 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Pitbull.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/NormalNPCs/PlagueBee.cs index 372603bc28..ccd34dac1a 100644 --- a/NPCs/NormalNPCs/PlagueBee.cs +++ b/NPCs/NormalNPCs/PlagueBee.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/NormalNPCs/PlagueBeeLarge.cs index 11989642d1..847b8927dd 100644 --- a/NPCs/NormalNPCs/PlagueBeeLarge.cs +++ b/NPCs/NormalNPCs/PlagueBeeLarge.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs index e1b896eeea..6504fd11f6 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -154,7 +154,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.cs b/NPCs/NormalNPCs/PlaguedFlyingFox.cs index 32825d31d4..4b66a4b043 100644 --- a/NPCs/NormalNPCs/PlaguedFlyingFox.cs +++ b/NPCs/NormalNPCs/PlaguedFlyingFox.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index dc7bf82e6b..d5510c550e 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs { spikeTimer -= 1f; } - if (!npc.wet && !Main.player[npc.target].GetCalamityPlayer().royalGel) + if (!npc.wet && !Main.player[npc.target].Calamity().royalGel) { Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; @@ -107,7 +107,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/PlaguedTortoise.cs b/NPCs/NormalNPCs/PlaguedTortoise.cs index d149abe9c7..aef0d5af1f 100644 --- a/NPCs/NormalNPCs/PlaguedTortoise.cs +++ b/NPCs/NormalNPCs/PlaguedTortoise.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index c7b2fa21e8..adddb13030 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 72; npc.height = 36; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 6000; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 4fc3a45698..9b764f0c04 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 46; npc.height = 32; npc.defense = 30; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.scale = 1.5f; npc.lifeMax = 580; npc.knockBackResist = 0.2f; @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 9a0da33455..83f2487b7a 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 160; npc.height = 160; npc.defense = 38; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = 16000; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 968569bd4f..42c5d56cb9 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 64; npc.height = 38; npc.defense = 15; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 150; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index a8975c2c67..b8142232f9 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index 5066d08cc0..e749c8eb0f 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -47,8 +47,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetCalamityPlayer().ZoneAbyss || - spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index b17eb7f57a..050e58a196 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 80; npc.height = 140; npc.defense = 18; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = 6000; if (CalamityWorld.downedProvidence) { diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index f90b765428..00d51dc6f8 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs index da29a08bf0..59f1416f65 100644 --- a/NPCs/NormalNPCs/WulfrumSlime.cs +++ b/NPCs/NormalNPCs/WulfrumSlime.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.GetCalamityPlayer().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 0784fdfd09..99ef8f023a 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = 198; npc.height = 198; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = CalamityWorld.revenge ? 77275 : 58500; if (CalamityWorld.death) { @@ -261,7 +261,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1044 += 2f; if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) num1044 += 2f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1044 += 2f; Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -304,7 +304,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1048 += 2f; num1049 += 0.1f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1048 += 2f; num1049 += 0.1f; @@ -347,7 +347,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.spriteDirection = npc.direction; int num1050 = 600; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1050 = 250; else if (aboveGroundEnrage) num1050 = 350; @@ -590,7 +590,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 1f; bool flag104 = false; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (npc.ai[1] % 10f == 9f) flag104 = true; @@ -615,7 +615,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileSpeed = revenge ? 6.5f : 6f; - if (jungleEnrage || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (jungleEnrage || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) projectileSpeed += 10f; if (CalamityWorld.bossRushActive) projectileSpeed *= 1.5f; diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.cs b/NPCs/PlaguebringerShade/PlaguebringerShade.cs index 1d240f2696..103e75b694 100644 --- a/NPCs/PlaguebringerShade/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerShade/PlaguebringerShade.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.PlaguebringerShade npc.width = 66; npc.height = 66; npc.defense = 30; - npc.GetCalamityNPC().RevPlusDR(0.2f); + npc.Calamity().RevPlusDR(0.2f); npc.lifeMax = CalamityWorld.death ? 4000 : 3000; npc.value = Item.buyPrice(0, 1, 50, 0); if (CalamityWorld.bossRushActive) diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 30d6491389..ce6976012e 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Polterghast npc.width = 90; npc.height = 120; npc.defense = 90; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.1f; global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.88f); @@ -264,7 +264,7 @@ namespace CalamityMod.NPCs.Polterghast // Set DR based on phase and boostDR variable float dr = phase3 ? phase3DR : phase2 ? phase2DR : phase1DR; if (boostDR) dr += cloneDRBoost; - npc.GetCalamityNPC().DR = dr; + npc.Calamity().DR = dr; if (expertMode) { @@ -383,7 +383,7 @@ namespace CalamityMod.NPCs.Polterghast num742 += 1f; if (CalamityWorld.bossRushActive) num742 = 13f; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); @@ -405,7 +405,7 @@ namespace CalamityMod.NPCs.Polterghast num747 = mod.ProjectileType("PhantomBlast"); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num746 *= 2; vector93.X += num743 * 3f; @@ -421,7 +421,7 @@ namespace CalamityMod.NPCs.Polterghast num742 += 1f; if (CalamityWorld.bossRushActive) num742 = 18f; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); @@ -435,7 +435,7 @@ namespace CalamityMod.NPCs.Polterghast int num746 = expertMode ? 60 : 70; int num747 = mod.ProjectileType("PhantomBlast"); - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num746 *= 2; vector93.X += num743 * 3f; @@ -487,7 +487,7 @@ namespace CalamityMod.NPCs.Polterghast npc.damage = (int)((float)npc.defDamage * 1.2f); npc.defense = (int)((float)npc.defDefense * 0.8f); - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.defense *= 2; npc.damage *= 2; @@ -517,7 +517,7 @@ namespace CalamityMod.NPCs.Polterghast num742 += 1f; if (CalamityWorld.bossRushActive) num742 = 13f; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); @@ -539,7 +539,7 @@ namespace CalamityMod.NPCs.Polterghast num747 = mod.ProjectileType("PhantomBlast2"); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num746 *= 2; vector93.X += num743 * 3f; @@ -555,7 +555,7 @@ namespace CalamityMod.NPCs.Polterghast num742 += 1f; if (CalamityWorld.bossRushActive) num742 = 18f; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); @@ -570,7 +570,7 @@ namespace CalamityMod.NPCs.Polterghast int num746 = expertMode ? 65 : 75; int num747 = mod.ProjectileType("PhantomBlast2"); - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num746 *= 2; vector93.X += num743 * 3f; @@ -638,7 +638,7 @@ namespace CalamityMod.NPCs.Polterghast npc.damage = (int)((float)npc.defDamage * 1.4f); npc.defense = (int)((float)npc.defDefense * 0.5f); - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.defense *= 2; npc.damage *= 2; diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs index 18971dff12..39a6fb3060 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.width = 100; npc.height = 80; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = 102500; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs index 32f455c765..42f61fa4a6 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.width = 100; npc.height = 80; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = 40000; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs index c9c3b00af3..3ac343a567 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.width = 100; npc.height = 80; npc.defense = 35; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 3e60e92534..79d1128805 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index fb1aaff529..eeec304d22 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 35; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 40000; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index db2e12e669..731021df60 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.3f); + npc.Calamity().RevPlusDR(0.3f); npc.lifeMax = 42500; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 845478b725..bb1ce80bc9 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Providence npc.width = 600; npc.height = 450; npc.defense = 50; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = normalDR; global.customDR = true; global.flatDRReductions.Add(BuffID.Ichor, 0.05f); @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.Providence public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // whoAmI variable for Guardians and other things CalamityGlobalNPC.holyBoss = npc.whoAmI; @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.Providence } // Set DR based on current attack phase - npc.GetCalamityNPC().DR = (npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f) ? cocoonDR : normalDR; + npc.Calamity().DR = (npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f) ? cocoonDR : normalDR; // Movement if (npc.ai[0] != 2f && npc.ai[0] != 5f) @@ -558,7 +558,7 @@ namespace CalamityMod.NPCs.Providence npc.ai[3] += 1f; int num856 = (expertMode ? 24 : 26) - (int)(4f * (1f - lifeRatio)); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num856 = 19; num856 = (int)((double)num856 * attackRateMult); @@ -574,7 +574,7 @@ namespace CalamityMod.NPCs.Providence float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); float num860 = (expertMode ? 10.25f : 9f) + (2.5f * (1f - lifeRatio)); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num860 = 12.75f; if (revenge) @@ -804,7 +804,7 @@ namespace CalamityMod.NPCs.Providence npc.ai[3] += 1f; int num864 = (expertMode ? 73 : 77) - (int)(15f * (1f - lifeRatio)); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) num864 = 59; num864 = (int)((double)num864 * attackRateMult); @@ -846,7 +846,7 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f) + (2f * (1f - lifeRatio)); + npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f) + (2f * (1f - lifeRatio)); if (CalamityWorld.bossRushActive) npc.ai[2] += 1f; diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs index 397c69ad9d..db20f4836b 100644 --- a/NPCs/Scavenger/ScavengerBody.cs +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 332; npc.height = 214; npc.defense = 55; - npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = CalamityWorld.revenge ? 53500 : 42700; if (CalamityWorld.death) { @@ -382,11 +382,11 @@ namespace CalamityMod.NPCs.Scavenger npc.ai[1] += 1f; if (npc.ai[1] > 0f) { - if ((!rightClawActive && !leftClawActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if ((!rightClawActive && !leftClawActive) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.ai[1] += 1f; - if (!headActive || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (!headActive || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.ai[1] += 1f; - if ((!rightLegActive && !leftLegActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if ((!rightLegActive && !leftLegActive) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.ai[1] += 1f; } @@ -396,7 +396,7 @@ namespace CalamityMod.NPCs.Scavenger { npc.TargetClosest(true); - float velocityX = ((enrage || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8f : 4f) + (4f * (1f - lifeRatio)); + float velocityX = ((enrage || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8f : 4f) + (4f * (1f - lifeRatio)); npc.velocity.X = velocityX * (float)npc.direction; if (CalamityWorld.revenge || CalamityWorld.bossRushActive) @@ -480,7 +480,7 @@ namespace CalamityMod.NPCs.Scavenger npc.velocity.X = npc.velocity.X + 0.2f; float velocityX = 3f + (4f * (1f - lifeRatio)); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) velocityX += 3f; if (!rightClawActive) velocityX += 1f; diff --git a/NPCs/Scavenger/ScavengerClawLeft.cs b/NPCs/Scavenger/ScavengerClawLeft.cs index 345dbd67d6..bc4338dd97 100644 --- a/NPCs/Scavenger/ScavengerClawLeft.cs +++ b/NPCs/Scavenger/ScavengerClawLeft.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 80; npc.height = 40; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerClawRight.cs b/NPCs/Scavenger/ScavengerClawRight.cs index 46bca10b5b..6a9148d555 100644 --- a/NPCs/Scavenger/ScavengerClawRight.cs +++ b/NPCs/Scavenger/ScavengerClawRight.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 80; //324 npc.height = 40; //216 npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerHead.cs b/NPCs/Scavenger/ScavengerHead.cs index 564e73e9c3..a2a578a0b1 100644 --- a/NPCs/Scavenger/ScavengerHead.cs +++ b/NPCs/Scavenger/ScavengerHead.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 80; npc.height = 80; npc.defense = 50; - npc.GetCalamityNPC().RevPlusDR(0.1f); + npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = 32705; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerLegLeft.cs b/NPCs/Scavenger/ScavengerLegLeft.cs index f7b68299ae..ba2657f44b 100644 --- a/NPCs/Scavenger/ScavengerLegLeft.cs +++ b/NPCs/Scavenger/ScavengerLegLeft.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 60; npc.height = 60; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 22010; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerLegRight.cs b/NPCs/Scavenger/ScavengerLegRight.cs index 964280f2eb..abc2b85493 100644 --- a/NPCs/Scavenger/ScavengerLegRight.cs +++ b/NPCs/Scavenger/ScavengerLegRight.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 60; npc.height = 60; npc.defense = 40; - npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 21010; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 418fce4446..a0a6640f85 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); + npc.localAI[1] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if (expertMode && Main.rand.NextBool(2)) { if (npc.localAI[0] >= 75f) @@ -234,7 +234,7 @@ namespace CalamityMod.NPCs.SlimeGod { num1372 = 22f; } - if (npc.GetGlobalNPC(mod).enraged || player.gravDir == -1f || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || player.gravDir == -1f || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1372 += 8f; } @@ -347,7 +347,7 @@ namespace CalamityMod.NPCs.SlimeGod DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedSlimeGod, 3, 1, 0); // Purified Jam is once per player, but drops for all players. - CalamityPlayer mp = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].GetCalamityPlayer(); + CalamityPlayer mp = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity(); if (!mp.revJamDrop) { DropHelper.DropItemCondition(npc, mod.ItemType("PurifiedJam"), true, CalamityWorld.revenge && !CalamityWorld.downedSlimeGod, 6, 8); diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index 48be9af7e3..cda35f14ea 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.width = 30; npc.height = 30; npc.defense = 60; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = 1200; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 28f5677587..f45174cfaa 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -167,7 +167,7 @@ namespace CalamityMod.NPCs.StormWeaver if (BoltCountdown == 0) { int speed2 = revenge ? 8 : 7; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed2 += 1; } diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 821ca44eaa..f2dfd6e266 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -186,7 +186,7 @@ namespace CalamityMod.NPCs.StormWeaver if (BoltCountdown == 0) { int speed2 = revenge ? 8 : 7; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed2 += 1; } diff --git a/NPCs/SunkenSeaNPCs/BlindedAngler.cs b/NPCs/SunkenSeaNPCs/BlindedAngler.cs index 668e5627ea..2af398eb51 100644 --- a/NPCs/SunkenSeaNPCs/BlindedAngler.cs +++ b/NPCs/SunkenSeaNPCs/BlindedAngler.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 56; npc.height = 44; npc.defense = 30; - npc.GetCalamityNPC().RevPlusDR(0.2f); + npc.Calamity().RevPlusDR(0.2f); npc.lifeMax = 750; npc.aiStyle = -1; aiType = -1; @@ -247,7 +247,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (Main.hardMode && spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetCalamityPlayer().clamity) + if (Main.hardMode && spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } diff --git a/NPCs/SunkenSeaNPCs/Clam.cs b/NPCs/SunkenSeaNPCs/Clam.cs index 3ba5fb7dea..7ee84ec3bf 100644 --- a/NPCs/SunkenSeaNPCs/Clam.cs +++ b/NPCs/SunkenSeaNPCs/Clam.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 56; npc.height = 38; npc.defense = 9999; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = Main.hardMode ? 300 : 150; if (Main.expertMode) { @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override void AI() { npc.TargetClosest(true); - if (Main.player[npc.target].GetCalamityPlayer().clamity) + if (Main.player[npc.target].Calamity().clamity) { hitAmount = 3; hasBeenHit = true; @@ -192,7 +192,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } diff --git a/NPCs/SunkenSeaNPCs/EutrophicRay.cs b/NPCs/SunkenSeaNPCs/EutrophicRay.cs index d66ba4a98a..e84de45fa5 100644 --- a/NPCs/SunkenSeaNPCs/EutrophicRay.cs +++ b/NPCs/SunkenSeaNPCs/EutrophicRay.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 116; npc.height = 36; npc.defense = Main.hardMode ? 15 : 5; - npc.GetCalamityNPC().RevPlusDR(0.05f); + npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = Main.hardMode ? 500 : 150; npc.aiStyle = -1; aiType = -1; @@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetCalamityPlayer().clamity) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/SunkenSeaNPCs/GhostBell.cs b/NPCs/SunkenSeaNPCs/GhostBell.cs index 7e4c08e788..b40bdfb998 100644 --- a/NPCs/SunkenSeaNPCs/GhostBell.cs +++ b/NPCs/SunkenSeaNPCs/GhostBell.cs @@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetCalamityPlayer().clamity) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.9f; } diff --git a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs index 02eacf3cf1..879001c406 100644 --- a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs +++ b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs @@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetCalamityPlayer().clamity) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 1.5f; } diff --git a/NPCs/SunkenSeaNPCs/GiantClam.cs b/NPCs/SunkenSeaNPCs/GiantClam.cs index 5ca7eb3ba2..c71edfd5b9 100644 --- a/NPCs/SunkenSeaNPCs/GiantClam.cs +++ b/NPCs/SunkenSeaNPCs/GiantClam.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 160; npc.height = 120; npc.defense = 9999; - npc.GetCalamityNPC().RevPlusDR(0.3f); + npc.Calamity().RevPlusDR(0.3f); npc.lifeMax = Main.hardMode ? 7500 : 1250; for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -348,7 +348,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(mod.NPCType("GiantClam"))) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(mod.NPCType("GiantClam"))) { return SpawnCondition.CaveJellyfish.Chance * 0.12f; } diff --git a/NPCs/SunkenSeaNPCs/PrismTurtle.cs b/NPCs/SunkenSeaNPCs/PrismTurtle.cs index 595fb3ff92..44ed5579a3 100644 --- a/NPCs/SunkenSeaNPCs/PrismTurtle.cs +++ b/NPCs/SunkenSeaNPCs/PrismTurtle.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 72; npc.height = 58; npc.defense = Main.hardMode ? 25 : 10; - npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = Main.hardMode ? 1000 : 350; npc.aiStyle = -1; aiType = -1; @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetCalamityPlayer().clamity) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.9f; } diff --git a/NPCs/SunkenSeaNPCs/SeaFloaty.cs b/NPCs/SunkenSeaNPCs/SeaFloaty.cs index b2e4e0e18a..2ec45d95b2 100644 --- a/NPCs/SunkenSeaNPCs/SeaFloaty.cs +++ b/NPCs/SunkenSeaNPCs/SeaFloaty.cs @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetCalamityPlayer().clamity) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } diff --git a/NPCs/SunkenSeaNPCs/SeaMinnow.cs b/NPCs/SunkenSeaNPCs/SeaMinnow.cs index 057ae14e9b..fbb87a7508 100644 --- a/NPCs/SunkenSeaNPCs/SeaMinnow.cs +++ b/NPCs/SunkenSeaNPCs/SeaMinnow.cs @@ -200,7 +200,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetCalamityPlayer().clamity) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent1.cs b/NPCs/SunkenSeaNPCs/SeaSerpent1.cs index 65ea0e6f55..3de6181541 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent1.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent1.cs @@ -315,8 +315,8 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (Main.hardMode && spawnInfo.player.GetCalamityPlayer().ZoneSunkenSea && spawnInfo.water && - !NPC.AnyNPCs(mod.NPCType("SeaSerpent1")) && !spawnInfo.player.GetCalamityPlayer().clamity && !spawnInfo.playerSafe) + if (Main.hardMode && spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && + !NPC.AnyNPCs(mod.NPCType("SeaSerpent1")) && !spawnInfo.player.Calamity().clamity && !spawnInfo.playerSafe) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 1a1d3b6f27..640681492c 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.canGhostHeal = false; npc.damage = 0; npc.defense = 80; - npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = Main.expertMode ? 90000 : 50000; if (CalamityWorld.revenge) { diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 8053418245..762da9fe00 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 120; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.bossRushActive ? bossRushDR : CalamityWorld.death ? deathDR : normalDR; global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.9f); @@ -227,7 +227,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startText) { - if (Main.LocalPlayer.GetCalamityPlayer().sCalKillCount == 4) + if (Main.LocalPlayer.Calamity().sCalKillCount == 4) { string key = "Mods.CalamityMod.SupremeBossText12"; //kill SCal 4 times Color messageColor = Color.Orange; @@ -240,7 +240,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - else if (Main.LocalPlayer.GetCalamityPlayer().sCalKillCount == 1) + else if (Main.LocalPlayer.Calamity().sCalKillCount == 1) { string key = "Mods.CalamityMod.SupremeBossText11"; //kill SCal once Color messageColor = Color.Orange; @@ -253,9 +253,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - if (Main.LocalPlayer.GetCalamityPlayer().sCalDeathCount < 51) + if (Main.LocalPlayer.Calamity().sCalDeathCount < 51) { - if (Main.LocalPlayer.GetCalamityPlayer().sCalDeathCount == 50) + if (Main.LocalPlayer.Calamity().sCalDeathCount == 50) { string key = "Mods.CalamityMod.SupremeBossText15"; //die 50 or more times Color messageColor = Color.Orange; @@ -268,7 +268,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - else if (Main.LocalPlayer.GetCalamityPlayer().sCalDeathCount > 19) + else if (Main.LocalPlayer.Calamity().sCalDeathCount > 19) { string key = "Mods.CalamityMod.SupremeBossText14"; //die 20 or more times Color messageColor = Color.Orange; @@ -281,7 +281,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - else if (Main.LocalPlayer.GetCalamityPlayer().sCalDeathCount > 4) + else if (Main.LocalPlayer.Calamity().sCalDeathCount > 4) { string key = "Mods.CalamityMod.SupremeBossText13"; //die 5 or more times Color messageColor = Color.Orange; @@ -375,7 +375,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } // Set DR to be 99% and unbreakable if enraged. Boost DR during the 5th attack. - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); if(protectionBoost) { global.DR = enragedDR; @@ -427,7 +427,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4 : 6)) + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4 : 6)) { bulletHellCounter = 0; int damage = expertMode ? 200 : 250; //800 500 @@ -525,7 +525,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 7 : 9)) + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 7 : 9)) { bulletHellCounter = 0; if (bulletHellCounter2 < 1200) //blasts from below @@ -588,7 +588,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9 : 11)) + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9 : 11)) { bulletHellCounter = 0; if (bulletHellCounter2 < 2100) //blasts from above @@ -661,7 +661,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas passedVar += 1f; } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 13 : 15)) + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 13 : 15)) { bulletHellCounter = 0; if (bulletHellCounter2 < 3000) //blasts from below @@ -738,7 +738,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-500, 500), -10f * uDieLul, 0f, mod.ProjectileType("BrimstoneWave"), damage, 0f, Main.myPlayer, 0f, 0f); } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 16 : 18)) + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 16 : 18)) { bulletHellCounter = 0; if (bulletHellCounter2 < 3900) //blasts from above @@ -2026,8 +2026,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas DeathMessage(); // Incrase the player's SCal kill count - if (Main.player[npc.target].GetCalamityPlayer().sCalKillCount < 5) - Main.player[npc.target].GetCalamityPlayer().sCalKillCount++; + if (Main.player[npc.target].Calamity().sCalKillCount < 5) + Main.player[npc.target].Calamity().sCalKillCount++; // Materials int essenceMin = Main.expertMode ? 30 : 20; @@ -2076,9 +2076,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas string key; // If the player has never killed SCal before, comment on how many attempts it took - if (Main.player[npc.target].GetCalamityPlayer().sCalKillCount == 0) + if (Main.player[npc.target].Calamity().sCalKillCount == 0) { - switch (Main.LocalPlayer.GetCalamityPlayer().sCalDeathCount) + switch (Main.LocalPlayer.Calamity().sCalDeathCount) { case 0: key = "Mods.CalamityMod.SupremeBossText16"; diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 283111a684..dbe59559c4 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 100; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.9f); diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 2fb6a6d5fd..351456d714 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 100; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.9f); diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs index 5b22ce96c7..38c1224ff5 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 56; npc.height = 56; npc.defense = 70; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.death ? 0.95f : 0.925f; global.unbreakableDR = true; npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs index 359f53732a..90fca530dc 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 34; npc.height = 34; npc.defense = 60; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.5f; global.unbreakableDR = true; npc.lifeMax = 100000; diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs index 39d65822b8..c1523e9de2 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 70; npc.height = 70; npc.defense = 70; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.death ? 0.97f : 0.955f; global.unbreakableDR = true; npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index e7e1c95e27..5751abf8ec 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.GetGlobalNPC(mod); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // whoAmI variable CalamityGlobalNPC.DoGHead = npc.whoAmI; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index c91b8d7b22..d7bdddb3dd 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.Yharon npc.buffImmune[mod.BuffType("DemonFlames")] = false; npc.buffImmune[mod.BuffType("Shred")] = false; - CalamityGlobalNPC global = npc.GetCalamityNPC(); + CalamityGlobalNPC global = npc.Calamity(); global.DR = Phase1_DR; global.customDR = true; global.flatDRReductions.Add(BuffID.Ichor, 0.05f); @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.Yharon int aiChangeRate = expertMode ? 36 : 38; float npcVelocity = expertMode ? 0.7f : 0.69f; float scaleFactor = expertMode ? 11f : 10.8f; - if (phase4Change || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (phase4Change || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npcVelocity = 0.95f; scaleFactor = 14f; @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.Yharon int chargeTime2 = expertMode ? 34 : 36; float chargeSpeed = expertMode ? 22f : 20.5f; float chargeSpeed2 = expertMode ? 37f : 34f; - if (phase4Change || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (phase4Change || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { chargeTime = 28; chargeSpeed = 31f; @@ -354,7 +354,7 @@ namespace CalamityMod.NPCs.Yharon } // Set DR based on protection boost (aka enrage) - npc.GetCalamityNPC().DR = protectionBoost ? EnragedDR : Phase1_DR; + npc.Calamity().DR = protectionBoost ? EnragedDR : Phase1_DR; // Trigger spawn effects if (npc.localAI[0] == 0f) @@ -1899,7 +1899,7 @@ namespace CalamityMod.NPCs.Yharon } // Set DR based on protection boost (aka enrage) - npc.GetCalamityNPC().DR = protectionBoost ? EnragedDR : Phase2_DR; + npc.Calamity().DR = protectionBoost ? EnragedDR : Phase2_DR; int num = -1; float num2 = 1f; @@ -1936,7 +1936,7 @@ namespace CalamityMod.NPCs.Yharon scaleFactor4 = 16.5f; scaleFactor5 = 39f; } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num6 = 0.65f; scaleFactor = 11f; diff --git a/Projectiles/Amidias/HermitCrab.cs b/Projectiles/Amidias/HermitCrab.cs index 8d8c117bcb..113474c25b 100644 --- a/Projectiles/Amidias/HermitCrab.cs +++ b/Projectiles/Amidias/HermitCrab.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Amidias { if (spawnDust) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 20; for (int num502 = 0; num502 < num501; num502++) { @@ -56,16 +56,16 @@ namespace CalamityMod.Projectiles.Amidias } spawnDust = false; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("HermitCrab"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("HermitCrab"), 3600); if (flag64) { diff --git a/Projectiles/Amidias/SandDollarProj.cs b/Projectiles/Amidias/SandDollarProj.cs index 9dee76e74a..224adeef34 100644 --- a/Projectiles/Amidias/SandDollarProj.cs +++ b/Projectiles/Amidias/SandDollarProj.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Amidias { projectile.width = 30; projectile.height = 28; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.friendly = true; projectile.penetrate = -1; projectile.aiStyle = 3; diff --git a/Projectiles/Amidias/SnapClamProj.cs b/Projectiles/Amidias/SnapClamProj.cs index d03f0fb61e..48abfc5f6f 100644 --- a/Projectiles/Amidias/SnapClamProj.cs +++ b/Projectiles/Amidias/SnapClamProj.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Amidias projectile.width = 20; projectile.height = 13; projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.penetrate = -1; } diff --git a/Projectiles/Amidias/UrchinBall.cs b/Projectiles/Amidias/UrchinBall.cs index 43bff34ff2..630372ae26 100644 --- a/Projectiles/Amidias/UrchinBall.cs +++ b/Projectiles/Amidias/UrchinBall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Amidias projectile.alpha = 255; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Astral/HeavenfallenEnergy.cs b/Projectiles/Astral/HeavenfallenEnergy.cs index 67efba475b..10c887b0dd 100644 --- a/Projectiles/Astral/HeavenfallenEnergy.cs +++ b/Projectiles/Astral/HeavenfallenEnergy.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Astral projectile.ignoreWater = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Astral/HeavenfallenStardisk.cs b/Projectiles/Astral/HeavenfallenStardisk.cs index ac59215813..d77b2c8a87 100644 --- a/Projectiles/Astral/HeavenfallenStardisk.cs +++ b/Projectiles/Astral/HeavenfallenStardisk.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Astral projectile.netImportant = true; projectile.penetrate = 1; projectile.timeLeft = 600; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Astral/Hive.cs b/Projectiles/Astral/Hive.cs index f694bff44b..6661295f91 100644 --- a/Projectiles/Astral/Hive.cs +++ b/Projectiles/Astral/Hive.cs @@ -28,14 +28,14 @@ namespace CalamityMod.Projectiles.Astral { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Astral/Quasar.cs b/Projectiles/Astral/Quasar.cs index 49756d9861..f4f0e70e01 100644 --- a/Projectiles/Astral/Quasar.cs +++ b/Projectiles/Astral/Quasar.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Astral projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Astral/Quasar2.cs b/Projectiles/Astral/Quasar2.cs index 5b842be32d..5ed0e94a6b 100644 --- a/Projectiles/Astral/Quasar2.cs +++ b/Projectiles/Astral/Quasar2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Astral projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Astral/RadiantExplosion.cs b/Projectiles/Astral/RadiantExplosion.cs index 7afaa6a00f..418d36181b 100644 --- a/Projectiles/Astral/RadiantExplosion.cs +++ b/Projectiles/Astral/RadiantExplosion.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Astral projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 10; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Astral/RadiantStar.cs b/Projectiles/Astral/RadiantStar.cs index 2a8a359b5b..1b425783ff 100644 --- a/Projectiles/Astral/RadiantStar.cs +++ b/Projectiles/Astral/RadiantStar.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Astral projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Astral/RadiantStar2.cs b/Projectiles/Astral/RadiantStar2.cs index 2924a1ca6f..417c9ce635 100644 --- a/Projectiles/Astral/RadiantStar2.cs +++ b/Projectiles/Astral/RadiantStar2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Astral projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Astral/StellarKnife.cs b/Projectiles/Astral/StellarKnife.cs index 8c058c010f..bae92f4553 100644 --- a/Projectiles/Astral/StellarKnife.cs +++ b/Projectiles/Astral/StellarKnife.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Astral projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 600; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 8daddf8131..9ab4255258 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -343,7 +343,7 @@ namespace CalamityMod.Projectiles // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1) && - Main.npc[(int)projectile.ai[1]].GetGlobalNPC(mod).newAI[0] == 1f) + Main.npc[(int)projectile.ai[1]].Calamity().newAI[0] == 1f) { num807 = 2400f; } @@ -526,7 +526,7 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.SoulDrain) projectile.magic = true; - if (Main.player[projectile.owner].GetCalamityPlayer().eQuiver && projectile.ranged && + if (Main.player[projectile.owner].Calamity().eQuiver && projectile.ranged && projectile.friendly && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x)) { if (Main.rand.Next(200) > 198) @@ -547,7 +547,7 @@ namespace CalamityMod.Projectiles } } - if (Main.player[projectile.owner].GetCalamityPlayer().fungalSymbiote && trueMelee) + if (Main.player[projectile.owner].Calamity().fungalSymbiote && trueMelee) { counter++; if (counter >= 6) @@ -581,7 +581,7 @@ namespace CalamityMod.Projectiles } } - if (Main.player[projectile.owner].GetCalamityPlayer().nanotech && rogue && projectile.friendly) + if (Main.player[projectile.owner].Calamity().nanotech && rogue && projectile.friendly) { counter++; if (counter >= 30) @@ -595,7 +595,7 @@ namespace CalamityMod.Projectiles } } - if (Main.player[projectile.owner].GetCalamityPlayer().daedalusSplit && rogue && projectile.friendly) + if (Main.player[projectile.owner].Calamity().daedalusSplit && rogue && projectile.friendly) { counter2++; if (counter2 >= 30) @@ -619,14 +619,14 @@ namespace CalamityMod.Projectiles } } - if (Main.player[projectile.owner].GetCalamityPlayer().theBeeDamage > 0 && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && + if (Main.player[projectile.owner].Calamity().theBeeDamage > 0 && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) { int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); Main.dust[dust].noGravity = true; } - if (Main.player[projectile.owner].GetCalamityPlayer().providenceLore && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && + if (Main.player[projectile.owner].Calamity().providenceLore && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) { int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); @@ -635,7 +635,7 @@ namespace CalamityMod.Projectiles if (rogue) { - if (Main.player[projectile.owner].GetCalamityPlayer().moonCrown) + if (Main.player[projectile.owner].Calamity().moonCrown) { //Summon moon sigils infrequently if (Main.rand.NextBool(300)) @@ -704,7 +704,7 @@ namespace CalamityMod.Projectiles Main.player[Main.myPlayer].lifeSteal -= num; } - if (Main.player[projectile.owner].GetCalamityPlayer().alchFlask && + if (Main.player[projectile.owner].Calamity().alchFlask && (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("PlagueSeeker")] < 6) { @@ -717,7 +717,7 @@ namespace CalamityMod.Projectiles Main.projectile[plague].melee = false; } - if (Main.player[projectile.owner].GetCalamityPlayer().reaverBlast && projectile.melee) + if (Main.player[projectile.owner].Calamity().reaverBlast && projectile.melee) { int newDamage = (int)((double)projectile.damage * 0.2); if (newDamage > 30) @@ -727,7 +727,7 @@ namespace CalamityMod.Projectiles Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ReaverBlast"), newDamage, 0f, projectile.owner, 0f, 0f); } - if (Main.player[projectile.owner].GetCalamityPlayer().auricSet && target.canGhostHeal) + if (Main.player[projectile.owner].Calamity().auricSet && target.canGhostHeal) { float num11 = 0.05f; num11 -= (float)projectile.numHits * 0.025f; @@ -761,7 +761,7 @@ namespace CalamityMod.Projectiles } Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AuricOrb"), 0, 0f, projectile.owner, (float)num14, num12); } - else if (Main.player[projectile.owner].GetCalamityPlayer().silvaSet && target.canGhostHeal) + else if (Main.player[projectile.owner].Calamity().silvaSet && target.canGhostHeal) { float num11 = 0.03f; num11 -= (float)projectile.numHits * 0.015f; @@ -798,7 +798,7 @@ namespace CalamityMod.Projectiles if (projectile.magic) { - if (Main.player[projectile.owner].GetCalamityPlayer().silvaMage && projectile.penetrate == 1 && Main.rand.Next(0, 100) >= 97) + if (Main.player[projectile.owner].Calamity().silvaMage && projectile.penetrate == 1 && Main.rand.Next(0, 100) >= 97) { Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); projectile.position = projectile.Center; @@ -818,15 +818,15 @@ namespace CalamityMod.Projectiles Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.damage *= (Main.player[projectile.owner].GetCalamityPlayer().auricSet ? 7 : 4); + projectile.damage *= (Main.player[projectile.owner].Calamity().auricSet ? 7 : 4); projectile.Damage(); } - if (Main.player[projectile.owner].GetCalamityPlayer().tarraMage && target.canGhostHeal) + if (Main.player[projectile.owner].Calamity().tarraMage && target.canGhostHeal) { - if (Main.player[projectile.owner].GetCalamityPlayer().tarraMageHealCooldown <= 0) + if (Main.player[projectile.owner].Calamity().tarraMageHealCooldown <= 0) { - Main.player[projectile.owner].GetCalamityPlayer().tarraMageHealCooldown = 90; + Main.player[projectile.owner].Calamity().tarraMageHealCooldown = 90; float num11 = 0.03f; num11 -= (float)projectile.numHits * 0.015f; if (num11 <= 0f) @@ -843,7 +843,7 @@ namespace CalamityMod.Projectiles return; } Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - int healAmount = (Main.player[projectile.owner].GetCalamityPlayer().auricSet ? projectile.damage / 100 : projectile.damage / 50); + int healAmount = (Main.player[projectile.owner].Calamity().auricSet ? projectile.damage / 100 : projectile.damage / 50); Player player = Main.player[projectile.owner]; player.statLife += healAmount; player.HealEffect(healAmount); @@ -854,7 +854,7 @@ namespace CalamityMod.Projectiles } } - if (Main.player[projectile.owner].GetCalamityPlayer().reaverBurst) + if (Main.player[projectile.owner].Calamity().reaverBurst) { int num251 = Main.rand.Next(2, 5); for (int num252 = 0; num252 < num251; num252++) @@ -876,10 +876,10 @@ namespace CalamityMod.Projectiles Main.projectile[proj].localNPCHitCooldown = 30; } } - else if (Main.player[projectile.owner].GetCalamityPlayer().ataxiaMage && Main.player[projectile.owner].GetCalamityPlayer().ataxiaDmg <= 0) + else if (Main.player[projectile.owner].Calamity().ataxiaMage && Main.player[projectile.owner].Calamity().ataxiaDmg <= 0) { int num = projectile.damage / 2; - Main.player[projectile.owner].GetCalamityPlayer().ataxiaDmg += (float)num; + Main.player[projectile.owner].Calamity().ataxiaDmg += (float)num; int[] array = new int[200]; int num3 = 0; int num4 = 0; @@ -959,10 +959,10 @@ namespace CalamityMod.Projectiles Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AtaxiaHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); } } - else if (Main.player[projectile.owner].GetCalamityPlayer().xerocSet && Main.player[projectile.owner].GetCalamityPlayer().xerocDmg <= 0) + else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) { int num = projectile.damage / 2; - Main.player[projectile.owner].GetCalamityPlayer().xerocDmg += (float)num; + Main.player[projectile.owner].Calamity().xerocDmg += (float)num; int[] array = new int[200]; int num3 = 0; int num4 = 0; @@ -1042,10 +1042,10 @@ namespace CalamityMod.Projectiles Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); } } - else if (Main.player[projectile.owner].GetCalamityPlayer().godSlayerMage && Main.player[projectile.owner].GetCalamityPlayer().godSlayerDmg <= 0) + else if (Main.player[projectile.owner].Calamity().godSlayerMage && Main.player[projectile.owner].Calamity().godSlayerDmg <= 0) { int num = projectile.damage / 2; - Main.player[projectile.owner].GetCalamityPlayer().godSlayerDmg += (float)num; + Main.player[projectile.owner].Calamity().godSlayerDmg += (float)num; int[] array = new int[200]; int num3 = 0; int num4 = 0; @@ -1090,10 +1090,10 @@ namespace CalamityMod.Projectiles num8 *= num10; num9 *= num10; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerOrb"), - (int)((double)num * (Main.player[projectile.owner].GetCalamityPlayer().auricSet ? 2.0 : 1.5)), 0f, projectile.owner, (float)num6, 0f); + (int)((double)num * (Main.player[projectile.owner].Calamity().auricSet ? 2.0 : 1.5)), 0f, projectile.owner, (float)num6, 0f); if (target.canGhostHeal) { - float num11 = (Main.player[projectile.owner].GetCalamityPlayer().auricSet ? 0.03f : 0.06f); //0.2 + float num11 = (Main.player[projectile.owner].Calamity().auricSet ? 0.03f : 0.06f); //0.2 num11 -= (float)projectile.numHits * 0.015f; //0.05 if (num11 <= 0f) { @@ -1129,7 +1129,7 @@ namespace CalamityMod.Projectiles } else if (projectile.melee) { - if (Main.player[projectile.owner].GetCalamityPlayer().ataxiaGeyser && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) + if (Main.player[projectile.owner].Calamity().ataxiaGeyser && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) { int newDamage = (int)((double)projectile.damage * 0.15); if (newDamage > 35) @@ -1138,7 +1138,7 @@ namespace CalamityMod.Projectiles } Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), newDamage, 0f, projectile.owner, 0f, 0f); } - else if (Main.player[projectile.owner].GetCalamityPlayer().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocBlast")] < 3) + else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocBlast")] < 3) { int newDamage = (int)((double)projectile.damage * 0.2); if (newDamage > 40) @@ -1150,7 +1150,7 @@ namespace CalamityMod.Projectiles } else if (projectile.ranged) { - if (Main.player[projectile.owner].GetCalamityPlayer().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocFire")] < 3) + if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocFire")] < 3) { int newDamage = (int)((double)projectile.damage * 0.15); if (newDamage > 40) @@ -1162,10 +1162,10 @@ namespace CalamityMod.Projectiles } else if (rogue) { - if (Main.player[projectile.owner].GetCalamityPlayer().xerocSet && Main.player[projectile.owner].GetCalamityPlayer().xerocDmg <= 0) + if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) { int num = projectile.damage / 2; - Main.player[projectile.owner].GetCalamityPlayer().xerocDmg += (float)num; + Main.player[projectile.owner].Calamity().xerocDmg += (float)num; int[] array = new int[200]; int num3 = 0; int num4 = 0; @@ -1212,7 +1212,7 @@ namespace CalamityMod.Projectiles Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocStar"), (int)((double)num * 1.6), 0f, projectile.owner, (float)num6, 0f); } - if (Main.player[projectile.owner].GetCalamityPlayer().featherCrown && stealthStrike) + if (Main.player[projectile.owner].Calamity().featherCrown && stealthStrike) { for (int i = 0; i < 10; i++) { @@ -1221,11 +1221,11 @@ namespace CalamityMod.Projectiles float speedY = (target.position.Y - pos.Y) * 8; int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, mod.ProjectileType("StickyFeather"), 15, 3, projectile.owner, 0f, (float)Main.rand.Next(15)); Main.projectile[feather].magic = false; - Main.projectile[feather].GetGlobalProjectile(mod).rogue = true; + Main.projectile[feather].Calamity().rogue = true; } } - if (Main.player[projectile.owner].GetCalamityPlayer().moonCrown && stealthStrike) + if (Main.player[projectile.owner].Calamity().moonCrown && stealthStrike) { for (int i = 0; i < 20; i++) { @@ -1233,32 +1233,32 @@ namespace CalamityMod.Projectiles Vector2 velocity = (target.position - pos) / 10f; int flare = Projectile.NewProjectile(pos, velocity, ProjectileID.LunarFlare, 50, 3, projectile.owner); Main.projectile[flare].magic = false; - Main.projectile[flare].GetGlobalProjectile(mod).rogue = true; + Main.projectile[flare].Calamity().rogue = true; } } } else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) { - if (Main.player[projectile.owner].GetCalamityPlayer().pArtifact) + if (Main.player[projectile.owner].Calamity().pArtifact) { target.AddBuff(mod.BuffType("HolyLight"), 300); } - if (Main.player[projectile.owner].GetCalamityPlayer().tearMinions) + if (Main.player[projectile.owner].Calamity().tearMinions) { target.AddBuff(mod.BuffType("TemporalSadness"), 60); } - if (Main.player[projectile.owner].GetCalamityPlayer().shadowMinions) + if (Main.player[projectile.owner].Calamity().shadowMinions) { target.AddBuff(BuffID.ShadowFlame, 300); } - if (Main.player[projectile.owner].GetCalamityPlayer().godSlayerSummon && Main.player[projectile.owner].GetCalamityPlayer().godSlayerDmg <= 0) + if (Main.player[projectile.owner].Calamity().godSlayerSummon && Main.player[projectile.owner].Calamity().godSlayerDmg <= 0) { int num = projectile.damage / 2; float ai1 = (Main.rand.NextFloat() + 0.5f); - Main.player[projectile.owner].GetCalamityPlayer().godSlayerDmg += (float)num; + Main.player[projectile.owner].Calamity().godSlayerDmg += (float)num; int[] array = new int[200]; int num3 = 0; int num4 = 0; @@ -1304,10 +1304,10 @@ namespace CalamityMod.Projectiles num9 *= num10; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerPhantom"), (int)((double)num * 2.0), 0f, projectile.owner, 0f, ai1); } - else if (Main.player[projectile.owner].GetCalamityPlayer().xerocSet && Main.player[projectile.owner].GetCalamityPlayer().xerocDmg <= 0) + else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) { int num = projectile.damage / 2; - Main.player[projectile.owner].GetCalamityPlayer().xerocDmg += (float)num; + Main.player[projectile.owner].Calamity().xerocDmg += (float)num; int[] array = new int[200]; int num3 = 0; int num4 = 0; @@ -1383,7 +1383,7 @@ namespace CalamityMod.Projectiles #region Drawing public override Color? GetAlpha(Projectile projectile, Color lightColor) { - if (Main.player[Main.myPlayer].GetCalamityPlayer().trippy) + if (Main.player[Main.myPlayer].Calamity().trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); if (projectile.type == ProjectileID.PinkLaser) @@ -1399,7 +1399,7 @@ namespace CalamityMod.Projectiles public override bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) { - if (Main.player[Main.myPlayer].GetCalamityPlayer().trippy) + if (Main.player[Main.myPlayer].Calamity().trippy) { Texture2D texture = Main.projectileTexture[projectile.type]; SpriteEffects spriteEffects = SpriteEffects.None; @@ -1509,7 +1509,7 @@ namespace CalamityMod.Projectiles { if (projectile.owner == Main.myPlayer) { - if (Main.player[projectile.owner].GetCalamityPlayer().providenceLore && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) + if (Main.player[projectile.owner].Calamity().providenceLore && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int i = 0; i < 3; i++) @@ -1521,7 +1521,7 @@ namespace CalamityMod.Projectiles if (projectile.ranged) { - if (Main.player[projectile.owner].GetCalamityPlayer().tarraRanged && Main.rand.Next(0, 100) >= 88) + if (Main.player[projectile.owner].Calamity().tarraRanged && Main.rand.Next(0, 100) >= 88) { int num251 = Main.rand.Next(2, 4); for (int num252 = 0; num252 < num251; num252++) diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 8840096152..921178dd34 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Healing !player.inventory[player.selectedItem].melee && !player.inventory[player.selectedItem].ranged && !player.inventory[player.selectedItem].magic && - !player.inventory[player.selectedItem].GetGlobalItem(mod).rogue) || + !player.inventory[player.selectedItem].Calamity().rogue) || player.inventory[player.selectedItem].hammer > 0 || player.inventory[player.selectedItem].pick > 0 || player.inventory[player.selectedItem].axe > 0) diff --git a/Projectiles/Magic/AetherBeam.cs b/Projectiles/Magic/AetherBeam.cs index 257ddb1f00..d0a545fa6b 100644 --- a/Projectiles/Magic/AetherBeam.cs +++ b/Projectiles/Magic/AetherBeam.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; projectile.ai[1] = 0f; } - projectile.damage += projectile.GetGlobalProjectile(mod).defDamage / 200; + projectile.damage += projectile.Calamity().defDamage / 200; if (projectile.alpha > 0) { projectile.alpha -= 25; diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index 30096f88ee..79f95a631b 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; + Main.projectile[proj].Calamity().forceMagic = true; } } } diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/SolarBeam2.cs index 8330a37750..3c2bd6f6ac 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/SolarBeam2.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; + Main.projectile[proj].Calamity().forceMagic = true; } } } diff --git a/Projectiles/Melee/CosmicDischarge.cs b/Projectiles/Melee/CosmicDischarge.cs index f45bad78ba..4ec6f7b729 100644 --- a/Projectiles/Melee/CosmicDischarge.cs +++ b/Projectiles/Melee/CosmicDischarge.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index ad9fea509c..eee47471c6 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.Center.X,(int)projectile.Center.Y, 60, 0.6f); - + for (int i = 0; i <= 360; i += 3) { Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(i)); diff --git a/Projectiles/Melee/EradicatorMeleeProjectile.cs b/Projectiles/Melee/EradicatorMeleeProjectile.cs index 9302107bef..ec2822a842 100644 --- a/Projectiles/Melee/EradicatorMeleeProjectile.cs +++ b/Projectiles/Melee/EradicatorMeleeProjectile.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/FlameScytheProjectileMelee.cs b/Projectiles/Melee/FlameScytheProjectileMelee.cs index 8477665aa6..1652ec4856 100644 --- a/Projectiles/Melee/FlameScytheProjectileMelee.cs +++ b/Projectiles/Melee/FlameScytheProjectileMelee.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.owner == Main.myPlayer) { int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/Galaxia.cs b/Projectiles/Melee/Galaxia.cs index 1654c58354..88db2df466 100644 --- a/Projectiles/Melee/Galaxia.cs +++ b/Projectiles/Melee/Galaxia.cs @@ -163,7 +163,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(mod.BuffType("Plague"), 1200); player.AddBuff(BuffID.Thorns, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (snow) { @@ -176,20 +176,20 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(mod.BuffType("CrushDepth"), 1200); player.AddBuff(BuffID.Wet, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (corrupt) { player.AddBuff(BuffID.Wrath, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (crimson) { player.AddBuff(BuffID.Rage, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (dungeon) @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.Frostburn, 1200); player.AddBuff(BuffID.Dangersense, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (desert) @@ -205,40 +205,40 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Endurance, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (glow) { target.AddBuff(mod.BuffType("TemporalSadness"), 1200); player.AddBuff(BuffID.Spelunker, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (hell) { target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); player.AddBuff(BuffID.Inferno, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (holy) { target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Heartreach, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (nebula) { player.AddBuff(BuffID.MagicPower, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (stardust) { player.AddBuff(BuffID.Summoning, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (solar) @@ -250,7 +250,7 @@ namespace CalamityMod.Projectiles.Melee { player.AddBuff(BuffID.AmmoReservation, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else { diff --git a/Projectiles/Melee/Galaxia2.cs b/Projectiles/Melee/Galaxia2.cs index 0c5e4fa64d..c0400e9a67 100644 --- a/Projectiles/Melee/Galaxia2.cs +++ b/Projectiles/Melee/Galaxia2.cs @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(mod.BuffType("Plague"), 1200); player.AddBuff(BuffID.Thorns, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (snow) { @@ -175,20 +175,20 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(mod.BuffType("CrushDepth"), 1200); player.AddBuff(BuffID.Wet, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (corrupt) { player.AddBuff(BuffID.Wrath, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (crimson) { player.AddBuff(BuffID.Rage, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (dungeon) @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.Frostburn, 1200); player.AddBuff(BuffID.Dangersense, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (desert) @@ -204,40 +204,40 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Endurance, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (glow) { target.AddBuff(mod.BuffType("TemporalSadness"), 1200); player.AddBuff(BuffID.Spelunker, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (hell) { target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); player.AddBuff(BuffID.Inferno, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (holy) { target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Heartreach, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (nebula) { player.AddBuff(BuffID.MagicPower, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else if (stardust) { player.AddBuff(BuffID.Summoning, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].Calamity().forceMelee = true; Main.projectile[ball].penetrate = 1; } else if (solar) @@ -249,7 +249,7 @@ namespace CalamityMod.Projectiles.Melee { player.AddBuff(BuffID.AmmoReservation, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } else { diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index a60653b4fb..c507d5fabc 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Projectiles.Melee { offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile1].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[projectile1].Calamity().forceMelee = true; int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[projectile2].Calamity().forceMelee = true; } } for (int k = 0; k < 3; k++) diff --git a/Projectiles/Melee/Icebreaker.cs b/Projectiles/Melee/Icebreaker.cs index aba7682ceb..8737033f0a 100644 --- a/Projectiles/Melee/Icebreaker.cs +++ b/Projectiles/Melee/Icebreaker.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 120; diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 38d8eef270..f520cea869 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.owner == Main.myPlayer) { int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), (int)(350f * Main.player[projectile.owner].meleeDamage), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[projectile1].Calamity().forceMelee = true; Main.projectile[projectile1].aiStyle = 1; } projectile.localAI[0] = 0f; diff --git a/Projectiles/Melee/Mourningstar.cs b/Projectiles/Melee/Mourningstar.cs index 1b0ce6e37b..20ee67ea35 100644 --- a/Projectiles/Melee/Mourningstar.cs +++ b/Projectiles/Melee/Mourningstar.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Murasama.cs b/Projectiles/Melee/Murasama.cs index 24046f7ff8..744c0f682d 100644 --- a/Projectiles/Melee/Murasama.cs +++ b/Projectiles/Melee/Murasama.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 0; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Nebulash.cs b/Projectiles/Melee/Nebulash.cs index f0325f00ba..09b5bb52b1 100644 --- a/Projectiles/Melee/Nebulash.cs +++ b/Projectiles/Melee/Nebulash.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 2; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/OPHammerMelee.cs b/Projectiles/Melee/OPHammerMelee.cs index 22a7fb7903..0783adcb2d 100644 --- a/Projectiles/Melee/OPHammerMelee.cs +++ b/Projectiles/Melee/OPHammerMelee.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.owner == Main.myPlayer) { int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; } } diff --git a/Projectiles/Melee/ScourgeoftheCosmos.cs b/Projectiles/Melee/ScourgeoftheCosmos.cs index 0197a0548c..6c68953520 100644 --- a/Projectiles/Melee/ScourgeoftheCosmos.cs +++ b/Projectiles/Melee/ScourgeoftheCosmos.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } if (projectile.alpha <= 200) { diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index 798aef1835..0f865c333a 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } if (projectile.alpha > 0) { diff --git a/Projectiles/Melee/Spears/AstralPike.cs b/Projectiles/Melee/Spears/AstralPike.cs index 92dcdbe712..2f83ff8b75 100644 --- a/Projectiles/Melee/Spears/AstralPike.cs +++ b/Projectiles/Melee/Spears/AstralPike.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee.Spears if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstralStar"), (int)((double)projectile.damage * 0.2), 1f, projectile.owner); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/Spears/Brimlance.cs b/Projectiles/Melee/Spears/Brimlance.cs index 1f05ef0a71..1b75355d80 100644 --- a/Projectiles/Melee/Spears/Brimlance.cs +++ b/Projectiles/Melee/Spears/Brimlance.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Spears/DiseasedPike.cs b/Projectiles/Melee/Spears/DiseasedPike.cs index 110a1161c9..b99759a8e7 100644 --- a/Projectiles/Melee/Spears/DiseasedPike.cs +++ b/Projectiles/Melee/Spears/DiseasedPike.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Spears/EarthenPike.cs b/Projectiles/Melee/Spears/EarthenPike.cs index 2e09aa3c58..688919d689 100644 --- a/Projectiles/Melee/Spears/EarthenPike.cs +++ b/Projectiles/Melee/Spears/EarthenPike.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee.Spears } int proj = Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 1.25f, velocityY, mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index 8cfe6c2218..8cc003866f 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee.Spears if (projectile.owner == Main.myPlayer) { int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; } if (crit) { diff --git a/Projectiles/Melee/Spears/FulgurationHalberd.cs b/Projectiles/Melee/Spears/FulgurationHalberd.cs index 9fd3853dea..77b11325c8 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberd.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberd.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Spears/GildedProboscis.cs b/Projectiles/Melee/Spears/GildedProboscis.cs index ae1c18b957..45db44b686 100644 --- a/Projectiles/Melee/Spears/GildedProboscis.cs +++ b/Projectiles/Melee/Spears/GildedProboscis.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Spears/HeartRapierProjectile.cs b/Projectiles/Melee/Spears/HeartRapierProjectile.cs index ee611a57ae..8e5dd2e112 100644 --- a/Projectiles/Melee/Spears/HeartRapierProjectile.cs +++ b/Projectiles/Melee/Spears/HeartRapierProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index c01f854f6c..4e07efff21 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Spears/SausageMaker.cs b/Projectiles/Melee/Spears/SausageMaker.cs index 63c916102a..cba23a73b1 100644 --- a/Projectiles/Melee/Spears/SausageMaker.cs +++ b/Projectiles/Melee/Spears/SausageMaker.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Tumbleweed.cs b/Projectiles/Melee/Tumbleweed.cs index b91de5838b..ca78ec40b7 100644 --- a/Projectiles/Melee/Tumbleweed.cs +++ b/Projectiles/Melee/Tumbleweed.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.melee = true; projectile.alpha = 255; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs index a64ce0db07..b546bcc0a2 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[boom].Calamity().forceMelee = true; } } diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs index 3d2cc9bcf2..fad047f0ef 100644 --- a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs +++ b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Seashell"), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[projectile2].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs index 29984d9120..12d7d12fb7 100644 --- a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs +++ b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs @@ -36,21 +36,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Main.rand.NextBool(10)) { proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } if (Main.rand.NextBool(30)) { proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 570, (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } if (Main.rand.NextBool(50)) { proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, 571, (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs index 5efe8a671f..4857224b74 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 92, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 7fe79731a8..660d822474 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs index 3d7619b29c..da525c2bec 100644 --- a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ProjectileID.SlimeGun, (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[projectile2].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/Yoyos/TheObliterator.cs b/Projectiles/Melee/Yoyos/TheObliterator.cs index e733e9e91f..6ac9e162a3 100644 --- a/Projectiles/Melee/Yoyos/TheObliterator.cs +++ b/Projectiles/Melee/Yoyos/TheObliterator.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.cs b/Projectiles/Melee/Yoyos/VerdantProjectile.cs index f7fdda6b10..8c63bfad6b 100644 --- a/Projectiles/Melee/Yoyos/VerdantProjectile.cs +++ b/Projectiles/Melee/Yoyos/VerdantProjectile.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 227, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[proj].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Patreon/Akato.cs b/Projectiles/Patreon/Akato.cs index 37d5015e01..7e5c41d66d 100644 --- a/Projectiles/Patreon/Akato.cs +++ b/Projectiles/Patreon/Akato.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.akato = false; diff --git a/Projectiles/Patreon/CorpusAvertor.cs b/Projectiles/Patreon/CorpusAvertor.cs index c68da9692f..b4ac6a95c1 100644 --- a/Projectiles/Patreon/CorpusAvertor.cs +++ b/Projectiles/Patreon/CorpusAvertor.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Patreon if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; diff --git a/Projectiles/Patreon/CorpusAvertorClone.cs b/Projectiles/Patreon/CorpusAvertorClone.cs index 381dc43aae..7ac14dc078 100644 --- a/Projectiles/Patreon/CorpusAvertorClone.cs +++ b/Projectiles/Patreon/CorpusAvertorClone.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Patreon if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; diff --git a/Projectiles/Patreon/DeepSeaDumbbell1.cs b/Projectiles/Patreon/DeepSeaDumbbell1.cs index ae894b96b0..8e01a35747 100644 --- a/Projectiles/Patreon/DeepSeaDumbbell1.cs +++ b/Projectiles/Patreon/DeepSeaDumbbell1.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.width = 26; projectile.height = 26; projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.penetrate = 1; } diff --git a/Projectiles/Patreon/DeepSeaDumbbell2.cs b/Projectiles/Patreon/DeepSeaDumbbell2.cs index f5b5a84abf..9c6151b4e6 100644 --- a/Projectiles/Patreon/DeepSeaDumbbell2.cs +++ b/Projectiles/Patreon/DeepSeaDumbbell2.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.width = 26; projectile.height = 26; projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.penetrate = 1; } diff --git a/Projectiles/Patreon/DeepSeaDumbbell3.cs b/Projectiles/Patreon/DeepSeaDumbbell3.cs index 1c8b655ef3..39a168bccc 100644 --- a/Projectiles/Patreon/DeepSeaDumbbell3.cs +++ b/Projectiles/Patreon/DeepSeaDumbbell3.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.width = 26; projectile.height = 26; projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.penetrate = 1; } diff --git a/Projectiles/Patreon/DeepSeaDumbbellWeight.cs b/Projectiles/Patreon/DeepSeaDumbbellWeight.cs index d8f8bbb1b1..b1d168f5fd 100644 --- a/Projectiles/Patreon/DeepSeaDumbbellWeight.cs +++ b/Projectiles/Patreon/DeepSeaDumbbellWeight.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.width = 14; projectile.height = 14; projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.penetrate = 1; } diff --git a/Projectiles/Patreon/DevilsSunrise.cs b/Projectiles/Patreon/DevilsSunrise.cs index 3aa2ceb3e2..b8bdc53211 100644 --- a/Projectiles/Patreon/DevilsSunrise.cs +++ b/Projectiles/Patreon/DevilsSunrise.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.ai[1] += 1f; if (projectile.ai[1] == 255f) - projectile.damage = (int)((double)projectile.GetGlobalProjectile(mod).defDamage * 2.0); + projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); red = 64 + (int)(projectile.ai[1] * 0.75f); if (red > 255) diff --git a/Projectiles/Patreon/DevilsSunriseCyclone.cs b/Projectiles/Patreon/DevilsSunriseCyclone.cs index 43256e6f57..566ed2f4a4 100644 --- a/Projectiles/Patreon/DevilsSunriseCyclone.cs +++ b/Projectiles/Patreon/DevilsSunriseCyclone.cs @@ -41,12 +41,12 @@ namespace CalamityMod.Projectiles.Patreon if (!Main.player[projectile.owner].channel) { projectile.ai[1] = -1f; - projectile.damage = projectile.GetGlobalProjectile(mod).defDamage; + projectile.damage = projectile.Calamity().defDamage; } } if (projectile.ai[1] >= 255f) - projectile.damage = (int)((double)projectile.GetGlobalProjectile(mod).defDamage * 2.0); + projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); red = 64 + (int)(projectile.ai[1] * 0.75f); if (red > 255) diff --git a/Projectiles/Patreon/KelvinCatalyst.cs b/Projectiles/Patreon/KelvinCatalyst.cs index d7a3f5eec8..8d3933a9da 100644 --- a/Projectiles/Patreon/KelvinCatalyst.cs +++ b/Projectiles/Patreon/KelvinCatalyst.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Patreon if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } if (projectile.soundDelay == 0) diff --git a/Projectiles/Patreon/MiniGuardianAttack.cs b/Projectiles/Patreon/MiniGuardianAttack.cs index 30d8ed9755..4c7d0266c9 100644 --- a/Projectiles/Patreon/MiniGuardianAttack.cs +++ b/Projectiles/Patreon/MiniGuardianAttack.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Patreon public override void AI() { Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.gOffense = false; diff --git a/Projectiles/Patreon/MiniGuardianDefense.cs b/Projectiles/Patreon/MiniGuardianDefense.cs index d77ea160ab..8cf1feb79a 100644 --- a/Projectiles/Patreon/MiniGuardianDefense.cs +++ b/Projectiles/Patreon/MiniGuardianDefense.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Patreon public override void AI() { Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.gDefense = false; diff --git a/Projectiles/Patreon/MiniGuardianHealer.cs b/Projectiles/Patreon/MiniGuardianHealer.cs index be97e57ee9..10611f8542 100644 --- a/Projectiles/Patreon/MiniGuardianHealer.cs +++ b/Projectiles/Patreon/MiniGuardianHealer.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Patreon public override void AI() { Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.gHealer = false; diff --git a/Projectiles/Patreon/PerforaMini.cs b/Projectiles/Patreon/PerforaMini.cs index 4aba8bab62..10582748f6 100644 --- a/Projectiles/Patreon/PerforaMini.cs +++ b/Projectiles/Patreon/PerforaMini.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.Kill(); } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.perfmini = false; diff --git a/Projectiles/Patreon/PinkButterfly.cs b/Projectiles/Patreon/PinkButterfly.cs index 85fbcc34dc..bafe4fc126 100644 --- a/Projectiles/Patreon/PinkButterfly.cs +++ b/Projectiles/Patreon/PinkButterfly.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Patreon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -50,10 +50,10 @@ namespace CalamityMod.Projectiles.Patreon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Patreon float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("PinkButterfly"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("ResurrectionButterflyBuff"), 3600); if (flag64) { diff --git a/Projectiles/Patreon/PlagueBee.cs b/Projectiles/Patreon/PlagueBee.cs index 4c97d18762..6b35ce8825 100644 --- a/Projectiles/Patreon/PlagueBee.cs +++ b/Projectiles/Patreon/PlagueBee.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.penetrate = 2; projectile.timeLeft = 420; projectile.ignoreWater = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Patreon/Plaguenade.cs b/Projectiles/Patreon/Plaguenade.cs index a5b8913a79..d0c61af029 100644 --- a/Projectiles/Patreon/Plaguenade.cs +++ b/Projectiles/Patreon/Plaguenade.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.penetrate = 1; projectile.extraUpdates = 1; projectile.timeLeft = 180; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Patreon/PurpleButterfly.cs b/Projectiles/Patreon/PurpleButterfly.cs index 74ed8b3bfa..20a6c17ca6 100644 --- a/Projectiles/Patreon/PurpleButterfly.cs +++ b/Projectiles/Patreon/PurpleButterfly.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Patreon { if (dust > 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Patreon } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Patreon float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("PurpleButterfly"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("ResurrectionButterflyBuff"), 3600); if (flag64) { diff --git a/Projectiles/Patreon/TimeBolt.cs b/Projectiles/Patreon/TimeBolt.cs index 8938a54044..9be93e142e 100644 --- a/Projectiles/Patreon/TimeBolt.cs +++ b/Projectiles/Patreon/TimeBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.friendly = true; projectile.penetrate = penetrationAmt; projectile.timeLeft = 600; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; } diff --git a/Projectiles/Patreon/YateveoBloom.cs b/Projectiles/Patreon/YateveoBloom.cs index ef5eb51de8..fef315698b 100644 --- a/Projectiles/Patreon/YateveoBloom.cs +++ b/Projectiles/Patreon/YateveoBloom.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.penetrate = -1; projectile.melee = true; projectile.alpha = 255; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Patreon/YateveoBloomSpear.cs b/Projectiles/Patreon/YateveoBloomSpear.cs index c7d32250fa..de3105ab17 100644 --- a/Projectiles/Patreon/YateveoBloomSpear.cs +++ b/Projectiles/Patreon/YateveoBloomSpear.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Permafrost/FrostShardFriendly.cs b/Projectiles/Permafrost/FrostShardFriendly.cs index 695b12af17..e03fefcc68 100644 --- a/Projectiles/Permafrost/FrostShardFriendly.cs +++ b/Projectiles/Permafrost/FrostShardFriendly.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Permafrost projectile.friendly = true; projectile.minion = true; projectile.penetrate = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void SetStaticDefaults() diff --git a/Projectiles/Permafrost/FrostyFlare.cs b/Projectiles/Permafrost/FrostyFlare.cs index 3fb991c950..42a40ec5e5 100644 --- a/Projectiles/Permafrost/FrostyFlare.cs +++ b/Projectiles/Permafrost/FrostyFlare.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Permafrost projectile.friendly = true; projectile.penetrate = -1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void SetStaticDefaults() diff --git a/Projectiles/Permafrost/IceSentry.cs b/Projectiles/Permafrost/IceSentry.cs index 80d69983cc..9184e0e86b 100644 --- a/Projectiles/Permafrost/IceSentry.cs +++ b/Projectiles/Permafrost/IceSentry.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Permafrost { if (setDamage) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; setDamage = false; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index eea739153c..63344e9c0c 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.bearPet = false; diff --git a/Projectiles/Pets/Brimling.cs b/Projectiles/Pets/Brimling.cs index 46c7232054..df659dec09 100644 --- a/Projectiles/Pets/Brimling.cs +++ b/Projectiles/Pets/Brimling.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.brimling = false; diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 03399539aa..e22876a95b 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Pets projectile.type = trueType; //asserts real type after running black Cat AI 26 (ensures chibii pet isnt drawn as black cat and other weird stuff) Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.chibii = false; diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index de8eeb3db4..e3ac773ade 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - if (Main.player[projectile.owner].GetCalamityPlayer().chibii) + if (Main.player[projectile.owner].Calamity().chibii) projectile.timeLeft = 2; int byUuid = (int) projectile.ai[0]; //contains identity of parent projectile in main.projectile array diff --git a/Projectiles/Pets/DannyDevito.cs b/Projectiles/Pets/DannyDevito.cs index 05d7e3dcc5..81602dccad 100644 --- a/Projectiles/Pets/DannyDevito.cs +++ b/Projectiles/Pets/DannyDevito.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.trashMan = false; diff --git a/Projectiles/Pets/Fox.cs b/Projectiles/Pets/Fox.cs index f9190ef007..f55fecde78 100644 --- a/Projectiles/Pets/Fox.cs +++ b/Projectiles/Pets/Fox.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.fox = false; diff --git a/Projectiles/Pets/Kendra.cs b/Projectiles/Pets/Kendra.cs index f438372de5..2f27b65b3e 100644 --- a/Projectiles/Pets/Kendra.cs +++ b/Projectiles/Pets/Kendra.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.kendra = false; diff --git a/Projectiles/Pets/Levi.cs b/Projectiles/Pets/Levi.cs index c492115e7d..0ab65216f3 100644 --- a/Projectiles/Pets/Levi.cs +++ b/Projectiles/Pets/Levi.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.leviPet = false; diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index 596dc6c5cf..78557d8391 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.sirenPet = false; diff --git a/Projectiles/Pets/ThirdSage.cs b/Projectiles/Pets/ThirdSage.cs index 1dab212859..9d67718d1d 100644 --- a/Projectiles/Pets/ThirdSage.cs +++ b/Projectiles/Pets/ThirdSage.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Pets projectile.active = false; return; } - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { modPlayer.thirdSage = false; diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 4214319284..9a6fb26b5d 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 4), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num520].Calamity().forceRanged = true; } } } diff --git a/Projectiles/Ranged/DragonBurst.cs b/Projectiles/Ranged/DragonBurst.cs index 9a760b8ef2..7515c8cb6c 100644 --- a/Projectiles/Ranged/DragonBurst.cs +++ b/Projectiles/Ranged/DragonBurst.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[proj].Calamity().forceRanged = true; } } diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index a23e331f0b..67f36988da 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector3 = projectile.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); Vector2 speed = projectile.Center - vector3; speed /= 30f; - Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, mod.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); Projectile.NewProjectile(projectile.Center, Vector2.Zero, DragonDust, projectile.damage / 3, projectile.knockBack * 2f, projectile.owner); } diff --git a/Projectiles/Ranged/ExplodingStake.cs b/Projectiles/Ranged/ExplodingStake.cs index 589334b9dd..7d6ecaab8d 100644 --- a/Projectiles/Ranged/ExplodingStake.cs +++ b/Projectiles/Ranged/ExplodingStake.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.owner == Main.myPlayer) { int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[boom].Calamity().forceRanged = true; } } diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index fe4f54fd0a..a7b61e4304 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num520].Calamity().forceRanged = true; } } } diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index f8f8e1c346..90fa13af95 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num520].Calamity().forceRanged = true; } } } diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index eaedc604e9..994c96fa44 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num520].Calamity().forceRanged = true; } } } diff --git a/Projectiles/Ranged/HolyFireBullet.cs b/Projectiles/Ranged/HolyFireBullet.cs index 02f53dc92c..902b08d971 100644 --- a/Projectiles/Ranged/HolyFireBullet.cs +++ b/Projectiles/Ranged/HolyFireBullet.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((double)projectile.damage * 0.85), projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[proj].Calamity().forceRanged = true; } for (int k = 0; k < 10; k++) { diff --git a/Projectiles/Ranged/NebulaShot.cs b/Projectiles/Ranged/NebulaShot.cs index b9c9f7bd65..571bd12afb 100644 --- a/Projectiles/Ranged/NebulaShot.cs +++ b/Projectiles/Ranged/NebulaShot.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Projectiles.Ranged // Force damage type based on AI variable (this is outdated code and the weapons themselves should set the force variables) if (projectile.ai[0] == 1f) - projectile.GetGlobalProjectile(mod).forceMelee = true; + projectile.Calamity().forceMelee = true; else if (projectile.ai[0] == 2f) - projectile.GetGlobalProjectile(mod).forceRogue = true; + projectile.Calamity().forceRogue = true; if (projectile.alpha > 0) { diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index a88eba9b46..1bd64640d8 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged num518 += projectile.oldVelocity.X / 6f; num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num520].Calamity().forceRanged = true; Main.projectile[num520].penetrate = 2; } } diff --git a/Projectiles/Ranged/StarfleetMK2.cs b/Projectiles/Ranged/StarfleetMK2.cs index 43b499b60a..701e01e6ae 100644 --- a/Projectiles/Ranged/StarfleetMK2.cs +++ b/Projectiles/Ranged/StarfleetMK2.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); Main.projectile[star].penetrate = 1; Main.projectile[star].timeLeft = 300; - Main.projectile[star].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[star].Calamity().forceRanged = true; Main.projectile[star].netUpdate = true; projectile.netUpdate = true; } diff --git a/Projectiles/Rogue/AccretionDisk.cs b/Projectiles/Rogue/AccretionDisk.cs index 81e9aeb1be..b4157a16d3 100644 --- a/Projectiles/Rogue/AccretionDisk.cs +++ b/Projectiles/Rogue/AccretionDisk.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 400; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs index 701fd93f90..6574a74365 100644 --- a/Projectiles/Rogue/AccretionDisk2.cs +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 60; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index 04bf236111..921f5796ed 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 3; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/BallisticPoisonBomb.cs b/Projectiles/Rogue/BallisticPoisonBomb.cs index 76e2baac18..b54ffe019c 100644 --- a/Projectiles/Rogue/BallisticPoisonBomb.cs +++ b/Projectiles/Rogue/BallisticPoisonBomb.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.timeLeft = 200; projectile.tileCollide = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index 2ad71882fc..ae0dc54554 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 2; projectile.aiStyle = 93; aiType = 514; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/BarrelShrapnel.cs b/Projectiles/Rogue/BarrelShrapnel.cs index df7733a1a5..2840269c74 100644 --- a/Projectiles/Rogue/BarrelShrapnel.cs +++ b/Projectiles/Rogue/BarrelShrapnel.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.timeLeft = 160; projectile.tileCollide = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 40863198e3..243b7e0962 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -26,14 +26,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = -1; projectile.timeLeft = 480; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } //Jesus christ, why isn't this in the Entity class instead of just NPC??? //Negative check is so that it doesn't register a bounce as a collision public bool collideX => projectile.oldPosition.X == projectile.position.X; public override void AI() { - bool stealthS = projectile.GetCalamityProj().stealthStrike; + bool stealthS = projectile.Calamity().stealthStrike; if (projectile.localAI[0] == 0f) { projectile.ai[1] = stealthS.ToInt() == 0 ? 1 : 3; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) => false; public void BounceEffects() { - bool stealthS = projectile.GetCalamityProj().stealthStrike; + bool stealthS = projectile.Calamity().stealthStrike; int projectileCount = 12; Main.PlaySound(2, projectile.Center, 14); //aka can bounce multiple times @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), BlastBarrel.BaseDamage, 1f, projectile.owner); Main.projectile[fireIndex].thrown = false; - Main.projectile[fireIndex].GetGlobalProjectile(mod).rogue = true; + Main.projectile[fireIndex].Calamity().rogue = true; } } projectile.ai[1]--; diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 92667aca1d..b3d4f4f419 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; //10 seconds and counting aiType = 48; //Throwing Knife AI - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.usesIDStaticNPCImmunity = true; //afaik, no Calamity projectiles use this and only 1 vanilla projectile projectile.idStaticNPCHitCooldown = 5; projectile.extraUpdates = 1; @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer && grind >= 1) //stealth strike attack { int stealth = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Blood"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[stealth].GetGlobalProjectile(mod).forceRogue = true; + Main.projectile[stealth].Calamity().forceRogue = true; } if (!target.canGhostHeal) //canGhostHeal be like lol { diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index ce2419e7e9..b4e8556a58 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = true; projectile.timeLeft = 300; projectile.penetrate = 2; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index 87f7cc7c6b..85ff1b9623 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = true; projectile.timeLeft = 280; projectile.penetrate = -1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/BrackishFlask.cs b/Projectiles/Rogue/BrackishFlask.cs index 1b46431e8b..a6a75b04b0 100644 --- a/Projectiles/Rogue/BrackishFlask.cs +++ b/Projectiles/Rogue/BrackishFlask.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 180; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index 94d7c293d5..8bc5b17234 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.penetrate = 1; projectile.timeLeft = 60; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index ceb2f45e16..85d3419afa 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 60; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 09e933a1e9..04a0f2f749 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 19; projectile.height = 19; projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue } //Spawn the projectile - Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, mod.ProjectileType(), (int)(projectile.damage * 0.3), 2f, projectile.owner); + Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 2f, projectile.owner); split += 1; } } diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index 0f60d23fc7..6786470d7c 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.width = 13; projectile.height = 13; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() { diff --git a/Projectiles/Rogue/Brimblade.cs b/Projectiles/Rogue/Brimblade.cs index e2a31c1bae..6b2cadab9d 100644 --- a/Projectiles/Rogue/Brimblade.cs +++ b/Projectiles/Rogue/Brimblade.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/Brimblade2.cs b/Projectiles/Rogue/Brimblade2.cs index 42269c9bba..058b961525 100644 --- a/Projectiles/Rogue/Brimblade2.cs +++ b/Projectiles/Rogue/Brimblade2.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index eea33c43ef..0426123a64 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = -1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 60; diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index af5afc485e..5b5d73ddfa 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30; } diff --git a/Projectiles/Rogue/Celestus.cs b/Projectiles/Rogue/Celestus.cs index 6e52df09d8..a325951b02 100644 --- a/Projectiles/Rogue/Celestus.cs +++ b/Projectiles/Rogue/Celestus.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index d78710c6ba..90928142f3 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 40; projectile.timeLeft = 85; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 09fede144f..2e9c2b4f7e 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 2; projectile.tileCollide = false; projectile.extraUpdates = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index b35b43f538..8b5612166f 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/CosmicKunai.cs b/Projectiles/Rogue/CosmicKunai.cs index 7c8ebb643d..09c0ccf4aa 100644 --- a/Projectiles/Rogue/CosmicKunai.cs +++ b/Projectiles/Rogue/CosmicKunai.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.tileCollide = false; projectile.penetrate = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/CraniumSmasher.cs b/Projectiles/Rogue/CraniumSmasher.cs index 6a43b57d4c..6f20aa7028 100644 --- a/Projectiles/Rogue/CraniumSmasher.cs +++ b/Projectiles/Rogue/CraniumSmasher.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; projectile.tileCollide = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 905d50b413..91cfa8f538 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 300; projectile.localNPCHitCooldown = 15; projectile.tileCollide = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 3f41834b35..5c56a7f114 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 300; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 2fed9b66ff..1976cb1ff1 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Crystalline.cs b/Projectiles/Rogue/Crystalline.cs index def79fd719..00602a8e26 100644 --- a/Projectiles/Rogue/Crystalline.cs +++ b/Projectiles/Rogue/Crystalline.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 120; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index 7cd9a4624e..e4114935bc 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 30; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/CursedDagger.cs b/Projectiles/Rogue/CursedDagger.cs index 910f96ce2b..7134e1f7f1 100644 --- a/Projectiles/Rogue/CursedDagger.cs +++ b/Projectiles/Rogue/CursedDagger.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 210471850f..519e7b04b2 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.ignoreWater = true; projectile.timeLeft = 3600; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/DuststormInABottle.cs b/Projectiles/Rogue/DuststormInABottle.cs index 608872ea96..7d58f6f967 100644 --- a/Projectiles/Rogue/DuststormInABottle.cs +++ b/Projectiles/Rogue/DuststormInABottle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 180; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index 425511c88c..dc9bed25e4 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 1; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index 2c083f7e7b..3fa11cbd47 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.timeLeft = 300; projectile.extraUpdates = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 27c71c199c..9773437aac 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/EmpyreanKnives.cs b/Projectiles/Rogue/EmpyreanKnives.cs index 77c465e455..08c95297bb 100644 --- a/Projectiles/Rogue/EmpyreanKnives.cs +++ b/Projectiles/Rogue/EmpyreanKnives.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } projectile.ai[0] += 1f; if (projectile.ai[0] >= 75f) diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index b653e59273..492eca0ccb 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue aiType = 52; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + Main.projectile[proj].Calamity().forceRogue = true; } } } diff --git a/Projectiles/Rogue/ExecutionersBlade.cs b/Projectiles/Rogue/ExecutionersBlade.cs index f17708b868..81841430b8 100644 --- a/Projectiles/Rogue/ExecutionersBlade.cs +++ b/Projectiles/Rogue/ExecutionersBlade.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 240; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 84dbf49285..dc920400c4 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/FlameScytheProjectile.cs b/Projectiles/Rogue/FlameScytheProjectile.cs index a9ec2eae4c..192c22189b 100644 --- a/Projectiles/Rogue/FlameScytheProjectile.cs +++ b/Projectiles/Rogue/FlameScytheProjectile.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; projectile.alpha = 55; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + Main.projectile[proj].Calamity().forceRogue = true; } } } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 82e9fa417d..bc092c50b1 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index bfeaae0084..34df455317 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 1; projectile.timeLeft = 90; aiType = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 05b2b63e80..858959518a 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/GhoulishGouger.cs b/Projectiles/Rogue/GhoulishGouger.cs index b36f80b549..fd8cc7eb82 100644 --- a/Projectiles/Rogue/GhoulishGouger.cs +++ b/Projectiles/Rogue/GhoulishGouger.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 4; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 2; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index 8ac7d7dacb..4b3c40732b 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 3; projectile.timeLeft = Lifetime; drawOffsetX = -10; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index c5cd4aad55..181d201c2c 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 280; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/IchorSpear.cs b/Projectiles/Rogue/IchorSpear.cs index 5bd99fc14e..46dfd24f0d 100644 --- a/Projectiles/Rogue/IchorSpear.cs +++ b/Projectiles/Rogue/IchorSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/IchorSpear2.cs b/Projectiles/Rogue/IchorSpear2.cs index 216ba92003..109f1dad9d 100644 --- a/Projectiles/Rogue/IchorSpear2.cs +++ b/Projectiles/Rogue/IchorSpear2.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index 47467a6a1f..568f0d32b5 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Lionfish.cs b/Projectiles/Rogue/Lionfish.cs index da5e1dedaa..65c11115d8 100644 --- a/Projectiles/Rogue/Lionfish.cs +++ b/Projectiles/Rogue/Lionfish.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.penetrate = -1; projectile.alpha = 255; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Malachite.cs b/Projectiles/Rogue/Malachite.cs index eb01d86130..048b5613f3 100644 --- a/Projectiles/Rogue/Malachite.cs +++ b/Projectiles/Rogue/Malachite.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue aiType = 514; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index 3954adc1a9..1d0c94fb32 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 10; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index 0b3b3c805f..ddbbe98cea 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 600; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/MeteorFist.cs b/Projectiles/Rogue/MeteorFist.cs index af5ab65cdf..75fd3c73bb 100644 --- a/Projectiles/Rogue/MeteorFist.cs +++ b/Projectiles/Rogue/MeteorFist.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 180; - projectile.GetCalamityProj().rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/MoltenAmputator.cs b/Projectiles/Rogue/MoltenAmputator.cs index 4e1131b22e..11105cfe1f 100644 --- a/Projectiles/Rogue/MoltenAmputator.cs +++ b/Projectiles/Rogue/MoltenAmputator.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index dbc9172e20..ace7351982 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index 392144ec33..16da3ec20a 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue drawOriginOffsetY = 0; drawOriginOffsetX = 0; projectile.extraUpdates = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue //Randomly not consume item if it wasnt a stealth strike if (Main.rand.Next(4) == 0 && projectile.ai[0] != 1) { - Item.NewItem((int)projectile.position.X,(int) projectile.position.Y, 27, 27, mod.ItemType() ); + Item.NewItem((int)projectile.position.X,(int) projectile.position.Y, 27, 27, ModContent.ItemType() ); } } diff --git a/Projectiles/Rogue/Mycoroot.cs b/Projectiles/Rogue/Mycoroot.cs index 833af2e073..56a335746b 100644 --- a/Projectiles/Rogue/Mycoroot.cs +++ b/Projectiles/Rogue/Mycoroot.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 12; projectile.friendly = true; projectile.penetrate = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index d8a4c64d16..97c2863317 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/OPHammer.cs b/Projectiles/Rogue/OPHammer.cs index 41efc251d1..48ea16ef7a 100644 --- a/Projectiles/Rogue/OPHammer.cs +++ b/Projectiles/Rogue/OPHammer.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = -1; projectile.extraUpdates = 2; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + Main.projectile[proj].Calamity().forceRogue = true; } } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index 549e799237..50bb26b31a 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 6; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index 8ae7a9ebcb..c1ab2acddb 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ProfanedTrident.cs b/Projectiles/Rogue/ProfanedTrident.cs index a98a2629f8..794cb5f15e 100644 --- a/Projectiles/Rogue/ProfanedTrident.cs +++ b/Projectiles/Rogue/ProfanedTrident.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Pwnagehammer.cs b/Projectiles/Rogue/Pwnagehammer.cs index 2f3160616e..cbb60ef4d9 100644 --- a/Projectiles/Rogue/Pwnagehammer.cs +++ b/Projectiles/Rogue/Pwnagehammer.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 120; projectile.extraUpdates = 3; aiType = 301; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 003aa3bf92..28e1f6ee6c 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/RoyalKnife.cs b/Projectiles/Rogue/RoyalKnife.cs index 42609f3844..28ebb4e5df 100644 --- a/Projectiles/Rogue/RoyalKnife.cs +++ b/Projectiles/Rogue/RoyalKnife.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index 7a421f69cf..d7ebb504ee 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 30; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index 5d9fa8aaf6..bc489173c7 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 140; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 330f0adde8..313e230e1c 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -28,19 +28,19 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.timeLeft = 300; projectile.extraUpdates = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } - + public override void AI() { - CalamityPlayer modPlayer = Main.player[Main.myPlayer].GetCalamityPlayer(); + CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 130, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.85f); projectile.ai[0] += 1f; if (projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) { - projectile.GetCalamityProj().stealthStrike = true; + projectile.Calamity().stealthStrike = true; lifesteal = true; } if ((projectile.ai[0] %= 5f) == 0f) diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index 0316c517ee..63bdbdcdd9 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScourgeoftheDesert.cs b/Projectiles/Rogue/ScourgeoftheDesert.cs index 6c4ef3c1ea..cce72a54e5 100644 --- a/Projectiles/Rogue/ScourgeoftheDesert.cs +++ b/Projectiles/Rogue/ScourgeoftheDesert.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; aiType = 598; projectile.penetrate = 3; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScourgeoftheDesert2.cs b/Projectiles/Rogue/ScourgeoftheDesert2.cs index 54c6e44480..130194b47b 100644 --- a/Projectiles/Rogue/ScourgeoftheDesert2.cs +++ b/Projectiles/Rogue/ScourgeoftheDesert2.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 26; projectile.friendly = true; projectile.penetrate = 6; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index b99e150e4d..aee44bd1c3 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.extraUpdates = 1; projectile.timeLeft = 1200; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs index 461bc85be5..b69d070557 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.extraUpdates = 1; projectile.timeLeft = 1200; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 60; } diff --git a/Projectiles/Rogue/SeashellBoomerangProjectile.cs b/Projectiles/Rogue/SeashellBoomerangProjectile.cs index 8524e0a4bf..bc4d4d5050 100644 --- a/Projectiles/Rogue/SeashellBoomerangProjectile.cs +++ b/Projectiles/Rogue/SeashellBoomerangProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 240; aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } } } diff --git a/Projectiles/Rogue/ShatteredExplosion.cs b/Projectiles/Rogue/ShatteredExplosion.cs index 7954a5eaaa..4f147078b5 100644 --- a/Projectiles/Rogue/ShatteredExplosion.cs +++ b/Projectiles/Rogue/ShatteredExplosion.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 15; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ShatteredSun.cs b/Projectiles/Rogue/ShatteredSun.cs index 2ff0e44f23..8f16087dbe 100644 --- a/Projectiles/Rogue/ShatteredSun.cs +++ b/Projectiles/Rogue/ShatteredSun.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ShatteredSun2.cs b/Projectiles/Rogue/ShatteredSun2.cs index 29707b916a..0c4f54167d 100644 --- a/Projectiles/Rogue/ShatteredSun2.cs +++ b/Projectiles/Rogue/ShatteredSun2.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ShatteredSun3.cs b/Projectiles/Rogue/ShatteredSun3.cs index 1000a2ad5c..492c035336 100644 --- a/Projectiles/Rogue/ShatteredSun3.cs +++ b/Projectiles/Rogue/ShatteredSun3.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/SpearofPaleolith.cs b/Projectiles/Rogue/SpearofPaleolith.cs index 5fe9098d7c..718eebde28 100644 --- a/Projectiles/Rogue/SpearofPaleolith.cs +++ b/Projectiles/Rogue/SpearofPaleolith.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Stormfrontproj.cs b/Projectiles/Rogue/Stormfrontproj.cs index 0a3c986aeb..da18a6e87d 100644 --- a/Projectiles/Rogue/Stormfrontproj.cs +++ b/Projectiles/Rogue/Stormfrontproj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 5; projectile.timeLeft = 300; projectile.extraUpdates = 1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index 4761d6bebb..1f13886678 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 12; projectile.timeLeft = 240; projectile.penetrate = -1; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index f572bec3b4..8ecd1e4e2f 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 33a3cbc39b..defcad7d6d 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 26b4b1fee5..5fc85287ff 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/TriactisOPHammer.cs b/Projectiles/Rogue/TriactisOPHammer.cs index af145fd12a..911eb0975d 100644 --- a/Projectiles/Rogue/TriactisOPHammer.cs +++ b/Projectiles/Rogue/TriactisOPHammer.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = -1; projectile.extraUpdates = 3; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/UrchinStinger.cs b/Projectiles/Rogue/UrchinStinger.cs index fa74aee6dc..404c57d909 100644 --- a/Projectiles/Rogue/UrchinStinger.cs +++ b/Projectiles/Rogue/UrchinStinger.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/Valediction.cs b/Projectiles/Rogue/Valediction.cs index 145ee9f235..eed74aac7c 100644 --- a/Projectiles/Rogue/Valediction.cs +++ b/Projectiles/Rogue/Valediction.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/Valediction2.cs b/Projectiles/Rogue/Valediction2.cs index 2a7452244f..66ec5dc524 100644 --- a/Projectiles/Rogue/Valediction2.cs +++ b/Projectiles/Rogue/Valediction2.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/WulfrumKnife.cs b/Projectiles/Rogue/WulfrumKnife.cs index 410a7b0a03..c57f765f42 100644 --- a/Projectiles/Rogue/WulfrumKnife.cs +++ b/Projectiles/Rogue/WulfrumKnife.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.cs b/Projectiles/Rogue/XerocPitchforkProjectile.cs index d06420366f..d60cc5fb15 100644 --- a/Projectiles/Rogue/XerocPitchforkProjectile.cs +++ b/Projectiles/Rogue/XerocPitchforkProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Shrines/GladiatorSword.cs b/Projectiles/Shrines/GladiatorSword.cs index 27fc3d8f92..47dc0666f3 100644 --- a/Projectiles/Shrines/GladiatorSword.cs +++ b/Projectiles/Shrines/GladiatorSword.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Shrines { bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.gladiatorSword) { projectile.active = false; diff --git a/Projectiles/Shrines/GladiatorSword2.cs b/Projectiles/Shrines/GladiatorSword2.cs index cb54a8803b..e4649ec1c1 100644 --- a/Projectiles/Shrines/GladiatorSword2.cs +++ b/Projectiles/Shrines/GladiatorSword2.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Shrines { bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword2"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.gladiatorSword) { projectile.active = false; diff --git a/Projectiles/Shrines/LuxorsGiftRogue.cs b/Projectiles/Shrines/LuxorsGiftRogue.cs index f390f35e48..237ed19451 100644 --- a/Projectiles/Shrines/LuxorsGiftRogue.cs +++ b/Projectiles/Shrines/LuxorsGiftRogue.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Shrines aiType = 48; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Shrines/LuxorsGiftSummon.cs b/Projectiles/Shrines/LuxorsGiftSummon.cs index bdc41195d5..1a4a243e00 100644 --- a/Projectiles/Shrines/LuxorsGiftSummon.cs +++ b/Projectiles/Shrines/LuxorsGiftSummon.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Shrines { if (dust > 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -55,10 +55,10 @@ namespace CalamityMod.Projectiles.Shrines } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Shrines float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("LuxorsGiftSummon"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (flag64) { if (!modPlayer.luxorsGift || player.dead) diff --git a/Projectiles/Summon/AngryChicken.cs b/Projectiles/Summon/AngryChicken.cs index 652e147880..0c27caccd3 100644 --- a/Projectiles/Summon/AngryChicken.cs +++ b/Projectiles/Summon/AngryChicken.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 100; for (int num502 = 0; num502 < num501; num502++) { @@ -51,10 +51,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(projectile.Center, 1.2f * num, 0.8f * num, 0f * num); bool flag64 = projectile.type == mod.ProjectileType("AngryChicken"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("AngryChicken"), 3600); if (flag64) { diff --git a/Projectiles/Summon/AquaticStar.cs b/Projectiles/Summon/AquaticStar.cs index 94034123b2..2b7fcce6c4 100644 --- a/Projectiles/Summon/AquaticStar.cs +++ b/Projectiles/Summon/AquaticStar.cs @@ -38,8 +38,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -53,17 +53,17 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } projectile.rotation += projectile.velocity.X * 0.04f; bool flag64 = projectile.type == mod.ProjectileType("AquaticStar"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("AquaticStar"), 3600); if (flag64) { diff --git a/Projectiles/Summon/BigBustyRose.cs b/Projectiles/Summon/BigBustyRose.cs index 8c76860cb6..a88be5a51a 100644 --- a/Projectiles/Summon/BigBustyRose.cs +++ b/Projectiles/Summon/BigBustyRose.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("BigBustyRose"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus) { projectile.active = false; @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Summon value19 *= scaleFactor3; int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num659].timeLeft = 200; - Main.projectile[num659].GetGlobalProjectile(mod).forceMinion = true; + Main.projectile[num659].Calamity().forceMinion = true; projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 25f7ce94ee..a56a8e0352 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -80,10 +80,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index ee66173ab2..cec1497064 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon } bool flag64 = projectile.type == mod.ProjectileType("BloodClotMinion"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("BloodClot"), 3600); if (flag64) { diff --git a/Projectiles/Summon/BrittleStar.cs b/Projectiles/Summon/BrittleStar.cs index 24f0cf2b25..4a8b9249f1 100644 --- a/Projectiles/Summon/BrittleStar.cs +++ b/Projectiles/Summon/BrittleStar.cs @@ -38,8 +38,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -53,17 +53,17 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } projectile.rotation += projectile.velocity.X * 0.04f; bool flag64 = projectile.type == mod.ProjectileType("BrittleStar"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("BrittleStar"), 3600); if (flag64) { diff --git a/Projectiles/Summon/Calamari.cs b/Projectiles/Summon/Calamari.cs index 3d71fa5ba1..f4dc3a49bf 100644 --- a/Projectiles/Summon/Calamari.cs +++ b/Projectiles/Summon/Calamari.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[1] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; //66% = 1.66 - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; //300 * 1.66 = 498 (new value) + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; //66% = 1.66 + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; //300 * 1.66 = 498 (new value) int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[1] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / //498 - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * //1.66 498 / 1.66 = 300 (original value) + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / //498 + projectile.Calamity().spawnedPlayerMinionDamageValue) * //1.66 498 / 1.66 = 300 (original value) Main.player[projectile.owner].minionDamage); //300 * 1.15 = 345 (new value) projectile.damage = damage2; } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon } bool flag64 = projectile.type == mod.ProjectileType("Calamari"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Calamari"), 3600); if (flag64) { diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index b3303f7ef7..0a151558c8 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -51,10 +51,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("Calamitamini"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("CalamitasEyes"), 3600); if (flag64) { diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index 24dc48a465..f153dce789 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -51,10 +51,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("Cataclymini"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (flag64) { if (player.dead) diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 0b454e5572..df3d6addcb 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -51,10 +51,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("Catastromini"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (flag64) { if (player.dead) diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index 97911f60e8..968bd57b05 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("ChaosSpirit"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.chaosSpirit) { projectile.active = false; @@ -58,8 +58,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -68,10 +68,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/CloudyWaifu.cs b/Projectiles/Summon/CloudyWaifu.cs index bdfb58dc46..c351b3d778 100644 --- a/Projectiles/Summon/CloudyWaifu.cs +++ b/Projectiles/Summon/CloudyWaifu.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("CloudyWaifu"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.cloudWaifu && !modPlayer.allWaifus) { projectile.active = false; @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/Corroslime.cs b/Projectiles/Summon/Corroslime.cs index 87c4303f20..ff69b934db 100644 --- a/Projectiles/Summon/Corroslime.cs +++ b/Projectiles/Summon/Corroslime.cs @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -63,16 +63,16 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("Corroslime"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Corroslime"), 3600); if (flag64) { diff --git a/Projectiles/Summon/CosmicEnergy.cs b/Projectiles/Summon/CosmicEnergy.cs index a86b1f5bab..860cf376d4 100644 --- a/Projectiles/Summon/CosmicEnergy.cs +++ b/Projectiles/Summon/CosmicEnergy.cs @@ -40,20 +40,20 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("CosmicEnergy"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("CosmicEnergy"), 3600); if (flag64) { diff --git a/Projectiles/Summon/Cosmilamp.cs b/Projectiles/Summon/Cosmilamp.cs index 248bfd5b66..74d8893d96 100644 --- a/Projectiles/Summon/Cosmilamp.cs +++ b/Projectiles/Summon/Cosmilamp.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num1262].noGravity = true; bool flag64 = projectile.type == mod.ProjectileType("Cosmilamp"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Cosmilamp"), 3600); if (flag64) { diff --git a/Projectiles/Summon/Crimslime.cs b/Projectiles/Summon/Crimslime.cs index a39c5b1fd1..19c39213af 100644 --- a/Projectiles/Summon/Crimslime.cs +++ b/Projectiles/Summon/Crimslime.cs @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -63,16 +63,16 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("Crimslime"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Crimslime"), 3600); if (flag64) { diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index 03060dd9c3..4a1e3b2eb1 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("DaedalusCrystal"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.daedalusCrystal) { projectile.active = false; @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/DankCreeper.cs b/Projectiles/Summon/DankCreeper.cs index 22396b54e2..332922e5df 100644 --- a/Projectiles/Summon/DankCreeper.cs +++ b/Projectiles/Summon/DankCreeper.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -55,16 +55,16 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("DankCreeper"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("DankCreeper"), 3600); if (flag64) { diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index 138b725212..3e52795989 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/DrewsSandyWaifu.cs b/Projectiles/Summon/DrewsSandyWaifu.cs index ff322c9c14..14e162d97c 100644 --- a/Projectiles/Summon/DrewsSandyWaifu.cs +++ b/Projectiles/Summon/DrewsSandyWaifu.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("DrewsSandyWaifu"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus) { projectile.active = false; @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/ElementalAxe.cs b/Projectiles/Summon/ElementalAxe.cs index d6c2bbf388..f3a8a70a61 100644 --- a/Projectiles/Summon/ElementalAxe.cs +++ b/Projectiles/Summon/ElementalAxe.cs @@ -37,20 +37,20 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = (projectile.type == mod.ProjectileType("ElementalAxe")); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("ElementalAxe"), 3600); if (flag64) { diff --git a/Projectiles/Summon/FungalClump.cs b/Projectiles/Summon/FungalClump.cs index 35f11d9975..f60a71135b 100644 --- a/Projectiles/Summon/FungalClump.cs +++ b/Projectiles/Summon/FungalClump.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("FungalClump"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.fungalClump) { projectile.active = false; @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -71,10 +71,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index 996324e0fa..9d3d7daf96 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -33,16 +33,16 @@ namespace CalamityMod.Projectiles.Summon { if (start) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; Main.PlaySound(SoundID.Item20, projectile.position); projectile.ai[1] = projectile.ai[0]; start = false; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/Herring.cs b/Projectiles/Summon/Herring.cs index 7901a37603..572f0c49a3 100644 --- a/Projectiles/Summon/Herring.cs +++ b/Projectiles/Summon/Herring.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust > 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Summon float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("Herring"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Herring"), 3600); if (flag64) { diff --git a/Projectiles/Summon/IceClasper.cs b/Projectiles/Summon/IceClasper.cs index fdf82b0753..18eb4f0d84 100644 --- a/Projectiles/Summon/IceClasper.cs +++ b/Projectiles/Summon/IceClasper.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust > 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon float num636 = 150f; bool flag64 = projectile.type == mod.ProjectileType("IceClasper"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("IceClasper"), 3600); if (flag64) { diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 9a9479c6e7..7164c8689e 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon runCheck = false; playerMinionSlots = player9.maxMinions; } - CalamityPlayer modPlayer = player9.GetCalamityPlayer(); + CalamityPlayer modPlayer = player9.Calamity(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index f62f0d51eb..d18280d658 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon runCheck = false; playerMinionSlots = player9.maxMinions; } - CalamityPlayer modPlayer = player9.GetCalamityPlayer(); + CalamityPlayer modPlayer = player9.Calamity(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 16e6b3537e..6819cbb6b6 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon runCheck = false; playerMinionSlots = player9.maxMinions; } - CalamityPlayer modPlayer = player9.GetCalamityPlayer(); + CalamityPlayer modPlayer = player9.Calamity(); player9.AddBuff(mod.BuffType("Mechworm"), 3600); if ((int)Main.time % 120 == 0) { diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index a0bd5fb4f6..46402c53b0 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon runCheck = false; playerMinionSlots = player9.maxMinions; } - CalamityPlayer modPlayer = player9.GetCalamityPlayer(); + CalamityPlayer modPlayer = player9.Calamity(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 65de5ce00a..77d1bcf56c 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -35,8 +35,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -49,10 +49,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon float num636 = 600f; bool flag64 = projectile.type == mod.ProjectileType("PhantomGuy"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Phantom"), 3600); if (flag64) { diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 0bf9790671..faaef7c94a 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Summon } if (count == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int num621 = 0; num621 < 5; num621++) { @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Summon } count += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/ReaverOrb.cs b/Projectiles/Summon/ReaverOrb.cs index 0f4cb29b7c..43adfa19fd 100644 --- a/Projectiles/Summon/ReaverOrb.cs +++ b/Projectiles/Summon/ReaverOrb.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("ReaverOrb"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.reaverOrb) { projectile.active = false; @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/RedDevil.cs b/Projectiles/Summon/RedDevil.cs index b00f132d8e..57e45f45a3 100644 --- a/Projectiles/Summon/RedDevil.cs +++ b/Projectiles/Summon/RedDevil.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("RedDevil"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.redDevil) { projectile.active = false; diff --git a/Projectiles/Summon/Sandnado.cs b/Projectiles/Summon/Sandnado.cs index 442bfd5610..9228ea83e5 100644 --- a/Projectiles/Summon/Sandnado.cs +++ b/Projectiles/Summon/Sandnado.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[1] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -54,16 +54,16 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[1] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("Sandnado"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Sandnado"), 3600); if (flag64) { diff --git a/Projectiles/Summon/SandyWaifu.cs b/Projectiles/Summon/SandyWaifu.cs index aedd5c5f32..34d83d3dd5 100644 --- a/Projectiles/Summon/SandyWaifu.cs +++ b/Projectiles/Summon/SandyWaifu.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("SandyWaifu"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sandWaifu && !modPlayer.allWaifus) { projectile.active = false; @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 9b6607d2c1..7ae993c58a 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -37,20 +37,20 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[1] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[1] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("SilvaCrystal"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.silvaSummon) { projectile.active = false; diff --git a/Projectiles/Summon/SirenLure.cs b/Projectiles/Summon/SirenLure.cs index 4380e07c17..c98c9637e5 100644 --- a/Projectiles/Summon/SirenLure.cs +++ b/Projectiles/Summon/SirenLure.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("SirenLure"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sirenWaifu && !modPlayer.allWaifus) { projectile.active = false; @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Summon } if (dust > 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -68,10 +68,10 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/SlimeGod.cs b/Projectiles/Summon/SlimeGod.cs index 177161f1f3..ba7b155b86 100644 --- a/Projectiles/Summon/SlimeGod.cs +++ b/Projectiles/Summon/SlimeGod.cs @@ -47,8 +47,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -62,16 +62,16 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("SlimeGod"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("SlimeGod"), 3600); if (!modPlayer.slimeGod) { diff --git a/Projectiles/Summon/SlimeGodAlt.cs b/Projectiles/Summon/SlimeGodAlt.cs index df97970631..696ad5359b 100644 --- a/Projectiles/Summon/SlimeGodAlt.cs +++ b/Projectiles/Summon/SlimeGodAlt.cs @@ -47,8 +47,8 @@ namespace CalamityMod.Projectiles.Summon { if (dust == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -62,16 +62,16 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } bool flag64 = projectile.type == mod.ProjectileType("SlimeGodAlt"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("SlimeGod"), 3600); if (!modPlayer.slimeGod) { diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index b3e15781f1..be462ade0e 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); bool flag64 = projectile.type == mod.ProjectileType("SolarGod"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("SolarSpiritGod"), 3600); if (flag64) { @@ -67,8 +67,8 @@ namespace CalamityMod.Projectiles.Summon projectile.scale = num395 + 0.95f; if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -78,10 +78,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 435ebdd56e..439c5327bd 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); bool flag64 = projectile.type == mod.ProjectileType("SolarPixie"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("SolarSpirit"), 3600); if (flag64) { @@ -67,8 +67,8 @@ namespace CalamityMod.Projectiles.Summon projectile.scale = num395 + 0.95f; if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 25; for (int num502 = 0; num502 < num501; num502++) { @@ -78,10 +78,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index 0c97f9e81e..f23b22bb96 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -31,14 +31,14 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/Urchin.cs b/Projectiles/Summon/Urchin.cs index 8ac8cf1642..d79fe81247 100644 --- a/Projectiles/Summon/Urchin.cs +++ b/Projectiles/Summon/Urchin.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("Urchin"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.urchin) { projectile.active = false; @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -66,10 +66,10 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 45eb82886d..9e221f1648 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon { bool flag64 = projectile.type == mod.ProjectileType("Valkyrie"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.valkyrie) { projectile.active = false; @@ -58,8 +58,8 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.localAI[0] == 0f) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 30; for (int num502 = 0; num502 < num501; num502++) { @@ -69,10 +69,10 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/SunkenSea/ClamCrusherFlail.cs b/Projectiles/SunkenSea/ClamCrusherFlail.cs index 43aa23f436..c2f20f14c8 100644 --- a/Projectiles/SunkenSea/ClamCrusherFlail.cs +++ b/Projectiles/SunkenSea/ClamCrusherFlail.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.melee = true; projectile.alpha = 255; projectile.tileCollide = false; - projectile.GetGlobalProjectile(mod).trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/SunkenSea/Prismalline.cs b/Projectiles/SunkenSea/Prismalline.cs index c0b959fb73..b7b17607a4 100644 --- a/Projectiles/SunkenSea/Prismalline.cs +++ b/Projectiles/SunkenSea/Prismalline.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.aiStyle = 113; projectile.timeLeft = 180; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/SunkenSea/Prismalline2.cs b/Projectiles/SunkenSea/Prismalline2.cs index a066a7d9f6..e48ccdc815 100644 --- a/Projectiles/SunkenSea/Prismalline2.cs +++ b/Projectiles/SunkenSea/Prismalline2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.aiStyle = 113; projectile.timeLeft = 60; aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/SunkenSea/Prismalline3.cs b/Projectiles/SunkenSea/Prismalline3.cs index c974e01840..ac8bdcac09 100644 --- a/Projectiles/SunkenSea/Prismalline3.cs +++ b/Projectiles/SunkenSea/Prismalline3.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 180; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/SunkenSea/SeafoamBomb.cs b/Projectiles/SunkenSea/SeafoamBomb.cs index b927045c3c..9ef78afcf2 100644 --- a/Projectiles/SunkenSea/SeafoamBomb.cs +++ b/Projectiles/SunkenSea/SeafoamBomb.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 240; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/SunkenSea/SeafoamBubble.cs b/Projectiles/SunkenSea/SeafoamBubble.cs index 61cf1a3b7d..13945bceab 100644 --- a/Projectiles/SunkenSea/SeafoamBubble.cs +++ b/Projectiles/SunkenSea/SeafoamBubble.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.alpha = 255; projectile.scale = 1f; projectile.localNPCHitCooldown = 30; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/SunkenSea/Shellfish.cs b/Projectiles/SunkenSea/Shellfish.cs index 47c4ece711..f4d241eb4f 100644 --- a/Projectiles/SunkenSea/Shellfish.cs +++ b/Projectiles/SunkenSea/Shellfish.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.SunkenSea { if (spawnDust) { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 20; for (int num502 = 0; num502 < num501; num502++) { @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.SunkenSea } bool flag64 = projectile.type == mod.ProjectileType("Shellfish"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetCalamityPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Shellfish"), 3600); if (flag64) { @@ -84,10 +84,10 @@ namespace CalamityMod.Projectiles.SunkenSea if (projectile.ai[0] == 0f) { projectile.damage = 70; - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); projectile.damage = damage2; } diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 33ae445745..192f665445 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Typeless { if (projectile.ai[0] == 2f) { - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.Calamity().rogue = true; } int randomToSubtract = Main.rand.Next(1, 3); noTileHitCounter -= randomToSubtract; diff --git a/Projectiles/Typeless/NanoblackMain.cs b/Projectiles/Typeless/NanoblackMain.cs index 5daf2c16fe..7729445e4a 100644 --- a/Projectiles/Typeless/NanoblackMain.cs +++ b/Projectiles/Typeless/NanoblackMain.cs @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Typeless if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); - CalamityGlobalProjectile cgp = Main.projectile[proj].GetGlobalProjectile(mod); + CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); if (projectile.melee) cgp.forceMelee = true; else diff --git a/Projectiles/Typeless/StellarContemptHammer.cs b/Projectiles/Typeless/StellarContemptHammer.cs index 885634b4d5..d5a13645f3 100644 --- a/Projectiles/Typeless/StellarContemptHammer.cs +++ b/Projectiles/Typeless/StellarContemptHammer.cs @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Typeless if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); - CalamityGlobalProjectile cgp = Main.projectile[proj].GetGlobalProjectile(mod); + CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); if (projectile.melee) cgp.forceMelee = true; else diff --git a/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs b/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs index bbbaf8e3e4..5cdbe8cb5f 100644 --- a/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs +++ b/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate // public override void SetDefaults() // { // item.CloneDefaults(ItemID.FireflyinaBottle); - // item.createTile = mod.TileType(); + // item.createTile = ModContent.TileType(); // } //} } diff --git a/Tiles/FurnitureStatigel/StaticRefiner.cs b/Tiles/FurnitureStatigel/StaticRefiner.cs index 58462e04f5..e7425291af 100644 --- a/Tiles/FurnitureStatigel/StaticRefiner.cs +++ b/Tiles/FurnitureStatigel/StaticRefiner.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel // public override void SetDefaults() // { // item.CloneDefaults(ItemID.FireflyinaBottle); - // item.createTile = mod.TileType(); + // item.createTile = ModContent.TileType(); // } //} } diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 33e11e93fb..52f1a5de82 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items; using CalamityMod.NPCs; using CalamityMod.Projectiles; using CalamityMod.World; @@ -8,40 +9,43 @@ using Terraria; namespace CalamityMod { - public static class CPlayerUtils + public static class CalamityUtils { - public static CalamityPlayer GetCalamityPlayer(this Player player) => player.GetModPlayer(); + #region Object Extensions + public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer(); + public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC(); + public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); + public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile(); + #endregion - public static bool InCalamity(this Player player) => player.GetCalamityPlayer().ZoneCalamity; - public static bool InAstral(this Player player) => player.GetCalamityPlayer().ZoneAstral; - public static bool InSunkenSea(this Player player) => player.GetCalamityPlayer().ZoneSunkenSea; - public static bool InSulphur(this Player player) => player.GetCalamityPlayer().ZoneSulphur; + #region Player Utilities + public static bool InCalamity(this Player player) => player.Calamity().ZoneCalamity; + public static bool InAstral(this Player player) => player.Calamity().ZoneAstral; + public static bool InSunkenSea(this Player player) => player.Calamity().ZoneSunkenSea; + public static bool InSulphur(this Player player) => player.Calamity().ZoneSulphur; public static bool InAbyss(this Player player, int layer = 0) { switch (layer) { case 1: - return player.GetCalamityPlayer().ZoneAbyssLayer1; + return player.Calamity().ZoneAbyssLayer1; case 2: - return player.GetCalamityPlayer().ZoneAbyssLayer2; + return player.Calamity().ZoneAbyssLayer2; case 3: - return player.GetCalamityPlayer().ZoneAbyssLayer3; + return player.Calamity().ZoneAbyssLayer3; case 4: - return player.GetCalamityPlayer().ZoneAbyssLayer4; + return player.Calamity().ZoneAbyssLayer4; default: - return player.GetCalamityPlayer().ZoneAbyss; + return player.Calamity().ZoneAbyss; } } - } - - public static class CNPCUtils - { - public static CalamityGlobalNPC GetCalamityNPC(this NPC npc) => npc.GetGlobalNPC(); + #endregion + #region NPC Utilities /// /// Allows you to set the lifeMax value of a NPC to different values based on the mode. Called instead of npc.lifeMax = X. /// @@ -70,7 +74,7 @@ namespace CalamityMod if (npc.boss) { double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); } } /// @@ -108,7 +112,7 @@ namespace CalamityMod { return Main.npc[owner.MinionAttackTargetNPC]; } - return ClosestNPCAt(origin,maxDistanceToCheck); + return ClosestNPCAt(origin, maxDistanceToCheck); } /// @@ -124,21 +128,14 @@ namespace CalamityMod damage = 0D; return true; } - } + #endregion - public static class CProjectileUtils - { - public static CalamityGlobalProjectile GetCalamityProj(this Projectile proj) => proj.GetGlobalProjectile(); - } - - public static class CMiscUtils - { + #region Miscellaneous Utilities public static void AddWithCondition(this List list, T type, bool condition) { if (condition) - { list.Add(type); - } } + #endregion } } diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index c88f2a7647..421e803420 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.GetCalamityPlayer().ZoneAbyss; + return Main.LocalPlayer.Calamity().ZoneAbyss; } public override int ChooseWaterfallStyle() diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 81355ce230..47d60eacf4 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.GetCalamityPlayer().ZoneAstral; + return Main.LocalPlayer.Calamity().ZoneAstral; } public override int ChooseWaterfallStyle() diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 7d0a8ae89d..b8f20d39ad 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.GetCalamityPlayer().ZoneSulphur; + return Main.LocalPlayer.Calamity().ZoneSulphur; } public override int ChooseWaterfallStyle() diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index ea84d429d7..21de283e6b 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.GetCalamityPlayer().ZoneSunkenSea; + return Main.LocalPlayer.Calamity().ZoneSunkenSea; } public override int ChooseWaterfallStyle() diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index fcdc18ffe7..c9ee73eea7 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1022,11 +1022,11 @@ namespace CalamityMod.World !Main.player[closestPlayer].ZoneUnderworldHeight && !Main.player[closestPlayer].ZoneDungeon && !Main.player[closestPlayer].ZoneJungle && - !Main.player[closestPlayer].GetCalamityPlayer().ZoneSunkenSea && + !Main.player[closestPlayer].Calamity().ZoneSunkenSea && !CalamityPlayer.areThereAnyDamnBosses) { if (NPC.downedPlantBoss && - !Main.player[closestPlayer].GetCalamityPlayer().ZoneAbyss && + !Main.player[closestPlayer].Calamity().ZoneAbyss && Main.player[closestPlayer].townNPCs < 3f) { double spawnRate = 100000D; @@ -1039,18 +1039,18 @@ namespace CalamityMod.World if (demonMode) spawnRate *= 0.75D; - if (Main.player[closestPlayer].GetCalamityPlayer().zerg && Main.player[closestPlayer].GetCalamityPlayer().chaosCandle) + if (Main.player[closestPlayer].Calamity().zerg && Main.player[closestPlayer].Calamity().chaosCandle) spawnRate *= 0.005D; - else if (Main.player[closestPlayer].GetCalamityPlayer().zerg) + else if (Main.player[closestPlayer].Calamity().zerg) spawnRate *= 0.01D; - else if (Main.player[closestPlayer].GetCalamityPlayer().chaosCandle) + else if (Main.player[closestPlayer].Calamity().chaosCandle) spawnRate *= 0.02D; - if (Main.player[closestPlayer].GetCalamityPlayer().zen && Main.player[closestPlayer].GetCalamityPlayer().tranquilityCandle) + if (Main.player[closestPlayer].Calamity().zen && Main.player[closestPlayer].Calamity().tranquilityCandle) spawnRate *= 75D; - else if (Main.player[closestPlayer].GetCalamityPlayer().zen) + else if (Main.player[closestPlayer].Calamity().zen) spawnRate *= 50D; - else if (Main.player[closestPlayer].GetCalamityPlayer().tranquilityCandle) + else if (Main.player[closestPlayer].Calamity().tranquilityCandle) spawnRate *= 25D; int chance = (int)spawnRate; @@ -1075,7 +1075,7 @@ namespace CalamityMod.World } } - if (Main.player[closestPlayer].GetCalamityPlayer().ZoneAbyss) + if (Main.player[closestPlayer].Calamity().ZoneAbyss) { if (Main.player[closestPlayer].chaosState) { @@ -1203,7 +1203,7 @@ namespace CalamityMod.World } if (!NPC.downedFishron && bossType == 0) - if (Main.player[closestPlayer].ZoneBeach && !Main.player[closestPlayer].GetCalamityPlayer().ZoneSulphur) + if (Main.player[closestPlayer].ZoneBeach && !Main.player[closestPlayer].Calamity().ZoneSulphur) { BossText(); bossType = NPCID.DukeFishron; @@ -1227,7 +1227,7 @@ namespace CalamityMod.World } if (!downedAstrageldon && bossType == 0) - if (Main.player[closestPlayer].GetCalamityPlayer().ZoneAstral && + if (Main.player[closestPlayer].Calamity().ZoneAstral && !Main.dayTime && Main.player[closestPlayer].ZoneOverworldHeight) { BossText(); @@ -1361,7 +1361,7 @@ namespace CalamityMod.World } else if (bossType == mod.NPCType("Astrageldon")) { - if (!Main.player[closestPlayer].GetCalamityPlayer().ZoneAstral || + if (!Main.player[closestPlayer].Calamity().ZoneAstral || Main.dayTime || !Main.player[closestPlayer].ZoneOverworldHeight) canSpawn = false; } From 4707c31799f022cf7e26ae1f0ff331617e5fb0b8 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 11 Oct 2019 08:15:16 -0500 Subject: [PATCH 5/7] Changed Eclipse's Fall to use ItemID for daybreak --- Items/CalamityCustomThrowingDamage/EclipsesFall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs index cf5352562d..4fc3409269 100644 --- a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs +++ b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(3543, 1); //Daybreak weapon because I don't know internal file name + recipe.AddIngredient(ItemID.DayBreak, 1); recipe.AddIngredient(mod.ItemType("DarksunFragment"), 15); recipe.AddIngredient(mod.ItemType("CoreofCinder"), 6); recipe.AddTile(TileID.LunarCraftingStation); From 830a5378cbed8412a69f586b2c3d34f2e93b9c5c Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 11 Oct 2019 09:42:35 -0400 Subject: [PATCH 6/7] 0.11.5 total compatibility and optimization. Also replaced hardcoded 22 buff limit with Player.MaxBuffs. --- Buffs/Permafrost/Popo.cs | 2 +- Buffs/Permafrost/PopoNoseless.cs | 2 +- Buffs/StatBuffs/AbyssalDivingSuitBuff.cs | 2 +- Buffs/StatBuffs/SirenBobs.cs | 2 +- Buffs/StatBuffs/SirenBobsAlt.cs | 2 +- Buffs/StatDebuffs/AbyssalMirrorCooldown.cs | 2 +- Buffs/StatDebuffs/EclipseMirrorCooldown.cs | 2 +- Buffs/StatDebuffs/InkBombCooldown.cs | 2 +- Buffs/SummonBuffs/BlackHawkBuff.cs | 2 +- CalPlayer/CalamityPlayer.cs | 94 +- CalPlayer/CalamityPlayerLifeRegen.cs | 4 +- CalamityMod.cs | 53 +- Config.cs | 2 +- Gores/AstralWaterDroplet.cs | 4 +- Items/Accessories/AbyssalMirror.cs | 2 +- Items/Accessories/DarkGodsSheath.cs | 2 +- Items/Accessories/EclipseMirror.cs | 2 +- Items/Accessories/FeatherCrown.cs | 2 +- Items/Accessories/InkBomb.cs | 2 +- Items/Accessories/MirageMirror.cs | 2 +- Items/Accessories/MoonstoneCrown.cs | 2 +- Items/Accessories/RuinMedallion.cs | 2 +- Items/Accessories/SilencingSheath.cs | 2 +- Items/Accessories/TheAmalgam.cs | 2 +- Items/Accessories/VoidofExtinction.cs | 2 +- Items/Accessories/Wings/AureateWings.cs | 4 +- Items/Accessories/Wings/HadarianWings.cs | 2 +- Items/Accessories/Wings/MOAB.cs | 4 +- Items/Armor/AbyssalDivingSuit.cs | 2 +- Items/Armor/AtaxiaArmor.cs | 2 +- Items/Armor/AuricTeslaCuisses.cs | 2 +- Items/Armor/BloodflareBodyArmor.cs | 2 +- Items/Armor/BloodflareCuisses.cs | 2 +- Items/Armor/DaedalusBreastplate.cs | 2 +- Items/Armor/DemonshadeHelm.cs | 2 +- Items/Armor/GodSlayerLeggings.cs | 2 +- Items/Armor/MolluskShelleggings.cs | 2 +- Items/Armor/MolluskShellmet.cs | 4 +- Items/Armor/MolluskShellplate.cs | 2 +- Items/Armor/OmegaBlueChestplate.cs | 2 +- Items/Armor/OmegaBlueHelmet.cs | 14 +- Items/Armor/OmegaBlueLeggings.cs | 2 +- Items/Armor/ReaverScaleMail.cs | 2 +- Items/Armor/SilvaArmor.cs | 2 +- Items/Armor/SilvaLeggings.cs | 2 +- Items/Armor/SirensHeart.cs | 2 +- Items/Armor/SirensHeartAlt.cs | 2 +- Items/Armor/TarragonBreastplate.cs | 2 +- Items/Armor/TarragonLeggings.cs | 2 +- Items/BrimstoneWaifu/Gehenna.cs | 2 +- .../CelestialReaper.cs | 2 +- .../ConsecratedWater.cs | 2 +- .../IronFrancisca.cs | 3 +- .../LeadTomahawk.cs | 3 +- .../MonkeyDarts.cs | 1 + Items/CalamityGlobalItem.cs | 8 +- Items/Mounts/AngryDog.cs | 2 +- Items/Permafrost/PermafrostsConcoction.cs | 2 +- Items/Permafrost/Popo.cs | 2 +- Items/Placeables/ChaosCandle.cs | 2 +- Items/Placeables/TranquilityCandle.cs | 2 +- Items/SunkenSea/AmidiasPendant.cs | 2 +- Items/Weapons/Polterghast/FatesReveal.cs | 2 +- Items/Weapons/RareVariants/Carnage.cs | 8 +- Items/Weapons/TheMutilator.cs | 8 +- Localization/CalamityLocalization.cs | 4 +- MiscModSupport/ModCalls.cs | 4 +- NPCs/AstralBiomeNPCs/Aries.cs | 2 +- NPCs/AstralBiomeNPCs/AstralProbe.cs | 16 +- NPCs/AstralBiomeNPCs/AstralSlime.cs | 2 +- NPCs/AstralBiomeNPCs/AstralachneaGround.cs | 2 +- NPCs/AstralBiomeNPCs/Atlas.cs | 2 +- NPCs/AstralBiomeNPCs/BigSightseer.cs | 2 +- NPCs/AstralBiomeNPCs/FusionFeeder.cs | 2 +- NPCs/AstralBiomeNPCs/Hadarian.cs | 2 +- NPCs/AstralBiomeNPCs/Hive.cs | 2 +- NPCs/AstralBiomeNPCs/Mantis.cs | 2 +- NPCs/AstralBiomeNPCs/Nova.cs | 2 +- NPCs/AstralBiomeNPCs/SmallSightseer.cs | 2 +- NPCs/AstralBiomeNPCs/StellarCulex.cs | 2 +- NPCs/AstralBiomeNPCs/Twinkler.cs | 4 +- NPCs/AstrumDeus/AstrumDeusProbe3.cs | 16 +- NPCs/CalamityAI.cs | 22 +- NPCs/CalamityGlobalAI.cs | 930 +++++++++--------- NPCs/CalamityGlobalNPC.cs | 61 +- NPCs/Leviathan/Leviathan.cs | 2 +- NPCs/NormalNPCs/Horse.cs | 20 +- NPCs/NormalNPCs/PlaguedDerpling.cs | 4 +- .../PlaguebringerGoliath.cs | 2 +- NPCs/Scavenger/ScavengerBody.cs | 20 +- NPCs/SlimeGod/SlimeGodCore.cs | 2 +- NPCs/StormWeaver/StasisProbe.cs | 16 +- NPCs/StormWeaver/StasisProbeNaked.cs | 16 +- NPCs/StormWeaver/StormWeaverHead.cs | 2 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 2 +- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 2 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsBody.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsHead.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsTail.cs | 2 +- NPCs/TheDevourerofGods/DevourerofGodsTailS.cs | 2 +- NPCs/TownNPCs/Bandit.cs | 8 +- NPCs/TownNPCs/DILF.cs | 4 +- NPCs/TownNPCs/FAP.cs | 14 +- NPCs/TownNPCs/SEAHOE.cs | 6 +- NPCs/Yharon/Yharon.cs | 2 +- Projectiles/Amidias/AmidiasWhirlpool.cs | 4 +- Projectiles/Amidias/WaywasherProj.cs | 4 +- Projectiles/Boss/BrimstoneFire.cs | 8 +- Projectiles/Boss/FlareBomb.cs | 16 +- Projectiles/Boss/FlareDust.cs | 16 +- Projectiles/Boss/FlareDust2.cs | 16 +- Projectiles/Boss/HealOrbProv.cs | 4 +- Projectiles/Boss/HellfireExplosion.cs | 4 +- Projectiles/Boss/HiveBombGoliath.cs | 16 +- Projectiles/Boss/PlagueExplosion.cs | 4 +- Projectiles/Boss/SandBlast.cs | 4 +- Projectiles/Boss/ScavengerNuke.cs | 16 +- Projectiles/Boss/ShaderainHostile.cs | 2 +- Projectiles/Boss/Shadowflamethrower.cs | 8 +- Projectiles/CalamityGlobalProjectile.cs | 28 +- Projectiles/Enemy/EarthRockBig.cs | 16 +- Projectiles/Enemy/EarthRockSmall.cs | 16 +- Projectiles/Enemy/HorsWaterBlast.cs | 4 +- Projectiles/Enemy/PufferExplosion.cs | 4 +- Projectiles/Healing/AtaxiaHealOrb.cs | 4 +- Projectiles/Healing/BurntSienna.cs | 4 +- Projectiles/Healing/CactusHealOrb.cs | 4 +- Projectiles/Healing/EarthHealOrb.cs | 4 +- Projectiles/Healing/Exoheal.cs | 4 +- Projectiles/Healing/FungalHeal.cs | 8 +- Projectiles/Healing/GodSlayerHealOrb.cs | 4 +- Projectiles/Healing/PhoenixHeal.cs | 4 +- Projectiles/Healing/RainHeal.cs | 4 +- Projectiles/Healing/RoyalHeal.cs | 8 +- Projectiles/Healing/Terracotta.cs | 4 +- Projectiles/Healing/TransfusionTrail.cs | 8 +- Projectiles/Healing/XerocHealOrb.cs | 4 +- Projectiles/Magic/Ancient.cs | 16 +- Projectiles/Magic/Ancient2.cs | 16 +- Projectiles/Magic/Asteroid.cs | 4 +- Projectiles/Magic/AsteroidMolten.cs | 4 +- Projectiles/Magic/BloodBeam.cs | 8 +- Projectiles/Magic/BloodBlast.cs | 4 +- Projectiles/Magic/DustProjectile.cs | 16 +- Projectiles/Magic/EvergladeSprayProjectile.cs | 4 +- Projectiles/Magic/FlamePillar.cs | 8 +- Projectiles/Magic/FlareBoltProjectile.cs | 4 +- Projectiles/Magic/ForbiddenSunburst.cs | 4 +- .../Magic/FrigidflashBoltProjectile.cs | 8 +- Projectiles/Magic/FrostBoltProjectile.cs | 4 +- .../Magic/HellfireExplosionFriendly.cs | 4 +- .../Magic/HellfireExplosionFriendly2.cs | 4 +- Projectiles/Magic/InfernalBlade.cs | 2 +- Projectiles/Magic/InfernalBlade2.cs | 2 +- Projectiles/Magic/LiquidBlade.cs | 2 +- Projectiles/Magic/LiquidBlade2.cs | 2 +- Projectiles/Magic/PlagueFang.cs | 6 +- Projectiles/Magic/SHPExplosion.cs | 4 +- Projectiles/Magic/Shaderain.cs | 2 +- Projectiles/Magic/Starblast.cs | 2 +- .../Magic/SupremeDustFlakProjectile.cs | 16 +- Projectiles/Magic/SupremeDustProjectile.cs | 16 +- Projectiles/Magic/VenusianExplosion.cs | 4 +- Projectiles/Magic/VenusianFlame.cs | 10 +- Projectiles/Magic/WaterStream.cs | 4 +- Projectiles/Magic/WaterStream2.cs | 4 +- Projectiles/Melee/AegisBeam.cs | 4 +- Projectiles/Melee/AegisBlast.cs | 4 +- Projectiles/Melee/AegisBlast2.cs | 4 +- Projectiles/Melee/AegisFlame.cs | 10 +- .../Melee/BalefulHarvesterProjectile.cs | 4 +- Projectiles/Melee/Brimblast.cs | 10 +- .../Melee/BrimlanceHellfireExplosion.cs | 4 +- Projectiles/Melee/BrimlanceStandingFire.cs | 10 +- Projectiles/Melee/BrimstoneBoom.cs | 4 +- Projectiles/Melee/CosmicBolt.cs | 4 +- Projectiles/Melee/DepthOrb.cs | 4 +- Projectiles/Melee/DepthOrb2.cs | 4 +- Projectiles/Melee/DragonRage.cs | 16 +- Projectiles/Melee/Earth3.cs | 16 +- Projectiles/Melee/Exoboom.cs | 4 +- Projectiles/Melee/Nebudust.cs | 4 +- Projectiles/Melee/NeptuneOrb.cs | 4 +- Projectiles/Melee/OceanBeam.cs | 8 +- Projectiles/Melee/PlagueBeeDust.cs | 8 +- Projectiles/Melee/PlagueDust.cs | 8 +- Projectiles/Melee/RainbowBoom.cs | 4 +- Projectiles/Melee/Spark.cs | 10 +- Projectiles/Melee/TerracottaExplosion.cs | 4 +- Projectiles/Melee/UltimusCleaverDust.cs | 10 +- .../Melee/Yoyos/TheGodsGambitProjectile.cs | 4 +- Projectiles/Patreon/Plaguenade.cs | 16 +- Projectiles/Ranged/Archerfish.cs | 8 +- Projectiles/Ranged/BeeRPG.cs | 16 +- Projectiles/Ranged/BigNuke.cs | 16 +- Projectiles/Ranged/BrimstoneFireFriendly.cs | 8 +- Projectiles/Ranged/Butcher.cs | 4 +- Projectiles/Ranged/ChickenExplosion.cs | 4 +- Projectiles/Ranged/CorossiveFlames.cs | 12 +- Projectiles/Ranged/CosmicFire.cs | 8 +- Projectiles/Ranged/DragonBurst.cs | 4 +- Projectiles/Ranged/ElysianArrow.cs | 16 +- Projectiles/Ranged/EssenceFire.cs | 8 +- Projectiles/Ranged/ExoFire.cs | 8 +- Projectiles/Ranged/Flash.cs | 4 +- Projectiles/Ranged/GoliathRocket.cs | 16 +- Projectiles/Ranged/HalleysComet.cs | 10 +- Projectiles/Ranged/HiveBomb.cs | 16 +- Projectiles/Ranged/HiveMissile.cs | 16 +- Projectiles/Ranged/HolyFireBullet.cs | 4 +- Projectiles/Ranged/MeowFire.cs | 8 +- Projectiles/Ranged/MeowFire2.cs | 8 +- Projectiles/Ranged/MiniRocket.cs | 16 +- Projectiles/Ranged/MortarRound.cs | 16 +- Projectiles/Ranged/NapalmArrow.cs | 16 +- Projectiles/Ranged/Norfleet.cs | 8 +- Projectiles/Ranged/NorfleetExplosion.cs | 4 +- Projectiles/Ranged/Nuke.cs | 16 +- Projectiles/Ranged/PlagueExplosionFriendly.cs | 4 +- Projectiles/Ranged/PlasmaExplosion.cs | 4 +- Projectiles/Ranged/RubberMortarRound.cs | 32 +- Projectiles/Ranged/SandWater.cs | 4 +- Projectiles/Ranged/ShadeFire.cs | 8 +- Projectiles/Ranged/Shockblast.cs | 4 +- Projectiles/Ranged/Sickness.cs | 4 +- Projectiles/Ranged/SparkSpreaderFire.cs | 14 +- Projectiles/Ranged/TerraFireGreen.cs | 8 +- Projectiles/Ranged/TerraFireGreen2.cs | 8 +- Projectiles/Rogue/AbyssalMirrorProjectile.cs | 2 +- Projectiles/Rogue/BallisticPoisonBomb.cs | 16 +- Projectiles/Rogue/BlueFlamePillar.cs | 10 +- Projectiles/Rogue/BrackishWaterBlast.cs | 4 +- Projectiles/Rogue/Brick.cs | 4 +- Projectiles/Rogue/BrickFragment.cs | 2 +- .../Rogue/CelestialReaperAfterimage.cs | 2 +- .../Rogue/CelestialReaperProjectile.cs | 2 +- .../Rogue/ConsecratedWaterProjectile.cs | 2 +- Projectiles/Rogue/CraniumSmasherExplosive.cs | 12 +- Projectiles/Rogue/EclipseMirrorBurst.cs | 2 +- Projectiles/Rogue/InkBombProjectile.cs | 2 +- Projectiles/Rogue/InkCloud.cs | 2 +- Projectiles/Rogue/InkCloud2.cs | 2 +- Projectiles/Rogue/InkCloud3.cs | 2 +- Projectiles/Rogue/IronFrancisca.cs | 2 +- Projectiles/Rogue/KylieBoomerang.cs | 5 +- Projectiles/Rogue/LeadTomahawk.cs | 2 +- Projectiles/Rogue/MeteorFist.cs | 16 +- Projectiles/Rogue/MonkeyDart.cs | 4 +- Projectiles/Rogue/MoonSigil.cs | 2 +- Projectiles/Rogue/ScarletBlast.cs | 4 +- .../Rogue/ScourgeoftheSeasProjectile.cs | 2 +- Projectiles/Rogue/ScourgeoftheSeasStealth.cs | 2 +- Projectiles/Rogue/Stormfrontspark.cs | 10 +- Projectiles/Shrines/UnstableSpark.cs | 10 +- Projectiles/Summon/BlackHawkSummon.cs | 6 +- Projectiles/Summon/BrimstoneFireSummon.cs | 8 +- Projectiles/Summon/Dreadmine.cs | 16 +- Projectiles/Summon/GigaFlareFriendly.cs | 16 +- Projectiles/SunkenSea/ClamCrusherFlail.cs | 4 +- Projectiles/SunkenSea/EutrophicSpark.cs | 10 +- Projectiles/SunkenSea/SeafoamBomb.cs | 12 +- Projectiles/Typeless/BloodBombExplosion.cs | 4 +- Projectiles/Typeless/ChaosBlaze.cs | 4 +- Projectiles/Typeless/ChaosGeyser.cs | 10 +- Projectiles/Typeless/DragonDust.cs | 4 +- Projectiles/Typeless/FuckYou.cs | 14 +- Projectiles/Typeless/GodSlayerBlaze.cs | 4 +- Projectiles/Typeless/GodSlayerShrapnel.cs | 10 +- Projectiles/Typeless/GoldenGun.cs | 8 +- Projectiles/Typeless/HolyEruption.cs | 10 +- Projectiles/Typeless/OmegaBlueTentacle.cs | 8 +- Projectiles/Typeless/ReaverBlast.cs | 4 +- Projectiles/Typeless/SkyFlareFriendly.cs | 16 +- Projectiles/Typeless/StandingFire.cs | 10 +- Projectiles/Typeless/XerocBlast.cs | 4 +- Projectiles/Typeless/XerocFire.cs | 10 +- Tiles/Astral/AstralChestLocked.cs | 49 +- Tiles/Astral/AstralMonolith.cs | 4 +- Tiles/Astral/AstralTree.cs | 10 +- Tiles/AstralBrick.cs | 4 +- Tiles/AstralDesert/AstralPalmTree.cs | 8 +- Tiles/CalamityGlobalTile.cs | 4 +- Tiles/FurnitureAbyss/AbyssBed.cs | 3 +- Tiles/FurnitureAbyss/AbyssChest.cs | 4 +- Tiles/FurnitureAbyss/AbyssClock.cs | 93 +- Tiles/FurnitureAbyss/AbyssDresser.cs | 16 +- Tiles/FurnitureAncient/AncientBed.cs | 3 +- Tiles/FurnitureAncient/AncientDresser.cs | 186 ++-- Tiles/FurnitureAncient/AncientMonolith.cs | 3 +- Tiles/FurnitureAshen/AshenBed.cs | 3 +- Tiles/FurnitureAshen/AshenChest.cs | 36 +- Tiles/FurnitureAshen/AshenDresser.cs | 186 ++-- Tiles/FurnitureAshen/AshenMonolith.cs | 99 +- Tiles/FurnitureBotanic/BotanicBed.cs | 3 +- Tiles/FurnitureBotanic/BotanicChest.cs | 146 +-- Tiles/FurnitureBotanic/BotanicClock.cs | 93 +- Tiles/FurnitureBotanic/BotanicDresser.cs | 186 ++-- Tiles/FurnitureCosmilite/CosmiliteBed.cs | 3 +- Tiles/FurnitureCosmilite/CosmiliteChest.cs | 146 +-- Tiles/FurnitureCosmilite/CosmiliteClock.cs | 97 +- Tiles/FurnitureCosmilite/CosmiliteDresser.cs | 186 ++-- Tiles/FurnitureEutrophic/EutrophicBed.cs | 3 +- Tiles/FurnitureEutrophic/EutrophicChest.cs | 146 +-- Tiles/FurnitureEutrophic/EutrophicClock.cs | 93 +- Tiles/FurnitureEutrophic/EutrophicDresser.cs | 186 ++-- Tiles/FurnitureOccult/OccultBed.cs | 3 +- Tiles/FurnitureOccult/OccultChest.cs | 146 +-- Tiles/FurnitureOccult/OccultClock.cs | 93 +- Tiles/FurnitureOccult/OccultDresser.cs | 186 ++-- .../FurniturePlaguedPlate/PlaguedPlateBed.cs | 3 +- .../PlaguedPlateChest.cs | 146 +-- .../PlaguedPlateClock.cs | 93 +- .../PlaguedPlateDresser.cs | 186 ++-- Tiles/FurnitureProfaned/ProfanedBed.cs | 3 +- Tiles/FurnitureProfaned/ProfanedChest.cs | 146 +-- Tiles/FurnitureProfaned/ProfanedClock.cs | 93 +- Tiles/FurnitureProfaned/ProfanedDresser.cs | 186 ++-- Tiles/FurnitureProfaned/ProfanedRock.cs | 2 +- Tiles/FurnitureSilva/SilvaBed.cs | 3 +- Tiles/FurnitureSilva/SilvaChest.cs | 146 +-- Tiles/FurnitureSilva/SilvaClock.cs | 93 +- Tiles/FurnitureSilva/SilvaDresser.cs | 186 ++-- Tiles/FurnitureStatigel/StatigelBed.cs | 3 +- Tiles/FurnitureStatigel/StatigelChest.cs | 146 +-- Tiles/FurnitureStatigel/StatigelClock.cs | 93 +- Tiles/FurnitureStatigel/StatigelDresser.cs | 186 ++-- Tiles/FurnitureStratus/StratusBed.cs | 3 +- Tiles/FurnitureStratus/StratusChest.cs | 146 +-- Tiles/FurnitureStratus/StratusClock.cs | 93 +- Tiles/FurnitureStratus/StratusDresser.cs | 186 ++-- Tiles/FurnitureVoid/SmoothVoidstone.cs | 2 +- Tiles/FurnitureVoid/VoidBed.cs | 3 +- Tiles/FurnitureVoid/VoidChest.cs | 146 +-- Tiles/FurnitureVoid/VoidClock.cs | 93 +- Tiles/FurnitureVoid/VoidDresser.cs | 186 ++-- Tiles/FurnitureVoid/VoidstoneSlab.cs | 2 +- Tiles/Voidstone.cs | 2 +- UI/AstralArcanumUI.cs | 2 +- UI/UIBar.cs | 4 +- UI/UIBar2.cs | 4 +- Utilities/CalamityRecipes.cs | 18 +- Utilities/CalamityUtils.cs | 2 +- Utilities/CustomTileFraming.cs | 12 +- Utilities/DropHelper.cs | 5 +- Utilities/TileMerge.cs | 18 +- World/CalamityWorld.cs | 2 +- World/Planets/MainPlanet.cs | 5 +- World/WorldGenerationMethods.cs | 2 +- 352 files changed, 4038 insertions(+), 3869 deletions(-) diff --git a/Buffs/Permafrost/Popo.cs b/Buffs/Permafrost/Popo.cs index 4762b25c27..7d028b6842 100644 --- a/Buffs/Permafrost/Popo.cs +++ b/Buffs/Permafrost/Popo.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.Permafrost public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.snowmanPrevious) { modPlayer.snowmanPower = true; diff --git a/Buffs/Permafrost/PopoNoseless.cs b/Buffs/Permafrost/PopoNoseless.cs index b950a3c82d..8c40b62d4e 100644 --- a/Buffs/Permafrost/PopoNoseless.cs +++ b/Buffs/Permafrost/PopoNoseless.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.Permafrost public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.snowmanPrevious) { modPlayer.snowmanPower = true; diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index 2f08b5c7e3..8097f76cb3 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.abyssalDivingSuitPrevious) { player.gills = true; diff --git a/Buffs/StatBuffs/SirenBobs.cs b/Buffs/StatBuffs/SirenBobs.cs index 8aedce8c7a..4a2a74c4ce 100644 --- a/Buffs/StatBuffs/SirenBobs.cs +++ b/Buffs/StatBuffs/SirenBobs.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.sirenBoobsPrevious) { modPlayer.sirenBoobsPower = true; diff --git a/Buffs/StatBuffs/SirenBobsAlt.cs b/Buffs/StatBuffs/SirenBobsAlt.cs index a870e3ff8c..90b1850dfd 100644 --- a/Buffs/StatBuffs/SirenBobsAlt.cs +++ b/Buffs/StatBuffs/SirenBobsAlt.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.sirenBoobsAltPrevious) { modPlayer.sirenBoobsAltPower = true; diff --git a/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs b/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs index 21e0147c3c..bf02b22d2d 100644 --- a/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs +++ b/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetModPlayer(mod).abyssalMirrorCooldown = true; + player.Calamity().abyssalMirrorCooldown = true; } } } diff --git a/Buffs/StatDebuffs/EclipseMirrorCooldown.cs b/Buffs/StatDebuffs/EclipseMirrorCooldown.cs index 1a77ae9f8f..2f9e61f36d 100644 --- a/Buffs/StatDebuffs/EclipseMirrorCooldown.cs +++ b/Buffs/StatDebuffs/EclipseMirrorCooldown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetModPlayer(mod).eclipseMirrorCooldown = true; + player.Calamity().eclipseMirrorCooldown = true; } } } diff --git a/Buffs/StatDebuffs/InkBombCooldown.cs b/Buffs/StatDebuffs/InkBombCooldown.cs index ad4f09d956..ad0e0b0601 100644 --- a/Buffs/StatDebuffs/InkBombCooldown.cs +++ b/Buffs/StatDebuffs/InkBombCooldown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.GetModPlayer(mod).inkBombCooldown = true; + player.Calamity().inkBombCooldown = true; } } } diff --git a/Buffs/SummonBuffs/BlackHawkBuff.cs b/Buffs/SummonBuffs/BlackHawkBuff.cs index 57cbda5939..10cf1c845b 100644 --- a/Buffs/SummonBuffs/BlackHawkBuff.cs +++ b/Buffs/SummonBuffs/BlackHawkBuff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.SummonBuffs public override void Update(Player player, ref int buffIndex) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[mod.ProjectileType("BlackHawkSummon")] > 0) { modPlayer.blackhawk = true; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c0d0e2d84e..4a7db80e73 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -739,7 +739,7 @@ namespace CalamityMod.CalPlayer } else { - CalamityMod.Instance.Logger.Error("Unknown loadVersion: " + loadVersion); + ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); } } #endregion @@ -2280,7 +2280,7 @@ namespace CalamityMod.CalPlayer { if (abyssalDivingSuitCooldown) { - for (int l = 0; l < 22; l++) + for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; if (player.buffTime[l] < 30 && hasBuff == mod.BuffType("AbyssalDivingSuitPlatesBroken")) @@ -2396,7 +2396,7 @@ namespace CalamityMod.CalPlayer { if (player.onHitDodge) { - for (int l = 0; l < 22; l++) + for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) @@ -3069,9 +3069,9 @@ namespace CalamityMod.CalPlayer { int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); Main.dust[num].velocity *= 0.9f; Main.dust[num].noGravity = true; Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; @@ -3097,9 +3097,9 @@ namespace CalamityMod.CalPlayer { int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); Main.dust[num].velocity *= 0.9f; Main.dust[num].noGravity = true; Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; @@ -3126,7 +3126,7 @@ namespace CalamityMod.CalPlayer player.immune = true; player.immuneTime = 300; } - for (int l = 0; l < 22; l++) + for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); @@ -3163,9 +3163,9 @@ namespace CalamityMod.CalPlayer { int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default, 2f); Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); Main.dust[num].velocity *= 0.9f; Main.dust[num].noGravity = true; Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; @@ -3443,12 +3443,12 @@ namespace CalamityMod.CalPlayer if (Main.item[j].velocity.X < 90f + player.velocity.X) { Item item = Main.item[j]; - item.velocity.X = item.velocity.X + 9f; + item.velocity.X += 9f; } if (Main.item[j].velocity.X < 0f) { Item item = Main.item[j]; - item.velocity.X = item.velocity.X + 9f * 0.75f; + item.velocity.X += 9f * 0.75f; } } else @@ -3456,12 +3456,12 @@ namespace CalamityMod.CalPlayer if (Main.item[j].velocity.X > -90f + player.velocity.X) { Item item = Main.item[j]; - item.velocity.X = item.velocity.X - 9f; + item.velocity.X -= 9f; } if (Main.item[j].velocity.X > 0f) { Item item = Main.item[j]; - item.velocity.X = item.velocity.X - 9f * 0.75f; + item.velocity.X -= 9f * 0.75f; } } if ((double)player.position.Y + (double)player.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5) @@ -3469,12 +3469,12 @@ namespace CalamityMod.CalPlayer if (Main.item[j].velocity.Y < 90f) { Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y + 9f; + item.velocity.Y += 9f; } if (Main.item[j].velocity.Y < 0f) { Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y + 9f * 0.75f; + item.velocity.Y += 9f * 0.75f; } } else @@ -3482,12 +3482,12 @@ namespace CalamityMod.CalPlayer if (Main.item[j].velocity.Y > -90f) { Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y - 9f; + item.velocity.Y -= 9f; } if (Main.item[j].velocity.Y > 0f) { Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y - 9f * 0.75f; + item.velocity.Y -= 9f * 0.75f; } } } @@ -4151,7 +4151,7 @@ namespace CalamityMod.CalPlayer player.moveSpeed += floatTypeBoost; player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; bool lesserEffect = false; - for (int l = 0; l < 22; l++) + for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); @@ -4872,9 +4872,9 @@ namespace CalamityMod.CalPlayer { int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default, 2f); Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); Main.dust[num].velocity *= 0.9f; Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); @@ -4898,9 +4898,9 @@ namespace CalamityMod.CalPlayer { int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default, 2f); Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); Main.dust[num].velocity *= 0.9f; Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); @@ -6955,10 +6955,8 @@ namespace CalamityMod.CalPlayer public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel) { - if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type = mod.ItemType("ArcturusAstroidean")) - { + if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == mod.ItemType("ArcturusAstroidean")) fishingLevel = (int)(fishingLevel * 1.1f); - } } #endregion @@ -7222,27 +7220,27 @@ namespace CalamityMod.CalPlayer int num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } @@ -8225,9 +8223,9 @@ namespace CalamityMod.CalPlayer { int num18 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default, 2f); Dust expr_CDB_cp_0 = Main.dust[num18]; - expr_CDB_cp_0.position.X = expr_CDB_cp_0.position.X + (float)Main.rand.Next(-5, 6); + expr_CDB_cp_0.position.X += (float)Main.rand.Next(-5, 6); Dust expr_D02_cp_0 = Main.dust[num18]; - expr_D02_cp_0.position.Y = expr_D02_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + expr_D02_cp_0.position.Y += (float)Main.rand.Next(-5, 6); Main.dust[num18].velocity *= 0.2f; Main.dust[num18].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num18].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); @@ -8287,9 +8285,9 @@ namespace CalamityMod.CalPlayer { int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 246, 0f, 0f, 100, default, 3f); Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X = expr_13AF_cp_0.position.X + (float)Main.rand.Next(-5, 6); + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y = expr_13D6_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); Main.dust[num25].velocity *= 0.2f; Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); @@ -8350,9 +8348,9 @@ namespace CalamityMod.CalPlayer { int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X = expr_13AF_cp_0.position.X + (float)Main.rand.Next(-5, 6); + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y = expr_13D6_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); Main.dust[num25].velocity *= 0.2f; Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); @@ -8413,9 +8411,9 @@ namespace CalamityMod.CalPlayer { int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X = expr_13AF_cp_0.position.X + (float)Main.rand.Next(-5, 6); + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y = expr_13D6_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); Main.dust[num25].velocity *= 0.2f; Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); @@ -8476,9 +8474,9 @@ namespace CalamityMod.CalPlayer { int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 33, 0f, 0f, 100, default, 3f); Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X = expr_13AF_cp_0.position.X + (float)Main.rand.Next(-5, 6); + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y = expr_13D6_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); Main.dust[num25].velocity *= 0.2f; Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); @@ -8539,9 +8537,9 @@ namespace CalamityMod.CalPlayer { int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 1.25f); Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X = expr_13AF_cp_0.position.X + (float)Main.rand.Next(-5, 6); + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y = expr_13D6_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); Main.dust[num25].velocity *= 0.2f; Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); @@ -8573,9 +8571,9 @@ namespace CalamityMod.CalPlayer { int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default, 2f); Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); Main.dust[num].velocity *= 0.4f; Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index e9e015bebd..80e7843a99 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -225,7 +225,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.celestialJewel || modPlayer.astralArcanum) { bool lesserEffect = false; - for (int l = 0; l < 22; l++) + for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); @@ -253,7 +253,7 @@ namespace CalamityMod.CalPlayer else if (modPlayer.crownJewel) { bool lesserEffect = false; - for (int l = 0; l < 22; l++) + for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); diff --git a/CalamityMod.cs b/CalamityMod.cs index 8029067ec4..daba10954e 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -106,17 +106,10 @@ namespace CalamityMod public static List hornetList; public static List mossHornetList; - public static CalamityMod Instance; - - public CalamityMod() + #region Load + public override void Load() { - Instance = this; - } - - #region Load - public override void Load() - { - heartOriginal2 = Main.heartTexture; + heartOriginal2 = Main.heartTexture; heartOriginal = Main.heart2Texture; rainOriginal = Main.rainTexture; manaOriginal = Main.manaTexture; @@ -199,9 +192,7 @@ namespace CalamityMod Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(CustomShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); - Mod mod = ModLoader.GetMod("CalamityMod"); - UIHandler.OnLoad(mod); - + UIHandler.OnLoad(this); AstralArcanumUI.Load(this); } #endregion @@ -291,8 +282,6 @@ namespace CalamityMod rainOriginal = null; manaOriginal = null; carpetOriginal = null; - - Instance = null; } #endregion @@ -2806,53 +2795,53 @@ namespace CalamityMod switch (msgType) { case CalamityModMessageType.MeleeLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 0); + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0); break; case CalamityModMessageType.RangedLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 1); + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 1); break; case CalamityModMessageType.MagicLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 2); + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 2); break; case CalamityModMessageType.SummonLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 3); + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 3); break; case CalamityModMessageType.RogueLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 4); + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 4); break; case CalamityModMessageType.ExactMeleeLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 0); + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 0); break; case CalamityModMessageType.ExactRangedLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 1); + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 1); break; case CalamityModMessageType.ExactMagicLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 2); + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 2); break; case CalamityModMessageType.ExactSummonLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 3); + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 3); break; case CalamityModMessageType.ExactRogueLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 4); + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4); break; case CalamityModMessageType.StressSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleStress(reader); + Main.player[reader.ReadInt32()].Calamity().HandleStress(reader); break; case CalamityModMessageType.BossRushStage: int stage = reader.ReadInt32(); CalamityWorld.bossRushStage = stage; break; case CalamityModMessageType.AdrenalineSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleAdrenaline(reader); + Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader); break; case CalamityModMessageType.RadiationSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleRadiation(reader); + Main.player[reader.ReadInt32()].Calamity().HandleRadiation(reader); break; /*case CalamityModMessageType.DistanceFromBossSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleDistanceFromBoss(reader); + Main.player[reader.ReadInt32()].Calamity().HandleDistanceFromBoss(reader); break;*/ case CalamityModMessageType.TeleportPlayer: - Main.player[reader.ReadInt32()].GetModPlayer().HandleTeleport(reader.ReadInt32(), true, whoAmI); + Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI); break; case CalamityModMessageType.DoGCountdownSync: int countdown = reader.ReadInt32(); @@ -2867,10 +2856,10 @@ namespace CalamityMod CalamityWorld.bossType = type; break; case CalamityModMessageType.DeathCountSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleDeathCount(reader); + Main.player[reader.ReadInt32()].Calamity().HandleDeathCount(reader); break; default: - Instance.Logger.Warn("Unknown Message type: " + msgType); + Logger.Warn("Unknown Message type: " + msgType); break; } } diff --git a/Config.cs b/Config.cs index 608e8635b8..7a5ca607b8 100644 --- a/Config.cs +++ b/Config.cs @@ -37,7 +37,7 @@ namespace CalamityMod if (!ReadConfig()) { SetDefaults(); - CalamityMod.Instance.Logger.Warn("Couldn't find config file! Creating a new one..."); + ModContent.GetInstance().Logger.Warn("Couldn't find config file! Creating a new one..."); } SaveConfig(); } diff --git a/Gores/AstralWaterDroplet.cs b/Gores/AstralWaterDroplet.cs index 4e912d1296..219bfd0335 100644 --- a/Gores/AstralWaterDroplet.cs +++ b/Gores/AstralWaterDroplet.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Gores else if (gore.frame <= 9) { num = 6; - gore.velocity.Y = gore.velocity.Y + 0.2f; + gore.velocity.Y += 0.2f; if ((double)gore.velocity.Y < 0.5) { gore.velocity.Y = 0.5f; @@ -124,7 +124,7 @@ namespace CalamityMod.Gores } else { - gore.velocity.Y = gore.velocity.Y + 0.1f; + gore.velocity.Y += 0.1f; if ((int)gore.frameCounter >= num) { gore.frameCounter = 0; diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index dab49f627f..9f0c84f9f8 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthGenMoving += 0.15f; modPlayer.abyssalMirror = true; player.aggro -= 450; diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs index 148398317d..9bbcd21a6c 100644 --- a/Items/Accessories/DarkGodsSheath.cs +++ b/Items/Accessories/DarkGodsSheath.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthStrikeAlwaysCrits = true; modPlayer.stealthStrikeHalfCost = true; modPlayer.rogueStealthMax += 1; diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index ff4606fb6e..5fb15a6f94 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthGenMoving += 0.2f; modPlayer.rogueStealthMax += 1; modPlayer.eclipseMirror = true; diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index 5de38271e6..885267d521 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.throwingVelocity += 0.15f; modPlayer.featherCrown = true; } diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index 6689c18557..e8c895ba4f 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.inkBomb = true; } diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs index 3839a333aa..8a66fea7cb 100644 --- a/Items/Accessories/MirageMirror.cs +++ b/Items/Accessories/MirageMirror.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthGenMoving += 0.1f; player.aggro -= 200; } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 957cea9e12..522224c5b2 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.throwingVelocity += 0.15f; modPlayer.moonCrown = true; } diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index 27e7e203c3..92bc615c08 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthStrikeHalfCost = true; modPlayer.throwingCrit += 6; modPlayer.throwingDamage += 0.06f; diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs index 36f837060d..e41e4848d6 100644 --- a/Items/Accessories/SilencingSheath.cs +++ b/Items/Accessories/SilencingSheath.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.rogueStealthMax += 0.5f; modPlayer.stealthGenStandstill += 0.1f; } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index d5b95f3688..e1e7c0ccf1 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -167,7 +167,7 @@ namespace CalamityMod.Items.Accessories Vector2 baseSpawn = new Vector2(spawnX, spawnY); Vector2 baseVelocity = player.Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; + baseVelocity *= speed2; for (int i = 0; i < FireProjectiles; i++) { Vector2 spawn = baseSpawn; diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index 63065c90e6..bd0b4561b9 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Accessories Vector2 baseSpawn = new Vector2(spawnX, spawnY); Vector2 baseVelocity = player.Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; + baseVelocity *= speed2; for (int i = 0; i < FireProjectiles; i++) { Vector2 spawn = baseSpawn; diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index 07a54930fb..de2db629d0 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -75,14 +75,14 @@ namespace CalamityMod.Items.Accessories.Wings } int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale); Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; - expr_5A11_cp_0_cp_0.velocity.X = expr_5A11_cp_0_cp_0.velocity.X * 0.1f; + expr_5A11_cp_0_cp_0.velocity.X *= 0.1f; Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; Main.dust[num69].noGravity = true; Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); if (num66 == 4) { Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; - expr_5AA6_cp_0_cp_0.velocity.Y = expr_5AA6_cp_0_cp_0.velocity.Y + 6f; + expr_5AA6_cp_0_cp_0.velocity.Y += 6f; } } } diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 4e18e0eb61..a1223b282a 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories.Wings { if (player.controlDown && !player.merman) { - player.velocity.Y = player.velocity.Y * 0.9f; + player.velocity.Y *= 0.9f; if (player.velocity.Y > -2f && player.velocity.Y < 1f) { player.velocity.Y = 1E-05f; diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 9416bf3703..0df4e37ccc 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -74,14 +74,14 @@ namespace CalamityMod.Items.Accessories.Wings } int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale); Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; - expr_5A11_cp_0_cp_0.velocity.X = expr_5A11_cp_0_cp_0.velocity.X * 0.1f; + expr_5A11_cp_0_cp_0.velocity.X *= 0.1f; Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; Main.dust[num69].noGravity = true; Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); if (num66 == 4) { Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; - expr_5AA6_cp_0_cp_0.velocity.Y = expr_5AA6_cp_0_cp_0.velocity.Y + 6f; + expr_5AA6_cp_0_cp_0.velocity.Y += 6f; } } } diff --git a/Items/Armor/AbyssalDivingSuit.cs b/Items/Armor/AbyssalDivingSuit.cs index 9078c0fd1b..5864b702a0 100644 --- a/Items/Armor/AbyssalDivingSuit.cs +++ b/Items/Armor/AbyssalDivingSuit.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.abyssalDivingSuit = true; if (hideVisual) { diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs index 35b01cc19e..89b0a3eaf0 100644 --- a/Items/Armor/AtaxiaArmor.cs +++ b/Items/Armor/AtaxiaArmor.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor { player.statLifeMax2 += 20; player.allDamage += 0.08f; - player.GetModPlayer().AllCritBoost(4); + player.Calamity().AllCritBoost(4); } public override void AddRecipes() diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index 6c26cf6bf7..e28cf6491d 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor player.moveSpeed += 0.5f; player.carpet = true; player.allDamage += 0.12f; - player.GetModPlayer().AllCritBoost(5); + player.Calamity().AllCritBoost(5); } public override void AddRecipes() diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs index 19928906bd..7c66d96139 100644 --- a/Items/Armor/BloodflareBodyArmor.cs +++ b/Items/Armor/BloodflareBodyArmor.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor { player.statLifeMax2 += 40; player.allDamage += 0.12f; - player.GetModPlayer().AllCritBoost(8); + player.Calamity().AllCritBoost(8); if (player.lavaWet) { player.statDefense += 30; diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs index f5cb67c375..7c65d2f694 100644 --- a/Items/Armor/BloodflareCuisses.cs +++ b/Items/Armor/BloodflareCuisses.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor { player.moveSpeed += 0.3f; player.allDamage += 0.1f; - player.GetModPlayer().AllCritBoost(7); + player.Calamity().AllCritBoost(7); } public override void AddRecipes() diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs index 8c7e26187e..fa32682dfb 100644 --- a/Items/Armor/DaedalusBreastplate.cs +++ b/Items/Armor/DaedalusBreastplate.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.allDamage += 0.03f; - player.GetModPlayer().AllCritBoost(3); + player.Calamity().AllCritBoost(3); } public override void AddRecipes() diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 112d6e87ca..8e829b513d 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Armor { player.maxMinions += 10; player.allDamage += 0.3f; - player.GetModPlayer().AllCritBoost(15); + player.Calamity().AllCritBoost(15); } public override void AddRecipes() diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index 4a5a69474d..c6764c86f5 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor { player.moveSpeed += 0.35f; player.allDamage += 0.1f; - player.GetModPlayer().AllCritBoost(6); + player.Calamity().AllCritBoost(6); } public override void AddRecipes() diff --git a/Items/Armor/MolluskShelleggings.cs b/Items/Armor/MolluskShelleggings.cs index 9f5bd982a5..d84605f579 100644 --- a/Items/Armor/MolluskShelleggings.cs +++ b/Items/Armor/MolluskShelleggings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.allDamage += 0.12f; - player.GetModPlayer().AllCritBoost(4); + player.Calamity().AllCritBoost(4); player.moveSpeed -= 0.07f; } diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index d500f3b108..01e5ed9a4e 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor { player.ignoreWater = true; player.allDamage += 0.05f; - player.GetModPlayer().AllCritBoost(4); + player.Calamity().AllCritBoost(4); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Two shellfishes aid you in combat\n" + "10% increased damage\n" + "Your horizontal movement is slowed"; - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.allDamage += 0.1f; modPlayer.molluskSet = true; player.maxMinions += 4; diff --git a/Items/Armor/MolluskShellplate.cs b/Items/Armor/MolluskShellplate.cs index 7cafcd3d6c..f3e023da63 100644 --- a/Items/Armor/MolluskShellplate.cs +++ b/Items/Armor/MolluskShellplate.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.allDamage += 0.1f; - player.GetModPlayer().AllCritBoost(6); + player.Calamity().AllCritBoost(6); player.moveSpeed -= 0.15f; } diff --git a/Items/Armor/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlueChestplate.cs index afef4bf8f7..037f67f22d 100644 --- a/Items/Armor/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlueChestplate.cs @@ -28,7 +28,7 @@ No positive life regen"); public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); player.allDamage += 0.12f; modPlayer.AllCritBoost(8); modPlayer.omegaBlueChestplate = true; diff --git a/Items/Armor/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlueHelmet.cs index 641a6cbb9e..9e2a989143 100644 --- a/Items/Armor/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlueHelmet.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Armor player.ignoreWater = true; player.allDamage += 0.12f; - player.GetModPlayer().AllCritBoost(8); + player.Calamity().AllCritBoost(8); player.maxMinions += 2; } @@ -60,11 +60,11 @@ This effect has a 30 second cooldown"; player.Calamity().wearingRogueArmor = true; //raise rev caps - player.GetModPlayer().omegaBlueSet = true; + player.Calamity().omegaBlueSet = true; - if (player.GetModPlayer().omegaBlueCooldown > 0) + if (player.Calamity().omegaBlueCooldown > 0) { - if (player.GetModPlayer().omegaBlueCooldown == 1) //dust when ready to use again + if (player.Calamity().omegaBlueCooldown == 1) //dust when ready to use again { for (int i = 0; i < 66; i++) { @@ -75,12 +75,12 @@ This effect has a 30 second cooldown"; Main.dust[d].velocity *= 6.6f; } } - player.GetModPlayer().omegaBlueCooldown--; + player.Calamity().omegaBlueCooldown--; } - if (player.GetModPlayer().omegaBlueCooldown > 1500) + if (player.Calamity().omegaBlueCooldown > 1500) { - player.GetModPlayer().omegaBlueHentai = true; + player.Calamity().omegaBlueHentai = true; int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 1.6f); Main.dust[d].noGravity = true; diff --git a/Items/Armor/OmegaBlueLeggings.cs b/Items/Armor/OmegaBlueLeggings.cs index 2c21c97eef..1574c454e4 100644 --- a/Items/Armor/OmegaBlueLeggings.cs +++ b/Items/Armor/OmegaBlueLeggings.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.allDamage += 0.12f; - player.GetModPlayer().AllCritBoost(8); + player.Calamity().AllCritBoost(8); player.moveSpeed += 0.3f; } diff --git a/Items/Armor/ReaverScaleMail.cs b/Items/Armor/ReaverScaleMail.cs index 99d0565279..925cfe0a08 100644 --- a/Items/Armor/ReaverScaleMail.cs +++ b/Items/Armor/ReaverScaleMail.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor { player.statLifeMax2 += 20; player.allDamage += 0.09f; - player.GetModPlayer().AllCritBoost(4); + player.Calamity().AllCritBoost(4); } public override void AddRecipes() diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 73aec8794f..00f71a1542 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor player.statLifeMax2 += 80; player.moveSpeed += 0.2f; player.allDamage += 0.12f; - player.GetModPlayer().AllCritBoost(8); + player.Calamity().AllCritBoost(8); } public override void AddRecipes() diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index ed9b63a7ea..a785698eaf 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor { player.moveSpeed += 0.45f; player.allDamage += 0.12f; - player.GetModPlayer().AllCritBoost(7); + player.Calamity().AllCritBoost(7); } public override void AddRecipes() diff --git a/Items/Armor/SirensHeart.cs b/Items/Armor/SirensHeart.cs index 47ece8a84e..b4191d95f9 100644 --- a/Items/Armor/SirensHeart.cs +++ b/Items/Armor/SirensHeart.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.sirenBoobs = true; if (hideVisual) { diff --git a/Items/Armor/SirensHeartAlt.cs b/Items/Armor/SirensHeartAlt.cs index e8e6ea883f..d6d5c8d766 100644 --- a/Items/Armor/SirensHeartAlt.cs +++ b/Items/Armor/SirensHeartAlt.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.sirenBoobsAlt = true; if (hideVisual) { diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 17b11524e5..17c9bbda8c 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor { player.statLifeMax2 += 40; player.allDamage += 0.1f; - player.GetModPlayer().AllCritBoost(5); + player.Calamity().AllCritBoost(5); } public override void AddRecipes() diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs index b828434338..e447d8b905 100644 --- a/Items/Armor/TarragonLeggings.cs +++ b/Items/Armor/TarragonLeggings.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor player.moveSpeed += 0.15f; } player.allDamage += 0.06f; - player.GetModPlayer().AllCritBoost(6); + player.Calamity().AllCritBoost(6); } public override void AddRecipes() diff --git a/Items/BrimstoneWaifu/Gehenna.cs b/Items/BrimstoneWaifu/Gehenna.cs index 33510f31f3..4cd9ffd131 100644 --- a/Items/BrimstoneWaifu/Gehenna.cs +++ b/Items/BrimstoneWaifu/Gehenna.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.BrimstoneWaifu Vector2 baseSpawn = new Vector2(spawnX, spawnY); Vector2 baseVelocity = player.Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; + baseVelocity *= speed2; for (int i = 0; i < FireProjectiles; i++) { Vector2 spawn = baseSpawn; diff --git a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs index fbd0c9cd12..2353a80720 100644 --- a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs +++ b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.value = Item.buyPrice(platinum:2); //sell price of 40 gold item.shoot = mod.ProjectileType("CelestialReaperProjectile"); item.shootSpeed = 20f; - item.GetGlobalItem(ModLoader.GetMod("CalamityMod")).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs index 06385bd20b..cf3b635778 100644 --- a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs +++ b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.value = Item.buyPrice(gold:50); //sell price of 10 gold item.shoot = mod.ProjectileType("ConsecratedWaterProjectile"); item.shootSpeed = 15f; - item.GetGlobalItem(ModLoader.GetMod("CalamityMod")).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/CalamityCustomThrowingDamage/IronFrancisca.cs b/Items/CalamityCustomThrowingDamage/IronFrancisca.cs index 80749caa4a..ee7ef46fb1 100644 --- a/Items/CalamityCustomThrowingDamage/IronFrancisca.cs +++ b/Items/CalamityCustomThrowingDamage/IronFrancisca.cs @@ -31,8 +31,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 0; item.shoot = mod.ProjectileType("IronFrancisca"); item.shootSpeed = 12f; - Mod calamity = ModLoader.GetMod("CalamityMod"); - item.GetGlobalItem(calamity).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs b/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs index 5873386bcc..f11b0782c7 100644 --- a/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs +++ b/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs @@ -31,8 +31,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 0; item.shoot = mod.ProjectileType("LeadTomahawk"); item.shootSpeed = 12f; - Mod calamity = ModLoader.GetMod("CalamityMod"); - item.GetGlobalItem(calamity).rogue = true; + item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs index b779989618..dcd8c21408 100644 --- a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs +++ b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 64869b54ac..e92af1cc00 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -300,7 +300,7 @@ namespace CalamityMod.Items } else { - CalamityMod.Instance.Logger.Error("Unknown loadVersion: " + loadVersion); + ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); } } @@ -2376,10 +2376,10 @@ namespace CalamityMod.Items { int value = item.value; ItemLoader.ReforgePrice(item, ref value, ref Main.LocalPlayer.discount); - if (Main.LocalPlayer.GetModPlayer().reforges <= 9) //to be reset later + if (Main.LocalPlayer.Calamity().reforges <= 9) //to be reset later { - Main.LocalPlayer.GetModPlayer().moneyStolenByBandit += value / 5; - Main.LocalPlayer.GetModPlayer().reforges++; + Main.LocalPlayer.Calamity().moneyStolenByBandit += value / 5; + Main.LocalPlayer.Calamity().reforges++; } } } diff --git a/Items/Mounts/AngryDog.cs b/Items/Mounts/AngryDog.cs index eea8aa359c..386bc8890c 100644 --- a/Items/Mounts/AngryDog.cs +++ b/Items/Mounts/AngryDog.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Mounts if (dust.velocity.Y < 0f) { Dust expr_808_cp_0_cp_0 = dust; - expr_808_cp_0_cp_0.velocity.Y = expr_808_cp_0_cp_0.velocity.Y * (1f + 2f * Main.rand.NextFloat()); + expr_808_cp_0_cp_0.velocity.Y *= (1f + 2f * Main.rand.NextFloat()); } dust.velocity += mountedPlayer.velocity * 0.55f; dust.velocity *= mountedPlayer.velocity.Length() / mountedPlayer.mount.RunSpeed; diff --git a/Items/Permafrost/PermafrostsConcoction.cs b/Items/Permafrost/PermafrostsConcoction.cs index 751fd4f713..c771fd906e 100644 --- a/Items/Permafrost/PermafrostsConcoction.cs +++ b/Items/Permafrost/PermafrostsConcoction.cs @@ -28,7 +28,7 @@ You are encased in an ice barrier for 5 seconds when revived"); public override void UpdateAccessory(Player player, bool hideVisual) { player.statManaMax2 += 50; - player.GetModPlayer().permafrostsConcoction = true; + player.Calamity().permafrostsConcoction = true; } } } diff --git a/Items/Permafrost/Popo.cs b/Items/Permafrost/Popo.cs index 6d013c95f0..dba2e12327 100644 --- a/Items/Permafrost/Popo.cs +++ b/Items/Permafrost/Popo.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Permafrost public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.GetModPlayer(); + CalamityPlayer modPlayer = player.Calamity(); modPlayer.snowman = true; if (hideVisual) { diff --git a/Items/Placeables/ChaosCandle.cs b/Items/Placeables/ChaosCandle.cs index 2fd8f7f60f..b9d229ef39 100644 --- a/Items/Placeables/ChaosCandle.cs +++ b/Items/Placeables/ChaosCandle.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables public override void HoldItem(Player player) { - player.GetModPlayer().chaosCandle = true; + player.Calamity().chaosCandle = true; } public override void AddRecipes() diff --git a/Items/Placeables/TranquilityCandle.cs b/Items/Placeables/TranquilityCandle.cs index 5779ba3486..4f1bfd81c2 100644 --- a/Items/Placeables/TranquilityCandle.cs +++ b/Items/Placeables/TranquilityCandle.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables public override void HoldItem(Player player) { - player.GetModPlayer().tranquilityCandle = true; + player.Calamity().tranquilityCandle = true; } public override void AddRecipes() diff --git a/Items/SunkenSea/AmidiasPendant.cs b/Items/SunkenSea/AmidiasPendant.cs index 7981225baa..75ebc2aaef 100644 --- a/Items/SunkenSea/AmidiasPendant.cs +++ b/Items/SunkenSea/AmidiasPendant.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.SunkenSea Vector2 baseSpawn = new Vector2(spawnX, spawnY); Vector2 baseVelocity = player.Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; + baseVelocity *= speed2; for (int i = 0; i < ShardProjectiles; i++) { Vector2 spawn = baseSpawn; diff --git a/Items/Weapons/Polterghast/FatesReveal.cs b/Items/Weapons/Polterghast/FatesReveal.cs index 2afcf34918..7f274630ec 100644 --- a/Items/Weapons/Polterghast/FatesReveal.cs +++ b/Items/Weapons/Polterghast/FatesReveal.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Polterghast int num107 = 5; for (int num108 = 0; num108 < num107; num108++) { - vector.X = vector.X + (float)Main.rand.Next(-100, 101); + vector.X += (float)Main.rand.Next(-100, 101); vector.Y += (float)(Main.rand.Next(-25, 26) * num108); float spawnX = vector.X; float spawnY = vector.Y; diff --git a/Items/Weapons/RareVariants/Carnage.cs b/Items/Weapons/RareVariants/Carnage.cs index fe0c955716..675eca800c 100644 --- a/Items/Weapons/RareVariants/Carnage.cs +++ b/Items/Weapons/RareVariants/Carnage.cs @@ -44,10 +44,10 @@ namespace CalamityMod.Items.Weapons.RareVariants if (target.life <= 0) { Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 74); - target.position.X = target.position.X + (float)(target.width / 2); - target.position.Y = target.position.Y + (float)(target.height / 2); - target.position.X = target.position.X - (float)(target.width / 2); - target.position.Y = target.position.Y - (float)(target.height / 2); + target.position.X += (float)(target.width / 2); + target.position.Y += (float)(target.height / 2); + target.position.X -= (float)(target.width / 2); + target.position.Y -= (float)(target.height / 2); for (int num621 = 0; num621 < 15; num621++) { int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); diff --git a/Items/Weapons/TheMutilator.cs b/Items/Weapons/TheMutilator.cs index 0a6a2efea4..f56387dff4 100644 --- a/Items/Weapons/TheMutilator.cs +++ b/Items/Weapons/TheMutilator.cs @@ -43,10 +43,10 @@ namespace CalamityMod.Items.Weapons Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); } Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 14); - target.position.X = target.position.X + (float)(target.width / 2); - target.position.Y = target.position.Y + (float)(target.height / 2); - target.position.X = target.position.X - (float)(target.width / 2); - target.position.Y = target.position.Y - (float)(target.height / 2); + target.position.X += (float)(target.width / 2); + target.position.Y += (float)(target.height / 2); + target.position.X -= (float)(target.width / 2); + target.position.Y -= (float)(target.height / 2); for (int num621 = 0; num621 < 30; num621++) { int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 1cabf484c5..99fde856b3 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -163,9 +163,9 @@ namespace CalamityMod.Localization Load(); foreach (string[] localization in _localizations) { - ModTranslation text = CalamityMod.Instance.CreateTranslation(localization[0]); + ModTranslation text = ModContent.GetInstance().CreateTranslation(localization[0]); text.SetDefault(localization[1]); - CalamityMod.Instance.AddTranslation(text); + ModContent.GetInstance().AddTranslation(text); } Unload(); } diff --git a/MiscModSupport/ModCalls.cs b/MiscModSupport/ModCalls.cs index 80d6f2ddfe..d96501e34d 100644 --- a/MiscModSupport/ModCalls.cs +++ b/MiscModSupport/ModCalls.cs @@ -164,7 +164,7 @@ namespace CalamityMod.MiscModSupport public static bool GetInZone(Player p, string zone) { Mod calamity = ModLoader.GetMod("CalamityMod"); - CalamityPlayer mp = p.GetModPlayer(calamity); + CalamityPlayer mp = p.Calamity(); switch (zone.ToLower()) { default: return false; @@ -308,7 +308,7 @@ namespace CalamityMod.MiscModSupport public static bool GetSetBonus(Player p, string setBonus) { Mod calamity = ModLoader.GetMod("CalamityMod"); - CalamityPlayer mp = p.GetModPlayer(calamity); + CalamityPlayer mp = p.Calamity(); setBonus = setBonus.ToLower(); diff --git a/NPCs/AstralBiomeNPCs/Aries.cs b/NPCs/AstralBiomeNPCs/Aries.cs index 5d21fc7825..9b4599b18e 100644 --- a/NPCs/AstralBiomeNPCs/Aries.cs +++ b/NPCs/AstralBiomeNPCs/Aries.cs @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) + if (spawnInfo.player.Calamity().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) { return 0.15f; } diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.cs b/NPCs/AstralBiomeNPCs/AstralProbe.cs index 59738bec38..8318aa125f 100644 --- a/NPCs/AstralBiomeNPCs/AstralProbe.cs +++ b/NPCs/AstralBiomeNPCs/AstralProbe.cs @@ -263,27 +263,27 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/NPCs/AstralBiomeNPCs/AstralSlime.cs b/NPCs/AstralBiomeNPCs/AstralSlime.cs index fd71e753d0..6b170abf9d 100644 --- a/NPCs/AstralBiomeNPCs/AstralSlime.cs +++ b/NPCs/AstralBiomeNPCs/AstralSlime.cs @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) + if (spawnInfo.player.Calamity().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) { return 0.21f; } diff --git a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs index a1fbda0772..88a4ffce24 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs @@ -143,7 +143,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && spawnInfo.player.ZoneRockLayerHeight) + if (spawnInfo.player.Calamity().ZoneAstral && spawnInfo.player.ZoneRockLayerHeight) { return 0.17f; } diff --git a/NPCs/AstralBiomeNPCs/Atlas.cs b/NPCs/AstralBiomeNPCs/Atlas.cs index 0b67216e9a..75feffcff4 100644 --- a/NPCs/AstralBiomeNPCs/Atlas.cs +++ b/NPCs/AstralBiomeNPCs/Atlas.cs @@ -601,7 +601,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && spawnInfo.player.ZoneOverworldHeight) + if (spawnInfo.player.Calamity().ZoneAstral && spawnInfo.player.ZoneOverworldHeight) { return 0.06f; } diff --git a/NPCs/AstralBiomeNPCs/BigSightseer.cs b/NPCs/AstralBiomeNPCs/BigSightseer.cs index 2d42651488..1bec2cc999 100644 --- a/NPCs/AstralBiomeNPCs/BigSightseer.cs +++ b/NPCs/AstralBiomeNPCs/BigSightseer.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.GetModPlayer().ZoneAstral && (spawnInfo.player.ZoneOverworldHeight || spawnInfo.player.ZoneDirtLayerHeight)) + if (spawnInfo.player.Calamity().ZoneAstral && (spawnInfo.player.ZoneOverworldHeight || spawnInfo.player.ZoneDirtLayerHeight)) { return spawnInfo.player.ZoneDesert ? 0.14f : (spawnInfo.player.ZoneRockLayerHeight ? 0.04f : 0.17f); } diff --git a/NPCs/AstralBiomeNPCs/FusionFeeder.cs b/NPCs/AstralBiomeNPCs/FusionFeeder.cs index 405a942946..7751b463ff 100644 --- a/NPCs/AstralBiomeNPCs/FusionFeeder.cs +++ b/NPCs/AstralBiomeNPCs/FusionFeeder.cs @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && spawnInfo.player.ZoneDesert) + if (spawnInfo.player.Calamity().ZoneAstral && spawnInfo.player.ZoneDesert) { return 0.14f; } diff --git a/NPCs/AstralBiomeNPCs/Hadarian.cs b/NPCs/AstralBiomeNPCs/Hadarian.cs index 48e659074c..372f95dca8 100644 --- a/NPCs/AstralBiomeNPCs/Hadarian.cs +++ b/NPCs/AstralBiomeNPCs/Hadarian.cs @@ -181,7 +181,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.GetModPlayer().ZoneAstral && spawnInfo.player.ZoneDesert && spawnInfo.spawnTileType == mod.TileType("AstralSand") && tile.wall == WallID.None) + if (spawnInfo.player.Calamity().ZoneAstral && spawnInfo.player.ZoneDesert && spawnInfo.spawnTileType == mod.TileType("AstralSand") && tile.wall == WallID.None) { return 0.25f; } diff --git a/NPCs/AstralBiomeNPCs/Hive.cs b/NPCs/AstralBiomeNPCs/Hive.cs index cbbd6ae0d3..ee3c257f50 100644 --- a/NPCs/AstralBiomeNPCs/Hive.cs +++ b/NPCs/AstralBiomeNPCs/Hive.cs @@ -124,7 +124,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs if (anyHives) return 0f; Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.GetModPlayer().ZoneAstral && (spawnInfo.player.ZoneDirtLayerHeight || spawnInfo.player.ZoneRockLayerHeight)) + if (spawnInfo.player.Calamity().ZoneAstral && (spawnInfo.player.ZoneDirtLayerHeight || spawnInfo.player.ZoneRockLayerHeight)) { return 0.17f; } diff --git a/NPCs/AstralBiomeNPCs/Mantis.cs b/NPCs/AstralBiomeNPCs/Mantis.cs index a278e217e1..6719c85896 100644 --- a/NPCs/AstralBiomeNPCs/Mantis.cs +++ b/NPCs/AstralBiomeNPCs/Mantis.cs @@ -224,7 +224,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) + if (spawnInfo.player.Calamity().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) { return 0.16f; } diff --git a/NPCs/AstralBiomeNPCs/Nova.cs b/NPCs/AstralBiomeNPCs/Nova.cs index c458cff6f9..6d947ac5d3 100644 --- a/NPCs/AstralBiomeNPCs/Nova.cs +++ b/NPCs/AstralBiomeNPCs/Nova.cs @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && spawnInfo.player.ZoneOverworldHeight) + if (spawnInfo.player.Calamity().ZoneAstral && spawnInfo.player.ZoneOverworldHeight) { return 0.19f; } diff --git a/NPCs/AstralBiomeNPCs/SmallSightseer.cs b/NPCs/AstralBiomeNPCs/SmallSightseer.cs index c3cb82617a..91429c0fdb 100644 --- a/NPCs/AstralBiomeNPCs/SmallSightseer.cs +++ b/NPCs/AstralBiomeNPCs/SmallSightseer.cs @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.GetModPlayer().ZoneAstral && (spawnInfo.player.ZoneOverworldHeight || spawnInfo.player.ZoneDirtLayerHeight)) + if (spawnInfo.player.Calamity().ZoneAstral && (spawnInfo.player.ZoneOverworldHeight || spawnInfo.player.ZoneDirtLayerHeight)) { return spawnInfo.player.ZoneDesert ? 0.16f : (spawnInfo.player.ZoneRockLayerHeight ? 0.08f : 0.2f); } diff --git a/NPCs/AstralBiomeNPCs/StellarCulex.cs b/NPCs/AstralBiomeNPCs/StellarCulex.cs index adda27567d..9c22bd6778 100644 --- a/NPCs/AstralBiomeNPCs/StellarCulex.cs +++ b/NPCs/AstralBiomeNPCs/StellarCulex.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && spawnInfo.player.ZoneRockLayerHeight) + if (spawnInfo.player.Calamity().ZoneAstral && spawnInfo.player.ZoneRockLayerHeight) { return 0.16f; } diff --git a/NPCs/AstralBiomeNPCs/Twinkler.cs b/NPCs/AstralBiomeNPCs/Twinkler.cs index 76e7562744..87e4a7062c 100644 --- a/NPCs/AstralBiomeNPCs/Twinkler.cs +++ b/NPCs/AstralBiomeNPCs/Twinkler.cs @@ -59,14 +59,14 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.GetModPlayer().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) + if (spawnInfo.player.Calamity().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) { return SpawnCondition.TownCritter.Chance; } return 0f; } - public virtual void OnCatchNPC(Player player, Item item) + public override void OnCatchNPC(Player player, Item item) { try { diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index 717d60dcbd..6156673e32 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -269,27 +269,27 @@ namespace CalamityMod.NPCs.AstrumDeus int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index de5ffd0f18..7d20665b21 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -175,7 +175,7 @@ namespace CalamityMod.NPCs // Set walking direction if (Math.Abs(npc.Center.X - player.Center.X) < 200f) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; } @@ -200,16 +200,16 @@ namespace CalamityMod.NPCs flag52 = true; if (flag52) - npc.velocity.Y = npc.velocity.Y + 0.5f; + npc.velocity.Y += 0.5f; else if (Collision.SolidCollision(position2, num854, num855)) { if (npc.velocity.Y > 0f) npc.velocity.Y = 0f; if ((double)npc.velocity.Y > -0.2) - npc.velocity.Y = npc.velocity.Y - 0.025f; + npc.velocity.Y -= 0.025f; else - npc.velocity.Y = npc.velocity.Y - 0.2f; + npc.velocity.Y -= 0.2f; if (npc.velocity.Y < -4f) npc.velocity.Y = -4f; @@ -220,9 +220,9 @@ namespace CalamityMod.NPCs npc.velocity.Y = 0f; if ((double)npc.velocity.Y < 0.1) - npc.velocity.Y = npc.velocity.Y + 0.025f; + npc.velocity.Y += 0.025f; else - npc.velocity.Y = npc.velocity.Y + 0.5f; + npc.velocity.Y += 0.5f; } // Walk for a maximum of 6 seconds @@ -251,7 +251,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y == 0f) { // Slow down - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; // Half second delay before jumping npc.ai[1] += 1f; @@ -324,20 +324,20 @@ namespace CalamityMod.NPCs if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; if (player.position.Y > npc.position.Y + (float)npc.height) { float fallSpeed = 0.8f + (0.8f * (1f - lifeRatio)); - npc.velocity.Y = npc.velocity.Y + fallSpeed; + npc.velocity.Y += fallSpeed; } } else { if (npc.direction < 0) - npc.velocity.X = npc.velocity.X - 0.2f; + npc.velocity.X -= 0.2f; else if (npc.direction > 0) - npc.velocity.X = npc.velocity.X + 0.2f; + npc.velocity.X += 0.2f; float num626 = (CalamityWorld.bossRushActive ? 12f : 9f) + (6f * (1f - lifeRatio)); if (npc.velocity.X < -num626) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 14a664c40a..3b3853aa8c 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -45,27 +45,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num4) { - npc.velocity.X = npc.velocity.X + num2; + npc.velocity.X += num2; if (npc.velocity.X < 0f && num4 > 0f) - npc.velocity.X = npc.velocity.X + num2; + npc.velocity.X += num2; } else if (npc.velocity.X > num4) { - npc.velocity.X = npc.velocity.X - num2; + npc.velocity.X -= num2; if (npc.velocity.X > 0f && num4 < 0f) - npc.velocity.X = npc.velocity.X - num2; + npc.velocity.X -= num2; } if (npc.velocity.Y < num5) { - npc.velocity.Y = npc.velocity.Y + num2; + npc.velocity.Y += num2; if (npc.velocity.Y < 0f && num5 > 0f) - npc.velocity.Y = npc.velocity.Y + num2; + npc.velocity.Y += num2; } else if (npc.velocity.Y > num5) { - npc.velocity.Y = npc.velocity.Y - num2; + npc.velocity.Y -= num2; if (npc.velocity.Y > 0f && num5 < 0f) - npc.velocity.Y = npc.velocity.Y - num2; + npc.velocity.Y -= num2; } if (npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall) @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs // Faster fall if (npc.velocity.Y > 0f && CalamityWorld.bossRushActive) - npc.velocity.Y = npc.velocity.Y + 0.1f; + npc.velocity.Y += 0.1f; // Activate teleport if (!Main.player[npc.target].dead && npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f) && npc.ai[1] < 5f && npc.velocity.Y == 0f) @@ -349,7 +349,7 @@ namespace CalamityMod.NPCs // Jump if (npc.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -391,7 +391,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 3f) { npc.velocity.Y = -13f * speedMult; - npc.velocity.X = npc.velocity.X + (phase2 ? 4f : 3.5f) * (float)npc.direction; + npc.velocity.X += (phase2 ? 4f : 3.5f) * (float)npc.direction; if (CalamityWorld.bossRushActive) npc.velocity.X *= 2f; @@ -401,7 +401,7 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 2f) { npc.velocity.Y = -6f * speedMult; - npc.velocity.X = npc.velocity.X + (phase2 ? 5f : 4.5f) * (float)npc.direction; + npc.velocity.X += (phase2 ? 5f : 4.5f) * (float)npc.direction; if (CalamityWorld.bossRushActive) npc.velocity.X *= 2f; @@ -411,7 +411,7 @@ namespace CalamityMod.NPCs else { npc.velocity.Y = -8f * speedMult; - npc.velocity.X = npc.velocity.X + (phase2 ? 4.5f : 4f) * (float)npc.direction; + npc.velocity.X += (phase2 ? 4.5f : 4f) * (float)npc.direction; if (CalamityWorld.bossRushActive) npc.velocity.X *= 2f; @@ -428,9 +428,9 @@ namespace CalamityMod.NPCs else if (npc.target < 255 && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) { if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.4f : 0.2f) * (float)npc.direction; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.4f : 0.2f) * (float)npc.direction; else - npc.velocity.X = npc.velocity.X * (CalamityWorld.bossRushActive ? 0.9f : 0.93f); + npc.velocity.X *= (CalamityWorld.bossRushActive ? 0.9f : 0.93f); } // Spawn dust @@ -446,13 +446,13 @@ namespace CalamityMod.NPCs lifeRatio *= num234; if (lifeRatio != npc.scale) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; + npc.position.X += (float)(npc.width / 2); + npc.position.Y += (float)npc.height; npc.scale = lifeRatio; npc.width = (int)(98f * npc.scale); npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; + npc.position.X -= (float)(npc.width / 2); + npc.position.Y -= (float)npc.height; } // Slime spawning @@ -606,14 +606,14 @@ namespace CalamityMod.NPCs { int num10 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); Dust var_9_825_cp_0_cp_0 = Main.dust[num10]; - var_9_825_cp_0_cp_0.velocity.X = var_9_825_cp_0_cp_0.velocity.X * 0.5f; + var_9_825_cp_0_cp_0.velocity.X *= 0.5f; Dust var_9_845_cp_0_cp_0 = Main.dust[num10]; - var_9_845_cp_0_cp_0.velocity.Y = var_9_845_cp_0_cp_0.velocity.Y * 0.1f; + var_9_845_cp_0_cp_0.velocity.Y *= 0.1f; } if (Main.dayTime | dead) { - npc.velocity.Y = npc.velocity.Y - 0.04f; + npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) npc.timeLeft = 10; @@ -638,27 +638,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num13) { - npc.velocity.X = npc.velocity.X + num12; + npc.velocity.X += num12; if (npc.velocity.X < 0f && num13 > 0f) - npc.velocity.X = npc.velocity.X + num12; + npc.velocity.X += num12; } else if (npc.velocity.X > num13) { - npc.velocity.X = npc.velocity.X - num12; + npc.velocity.X -= num12; if (npc.velocity.X > 0f && num13 < 0f) - npc.velocity.X = npc.velocity.X - num12; + npc.velocity.X -= num12; } if (npc.velocity.Y < num14) { - npc.velocity.Y = npc.velocity.Y + num12; + npc.velocity.Y += num12; if (npc.velocity.Y < 0f && num14 > 0f) - npc.velocity.Y = npc.velocity.Y + num12; + npc.velocity.Y += num12; } else if (npc.velocity.Y > num14) { - npc.velocity.Y = npc.velocity.Y - num12; + npc.velocity.Y -= num12; if (npc.velocity.Y > 0f && num14 < 0f) - npc.velocity.Y = npc.velocity.Y - num12; + npc.velocity.Y -= num12; } npc.ai[2] += 1f; @@ -860,8 +860,8 @@ namespace CalamityMod.NPCs } } Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -914,27 +914,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num39) { - npc.velocity.X = npc.velocity.X + num38; + npc.velocity.X += num38; if (npc.velocity.X < 0f && num39 > 0f) - npc.velocity.X = npc.velocity.X + num38; + npc.velocity.X += num38; } else if (npc.velocity.X > num39) { - npc.velocity.X = npc.velocity.X - num38; + npc.velocity.X -= num38; if (npc.velocity.X > 0f && num39 < 0f) - npc.velocity.X = npc.velocity.X - num38; + npc.velocity.X -= num38; } if (npc.velocity.Y < num40) { - npc.velocity.Y = npc.velocity.Y + num38; + npc.velocity.Y += num38; if (npc.velocity.Y < 0f && num40 > 0f) - npc.velocity.Y = npc.velocity.Y + num38; + npc.velocity.Y += num38; } else if (npc.velocity.Y > num40) { - npc.velocity.Y = npc.velocity.Y - num38; + npc.velocity.Y -= num38; if (npc.velocity.Y > 0f && num40 < 0f) - npc.velocity.Y = npc.velocity.Y - num38; + npc.velocity.Y -= num38; } npc.ai[2] += 1f; @@ -1071,8 +1071,8 @@ namespace CalamityMod.NPCs num52 = num48 / num52; npc.velocity.X = num49 * num52; npc.velocity.Y = num50 * num52; - npc.velocity.X = npc.velocity.X + (float)Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y = npc.velocity.Y + (float)Main.rand.Next(-20, 21) * 0.1f; + npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; + npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; if (num53 < 100f) { @@ -1187,27 +1187,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num65) { - npc.velocity.X = npc.velocity.X + num64; + npc.velocity.X += num64; if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X = npc.velocity.X + num64; + npc.velocity.X += num64; } else if (npc.velocity.X > num65) { - npc.velocity.X = npc.velocity.X - num64; + npc.velocity.X -= num64; if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X = npc.velocity.X - num64; + npc.velocity.X -= num64; } if (npc.velocity.Y < num66) { - npc.velocity.Y = npc.velocity.Y + num64; + npc.velocity.Y += num64; if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y = npc.velocity.Y + num64; + npc.velocity.Y += num64; } else if (npc.velocity.Y > num66) { - npc.velocity.Y = npc.velocity.Y - num64; + npc.velocity.Y -= num64; if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y = npc.velocity.Y - num64; + npc.velocity.Y -= num64; } npc.ai[2] += 1f; @@ -1640,8 +1640,8 @@ namespace CalamityMod.NPCs num39 *= num52; num40 *= num52; npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num39; - npc.position.Y = npc.position.Y + num40; + npc.position.X += num39; + npc.position.Y += num40; } else { @@ -1658,30 +1658,30 @@ namespace CalamityMod.NPCs { npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.11f; + npc.velocity.Y += 0.11f; if (npc.velocity.Y > num37) npc.velocity.Y = num37; if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.4) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X - num38 * 1.1f; + npc.velocity.X -= num38 * 1.1f; else - npc.velocity.X = npc.velocity.X + num38 * 1.1f; + npc.velocity.X += num38 * 1.1f; } else if (npc.velocity.Y == num37) { if (npc.velocity.X < num39) - npc.velocity.X = npc.velocity.X + num38; + npc.velocity.X += num38; else if (npc.velocity.X > num39) - npc.velocity.X = npc.velocity.X - num38; + npc.velocity.X -= num38; } else if (npc.velocity.Y > 4f) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X + num38 * 0.9f; + npc.velocity.X += num38 * 0.9f; else - npc.velocity.X = npc.velocity.X - num38 * 0.9f; + npc.velocity.X -= num38 * 0.9f; } } else @@ -1747,58 +1747,58 @@ namespace CalamityMod.NPCs if ((npc.velocity.X > 0f && num39 > 0f) || (npc.velocity.X < 0f && num39 < 0f) || (npc.velocity.Y > 0f && num40 > 0f) || (npc.velocity.Y < 0f && num40 < 0f)) { if (npc.velocity.X < num39) - npc.velocity.X = npc.velocity.X + num38; + npc.velocity.X += num38; else if (npc.velocity.X > num39) - npc.velocity.X = npc.velocity.X - num38; + npc.velocity.X -= num38; if (npc.velocity.Y < num40) - npc.velocity.Y = npc.velocity.Y + num38; + npc.velocity.Y += num38; else if (npc.velocity.Y > num40) - npc.velocity.Y = npc.velocity.Y - num38; + npc.velocity.Y -= num38; if ((double)Math.Abs(num40) < (double)num37 * 0.2 && ((npc.velocity.X > 0f && num39 < 0f) || (npc.velocity.X < 0f && num39 > 0f))) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num38 * 2f; + npc.velocity.Y += num38 * 2f; else - npc.velocity.Y = npc.velocity.Y - num38 * 2f; + npc.velocity.Y -= num38 * 2f; } if ((double)Math.Abs(num39) < (double)num37 * 0.2 && ((npc.velocity.Y > 0f && num40 < 0f) || (npc.velocity.Y < 0f && num40 > 0f))) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num38 * 2f; + npc.velocity.X += num38 * 2f; else - npc.velocity.X = npc.velocity.X - num38 * 2f; + npc.velocity.X -= num38 * 2f; } } else if (num55 > num56) { if (npc.velocity.X < num39) - npc.velocity.X = npc.velocity.X + num38 * 1.1f; + npc.velocity.X += num38 * 1.1f; else if (npc.velocity.X > num39) - npc.velocity.X = npc.velocity.X - num38 * 1.1f; + npc.velocity.X -= num38 * 1.1f; if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.5) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num38; + npc.velocity.Y += num38; else - npc.velocity.Y = npc.velocity.Y - num38; + npc.velocity.Y -= num38; } } else { if (npc.velocity.Y < num40) - npc.velocity.Y = npc.velocity.Y + num38 * 1.1f; + npc.velocity.Y += num38 * 1.1f; else if (npc.velocity.Y > num40) - npc.velocity.Y = npc.velocity.Y - num38 * 1.1f; + npc.velocity.Y -= num38 * 1.1f; if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.5) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num38; + npc.velocity.X += num38; else - npc.velocity.X = npc.velocity.X - num38; + npc.velocity.X -= num38; } } } @@ -2365,7 +2365,7 @@ namespace CalamityMod.NPCs npc.localAI[3] += 1f; if (npc.localAI[3] > 60f) - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.25f; + npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; npc.ai[0] = 2f; npc.alpha = 10; @@ -2423,8 +2423,8 @@ namespace CalamityMod.NPCs // Increase speed if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < velocity) { - npc.velocity.Y = npc.velocity.Y * 1.05f; - npc.velocity.X = npc.velocity.X * 1.05f; + npc.velocity.Y *= 1.05f; + npc.velocity.X *= 1.05f; } // Charge at target @@ -2504,11 +2504,11 @@ namespace CalamityMod.NPCs if (Main.player[npc.target].dead) { if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) - npc.velocity.Y = npc.velocity.Y + 0.04f; + npc.velocity.Y += 0.04f; if (npc.position.X < (float)(Main.maxTilesX * 8)) - npc.velocity.X = npc.velocity.X - 0.04f; + npc.velocity.X -= 0.04f; else - npc.velocity.X = npc.velocity.X + 0.04f; + npc.velocity.X += 0.04f; if (npc.timeLeft > 10) { @@ -2647,9 +2647,9 @@ namespace CalamityMod.NPCs // Velocity calculations if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) - npc.velocity.Y = npc.velocity.Y + num603; + npc.velocity.Y += num603; else - npc.velocity.Y = npc.velocity.Y - num603; + npc.velocity.Y -= num603; if (npc.velocity.Y < -12f) npc.velocity.Y = -num602; @@ -2657,11 +2657,11 @@ namespace CalamityMod.NPCs npc.velocity.Y = num602; if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + npc.velocity.X += 0.15f * (float)npc.direction; else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + npc.velocity.X -= 0.15f * (float)npc.direction; else - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; // Limit velocity if (npc.velocity.X < -16f) @@ -2762,27 +2762,27 @@ namespace CalamityMod.NPCs // Velocity calculations if (npc.velocity.X < num609) { - npc.velocity.X = npc.velocity.X + num608; + npc.velocity.X += num608; if (npc.velocity.X < 0f && num609 > 0f) - npc.velocity.X = npc.velocity.X + num608; + npc.velocity.X += num608; } else if (npc.velocity.X > num609) { - npc.velocity.X = npc.velocity.X - num608; + npc.velocity.X -= num608; if (npc.velocity.X > 0f && num609 < 0f) - npc.velocity.X = npc.velocity.X - num608; + npc.velocity.X -= num608; } if (npc.velocity.Y < num610) { - npc.velocity.Y = npc.velocity.Y + num608; + npc.velocity.Y += num608; if (npc.velocity.Y < 0f && num610 > 0f) - npc.velocity.Y = npc.velocity.Y + num608; + npc.velocity.Y += num608; } else if (npc.velocity.Y > num610) { - npc.velocity.Y = npc.velocity.Y - num608; + npc.velocity.Y -= num608; if (npc.velocity.Y > 0f && num610 < 0f) - npc.velocity.Y = npc.velocity.Y - num608; + npc.velocity.Y -= num608; } } @@ -2859,27 +2859,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num612) { - npc.velocity.X = npc.velocity.X + num618; + npc.velocity.X += num618; if (npc.velocity.X < 0f && num612 > 0f) - npc.velocity.X = npc.velocity.X + num618; + npc.velocity.X += num618; } else if (npc.velocity.X > num612) { - npc.velocity.X = npc.velocity.X - num618; + npc.velocity.X -= num618; if (npc.velocity.X > 0f && num612 < 0f) - npc.velocity.X = npc.velocity.X - num618; + npc.velocity.X -= num618; } if (npc.velocity.Y < num613) { - npc.velocity.Y = npc.velocity.Y + num618; + npc.velocity.Y += num618; if (npc.velocity.Y < 0f && num613 > 0f) - npc.velocity.Y = npc.velocity.Y + num618; + npc.velocity.Y += num618; } else if (npc.velocity.Y > num613) { - npc.velocity.Y = npc.velocity.Y - num618; + npc.velocity.Y -= num618; if (npc.velocity.Y > 0f && num613 < 0f) - npc.velocity.Y = npc.velocity.Y - num618; + npc.velocity.Y -= num618; } } else @@ -2960,27 +2960,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num621) { - npc.velocity.X = npc.velocity.X + num620; + npc.velocity.X += num620; if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X = npc.velocity.X + num620; + npc.velocity.X += num620; } else if (npc.velocity.X > num621) { - npc.velocity.X = npc.velocity.X - num620; + npc.velocity.X -= num620; if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X = npc.velocity.X - num620; + npc.velocity.X -= num620; } if (npc.velocity.Y < num622) { - npc.velocity.Y = npc.velocity.Y + num620; + npc.velocity.Y += num620; if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y = npc.velocity.Y + num620; + npc.velocity.Y += num620; } else if (npc.velocity.Y > num622) { - npc.velocity.Y = npc.velocity.Y - num620; + npc.velocity.Y -= num620; if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y = npc.velocity.Y - num620; + npc.velocity.Y -= num620; } } else if (num623 > 100f) @@ -2989,27 +2989,27 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; if (npc.velocity.X < num621) { - npc.velocity.X = npc.velocity.X + num620; + npc.velocity.X += num620; if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X = npc.velocity.X + num620 * 2f; + npc.velocity.X += num620 * 2f; } else if (npc.velocity.X > num621) { - npc.velocity.X = npc.velocity.X - num620; + npc.velocity.X -= num620; if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X = npc.velocity.X - num620 * 2f; + npc.velocity.X -= num620 * 2f; } if (npc.velocity.Y < num622) { - npc.velocity.Y = npc.velocity.Y + num620; + npc.velocity.Y += num620; if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y = npc.velocity.Y + num620 * 2f; + npc.velocity.Y += num620 * 2f; } else if (npc.velocity.Y > num622) { - npc.velocity.Y = npc.velocity.Y - num620; + npc.velocity.Y -= num620; if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y = npc.velocity.Y - num620 * 2f; + npc.velocity.Y -= num620 * 2f; } } @@ -3332,16 +3332,16 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.player[npc.target].position.Y - 250f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y - num169; + npc.velocity.Y *= 0.98f; + npc.velocity.Y -= num169; if (npc.velocity.Y > num170) npc.velocity.Y = num170; } else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y + num169; + npc.velocity.Y *= 0.98f; + npc.velocity.Y += num169; if (npc.velocity.Y < -num170) npc.velocity.Y = -num170; } @@ -3349,8 +3349,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X - num171; + npc.velocity.X *= 0.98f; + npc.velocity.X -= num171; if (npc.velocity.X > num172) npc.velocity.X = num172; } @@ -3358,8 +3358,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X + num171; + npc.velocity.X *= 0.98f; + npc.velocity.X += num171; if (npc.velocity.X < -num172) npc.velocity.X = -num172; } @@ -3439,10 +3439,10 @@ namespace CalamityMod.NPCs // Despawn else if (npc.ai[1] == 3f) { - npc.velocity.Y = npc.velocity.Y + 0.1f; + npc.velocity.Y += 0.1f; if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.95f; - npc.velocity.X = npc.velocity.X * 0.95f; + npc.velocity.Y *= 0.95f; + npc.velocity.X *= 0.95f; if (npc.timeLeft > 50) npc.timeLeft = 50; } @@ -3495,16 +3495,16 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + npc.velocity.Y *= 0.96f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + npc.velocity.Y *= 0.96f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -3512,8 +3512,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X *= 0.96f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -3521,8 +3521,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X *= 0.96f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -3543,16 +3543,16 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + npc.velocity.Y *= 0.96f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + npc.velocity.Y *= 0.96f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -3560,8 +3560,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + npc.velocity.X *= 0.96f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -3569,8 +3569,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + npc.velocity.X *= 0.96f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -3578,16 +3578,16 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + npc.velocity.Y *= 0.96f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + npc.velocity.Y *= 0.96f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -3595,8 +3595,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + npc.velocity.X *= 0.96f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -3604,8 +3604,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + npc.velocity.X *= 0.96f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -3625,10 +3625,10 @@ namespace CalamityMod.NPCs float num186 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector23.Y; float num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186)); npc.rotation = (float)Math.Atan2((double)num186, (double)num185) + 1.57f; - npc.velocity.X = npc.velocity.X * 0.95f; - npc.velocity.Y = npc.velocity.Y - 0.1f; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.1f; - npc.velocity.Y = npc.velocity.Y - 0.06f; + npc.velocity.Y -= 0.06f; if (npc.velocity.Y < -15f) npc.velocity.Y = -15f; @@ -3662,10 +3662,10 @@ namespace CalamityMod.NPCs float num189 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector24.Y; float num190 = (float)Math.Sqrt((double)(num188 * num188 + num189 * num189)); npc.rotation = (float)Math.Atan2((double)num189, (double)num188) + 1.57f; - npc.velocity.Y = npc.velocity.Y * 0.95f; - npc.velocity.X = npc.velocity.X + 0.1f * -npc.ai[0]; + npc.velocity.Y *= 0.95f; + npc.velocity.X += 0.1f * -npc.ai[0]; - npc.velocity.X = npc.velocity.X + 0.07f * -npc.ai[0]; + npc.velocity.X += 0.07f * -npc.ai[0]; if (npc.velocity.X < -14f) npc.velocity.X = -14f; else if (npc.velocity.X > 14f) @@ -4474,11 +4474,11 @@ namespace CalamityMod.NPCs if (Main.dayTime || Main.player[npc.target].dead) { flag2 = false; - npc.velocity.Y = npc.velocity.Y + 1f; + npc.velocity.Y += 1f; if ((double)npc.position.Y > Main.worldSurface * 16.0) { - npc.velocity.Y = npc.velocity.Y + 1f; + npc.velocity.Y += 1f; fallSpeed = 32f; } @@ -4531,15 +4531,15 @@ namespace CalamityMod.NPCs num20 *= num22; num21 *= num22; npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; + npc.position.X += num20; + npc.position.Y += num21; return false; } if (!flag2) { npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; + npc.velocity.Y += 0.15f; if (npc.velocity.Y > fallSpeed) npc.velocity.Y = fallSpeed; @@ -4547,23 +4547,23 @@ namespace CalamityMod.NPCs if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.4) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X - speed * 1.1f; + npc.velocity.X -= speed * 1.1f; else - npc.velocity.X = npc.velocity.X + speed * 1.1f; + npc.velocity.X += speed * 1.1f; } else if (npc.velocity.Y == fallSpeed) { if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + speed; + npc.velocity.X += speed; else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - speed; + npc.velocity.X -= speed; } else if (npc.velocity.Y > 4f) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X + speed * 0.9f; + npc.velocity.X += speed * 0.9f; else - npc.velocity.X = npc.velocity.X - speed * 0.9f; + npc.velocity.X -= speed * 0.9f; } } else @@ -4590,69 +4590,69 @@ namespace CalamityMod.NPCs if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) { if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + turnSpeed; + npc.velocity.X += turnSpeed; else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - turnSpeed; + npc.velocity.X -= turnSpeed; if (npc.velocity.Y < num21) - npc.velocity.Y = npc.velocity.Y + turnSpeed; + npc.velocity.Y += turnSpeed; else if (npc.velocity.Y > num21) - npc.velocity.Y = npc.velocity.Y - turnSpeed; + npc.velocity.Y -= turnSpeed; } if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) { if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + speed; + npc.velocity.X += speed; else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - speed; + npc.velocity.X -= speed; if (npc.velocity.Y < num21) - npc.velocity.Y = npc.velocity.Y + speed; + npc.velocity.Y += speed; else if (npc.velocity.Y > num21) - npc.velocity.Y = npc.velocity.Y - speed; + npc.velocity.Y -= speed; if ((double)Math.Abs(num21) < (double)fallSpeed * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + speed * 2f; + npc.velocity.Y += speed * 2f; else - npc.velocity.Y = npc.velocity.Y - speed * 2f; + npc.velocity.Y -= speed * 2f; } if ((double)Math.Abs(num20) < (double)fallSpeed * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + speed * 2f; + npc.velocity.X += speed * 2f; else - npc.velocity.X = npc.velocity.X - speed * 2f; + npc.velocity.X -= speed * 2f; } } else if (num25 > num26) { if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + speed * 1.1f; + npc.velocity.X += speed * 1.1f; else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - speed * 1.1f; + npc.velocity.X -= speed * 1.1f; if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.5) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + speed; + npc.velocity.Y += speed; else - npc.velocity.Y = npc.velocity.Y - speed; + npc.velocity.Y -= speed; } } else { if (npc.velocity.Y < num21) - npc.velocity.Y = npc.velocity.Y + speed * 1.1f; + npc.velocity.Y += speed * 1.1f; else if (npc.velocity.Y > num21) - npc.velocity.Y = npc.velocity.Y - speed * 1.1f; + npc.velocity.Y -= speed * 1.1f; if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.5) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + speed; + npc.velocity.X += speed; else - npc.velocity.X = npc.velocity.X - speed; + npc.velocity.X -= speed; } } } @@ -4750,9 +4750,9 @@ namespace CalamityMod.NPCs { int num380 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); Dust var_9_131D1_cp_0_cp_0 = Main.dust[num380]; - var_9_131D1_cp_0_cp_0.velocity.X = var_9_131D1_cp_0_cp_0.velocity.X * 0.5f; + var_9_131D1_cp_0_cp_0.velocity.X *= 0.5f; Dust var_9_131F5_cp_0_cp_0 = Main.dust[num380]; - var_9_131F5_cp_0_cp_0.velocity.Y = var_9_131F5_cp_0_cp_0.velocity.Y * 0.1f; + var_9_131F5_cp_0_cp_0.velocity.Y *= 0.1f; } if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) @@ -4769,7 +4769,7 @@ namespace CalamityMod.NPCs if (Main.dayTime | Main.player[npc.target].dead) { - npc.velocity.Y = npc.velocity.Y - 0.04f; + npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) { npc.timeLeft = 10; @@ -4805,27 +4805,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num385) { - npc.velocity.X = npc.velocity.X + num383; + npc.velocity.X += num383; if (npc.velocity.X < 0f && num385 > 0f) - npc.velocity.X = npc.velocity.X + num383; + npc.velocity.X += num383; } else if (npc.velocity.X > num385) { - npc.velocity.X = npc.velocity.X - num383; + npc.velocity.X -= num383; if (npc.velocity.X > 0f && num385 < 0f) - npc.velocity.X = npc.velocity.X - num383; + npc.velocity.X -= num383; } if (npc.velocity.Y < num386) { - npc.velocity.Y = npc.velocity.Y + num383; + npc.velocity.Y += num383; if (npc.velocity.Y < 0f && num386 > 0f) - npc.velocity.Y = npc.velocity.Y + num383; + npc.velocity.Y += num383; } else if (npc.velocity.Y > num386) { - npc.velocity.Y = npc.velocity.Y - num383; + npc.velocity.Y -= num383; if (npc.velocity.Y > 0f && num386 < 0f) - npc.velocity.Y = npc.velocity.Y - num383; + npc.velocity.Y -= num383; } npc.ai[2] += 1f; @@ -4887,8 +4887,8 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; if (npc.ai[2] >= 25f) { - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.X *= 0.96f; + npc.velocity.Y *= 0.96f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) { npc.velocity.X = 0f; @@ -4977,8 +4977,8 @@ namespace CalamityMod.NPCs Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -5022,27 +5022,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num401) { - npc.velocity.X = npc.velocity.X + num400; + npc.velocity.X += num400; if (npc.velocity.X < 0f && num401 > 0f) - npc.velocity.X = npc.velocity.X + num400; + npc.velocity.X += num400; } else if (npc.velocity.X > num401) { - npc.velocity.X = npc.velocity.X - num400; + npc.velocity.X -= num400; if (npc.velocity.X > 0f && num401 < 0f) - npc.velocity.X = npc.velocity.X - num400; + npc.velocity.X -= num400; } if (npc.velocity.Y < num402) { - npc.velocity.Y = npc.velocity.Y + num400; + npc.velocity.Y += num400; if (npc.velocity.Y < 0f && num402 > 0f) - npc.velocity.Y = npc.velocity.Y + num400; + npc.velocity.Y += num400; } else if (npc.velocity.Y > num402) { - npc.velocity.Y = npc.velocity.Y - num400; + npc.velocity.Y -= num400; if (npc.velocity.Y > 0f && num402 < 0f) - npc.velocity.Y = npc.velocity.Y - num400; + npc.velocity.Y -= num400; } npc.ai[2] += (spazAlive ? 1f : 1.25f); @@ -5126,27 +5126,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num411) { - npc.velocity.X = npc.velocity.X + num410; + npc.velocity.X += num410; if (npc.velocity.X < 0f && num411 > 0f) - npc.velocity.X = npc.velocity.X + num410; + npc.velocity.X += num410; } else if (npc.velocity.X > num411) { - npc.velocity.X = npc.velocity.X - num410; + npc.velocity.X -= num410; if (npc.velocity.X > 0f && num411 < 0f) - npc.velocity.X = npc.velocity.X - num410; + npc.velocity.X -= num410; } if (npc.velocity.Y < num412) { - npc.velocity.Y = npc.velocity.Y + num410; + npc.velocity.Y += num410; if (npc.velocity.Y < 0f && num412 > 0f) - npc.velocity.Y = npc.velocity.Y + num410; + npc.velocity.Y += num410; } else if (npc.velocity.Y > num412) { - npc.velocity.Y = npc.velocity.Y - num410; + npc.velocity.Y -= num410; if (npc.velocity.Y > 0f && num412 < 0f) - npc.velocity.Y = npc.velocity.Y - num410; + npc.velocity.Y -= num410; } vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -5332,27 +5332,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num65) { - npc.velocity.X = npc.velocity.X + num64; + npc.velocity.X += num64; if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X = npc.velocity.X + num64; + npc.velocity.X += num64; } else if (npc.velocity.X > num65) { - npc.velocity.X = npc.velocity.X - num64; + npc.velocity.X -= num64; if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X = npc.velocity.X - num64; + npc.velocity.X -= num64; } if (npc.velocity.Y < num66) { - npc.velocity.Y = npc.velocity.Y + num64; + npc.velocity.Y += num64; if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y = npc.velocity.Y + num64; + npc.velocity.Y += num64; } else if (npc.velocity.Y > num66) { - npc.velocity.Y = npc.velocity.Y - num64; + npc.velocity.Y -= num64; if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y = npc.velocity.Y - num64; + npc.velocity.Y -= num64; } // Take 1.25 or 1 second to get in position, then charge @@ -5438,8 +5438,8 @@ namespace CalamityMod.NPCs { int num422 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); Dust dust = Main.dust[num422]; - dust.velocity.X = dust.velocity.X * 0.5f; - dust.velocity.Y = dust.velocity.Y * 0.1f; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.1f; } // Despawn Twins at the same time @@ -5458,7 +5458,7 @@ namespace CalamityMod.NPCs // Despawn if (Main.dayTime | Main.player[npc.target].dead) { - npc.velocity.Y = npc.velocity.Y - 0.04f; + npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) { npc.timeLeft = 10; @@ -5499,27 +5499,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num427) { - npc.velocity.X = npc.velocity.X + num425; + npc.velocity.X += num425; if (npc.velocity.X < 0f && num427 > 0f) - npc.velocity.X = npc.velocity.X + num425; + npc.velocity.X += num425; } else if (npc.velocity.X > num427) { - npc.velocity.X = npc.velocity.X - num425; + npc.velocity.X -= num425; if (npc.velocity.X > 0f && num427 < 0f) - npc.velocity.X = npc.velocity.X - num425; + npc.velocity.X -= num425; } if (npc.velocity.Y < num428) { - npc.velocity.Y = npc.velocity.Y + num425; + npc.velocity.Y += num425; if (npc.velocity.Y < 0f && num428 > 0f) - npc.velocity.Y = npc.velocity.Y + num425; + npc.velocity.Y += num425; } else if (npc.velocity.Y > num428) { - npc.velocity.Y = npc.velocity.Y - num425; + npc.velocity.Y -= num425; if (npc.velocity.Y > 0f && num428 < 0f) - npc.velocity.Y = npc.velocity.Y - num425; + npc.velocity.Y -= num425; } // Fire cursed flames for 5 seconds @@ -5589,8 +5589,8 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= timeBeforeSlowDown) { // Slow down - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.Y = npc.velocity.Y * 0.9f; + npc.velocity.X *= 0.9f; + npc.velocity.Y *= 0.9f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -5684,8 +5684,8 @@ namespace CalamityMod.NPCs Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -5753,27 +5753,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num443) { - npc.velocity.X = npc.velocity.X + num441; + npc.velocity.X += num441; if (npc.velocity.X < 0f && num443 > 0f) - npc.velocity.X = npc.velocity.X + num441; + npc.velocity.X += num441; } else if (npc.velocity.X > num443) { - npc.velocity.X = npc.velocity.X - num441; + npc.velocity.X -= num441; if (npc.velocity.X > 0f && num443 < 0f) - npc.velocity.X = npc.velocity.X - num441; + npc.velocity.X -= num441; } if (npc.velocity.Y < num444) { - npc.velocity.Y = npc.velocity.Y + num441; + npc.velocity.Y += num441; if (npc.velocity.Y < 0f && num444 > 0f) - npc.velocity.Y = npc.velocity.Y + num441; + npc.velocity.Y += num441; } else if (npc.velocity.Y > num444) { - npc.velocity.Y = npc.velocity.Y - num441; + npc.velocity.Y -= num441; if (npc.velocity.Y > 0f && num444 < 0f) - npc.velocity.Y = npc.velocity.Y - num441; + npc.velocity.Y -= num441; } // Fire flamethrower for x seconds @@ -6054,27 +6054,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num65) { - npc.velocity.X = npc.velocity.X + num64; + npc.velocity.X += num64; if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X = npc.velocity.X + num64; + npc.velocity.X += num64; } else if (npc.velocity.X > num65) { - npc.velocity.X = npc.velocity.X - num64; + npc.velocity.X -= num64; if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X = npc.velocity.X - num64; + npc.velocity.X -= num64; } if (npc.velocity.Y < num66) { - npc.velocity.Y = npc.velocity.Y + num64; + npc.velocity.Y += num64; if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y = npc.velocity.Y + num64; + npc.velocity.Y += num64; } else if (npc.velocity.Y > num66) { - npc.velocity.Y = npc.velocity.Y - num64; + npc.velocity.Y -= num64; if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y = npc.velocity.Y - num64; + npc.velocity.Y -= num64; } npc.ai[2] += 1f; @@ -6348,9 +6348,9 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.player[npc.target].position.Y - 350f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y *= 0.98f; - npc.velocity.Y = npc.velocity.Y - acceleration; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocity2) npc.velocity.Y = velocity2; @@ -6358,9 +6358,9 @@ namespace CalamityMod.NPCs else if (npc.position.Y < Main.player[npc.target].position.Y - 500f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y *= 0.98f; - npc.velocity.Y = npc.velocity.Y + acceleration; + npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocity2) npc.velocity.Y = -velocity2; @@ -6369,9 +6369,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 150f) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.X > 8f) npc.velocity.X = 8f; @@ -6379,9 +6379,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 150f) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.X < -8f) npc.velocity.X = -8f; @@ -6528,11 +6528,11 @@ namespace CalamityMod.NPCs // Despawning if (npc.ai[1] == 3f) { - npc.velocity.Y = npc.velocity.Y + 0.1f; + npc.velocity.Y += 0.1f; if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; - npc.velocity.X = npc.velocity.X * 0.95f; + npc.velocity.X *= 0.95f; if (npc.timeLeft > 500) npc.timeLeft = 500; @@ -6654,27 +6654,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < posX) { - npc.velocity.X = npc.velocity.X + fligthAcceleration; + npc.velocity.X += fligthAcceleration; if (npc.velocity.X < 0f && posX > 0f) - npc.velocity.X = npc.velocity.X + fligthAcceleration; + npc.velocity.X += fligthAcceleration; } else if (npc.velocity.X > posX) { - npc.velocity.X = npc.velocity.X - fligthAcceleration; + npc.velocity.X -= fligthAcceleration; if (npc.velocity.X > 0f && posX < 0f) - npc.velocity.X = npc.velocity.X - fligthAcceleration; + npc.velocity.X -= fligthAcceleration; } if (npc.velocity.Y < posY) { - npc.velocity.Y = npc.velocity.Y + fligthAcceleration; + npc.velocity.Y += fligthAcceleration; if (npc.velocity.Y < 0f && posY > 0f) - npc.velocity.Y = npc.velocity.Y + fligthAcceleration; + npc.velocity.Y += fligthAcceleration; } else if (npc.velocity.Y > posY) { - npc.velocity.Y = npc.velocity.Y - fligthAcceleration; + npc.velocity.Y -= fligthAcceleration; if (npc.velocity.Y > 0f && posY < 0f) - npc.velocity.Y = npc.velocity.Y - fligthAcceleration; + npc.velocity.Y -= fligthAcceleration; } if (npc.ai[2] % 12f == 0f) @@ -6779,9 +6779,9 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -6789,9 +6789,9 @@ namespace CalamityMod.NPCs else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y < -3f) npc.velocity.Y = -3f; @@ -6800,9 +6800,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.21f : 0.14f); + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.21f : 0.14f); if (npc.velocity.X > 8f) npc.velocity.X = 8f; @@ -6810,9 +6810,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.21f : 0.14f); + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.21f : 0.14f); if (npc.velocity.X < -8f) npc.velocity.X = -8f; @@ -6886,26 +6886,26 @@ namespace CalamityMod.NPCs if (npc.velocity.X > num513) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X *= 0.9f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); } if (npc.velocity.X < num513) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X *= 0.9f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); } if (npc.velocity.Y > num514) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.9f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.09f : 0.06f); + npc.velocity.Y *= 0.9f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.09f : 0.06f); } if (npc.velocity.Y < num514) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.9f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.09f : 0.06f); + npc.velocity.Y *= 0.9f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.09f : 0.06f); } npc.TargetClosest(true); @@ -7055,9 +7055,9 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -7065,9 +7065,9 @@ namespace CalamityMod.NPCs else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); if (npc.velocity.Y < -3f) npc.velocity.Y = -3f; @@ -7076,9 +7076,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 200f) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.3f : 0.2f); + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.3f : 0.2f); if (npc.velocity.X > 8f) npc.velocity.X = 8f; @@ -7086,9 +7086,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 160f) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.3f : 0.2f); + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.3f : 0.2f); if (npc.velocity.X < -8f) npc.velocity.X = -8f; @@ -7141,26 +7141,26 @@ namespace CalamityMod.NPCs if (npc.velocity.X > num499) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + npc.velocity.X *= 0.9f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); } if (npc.velocity.X < num499) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + npc.velocity.X *= 0.9f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); } if (npc.velocity.Y > num500) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.9f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + npc.velocity.Y *= 0.9f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); } if (npc.velocity.Y < num500) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.9f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + npc.velocity.Y *= 0.9f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); } npc.TargetClosest(true); @@ -7267,9 +7267,9 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y > 8f) npc.velocity.Y = 8f; @@ -7277,9 +7277,9 @@ namespace CalamityMod.NPCs else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y < -8f) npc.velocity.Y = -8f; @@ -7288,9 +7288,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.75f : 0.5f); if (npc.velocity.X > 12f) npc.velocity.X = 12f; @@ -7298,9 +7298,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.75f : 0.5f); if (npc.velocity.X < -12f) npc.velocity.X = -12f; @@ -7336,9 +7336,9 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -7346,9 +7346,9 @@ namespace CalamityMod.NPCs else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y < -3f) npc.velocity.Y = -3f; @@ -7357,9 +7357,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 250f) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.94f; + npc.velocity.X *= 0.94f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.45f : 0.3f); + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.45f : 0.3f); if (npc.velocity.X > 9f) npc.velocity.X = 9f; @@ -7367,9 +7367,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.94f; + npc.velocity.X *= 0.94f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.3f : 0.2f); + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.3f : 0.2f); if (npc.velocity.X < -8f) npc.velocity.X = -8f; @@ -7387,7 +7387,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 1f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.9f; + npc.velocity.Y *= 0.9f; Vector2 vector58 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num486 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 280f * npc.ai[0] - vector58.X; @@ -7396,9 +7396,9 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2((double)num487, (double)num486) + 1.57f; npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; - npc.velocity.X = npc.velocity.X + 0.5f; + npc.velocity.X += 0.5f; - npc.velocity.Y = npc.velocity.Y - 0.5f; + npc.velocity.Y -= 0.5f; if (npc.velocity.Y < -9f) npc.velocity.Y = -9f; @@ -7462,7 +7462,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; - npc.velocity.X = npc.velocity.X + 0.5f; + npc.velocity.X += 0.5f; if (npc.velocity.X > 12f) npc.velocity.X = 12f; @@ -7574,9 +7574,9 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y > 8f) npc.velocity.Y = 8f; @@ -7584,9 +7584,9 @@ namespace CalamityMod.NPCs else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); if (npc.velocity.Y < -8f) npc.velocity.Y = -8f; @@ -7595,9 +7595,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.75f : 0.5f); if (npc.velocity.X > 12f) npc.velocity.X = 12f; @@ -7605,9 +7605,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.75f : 0.5f); if (npc.velocity.X < -12f) npc.velocity.X = -12f; @@ -7639,9 +7639,9 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -7649,9 +7649,9 @@ namespace CalamityMod.NPCs else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.96f; + npc.velocity.Y *= 0.96f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); if (npc.velocity.Y < -3f) npc.velocity.Y = -3f; @@ -7660,9 +7660,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.45f : 0.3f); + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.45f : 0.3f); if (npc.velocity.X > 12f) npc.velocity.X = 12f; @@ -7670,9 +7670,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 250f) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.X *= 0.96f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.45f : 0.3f); + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.45f : 0.3f); if (npc.velocity.X < -12f) npc.velocity.X = -12f; @@ -7694,8 +7694,8 @@ namespace CalamityMod.NPCs float num473 = (float)Math.Sqrt((double)(num471 * num471 + num472 * num472)); npc.rotation = (float)Math.Atan2((double)num472, (double)num471) + 1.57f; - npc.velocity.X = npc.velocity.X * 0.95f; - npc.velocity.Y = npc.velocity.Y - 0.3f; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.3f; if (npc.velocity.Y < -8f) npc.velocity.Y = -8f; @@ -7752,26 +7752,26 @@ namespace CalamityMod.NPCs if (npc.velocity.X > num474) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.97f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + npc.velocity.X *= 0.97f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.075f : 0.05f); } if (npc.velocity.X < num474) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.97f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + npc.velocity.X *= 0.97f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.075f : 0.05f); } if (npc.velocity.Y > num475) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.97f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + npc.velocity.Y *= 0.97f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.075f : 0.05f); } if (npc.velocity.Y < num475) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.97f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + npc.velocity.Y *= 0.97f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.075f : 0.05f); } npc.ai[3] += 1f; @@ -8023,27 +8023,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num736) { - npc.velocity.X = npc.velocity.X + acceleration; + npc.velocity.X += acceleration; if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X = npc.velocity.X + acceleration * 2f; + npc.velocity.X += acceleration * 2f; } else if (npc.velocity.X > num736) { - npc.velocity.X = npc.velocity.X - acceleration; + npc.velocity.X -= acceleration; if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X = npc.velocity.X - acceleration * 2f; + npc.velocity.X -= acceleration * 2f; } if (npc.velocity.Y < num737) { - npc.velocity.Y = npc.velocity.Y + acceleration; + npc.velocity.Y += acceleration; if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y = npc.velocity.Y + acceleration * 2f; + npc.velocity.Y += acceleration * 2f; } else if (npc.velocity.Y > num737) { - npc.velocity.Y = npc.velocity.Y - acceleration; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y = npc.velocity.Y - acceleration * 2f; + npc.velocity.Y -= acceleration * 2f; } // Slow down considerably if near player @@ -8565,27 +8565,27 @@ namespace CalamityMod.NPCs num787 *= num788; if (npc.position.X < num782 + num786) { - npc.velocity.X = npc.velocity.X + num779; + npc.velocity.X += num779; if (npc.velocity.X < 0f && num786 > 0f) - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } else if (npc.position.X > num782 + num786) { - npc.velocity.X = npc.velocity.X - num779; + npc.velocity.X -= num779; if (npc.velocity.X > 0f && num786 < 0f) - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } if (npc.position.Y < num783 + num787) { - npc.velocity.Y = npc.velocity.Y + num779; + npc.velocity.Y += num779; if (npc.velocity.Y < 0f && num787 > 0f) - npc.velocity.Y = npc.velocity.Y * 0.9f; + npc.velocity.Y *= 0.9f; } else if (npc.position.Y > num783 + num787) { - npc.velocity.Y = npc.velocity.Y - num779; + npc.velocity.Y -= num779; if (npc.velocity.Y > 0f && num787 < 0f) - npc.velocity.Y = npc.velocity.Y * 0.9f; + npc.velocity.Y *= 0.9f; } if (npc.velocity.X > 8f) npc.velocity.X = 8f; @@ -8686,7 +8686,7 @@ namespace CalamityMod.NPCs Dust dust = Main.dust[num642]; dust.alpha += Main.rand.Next(100); dust.velocity *= 0.2f; - dust.velocity.Y = dust.velocity.Y - (0.5f + (float)Main.rand.Next(10) * 0.1f); + dust.velocity.Y -= (0.5f + (float)Main.rand.Next(10) * 0.1f); dust.fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.Next(10) == 0) @@ -8697,7 +8697,7 @@ namespace CalamityMod.NPCs Main.dust[num642].noGravity = true; dust = Main.dust[num642]; dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - dust.velocity.Y = dust.velocity.Y - 1f; + dust.velocity.Y -= 1f; } } } @@ -8707,7 +8707,7 @@ namespace CalamityMod.NPCs Dust dust = Main.dust[num643]; dust.alpha += Main.rand.Next(100); dust.velocity *= 0.2f; - dust.velocity.Y = dust.velocity.Y - (0.5f + (float)Main.rand.Next(10) * 0.1f); + dust.velocity.Y -= (0.5f + (float)Main.rand.Next(10) * 0.1f); dust.fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.Next(10) == 0) @@ -8718,7 +8718,7 @@ namespace CalamityMod.NPCs Main.dust[num643].noGravity = true; dust = Main.dust[num643]; dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - dust.velocity.Y = dust.velocity.Y - 1f; + dust.velocity.Y -= 1f; } } } @@ -8769,7 +8769,7 @@ namespace CalamityMod.NPCs } // Slow down - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; // Delay before jumping npc.ai[1] += 1f; @@ -8896,7 +8896,7 @@ namespace CalamityMod.NPCs // Velocity when falling if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; if (Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height) { @@ -8904,15 +8904,15 @@ namespace CalamityMod.NPCs if (enrage) fallSpeed *= 1.5f; - npc.velocity.Y = npc.velocity.Y + fallSpeed; + npc.velocity.Y += fallSpeed; } } else { if (npc.direction < 0) - npc.velocity.X = npc.velocity.X - 0.2f; + npc.velocity.X -= 0.2f; else if (npc.direction > 0) - npc.velocity.X = npc.velocity.X + 0.2f; + npc.velocity.X += 0.2f; float num648 = 3f + (6f * (1f - lifeRatio)); if (enrage) @@ -9349,27 +9349,27 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num702) { - npc.velocity.X = npc.velocity.X + num701; + npc.velocity.X += num701; if (npc.velocity.X < 0f && num702 > 0f) - npc.velocity.X = npc.velocity.X + num701; + npc.velocity.X += num701; } else if (npc.velocity.X > num702) { - npc.velocity.X = npc.velocity.X - num701; + npc.velocity.X -= num701; if (npc.velocity.X > 0f && num702 < 0f) - npc.velocity.X = npc.velocity.X - num701; + npc.velocity.X -= num701; } if (npc.velocity.Y < num703) { - npc.velocity.Y = npc.velocity.Y + num701; + npc.velocity.Y += num701; if (npc.velocity.Y < 0f && num703 > 0f) - npc.velocity.Y = npc.velocity.Y + num701; + npc.velocity.Y += num701; } else if (npc.velocity.Y > num703) { - npc.velocity.Y = npc.velocity.Y - num701; + npc.velocity.Y -= num701; if (npc.velocity.Y > 0f && num703 < 0f) - npc.velocity.Y = npc.velocity.Y - num701; + npc.velocity.Y -= num701; } } @@ -9553,7 +9553,7 @@ namespace CalamityMod.NPCs // Despawn if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - npc.velocity.Y = npc.velocity.Y - 0.4f; + npc.velocity.Y -= 0.4f; if (npc.timeLeft > 10) npc.timeLeft = 10; @@ -9745,27 +9745,27 @@ namespace CalamityMod.NPCs Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; if (npc.velocity.X < vector3.X) { - npc.velocity.X = npc.velocity.X + num3; + npc.velocity.X += num3; if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X = npc.velocity.X + num3; + npc.velocity.X += num3; } else if (npc.velocity.X > vector3.X) { - npc.velocity.X = npc.velocity.X - num3; + npc.velocity.X -= num3; if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X = npc.velocity.X - num3; + npc.velocity.X -= num3; } if (npc.velocity.Y < vector3.Y) { - npc.velocity.Y = npc.velocity.Y + num3; + npc.velocity.Y += num3; if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num3; + npc.velocity.Y += num3; } else if (npc.velocity.Y > vector3.Y) { - npc.velocity.Y = npc.velocity.Y - num3; + npc.velocity.Y -= num3; if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y = npc.velocity.Y - num3; + npc.velocity.Y -= num3; } // Rotation and direction @@ -9906,27 +9906,27 @@ namespace CalamityMod.NPCs Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor2; if (npc.velocity.X < vector5.X) { - npc.velocity.X = npc.velocity.X + num8; + npc.velocity.X += num8; if (npc.velocity.X < 0f && vector5.X > 0f) - npc.velocity.X = npc.velocity.X + num8; + npc.velocity.X += num8; } else if (npc.velocity.X > vector5.X) { - npc.velocity.X = npc.velocity.X - num8; + npc.velocity.X -= num8; if (npc.velocity.X > 0f && vector5.X < 0f) - npc.velocity.X = npc.velocity.X - num8; + npc.velocity.X -= num8; } if (npc.velocity.Y < vector5.Y) { - npc.velocity.Y = npc.velocity.Y + num8; + npc.velocity.Y += num8; if (npc.velocity.Y < 0f && vector5.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num8; + npc.velocity.Y += num8; } else if (npc.velocity.Y > vector5.Y) { - npc.velocity.Y = npc.velocity.Y - num8; + npc.velocity.Y -= num8; if (npc.velocity.Y > 0f && vector5.Y < 0f) - npc.velocity.Y = npc.velocity.Y - num8; + npc.velocity.Y -= num8; } // Play sounds and spawn bubbles @@ -10032,27 +10032,27 @@ namespace CalamityMod.NPCs Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; if (npc.velocity.X < vector8.X) { - npc.velocity.X = npc.velocity.X + num3; + npc.velocity.X += num3; if (npc.velocity.X < 0f && vector8.X > 0f) - npc.velocity.X = npc.velocity.X + num3; + npc.velocity.X += num3; } else if (npc.velocity.X > vector8.X) { - npc.velocity.X = npc.velocity.X - num3; + npc.velocity.X -= num3; if (npc.velocity.X > 0f && vector8.X < 0f) - npc.velocity.X = npc.velocity.X - num3; + npc.velocity.X -= num3; } if (npc.velocity.Y < vector8.Y) { - npc.velocity.Y = npc.velocity.Y + num3; + npc.velocity.Y += num3; if (npc.velocity.Y < 0f && vector8.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num3; + npc.velocity.Y += num3; } else if (npc.velocity.Y > vector8.Y) { - npc.velocity.Y = npc.velocity.Y - num3; + npc.velocity.Y -= num3; if (npc.velocity.Y > 0f && vector8.Y < 0f) - npc.velocity.Y = npc.velocity.Y - num3; + npc.velocity.Y -= num3; } // Direction and rotation @@ -10888,7 +10888,7 @@ namespace CalamityMod.NPCs { num18 = 0f; } - Vector2 value = new Vector2(0f, -1f).RotatedBy((double)num18, default(Vector2)) * new Vector2(150f, 200f); + Vector2 value = new Vector2(0f, -1f).RotatedBy((double)num18, default) * new Vector2(150f, 200f); Vector2 value2 = player.Center + value - center2; nPC2.ai[0] = 1f; nPC2.ai[1] = num16; @@ -11184,7 +11184,7 @@ namespace CalamityMod.NPCs float[] array = new float[num31]; for (int num32 = 0; num32 < array.Length; num32++) { - array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((double)((float)num32 * 6.28318548f / (float)num31 - 1.57079637f), default(Vector2)), player.Center); + array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((double)((float)num32 * 6.28318548f / (float)num31 - 1.57079637f), default), player.Center); } int num33 = 0; for (int num34 = 1; num34 < array.Length; num34++) @@ -11207,7 +11207,7 @@ namespace CalamityMod.NPCs { if (num33 != num36) { - Vector2 vector11 = npc.Center + spinningpoint.RotatedBy((double)((float)num36 * 6.28318548f / (float)num31 - 1.57079637f), default(Vector2)); + Vector2 vector11 = npc.Center + spinningpoint.RotatedBy((double)((float)num36 * 6.28318548f / (float)num31 - 1.57079637f), default); if (num35-- > 0) { int num37 = NPC.NewNPC((int)vector11.X, (int)vector11.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI, 0f, 0f, 0f, 0f, 255); @@ -11224,7 +11224,7 @@ namespace CalamityMod.NPCs } } npc.ai[2] = (float)Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); - npc.Center += spinningpoint.RotatedBy((double)((float)num33 * 6.28318548f / (float)num31 - 1.57079637f), default(Vector2)); + npc.Center += spinningpoint.RotatedBy((double)((float)num33 * 6.28318548f / (float)num31 - 1.57079637f), default); npc.netUpdate = true; list6.Clear(); } @@ -11446,7 +11446,7 @@ namespace CalamityMod.NPCs while ((float)num49 < 5f) { Vector2 vector19 = vec4 * scaleFactor; - vector19 = vector19.RotatedBy((double)(num48 * (float)num49 - (1.2566371f - num48) / 2f), default(Vector2)); + vector19 = vector19.RotatedBy((double)(num48 * (float)num49 - (1.2566371f - num48) / 2f), default); float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * 6.28318548f / 60f; int num50 = NPC.NewNPC((int)vector18.X, (int)vector18.Y + 7, NPCID.AncientLight, 0, 0f, ai, vector19.X, vector19.Y, 255); Main.npc[num50].velocity = vector19; @@ -11593,27 +11593,27 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(6)) { Vector2 spinningpoint4 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust17 = Main.dust[Dust.NewDust(npc.Center - spinningpoint4 * 20f, 0, 0, 27, 0f, 0f, 0, default(Color), 1f)]; + Dust dust17 = Main.dust[Dust.NewDust(npc.Center - spinningpoint4 * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; dust17.noGravity = true; dust17.position = npc.Center - spinningpoint4 * (float)Main.rand.Next(10, 21) * npc.scale; - dust17.velocity = spinningpoint4.RotatedBy(1.5707963705062866, default(Vector2)) * 4f; + dust17.velocity = spinningpoint4.RotatedBy(1.5707963705062866, default) * 4f; dust17.scale = 0.5f + Main.rand.NextFloat(); dust17.fadeIn = 0.5f; } if (Main.rand.NextBool(6)) { Vector2 spinningpoint5 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust18 = Main.dust[Dust.NewDust(npc.Center - spinningpoint5 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; + Dust dust18 = Main.dust[Dust.NewDust(npc.Center - spinningpoint5 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; dust18.noGravity = true; dust18.position = npc.Center - spinningpoint5 * 20f * npc.scale; - dust18.velocity = spinningpoint5.RotatedBy(-1.5707963705062866, default(Vector2)) * 2f; + dust18.velocity = spinningpoint5.RotatedBy(-1.5707963705062866, default) * 2f; dust18.scale = 0.5f + Main.rand.NextFloat(); dust18.fadeIn = 0.5f; } if (Main.rand.NextBool(6)) { Vector2 vector254 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust19 = Main.dust[Dust.NewDust(npc.Center - vector254 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; + Dust dust19 = Main.dust[Dust.NewDust(npc.Center - vector254 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; dust19.position = npc.Center - vector254 * 20f * npc.scale; dust19.velocity = Vector2.Zero; dust19.scale = 0.5f + Main.rand.NextFloat(); @@ -11621,7 +11621,7 @@ namespace CalamityMod.NPCs dust19.noLight = true; } npc.localAI[0] += 0.05235988f; - npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy((double)(npc.ai[1] * 6.28318548f / 60f), default(Vector2)).Y * 0.25f; + npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy((double)(npc.ai[1] * 6.28318548f / 60f), default).Y * 0.25f; if (npc.ai[1] >= num1496) { flag110 = true; @@ -11630,7 +11630,7 @@ namespace CalamityMod.NPCs int num; for (int num1501 = 0; num1501 < 4; num1501 = num + 1) { - Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy((double)(1.57079637f * (float)num1501), default(Vector2)); + Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy((double)(1.57079637f * (float)num1501), default); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.AncientDoomProjectile, 50, 0f, Main.myPlayer, 0f, 0f); num = num1501; } @@ -11875,10 +11875,10 @@ namespace CalamityMod.NPCs MoonlordDeathDrama.AddExplosion(vector159); for (float num1168 = 0f; num1168 < num1163 * 2f; num1168 = ai1 + 1f) { - Dust dust2 = Main.dust[Dust.NewDust(vector159, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)]; + Dust dust2 = Main.dust[Dust.NewDust(vector159, 0, 0, 229, 0f, 0f, 0, default, 1f)]; dust2.noGravity = true; dust2.position = vector159; - dust2.velocity = Vector2.UnitY.RotatedBy((double)(num1165 + num1164 * num1168), default(Vector2)) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); + dust2.velocity = Vector2.UnitY.RotatedBy((double)(num1165 + num1164 * num1168), default) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); dust2.fadeIn = fadeIn; dust2.scale = num1166; ai1 = num1168; @@ -11903,7 +11903,7 @@ namespace CalamityMod.NPCs if (flag87) { - Dust dust3 = Main.dust[Dust.NewDust(vector161, 0, 0, num1167, 0f, 0f, 0, default(Color), 1f)]; + Dust dust3 = Main.dust[Dust.NewDust(vector161, 0, 0, num1167, 0f, 0f, 0, default, 1f)]; dust3.noGravity = true; dust3.position = vector161; dust3.velocity = -Vector2.UnitY * scaleFactor8 * (Main.rand.NextFloat() * 0.9f + 1.6f); @@ -11934,7 +11934,7 @@ namespace CalamityMod.NPCs if (flag88) { float num1170 = (float)(Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + 0.7853982f * Main.rand.NextFloat()); - Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy((double)num1170, default(Vector2)) * 6f; + Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy((double)num1170, default) * 6f; Projectile.NewProjectile(vector163.X, vector163.Y, vector164.X, vector164.Y, ProjectileID.BlowupSmokeMoonlord, 0, 0f, Main.myPlayer, 0f, 0f); } } @@ -12209,7 +12209,7 @@ namespace CalamityMod.NPCs } Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; - int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default(Color), 1f); + int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); Main.dust[num1224].velocity = Vector2.Normalize(center20 - vector199) * 3.5f * (10f - (float)num1220 * 2f) / 10f; Main.dust[num1224].noGravity = true; Main.dust[num1224].scale = num1223; @@ -12233,7 +12233,7 @@ namespace CalamityMod.NPCs if (vector200.X < 0f) num1225 = 1f; - vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default(Vector2)); + vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, ProjectileID.PhantasmalDeathray, 75, 0f, Main.myPlayer, num1225 * 6.28318548f / rotation, (float)npc.whoAmI); npc.ai[2] = (vector200.ToRotation() + 9.424778f) * num1225; npc.netUpdate = true; @@ -12803,7 +12803,7 @@ namespace CalamityMod.NPCs Vector2 spinningpoint3 = Vector2.UnitY * (float)(-(float)npc.height) / 2f; for (int num1286 = 0; num1286 < 6; num1286++) { - int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1286 * 6.28318548f / 6f), default(Vector2)), 0, 0, 229, 0f, 0f, 0, default(Color), 1f); + int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1286 * 6.28318548f / 6f), default), 0, 0, 229, 0f, 0f, 0, default, 1f); Main.dust[num1287].velocity = -Vector2.UnitY; Main.dust[num1287].noGravity = true; Main.dust[num1287].scale = 0.7f; @@ -12813,7 +12813,7 @@ namespace CalamityMod.NPCs spinningpoint3 = Vector2.UnitY * (float)(-(float)npc.height) / 6f; for (int num1288 = 0; num1288 < 3; num1288++) { - int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1288 * 6.28318548f / 6f), default(Vector2)), 0, 0, 229, 0f, -2f, 0, default(Color), 1f); + int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1288 * 6.28318548f / 6f), default), 0, 0, 229, 0f, -2f, 0, default, 1f); Main.dust[num1289].noGravity = true; Main.dust[num1289].scale = 1.5f; Main.dust[num1289].customData = npc; @@ -12870,7 +12870,7 @@ namespace CalamityMod.NPCs if (npc.collideX) { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); if (npc.velocity.X > 4f) npc.velocity.X = 4f; @@ -12879,7 +12879,7 @@ namespace CalamityMod.NPCs } if (npc.collideY) { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; @@ -12992,7 +12992,7 @@ namespace CalamityMod.NPCs if (npc.collideX) { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); if (npc.velocity.X > 4f) npc.velocity.X = 4f; @@ -13001,7 +13001,7 @@ namespace CalamityMod.NPCs } if (npc.collideY) { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; @@ -13331,8 +13331,8 @@ namespace CalamityMod.NPCs if (Main.dayTime) { - npc.velocity.Y = npc.velocity.Y + 0.3f; - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.Y += 0.3f; + npc.velocity.X *= 0.9f; } else if (npc.ai[1] == 0f) { @@ -13397,12 +13397,12 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 2f) { npc.ai[1] = 3f; - npc.velocity.Y = npc.velocity.Y + 0.1f; + npc.velocity.Y += 0.1f; if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; - npc.velocity.X = npc.velocity.X * 0.95f; + npc.velocity.X *= 0.95f; if (npc.timeLeft > 500) npc.timeLeft = 500; @@ -13453,8 +13453,8 @@ namespace CalamityMod.NPCs if (Main.dayTime) { - npc.velocity.Y = npc.velocity.Y + 0.3f; - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.Y += 0.3f; + npc.velocity.X *= 0.9f; return false; } @@ -13518,8 +13518,8 @@ namespace CalamityMod.NPCs float num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); npc.rotation = (float)Math.Atan2((double)num880, (double)num879) + 1.57f; - npc.velocity.X = npc.velocity.X * 0.95f; - npc.velocity.Y = npc.velocity.Y - 0.3f; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.3f; if (npc.velocity.Y < -18f) npc.velocity.Y = -18f; @@ -13555,8 +13555,8 @@ namespace CalamityMod.NPCs float num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); npc.rotation = (float)Math.Atan2((double)num884, (double)num883) + 1.57f; - npc.velocity.Y = npc.velocity.Y * 0.95f; - npc.velocity.X = npc.velocity.X + 0.3f * -npc.ai[0]; + npc.velocity.Y *= 0.95f; + npc.velocity.X += 0.3f * -npc.ai[0]; if (npc.velocity.X < -18f) npc.velocity.X = -18f; @@ -13600,11 +13600,11 @@ namespace CalamityMod.NPCs if (Main.dayTime) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + 0.25f; + npc.velocity.X += 0.25f; else - npc.velocity.X = npc.velocity.X - 0.25f; + npc.velocity.X -= 0.25f; - npc.velocity.Y = npc.velocity.Y - 0.1f; + npc.velocity.Y -= 0.1f; npc.rotation = npc.velocity.X * 0.05f; } else if (npc.ai[0] == 0f) @@ -13646,7 +13646,7 @@ namespace CalamityMod.NPCs num890 = 16f; } - npc.velocity.X = npc.velocity.X + npc.ai[2] * num889; + npc.velocity.X += npc.ai[2] * num889; if (npc.velocity.X > num890) npc.velocity.X = num890; if (npc.velocity.X < -num890) @@ -13654,9 +13654,9 @@ namespace CalamityMod.NPCs float num891 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); if (num891 < 150f) - npc.velocity.Y = npc.velocity.Y - 0.2f; + npc.velocity.Y -= 0.2f; if (num891 > 200f) - npc.velocity.Y = npc.velocity.Y + 0.2f; + npc.velocity.Y += 0.2f; if (npc.velocity.Y > 9f) npc.velocity.Y = 9f; if (npc.velocity.Y < -9f) @@ -13739,24 +13739,24 @@ namespace CalamityMod.NPCs if (npc.Center.X < Main.player[npc.target].Center.X) { - npc.velocity.X = npc.velocity.X + num898; + npc.velocity.X += num898; if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; } if (npc.Center.X > Main.player[npc.target].Center.X) { - npc.velocity.X = npc.velocity.X - num898; + npc.velocity.X -= num898; if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; } if (npc.velocity.X > num899 || npc.velocity.X < -num899) - npc.velocity.X = npc.velocity.X * 0.95f; + npc.velocity.X *= 0.95f; float num900 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); if (num900 < 180f) - npc.velocity.Y = npc.velocity.Y - 0.1f; + npc.velocity.Y -= 0.1f; if (num900 > 200f) - npc.velocity.Y = npc.velocity.Y + 0.1f; + npc.velocity.Y += 0.1f; if (npc.velocity.Y > 7f) npc.velocity.Y = 7f; @@ -13934,13 +13934,13 @@ namespace CalamityMod.NPCs return; else if (npc.velocity.X < num63 && npc.direction == 1) { - npc.velocity.X = npc.velocity.X + num64; + npc.velocity.X += num64; if (npc.velocity.X > num63) npc.velocity.X = num63; } else if (npc.velocity.X > -num63 && npc.direction == -1) { - npc.velocity.X = npc.velocity.X - num64; + npc.velocity.X -= num64; if (npc.velocity.X < -num63) npc.velocity.X = -num63; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a7c4e5d9ae..81b054330b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -34,11 +34,11 @@ namespace CalamityMod.NPCs public Dictionary flatDRReductions = new Dictionary(); public Dictionary multDRReductions = new Dictionary(); - // Iron Heart - private int ironHeartDamage = 0; + // Iron Heart (currently unimplemented) + // private int ironHeartDamage = 0; - // NewAI - private const int maxAIMod = 4; + // NewAI + private const int maxAIMod = 4; public float[] newAI = new float[maxAIMod]; // Town NPC Patreon @@ -920,12 +920,12 @@ namespace CalamityMod.NPCs } #endregion - // TODO: Change Iron Heart damage in here for Iron Heart mode + // TODO -- Change Iron Heart damage in here for Iron Heart mode #region Iron Heart Changes private void IronHeartChanges(NPC npc) { // Iron Heart damage variable will scale with npc.damage - ironHeartDamage = 0; + // ironHeartDamage = 0; } #endregion @@ -945,9 +945,12 @@ namespace CalamityMod.NPCs if (((npc.boss || CalamityMod.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) || (npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod"))) { - double scalar = 1.0; + double scalar; switch (numPlayers) //Decrease HP in multiplayer before vanilla scaling { + case 1: + scalar = 1.0; + break; case 2: scalar = 0.76; break; @@ -2510,9 +2513,9 @@ namespace CalamityMod.NPCs Main.npc[num263].velocity.X = npc.velocity.X * 2f; Main.npc[num263].velocity.Y = npc.velocity.Y; NPC var_324_BB1A_cp_0_cp_0 = Main.npc[num263]; - var_324_BB1A_cp_0_cp_0.velocity.X = var_324_BB1A_cp_0_cp_0.velocity.X + (Main.rand.Next(-20, 20) * 0.1f + num262 * npc.direction * 0.3f); + var_324_BB1A_cp_0_cp_0.velocity.X += (Main.rand.Next(-20, 20) * 0.1f + num262 * npc.direction * 0.3f); NPC var_324_BB6F_cp_0_cp_0 = Main.npc[num263]; - var_324_BB6F_cp_0_cp_0.velocity.Y = var_324_BB6F_cp_0_cp_0.velocity.Y - (Main.rand.Next(0, 10) * 0.1f + num262); + var_324_BB6F_cp_0_cp_0.velocity.Y -= (Main.rand.Next(0, 10) * 0.1f + num262); Main.npc[num263].ai[0] = -1000 * Main.rand.Next(3); if (Main.netMode == NetmodeID.Server && num263 < 200) @@ -3159,7 +3162,7 @@ namespace CalamityMod.NPCs case NPCID.GoblinTinkerer: int banditIndex = NPC.FindFirstNPC(mod.NPCType("Bandit")); - if (Main.rand.NextBool(10) && banditIndex != -1 && Main.LocalPlayer.GetModPlayer().reforges >= 10) + if (Main.rand.NextBool(10) && banditIndex != -1 && Main.LocalPlayer.Calamity().reforges >= 10) { var thief = Main.npc[banditIndex]; chat = $"Hey, is it just me or have my pockets gotten lighter ever since {thief.GivenName} arrived?"; @@ -3875,38 +3878,38 @@ namespace CalamityMod.NPCs { if (npc.velocity.X < between.X) { - npc.velocity.X = npc.velocity.X + chaseAcceleration; + npc.velocity.X += chaseAcceleration; if (npc.velocity.X < 0f && between.X > 0f) { - npc.velocity.X = npc.velocity.X + chaseAcceleration; + npc.velocity.X += chaseAcceleration; } } else if (npc.velocity.X > between.X) { - npc.velocity.X = npc.velocity.X - chaseAcceleration; + npc.velocity.X -= chaseAcceleration; if (npc.velocity.X > 0f && between.X < 0f) { - npc.velocity.X = npc.velocity.X - chaseAcceleration; + npc.velocity.X -= chaseAcceleration; } } if (npc.velocity.Y < between.Y) { - npc.velocity.Y = npc.velocity.Y + chaseAcceleration; + npc.velocity.Y += chaseAcceleration; if (npc.velocity.Y < 0f && between.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + chaseAcceleration; + npc.velocity.Y += chaseAcceleration; } } else if (npc.velocity.Y > between.Y) { - npc.velocity.Y = npc.velocity.Y - chaseAcceleration; + npc.velocity.Y -= chaseAcceleration; if (npc.velocity.Y > 0f && between.Y < 0f) { - npc.velocity.Y = npc.velocity.Y - chaseAcceleration; + npc.velocity.Y -= chaseAcceleration; } } npc.rotation = between.ToRotation(); @@ -4050,11 +4053,11 @@ namespace CalamityMod.NPCs if (npc.velocity.X > maxSpeed) { - npc.velocity.X = npc.velocity.X - acceleration; + npc.velocity.X -= acceleration; } else if (npc.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X - acceleration * 0.5f; + npc.velocity.X -= acceleration * 0.5f; } if (npc.velocity.X < -maxSpeed) @@ -4064,15 +4067,15 @@ namespace CalamityMod.NPCs } else if (npc.direction == 1 && npc.velocity.X < maxSpeed) { - npc.velocity.X = npc.velocity.X + acceleration; + npc.velocity.X += acceleration; if (npc.velocity.X < -maxSpeed) { - npc.velocity.X = npc.velocity.X + acceleration; + npc.velocity.X += acceleration; } else if (npc.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X + acceleration * 0.5f; + npc.velocity.X += acceleration * 0.5f; } if (npc.velocity.X > maxSpeed) @@ -4090,20 +4093,20 @@ namespace CalamityMod.NPCs if (npc.position.Y < yLimiter) { - npc.velocity.Y = npc.velocity.Y + acceleration * 0.5f; + npc.velocity.Y += acceleration * 0.5f; if (npc.velocity.Y < 0f) { - npc.velocity.Y = npc.velocity.Y + acceleration * 0.1f; + npc.velocity.Y += acceleration * 0.1f; } } else { - npc.velocity.Y = npc.velocity.Y - acceleration * 0.5f; + npc.velocity.Y -= acceleration * 0.5f; if (npc.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y - acceleration * 0.1f; + npc.velocity.Y -= acceleration * 0.1f; } } @@ -4122,10 +4125,10 @@ namespace CalamityMod.NPCs { if (npc.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; } - npc.velocity.Y = npc.velocity.Y - 0.5f; + npc.velocity.Y -= 0.5f; if (npc.velocity.Y < -4f) { diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 9685793de8..e9f4c38a87 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -616,7 +616,7 @@ namespace CalamityMod.NPCs.Leviathan // This loot code is shared with Anahita. public static void DropSirenLeviLoot(NPC npc) { - CalamityMod mod = CalamityMod.Instance; + CalamityMod mod = ModContent.GetInstance(); DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("LeviathanTrophy"), 10); diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index cb327d47ef..8917fc4422 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -145,27 +145,27 @@ namespace CalamityMod.NPCs.NormalNPCs int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } @@ -225,8 +225,8 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.rand.Next(25) == 1) { - direction.X = direction.X * 6f; - direction.Y = direction.Y * 6f; + direction.X *= 6f; + direction.Y *= 6f; npc.velocity = direction; chargetimer = 0; } diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs index 6504fd11f6..73ebb460cb 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -147,9 +147,9 @@ namespace CalamityMod.NPCs.NormalNPCs int num13 = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, 46, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default, 2f); Main.dust[num13].noGravity = true; Dust expr_F26_cp_0 = Main.dust[num13]; - expr_F26_cp_0.velocity.X = expr_F26_cp_0.velocity.X * 0.3f; + expr_F26_cp_0.velocity.X *= 0.3f; Dust expr_F44_cp_0 = Main.dust[num13]; - expr_F44_cp_0.velocity.Y = expr_F44_cp_0.velocity.Y * 0.3f; + expr_F44_cp_0.velocity.Y *= 0.3f; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 99ef8f023a..ee0884ead6 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -707,7 +707,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 baseSpawn = new Vector2(spawnX, spawnY); Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed; + baseVelocity *= speed; for (int i = 0; i < MissileProjectiles; i++) { diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs index db20f4836b..7e635ec640 100644 --- a/NPCs/Scavenger/ScavengerBody.cs +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -182,7 +182,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[rightDust].velocity *= 0.2f; Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.Y = rightDustExpr.velocity.Y - (3f + (float)Main.rand.Next(10) * 0.1f); + rightDustExpr.velocity.Y -= (3f + (float)Main.rand.Next(10) * 0.1f); Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.Y = rightDustExpr2.velocity.Y - 4f; + rightDustExpr2.velocity.Y -= 4f; } } @@ -232,7 +232,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[rightDust].velocity *= 0.2f; Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.X = rightDustExpr.velocity.X + (3f + (float)Main.rand.Next(10) * 0.1f); + rightDustExpr.velocity.X += (3f + (float)Main.rand.Next(10) * 0.1f); Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) @@ -243,7 +243,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.X = rightDustExpr2.velocity.X + 4f; + rightDustExpr2.velocity.X += 4f; } } @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[leftDust].velocity *= 0.2f; Dust leftDustExpr = Main.dust[leftDust]; - leftDustExpr.velocity.X = leftDustExpr.velocity.X - (3f + (float)Main.rand.Next(10) * 0.1f); + leftDustExpr.velocity.X -= (3f + (float)Main.rand.Next(10) * 0.1f); Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) @@ -280,7 +280,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[leftDust].noGravity = true; Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; Dust leftDustExpr2 = Main.dust[leftDust]; - leftDustExpr2.velocity.X = leftDustExpr2.velocity.X - 4f; + leftDustExpr2.velocity.X -= 4f; } } @@ -306,7 +306,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[rightDust].velocity *= 0.2f; Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.Y = rightDustExpr.velocity.Y + (0.5f + (float)Main.rand.Next(10) * 0.1f); + rightDustExpr.velocity.Y += (0.5f + (float)Main.rand.Next(10) * 0.1f); Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) @@ -317,7 +317,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.Y = rightDustExpr2.velocity.Y + 1f; + rightDustExpr2.velocity.Y += 1f; } } @@ -342,7 +342,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[leftDust].velocity *= 0.2f; Dust leftDustExpr = Main.dust[leftDust]; - leftDustExpr.velocity.Y = leftDustExpr.velocity.Y + (0.5f + (float)Main.rand.Next(10) * 0.1f); + leftDustExpr.velocity.Y += (0.5f + (float)Main.rand.Next(10) * 0.1f); Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) @@ -353,7 +353,7 @@ namespace CalamityMod.NPCs.Scavenger Main.dust[leftDust].noGravity = true; Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; Dust leftDustExpr2 = Main.dust[leftDust]; - leftDustExpr2.velocity.Y = leftDustExpr2.velocity.Y + 1f; + leftDustExpr2.velocity.Y += 1f; } } diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index a0a6640f85..a1b207d559 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -339,7 +339,7 @@ namespace CalamityMod.NPCs.SlimeGod // This loot code is shared with every other Slime God component. public static void DropSlimeGodLoot(NPC npc) { - CalamityMod mod = CalamityMod.Instance; + CalamityMod mod = ModContent.GetInstance(); DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("SlimeGodTrophy"), 10); diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index cda35f14ea..3d6208f28a 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -247,27 +247,27 @@ namespace CalamityMod.NPCs.StormWeaver int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs index f8ac4ef7c3..91ae906c2c 100644 --- a/NPCs/StormWeaver/StasisProbeNaked.cs +++ b/NPCs/StormWeaver/StasisProbeNaked.cs @@ -247,27 +247,27 @@ namespace CalamityMod.NPCs.StormWeaver int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index f45174cfaa..4f24af6e75 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.StormWeaver Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; + baseVelocity *= speed2; for (int i = 0; i < BoltProjectiles; i++) { Vector2 spawn2 = baseSpawn; diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index f2dfd6e266..3de8acbac8 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -195,7 +195,7 @@ namespace CalamityMod.NPCs.StormWeaver Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; + baseVelocity *= speed2; for (int i = 0; i < BoltProjectiles; i++) { Vector2 spawn2 = baseSpawn; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 762da9fe00..80f7211d4f 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2120,7 +2120,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - return !CNPCUtils.AntiButcher(npc, ref damage, 0.1f); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.1f); } public override bool CheckActive() diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index dbe59559c4..7cdbe0c5ca 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -204,7 +204,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 351456d714..d76ab601b3 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -204,7 +204,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs index 38c1224ff5..2971d71baa 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -214,7 +214,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs index c1523e9de2..071eee28f2 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs index bd2e32ad57..af0463faf0 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -703,7 +703,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if(CNPCUtils.AntiButcher(npc, ref damage, 0.5f)) + if(CalamityUtils.AntiButcher(npc, ref damage, 0.5f)) { string key = "Mods.CalamityMod.EdgyBossText2"; Color messageColor = Color.Cyan; diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index 5751abf8ec..d6a8e59d9c 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -961,7 +961,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (CNPCUtils.AntiButcher(npc, ref damage, 0.5f)) + if (CalamityUtils.AntiButcher(npc, ref damage, 0.5f)) { string key = "Mods.CalamityMod.EdgyBossText2"; Color messageColor = Color.Cyan; diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs index a7c75e935e..268d54428e 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs @@ -192,7 +192,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs index 7fd86b0705..d1981eb5f6 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs @@ -266,7 +266,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index 64c65b1951..74277e204f 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -172,11 +172,11 @@ namespace CalamityMod.NPCs.TownNPCs public string Refund() { int goblinIndex = NPC.FindFirstNPC(NPCID.GoblinTinkerer); - if (goblinIndex != -1 && Main.LocalPlayer.GetModPlayer().reforges >= 10) + if (goblinIndex != -1 && Main.LocalPlayer.Calamity().reforges >= 10) { - Main.LocalPlayer.GetModPlayer().reforges = 0; - Main.LocalPlayer.SellItem((int)Main.LocalPlayer.GetModPlayer().moneyStolenByBandit, 1); - Main.LocalPlayer.GetModPlayer().moneyStolenByBandit = 0; + Main.LocalPlayer.Calamity().reforges = 0; + Main.LocalPlayer.SellItem((int)Main.LocalPlayer.Calamity().moneyStolenByBandit, 1); + Main.LocalPlayer.Calamity().moneyStolenByBandit = 0; NPC goblinFucker = Main.npc[goblinIndex]; Main.PlaySound(18, -1, -1, 1, 1f, 0f); //money dink sound switch (Main.rand.Next(2)) diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 5e97892ae1..82b8e86acc 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -104,10 +104,10 @@ namespace CalamityMod.NPCs.TownNPCs if (dryad != -1) dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); - if (Main.player[Main.myPlayer].GetModPlayer().chibii) + if (Main.player[Main.myPlayer].Calamity().chibii) dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); - if (Main.player[Main.myPlayer].GetModPlayer().cryogenSoul) + if (Main.player[Main.myPlayer].Calamity().cryogenSoul) dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); if (Main.hardMode) diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 17005c6eb6..5243ea352f 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -180,17 +180,17 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(Main.npc[waifu].GivenName + " works wonders for my hair...among other things."); } - if (Main.player[Main.myPlayer].GetModPlayer().chibii) + if (Main.player[Main.myPlayer].Calamity().chibii) dialogue.Add("Is that a toy? Looks like something I'd carry around if I was 5 years old."); - if ((Main.player[Main.myPlayer].GetModPlayer().sirenBoobs && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsHide) || - (Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAlt && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAltHide)) + if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) || + (Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide)) dialogue.Add("Nice...scales...did it get hot in here?"); - if (Main.player[Main.myPlayer].GetModPlayer().fabsolVodka) + if (Main.player[Main.myPlayer].Calamity().fabsolVodka) dialogue.Add("Oh yeah now you're drinking the good stuff! Do you like it? I created the recipe by mixing fairy dust, crystals, and other magical crap."); - if (Main.player[Main.myPlayer].GetModPlayer().fab) + if (Main.player[Main.myPlayer].Calamity().fab) { dialogue.Add("...so, you're riding me huh? That's not weird at all."); dialogue.Add("Are you coming on to me?"); @@ -215,8 +215,8 @@ namespace CalamityMod.NPCs.TownNPCs public string Death() { - return "You have failed " + Main.player[Main.myPlayer].GetModPlayer().deathCount + - (Main.player[Main.myPlayer].GetModPlayer().deathCount == 1 ? " time." : " times."); + return "You have failed " + Main.player[Main.myPlayer].Calamity().deathCount + + (Main.player[Main.myPlayer].Calamity().deathCount == 1 ? " time." : " times."); } public override void SetChatButtons(ref string button, ref string button2) diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 405b4d87bf..95426ac14a 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -110,13 +110,13 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("Oh, Yharim... did he ever realize what he was doing? He seems so...calm, as if his rage had been satiated."); }*/ - if (Main.player[Main.myPlayer].GetModPlayer().sirenPet) + if (Main.player[Main.myPlayer].Calamity().sirenPet) { dialogue.Add("Ah, nice duds, my child!"); } - if ((Main.player[Main.myPlayer].GetModPlayer().sirenBoobs && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsHide) || - (Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAlt && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAltHide)) + if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) || + (Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide)) { dialogue.Add("Shouldn't you be wearing a clam bra?"); } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index d7bdddb3dd..447810871e 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2840,7 +2840,7 @@ namespace CalamityMod.NPCs.Yharon #region StrikeNPC public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (CNPCUtils.AntiButcher(npc, ref damage, 0.1f)) return false; + if (CalamityUtils.AntiButcher(npc, ref damage, 0.1f)) return false; // Safeguard to prevent damage which would allow skipping phase 2. if (!startSecondAI && dropLoot) diff --git a/Projectiles/Amidias/AmidiasWhirlpool.cs b/Projectiles/Amidias/AmidiasWhirlpool.cs index b007d4d232..1c50aab22a 100644 --- a/Projectiles/Amidias/AmidiasWhirlpool.cs +++ b/Projectiles/Amidias/AmidiasWhirlpool.cs @@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Amidias Main.dust[num102].velocity *= 0.1f; Main.dust[num102].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + expr_47FA_cp_0.position.X -= num99; Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + expr_4815_cp_0.position.Y -= num100; } float[] var_2_2DDF8_cp_0 = projectile.ai; int var_2_2DDF8_cp_1 = 0; diff --git a/Projectiles/Amidias/WaywasherProj.cs b/Projectiles/Amidias/WaywasherProj.cs index 578edd636a..38cc9e902c 100644 --- a/Projectiles/Amidias/WaywasherProj.cs +++ b/Projectiles/Amidias/WaywasherProj.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Amidias Main.dust[num102].velocity *= 0.1f; Main.dust[num102].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + expr_47FA_cp_0.position.X -= num99; Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + expr_4815_cp_0.position.Y -= num100; } if (Main.rand.NextBool(5)) { diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index 0b85c4dc89..f457659681 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -56,18 +56,18 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 1.5f; + expr_DBEF_cp_0.velocity.X *= 1.5f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 1.5f; + expr_DC0F_cp_0.velocity.Y *= 1.5f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index ea605c88e7..3a62fe335b 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -143,27 +143,27 @@ namespace CalamityMod.Projectiles.Boss int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 759202348d..4ea0edf4b1 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -96,27 +96,27 @@ namespace CalamityMod.Projectiles.Boss int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } projectile.damage = Main.expertMode ? 300 : 180; projectile.Damage(); diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index 90ce57a2ad..b356b0b44b 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -110,27 +110,27 @@ namespace CalamityMod.Projectiles.Boss int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs index 5d45bfe403..9f7c7adf0b 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index 9df011cc99..dad6d9844a 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -91,9 +91,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 6206a81c2f..5643387d11 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -128,27 +128,27 @@ namespace CalamityMod.Projectiles.Boss int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index 5b63a13f96..e92a2ca948 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -75,9 +75,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index d78605f7d8..e2df1aa49c 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 2c44694f50..a5757c2a1b 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -134,27 +134,27 @@ namespace CalamityMod.Projectiles.Boss int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index f6b7b7a0bc..d135054061 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss { int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); Dust expr_A0A0_cp_0 = Main.dust[num310]; - expr_A0A0_cp_0.position.X = expr_A0A0_cp_0.position.X - 2f; + expr_A0A0_cp_0.position.X -= 2f; Main.dust[num310].alpha = 38; Main.dust[num310].velocity *= 0.1f; Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index 15ed4e4a26..6a3e5cf3b5 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -47,14 +47,14 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num305].noGravity = true; dust = Main.dust[num305]; dust.scale *= 3f; - dust.velocity.X = dust.velocity.X * 2f; - dust.velocity.Y = dust.velocity.Y * 2f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; } dust = Main.dust[num305]; dust.scale *= 2f; - dust.velocity.X = dust.velocity.X * 1.2f; - dust.velocity.Y = dust.velocity.Y * 1.2f; + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; dust.scale *= num302; dust.velocity += projectile.velocity; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 9ab4255258..b5ac47fb63 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[0] >= 35f) { projectile.ai[0] = 35f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; + projectile.velocity.Y += 0.01f; } projectile.tileCollide = false; @@ -151,13 +151,13 @@ namespace CalamityMod.Projectiles float num624 = -2f; float num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; - projectile.velocity.Y = projectile.velocity.Y - num625; + projectile.velocity.Y -= num625; projectile.ai[0] += 1f; num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; - projectile.velocity.Y = projectile.velocity.Y + num625; + projectile.velocity.Y += num625; projectile.localAI[0] += 1f; if (projectile.localAI[0] > 10f) @@ -199,13 +199,13 @@ namespace CalamityMod.Projectiles if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) { projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.position.X += (float)(projectile.width / 2); + projectile.position.Y += (float)(projectile.height / 2); projectile.scale = ((float)(num606 + num607) - projectile.ai[1]) * num608 / (float)(num607 + num606); projectile.width = (int)((float)num609 * projectile.scale); projectile.height = (int)((float)num610 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); projectile.netUpdate = true; } @@ -265,12 +265,12 @@ namespace CalamityMod.Projectiles float num616 = ((float)projectile.width / 5f) * 2.5f; float num617 = (float)(Math.Cos((double)(num615 * -(double)projectile.ai[0])) - 0.5) * num616; - projectile.position.X = projectile.position.X - num617 * (float)(-(float)projectile.direction); + projectile.position.X -= num617 * (float)(-(float)projectile.direction); projectile.ai[0] -= 1f; num617 = (float)(Math.Cos((double)(num615 * -(double)projectile.ai[0])) - 0.5) * num616; - projectile.position.X = projectile.position.X + num617 * (float)(-(float)projectile.direction); + projectile.position.X += num617 * (float)(-(float)projectile.direction); } return false; } @@ -356,15 +356,15 @@ namespace CalamityMod.Projectiles float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); - int num812 = Dust.NewDust(vector79, 0, 0, 229, vector80.X, vector80.Y, 0, default(Color), 1f); + int num812 = Dust.NewDust(vector79, 0, 0, 229, vector80.X, vector80.Y, 0, default, 1f); Main.dust[num812].noGravity = true; Main.dust[num812].scale = 1.7f; num3 = num809; } if (Main.rand.Next(5) == 0) { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); + Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); @@ -803,8 +803,8 @@ namespace CalamityMod.Projectiles Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); projectile.position = projectile.Center; projectile.width = (projectile.height = 96); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); for (int num193 = 0; num193 < 3; num193++) { Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 0cd20f3953..2e08f9a842 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -90,27 +90,27 @@ namespace CalamityMod.Projectiles.Enemy int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index e6e0b28543..3e4faab0bf 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -69,27 +69,27 @@ namespace CalamityMod.Projectiles.Enemy int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 4d39bf3d5d..6fa28682bb 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Enemy Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index 6f6b271a70..99c3734077 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Enemy Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Healing/AtaxiaHealOrb.cs b/Projectiles/Healing/AtaxiaHealOrb.cs index 84ca1c35d0..d85bc96978 100644 --- a/Projectiles/Healing/AtaxiaHealOrb.cs +++ b/Projectiles/Healing/AtaxiaHealOrb.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Healing/BurntSienna.cs b/Projectiles/Healing/BurntSienna.cs index 7df7e9586f..b7f755644c 100644 --- a/Projectiles/Healing/BurntSienna.cs +++ b/Projectiles/Healing/BurntSienna.cs @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } } } diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 78d49bc420..6f09c40e38 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; return; } } diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index d6ca46d0f6..2b1c525ad3 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index bd932c2e53..5ee2fa123e 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 921178dd34..3dbdbb70f3 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -73,18 +73,18 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num496].noGravity = true; Main.dust[num496].velocity *= 0f; Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; + expr_153E2_cp_0.position.X -= num494; Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; + expr_15401_cp_0.position.Y -= num495; float num498 = projectile.velocity.X * 0.2f; float num499 = -(projectile.velocity.Y * 0.2f); int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 0.7f); Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } } } diff --git a/Projectiles/Healing/GodSlayerHealOrb.cs b/Projectiles/Healing/GodSlayerHealOrb.cs index 6834e48b2c..8cab28aff9 100644 --- a/Projectiles/Healing/GodSlayerHealOrb.cs +++ b/Projectiles/Healing/GodSlayerHealOrb.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Healing/PhoenixHeal.cs b/Projectiles/Healing/PhoenixHeal.cs index e7627e572d..72d633b136 100644 --- a/Projectiles/Healing/PhoenixHeal.cs +++ b/Projectiles/Healing/PhoenixHeal.cs @@ -54,9 +54,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index ae0eeb0a25..4e6f373aaa 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; return; } } diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index 97e6309dec..90edb8051a 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num496].noGravity = true; Main.dust[num496].velocity *= 0f; Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; + expr_153E2_cp_0.position.X -= num494; Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; + expr_15401_cp_0.position.Y -= num495; } for (int num497 = 0; num497 < 5; num497++) { @@ -69,9 +69,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } } } diff --git a/Projectiles/Healing/Terracotta.cs b/Projectiles/Healing/Terracotta.cs index 1051415af8..4c10e8a994 100644 --- a/Projectiles/Healing/Terracotta.cs +++ b/Projectiles/Healing/Terracotta.cs @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index e624cfac69..43ae26c580 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num496].noGravity = true; Main.dust[num496].velocity *= 0f; Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; + expr_153E2_cp_0.position.X -= num494; Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; + expr_15401_cp_0.position.Y -= num495; } for (int num497 = 0; num497 < 2; num497++) { @@ -69,9 +69,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } } } diff --git a/Projectiles/Healing/XerocHealOrb.cs b/Projectiles/Healing/XerocHealOrb.cs index 45450440a2..9515e2b2d6 100644 --- a/Projectiles/Healing/XerocHealOrb.cs +++ b/Projectiles/Healing/XerocHealOrb.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Healing Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + expr_154F9_cp_0.position.X -= num498; Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + expr_15518_cp_0.position.Y -= num499; } return; } diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index 666af2af55..ddb9596b56 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -76,18 +76,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 2f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 6f; + expr_DBEF_cp_0.velocity.X *= 6f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 6f; + expr_DC0F_cp_0.velocity.Y *= 6f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 3f; + expr_DC74_cp_0.velocity.X *= 3f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 3f; + expr_DC94_cp_0.velocity.Y *= 3f; Main.dust[num299].scale *= num296; } for (int num298 = 0; num298 < 2; num298++) @@ -98,18 +98,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 4f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 4f; + expr_DBEF_cp_0.velocity.X *= 4f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 4f; + expr_DC0F_cp_0.velocity.Y *= 4f; } else { Main.dust[num299].scale *= 2.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 2f; + expr_DC74_cp_0.velocity.X *= 2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 2f; + expr_DC94_cp_0.velocity.Y *= 2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index 4208424d1d..a90a908019 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -57,14 +57,14 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 1.5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 3f; + expr_DBEF_cp_0.velocity.X *= 3f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 3f; + expr_DC0F_cp_0.velocity.Y *= 3f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 2f; + expr_DC74_cp_0.velocity.X *= 2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 2f; + expr_DC94_cp_0.velocity.Y *= 2f; Main.dust[num299].scale *= num296; } for (int num298 = 0; num298 < 2; num298++) @@ -75,18 +75,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 2f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index f624518866..9b4f602c7b 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -87,9 +87,9 @@ namespace CalamityMod.Projectiles.Magic int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); Main.gore[num340].velocity *= 0.3f; Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X = expr_B4D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y = expr_B502_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 8e00988a66..bd6782c5a3 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -87,9 +87,9 @@ namespace CalamityMod.Projectiles.Magic int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); Main.gore[num340].velocity *= 0.3f; Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X = expr_B4D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y = expr_B502_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index 9d79666aa3..d2f9a011f3 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -49,18 +49,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3.5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.25f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } else diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index 448c14c7d7..64a492d36c 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + expr_4815_cp_0.position.Y -= num94; } if (Main.rand.NextBool(5)) { diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index daaa1790f3..8c35cab597 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -56,18 +56,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 4f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } for (int num298 = 0; num298 < 2; num298++) @@ -78,18 +78,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 2.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index b518becd1a..aad41386c4 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -48,9 +48,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num155].velocity *= 0.1f; Main.dust[num155].velocity += projectile.velocity * 0.5f; Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; + expr_6A04_cp_0.position.X -= num152; Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; + expr_6A1F_cp_0.position.Y -= num153; } if (Main.rand.NextBool(8)) { diff --git a/Projectiles/Magic/FlamePillar.cs b/Projectiles/Magic/FlamePillar.cs index c49f495a7d..677bfa37e2 100644 --- a/Projectiles/Magic/FlamePillar.cs +++ b/Projectiles/Magic/FlamePillar.cs @@ -59,18 +59,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index 942eb54a01..e15e8cb299 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + expr_4815_cp_0.position.Y -= num94; } if (Main.rand.NextBool(5)) { diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index c1e0a13809..5e05868ee9 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -88,9 +88,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 68535f304e..1fa3e5921f 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + expr_4815_cp_0.position.Y -= num94; } if (Main.rand.NextBool(5)) { @@ -58,9 +58,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num102].velocity *= 0.1f; Main.dust[num102].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + expr_47FA_cp_0.position.X -= num99; Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + expr_4815_cp_0.position.Y -= num100; } if (Main.rand.NextBool(5)) { diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 05af1c3a78..d4c11a4c38 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num102].velocity *= 0.1f; Main.dust[num102].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + expr_47FA_cp_0.position.X -= num99; Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + expr_4815_cp_0.position.Y -= num100; } if (Main.rand.NextBool(5)) { diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index 3c5fad4ce7..b1197daf2e 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Magic/HellfireExplosionFriendly2.cs b/Projectiles/Magic/HellfireExplosionFriendly2.cs index e87a250e52..8e390c3a42 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly2.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly2.cs @@ -81,9 +81,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index d3fc13dfa7..eb7c4e40e9 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); Main.dust[num489].velocity *= 1.6f; Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + expr_FEDF_cp_0.velocity.Y -= 1f; Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; Main.dust[num489].scale = 2f; Main.dust[num489].fadeIn = 0.5f; diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 6d4a294b4b..72b345d074 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); Main.dust[num489].velocity *= 1.6f; Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + expr_FEDF_cp_0.velocity.Y -= 1f; Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; Main.dust[num489].scale = 2f; Main.dust[num489].fadeIn = 0.5f; diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index d5635de02e..b86ca0c1da 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num489].velocity *= 1.6f; Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + expr_FEDF_cp_0.velocity.Y -= 1f; Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; Main.dust[num489].scale = 2f; Main.dust[num489].fadeIn = 0.5f; diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 7b3157c7cf..c15f053ed6 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num489].velocity *= 1.6f; Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + expr_FEDF_cp_0.velocity.Y -= 1f; Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; Main.dust[num489].scale = 2f; Main.dust[num489].fadeIn = 0.5f; diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index 69e75a96bb..c6991c493e 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -35,12 +35,12 @@ namespace CalamityMod.Projectiles.Magic } if (projectile.alpha == 0) { - int num159 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f); + int num159 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); Main.dust[num159].noGravity = true; Main.dust[num159].velocity *= 0.6f; Main.dust[num159].velocity -= projectile.velocity * 0.4f; - int num160 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f); + int num160 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); Main.dust[num160].noGravity = true; Main.dust[num160].velocity *= 0.2f; Main.dust[num160].velocity -= projectile.velocity * 0.4f; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num302].velocity *= 1.2f; Main.dust[num302].velocity -= projectile.oldVelocity * 0.3f; - int num402 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, 0f, 0f, 100, default(Color), 1f); + int num402 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num402]; dust.noGravity = true; dust.velocity *= 1.2f; diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index 3d136ac19d..ae4e0c04ac 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -93,9 +93,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index 8d1e1bba0a..0d4502c5cc 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic { int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); Dust expr_A0A0_cp_0 = Main.dust[num310]; - expr_A0A0_cp_0.position.X = expr_A0A0_cp_0.position.X - 2f; + expr_A0A0_cp_0.position.X -= 2f; Main.dust[num310].alpha = 38; Main.dust[num310].velocity *= 0.1f; Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index 7bb82e214a..59f1c03e75 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num193].noGravity = true; Dust expr_835F_cp_0 = Main.dust[num193]; - expr_835F_cp_0.velocity.Y = expr_835F_cp_0.velocity.Y - 2f; + expr_835F_cp_0.velocity.Y -= 2f; } if (Main.rand.NextBool(6)) { diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index e43b5fb082..f39d21c128 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -52,18 +52,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = false; Main.dust[num299].scale *= 1f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 0.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } for (int num298 = 0; num298 < 2; num298++) @@ -74,18 +74,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = false; Main.dust[num299].scale *= 1.5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 0.25f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index 7431d876a5..a6ccb11e18 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -50,18 +50,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 4f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 2.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; int num399 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); if (Main.rand.NextBool(3)) @@ -69,18 +69,18 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num399].noGravity = true; Main.dust[num399].scale *= 6f; Dust expr_DBEF_cp_0 = Main.dust[num399]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num399]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num399].scale *= 2.5f; } Dust expr_DC74_cp_1 = Main.dust[num399]; - expr_DC74_cp_1.velocity.X = expr_DC74_cp_1.velocity.X * 1.2f; + expr_DC74_cp_1.velocity.X *= 1.2f; Dust expr_DC94_cp_1 = Main.dust[num399]; - expr_DC94_cp_1.velocity.Y = expr_DC94_cp_1.velocity.Y * 1.2f; + expr_DC94_cp_1.velocity.Y *= 1.2f; Main.dust[num399].scale *= num296; } else diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index e00125d38f..9bed7282df 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -84,9 +84,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index 0ef49a21ad..252d7ae0c9 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -61,20 +61,20 @@ namespace CalamityMod.Projectiles.Magic } int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Magic/WaterStream.cs b/Projectiles/Magic/WaterStream.cs index 30eb77d50f..8996f3c83b 100644 --- a/Projectiles/Magic/WaterStream.cs +++ b/Projectiles/Magic/WaterStream.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num155].velocity *= 0.1f; Main.dust[num155].velocity += projectile.velocity * 0.5f; Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; + expr_6A04_cp_0.position.X -= num152; Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; + expr_6A1F_cp_0.position.Y -= num153; } if (Main.rand.NextBool(8)) { diff --git a/Projectiles/Magic/WaterStream2.cs b/Projectiles/Magic/WaterStream2.cs index d1e8dfa0ea..f286950024 100644 --- a/Projectiles/Magic/WaterStream2.cs +++ b/Projectiles/Magic/WaterStream2.cs @@ -47,9 +47,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num155].velocity *= 0.1f; Main.dust[num155].velocity += projectile.velocity * 0.5f; Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; + expr_6A04_cp_0.position.X -= num152; Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; + expr_6A1F_cp_0.position.Y -= num153; } if (Main.rand.NextBool(8)) { diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index c142f4cf47..a1f4d221a4 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index 7ea23aef8f..f43d911631 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/AegisBlast2.cs b/Projectiles/Melee/AegisBlast2.cs index c8efc5cecf..212f976837 100644 --- a/Projectiles/Melee/AegisBlast2.cs +++ b/Projectiles/Melee/AegisBlast2.cs @@ -78,9 +78,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index 76503bd36a..40f7dbad92 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -53,20 +53,20 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index e4354b0c8e..173384957c 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -95,9 +95,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num158].position -= projectile.velocity * 2f; Main.dust[num158].noGravity = true; Dust expr_7A4A_cp_0_cp_0 = Main.dust[num158]; - expr_7A4A_cp_0_cp_0.velocity.X = expr_7A4A_cp_0_cp_0.velocity.X * 0.3f; + expr_7A4A_cp_0_cp_0.velocity.X *= 0.3f; Dust expr_7A65_cp_0_cp_0 = Main.dust[num158]; - expr_7A65_cp_0_cp_0.velocity.Y = expr_7A65_cp_0_cp_0.velocity.Y * 0.3f; + expr_7A65_cp_0_cp_0.velocity.Y *= 0.3f; } } } diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index 104e1b2a06..1a86a2e2f8 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -53,20 +53,20 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 4f; + expr_89E7_cp_0.velocity.Y -= 4f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.2f; diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index 1173337346..23faafe3bc 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index 7cd5d71d38..0a43723e3f 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -58,20 +58,20 @@ namespace CalamityMod.Projectiles.Melee } int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index bdacde1332..324eb1fc39 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index 62d9b2be97..f6f389d0f4 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -34,9 +34,9 @@ namespace CalamityMod.Projectiles.Melee int num442 = Dust.NewDust(vector30, 1, 1, 107, 0f, 0f, 0, default, 1.3f); Main.dust[num442].position = vector30; Dust expr_13A3E_cp_0 = Main.dust[num442]; - expr_13A3E_cp_0.position.X = expr_13A3E_cp_0.position.X + (float)(projectile.width / 2); + expr_13A3E_cp_0.position.X += (float)(projectile.width / 2); Dust expr_13A62_cp_0 = Main.dust[num442]; - expr_13A62_cp_0.position.Y = expr_13A62_cp_0.position.Y + (float)(projectile.height / 2); + expr_13A62_cp_0.position.Y += (float)(projectile.height / 2); Main.dust[num442].scale = (float)Main.rand.Next(70, 110) * 0.007f; Main.dust[num442].velocity *= 0.2f; } diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 41052dd469..4608744a63 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -68,9 +68,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index a652f8f399..e3dfa13e80 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -105,9 +105,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/Projectiles/Melee/DragonRage.cs b/Projectiles/Melee/DragonRage.cs index 0a32652303..cc6a753070 100644 --- a/Projectiles/Melee/DragonRage.cs +++ b/Projectiles/Melee/DragonRage.cs @@ -99,27 +99,27 @@ namespace CalamityMod.Projectiles.Melee int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index 32cad209ba..0231632ae3 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -124,27 +124,27 @@ namespace CalamityMod.Projectiles.Melee int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 9bb6cbc989..4a1dd98336 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -84,9 +84,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index 4ab544704f..91f4ea4442 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 482ccc3a93..55457e4f08 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -79,9 +79,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/Projectiles/Melee/OceanBeam.cs b/Projectiles/Melee/OceanBeam.cs index 2fd531fe72..1bef8f1d4d 100644 --- a/Projectiles/Melee/OceanBeam.cs +++ b/Projectiles/Melee/OceanBeam.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num96].velocity *= 0.25f; Main.dust[num96].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + expr_4815_cp_0.position.Y -= num94; } for (int num105 = 0; num105 < 2; num105++) { @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num102].velocity *= 0.1f; Main.dust[num102].velocity += projectile.velocity * 0.25f; Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + expr_47FA_cp_0.position.X -= num99; Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + expr_4815_cp_0.position.Y -= num100; } projectile.ai[1] += 1f; diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index 3684d80b4b..a64f93c4ec 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -61,18 +61,18 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 2.5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 2f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index eff9f548c9..6487fad5d5 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -52,18 +52,18 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 2.5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 2f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index 6b8b7bc0f3..94630b3339 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -77,9 +77,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index 4e84debaed..05b9ccd846 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -55,20 +55,20 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Melee/TerracottaExplosion.cs b/Projectiles/Melee/TerracottaExplosion.cs index 47a73fcaac..8c2b63a6f0 100644 --- a/Projectiles/Melee/TerracottaExplosion.cs +++ b/Projectiles/Melee/TerracottaExplosion.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index 0c86a80e4d..b37655ef4d 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -57,20 +57,20 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs index da525c2bec..0f419c44bc 100644 --- a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs @@ -68,8 +68,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos num440 = num437 / num440; num438 *= num440; num439 *= num440; - num438 = num438 + (float)Main.rand.Next(-30, 31) * 0.05f; - num439 = num439 + (float)Main.rand.Next(-30, 31) * 0.05f; + num438 += (float)Main.rand.Next(-30, 31) * 0.05f; + num439 += (float)Main.rand.Next(-30, 31) * 0.05f; if (projectile.owner == Main.myPlayer) { int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ProjectileID.SlimeGun, (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); diff --git a/Projectiles/Patreon/Plaguenade.cs b/Projectiles/Patreon/Plaguenade.cs index d0c61af029..7ae8c9e6c1 100644 --- a/Projectiles/Patreon/Plaguenade.cs +++ b/Projectiles/Patreon/Plaguenade.cs @@ -120,27 +120,27 @@ namespace CalamityMod.Projectiles.Patreon int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Ranged/Archerfish.cs b/Projectiles/Ranged/Archerfish.cs index d78603c6ed..c2650787fb 100644 --- a/Projectiles/Ranged/Archerfish.cs +++ b/Projectiles/Ranged/Archerfish.cs @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity += projectile.velocity * 0.5f; Main.dust[num591].position = projectile.Center; Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; - var_2_18F52_cp_0_cp_0.position.X = var_2_18F52_cp_0_cp_0.position.X - num588; + var_2_18F52_cp_0_cp_0.position.X -= num588; Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; - var_2_18F74_cp_0_cp_0.position.Y = var_2_18F74_cp_0_cp_0.position.Y - num589; + var_2_18F74_cp_0_cp_0.position.Y -= num589; dust = Main.dust[num591]; dust.velocity *= 0.2f; num3 = num587; @@ -122,9 +122,9 @@ namespace CalamityMod.Projectiles.Ranged dust = Main.dust[num363]; dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; - expr_C6F7_cp_0_cp_0.velocity.X = expr_C6F7_cp_0_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; + expr_C6F7_cp_0_cp_0.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; - expr_C726_cp_0_cp_0.velocity.Y = expr_C726_cp_0_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; + expr_C726_cp_0_cp_0.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; Main.dust[num363].position = projectile.Center; num3 = num362; } diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 9a6fb26b5d..529d9ffefe 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -152,27 +152,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index b6d8387039..b38fbe89cf 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -131,27 +131,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 2874deb754..621727d8fb 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -57,18 +57,18 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Ranged/Butcher.cs b/Projectiles/Ranged/Butcher.cs index 91f73f80c9..13fcc454e1 100644 --- a/Projectiles/Ranged/Butcher.cs +++ b/Projectiles/Ranged/Butcher.cs @@ -136,8 +136,8 @@ namespace CalamityMod.Projectiles.Ranged vector20 = -Vector2.UnitY; } Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); - vector20.X = vector20.X + (float)Main.rand.Next(-15, 16) * spreadMult; - vector20.Y = vector20.Y + (float)Main.rand.Next(-15, 16) * spreadMult; + vector20.X += (float)Main.rand.Next(-15, 16) * spreadMult; + vector20.Y += (float)Main.rand.Next(-15, 16) * spreadMult; int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); Main.projectile[num44].noDropItem = true; Main.projectile[num44].extraUpdates += num39 / 2; //0 to 4 diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 71bedf2541..028bfffe1d 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/CorossiveFlames.cs b/Projectiles/Ranged/CorossiveFlames.cs index 9d4e2cb9cb..a54b9e2414 100644 --- a/Projectiles/Ranged/CorossiveFlames.cs +++ b/Projectiles/Ranged/CorossiveFlames.cs @@ -57,27 +57,27 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 2.5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } if (Main.rand.NextBool(6)) { Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 2f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 1ebf01555f..015224043b 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -62,18 +62,18 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; if (!Main.dust[num299].noGravity) diff --git a/Projectiles/Ranged/DragonBurst.cs b/Projectiles/Ranged/DragonBurst.cs index 7515c8cb6c..cf8b122919 100644 --- a/Projectiles/Ranged/DragonBurst.cs +++ b/Projectiles/Ranged/DragonBurst.cs @@ -39,9 +39,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + expr_4815_cp_0.position.Y -= num94; } if (Main.rand.NextBool(10)) { diff --git a/Projectiles/Ranged/ElysianArrow.cs b/Projectiles/Ranged/ElysianArrow.cs index 8e8d3c9990..a546b14561 100644 --- a/Projectiles/Ranged/ElysianArrow.cs +++ b/Projectiles/Ranged/ElysianArrow.cs @@ -85,27 +85,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } float x = projectile.position.X + (float)Main.rand.Next(-400, 400); float y = projectile.position.Y - (float)Main.rand.Next(500, 800); diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 6157ac93ba..c1a483da29 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -61,18 +61,18 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; if (!Main.dust[num299].noGravity) diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index 2ad96de396..6c742b40b3 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -75,9 +75,9 @@ namespace CalamityMod.Projectiles.Ranged { Main.dust[num299].scale *= 1.5f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 1.2f; + expr_DBEF_cp_0.velocity.X *= 1.2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 1.2f; + expr_DC0F_cp_0.velocity.Y *= 1.2f; } else { @@ -85,9 +85,9 @@ namespace CalamityMod.Projectiles.Ranged } Main.dust[num299].noGravity = true; Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 0.8f; + expr_DC74_cp_0.velocity.X *= 0.8f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 0.8f; + expr_DC94_cp_0.velocity.Y *= 0.8f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; } diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index 3ff8711053..32c6806366 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -77,9 +77,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index a7b61e4304..e28a6677f1 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -169,27 +169,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 6d439031ce..3c22f290ed 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -58,24 +58,24 @@ namespace CalamityMod.Projectiles.Ranged { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 1, default(Color), 1f); + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 1, default, 1f); if (Main.rand.Next(3) == 0) { Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; if (!Main.dust[num299].noGravity) diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 90fa13af95..ade37d2bd9 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -169,27 +169,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 994c96fa44..58295e0e46 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -170,27 +170,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Ranged/HolyFireBullet.cs b/Projectiles/Ranged/HolyFireBullet.cs index 902b08d971..728b061049 100644 --- a/Projectiles/Ranged/HolyFireBullet.cs +++ b/Projectiles/Ranged/HolyFireBullet.cs @@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + expr_4815_cp_0.position.Y -= num94; } if (Main.rand.NextBool(20)) { diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index 5d17c7c441..f9a1586c11 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -51,18 +51,18 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 1.75f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 0.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; if (!Main.dust[num299].noGravity) diff --git a/Projectiles/Ranged/MeowFire2.cs b/Projectiles/Ranged/MeowFire2.cs index 87462efbf2..2375e35bcb 100644 --- a/Projectiles/Ranged/MeowFire2.cs +++ b/Projectiles/Ranged/MeowFire2.cs @@ -51,18 +51,18 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 1.75f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 0.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; if (!Main.dust[num299].noGravity) diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index 3ababb65b1..7cef0bfbb5 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -140,27 +140,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Ranged/MortarRound.cs b/Projectiles/Ranged/MortarRound.cs index 4079159d3f..33e13d9184 100644 --- a/Projectiles/Ranged/MortarRound.cs +++ b/Projectiles/Ranged/MortarRound.cs @@ -117,27 +117,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Ranged/NapalmArrow.cs b/Projectiles/Ranged/NapalmArrow.cs index 61b30e9625..40addcbdc4 100644 --- a/Projectiles/Ranged/NapalmArrow.cs +++ b/Projectiles/Ranged/NapalmArrow.cs @@ -72,27 +72,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Ranged/Norfleet.cs b/Projectiles/Ranged/Norfleet.cs index b8dc5d28b0..510539aa1b 100644 --- a/Projectiles/Ranged/Norfleet.cs +++ b/Projectiles/Ranged/Norfleet.cs @@ -94,11 +94,11 @@ namespace CalamityMod.Projectiles.Ranged Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); type = mod.ProjectileType("NorfleetComet"); - speed.X = speed.X + (float)Main.rand.Next(-30, 31) * 0.05f; - speed.Y = speed.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; + speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - speed.X = speed.X + (float)Main.rand.Next(-30, 31) * 0.05f; - speed.Y = speed.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; + speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); projectile.netUpdate = true; } diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index 25b8c6d7a7..8bbbe4d85d 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -78,9 +78,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 3001683178..b29a69d715 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -150,27 +150,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index 5d8bb2090a..70b9f90211 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index 7b31d17bf4..c333d143d9 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -84,9 +84,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/RubberMortarRound.cs b/Projectiles/Ranged/RubberMortarRound.cs index 2215eabe78..26ace01aaf 100644 --- a/Projectiles/Ranged/RubberMortarRound.cs +++ b/Projectiles/Ranged/RubberMortarRound.cs @@ -117,27 +117,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } if (projectile.owner == Main.myPlayer) { @@ -292,27 +292,27 @@ namespace CalamityMod.Projectiles.Ranged int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Ranged/SandWater.cs b/Projectiles/Ranged/SandWater.cs index 31034b6b5d..b3627f0591 100644 --- a/Projectiles/Ranged/SandWater.cs +++ b/Projectiles/Ranged/SandWater.cs @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index cb9d76e8ac..8c833d571b 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -57,18 +57,18 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 1.75f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 0.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; if (!Main.dust[num299].noGravity) diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index 24291bde53..a5053793f3 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index eb54a2a115..e49753ab63 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index ea5967466c..0ea1b52549 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.rand.Next(3) == 0) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 35, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 80, default(Color), 0.75f); - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 50, default(Color), 0.75f); + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 35, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 80, default, 0.75f); + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 50, default, 0.75f); } if (projectile.ai[0] > 7f) { @@ -64,15 +64,15 @@ namespace CalamityMod.Projectiles.Ranged { for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, default(Color), 0.75f); + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, default, 0.75f); if (Main.rand.Next(3) == 0) { Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 1.75f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { @@ -80,9 +80,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].scale *= 0.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; } diff --git a/Projectiles/Ranged/TerraFireGreen.cs b/Projectiles/Ranged/TerraFireGreen.cs index 5891e6d6c8..13d7c4be45 100644 --- a/Projectiles/Ranged/TerraFireGreen.cs +++ b/Projectiles/Ranged/TerraFireGreen.cs @@ -58,18 +58,18 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 2f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 0.75f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; if (!Main.dust[num299].noGravity) diff --git a/Projectiles/Ranged/TerraFireGreen2.cs b/Projectiles/Ranged/TerraFireGreen2.cs index 488a7ccd35..e301b18399 100644 --- a/Projectiles/Ranged/TerraFireGreen2.cs +++ b/Projectiles/Ranged/TerraFireGreen2.cs @@ -56,9 +56,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 1.75f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { @@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].scale *= 0.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; } diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.cs b/Projectiles/Rogue/AbyssalMirrorProjectile.cs index fceb84d554..2c0706b2ec 100644 --- a/Projectiles/Rogue/AbyssalMirrorProjectile.cs +++ b/Projectiles/Rogue/AbyssalMirrorProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/BallisticPoisonBomb.cs b/Projectiles/Rogue/BallisticPoisonBomb.cs index b54ffe019c..1f7a8b3dc2 100644 --- a/Projectiles/Rogue/BallisticPoisonBomb.cs +++ b/Projectiles/Rogue/BallisticPoisonBomb.cs @@ -166,27 +166,27 @@ namespace CalamityMod.Projectiles.Rogue int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index d4830d0e12..4d3186e96c 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 180; projectile.tileCollide = false; projectile.alpha = 255; - projectile.GetGlobalProjectile(ModLoader.GetMod("CalamityMod")).rogue = true; + projectile.Calamity().rogue = true; } /// /// Checks if a tile is below a designated Vector2 @@ -55,17 +55,17 @@ namespace CalamityMod.Projectiles.Rogue int counter = 0; while ((float)counter < max) { - int dustIndex = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 1f); + int dustIndex = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); Main.dust[dustIndex].noGravity = true; Dust dustFromIndex = Main.dust[dustIndex]; dustFromIndex.velocity *= 0.5f; Dust dustFromIndex2 = Main.dust[dustIndex]; - dustFromIndex2.velocity.Y = dustFromIndex2.velocity.Y - 0.5f; + dustFromIndex2.velocity.Y -= 0.5f; Main.dust[dustIndex].scale = 1.4f; Dust dustFromIndex3 = Main.dust[dustIndex]; - dustFromIndex3.position.X = dustFromIndex3.position.X + 6f; + dustFromIndex3.position.X += 6f; Dust dustFromIndex4 = Main.dust[dustIndex]; - dustFromIndex4.position.Y = dustFromIndex4.position.Y - 2f; + dustFromIndex4.position.Y -= 2f; counter++; } } diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 85d3419afa..5652f23e8e 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -91,9 +91,9 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 04a0f2f749..1794ff4b2c 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue //Dust trail if (Main.rand.Next(13) == 0) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 22, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default(Color), 0.9f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 22, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default, 0.9f); } } @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.15f, 120, default(Color), 1.5f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.15f, 120, default, 1.5f); dust_splash += 1; } // This only triggers if stealth is full diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index 6786470d7c..8d7766fcd7 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default(Color), 0.9f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.cs b/Projectiles/Rogue/CelestialReaperAfterimage.cs index 6c21cd8ceb..df3ac5c9ac 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.timeLeft = 51; projectile.tileCollide = false; - projectile.GetGlobalProjectile(ModLoader.GetMod("CalamityMod")).rogue = true; + projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; } diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index d5cf24b6ce..87a80fed50 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 6; projectile.tileCollide = false; - projectile.GetGlobalProjectile(ModLoader.GetMod("CalamityMod")).rogue = true; + projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; } diff --git a/Projectiles/Rogue/ConsecratedWaterProjectile.cs b/Projectiles/Rogue/ConsecratedWaterProjectile.cs index 674a42634c..49fdc152f6 100644 --- a/Projectiles/Rogue/ConsecratedWaterProjectile.cs +++ b/Projectiles/Rogue/ConsecratedWaterProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 200; projectile.tileCollide = true; projectile.alpha = 0; - projectile.GetGlobalProjectile(ModLoader.GetMod("CalamityMod")).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() { diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 91cfa8f538..9ad14eabe9 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -61,21 +61,21 @@ namespace CalamityMod.Projectiles.Rogue int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; } for (int num194 = 0; num194 < 25; num194++) { diff --git a/Projectiles/Rogue/EclipseMirrorBurst.cs b/Projectiles/Rogue/EclipseMirrorBurst.cs index f746e4ff95..e0577f29cb 100644 --- a/Projectiles/Rogue/EclipseMirrorBurst.cs +++ b/Projectiles/Rogue/EclipseMirrorBurst.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs index c8c5043970..64ef2c44fe 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.timeLeft = 50; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/InkCloud.cs b/Projectiles/Rogue/InkCloud.cs index 48f0c5d8c8..83a5e5aade 100644 --- a/Projectiles/Rogue/InkCloud.cs +++ b/Projectiles/Rogue/InkCloud.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/InkCloud2.cs b/Projectiles/Rogue/InkCloud2.cs index e48b574a22..263b20323c 100644 --- a/Projectiles/Rogue/InkCloud2.cs +++ b/Projectiles/Rogue/InkCloud2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/InkCloud3.cs b/Projectiles/Rogue/InkCloud3.cs index 34952fb55e..879009d812 100644 --- a/Projectiles/Rogue/InkCloud3.cs +++ b/Projectiles/Rogue/InkCloud3.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/IronFrancisca.cs b/Projectiles/Rogue/IronFrancisca.cs index 41a011f9fa..29fa8159fd 100644 --- a/Projectiles/Rogue/IronFrancisca.cs +++ b/Projectiles/Rogue/IronFrancisca.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 2; projectile.timeLeft = 600; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs index f6de64d32b..926fc27224 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 360; projectile.tileCollide = false; drawOffsetX = 6 * projectile.spriteDirection; - Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() @@ -37,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue //Dust trail if(Main.rand.Next(15) == 0) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 7, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 100, default(Color), 0f); + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 7, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 100, default, 0f); Main.dust[d].position = projectile.Center; } //Constant sound effects diff --git a/Projectiles/Rogue/LeadTomahawk.cs b/Projectiles/Rogue/LeadTomahawk.cs index d75d44667a..9bccc0ebb8 100644 --- a/Projectiles/Rogue/LeadTomahawk.cs +++ b/Projectiles/Rogue/LeadTomahawk.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 2; projectile.timeLeft = 600; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/MeteorFist.cs b/Projectiles/Rogue/MeteorFist.cs index 75fd3c73bb..44971c7f71 100644 --- a/Projectiles/Rogue/MeteorFist.cs +++ b/Projectiles/Rogue/MeteorFist.cs @@ -138,27 +138,27 @@ namespace CalamityMod.Projectiles.Rogue int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index 16da3ec20a..0321a8b2ce 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue //Dust trail if (Main.rand.Next(25) == 0) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 21, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default(Color), 0.9f); + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 21, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default, 0.9f); Main.dust[d].position = projectile.Center; Main.dust[d].noLight = true; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue int dustsplash = 0; while (dustsplash < 4) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, projectile.velocity.X * 0.25f, projectile.velocity.Y* 0.25f, 100, default(Color), 0.9f); + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, projectile.velocity.X * 0.25f, projectile.velocity.Y* 0.25f, 100, default, 0.9f); Main.dust[d].position = projectile.Center; dustsplash += 1; } diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index 2d26e87e69..156cc01453 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 2; Mod calamity = ModLoader.GetMod("CalamityMod"); - projectile.GetGlobalProjectile(calamity).rogue = true; + projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index d7ebb504ee..6ad8d46084 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index aee44bd1c3..c4fbe36514 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 1f); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs index b69d070557..5032a8d03c 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 1f); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index 1f13886678..a0e983aa50 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -28,20 +28,20 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Shrines/UnstableSpark.cs b/Projectiles/Shrines/UnstableSpark.cs index 714265c780..b642293b2c 100644 --- a/Projectiles/Shrines/UnstableSpark.cs +++ b/Projectiles/Shrines/UnstableSpark.cs @@ -54,20 +54,20 @@ namespace CalamityMod.Projectiles.Shrines projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index a56a8e0352..a71e892b73 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Summon for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Summon float num636 = 600f; bool flag64 = projectile.type == mod.ProjectileType("BlackHawkSummon"); Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("BlackHawkBuff"), 3600); if (flag64) { diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index bc6f01ec11..8d70334852 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -54,18 +54,18 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + expr_DBEF_cp_0.velocity.X *= 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + expr_DC0F_cp_0.velocity.Y *= 2f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + expr_DC74_cp_0.velocity.X *= 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + expr_DC94_cp_0.velocity.Y *= 1.2f; Main.dust[num299].scale *= num296; } } diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index ea4f3d8e87..3e0a8ee292 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -196,27 +196,27 @@ namespace CalamityMod.Projectiles.Summon int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Summon/GigaFlareFriendly.cs b/Projectiles/Summon/GigaFlareFriendly.cs index b75c941c27..556f672d06 100644 --- a/Projectiles/Summon/GigaFlareFriendly.cs +++ b/Projectiles/Summon/GigaFlareFriendly.cs @@ -141,27 +141,27 @@ namespace CalamityMod.Projectiles.Summon int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } diff --git a/Projectiles/SunkenSea/ClamCrusherFlail.cs b/Projectiles/SunkenSea/ClamCrusherFlail.cs index c2f20f14c8..d9284c6a60 100644 --- a/Projectiles/SunkenSea/ClamCrusherFlail.cs +++ b/Projectiles/SunkenSea/ClamCrusherFlail.cs @@ -48,9 +48,9 @@ namespace CalamityMod.Projectiles.SunkenSea Main.dust[waterDust].velocity *= 0.1f; Main.dust[waterDust].velocity += projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[waterDust]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + expr_47FA_cp_0.position.X -= num99; Dust expr_4815_cp_0 = Main.dust[waterDust]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + expr_4815_cp_0.position.Y -= num100; } } if (projectile.ai[1] == 5f) diff --git a/Projectiles/SunkenSea/EutrophicSpark.cs b/Projectiles/SunkenSea/EutrophicSpark.cs index 2ba2da1515..a1142325bb 100644 --- a/Projectiles/SunkenSea/EutrophicSpark.cs +++ b/Projectiles/SunkenSea/EutrophicSpark.cs @@ -55,20 +55,20 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/SunkenSea/SeafoamBomb.cs b/Projectiles/SunkenSea/SeafoamBomb.cs index 9ef78afcf2..2f0d1f70c6 100644 --- a/Projectiles/SunkenSea/SeafoamBomb.cs +++ b/Projectiles/SunkenSea/SeafoamBomb.cs @@ -55,21 +55,21 @@ namespace CalamityMod.Projectiles.SunkenSea int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Typeless/BloodBombExplosion.cs b/Projectiles/Typeless/BloodBombExplosion.cs index 2f4d36dfe4..8509c01ede 100644 --- a/Projectiles/Typeless/BloodBombExplosion.cs +++ b/Projectiles/Typeless/BloodBombExplosion.cs @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Typeless/ChaosBlaze.cs b/Projectiles/Typeless/ChaosBlaze.cs index b912348af6..0ef83b750b 100644 --- a/Projectiles/Typeless/ChaosBlaze.cs +++ b/Projectiles/Typeless/ChaosBlaze.cs @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Typeless/ChaosGeyser.cs b/Projectiles/Typeless/ChaosGeyser.cs index 5176c9872d..6fa8d3b21b 100644 --- a/Projectiles/Typeless/ChaosGeyser.cs +++ b/Projectiles/Typeless/ChaosGeyser.cs @@ -60,20 +60,20 @@ namespace CalamityMod.Projectiles.Typeless projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 16f; + expr_89E7_cp_0.velocity.Y -= 16f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.8f; diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index e0debc6395..1b9581b93f 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -74,9 +74,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index ef5105d688..a98da509f0 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -65,18 +65,18 @@ namespace CalamityMod.Projectiles.Typeless Main.PlaySound(SoundID.Item14, projectile.position); for (int num991 = 0; num991 < 4; num991 = num3 + 1) { - int num992 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f); + int num992 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); Main.dust[num992].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; num3 = num991; } for (int num993 = 0; num993 < 10; num993 = num3 + 1) { - int num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 200, default(Color), 2.7f); + int num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 200, default, 2.7f); Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; Main.dust[num994].noGravity = true; Dust dust = Main.dust[num994]; dust.velocity *= 3f; - num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f); + num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; dust = Main.dust[num994]; dust.velocity *= 2f; @@ -86,8 +86,8 @@ namespace CalamityMod.Projectiles.Typeless } for (int num995 = 0; num995 < 5; num995 = num3 + 1) { - int num996 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default(Color), 2.7f); - Main.dust[num996].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + int num996 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.7f); + Main.dust[num996].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; Main.dust[num996].noGravity = true; Dust dust = Main.dust[num996]; dust.velocity *= 3f; @@ -95,8 +95,8 @@ namespace CalamityMod.Projectiles.Typeless } for (int num997 = 0; num997 < 10; num997 = num3 + 1) { - int num998 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num998].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + int num998 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1.5f); + Main.dust[num998].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; Main.dust[num998].noGravity = true; Dust dust = Main.dust[num998]; dust.velocity *= 3f; diff --git a/Projectiles/Typeless/GodSlayerBlaze.cs b/Projectiles/Typeless/GodSlayerBlaze.cs index 1cd74e1453..19dca04e2f 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/GodSlayerBlaze.cs @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index d825e2d5b7..be420a2027 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -57,20 +57,20 @@ namespace CalamityMod.Projectiles.Typeless } int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Typeless/GoldenGun.cs b/Projectiles/Typeless/GoldenGun.cs index 44bac4e1bb..e8e1153735 100644 --- a/Projectiles/Typeless/GoldenGun.cs +++ b/Projectiles/Typeless/GoldenGun.cs @@ -65,9 +65,9 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity += projectile.velocity * 0.5f; Main.dust[num591].position = projectile.Center; Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; - var_2_18F52_cp_0_cp_0.position.X = var_2_18F52_cp_0_cp_0.position.X - num588; + var_2_18F52_cp_0_cp_0.position.X -= num588; Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; - var_2_18F74_cp_0_cp_0.position.Y = var_2_18F74_cp_0_cp_0.position.Y - num589; + var_2_18F74_cp_0_cp_0.position.Y -= num589; dust = Main.dust[num591]; dust.velocity *= 0.2f; num3 = num587; @@ -123,9 +123,9 @@ namespace CalamityMod.Projectiles.Typeless dust = Main.dust[num363]; dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; - expr_C6F7_cp_0_cp_0.velocity.X = expr_C6F7_cp_0_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; + expr_C6F7_cp_0_cp_0.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; - expr_C726_cp_0_cp_0.velocity.Y = expr_C726_cp_0_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; + expr_C726_cp_0_cp_0.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; Main.dust[num363].position = projectile.Center; num3 = num362; } diff --git a/Projectiles/Typeless/HolyEruption.cs b/Projectiles/Typeless/HolyEruption.cs index 6af4304768..39ebc28e44 100644 --- a/Projectiles/Typeless/HolyEruption.cs +++ b/Projectiles/Typeless/HolyEruption.cs @@ -54,20 +54,20 @@ namespace CalamityMod.Projectiles.Typeless projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 16f; + expr_89E7_cp_0.velocity.Y -= 16f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.8f; diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index ca7777005f..49a8854675 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { Player player = Main.player[projectile.owner]; - bool hentai = player.GetModPlayer().omegaBlueHentai; - if (player.active && player.GetModPlayer().omegaBlueSet) + bool hentai = player.Calamity().omegaBlueHentai; + if (player.active && player.Calamity().omegaBlueSet) projectile.timeLeft = 8; //tentacle head movement (homing) @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Main.player[projectile.owner].GetModPlayer().omegaBlueHentai) + if (Main.player[projectile.owner].Calamity().omegaBlueHentai) crit = true; } @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.Typeless if (healAmount > 0) { Main.player[Main.myPlayer].lifeSteal -= healAmount; - if (Main.player[Main.myPlayer].GetModPlayer().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay + if (Main.player[Main.myPlayer].Calamity().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay Main.player[Main.myPlayer].lifeSteal += healAmount / 2; /*Main.player[Main.myPlayer].statLife += healAmount; if (Main.player[Main.myPlayer].statLife > Main.player[Main.myPlayer].statLifeMax2) diff --git a/Projectiles/Typeless/ReaverBlast.cs b/Projectiles/Typeless/ReaverBlast.cs index ed448d4f19..a40208b714 100644 --- a/Projectiles/Typeless/ReaverBlast.cs +++ b/Projectiles/Typeless/ReaverBlast.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index c9c35a8c6a..4373ee1694 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -91,27 +91,27 @@ namespace CalamityMod.Projectiles.Typeless int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; + expr_13AD6_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; + expr_13B99_cp_0.velocity.Y += 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + expr_13C5C_cp_0.velocity.Y -= 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + expr_13CFF_cp_0.velocity.X -= 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + expr_13D1F_cp_0.velocity.Y -= 1f; } } } diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index 5563db4a11..7f1d5cca0f 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -57,20 +57,20 @@ namespace CalamityMod.Projectiles.Typeless } int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Projectiles/Typeless/XerocBlast.cs b/Projectiles/Typeless/XerocBlast.cs index fa74362c8f..8c5ec65fe8 100644 --- a/Projectiles/Typeless/XerocBlast.cs +++ b/Projectiles/Typeless/XerocBlast.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index eb0c88c7f8..0b8ec7b113 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -53,20 +53,20 @@ namespace CalamityMod.Projectiles.Typeless projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + expr_8994_cp_0.position.Y += 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + expr_8A6C_cp_0.position.Y += 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index a21be630b5..c0657e412a 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -93,11 +93,13 @@ namespace CalamityMod.Tiles.Astral Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; + + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; int left = i; int top = j; @@ -106,7 +108,8 @@ namespace CalamityMod.Tiles.Astral if (tile.frameY != 0) top--; - if (player.sign >= 0) + // If the player right clicked the chest while editing a sign, finish that up + if (player.sign >= 0) { Main.PlaySound(SoundID.MenuClose); player.sign = -1; @@ -114,55 +117,73 @@ namespace CalamityMod.Tiles.Astral Main.npcChatText = ""; } - if (Main.editChest) + // If the player right clicked the chest while editing a chest, finish that up + if (Main.editChest) { Main.PlaySound(SoundID.MenuTick); Main.editChest = false; Main.npcChatText = ""; } - if (player.editedChestName) + // If the player right clicked the chest after changing another chest's name, finish that up + if (player.editedChestName) { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); player.editedChestName = false; } bool isLocked = IsLockedChest(left, top); + + // Unlocked interactions as a client (have to send messages to the server) if (Main.netMode == NetmodeID.MultiplayerClient && !isLocked) { - if (left == player.chestX && top == player.chestY && player.chest >= 0) + // If you right click the opened chest, it closes itself. This couns as interaction. + if (left == player.chestX && top == player.chestY && player.chest >= 0) { player.chest = -1; Recipe.FindRecipes(); Main.PlaySound(SoundID.MenuClose); - } + return true; + } + + // If you right click the closed chest, it opens. This counts as interaction. else { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); Main.stackSplit = 600; - } + return true; + } } + + // Single player interactions, server interactions, or locked interactions else { if (isLocked) { - if (Chest.Unlock(left, top)) + // If you right click the locked chest and you can unlock it, it unlocks itself but does not open. This counts as interaction. + if (Chest.Unlock(left, top)) { if (Main.netMode == NetmodeID.MultiplayerClient) NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, (float)left, (float)top); - } + return true; + } } + else { int chest = Chest.FindChest(left, top); if (chest >= 0) { Main.stackSplit = 600; + + // If you right click the same chest you already have open, it closes. This counts as interaction. if (chest == player.chest) { player.chest = -1; Main.PlaySound(SoundID.MenuClose); } + + // If you right click this chest when you have a different chest selected, that one closes and this one opens. This counts as interaction. else { player.chest = chest; @@ -173,9 +194,13 @@ namespace CalamityMod.Tiles.Astral Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); } Recipe.FindRecipes(); + return true; } } } + + // This only occurs when the chest is locked and cannot be unlocked. You did not interact with the chest. + return false; } public override void MouseOver(int i, int j) diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index e030e3668a..88340f7aef 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -47,8 +47,8 @@ namespace CalamityMod.Tiles.Astral int yPos = Main.tile[i, j].frameY; int xOffset = i % 4; int yOffset = j % 4; - xOffset = xOffset * 288; - yOffset = yOffset * 270; + xOffset *= 288; + yOffset *= 270; xPos += xOffset; yPos += yOffset; Texture2D glowmask = mod.GetTexture("Tiles/Astral/AstralMonolith_Glowmask"); diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index ef7a9e01c2..ba355197cd 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -8,27 +8,27 @@ namespace CalamityMod.Tiles public override Texture2D GetTopTextures(int i, int j, ref int frame, ref int frameWidth, ref int frameHeight, ref int xOffsetLeft, ref int yOffset) { frame = (i + j * j) % 3; - return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralTree_Tops"); + return ModContent.GetInstance().GetTexture("Tiles/Astral/AstralTree_Tops"); } public override Texture2D GetBranchTextures(int i, int j, int trunkOffset, ref int frame) { - return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralTree_Branches"); + return ModContent.GetInstance().GetTexture("Tiles/Astral/AstralTree_Branches"); } public override Texture2D GetTexture() { - return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralTree"); + return ModContent.GetInstance().GetTexture("Tiles/Astral/AstralTree"); } public override int DropWood() { - return CalamityMod.Instance.ItemType("AstralMonolith"); + return ModContent.GetInstance().ItemType("AstralMonolith"); } public override int CreateDust() { - return CalamityMod.Instance.DustType("AstralBasic"); + return ModContent.GetInstance().DustType("AstralBasic"); } public override int GrowthFXGore() diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index b3dc9592f7..b06c5cb47b 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -46,8 +46,8 @@ namespace CalamityMod.Tiles int yPos = Main.tile[i, j].frameY; int xOffset = i % 2; int yOffset = j % 2; - xOffset = xOffset * subsheetWidth; - yOffset = yOffset * subsheetHeight; + xOffset *= subsheetWidth; + yOffset *= subsheetHeight; xPos += xOffset; yPos += yOffset; Texture2D glowmask = mod.GetTexture("Tiles/AstralBrick_Glowmask"); diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index 3e2e93b6b1..a75a112354 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -7,22 +7,22 @@ namespace CalamityMod.Tiles { public override Texture2D GetTexture() { - return CalamityMod.Instance.GetTexture("Tiles/AstralDesert/AstralPalmTree"); + return ModContent.GetInstance().GetTexture("Tiles/AstralDesert/AstralPalmTree"); } public override Texture2D GetTopTextures() { - return CalamityMod.Instance.GetTexture("Tiles/AstralDesert/AstralPalmTree_Tops"); + return ModContent.GetInstance().GetTexture("Tiles/AstralDesert/AstralPalmTree_Tops"); } public override int DropWood() { - return CalamityMod.Instance.ItemType("AstralMonolith"); + return ModContent.GetInstance().ItemType("AstralMonolith"); } public override int CreateDust() { - return CalamityMod.Instance.DustType("AstralBasic"); + return ModContent.GetInstance().DustType("AstralBasic"); } public override int GrowthFXGore() diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 9aad281418..398c703e7b 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Tiles TileID.HallowedPlants, TileID.HallowedPlants2, TileID.FleshWeeds, - (ushort)CalamityMod.Instance.TileType("AstralShortPlants"), - (ushort)CalamityMod.Instance.TileType("AstralTallPlants") + (ushort)ModContent.GetInstance().TileType("AstralShortPlants"), + (ushort)ModContent.GetInstance().TileType("AstralTallPlants") }; public override void SetDefaults() diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index e12f9b402f..0c8ff424fd 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AbyssBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -68,6 +68,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 9fa8a8244c..7ef42f367f 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -120,6 +120,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); player.editedChestName = false; } + if (Main.netMode == NetmodeID.MultiplayerClient) { if (left == player.chestX && top == player.chestY && player.chest >= 0) @@ -157,6 +158,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss Recipe.FindRecipes(); } } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index ac2e6fee87..9aa15df7e5 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -52,56 +52,55 @@ namespace CalamityMod.Tiles.FurnitureAbyss num = fail ? 1 : 3; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureAbyss/AbyssDresser.cs b/Tiles/FurnitureAbyss/AbyssDresser.cs index a7273806c9..bb3a3f9e45 100644 --- a/Tiles/FurnitureAbyss/AbyssDresser.cs +++ b/Tiles/FurnitureAbyss/AbyssDresser.cs @@ -52,13 +52,16 @@ namespace CalamityMod.Tiles.FurnitureAbyss return true; } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) { Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; + + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); left %= 3; left = Player.tileTargetX - left; @@ -78,7 +81,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss } if (player.editedChestName) { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); player.editedChestName = false; } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -91,9 +94,10 @@ namespace CalamityMod.Tiles.FurnitureAbyss } else { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); Main.stackSplit = 600; } + return true; } else { @@ -127,6 +131,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss player.chestY = top; } Recipe.FindRecipes(); + return true; } } } @@ -138,7 +143,10 @@ namespace CalamityMod.Tiles.FurnitureAbyss Main.dresserX = Player.tileTargetX; Main.dresserY = Player.tileTargetY; Main.OpenClothesWindow(); + return true; } + + return false; } public override void MouseOverFar(int i, int j) diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index b60a669db1..e9555f440f 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.FurnitureAncient Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AncientBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -69,6 +69,7 @@ namespace CalamityMod.Tiles.FurnitureAncient player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureAncient/AncientDresser.cs b/Tiles/FurnitureAncient/AncientDresser.cs index accf90126b..1f9067681c 100644 --- a/Tiles/FurnitureAncient/AncientDresser.cs +++ b/Tiles/FurnitureAncient/AncientDresser.cs @@ -52,96 +52,104 @@ namespace CalamityMod.Tiles.FurnitureAncient return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureAncient/AncientMonolith.cs b/Tiles/FurnitureAncient/AncientMonolith.cs index 0e025cffe6..69132d9e64 100644 --- a/Tiles/FurnitureAncient/AncientMonolith.cs +++ b/Tiles/FurnitureAncient/AncientMonolith.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Tiles.FurnitureAncient // Above code works, but since we are just mimicking another tile, we can just use the same value. } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { { string text = "AM"; @@ -130,6 +130,7 @@ namespace CalamityMod.Tiles.FurnitureAncient //Whack it all together to get a HH:MM format var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); Main.NewText(newText, 255, 240, 20); + return true; } } diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index 0a3b42024b..e981a1622f 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.FurnitureAshen Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AshenBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -69,6 +69,7 @@ namespace CalamityMod.Tiles.FurnitureAshen player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index d99ed2344f..db571508d9 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -98,11 +98,14 @@ namespace CalamityMod.Tiles.FurnitureAshen Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; + + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + int left = i; int top = j; if (tile.frameX % 36 != 0) @@ -113,6 +116,8 @@ namespace CalamityMod.Tiles.FurnitureAshen { top--; } + + // If the player right clicked the chest while editing a sign, finish that up if (player.sign >= 0) { Main.PlaySound(SoundID.MenuClose); @@ -120,43 +125,55 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.editSign = false; Main.npcChatText = ""; } + + // If the player right clicked the chest while editing a chest, finish that up if (Main.editChest) { Main.PlaySound(SoundID.MenuTick); Main.editChest = false; Main.npcChatText = ""; } + + // If the player right clicked the chest after changing another chest's name, finish that up if (player.editedChestName) { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); player.editedChestName = false; } + bool isLocked = IsLockedChest(left, top); if (Main.netMode == 1 && !isLocked) { + // Right clicking the chest you currently have open closes it. This counts as interaction. if (left == player.chestX && top == player.chestY && player.chest >= 0) { player.chest = -1; Recipe.FindRecipes(); Main.PlaySound(SoundID.MenuClose); } + + // Right clicking this chest opens it if it's not already open. This counts as interaction. else { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); Main.stackSplit = 600; } + return true; } + + else { if (isLocked) { - int key = mod.ItemType("BrimstoneKey"); + // If you right click the locked chest and you can unlock it, it unlocks itself but does not open. This counts as interaction. if (Chest.Unlock(left, top)) { if (Main.netMode == 1) { NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, (float)left, (float)top); } + return true; } } else @@ -165,11 +182,15 @@ namespace CalamityMod.Tiles.FurnitureAshen if (chest >= 0) { Main.stackSplit = 600; + + // If you right click the same chest you already have open, it closes. This counts as interaction. if (chest == player.chest) { player.chest = -1; Main.PlaySound(SoundID.MenuClose); } + + // If you right click this chest when you have a different chest selected, that one closes and this one opens. This counts as interaction. else { player.chest = chest; @@ -179,10 +200,15 @@ namespace CalamityMod.Tiles.FurnitureAshen player.chestY = top; Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); } + Recipe.FindRecipes(); + return true; } } } + + // This only occurs when the chest is locked and cannot be unlocked. You did not interact with the chest. + return false; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureAshen/AshenDresser.cs b/Tiles/FurnitureAshen/AshenDresser.cs index 32ad2faaeb..ebd7105d65 100644 --- a/Tiles/FurnitureAshen/AshenDresser.cs +++ b/Tiles/FurnitureAshen/AshenDresser.cs @@ -52,96 +52,104 @@ namespace CalamityMod.Tiles.FurnitureAshen return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 5eb01c4757..2ce77878dd 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -59,56 +59,55 @@ namespace CalamityMod.Tiles.FurnitureAshen b = 0.5f; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) @@ -189,11 +188,11 @@ namespace CalamityMod.Tiles.FurnitureAshen eyeToPlayer.Y = (int)eyeToPlayer.Y; float factor = Math.Abs((Math.Abs(eyeToPlayer.X) >= 2 * Math.Abs(eyeToPlayer.Y)) ? eyeToPlayer.X / xRange : eyeToPlayer.Y / yRange); - if (factor != 0) { eyeToPlayer = eyeToPlayer / factor; } + if (factor != 0) { eyeToPlayer /= factor; } frameX += (int)(eyeToPlayer.X); frameY += (int)(eyeToPlayer.Y); - frameX = frameX * animationFrameWidth; - frameY = frameY * 90; + frameX *= animationFrameWidth; + frameY *= 90; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Texture2D eyeSheet = mod.GetTexture("Tiles/FurnitureAshen/AshenMonolith_Eye"); diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index 52177c9aa9..6d810259f2 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("BotanicBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -69,6 +69,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureBotanic/BotanicChest.cs b/Tiles/FurnitureBotanic/BotanicChest.cs index 5032dfdef2..8ce95f96ea 100644 --- a/Tiles/FurnitureBotanic/BotanicChest.cs +++ b/Tiles/FurnitureBotanic/BotanicChest.cs @@ -88,79 +88,81 @@ namespace CalamityMod.Tiles.FurnitureBotanic Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureBotanic/BotanicClock.cs b/Tiles/FurnitureBotanic/BotanicClock.cs index 643aa9c2fe..402354b2ff 100644 --- a/Tiles/FurnitureBotanic/BotanicClock.cs +++ b/Tiles/FurnitureBotanic/BotanicClock.cs @@ -54,56 +54,55 @@ namespace CalamityMod.Tiles.FurnitureBotanic num = fail ? 1 : 3; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureBotanic/BotanicDresser.cs b/Tiles/FurnitureBotanic/BotanicDresser.cs index 57e3e39915..561ceac779 100644 --- a/Tiles/FurnitureBotanic/BotanicDresser.cs +++ b/Tiles/FurnitureBotanic/BotanicDresser.cs @@ -53,96 +53,104 @@ namespace CalamityMod.Tiles.FurnitureBotanic return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index a496aff125..b048d77334 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("CosmiliteBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -68,6 +68,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index a2f2867ff4..78e35b7620 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -88,79 +88,81 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index b881165ad5..7af4377b63 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -48,56 +48,55 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return false; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs index fa1b87681d..9fd4b0ae27 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs @@ -52,96 +52,104 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index 721ae687a1..c0b36f2f05 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("EutrophicBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -68,6 +68,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureEutrophic/EutrophicChest.cs index 5720d3efab..6c4e519a38 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChest.cs @@ -87,79 +87,81 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.cs b/Tiles/FurnitureEutrophic/EutrophicClock.cs index 339523d72b..129acad337 100644 --- a/Tiles/FurnitureEutrophic/EutrophicClock.cs +++ b/Tiles/FurnitureEutrophic/EutrophicClock.cs @@ -70,56 +70,55 @@ namespace CalamityMod.Tiles.FurnitureEutrophic num = fail ? 1 : 3; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser.cs b/Tiles/FurnitureEutrophic/EutrophicDresser.cs index d023e2db12..2431c65f6f 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDresser.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDresser.cs @@ -52,96 +52,104 @@ namespace CalamityMod.Tiles.FurnitureEutrophic return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureOccult/OccultBed.cs b/Tiles/FurnitureOccult/OccultBed.cs index b98e55edec..28f4dd67eb 100644 --- a/Tiles/FurnitureOccult/OccultBed.cs +++ b/Tiles/FurnitureOccult/OccultBed.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.FurnitureOccult Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("OccultBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -69,6 +69,7 @@ namespace CalamityMod.Tiles.FurnitureOccult player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureOccult/OccultChest.cs b/Tiles/FurnitureOccult/OccultChest.cs index 413835a0a1..d553c43f50 100644 --- a/Tiles/FurnitureOccult/OccultChest.cs +++ b/Tiles/FurnitureOccult/OccultChest.cs @@ -88,79 +88,81 @@ namespace CalamityMod.Tiles.FurnitureOccult Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureOccult/OccultClock.cs b/Tiles/FurnitureOccult/OccultClock.cs index c0e359630c..bcf281f22b 100644 --- a/Tiles/FurnitureOccult/OccultClock.cs +++ b/Tiles/FurnitureOccult/OccultClock.cs @@ -54,56 +54,55 @@ namespace CalamityMod.Tiles.FurnitureOccult num = fail ? 1 : 3; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureOccult/OccultDresser.cs b/Tiles/FurnitureOccult/OccultDresser.cs index 4d26a265d7..cc2868f7b5 100644 --- a/Tiles/FurnitureOccult/OccultDresser.cs +++ b/Tiles/FurnitureOccult/OccultDresser.cs @@ -53,96 +53,104 @@ namespace CalamityMod.Tiles.FurnitureOccult return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index 4f42aac31c..4cbb87def6 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("PlaguedPlateBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -67,6 +67,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index df8916fb02..ef8b7d144e 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -87,79 +87,81 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index 68ccf885ff..636ac2f700 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -41,56 +41,55 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate return true; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs index eff14dc3f6..8ea196cfb2 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -56,96 +56,104 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate num = fail ? 1 : 3; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index 46de90c888..b8b08a3a2b 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("ProfanedBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -68,6 +68,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index 4e607a55f7..900b4ba08d 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -88,79 +88,81 @@ namespace CalamityMod.Tiles.FurnitureProfaned Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index 46eede8ca9..89303c3cac 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -53,56 +53,55 @@ namespace CalamityMod.Tiles.FurnitureProfaned num = fail ? 1 : 3; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureProfaned/ProfanedDresser.cs b/Tiles/FurnitureProfaned/ProfanedDresser.cs index 8258bd1deb..02f5effd58 100644 --- a/Tiles/FurnitureProfaned/ProfanedDresser.cs +++ b/Tiles/FurnitureProfaned/ProfanedDresser.cs @@ -57,96 +57,104 @@ namespace CalamityMod.Tiles.FurnitureProfaned return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 058f87a628..721f7dc9d7 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -214,7 +214,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned } break; } - xOffset = xOffset * 288; + xOffset *= 288; xPos += xOffset; Texture2D glowmask = mod.GetTexture("Tiles/FurnitureProfaned/ProfanedRock_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index 8b62969fec..70a3b5b139 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.FurnitureSilva Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("SilvaBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -69,6 +69,7 @@ namespace CalamityMod.Tiles.FurnitureSilva player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 9d138576c0..8755cbff2a 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -88,79 +88,81 @@ namespace CalamityMod.Tiles.FurnitureSilva Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index 44cfe12d82..5840b94868 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -54,56 +54,55 @@ namespace CalamityMod.Tiles.FurnitureSilva num = fail ? 1 : 3; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureSilva/SilvaDresser.cs b/Tiles/FurnitureSilva/SilvaDresser.cs index 50df3ef6cf..42b4b24fbd 100644 --- a/Tiles/FurnitureSilva/SilvaDresser.cs +++ b/Tiles/FurnitureSilva/SilvaDresser.cs @@ -53,96 +53,104 @@ namespace CalamityMod.Tiles.FurnitureSilva return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index 83038e2e91..5edfa1f561 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("StatigelBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -67,6 +67,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index 367a36c092..dfbc45f924 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -87,79 +87,81 @@ namespace CalamityMod.Tiles.FurnitureStatigel Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureStatigel/StatigelClock.cs b/Tiles/FurnitureStatigel/StatigelClock.cs index 4531ef15f7..7947af736b 100644 --- a/Tiles/FurnitureStatigel/StatigelClock.cs +++ b/Tiles/FurnitureStatigel/StatigelClock.cs @@ -46,56 +46,55 @@ namespace CalamityMod.Tiles.FurnitureStatigel return false; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureStatigel/StatigelDresser.cs b/Tiles/FurnitureStatigel/StatigelDresser.cs index 3ba10c7bb9..0a10fd40db 100644 --- a/Tiles/FurnitureStatigel/StatigelDresser.cs +++ b/Tiles/FurnitureStatigel/StatigelDresser.cs @@ -51,96 +51,104 @@ namespace CalamityMod.Tiles.FurnitureStatigel return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index 50eee25444..e5a85436be 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureStratus Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("StratusBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -68,6 +68,7 @@ namespace CalamityMod.Tiles.FurnitureStratus player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 715beeff87..5be70f5974 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -88,79 +88,81 @@ namespace CalamityMod.Tiles.FurnitureStratus Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index 8cfae048b4..037e74ee4f 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -47,56 +47,55 @@ namespace CalamityMod.Tiles.FurnitureStratus return false; } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureStratus/StratusDresser.cs b/Tiles/FurnitureStratus/StratusDresser.cs index 722731c3fa..75e2b8fbf8 100644 --- a/Tiles/FurnitureStratus/StratusDresser.cs +++ b/Tiles/FurnitureStratus/StratusDresser.cs @@ -52,96 +52,104 @@ namespace CalamityMod.Tiles.FurnitureStratus return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index 296f888365..de2a5e2a6f 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -214,7 +214,7 @@ namespace CalamityMod.Tiles.FurnitureVoid } break; } - xOffset = xOffset * 288; + xOffset *= 288; xPos += xOffset; Texture2D glowmask = mod.GetTexture("Tiles/FurnitureVoid/SmoothVoidstone_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index da3eb48d56..4fa5b5526e 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("VoidBed")); } - public override void RightClick(int i, int j) + public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; @@ -68,6 +68,7 @@ namespace CalamityMod.Tiles.FurnitureVoid player.ChangeSpawn(spawnX, spawnY); Main.NewText("Spawn point set!", 255, 240, 20, false); } + return true; } public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index d4e0f5b3a9..fb27147e37 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -87,79 +87,81 @@ namespace CalamityMod.Tiles.FurnitureVoid Chest.DestroyChest(i, j); } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - public override void MouseOver(int i, int j) + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index 5dbbd50561..4305831f43 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -58,56 +58,55 @@ namespace CalamityMod.Tiles.FurnitureVoid } } - public override void RightClick(int x, int y) + public override bool NewRightClick(int x, int y) { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + //if it's night add this number + time += 54000.0; } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/FurnitureVoid/VoidDresser.cs b/Tiles/FurnitureVoid/VoidDresser.cs index 72666f3a6e..473e4c9b62 100644 --- a/Tiles/FurnitureVoid/VoidDresser.cs +++ b/Tiles/FurnitureVoid/VoidDresser.cs @@ -52,96 +52,104 @@ namespace CalamityMod.Tiles.FurnitureVoid return true; } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); - public override void MouseOverFar(int i, int j) + // with 0.11.5 changes this should no longer be necessary + // Main.mouseRightRelease = false; + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public override void MouseOverFar(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index 35094a782e..5c833b9572 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -153,7 +153,7 @@ namespace CalamityMod.Tiles.FurnitureVoid } break; } - yOffset = yOffset * 270; + yOffset *= 270; yPos += yOffset; Texture2D glowmask = mod.GetTexture("Tiles/FurnitureVoid/VoidstoneSlab_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/Voidstone.cs b/Tiles/Voidstone.cs index f08a7a1db4..a0eb2fda3c 100644 --- a/Tiles/Voidstone.cs +++ b/Tiles/Voidstone.cs @@ -214,7 +214,7 @@ namespace CalamityMod.Tiles } break; } - xOffset = xOffset * 288; + xOffset *= 288; xPos += xOffset; Texture2D glowmask = mod.GetTexture("Tiles/Voidstone_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 83464a0706..52eae860c0 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -168,7 +168,7 @@ namespace CalamityMod.UI } else { - Main.player[Main.myPlayer].GetModPlayer(ModLoader.GetMod("CalamityMod")).HandleTeleport(circle, false, 0); + Main.LocalPlayer.Calamity().HandleTeleport(circle, false, 0); } } diff --git a/UI/UIBar.cs b/UI/UIBar.cs index 5f84cbc384..059c4b21b9 100644 --- a/UI/UIBar.cs +++ b/UI/UIBar.cs @@ -44,7 +44,7 @@ namespace CalamityMod.UI public static int GetTickedValue() //ditto { Mod calamity = ModLoader.GetMod("CalamityMod"); - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).stress; + tick = Main.player[Main.myPlayer].Calamity().stress; return tick; } @@ -118,7 +118,7 @@ namespace CalamityMod.UI Mod calamity = ModLoader.GetMod("CalamityMod"); base.Update(gameTime); Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).stress; //updates the testing tick + tick = Main.player[Main.myPlayer].Calamity().stress; //updates the testing tick if (tick >= 10000) { tick = 10000; diff --git a/UI/UIBar2.cs b/UI/UIBar2.cs index 789e80bcd0..2b759ee4bf 100644 --- a/UI/UIBar2.cs +++ b/UI/UIBar2.cs @@ -44,7 +44,7 @@ namespace CalamityMod.UI public static int GetTickedValue() //ditto { Mod calamity = ModLoader.GetMod("CalamityMod"); - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).adrenaline; + tick = Main.player[Main.myPlayer].Calamity().adrenaline; return tick; } @@ -118,7 +118,7 @@ namespace CalamityMod.UI Mod calamity = ModLoader.GetMod("CalamityMod"); base.Update(gameTime); Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).adrenaline; //updates the testing tick + tick = Main.player[Main.myPlayer].Calamity().adrenaline; //updates the testing tick if (tick >= 10000) { tick = 10000; diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 270bf8366b..5d71ede9ad 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Utilities { private static ModRecipe GetNewRecipe() { - return new ModRecipe(CalamityMod.Instance); + return new ModRecipe(ModContent.GetInstance()); } public static void AddRecipes() @@ -108,7 +108,7 @@ namespace CalamityMod.Utilities s.requiredItem[0].stack = 1; s.requiredItem[1].SetDefaults(ItemID.TrueExcalibur, false); s.requiredItem[1].stack = 1; - s.requiredItem[2].SetDefaults(CalamityMod.Instance.ItemType("LivingShard"), false); + s.requiredItem[2].SetDefaults(ModContent.GetInstance().ItemType("LivingShard"), false); s.requiredItem[2].stack = 7; s.createItem.SetDefaults(ItemID.TerraBlade, false); @@ -739,13 +739,13 @@ namespace CalamityMod.Utilities ItemID.BetsyWings, ItemID.ArkhalisWings, ItemID.LeinforsWings, - CalamityMod.Instance.ItemType("SkylineWings"), - CalamityMod.Instance.ItemType("StarlightWings"), - CalamityMod.Instance.ItemType("AureateWings"), - CalamityMod.Instance.ItemType("DiscordianWings"), - CalamityMod.Instance.ItemType("TarragonWings"), - CalamityMod.Instance.ItemType("XerocWings"), - CalamityMod.Instance.ItemType("HadarianWings") + ModContent.GetInstance().ItemType("SkylineWings"), + ModContent.GetInstance().ItemType("StarlightWings"), + ModContent.GetInstance().ItemType("AureateWings"), + ModContent.GetInstance().ItemType("DiscordianWings"), + ModContent.GetInstance().ItemType("TarragonWings"), + ModContent.GetInstance().ItemType("XerocWings"), + ModContent.GetInstance().ItemType("HadarianWings") }); RecipeGroup.RegisterGroup("WingsGroup", group); } diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 52f1a5de82..75db4873a3 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -12,7 +12,7 @@ namespace CalamityMod public static class CalamityUtils { #region Object Extensions - public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer(); + public static CalamityPlayer Calamity(this Player player) => player.Calamity(); public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC(); public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile(); diff --git a/Utilities/CustomTileFraming.cs b/Utilities/CustomTileFraming.cs index 78f950150f..59809ddff5 100644 --- a/Utilities/CustomTileFraming.cs +++ b/Utilities/CustomTileFraming.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Utilities private static void Setup() { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); int size = CalamityGlobalTile.PlantTypes.Length; PlantCheckAgainst = new int[TileLoader.TileCount][]; @@ -35,8 +35,8 @@ namespace CalamityMod.Utilities PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass }; PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass }; PlantCheckAgainst[TileID.FleshWeeds] = new int[1] { TileID.FleshWeeds }; - PlantCheckAgainst[CalamityMod.Instance.TileType("AstralShortPlants")] = new int[1] { mod.TileType("AstralGrass") }; - PlantCheckAgainst[CalamityMod.Instance.TileType("AstralTallPlants")] = new int[1] { mod.TileType("AstralGrass") }; + PlantCheckAgainst[ModContent.GetInstance().TileType("AstralShortPlants")] = new int[1] { mod.TileType("AstralGrass") }; + PlantCheckAgainst[ModContent.GetInstance().TileType("AstralTallPlants")] = new int[1] { mod.TileType("AstralGrass") }; VineToGrass = new Dictionary(); VineToGrass[TileID.Vines] = TileID.Grass; @@ -157,17 +157,17 @@ namespace CalamityMod.Utilities Main.tile[x, y].frameX -= 72; } } - else if (checkType == CalamityMod.Instance.TileType("AstralGrass")) //ASTRAL + else if (checkType == ModContent.GetInstance().TileType("AstralGrass")) //ASTRAL { if (plantType == TileID.Plants || plantType == TileID.CorruptPlants || plantType == TileID.FleshWeeds || plantType == TileID.HallowedPlants || plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants) { - plantType = CalamityMod.Instance.TileType("AstralShortPlants"); + plantType = ModContent.GetInstance().TileType("AstralShortPlants"); } else { - plantType = CalamityMod.Instance.TileType("AstralTallPlants"); + plantType = ModContent.GetInstance().TileType("AstralTallPlants"); } } if (plantType != Main.tile[x, y].type) diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index b51c1ba187..1d3a880626 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ModLoader; using CalamityMod.World; namespace CalamityMod.Utilities @@ -169,7 +170,7 @@ namespace CalamityMod.Utilities public static bool DropRevBagAccessories(Player p) { - CalamityMod mod = CalamityMod.Instance; + CalamityMod mod = ModContent.GetInstance(); return DropItemFromSetCondition(p, CalamityWorld.revenge, 0.05f, mod.ItemType("StressPills"), mod.ItemType("Laudanum"), mod.ItemType("HeartofDarkness")); } @@ -187,7 +188,7 @@ namespace CalamityMod.Utilities if (alreadyKilled) return 0; - CalamityMod mod = CalamityMod.Instance; + CalamityMod mod = ModContent.GetInstance(); int dropped = 0; dropped += DropItem(theBoss, mod.ItemType("MagnumRounds"), magnum); dropped += DropItem(theBoss, mod.ItemType("GrenadeRounds"), bazooka); diff --git a/Utilities/TileMerge.cs b/Utilities/TileMerge.cs index 18563fb134..fe1a0c9576 100644 --- a/Utilities/TileMerge.cs +++ b/Utilities/TileMerge.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Utilities /// public static void MergeGeneralTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Soils MergeTile(type, TileID.ClayBlock); MergeTile(type, TileID.Dirt); @@ -49,7 +49,7 @@ namespace CalamityMod.Utilities public static void MergeOreTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Vanilla Ores MergeTile(type, TileID.Copper); MergeTile(type, TileID.Tin); @@ -85,7 +85,7 @@ namespace CalamityMod.Utilities /// public static void MergeDesertTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Sands MergeTile(type, TileID.Sand); MergeTile(type, TileID.Ebonsand); @@ -120,7 +120,7 @@ namespace CalamityMod.Utilities /// public static void MergeSnowTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Snow MergeTile(type, TileID.SnowBlock); //Ices @@ -138,7 +138,7 @@ namespace CalamityMod.Utilities /// public static void MergeHellTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Terrain MergeTile(type, TileID.Ash); MergeTile(type, TileID.Hellstone); @@ -155,7 +155,7 @@ namespace CalamityMod.Utilities /// public static void MergeAbyssTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Sulphurous Sea MergeTile(type, mod.TileType("SulphurousSand")); //Abyss @@ -172,7 +172,7 @@ namespace CalamityMod.Utilities /// public static void MergeAstralTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Astral MergeTile(type, mod.TileType("AstralDirt")); MergeTile(type, mod.TileType("AstralStone")); @@ -191,7 +191,7 @@ namespace CalamityMod.Utilities /// public static void MergeSmoothTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Vanilla MergeTile(type, TileID.MarbleBlock); MergeTile(type, TileID.GraniteBlock); @@ -208,7 +208,7 @@ namespace CalamityMod.Utilities /// public static void MergeDecorativeTiles(int type) { - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); //Vanilla decor Main.tileBrick[type] = true; //Calam diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index c9ee73eea7..b39d5421bd 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -364,7 +364,7 @@ namespace CalamityMod.World } else { - CalamityMod.Instance.Logger.Error("Unknown loadVersion: " + loadVersion); + ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); } } #endregion diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index 8b09685607..158c4595ca 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -5,6 +5,7 @@ using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.ModLoader; using Terraria.World.Generation; using Terraria.GameContent.Generation; using Microsoft.Xna.Framework; @@ -119,7 +120,7 @@ namespace CalamityMod.World.Planets ShapeData cinderPlateBlob = new ShapeData(); WorldUtils.Gen(origin, new Shapes.Circle(cinderRadius), Actions.Chain(new GenAction[] { - new Actions.SetTile((ushort)CalamityMod.Instance.TileType("Cinderplate"), true).Output(cinderPlateBlob), + new Actions.SetTile((ushort)ModContent.GetInstance().TileType("Cinderplate"), true).Output(cinderPlateBlob), new Actions.ClearWall(), new Actions.PlaceWall(WallID.LavaUnsafe2) })); @@ -209,7 +210,7 @@ namespace CalamityMod.World.Planets } WorldGen.PlaceDoor(doorX, origin.Y + 2, TileID.ClosedDoor, 14); int lanternX = labLeftSide ? doorX - 7 : doorX + 7; - int chest = -1; + int chest; if (labLeftSide) { //Lantern, alchemy table, heavy work bench diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index a98813c195..f725664c9b 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -932,7 +932,7 @@ namespace CalamityMod.World Tile tile = Main.tile[x, y]; int type = tile.type; int wallType = tile.wall; - Mod mod = CalamityMod.Instance; + Mod mod = ModContent.GetInstance(); if (WorldGen.InWorld(x, y, 1)) { From da643328c85c92f25d38ed89c029507e8eb1c03a Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 11 Oct 2019 11:52:16 -0400 Subject: [PATCH 7/7] Replaced all tabs with spaces. --- Buffs/Amidias/AmidiasBlessing.cs | 12 +- Buffs/Amidias/HermitCrab.cs | 52 +- Buffs/Amidias/SnapClamDebuff.cs | 31 +- Buffs/CalamityGlobalBuff.cs | 36 +- Buffs/DoTDebuffs/AbyssalFlames.cs | 39 +- Buffs/DoTDebuffs/AstralInfectionDebuff.cs | 37 +- Buffs/DoTDebuffs/BrimstoneFlames.cs | 40 +- Buffs/DoTDebuffs/BurningBlood.cs | 40 +- Buffs/DoTDebuffs/CrushDepth.cs | 30 +- Buffs/DoTDebuffs/DemonFlames.cs | 31 +- Buffs/DoTDebuffs/GodSlayerInferno.cs | 37 +- Buffs/DoTDebuffs/HolyInferno.cs | 29 +- Buffs/DoTDebuffs/HolyLight.cs | 40 +- Buffs/DoTDebuffs/LethalLavaBurn.cs | 31 +- Buffs/DoTDebuffs/Nightwither.cs | 31 +- Buffs/DoTDebuffs/Plague.cs | 37 +- Buffs/DoTDebuffs/Shadowflame.cs | 31 +- Buffs/DoTDebuffs/Shred.cs | 31 +- Buffs/DoTDebuffs/VulnerabilityHex.cs | 33 +- Buffs/Fabsol/BloodyMary.cs | 29 +- Buffs/Fabsol/BlueSpeedCandle.cs | 31 +- Buffs/Fabsol/CaribbeanRum.cs | 29 +- Buffs/Fabsol/CinnamonRoll.cs | 29 +- Buffs/Fabsol/Everclear.cs | 29 +- Buffs/Fabsol/EvergreenGin.cs | 29 +- Buffs/Fabsol/FabsolVodka.cs | 29 +- Buffs/Fabsol/Fireball.cs | 29 +- Buffs/Fabsol/GrapeBeer.cs | 29 +- Buffs/Fabsol/Margarita.cs | 29 +- Buffs/Fabsol/Moonshine.cs | 29 +- Buffs/Fabsol/MoscowMule.cs | 29 +- Buffs/Fabsol/PinkHealthCandle.cs | 31 +- Buffs/Fabsol/PurpleDefenseCandle.cs | 31 +- Buffs/Fabsol/RedWine.cs | 29 +- Buffs/Fabsol/Rum.cs | 29 +- Buffs/Fabsol/Screwdriver.cs | 29 +- Buffs/Fabsol/StarBeamRye.cs | 29 +- Buffs/Fabsol/Tequila.cs | 29 +- Buffs/Fabsol/TequilaSunrise.cs | 29 +- Buffs/Fabsol/Trippy.cs | 29 +- Buffs/Fabsol/Vodka.cs | 29 +- Buffs/Fabsol/Whiskey.cs | 29 +- Buffs/Fabsol/WhiteWine.cs | 29 +- Buffs/Fabsol/YellowDamageCandle.cs | 40 +- Buffs/Permafrost/ConcoctionCooldown.cs | 18 +- Buffs/Permafrost/Encased.cs | 18 +- Buffs/Permafrost/Popo.cs | 10 +- Buffs/Permafrost/PopoNoseless.cs | 10 +- Buffs/PetBuffs/AkatoYharonBuff.cs | 17 +- Buffs/PetBuffs/BearBuff.cs | 19 +- Buffs/PetBuffs/BloodBound.cs | 44 +- Buffs/PetBuffs/BrimlingBuff.cs | 19 +- Buffs/PetBuffs/ChibiiBuff.cs | 39 +- Buffs/PetBuffs/DannyDevito.cs | 19 +- Buffs/PetBuffs/Fox.cs | 17 +- Buffs/PetBuffs/Kendra.cs | 19 +- Buffs/PetBuffs/Levi.cs | 17 +- Buffs/PetBuffs/StrangeOrb.cs | 19 +- Buffs/PetBuffs/ThirdSageBuff.cs | 49 +- Buffs/PotionBuffs/AbyssalWeapon.cs | 31 +- Buffs/PotionBuffs/AnechoicCoating.cs | 31 +- Buffs/PotionBuffs/ArmorCrumbling.cs | 31 +- Buffs/PotionBuffs/ArmorShattering.cs | 31 +- Buffs/PotionBuffs/AstralInjectionBuff.cs | 31 +- Buffs/PotionBuffs/BoundingBuff.cs | 31 +- Buffs/PotionBuffs/Cadence.cs | 31 +- Buffs/PotionBuffs/CalciumBuff.cs | 31 +- Buffs/PotionBuffs/CeaselessHunger.cs | 31 +- Buffs/PotionBuffs/DraconicSurgeBuff.cs | 31 +- Buffs/PotionBuffs/GravityNormalizerBuff.cs | 31 +- Buffs/PotionBuffs/HolyWrathBuff.cs | 31 +- Buffs/PotionBuffs/Invincible.cs | 31 +- Buffs/PotionBuffs/Omniscience.cs | 31 +- Buffs/PotionBuffs/PenumbraBuff.cs | 33 +- Buffs/PotionBuffs/PhotosynthesisBuff.cs | 31 +- Buffs/PotionBuffs/ProfanedRageBuff.cs | 31 +- Buffs/PotionBuffs/Soaring.cs | 31 +- Buffs/PotionBuffs/TitanScale.cs | 31 +- Buffs/PotionBuffs/TriumphBuff.cs | 31 +- Buffs/PotionBuffs/YharimPower.cs | 31 +- Buffs/PotionBuffs/Zen.cs | 31 +- Buffs/PotionBuffs/Zerg.cs | 31 +- Buffs/Shrines/ChiBuff.cs | 29 +- Buffs/Shrines/CorruptionEffigyBuff.cs | 29 +- Buffs/Shrines/CrimsonEffigyBuff.cs | 29 +- Buffs/Shrines/GladiatorSwords.cs | 58 +- Buffs/StatBuffs/AbyssalDivingSuitBuff.cs | 10 +- Buffs/StatBuffs/AbyssalDivingSuitPlates.cs | 29 +- Buffs/StatBuffs/AdrenalineMode.cs | 51 +- Buffs/StatBuffs/Afflicted.cs | 31 +- Buffs/StatBuffs/ChaosCandle.cs | 35 +- Buffs/StatBuffs/CosmicFreeze.cs | 31 +- Buffs/StatBuffs/GodSlayerCooldown.cs | 33 +- Buffs/StatBuffs/GraxDefense.cs | 31 +- Buffs/StatBuffs/HeartAttack.cs | 31 +- Buffs/StatBuffs/IceShieldBuff.cs | 29 +- Buffs/StatBuffs/Molten.cs | 31 +- Buffs/StatBuffs/Mushy.cs | 33 +- Buffs/StatBuffs/RageMode.cs | 51 +- Buffs/StatBuffs/ReaverRage.cs | 31 +- Buffs/StatBuffs/ScarfMeleeBoost.cs | 31 +- Buffs/StatBuffs/ShellBoost.cs | 31 +- Buffs/StatBuffs/SilvaRevival.cs | 25 +- Buffs/StatBuffs/SirenBobs.cs | 10 +- Buffs/StatBuffs/SirenBobsAlt.cs | 12 +- Buffs/StatBuffs/SirenWaterSpeed.cs | 7 +- Buffs/StatBuffs/TarraLifeRegen.cs | 31 +- Buffs/StatBuffs/TranquilityCandle.cs | 35 +- Buffs/StatBuffs/TyrantsFury.cs | 31 +- Buffs/StatBuffs/XerocRage.cs | 31 +- Buffs/StatBuffs/XerocWrath.cs | 31 +- .../AbyssalDivingSuitPlatesBroken.cs | 33 +- Buffs/StatDebuffs/AbyssalMirrorCooldown.cs | 33 +- Buffs/StatDebuffs/ArmorCrunch.cs | 20 +- Buffs/StatDebuffs/BurntOut.cs | 29 +- Buffs/StatDebuffs/EclipseMirrorCooldown.cs | 33 +- Buffs/StatDebuffs/Enraged.cs | 32 +- Buffs/StatDebuffs/ExoFreeze.cs | 31 +- Buffs/StatDebuffs/ExtremeGrav.cs | 35 +- Buffs/StatDebuffs/ExtremeGravity.cs | 33 +- Buffs/StatDebuffs/FishAlert.cs | 31 +- Buffs/StatDebuffs/GlacialState.cs | 40 +- Buffs/StatDebuffs/Horror.cs | 31 +- Buffs/StatDebuffs/IceShieldBrokenBuff.cs | 33 +- Buffs/StatDebuffs/InkBombCooldown.cs | 33 +- Buffs/StatDebuffs/Irradiated.cs | 44 +- Buffs/StatDebuffs/MarkedforDeath.cs | 40 +- Buffs/StatDebuffs/ScarfCooldown.cs | 33 +- Buffs/StatDebuffs/SilvaStun.cs | 31 +- Buffs/StatDebuffs/TemporalSadness.cs | 31 +- Buffs/StatDebuffs/TimeSlow.cs | 20 +- Buffs/StatDebuffs/WarCleave.cs | 29 +- Buffs/StatDebuffs/Warped.cs | 35 +- Buffs/StatDebuffs/WeakPetrification.cs | 35 +- Buffs/StatDebuffs/WhisperingDeath.cs | 37 +- Buffs/SummonBuffs/AngryChicken.cs | 58 +- Buffs/SummonBuffs/AquaticStar.cs | 58 +- Buffs/SummonBuffs/BlackHawkBuff.cs | 56 +- Buffs/SummonBuffs/BloodClot.cs | 58 +- Buffs/SummonBuffs/BrimstoneWaifu.cs | 58 +- Buffs/SummonBuffs/BrittleStar.cs | 58 +- Buffs/SummonBuffs/Calamari.cs | 58 +- Buffs/SummonBuffs/CalamitasEyes.cs | 58 +- Buffs/SummonBuffs/ChaosSpirit.cs | 58 +- Buffs/SummonBuffs/CloudyWaifu.cs | 58 +- Buffs/SummonBuffs/Corroslime.cs | 58 +- Buffs/SummonBuffs/CosmicEnergy.cs | 58 +- Buffs/SummonBuffs/Cosmilamp.cs | 58 +- Buffs/SummonBuffs/Crimslime.cs | 58 +- Buffs/SummonBuffs/DaedalusCrystal.cs | 58 +- Buffs/SummonBuffs/DankCreeper.cs | 58 +- Buffs/SummonBuffs/DrewsSandyWaifu.cs | 58 +- Buffs/SummonBuffs/ElementalAxe.cs | 58 +- Buffs/SummonBuffs/FungalClump.cs | 58 +- Buffs/SummonBuffs/GuardianDefense.cs | 58 +- Buffs/SummonBuffs/GuardianHealer.cs | 58 +- Buffs/SummonBuffs/GuardianOffense.cs | 58 +- Buffs/SummonBuffs/Herring.cs | 58 +- Buffs/SummonBuffs/HotE.cs | 52 +- Buffs/SummonBuffs/IceClasper.cs | 58 +- Buffs/SummonBuffs/Mechworm.cs | 58 +- Buffs/SummonBuffs/Phantom.cs | 58 +- Buffs/SummonBuffs/ReaverOrb.cs | 58 +- Buffs/SummonBuffs/RedDevil.cs | 58 +- .../SummonBuffs/ResurrectionButterflyBuff.cs | 58 +- Buffs/SummonBuffs/Sandnado.cs | 58 +- Buffs/SummonBuffs/SandyWaifu.cs | 58 +- Buffs/SummonBuffs/SilvaCrystal.cs | 58 +- Buffs/SummonBuffs/SirenLure.cs | 58 +- Buffs/SummonBuffs/SlimeGod.cs | 66 +- Buffs/SummonBuffs/SolarSpirit.cs | 58 +- Buffs/SummonBuffs/SolarSpiritGod.cs | 58 +- Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs | 31 +- Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs | 31 +- Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs | 31 +- Buffs/SummonBuffs/Urchin.cs | 58 +- Buffs/SummonBuffs/Valkyrie.cs | 58 +- Buffs/SunkenSea/Clamity.cs | 33 +- Buffs/SunkenSea/PearlAura.cs | 29 +- Buffs/SunkenSea/Shellfish.cs | 58 +- Buffs/SunkenSea/ShellfishEating.cs | 29 +- CalPlayer/CalamityPlayer.cs | 20206 ++++++------ CalPlayer/CalamityPlayerLifeRegen.cs | 1127 +- CalamityMod.cs | 4789 +-- Config.cs | 250 +- Dusts/BrimstoneFlame.cs | 58 +- Dusts/FurnitureDusts/BloomTileGold.cs | 34 +- Dusts/FurnitureDusts/BloomTileLeaves.cs | 34 +- Dusts/FurnitureDusts/OccultTileCloth.cs | 34 +- Dusts/FurnitureDusts/ProfanedTileRock.cs | 34 +- Dusts/FurnitureDusts/SilvaTileGold.cs | 34 +- Dusts/HBSparkle.cs | 41 +- Dusts/HolyFlame.cs | 58 +- Dusts/OMGWTHSparkle.cs | 41 +- Gores/AstralWaterDroplet.cs | 9 +- Items/AbyssItems/AbyssalAmulet.cs | 4 +- Items/AbyssItems/AbyssalDivingGear.cs | 4 +- Items/AbyssItems/AlluringBait.cs | 9 +- Items/AbyssItems/AnechoicCoating.cs | 54 +- Items/AbyssItems/AnechoicPlating.cs | 4 +- Items/AbyssItems/CloakingGland.cs | 4 +- Items/AbyssItems/DepthCells.cs | 4 +- Items/AbyssItems/DepthCharm.cs | 4 +- Items/AbyssItems/IronBoots.cs | 4 +- Items/AbyssItems/LumenousAmulet.cs | 4 +- Items/AbyssItems/ReaperTooth.cs | 4 +- Items/AbyssItems/ReaperToothNecklace.cs | 4 +- Items/AbyssItems/SunkenStew.cs | 150 +- Items/AbyssItems/TorrentialTear.cs | 54 +- Items/Accessories/AbyssalMirror.cs | 34 +- Items/Accessories/AlchemicalFlask.cs | 4 +- Items/Accessories/AmalgamatedBrain.cs | 10 +- Items/Accessories/AmbrosialAmpoule.cs | 4 +- Items/Accessories/AmidiasSpark.cs | 46 +- Items/Accessories/AngelTreads.cs | 4 +- Items/Accessories/ArcanumoftheVoid.cs | 12 +- Items/Accessories/AsgardianAegis.cs | 14 +- Items/Accessories/AsgardsValor.cs | 14 +- Items/Accessories/AstralArcanum.cs | 82 +- Items/Accessories/AstralBulwark.cs | 12 +- Items/Accessories/BadgeofBravery.cs | 24 +- Items/Accessories/BloodflareCore.cs | 8 +- Items/Accessories/BloodyWormScarf.cs | 4 +- Items/Accessories/BurdenBreaker.cs | 1 - Items/Accessories/CelestialJewel.cs | 4 +- Items/Accessories/ChaosAmulet.cs | 54 +- Items/Accessories/CheatTestThing.cs | 4 +- Items/Accessories/CoinofDeceit.cs | 21 +- Items/Accessories/CoreOfTheBloodGod.cs | 8 +- Items/Accessories/CounterScarf.cs | 4 +- Items/Accessories/CrawCarapace.cs | 40 +- Items/Accessories/CrownJewel.cs | 4 +- Items/Accessories/DarkGodsSheath.cs | 28 +- Items/Accessories/DarkSunRing.cs | 14 +- Items/Accessories/DeificAmulet.cs | 82 +- Items/Accessories/DimensionalSoulArtifact.cs | 50 +- Items/Accessories/DraedonsHeart.cs | 16 +- Items/Accessories/EclipseMirror.cs | 34 +- Items/Accessories/EldritchSoulArtifact.cs | 48 +- Items/Accessories/ElementalGauntlet.cs | 8 +- Items/Accessories/ElementalQuiver.cs | 10 +- Items/Accessories/EtherealTalisman.cs | 24 +- Items/Accessories/EyeoftheStorm.cs | 58 +- Items/Accessories/FeatherCrown.cs | 34 +- Items/Accessories/FrigidBulwark.cs | 8 +- Items/Accessories/FrostBarrier.cs | 46 +- Items/Accessories/FrostFlare.cs | 52 +- Items/Accessories/FungalCarapace.cs | 42 +- Items/Accessories/GiantShell.cs | 46 +- Items/Accessories/GiantTortoiseShell.cs | 40 +- Items/Accessories/GodlySoulArtifact.cs | 44 +- Items/Accessories/GoldBurdenBreaker.cs | 77 +- Items/Accessories/GrandGelatin.cs | 76 +- Items/Accessories/HarpyRing.cs | 4 +- Items/Accessories/HeartofDarkness.cs | 4 +- Items/Accessories/HeartoftheElements.cs | 280 +- Items/Accessories/HoneyDew.cs | 4 +- Items/Accessories/InkBomb.cs | 32 +- Items/Accessories/Laudanum.cs | 4 +- Items/Accessories/LifeJelly.cs | 44 +- Items/Accessories/MagicLevelMeter.cs | 4 +- Items/Accessories/ManaJelly.cs | 44 +- Items/Accessories/MeleeLevelMeter.cs | 4 +- Items/Accessories/MirageMirror.cs | 34 +- Items/Accessories/MoonstoneCrown.cs | 24 +- Items/Accessories/Nanotech.cs | 25 +- Items/Accessories/NecklaceofVexation.cs | 10 +- Items/Accessories/OldDie.cs | 4 +- Items/Accessories/OrnateShield.cs | 4 +- Items/Accessories/PlagueHive.cs | 8 +- Items/Accessories/PsychoticAmulet.cs | 57 +- Items/Accessories/RaidersTalisman.cs | 4 +- Items/Accessories/RampartofDeities.cs | 14 +- Items/Accessories/RangedLevelMeter.cs | 4 +- Items/Accessories/RareVariants/DeepDiver.cs | 18 +- .../RareVariants/FabledTortoiseShell.cs | 52 +- .../RareVariants/HideofAstrumDeus.cs | 38 +- Items/Accessories/RareVariants/Regenator.cs | 24 +- .../Accessories/RareVariants/SamuraiBadge.cs | 14 +- Items/Accessories/RareVariants/TheBee.cs | 56 +- .../Accessories/RareVariants/TheEvolution.cs | 16 +- .../RareVariants/TheTransformer.cs | 54 +- Items/Accessories/RogueLevelMeter.cs | 4 +- Items/Accessories/RuinMedallion.cs | 30 +- Items/Accessories/SeaShell.cs | 50 +- Items/Accessories/ShieldoftheOcean.cs | 4 +- Items/Accessories/SigilofCalamitas.cs | 108 +- Items/Accessories/SilencingSheath.cs | 34 +- Items/Accessories/SpiritGenerator.cs | 4 +- Items/Accessories/Sponge.cs | 8 +- Items/Accessories/StatisBeltOfCurses.cs | 9 +- Items/Accessories/StatisBlessing.cs | 4 +- Items/Accessories/StatisCurse.cs | 4 +- Items/Accessories/StatisNinjaBelt.cs | 5 +- Items/Accessories/StressPills.cs | 4 +- Items/Accessories/SummonLevelMeter.cs | 4 +- Items/Accessories/TheAbsorber.cs | 112 +- Items/Accessories/TheAmalgam.cs | 28 +- Items/Accessories/TheCommunity.cs | 40 +- Items/Accessories/TheFirstShadowflame.cs | 12 +- Items/Accessories/VitalJelly.cs | 38 +- Items/Accessories/VoidofExtinction.cs | 22 +- Items/Accessories/WifeinaBottle.cs | 58 +- Items/Accessories/WifeinaBottlewithBoobs.cs | 62 +- Items/Accessories/Wings/AureateWings.cs | 218 +- Items/Accessories/Wings/CelestialTracers.cs | 166 +- Items/Accessories/Wings/DiscordianWings.cs | 142 +- Items/Accessories/Wings/DrewsWings.cs | 108 +- Items/Accessories/Wings/ElysianTracers.cs | 164 +- Items/Accessories/Wings/HadarianWings.cs | 170 +- Items/Accessories/Wings/InfinityBoots.cs | 164 +- Items/Accessories/Wings/MOAB.cs | 224 +- Items/Accessories/Wings/SkylineWings.cs | 94 +- Items/Accessories/Wings/StarlightWings.cs | 142 +- Items/Accessories/Wings/TarragonWings.cs | 162 +- Items/Accessories/Wings/XerocWings.cs | 144 +- Items/Accessories/YharimsInsignia.cs | 8 +- Items/Amidias/AmidiasTrident.cs | 76 +- Items/Amidias/CoralCannon.cs | 84 +- Items/Amidias/MagicalConch.cs | 122 +- Items/Amidias/Shellshooter.cs | 64 +- Items/Amidias/UrchinFlail.cs | 54 +- Items/Amidias/Waywasher.cs | 66 +- Items/AquaticScourge/AquaticEmblem.cs | 8 +- Items/AquaticScourge/AquaticScourgeBag.cs | 122 +- Items/AquaticScourge/Seafood.cs | 76 +- Items/Armor/AbyssalDivingSuit.cs | 8 +- Items/Armor/AerospecBreastplate.cs | 5 +- Items/Armor/AerospecHat.cs | 8 +- Items/Armor/AerospecHeadgear.cs | 23 +- Items/Armor/AerospecHelm.cs | 8 +- Items/Armor/AerospecHelmet.cs | 8 +- Items/Armor/AerospecHood.cs | 8 +- Items/Armor/AerospecLeggings.cs | 4 +- Items/Armor/AstralBreastplate.cs | 4 +- Items/Armor/AstralHelm.cs | 98 +- Items/Armor/AstralLeggings.cs | 4 +- Items/Armor/AstrumDeusMask.cs | 28 +- Items/Armor/AtaxiaArmor.cs | 11 +- Items/Armor/AtaxiaHeadgear.cs | 12 +- Items/Armor/AtaxiaHelm.cs | 20 +- Items/Armor/AtaxiaHelmet.cs | 12 +- Items/Armor/AtaxiaHood.cs | 23 +- Items/Armor/AtaxiaMask.cs | 14 +- Items/Armor/AtaxiaSubligar.cs | 5 +- Items/Armor/AureusMask.cs | 28 +- Items/Armor/AuricTeslaBodyArmor.cs | 18 +- Items/Armor/AuricTeslaCuisses.cs | 15 +- Items/Armor/AuricTeslaHelm.cs | 16 +- Items/Armor/AuricTeslaHoodedFacemask.cs | 16 +- Items/Armor/AuricTeslaPlumedHelm.cs | 29 +- Items/Armor/AuricTeslaSpaceHelmet.cs | 18 +- Items/Armor/AuricTeslaWireHemmedVisage.cs | 24 +- Items/Armor/BloodflareBodyArmor.cs | 15 +- Items/Armor/BloodflareCuisses.cs | 15 +- Items/Armor/BloodflareHelm.cs | 29 +- Items/Armor/BloodflareHelmet.cs | 16 +- Items/Armor/BloodflareHornedHelm.cs | 16 +- Items/Armor/BloodflareHornedMask.cs | 22 +- Items/Armor/BloodflareMask.cs | 16 +- Items/Armor/CalamitasMask.cs | 28 +- Items/Armor/CrabulonMask.cs | 28 +- Items/Armor/CryogenMask.cs | 28 +- Items/Armor/DaedalusBreastplate.cs | 11 +- Items/Armor/DaedalusHat.cs | 18 +- Items/Armor/DaedalusHeadgear.cs | 8 +- Items/Armor/DaedalusHelm.cs | 16 +- Items/Armor/DaedalusHelmet.cs | 10 +- Items/Armor/DaedalusLeggings.cs | 5 +- Items/Armor/DaedalusVisor.cs | 21 +- Items/Armor/DemonshadeBreastplate.cs | 64 +- Items/Armor/DemonshadeGreaves.cs | 54 +- Items/Armor/DemonshadeHelm.cs | 130 +- Items/Armor/DesertScourgeMask.cs | 28 +- Items/Armor/DevourerofGodsMask.cs | 28 +- Items/Armor/GodSlayerChestplate.cs | 18 +- Items/Armor/GodSlayerHelm.cs | 12 +- Items/Armor/GodSlayerHelmet.cs | 12 +- Items/Armor/GodSlayerHornedHelm.cs | 12 +- Items/Armor/GodSlayerLeggings.cs | 15 +- Items/Armor/GodSlayerMask.cs | 25 +- Items/Armor/GodSlayerVisage.cs | 22 +- Items/Armor/HiveMindMask.cs | 28 +- Items/Armor/LeviathanMask.cs | 28 +- Items/Armor/MolluskShelleggings.cs | 31 +- Items/Armor/MolluskShellmet.cs | 114 +- Items/Armor/MolluskShellplate.cs | 31 +- Items/Armor/OmegaBlueChestplate.cs | 34 +- Items/Armor/OmegaBlueHelmet.cs | 41 +- Items/Armor/OmegaBlueLeggings.cs | 11 +- Items/Armor/PerforatorMask.cs | 28 +- Items/Armor/PlaguebringerGoliathMask.cs | 28 +- Items/Armor/ProvidenceMask.cs | 28 +- Items/Armor/ReaverCap.cs | 19 +- Items/Armor/ReaverCuisses.cs | 5 +- Items/Armor/ReaverHelm.cs | 8 +- Items/Armor/ReaverHelmet.cs | 8 +- Items/Armor/ReaverMask.cs | 12 +- Items/Armor/ReaverScaleMail.cs | 11 +- Items/Armor/ReaverVisage.cs | 8 +- Items/Armor/ShroomiteVisage.cs | 82 +- Items/Armor/SilvaArmor.cs | 21 +- Items/Armor/SilvaHelm.cs | 18 +- Items/Armor/SilvaHelmet.cs | 18 +- Items/Armor/SilvaHornedHelm.cs | 18 +- Items/Armor/SilvaLeggings.cs | 19 +- Items/Armor/SilvaMask.cs | 31 +- Items/Armor/SilvaMaskedCap.cs | 28 +- Items/Armor/SirensHeart.cs | 4 +- Items/Armor/SirensHeartAlt.cs | 4 +- Items/Armor/SlimeGodMask.cs | 28 +- Items/Armor/SlimeGodMask2.cs | 28 +- Items/Armor/StatigelArmor.cs | 5 +- Items/Armor/StatigelCap.cs | 12 +- Items/Armor/StatigelGreaves.cs | 8 +- Items/Armor/StatigelHeadgear.cs | 8 +- Items/Armor/StatigelHelm.cs | 8 +- Items/Armor/StatigelHood.cs | 8 +- Items/Armor/StatigelMask.cs | 21 +- Items/Armor/TarragonBreastplate.cs | 15 +- Items/Armor/TarragonHelm.cs | 16 +- Items/Armor/TarragonHelmet.cs | 27 +- Items/Armor/TarragonHornedHelm.cs | 20 +- Items/Armor/TarragonLeggings.cs | 15 +- Items/Armor/TarragonMask.cs | 22 +- Items/Armor/TarragonVisage.cs | 16 +- Items/Armor/VictideBreastplate.cs | 5 +- Items/Armor/VictideHeadgear.cs | 19 +- Items/Armor/VictideHelm.cs | 8 +- Items/Armor/VictideHelmet.cs | 8 +- Items/Armor/VictideLeggings.cs | 4 +- Items/Armor/VictideMask.cs | 8 +- Items/Armor/VictideVisage.cs | 8 +- Items/Armor/WulfrumArmor.cs | 5 +- Items/Armor/WulfrumHeadgear.cs | 4 +- Items/Armor/WulfrumHelm.cs | 4 +- Items/Armor/WulfrumHelmet.cs | 4 +- Items/Armor/WulfrumHood.cs | 4 +- Items/Armor/WulfrumLeggings.cs | 4 +- Items/Armor/WulfrumMask.cs | 5 +- Items/Armor/XerocCuisses.cs | 5 +- Items/Armor/XerocMask.cs | 25 +- Items/Armor/XerocPlateMail.cs | 5 +- Items/Armor/YharonMask.cs | 28 +- Items/Astrageldon/AstrageldonBag.cs | 82 +- Items/Astrageldon/AstralChunk.cs | 66 +- Items/Astrageldon/AstralJelly.cs | 60 +- Items/AstrumDeus/AstrumDeusBag.cs | 78 +- Items/AstrumDeus/Starcore.cs | 68 +- Items/BrimstoneKey.cs | 31 +- Items/BrimstoneWaifu/BrimstoneWaifuBag.cs | 88 +- Items/BrimstoneWaifu/CharredIdol.cs | 84 +- Items/BrimstoneWaifu/Gehenna.cs | 4 +- Items/BrimstoneWaifu/RoseStone.cs | 58 +- Items/Bumblefuck/BirbPheromones.cs | 74 +- Items/Bumblefuck/BumblebirbBag.cs | 70 +- Items/Bumblefuck/EffulgentFeather.cs | 34 +- Items/Calamitas/BlightedEyeball.cs | 74 +- Items/Calamitas/CalamitasBag.cs | 86 +- Items/Calamitas/CalamityDust.cs | 4 +- Items/Calamitas/CalamityRing.cs | 8 +- Items/Calamitas/ChaosStone.cs | 28 +- .../AccretionDisk.cs | 70 +- .../AdamantiteThrowingAxe.cs | 68 +- .../BallisticPoisonBomb.cs | 44 +- .../BlastBarrel.cs | 40 +- .../BloodsoakedCrasher.cs | 72 +- .../BouncingEyeball.cs | 37 +- .../BrackishFlask.cs | 4 +- .../CalamityCustomThrowingDamage/Brimblade.cs | 62 +- .../CalamityDamageItem.cs | 126 +- .../CelestialReaper.cs | 17 +- .../CalamityCustomThrowingDamage/Celestus.cs | 10 +- .../CobaltKunai.cs | 68 +- .../ConsecratedWater.cs | 18 +- .../CosmicKunai.cs | 68 +- .../CraniumSmasher.cs | 74 +- .../CrushsawCrasher.cs | 8 +- .../CrystalPiercer.cs | 68 +- .../Crystalline.cs | 68 +- .../CursedDagger.cs | 46 +- .../DuststormInABottle.cs | 4 +- .../EclipsesFall.cs | 95 +- .../EmpyreanKnivesThrown.cs | 12 +- .../Eradicator.cs | 22 +- .../ExecutionersBlade.cs | 90 +- .../FeatherKnife.cs | 68 +- .../FlameScythe.cs | 62 +- .../FrostyFlare.cs | 26 +- .../GacruxianMollusk.cs | 6 +- .../GalaxySmasherRogue.cs | 9 +- Items/CalamityCustomThrowingDamage/GelDart.cs | 8 +- .../GhoulishGouger.cs | 46 +- .../HeavenfallenStardisk.cs | 66 +- Items/CalamityCustomThrowingDamage/IceStar.cs | 6 +- .../Icebreaker.cs | 6 +- .../IchorSpear.cs | 44 +- Items/CalamityCustomThrowingDamage/Kylie.cs | 6 +- .../CalamityCustomThrowingDamage/Lionfish.cs | 46 +- .../CalamityCustomThrowingDamage/Malachite.cs | 114 +- .../MangroveChakram.cs | 60 +- .../MeteorFist.cs | 66 +- .../MoltenAmputator.cs | 10 +- .../MonkeyDarts.cs | 2 +- .../CalamityCustomThrowingDamage/Mycoroot.cs | 60 +- .../MythrilKnife.cs | 68 +- .../NanoblackReaperRogue.cs | 93 +- .../OrichalcumSpikedGemstone.cs | 70 +- .../PalladiumJavelin.cs | 70 +- .../Patreon/CorpusAvertor.cs | 76 +- .../Patreon/DeepSeaDumbbell.cs | 138 +- .../Patreon/KelvinCatalyst.cs | 108 +- .../Patreon/Plaguenade.cs | 54 +- .../Patreon/TimeBolt.cs | 86 +- .../Prismalline.cs | 74 +- .../ProfanedTrident.cs | 10 +- .../Pwnagehammer.cs | 62 +- .../RadiantStar.cs | 76 +- .../RareVariants/DuneHopper.cs | 48 +- .../RareVariants/Quasar.cs | 66 +- .../RareVariants/SpearofDestiny.cs | 70 +- .../RareVariants/TheReaper.cs | 46 +- Items/CalamityCustomThrowingDamage/RotBall.cs | 74 +- .../RoyalKnives.cs | 12 +- .../SandDollar.cs | 72 +- .../ScarletDevil.cs | 68 +- .../ScourgeoftheCosmosThrown.cs | 44 +- .../ScourgeoftheDesert.cs | 46 +- .../ScourgeoftheSeas.cs | 74 +- .../SeafoamBomb.cs | 70 +- .../SeashellBoomerang.cs | 4 +- .../ShatteredSun.cs | 74 +- .../CalamityCustomThrowingDamage/SnapClam.cs | 54 +- .../SpearofPaleolith.cs | 6 +- .../StellarContemptRogue.cs | 17 +- .../StellarKnife.cs | 56 +- .../StormfrontRazor.cs | 8 +- .../TarragonThrowingDart.cs | 6 +- .../TitaniumShuriken.cs | 4 +- .../CalamityCustomThrowingDamage/ToothBall.cs | 74 +- ...TriactisTruePaladinianMageHammerofMight.cs | 10 +- .../TruePaladinsHammer.cs | 8 +- .../UrchinStinger.cs | 52 +- .../UtensilPoker.cs | 77 +- .../Valediction.cs | 46 +- .../WulfrumKnife.cs | 68 +- .../XerocPitchfork.cs | 4 +- Items/CalamityGlobalItem.cs | 4601 ++- Items/Crabulon/CrabulonBag.cs | 84 +- Items/Crabulon/DecapoditaSprout.cs | 70 +- Items/Crabulon/FungalClump.cs | 62 +- Items/Cryogen/CryoBar.cs | 4 +- Items/Cryogen/CryoKey.cs | 80 +- Items/Cryogen/CryoStone.cs | 26 +- Items/Cryogen/CryogenBag.cs | 104 +- Items/Cryogen/SoulofCryogen.cs | 14 +- Items/DesertScourge/AeroStone.cs | 49 +- Items/DesertScourge/DesertScourgeBag.cs | 132 +- Items/DesertScourge/DriedSeafood.cs | 94 +- Items/DevourerMunsters/ArmoredShell.cs | 28 +- Items/DevourerMunsters/DarkPlasma.cs | 6 +- Items/DevourerMunsters/RuneofCos.cs | 90 +- Items/DevourerMunsters/TwistingNether.cs | 44 +- Items/DifficultyItems/Armageddon.cs | 46 +- Items/DifficultyItems/Death.cs | 56 +- Items/DifficultyItems/DefiledRune.cs | 164 +- Items/DifficultyItems/IronHeart.cs | 114 +- Items/DifficultyItems/MLGRune.cs | 56 +- Items/DifficultyItems/Revenge.cs | 214 +- Items/FabsolStuff/BloodyMary.cs | 16 +- Items/FabsolStuff/BlueCandle.cs | 44 +- Items/FabsolStuff/CaribbeanRum.cs | 16 +- Items/FabsolStuff/CinnamonRoll.cs | 16 +- Items/FabsolStuff/Everclear.cs | 16 +- Items/FabsolStuff/EvergreenGin.cs | 16 +- Items/FabsolStuff/FabsolsVodka.cs | 46 +- Items/FabsolStuff/Fireball.cs | 16 +- Items/FabsolStuff/GrapeBeer.cs | 116 +- Items/FabsolStuff/Margarita.cs | 120 +- Items/FabsolStuff/Moonshine.cs | 16 +- Items/FabsolStuff/MoscowMule.cs | 16 +- Items/FabsolStuff/OddMushroom.cs | 34 +- Items/FabsolStuff/PinkCandle.cs | 46 +- Items/FabsolStuff/PurpleCandle.cs | 44 +- Items/FabsolStuff/RedWine.cs | 64 +- Items/FabsolStuff/Rum.cs | 16 +- Items/FabsolStuff/Screwdriver.cs | 16 +- Items/FabsolStuff/StarBeamRye.cs | 16 +- Items/FabsolStuff/Tequila.cs | 16 +- Items/FabsolStuff/TequilaSunrise.cs | 16 +- Items/FabsolStuff/Vodka.cs | 16 +- Items/FabsolStuff/Whiskey.cs | 16 +- Items/FabsolStuff/WhiteWine.cs | 26 +- Items/FabsolStuff/YellowCandle.cs | 46 +- Items/Fishing/ArcturusAstroidean.cs | 7 +- Items/Fishing/AstralCrate.cs | 164 +- Items/Fishing/ProcyonidPrawn.cs | 2 +- Items/Fishing/TwinklingPollox.cs | 2 +- Items/Fishing/UrsaSergeant.cs | 5 +- Items/GreatSandShark/GrandScale.cs | 4 +- Items/GreatSandShark/SandstormsCore.cs | 64 +- Items/HiveMind/HiveMindBag.cs | 90 +- Items/HiveMind/RottenBrain.cs | 12 +- Items/HiveMind/Teratoma.cs | 72 +- Items/HiveMind/TrueShadowScale.cs | 28 +- Items/Leviathan/IOU.cs | 28 +- Items/Leviathan/LeviathanAmbergris.cs | 32 +- Items/Leviathan/LeviathanBag.cs | 110 +- Items/LoreItems/KnowledgeAquaticScourge.cs | 52 +- Items/LoreItems/KnowledgeAstralInfection.cs | 38 +- Items/LoreItems/KnowledgeAstrumAureus.cs | 52 +- Items/LoreItems/KnowledgeAstrumDeus.cs | 54 +- Items/LoreItems/KnowledgeBloodMoon.cs | 36 +- Items/LoreItems/KnowledgeBrainofCthulhu.cs | 140 +- Items/LoreItems/KnowledgeBrimstoneCrag.cs | 36 +- .../LoreItems/KnowledgeBrimstoneElemental.cs | 52 +- Items/LoreItems/KnowledgeBumblebirb.cs | 40 +- Items/LoreItems/KnowledgeCalamitas.cs | 58 +- Items/LoreItems/KnowledgeCalamitasClone.cs | 52 +- Items/LoreItems/KnowledgeCorruption.cs | 38 +- Items/LoreItems/KnowledgeCrabulon.cs | 58 +- Items/LoreItems/KnowledgeCrimson.cs | 36 +- Items/LoreItems/KnowledgeCryogen.cs | 54 +- Items/LoreItems/KnowledgeDesertScourge.cs | 53 +- Items/LoreItems/KnowledgeDestroyer.cs | 52 +- Items/LoreItems/KnowledgeDevourerofGods.cs | 56 +- Items/LoreItems/KnowledgeDukeFishron.cs | 58 +- Items/LoreItems/KnowledgeEaterofWorlds.cs | 52 +- Items/LoreItems/KnowledgeEyeofCthulhu.cs | 48 +- Items/LoreItems/KnowledgeGolem.cs | 54 +- Items/LoreItems/KnowledgeHiveMind.cs | 58 +- Items/LoreItems/KnowledgeLeviathanandSiren.cs | 54 +- Items/LoreItems/KnowledgeLunaticCultist.cs | 58 +- Items/LoreItems/KnowledgeMechs.cs | 36 +- Items/LoreItems/KnowledgeMoonLord.cs | 56 +- Items/LoreItems/KnowledgeOcean.cs | 36 +- Items/LoreItems/KnowledgePerforators.cs | 58 +- .../KnowledgePlaguebringerGoliath.cs | 54 +- Items/LoreItems/KnowledgePlantera.cs | 52 +- Items/LoreItems/KnowledgePolterghast.cs | 56 +- Items/LoreItems/KnowledgeProfanedGuardians.cs | 42 +- Items/LoreItems/KnowledgeProvidence.cs | 56 +- Items/LoreItems/KnowledgeQueenBee.cs | 52 +- Items/LoreItems/KnowledgeRavager.cs | 54 +- Items/LoreItems/KnowledgeSentinels.cs | 42 +- Items/LoreItems/KnowledgeSkeletron.cs | 58 +- Items/LoreItems/KnowledgeSkeletronPrime.cs | 52 +- Items/LoreItems/KnowledgeSlimeGod.cs | 62 +- Items/LoreItems/KnowledgeSulphurSea.cs | 38 +- Items/LoreItems/KnowledgeTwins.cs | 52 +- Items/LoreItems/KnowledgeUnderworld.cs | 36 +- Items/LoreItems/KnowledgeWallofFlesh.cs | 52 +- Items/LoreItems/KnowledgeYharon.cs | 56 +- Items/Materials/AerialiteBar.cs | 42 +- Items/Materials/AncientBoneDust.cs | 2 +- Items/Materials/BarofLife.cs | 46 +- Items/Materials/BeetleJuice.cs | 26 +- Items/Materials/BlightedLens.cs | 26 +- Items/Materials/BloodOrb.cs | 2 +- Items/Materials/BloodlettingEssence.cs | 2 +- Items/Materials/Bloodstone.cs | 6 +- Items/Materials/BloodstoneCore.cs | 6 +- Items/Materials/CalamitousEssence.cs | 6 +- Items/Materials/CoreofCalamity.cs | 54 +- Items/Materials/CoreofChaos.cs | 58 +- Items/Materials/CoreofCinder.cs | 58 +- Items/Materials/CoreofEleum.cs | 58 +- Items/Materials/CruptixBar.cs | 2 +- Items/Materials/DarksunFragment.cs | 44 +- Items/Materials/DemonicBoneAsh.cs | 26 +- Items/Materials/DesertFeather.cs | 26 +- Items/Materials/DraedonBar.cs | 2 +- Items/Materials/EbonianGel.cs | 26 +- Items/Materials/Ectoblood.cs | 26 +- Items/Materials/EndothermicEnergy.cs | 44 +- Items/Materials/EssenceofChaos.cs | 42 +- Items/Materials/EssenceofCinder.cs | 42 +- Items/Materials/EssenceofEleum.cs | 42 +- Items/Materials/FetidEssence.cs | 28 +- Items/Materials/GalacticaSingularity.cs | 2 +- Items/Materials/GypsyPowder.cs | 26 +- Items/Materials/HadarianMembrane.cs | 2 +- Items/Materials/HellcasterFragment.cs | 4 +- Items/Materials/LivingShard.cs | 26 +- Items/Materials/Lumenite.cs | 2 +- Items/Materials/ManeaterBulb.cs | 26 +- Items/Materials/MeldBlob.cs | 26 +- Items/Materials/MeldiateBar.cs | 2 +- Items/Materials/MurkyPaste.cs | 26 +- Items/Materials/MurkySludge.cs | 26 +- Items/Materials/NightmareFuel.cs | 44 +- Items/Materials/Phantoplasm.cs | 38 +- Items/Materials/ShadowspecBar.cs | 6 +- Items/Materials/Stardust.cs | 26 +- Items/Materials/StormlionMandible.cs | 26 +- Items/Materials/TrapperBulb.cs | 26 +- Items/Materials/UeliaceBar.cs | 6 +- Items/Materials/UnholyCore.cs | 2 +- Items/Materials/VerstaltiteBar.cs | 2 +- Items/Materials/VictideBar.cs | 48 +- Items/Materials/VictoryShard.cs | 26 +- Items/Materials/WulfrumShard.cs | 2 +- Items/Mounts/AngryDog.cs | 234 +- Items/Mounts/Brimrose.cs | 6 +- Items/Mounts/Crysthamyr.cs | 224 +- Items/Mounts/Fab.cs | 210 +- Items/Mounts/Fabsol.cs | 8 +- Items/Mounts/OnyxExcavator.cs | 309 +- Items/Mounts/SquishyBeanMount.cs | 8 +- Items/Patreon/AngelicShotgun.cs | 4 +- Items/Patreon/ApronOfAffection.cs | 12 +- Items/Patreon/Ataraxia.cs | 230 +- Items/Patreon/BloodyVein.cs | 63 +- Items/Patreon/CorpusAvertorMelee.cs | 76 +- Items/Patreon/DarkSpark.cs | 52 +- Items/Patreon/DevilsSunrise.cs | 91 +- Items/Patreon/DivineRetribution.cs | 46 +- Items/Patreon/DodusHandcannon.cs | 116 +- Items/Patreon/FaceMelter.cs | 170 +- Items/Patreon/ForgottenDragonEgg.cs | 6 +- Items/Patreon/GazeOfCrysthamyr.cs | 34 +- Items/Patreon/HandheldTank.cs | 96 +- Items/Patreon/Karasawa.cs | 128 +- Items/Patreon/Keelhaul.cs | 56 +- Items/Patreon/KelvinCatalystMelee.cs | 108 +- Items/Patreon/LightGodsBrilliance.cs | 68 +- Items/Patreon/MadAlchemistsCocktailGlove.cs | 134 +- Items/Patreon/Nadir.cs | 100 +- Items/Patreon/NormalityRelocator.cs | 56 +- Items/Patreon/ProfanedSoulArtifact.cs | 50 +- Items/Patreon/ResurrectionButterfly.cs | 160 +- Items/Patreon/Roxcalibur.cs | 502 +- Items/Patreon/TheLastMourning.cs | 192 +- Items/Patreon/ThePack.cs | 96 +- Items/Patreon/YateveoBloom.cs | 156 +- Items/Perforator/BloodSample.cs | 28 +- Items/Perforator/BloodyWormFood.cs | 76 +- Items/Perforator/BloodyWormTooth.cs | 12 +- Items/Perforator/PerforatorBag.cs | 94 +- Items/Permafrost/AbsoluteZero.cs | 40 +- Items/Permafrost/ArcticBearPaw.cs | 42 +- Items/Permafrost/ColdheartIcicle.cs | 26 +- Items/Permafrost/CryogenicStaff.cs | 42 +- Items/Permafrost/DeliciousMeat.cs | 18 +- Items/Permafrost/EnchantedMetal.cs | 22 +- Items/Permafrost/EternalBlizzard.cs | 44 +- Items/Permafrost/FrostbiteBlaster.cs | 44 +- Items/Permafrost/IcicleArrow.cs | 32 +- Items/Permafrost/IcicleTrident.cs | 42 +- Items/Permafrost/IcyBullet.cs | 32 +- Items/Permafrost/PermafrostsConcoction.cs | 25 +- Items/Permafrost/Popo.cs | 6 +- Items/Permafrost/WintersFury.cs | 46 +- Items/PermanentBoosters/BloodOrange.cs | 114 +- Items/PermanentBoosters/CometShard.cs | 106 +- Items/PermanentBoosters/Dragonfruit.cs | 118 +- Items/PermanentBoosters/Ectoheart.cs | 78 +- Items/PermanentBoosters/Elderberry.cs | 110 +- Items/PermanentBoosters/ElectrolyteGelPack.cs | 78 +- Items/PermanentBoosters/EtherealCore.cs | 108 +- Items/PermanentBoosters/InfernalBlood.cs | 80 +- Items/PermanentBoosters/MLGRune2.cs | 92 +- Items/PermanentBoosters/MiracleFruit.cs | 110 +- Items/PermanentBoosters/MushroomPlasmaRoot.cs | 78 +- Items/PermanentBoosters/PhantomHeart.cs | 106 +- .../RedLightningContainer.cs | 80 +- Items/PermanentBoosters/StarlightFuelCell.cs | 78 +- Items/Pets/BearEye.cs | 34 +- Items/Pets/CharredRelic.cs | 4 +- Items/Pets/CosmicPlushie.cs | 36 +- Items/Pets/FoxDrive.cs | 4 +- Items/Pets/IbarakiBox.cs | 75 +- Items/Pets/Levi.cs | 4 +- Items/Pets/RomajedaOrchid.cs | 34 +- Items/Pets/TrashmanTrashcan.cs | 34 +- Items/Placeables/AerialiteBrick.cs | 32 +- Items/Placeables/AerialiteBrickWall.cs | 42 +- Items/Placeables/AerialiteOre.cs | 2 +- Items/Placeables/AstrageldonTrophy.cs | 46 +- Items/Placeables/AstralBar.cs | 2 +- Items/Placeables/AstralBrick.cs | 32 +- Items/Placeables/AstralBrickWall.cs | 40 +- Items/Placeables/AstralChest.cs | 34 +- Items/Placeables/AstralMonolith.cs | 32 +- Items/Placeables/AstralMonolithWall.cs | 32 +- Items/Placeables/AstralOre.cs | 2 +- Items/Placeables/AstrumDeusTrophy.cs | 46 +- Items/Placeables/AuricOre.cs | 4 +- Items/Placeables/Banners/AeroSlimeBanner.cs | 38 +- .../Placeables/Banners/AmberCrawlerBanner.cs | 38 +- .../Banners/AmethystCrawlerBanner.cs | 38 +- Items/Placeables/Banners/AngryDogBanner.cs | 38 +- .../Banners/AquaticAberrationBanner.cs | 38 +- .../Banners/AquaticParasiteBanner.cs | 38 +- .../Placeables/Banners/AquaticSeekerBanner.cs | 38 +- .../Placeables/Banners/AquaticUrchinBanner.cs | 38 +- Items/Placeables/Banners/AriesBanner.cs | 38 +- .../Placeables/Banners/ArmoredDiggerBanner.cs | 38 +- Items/Placeables/Banners/AstralProbeBanner.cs | 38 +- Items/Placeables/Banners/AstralSlimeBanner.cs | 38 +- .../Placeables/Banners/AstralachneaBanner.cs | 38 +- Items/Placeables/Banners/AtlasBanner.cs | 38 +- Items/Placeables/Banners/BOHLDOHRBanner.cs | 38 +- .../Placeables/Banners/BigSightseerBanner.cs | 38 +- Items/Placeables/Banners/BlightedEyeBanner.cs | 38 +- .../Placeables/Banners/BlindedAnglerBanner.cs | 38 +- Items/Placeables/Banners/BloatfishBanner.cs | 38 +- Items/Placeables/Banners/BloomSlimeBanner.cs | 38 +- Items/Placeables/Banners/BobbitWormBanner.cs | 38 +- .../Placeables/Banners/BoxJellyfishBanner.cs | 38 +- Items/Placeables/Banners/CalamityEyeBanner.cs | 38 +- Items/Placeables/Banners/CatfishBanner.cs | 38 +- .../Placeables/Banners/ChaoticPufferBanner.cs | 38 +- .../Placeables/Banners/CharredSlimeBanner.cs | 38 +- Items/Placeables/Banners/ClamBanner.cs | 38 +- .../Banners/CloudElementalBanner.cs | 38 +- Items/Placeables/Banners/CnidrionBanner.cs | 38 +- .../Placeables/Banners/ColossalSquidBanner.cs | 38 +- .../Banners/CosmicElementalBanner.cs | 38 +- .../Banners/CrimulanBlightSlimeBanner.cs | 38 +- Items/Placeables/Banners/CryoSlimeBanner.cs | 38 +- Items/Placeables/Banners/CryonBanner.cs | 38 +- .../Banners/CrystalCrawlerBanner.cs | 38 +- .../Banners/CultistAssassinBanner.cs | 38 +- Items/Placeables/Banners/CuttlefishBanner.cs | 38 +- .../Placeables/Banners/DespairStoneBanner.cs | 38 +- Items/Placeables/Banners/DevilFishBanner.cs | 38 +- .../Banners/DiamondCrawlerBanner.cs | 38 +- .../Banners/EarthElementalBanner.cs | 38 +- .../Banners/EbonianBlightSlimeBanner.cs | 38 +- Items/Placeables/Banners/EidolistBanner.cs | 38 +- .../Banners/EidolonWyrmJuvenileBanner.cs | 38 +- .../Banners/EmeraldCrawlerBanner.cs | 38 +- .../Placeables/Banners/EutrophicRayBanner.cs | 38 +- Items/Placeables/Banners/FlounderBanner.cs | 38 +- Items/Placeables/Banners/FrogfishBanner.cs | 38 +- .../Placeables/Banners/FusionFeederBanner.cs | 38 +- Items/Placeables/Banners/GhostBellBanner.cs | 38 +- .../Banners/GhostBellSmallBanner.cs | 38 +- Items/Placeables/Banners/GiantClamBanner.cs | 38 +- Items/Placeables/Banners/GiantSquidBanner.cs | 38 +- Items/Placeables/Banners/GnasherBanner.cs | 38 +- .../Banners/GreatSandSharkBanner.cs | 38 +- Items/Placeables/Banners/GulperEelBanner.cs | 38 +- Items/Placeables/Banners/HadarianBanner.cs | 38 +- Items/Placeables/Banners/HeatSpiritBanner.cs | 38 +- Items/Placeables/Banners/HiveBanner.cs | 38 +- Items/Placeables/Banners/IceClasperBanner.cs | 38 +- .../Banners/ImpiousImmolatorBanner.cs | 38 +- .../Banners/IrradiatedSlimeBanner.cs | 38 +- Items/Placeables/Banners/LaserfishBanner.cs | 38 +- .../Banners/LuminousCorvinaBanner.cs | 38 +- Items/Placeables/Banners/MantisBanner.cs | 38 +- .../Placeables/Banners/MantisShrimpBanner.cs | 38 +- Items/Placeables/Banners/MaulerBanner.cs | 38 +- Items/Placeables/Banners/MelterBanner.cs | 38 +- Items/Placeables/Banners/MirageJellyBanner.cs | 38 +- Items/Placeables/Banners/MorayEelBanner.cs | 38 +- Items/Placeables/Banners/NovaBanner.cs | 38 +- Items/Placeables/Banners/OarfishBanner.cs | 38 +- .../Banners/OverloadedSoldierBanner.cs | 38 +- Items/Placeables/Banners/ParaseaBanner.cs | 38 +- .../Banners/PerennialSlimeBanner.cs | 38 +- .../Banners/PestilentSlimeBanner.cs | 38 +- .../Placeables/Banners/PhantomDebrisBanner.cs | 38 +- .../Placeables/Banners/PhantomSpiritBanner.cs | 38 +- Items/Placeables/Banners/PiggyBanner.cs | 38 +- Items/Placeables/Banners/PitbullBanner.cs | 38 +- .../Placeables/Banners/PlagueChargerBanner.cs | 38 +- .../Placeables/Banners/PlaguebringerBanner.cs | 38 +- Items/Placeables/Banners/PlagueshellBanner.cs | 38 +- Items/Placeables/Banners/PrismTurtleBanner.cs | 38 +- .../Banners/ProfanedEnergyBanner.cs | 38 +- Items/Placeables/Banners/ReaperSharkBanner.cs | 38 +- Items/Placeables/Banners/RubyCrawlerBanner.cs | 38 +- .../Placeables/Banners/SandTortoiseBanner.cs | 38 +- .../Banners/SapphireCrawlerBanner.cs | 38 +- Items/Placeables/Banners/ScornEaterBanner.cs | 38 +- Items/Placeables/Banners/ScryllarBanner.cs | 38 +- Items/Placeables/Banners/SeaFloatyBanner.cs | 38 +- Items/Placeables/Banners/SeaMinnowBanner.cs | 38 +- Items/Placeables/Banners/SeaSerpentBanner.cs | 38 +- Items/Placeables/Banners/SeaUrchinBanner.cs | 38 +- .../Banners/ShockstormShuttleBanner.cs | 38 +- .../Banners/SmallSightseerBanner.cs | 38 +- Items/Placeables/Banners/SoulSluperBanner.cs | 38 +- .../Placeables/Banners/StellarCulexBanner.cs | 38 +- Items/Placeables/Banners/StormlionBanner.cs | 38 +- Items/Placeables/Banners/SunBatBanner.cs | 38 +- Items/Placeables/Banners/SunskaterBanner.cs | 38 +- .../Placeables/Banners/TopazCrawlerBanner.cs | 38 +- Items/Placeables/Banners/ToxicMinnowBanner.cs | 38 +- Items/Placeables/Banners/TrasherBanner.cs | 38 +- Items/Placeables/Banners/ViperfishBanner.cs | 38 +- Items/Placeables/Banners/VirulingBanner.cs | 38 +- .../Placeables/Banners/WulfrumDroneBanner.cs | 38 +- .../Placeables/Banners/WulfrumSlimeBanner.cs | 38 +- Items/Placeables/BlueBrickWallUnsafe.cs | 4 +- Items/Placeables/BlueSlabWallUnsafe.cs | 4 +- Items/Placeables/BlueTiledWallUnsafe.cs | 4 +- Items/Placeables/BrimstoneElementalTrophy.cs | 46 +- Items/Placeables/BumblebirbTrophy.cs | 46 +- Items/Placeables/CalamitasTrophy.cs | 46 +- Items/Placeables/CataclysmTrophy.cs | 46 +- Items/Placeables/CatastropheTrophy.cs | 46 +- Items/Placeables/CeaselessVoidTrophy.cs | 46 +- Items/Placeables/ChaosCandle.cs | 53 +- Items/Placeables/ChaoticOre.cs | 2 +- Items/Placeables/CharredOre.cs | 2 +- Items/Placeables/Cinderplate.cs | 32 +- Items/Placeables/CinderplateWall.cs | 42 +- Items/Placeables/CrabulonTrophy.cs | 46 +- Items/Placeables/CryogenTrophy.cs | 46 +- Items/Placeables/CryonicBrick.cs | 32 +- Items/Placeables/CryonicBrickWall.cs | 40 +- Items/Placeables/CryonicOre.cs | 2 +- Items/Placeables/DesertScourgeTrophy.cs | 46 +- Items/Placeables/DevourerofGodsTrophy.cs | 46 +- Items/Placeables/DraedonsForge.cs | 132 +- Items/Placeables/EutrophicSand.cs | 18 +- Items/Placeables/ExodiumClusterOre.cs | 28 +- Items/Placeables/FurnitureAbyss/AbyssBath.cs | 30 +- Items/Placeables/FurnitureAbyss/AbyssBed.cs | 38 +- .../FurnitureAbyss/AbyssBookcase.cs | 30 +- .../FurnitureAbyss/AbyssCandelabra.cs | 36 +- .../Placeables/FurnitureAbyss/AbyssCandle.cs | 36 +- Items/Placeables/FurnitureAbyss/AbyssChair.cs | 38 +- .../FurnitureAbyss/AbyssChandelier.cs | 38 +- Items/Placeables/FurnitureAbyss/AbyssChest.cs | 32 +- Items/Placeables/FurnitureAbyss/AbyssClock.cs | 38 +- Items/Placeables/FurnitureAbyss/AbyssDoor.cs | 36 +- .../Placeables/FurnitureAbyss/AbyssDresser.cs | 36 +- Items/Placeables/FurnitureAbyss/AbyssLamp.cs | 36 +- .../Placeables/FurnitureAbyss/AbyssLantern.cs | 36 +- Items/Placeables/FurnitureAbyss/AbyssPiano.cs | 38 +- Items/Placeables/FurnitureAbyss/AbyssSink.cs | 34 +- Items/Placeables/FurnitureAbyss/AbyssSofa.cs | 38 +- Items/Placeables/FurnitureAbyss/AbyssTable.cs | 30 +- Items/Placeables/FurnitureAbyss/AbyssTorch.cs | 90 +- .../FurnitureAbyss/AbyssWorkbench.cs | 32 +- .../FurnitureAbyss/SmoothAbyssGravel.cs | 38 +- .../SmoothAbyssGravelPlatform.cs | 42 +- .../FurnitureAbyss/SmoothAbyssGravelWall.cs | 42 +- .../FurnitureAncient/AncientAltar.cs | 26 +- .../FurnitureAncient/AncientBasin.cs | 26 +- .../FurnitureAncient/AncientBath.cs | 26 +- .../Placeables/FurnitureAncient/AncientBed.cs | 36 +- .../FurnitureAncient/AncientBookcase.cs | 28 +- .../FurnitureAncient/AncientChair.cs | 34 +- .../FurnitureAncient/AncientChandelier.cs | 36 +- .../FurnitureAncient/AncientDoor.cs | 32 +- .../FurnitureAncient/AncientDresser.cs | 36 +- .../FurnitureAncient/AncientLamp.cs | 36 +- .../FurnitureAncient/AncientLantern.cs | 34 +- .../FurnitureAncient/AncientMonolith.cs | 36 +- .../FurnitureAncient/AncientPiano.cs | 36 +- .../FurnitureAncient/AncientSink.cs | 30 +- .../FurnitureAncient/AncientSofa.cs | 36 +- .../FurnitureAncient/AncientTable.cs | 30 +- .../FurnitureAncient/AncientWorkbench.cs | 30 +- Items/Placeables/FurnitureAshen/AshenAltar.cs | 32 +- Items/Placeables/FurnitureAshen/AshenBasin.cs | 30 +- Items/Placeables/FurnitureAshen/AshenBath.cs | 28 +- Items/Placeables/FurnitureAshen/AshenBed.cs | 36 +- .../FurnitureAshen/AshenBookcase.cs | 28 +- .../FurnitureAshen/AshenCandelabra.cs | 36 +- .../Placeables/FurnitureAshen/AshenCandle.cs | 38 +- Items/Placeables/FurnitureAshen/AshenChair.cs | 36 +- .../FurnitureAshen/AshenChandelier.cs | 36 +- Items/Placeables/FurnitureAshen/AshenChest.cs | 30 +- Items/Placeables/FurnitureAshen/AshenDoor.cs | 34 +- .../Placeables/FurnitureAshen/AshenDresser.cs | 36 +- Items/Placeables/FurnitureAshen/AshenLamp.cs | 36 +- .../Placeables/FurnitureAshen/AshenLantern.cs | 36 +- .../FurnitureAshen/AshenMonolith.cs | 36 +- Items/Placeables/FurnitureAshen/AshenPiano.cs | 36 +- .../FurnitureAshen/AshenPlatform.cs | 36 +- Items/Placeables/FurnitureAshen/AshenSink.cs | 32 +- Items/Placeables/FurnitureAshen/AshenSlab.cs | 30 +- .../FurnitureAshen/AshenSlabWall.cs | 40 +- Items/Placeables/FurnitureAshen/AshenSofa.cs | 36 +- Items/Placeables/FurnitureAshen/AshenTable.cs | 30 +- .../FurnitureAshen/AshenWorkbench.cs | 30 +- .../FurnitureAshen/SmoothBrimstoneSlagWall.cs | 40 +- .../FurnitureBotanic/BotanicBathtub.cs | 28 +- .../Placeables/FurnitureBotanic/BotanicBed.cs | 30 +- .../FurnitureBotanic/BotanicBench.cs | 30 +- .../FurnitureBotanic/BotanicBookcase.cs | 30 +- .../FurnitureBotanic/BotanicCandelabra.cs | 30 +- .../FurnitureBotanic/BotanicCandle.cs | 30 +- .../FurnitureBotanic/BotanicChair.cs | 28 +- .../FurnitureBotanic/BotanicChandelier.cs | 30 +- .../FurnitureBotanic/BotanicChest.cs | 30 +- .../FurnitureBotanic/BotanicClock.cs | 30 +- .../FurnitureBotanic/BotanicDoor.cs | 28 +- .../FurnitureBotanic/BotanicDresser.cs | 28 +- .../FurnitureBotanic/BotanicLamp.cs | 30 +- .../FurnitureBotanic/BotanicLantern.cs | 30 +- .../FurnitureBotanic/BotanicPiano.cs | 30 +- .../FurnitureBotanic/BotanicPlanter.cs | 30 +- .../FurnitureBotanic/BotanicPlatform.cs | 38 +- .../FurnitureBotanic/BotanicSink.cs | 30 +- .../FurnitureBotanic/BotanicTable.cs | 28 +- .../FurnitureBotanic/BotanicWorkBench.cs | 28 +- .../FurnitureCosmilite/CosmiliteBath.cs | 28 +- .../FurnitureCosmilite/CosmiliteBed.cs | 38 +- .../FurnitureCosmilite/CosmiliteBookcase.cs | 32 +- .../FurnitureCosmilite/CosmiliteBrickWall.cs | 42 +- .../FurnitureCosmilite/CosmiliteCandelabra.cs | 40 +- .../FurnitureCosmilite/CosmiliteCandle.cs | 40 +- .../FurnitureCosmilite/CosmiliteChair.cs | 38 +- .../FurnitureCosmilite/CosmiliteChandelier.cs | 40 +- .../FurnitureCosmilite/CosmiliteChest.cs | 34 +- .../FurnitureCosmilite/CosmiliteClock.cs | 40 +- .../FurnitureCosmilite/CosmiliteDoor.cs | 38 +- .../FurnitureCosmilite/CosmiliteDresser.cs | 40 +- .../FurnitureCosmilite/CosmiliteLamp.cs | 40 +- .../FurnitureCosmilite/CosmiliteLantern.cs | 40 +- .../FurnitureCosmilite/CosmilitePiano.cs | 40 +- .../FurnitureCosmilite/CosmilitePlatform.cs | 38 +- .../FurnitureCosmilite/CosmiliteSconce.cs | 38 +- .../FurnitureCosmilite/CosmiliteSink.cs | 36 +- .../FurnitureCosmilite/CosmiliteSofa.cs | 40 +- .../FurnitureCosmilite/CosmiliteTable.cs | 32 +- .../FurnitureCosmilite/CosmiliteWorkbench.cs | 34 +- .../FurnitureEutrophic/EutrophicBathtub.cs | 26 +- .../FurnitureEutrophic/EutrophicBed.cs | 28 +- .../FurnitureEutrophic/EutrophicBench.cs | 26 +- .../FurnitureEutrophic/EutrophicBookcase.cs | 28 +- .../FurnitureEutrophic/EutrophicCandelabra.cs | 26 +- .../FurnitureEutrophic/EutrophicCandle.cs | 26 +- .../FurnitureEutrophic/EutrophicChair.cs | 26 +- .../FurnitureEutrophic/EutrophicChandelier.cs | 26 +- .../FurnitureEutrophic/EutrophicChest.cs | 26 +- .../FurnitureEutrophic/EutrophicClock.cs | 26 +- .../FurnitureEutrophic/EutrophicCrafting.cs | 28 +- .../FurnitureEutrophic/EutrophicDoor.cs | 26 +- .../FurnitureEutrophic/EutrophicDresser.cs | 26 +- .../FurnitureEutrophic/EutrophicLamp.cs | 26 +- .../FurnitureEutrophic/EutrophicLantern.cs | 26 +- .../FurnitureEutrophic/EutrophicPiano.cs | 28 +- .../FurnitureEutrophic/EutrophicPlatform.cs | 34 +- .../FurnitureEutrophic/EutrophicSink.cs | 28 +- .../FurnitureEutrophic/EutrophicTable.cs | 26 +- .../FurnitureEutrophic/EutrophicWorkBench.cs | 24 +- .../FurnitureEutrophic/SmoothNavystone.cs | 32 +- .../FurnitureEutrophic/SmoothNavystoneWall.cs | 42 +- .../FurnitureOccult/OccultBathtub.cs | 30 +- Items/Placeables/FurnitureOccult/OccultBed.cs | 32 +- .../FurnitureOccult/OccultBookcase.cs | 32 +- .../FurnitureOccult/OccultCandelabra.cs | 30 +- .../FurnitureOccult/OccultCandle.cs | 30 +- .../Placeables/FurnitureOccult/OccultChair.cs | 30 +- .../FurnitureOccult/OccultChandelier.cs | 30 +- .../Placeables/FurnitureOccult/OccultChest.cs | 30 +- .../Placeables/FurnitureOccult/OccultClock.cs | 32 +- .../Placeables/FurnitureOccult/OccultDoor.cs | 30 +- .../FurnitureOccult/OccultDresser.cs | 30 +- .../Placeables/FurnitureOccult/OccultLamp.cs | 30 +- .../FurnitureOccult/OccultLantern.cs | 30 +- .../Placeables/FurnitureOccult/OccultPiano.cs | 32 +- .../FurnitureOccult/OccultPlatform.cs | 34 +- .../Placeables/FurnitureOccult/OccultSink.cs | 32 +- .../Placeables/FurnitureOccult/OccultSofa.cs | 32 +- .../Placeables/FurnitureOccult/OccultStone.cs | 8 +- .../FurnitureOccult/OccultStoneWall.cs | 38 +- .../Placeables/FurnitureOccult/OccultTable.cs | 30 +- .../FurnitureOccult/OccultWorkBench.cs | 30 +- .../FurniturePlaguedPlate/PlagueInfuser.cs | 34 +- .../PlaguedPlateBasin.cs | 38 +- .../PlaguedPlateBathtub.cs | 34 +- .../FurniturePlaguedPlate/PlaguedPlateBed.cs | 32 +- .../PlaguedPlateBookcase.cs | 38 +- .../PlaguedPlateCandelabra.cs | 38 +- .../PlaguedPlateCandle.cs | 38 +- .../PlaguedPlateChair.cs | 38 +- .../PlaguedPlateChandelier.cs | 38 +- .../PlaguedPlateChest.cs | 38 +- .../PlaguedPlateClock.cs | 38 +- .../FurniturePlaguedPlate/PlaguedPlateDoor.cs | 38 +- .../PlaguedPlateDresser.cs | 38 +- .../FurniturePlaguedPlate/PlaguedPlateLamp.cs | 38 +- .../PlaguedPlateLantern.cs | 38 +- .../PlaguedPlatePiano.cs | 38 +- .../PlaguedPlatePlatform.cs | 38 +- .../FurniturePlaguedPlate/PlaguedPlateSink.cs | 34 +- .../FurniturePlaguedPlate/PlaguedPlateSofa.cs | 38 +- .../PlaguedPlateTable.cs | 38 +- .../FurniturePlaguedPlate/PlaguedPlateWall.cs | 42 +- .../PlaguedPlateWorkbench.cs | 34 +- .../FurnitureProfaned/ProfanedBasin.cs | 30 +- .../FurnitureProfaned/ProfanedBath.cs | 30 +- .../FurnitureProfaned/ProfanedBed.cs | 40 +- .../FurnitureProfaned/ProfanedBench.cs | 40 +- .../FurnitureProfaned/ProfanedBookcase.cs | 32 +- .../FurnitureProfaned/ProfanedCandelabra.cs | 40 +- .../FurnitureProfaned/ProfanedCandle.cs | 40 +- .../FurnitureProfaned/ProfanedChair.cs | 38 +- .../FurnitureProfaned/ProfanedChandelier.cs | 40 +- .../FurnitureProfaned/ProfanedChest.cs | 34 +- .../FurnitureProfaned/ProfanedClock.cs | 40 +- .../FurnitureProfaned/ProfanedCrystal.cs | 34 +- .../FurnitureProfaned/ProfanedCrystalWall.cs | 42 +- .../FurnitureProfaned/ProfanedDoor.cs | 38 +- .../FurnitureProfaned/ProfanedDresser.cs | 40 +- .../FurnitureProfaned/ProfanedLamp.cs | 40 +- .../FurnitureProfaned/ProfanedLantern.cs | 40 +- .../FurnitureProfaned/ProfanedPiano.cs | 40 +- .../FurnitureProfaned/ProfanedPlatform.cs | 38 +- .../FurnitureProfaned/ProfanedRock.cs | 36 +- .../FurnitureProfaned/ProfanedRockWall.cs | 42 +- .../FurnitureProfaned/ProfanedSink.cs | 36 +- .../FurnitureProfaned/ProfanedSlabWall.cs | 42 +- .../FurnitureProfaned/ProfanedTable.cs | 32 +- .../FurnitureProfaned/ProfanedWorkbench.cs | 34 +- .../RunicProfanedBrickWall.cs | 42 +- Items/Placeables/FurnitureSilva/SilvaBasin.cs | 46 +- .../Placeables/FurnitureSilva/SilvaBathtub.cs | 30 +- Items/Placeables/FurnitureSilva/SilvaBed.cs | 32 +- Items/Placeables/FurnitureSilva/SilvaBench.cs | 30 +- .../FurnitureSilva/SilvaBookcase.cs | 32 +- .../FurnitureSilva/SilvaCandelabra.cs | 30 +- .../Placeables/FurnitureSilva/SilvaCandle.cs | 30 +- Items/Placeables/FurnitureSilva/SilvaChair.cs | 30 +- .../FurnitureSilva/SilvaChandelier.cs | 48 +- Items/Placeables/FurnitureSilva/SilvaChest.cs | 48 +- Items/Placeables/FurnitureSilva/SilvaClock.cs | 50 +- .../Placeables/FurnitureSilva/SilvaCrystal.cs | 24 +- Items/Placeables/FurnitureSilva/SilvaDoor.cs | 30 +- .../Placeables/FurnitureSilva/SilvaDresser.cs | 30 +- Items/Placeables/FurnitureSilva/SilvaLamp.cs | 30 +- .../Placeables/FurnitureSilva/SilvaLantern.cs | 30 +- Items/Placeables/FurnitureSilva/SilvaPiano.cs | 32 +- .../FurnitureSilva/SilvaPlatform.cs | 30 +- Items/Placeables/FurnitureSilva/SilvaSink.cs | 32 +- Items/Placeables/FurnitureSilva/SilvaTable.cs | 30 +- Items/Placeables/FurnitureSilva/SilvaWall.cs | 42 +- .../FurnitureSilva/SilvaWorkBench.cs | 30 +- .../FurnitureStatigel/StaticRefiner.cs | 28 +- .../FurnitureStatigel/StatigelBath.cs | 30 +- .../FurnitureStatigel/StatigelBed.cs | 40 +- .../FurnitureStatigel/StatigelBlock.cs | 54 +- .../FurnitureStatigel/StatigelBookcase.cs | 32 +- .../FurnitureStatigel/StatigelCandelabra.cs | 40 +- .../FurnitureStatigel/StatigelCandle.cs | 40 +- .../FurnitureStatigel/StatigelChair.cs | 38 +- .../FurnitureStatigel/StatigelChandelier.cs | 40 +- .../FurnitureStatigel/StatigelChest.cs | 34 +- .../FurnitureStatigel/StatigelClock.cs | 40 +- .../FurnitureStatigel/StatigelDoor.cs | 38 +- .../FurnitureStatigel/StatigelDresser.cs | 40 +- .../FurnitureStatigel/StatigelLamp.cs | 40 +- .../FurnitureStatigel/StatigelLantern.cs | 40 +- .../FurnitureStatigel/StatigelPiano.cs | 40 +- .../FurnitureStatigel/StatigelPlatform.cs | 38 +- .../FurnitureStatigel/StatigelSink.cs | 36 +- .../FurnitureStatigel/StatigelSofa.cs | 40 +- .../FurnitureStatigel/StatigelTable.cs | 32 +- .../FurnitureStatigel/StatigelWall.cs | 40 +- .../FurnitureStatigel/StatigelWorkbench.cs | 34 +- .../FurnitureStratus/StratusBathtub.cs | 30 +- .../Placeables/FurnitureStratus/StratusBed.cs | 30 +- .../FurnitureStratus/StratusBookcase.cs | 30 +- .../FurnitureStratus/StratusCandelabra.cs | 30 +- .../FurnitureStratus/StratusCandle.cs | 30 +- .../FurnitureStratus/StratusChair.cs | 30 +- .../FurnitureStratus/StratusChandelier.cs | 30 +- .../FurnitureStratus/StratusChest.cs | 30 +- .../FurnitureStratus/StratusClock.cs | 30 +- .../FurnitureStratus/StratusDoor.cs | 30 +- .../FurnitureStratus/StratusDresser.cs | 30 +- .../FurnitureStratus/StratusLamp.cs | 30 +- .../FurnitureStratus/StratusLantern.cs | 30 +- .../FurnitureStratus/StratusPiano.cs | 30 +- .../FurnitureStratus/StratusPlatform.cs | 32 +- .../FurnitureStratus/StratusSink.cs | 30 +- .../FurnitureStratus/StratusSofa.cs | 30 +- .../FurnitureStratus/StratusTable.cs | 30 +- .../FurnitureStratus/StratusWall.cs | 34 +- .../FurnitureStratus/StratusWorkbench.cs | 30 +- .../FurnitureVoid/SmoothVoidstone.cs | 34 +- .../FurnitureVoid/SmoothVoidstonePlatform.cs | 38 +- .../FurnitureVoid/SmoothVoidstoneWall.cs | 36 +- Items/Placeables/FurnitureVoid/VoidBath.cs | 30 +- Items/Placeables/FurnitureVoid/VoidBed.cs | 40 +- .../Placeables/FurnitureVoid/VoidBookcase.cs | 32 +- .../FurnitureVoid/VoidCandelabra.cs | 40 +- Items/Placeables/FurnitureVoid/VoidCandle.cs | 40 +- Items/Placeables/FurnitureVoid/VoidChair.cs | 38 +- .../FurnitureVoid/VoidChandelier.cs | 40 +- Items/Placeables/FurnitureVoid/VoidChest.cs | 34 +- Items/Placeables/FurnitureVoid/VoidClock.cs | 40 +- .../Placeables/FurnitureVoid/VoidCondenser.cs | 32 +- Items/Placeables/FurnitureVoid/VoidDoor.cs | 38 +- Items/Placeables/FurnitureVoid/VoidDresser.cs | 40 +- Items/Placeables/FurnitureVoid/VoidLamp.cs | 40 +- Items/Placeables/FurnitureVoid/VoidLantern.cs | 40 +- Items/Placeables/FurnitureVoid/VoidPiano.cs | 40 +- Items/Placeables/FurnitureVoid/VoidSink.cs | 30 +- Items/Placeables/FurnitureVoid/VoidSofa.cs | 40 +- Items/Placeables/FurnitureVoid/VoidTable.cs | 32 +- .../Placeables/FurnitureVoid/VoidWorkbench.cs | 34 +- .../Placeables/FurnitureVoid/VoidstoneSlab.cs | 38 +- .../FurnitureVoid/VoidstoneSlabWall.cs | 36 +- Items/Placeables/GreenBrickWallUnsafe.cs | 4 +- Items/Placeables/GreenSlabWallUnsafe.cs | 4 +- Items/Placeables/GreenTiledWallUnsafe.cs | 4 +- Items/Placeables/HiveMindTrophy.cs | 46 +- Items/Placeables/LeviathanTrophy.cs | 46 +- Items/Placeables/Navystone.cs | 28 +- Items/Placeables/PerennialBrick.cs | 32 +- Items/Placeables/PerennialBrickWall.cs | 40 +- Items/Placeables/PerennialOre.cs | 2 +- Items/Placeables/PerforatorTrophy.cs | 46 +- Items/Placeables/PinkBrickWallUnsafe.cs | 4 +- Items/Placeables/PinkSlabWallUnsafe.cs | 4 +- Items/Placeables/PinkTiledWallUnsafe.cs | 4 +- .../Placeables/PlaguebringerGoliathTrophy.cs | 46 +- Items/Placeables/PolterghastTrophy.cs | 46 +- Items/Placeables/PrismShard.cs | 2 +- Items/Placeables/ProvidenceTrophy.cs | 46 +- Items/Placeables/RavagerTrophy.cs | 46 +- Items/Placeables/SeaPrism.cs | 20 +- Items/Placeables/SignusTrophy.cs | 46 +- Items/Placeables/SlimeGodTrophy.cs | 46 +- Items/Placeables/Tenebris.cs | 2 +- Items/Placeables/TranquilityCandle.cs | 53 +- Items/Placeables/UelibloomBrickWall.cs | 40 +- Items/Placeables/UelibloomOre.cs | 8 +- Items/Placeables/Voidstone.cs | 38 +- Items/Placeables/VoidstoneWall.cs | 40 +- Items/Placeables/WeaverTrophy.cs | 46 +- Items/Placeables/YharonTrophy.cs | 46 +- Items/PlaguebringerGoliath/Abomination.cs | 76 +- Items/PlaguebringerGoliath/BloomStone.cs | 293 +- .../PlaguebringerGoliath/PlagueCellCluster.cs | 28 +- .../PlaguebringerGoliathBag.cs | 92 +- Items/PlaguebringerGoliath/ToxicHeart.cs | 4 +- Items/Polterghast/Affliction.cs | 64 +- Items/Polterghast/NecroplasmicBeacon.cs | 74 +- Items/Polterghast/PolterghastBag.cs | 86 +- Items/Polterghast/RuinousSoul.cs | 6 +- Items/Potions/AstralInjection.cs | 110 +- Items/Potions/BoundingPotion.cs | 80 +- Items/Potions/CadencePotion.cs | 90 +- Items/Potions/CalamitasBrew.cs | 80 +- Items/Potions/CalciumPotion.cs | 78 +- Items/Potions/CeaselessHungerPotion.cs | 82 +- Items/Potions/CrumblingPotion.cs | 84 +- Items/Potions/DraconicElixir.cs | 101 +- Items/Potions/GravityNormalizerPotion.cs | 80 +- Items/Potions/HolyWrathPotion.cs | 86 +- Items/Potions/OmegaHealingPotion.cs | 64 +- Items/Potions/PenumbraPotion.cs | 84 +- Items/Potions/PhotosynthesisPotion.cs | 86 +- Items/Potions/PotionofOmniscience.cs | 80 +- Items/Potions/ProfanedRagePotion.cs | 86 +- Items/Potions/PurifiedJam.cs | 74 +- Items/Potions/RevivifyPotion.cs | 102 +- Items/Potions/ShatteringPotion.cs | 84 +- Items/Potions/SoaringPotion.cs | 82 +- Items/Potions/SupremeHealingPotion.cs | 64 +- Items/Potions/SupremeManaPotion.cs | 62 +- Items/Potions/TitanScalePotion.cs | 80 +- Items/Potions/TriumphPotion.cs | 80 +- Items/Potions/YharimsStimulants.cs | 72 +- Items/Potions/ZenPotion.cs | 60 +- Items/Potions/ZergPotion.cs | 62 +- Items/ProfanedGuardian/ProfanedShard.cs | 74 +- Items/Providence/DivineGeode.cs | 6 +- Items/Providence/ElysianAegis.cs | 11 +- Items/Providence/ElysianWings.cs | 10 +- Items/Providence/ProfanedCore.cs | 62 +- Items/Providence/ProfanedCoreUnlimited.cs | 58 +- Items/Providence/ProvidenceBag.cs | 86 +- Items/Providence/UnholyEssence.cs | 6 +- Items/Rock.cs | 4 +- Items/Scavenger/AncientMedallion.cs | 70 +- Items/Scavenger/BloodPact.cs | 4 +- Items/Scavenger/FleshTotem.cs | 4 +- Items/Scavenger/RavagerBag.cs | 112 +- Items/ShrineItems/CorruptionEffigy.cs | 46 +- Items/ShrineItems/CrimsonEffigy.cs | 46 +- Items/ShrineItems/FungalSymbiote.cs | 46 +- Items/ShrineItems/GladiatorsLocket.cs | 68 +- Items/ShrineItems/LuxorsGift.cs | 46 +- Items/ShrineItems/OnyxExcavatorKey.cs | 14 +- Items/ShrineItems/TrinketofChi.cs | 48 +- Items/ShrineItems/TundraLeash.cs | 10 +- Items/ShrineItems/UnstablePrism.cs | 44 +- Items/SlimeGod/ManaOverloader.cs | 12 +- Items/SlimeGod/OverloadedSludge.cs | 102 +- Items/SlimeGod/PurifiedGel.cs | 4 +- Items/SlimeGod/SlimeGodBag.cs | 88 +- Items/StarterBag.cs | 106 +- Items/SummonsAndClimateChange/AridArtifact.cs | 90 +- Items/SummonsAndClimateChange/BloodIdol.cs | 68 +- Items/SummonsAndClimateChange/BossRush.cs | 42 +- Items/SummonsAndClimateChange/BulbofDoom.cs | 82 +- Items/SummonsAndClimateChange/Cosmolight.cs | 80 +- Items/SummonsAndClimateChange/Daylight.cs | 74 +- .../SummonsAndClimateChange/DraedonsRemote.cs | 58 +- .../SummonsAndClimateChange/EidolonTablet.cs | 52 +- Items/SummonsAndClimateChange/Moonlight.cs | 74 +- Items/SummonsAndClimateChange/OldPowerCell.cs | 74 +- Items/SunkenSea/AmidiasPendant.cs | 36 +- Items/SunkenSea/GiantPearl.cs | 12 +- Items/SunkenSea/MolluskHusk.cs | 4 +- Items/SuperDummy.cs | 84 +- Items/SupremeCalamitas/EyeofExtinction.cs | 126 +- Items/TheDevourerofGods/CosmicWorm.cs | 78 +- Items/TheDevourerofGods/CosmiliteBar.cs | 44 +- Items/TheDevourerofGods/DevourerofGodsBag.cs | 113 +- Items/TheDevourerofGods/NebulousCore.cs | 12 +- Items/Tools/AerialHamaxe.cs | 80 +- Items/Tools/AstralHamaxe.cs | 18 +- Items/Tools/AstralPickaxe.cs | 18 +- Items/Tools/BlossomPickaxe.cs | 4 +- Items/Tools/CrystylCrusher.cs | 72 +- Items/Tools/FellerofEvergreens.cs | 72 +- Items/Tools/GallantPickaxe.cs | 4 +- Items/Tools/Gelpick.cs | 86 +- Items/Tools/GreatbayPickaxe.cs | 64 +- Items/Tools/MarniteObliterator.cs | 94 +- Items/Tools/ReefclawHamaxe.cs | 64 +- Items/Tools/SkyfringePickaxe.cs | 80 +- Items/Tools/WulfrumAxe.cs | 62 +- Items/Tools/WulfrumHammer.cs | 62 +- Items/Tools/WulfrumPickaxe.cs | 62 +- Items/Weapons/AMR.cs | 8 +- Items/Weapons/AbyssBlade.cs | 88 +- Items/Weapons/AbyssWeapons/Archerfish.cs | 58 +- Items/Weapons/AbyssWeapons/BallOFugu.cs | 46 +- Items/Weapons/AbyssWeapons/BlackAnurian.cs | 60 +- Items/Weapons/AbyssWeapons/CalamarisLament.cs | 52 +- Items/Weapons/AbyssWeapons/EidolicWail.cs | 44 +- Items/Weapons/AbyssWeapons/FlakKraken.cs | 44 +- Items/Weapons/AbyssWeapons/HalibutCannon.cs | 58 +- Items/Weapons/AbyssWeapons/HerringStaff.cs | 48 +- Items/Weapons/AbyssWeapons/SoulEdge.cs | 4 +- .../AbyssWeapons/SulphuricAcidCannon.cs | 38 +- Items/Weapons/AbyssWeapons/TyphonsGreed.cs | 44 +- .../AbyssWeapons/UndinesRetribution.cs | 52 +- Items/Weapons/AccelerationBullet.cs | 62 +- Items/Weapons/AccretionDiskMelee.cs | 72 +- Items/Weapons/AcidBullet.cs | 62 +- Items/Weapons/AegisBlade.cs | 120 +- Items/Weapons/Aeries.cs | 86 +- Items/Weapons/AethersWhisper.cs | 20 +- Items/Weapons/Aftershock.cs | 100 +- Items/Weapons/AirSpinner.cs | 56 +- Items/Weapons/Alluvion.cs | 171 +- Items/Weapons/AlphaRay.cs | 138 +- Items/Weapons/AnarchyBlade.cs | 128 +- Items/Weapons/AncientCrusher.cs | 70 +- Items/Weapons/AncientIceChunk.cs | 2 +- Items/Weapons/AncientShiv.cs | 72 +- Items/Weapons/Animosity.cs | 150 +- Items/Weapons/Animus.cs | 120 +- Items/Weapons/ApoctosisArray.cs | 92 +- Items/Weapons/Apotheosis.cs | 64 +- Items/Weapons/AquaticDissolution.cs | 92 +- Items/Weapons/AquaticScourge/Barinautical.cs | 64 +- Items/Weapons/AquaticScourge/DeepseaStaff.cs | 94 +- Items/Weapons/AquaticScourge/Downpour.cs | 60 +- .../AquaticScourge/SubmarineShocker.cs | 66 +- Items/Weapons/ArchAmaryllis.cs | 68 +- Items/Weapons/ArcticArrow.cs | 60 +- Items/Weapons/ArkoftheAncients.cs | 275 +- Items/Weapons/ArkoftheCosmos.cs | 404 +- Items/Weapons/ArkoftheElements.cs | 224 +- Items/Weapons/ArterialAssault.cs | 8 +- Items/Weapons/AsteroidStaff.cs | 170 +- Items/Weapons/Astrageldon/Nebulash.cs | 60 +- Items/Weapons/Astral/AstralBlade.cs | 10 +- Items/Weapons/Astral/AstralBlaster.cs | 80 +- Items/Weapons/Astral/AstralPike.cs | 4 +- Items/Weapons/Astral/AstralRepeater.cs | 72 +- Items/Weapons/Astral/AstralScythe.cs | 52 +- Items/Weapons/Astral/AstralStaff.cs | 66 +- Items/Weapons/Astral/AstralachneaStaff.cs | 2 +- Items/Weapons/Astral/HivePod.cs | 40 +- Items/Weapons/Astral/StellarCannon.cs | 2 +- Items/Weapons/Astral/TitanArm.cs | 50 +- Items/Weapons/AstrealDefeat.cs | 110 +- Items/Weapons/AstrumDeus/Starfall.cs | 50 +- Items/Weapons/AuguroftheElements.cs | 124 +- Items/Weapons/Azathoth.cs | 68 +- Items/Weapons/BalefulHarvester.cs | 86 +- Items/Weapons/BarracudaGun.cs | 104 +- Items/Weapons/BiomeBlade.cs | 126 +- Items/Weapons/BlackHawkRemote.cs | 52 +- Items/Weapons/BladecrestOathsword.cs | 54 +- Items/Weapons/BladedgeGreatbow.cs | 127 +- Items/Weapons/BladeofEnmity.cs | 66 +- Items/Weapons/BloodfireArrow.cs | 60 +- Items/Weapons/BloodyEdge.cs | 118 +- Items/Weapons/BlossomFlux.cs | 116 +- Items/Weapons/BlushieStaff.cs | 70 +- Items/Weapons/Brimlash.cs | 88 +- Items/Weapons/BrimlashBuster.cs | 106 +- Items/Weapons/BrimroseStaff.cs | 66 +- Items/Weapons/BrimstoneFury.cs | 90 +- .../BrimstoneWaifu/SeethingDischarge.cs | 74 +- Items/Weapons/BrinyBaron.cs | 124 +- Items/Weapons/Bumblebirb/GildedProboscis.cs | 6 +- Items/Weapons/Bumblebirb/GoldenEagle.cs | 90 +- Items/Weapons/Bumblebirb/RougeSlash.cs | 62 +- Items/Weapons/BurningSea.cs | 64 +- Items/Weapons/BurntSienna.cs | 85 +- Items/Weapons/Butcher.cs | 84 +- Items/Weapons/Calamitas/BlightedEyeStaff.cs | 2 +- .../Calamitas/BrimstoneFlameblaster.cs | 48 +- .../Calamitas/BrimstoneFlamesprayer.cs | 46 +- Items/Weapons/CarnageRay.cs | 76 +- Items/Weapons/CatastropheClaymore.cs | 163 +- Items/Weapons/CausticEdge.cs | 84 +- Items/Weapons/CelestialClaymore.cs | 211 +- Items/Weapons/Chaotrix.cs | 56 +- Items/Weapons/ChargedDartRifle.cs | 120 +- Items/Weapons/ClaretCannon.cs | 4 +- Items/Weapons/CleansingBlaze.cs | 136 +- Items/Weapons/Climax.cs | 148 +- Items/Weapons/ClockGatlignum.cs | 108 +- Items/Weapons/ClockworkBow.cs | 8 +- Items/Weapons/Cnidarian.cs | 56 +- Items/Weapons/CometQuasher.cs | 187 +- Items/Weapons/ConferenceCall.cs | 202 +- Items/Weapons/Contagion.cs | 78 +- Items/Weapons/CoralSpout.cs | 66 +- Items/Weapons/CosmicBolter.cs | 118 +- Items/Weapons/CosmicDischarge.cs | 66 +- Items/Weapons/CosmicImmaterializer.cs | 14 +- Items/Weapons/CosmicRainbow.cs | 208 +- Items/Weapons/Cosmilamp.cs | 108 +- Items/Weapons/Crabulon/Fungicide.cs | 62 +- Items/Weapons/Crabulon/HyphaeRod.cs | 161 +- Items/Weapons/Crabulon/MycelialClaws.cs | 54 +- Items/Weapons/Cryogen/Avalanche.cs | 2 +- Items/Weapons/Cryogen/BittercoldStaff.cs | 2 +- Items/Weapons/Cryogen/EffluviumBow.cs | 96 +- Items/Weapons/Cryogen/GlacialCrusher.cs | 37 +- Items/Weapons/CrystalBlade.cs | 80 +- Items/Weapons/CrystalFlareStaff.cs | 70 +- Items/Weapons/CursedCapper.cs | 76 +- Items/Weapons/DarkechoGreatbow.cs | 96 +- Items/Weapons/DarklightGreatsword.cs | 100 +- Items/Weapons/DeathValley.cs | 70 +- Items/Weapons/DemonicPitchfork.cs | 72 +- Items/Weapons/DepthBlade.cs | 66 +- .../Weapons/DesertScourge/AquaticDischarge.cs | 72 +- Items/Weapons/DesertScourge/Barinade.cs | 56 +- Items/Weapons/DesertScourge/SeaboundStaff.cs | 96 +- Items/Weapons/DesertScourge/StormSpray.cs | 60 +- Items/Weapons/Devastation.cs | 223 +- Items/Weapons/DevilsDevastation.cs | 316 +- .../Weapons/DevourerofGods/DeathhailStaff.cs | 20 +- Items/Weapons/DevourerofGods/Deathwind.cs | 22 +- .../Weapons/DevourerofGods/EradicatorMelee.cs | 20 +- Items/Weapons/DevourerofGods/Excelsus.cs | 44 +- .../DevourerofGods/StaffoftheMechworm.cs | 232 +- .../Weapons/DevourerofGods/TheObliterator.cs | 4 +- Items/Weapons/DraconicDestruction.cs | 92 +- Items/Weapons/DraedonsExoblade.cs | 44 +- Items/Weapons/Drataliornus.cs | 50 +- Items/Weapons/Dualpoon.cs | 102 +- Items/Weapons/Earth.cs | 196 +- Items/Weapons/EarthenPike.cs | 52 +- Items/Weapons/Effervescence.cs | 94 +- Items/Weapons/ElementalAxe.cs | 117 +- Items/Weapons/ElementalBlaster.cs | 64 +- Items/Weapons/ElementalEruption.cs | 110 +- Items/Weapons/ElementalExcalibur.cs | 269 +- Items/Weapons/ElementalRay.cs | 70 +- Items/Weapons/ElementalShortsword.cs | 114 +- Items/Weapons/ElysianArrow.cs | 62 +- Items/Weapons/EmpyreanKnives.cs | 10 +- Items/Weapons/EnergyStaff.cs | 56 +- Items/Weapons/EnhancedNanoRound.cs | 62 +- Items/Weapons/EssenceFlayer.cs | 108 +- Items/Weapons/EvergladeSpray.cs | 66 +- Items/Weapons/ExcaliburShortsword.cs | 74 +- Items/Weapons/ExsanguinationLance.cs | 88 +- Items/Weapons/Fabstaff.cs | 70 +- Items/Weapons/FeralthornClaymore.cs | 94 +- Items/Weapons/FiniteUse/Bazooka.cs | 142 +- Items/Weapons/FiniteUse/ElephantKiller.cs | 146 +- Items/Weapons/FiniteUse/ExplosiveShells.cs | 40 +- Items/Weapons/FiniteUse/GrenadeRounds.cs | 40 +- Items/Weapons/FiniteUse/Hydra.cs | 164 +- Items/Weapons/FiniteUse/LightningHawk.cs | 144 +- Items/Weapons/FiniteUse/Magnum.cs | 144 +- Items/Weapons/FiniteUse/MagnumRounds.cs | 38 +- Items/Weapons/FirestormCannon.cs | 171 +- Items/Weapons/FlameScytheMelee.cs | 64 +- Items/Weapons/FlameburstShortsword.cs | 91 +- Items/Weapons/FlareBolt.cs | 70 +- Items/Weapons/FlarefrostBlade.cs | 108 +- Items/Weapons/FlarewingBow.cs | 136 +- Items/Weapons/FlashBullet.cs | 62 +- Items/Weapons/Floodtide.cs | 57 +- Items/Weapons/ForbiddenOathblade.cs | 188 +- Items/Weapons/ForbiddenSun.cs | 64 +- Items/Weapons/ForsakenSaber.cs | 90 +- Items/Weapons/FourSeasonsGalaxia.cs | 274 +- Items/Weapons/FrigidflashBolt.cs | 70 +- Items/Weapons/FrostBolt.cs | 70 +- Items/Weapons/FrostsparkBullet.cs | 62 +- Items/Weapons/FulgurationHalberd.cs | 140 +- Items/Weapons/GalacticaBlade.cs | 202 +- Items/Weapons/GalaxySmasherMelee.cs | 5 +- Items/Weapons/Galeforce.cs | 92 +- Items/Weapons/GammaFusillade.cs | 66 +- Items/Weapons/Genisis.cs | 94 +- Items/Weapons/GleamingMagnolia.cs | 68 +- Items/Weapons/GoldenGun.cs | 48 +- Items/Weapons/GoldplumeSpear.cs | 68 +- Items/Weapons/GrandGuardian.cs | 150 +- Items/Weapons/Grax.cs | 76 +- .../GreatSandShark/SandSharknadoStaff.cs | 94 +- Items/Weapons/GreatSandShark/Sandstorm.cs | 84 +- Items/Weapons/GreatSandShark/Tumbleweed.cs | 40 +- Items/Weapons/GreatbowofTurmoil.cs | 149 +- Items/Weapons/GreatswordofBlah.cs | 76 +- Items/Weapons/GreatswordofJudgement.cs | 70 +- Items/Weapons/HalleysInferno.cs | 90 +- Items/Weapons/HarvestStaff.cs | 70 +- Items/Weapons/HeartRapier.cs | 66 +- Items/Weapons/HeavenlyGale.cs | 112 +- Items/Weapons/HeliumFlash.cs | 4 +- Items/Weapons/HellBurst.cs | 70 +- Items/Weapons/HellfireFlamberge.cs | 135 +- Items/Weapons/HellionFlowerSpear.cs | 68 +- Items/Weapons/Hellkite.cs | 168 +- Items/Weapons/HellwingStaff.cs | 194 +- Items/Weapons/Helstorm.cs | 88 +- Items/Weapons/HiveMind/DankStaff.cs | 116 +- Items/Weapons/HiveMind/LeechingDagger.cs | 92 +- Items/Weapons/HiveMind/PerfectDark.cs | 66 +- Items/Weapons/HiveMind/ShaderainStaff.cs | 126 +- Items/Weapons/HiveMind/Shadethrower.cs | 88 +- Items/Weapons/HiveMind/ShadowdropStaff.cs | 172 +- Items/Weapons/HolidayHalberd.cs | 98 +- Items/Weapons/HolyFireBullet.cs | 62 +- Items/Weapons/HyperiusBullet.cs | 64 +- Items/Weapons/IcicleStaff.cs | 6 +- Items/Weapons/Impaler.cs | 110 +- Items/Weapons/InfernaCutter.cs | 237 +- Items/Weapons/InfernalRift.cs | 128 +- Items/Weapons/Interfacer.cs | 170 +- Items/Weapons/IonBlaster.cs | 104 +- Items/Weapons/Judgement.cs | 170 +- Items/Weapons/Lacerator.cs | 4 +- Items/Weapons/Lazhar.cs | 82 +- Items/Weapons/Leviathan/Greentide.cs | 146 +- Items/Weapons/Leviathan/Leviatitan.cs | 4 +- Items/Weapons/Leviathan/LureofEnthrallment.cs | 76 +- Items/Weapons/Leviathan/SirensSong.cs | 2 +- Items/Weapons/LifefruitScythe.cs | 94 +- Items/Weapons/Lucrecia.cs | 148 +- Items/Weapons/LunarianBow.cs | 134 +- Items/Weapons/LunicEye.cs | 109 +- Items/Weapons/MagnaCannon.cs | 94 +- Items/Weapons/MagnaStriker.cs | 92 +- Items/Weapons/MagneticMeltdown.cs | 90 +- Items/Weapons/MajesticGuard.cs | 104 +- Items/Weapons/ManaRose.cs | 70 +- Items/Weapons/MandibleBow.cs | 44 +- Items/Weapons/MandibleClaws.cs | 40 +- Items/Weapons/MangroveChakramMelee.cs | 60 +- Items/Weapons/MantisClaws.cs | 59 +- Items/Weapons/Mariana.cs | 162 +- Items/Weapons/MarkedMagnum.cs | 109 +- Items/Weapons/MarniteRifleSpear.cs | 80 +- Items/Weapons/MarniteSpear.cs | 82 +- Items/Weapons/Megafleet.cs | 88 +- Items/Weapons/Megalodon.cs | 86 +- Items/Weapons/Meowthrower.cs | 113 +- Items/Weapons/MineralMortar.cs | 88 +- Items/Weapons/Minigun.cs | 102 +- Items/Weapons/MirrorBlade.cs | 74 +- Items/Weapons/Mistlestorm.cs | 64 +- Items/Weapons/MolecularManipulator.cs | 66 +- Items/Weapons/Monsoon.cs | 159 +- Items/Weapons/MortarRound.cs | 62 +- Items/Weapons/Mourningstar.cs | 86 +- Items/Weapons/Murasama.cs | 82 +- Items/Weapons/NanoblackReaperMelee.cs | 93 +- Items/Weapons/NapalmArrow.cs | 64 +- Items/Weapons/Needler.cs | 66 +- Items/Weapons/NeptunesBounty.cs | 86 +- Items/Weapons/NettlelineGreatbow.cs | 147 +- Items/Weapons/NightsRay.cs | 76 +- Items/Weapons/NightsStabber.cs | 118 +- Items/Weapons/NuclearFury.cs | 100 +- Items/Weapons/NullificationRifle.cs | 76 +- Items/Weapons/OldLordOathsword.cs | 136 +- Items/Weapons/OmegaBiomeBlade.cs | 102 +- Items/Weapons/Omniblade.cs | 78 +- Items/Weapons/OnyxChainBlaster.cs | 116 +- Items/Weapons/Onyxia.cs | 6 +- Items/Weapons/OpalStriker.cs | 68 +- Items/Weapons/P90.cs | 116 +- Items/Weapons/PaintballBlaster.cs | 136 +- Items/Weapons/Perforators/Aorta.cs | 58 +- Items/Weapons/Perforators/BloodBath.cs | 188 +- Items/Weapons/Perforators/BloodClotStaff.cs | 114 +- Items/Weapons/Perforators/BloodyRupture.cs | 92 +- Items/Weapons/Perforators/Eviscerator.cs | 84 +- Items/Weapons/Perforators/SausageMaker.cs | 70 +- Items/Weapons/Perforators/VeinBurster.cs | 66 +- Items/Weapons/Phangasm.cs | 82 +- Items/Weapons/PhantasmalFury.cs | 66 +- Items/Weapons/PhoenixBlade.cs | 110 +- Items/Weapons/Photoviscerator.cs | 82 +- Items/Weapons/PlagueKeeper.cs | 13 +- Items/Weapons/Plaguebringer/Malevolence.cs | 72 +- .../Weapons/Plaguebringer/MepheticSprayer.cs | 46 +- .../Weapons/Plaguebringer/PestilentDefiler.cs | 4 +- Items/Weapons/Plaguebringer/PlagueStaff.cs | 126 +- Items/Weapons/Plaguebringer/TheHive.cs | 83 +- Items/Weapons/Plaguebringer/VirulentKatana.cs | 4 +- Items/Weapons/PlanetaryAnnihilation.cs | 212 +- Items/Weapons/PlasmaRifle.cs | 162 +- Items/Weapons/PlasmaRod.cs | 50 +- Items/Weapons/Polterghast/BansheeHook.cs | 6 +- Items/Weapons/Polterghast/DaemonsFlame.cs | 62 +- .../Weapons/Polterghast/EtherealSubjugator.cs | 6 +- Items/Weapons/Polterghast/FatesReveal.cs | 72 +- Items/Weapons/Polterghast/GhastlyVisage.cs | 58 +- Items/Weapons/Polterghast/TerrorBlade.cs | 62 +- Items/Weapons/PrimordialAncient.cs | 72 +- Items/Weapons/PrimordialEarth.cs | 70 +- Items/Weapons/ProfanedSword.cs | 92 +- Items/Weapons/ProporsePistol.cs | 58 +- .../Weapons/Providence/BlissfulBombardier.cs | 4 +- Items/Weapons/Providence/HolyCollider.cs | 44 +- Items/Weapons/Providence/PurgeGuzzler.cs | 48 +- Items/Weapons/Providence/SolarFlare.cs | 4 +- Items/Weapons/Providence/TelluricGlare.cs | 8 +- Items/Weapons/Pumpler.cs | 154 +- Items/Weapons/Purge.cs | 80 +- Items/Weapons/PurityAxe.cs | 146 +- Items/Weapons/PwnagehammerMelee.cs | 4 +- Items/Weapons/Quagmire.cs | 60 +- Items/Weapons/RaidersGlory.cs | 66 +- Items/Weapons/RareVariants/Arbalest.cs | 84 +- Items/Weapons/RareVariants/Carnage.cs | 144 +- Items/Weapons/RareVariants/ClothiersWrath.cs | 77 +- Items/Weapons/RareVariants/Cryophobia.cs | 62 +- Items/Weapons/RareVariants/EvilSmasher.cs | 80 +- Items/Weapons/RareVariants/EyeofMagnus.cs | 64 +- Items/Weapons/RareVariants/GrandDad.cs | 70 +- Items/Weapons/RareVariants/Hellborn.cs | 90 +- Items/Weapons/RareVariants/Infinity.cs | 88 +- Items/Weapons/RareVariants/LeadWizard.cs | 96 +- Items/Weapons/RareVariants/Norfleet.cs | 26 +- Items/Weapons/RareVariants/PearlGod.cs | 78 +- Items/Weapons/RareVariants/Skullmasher.cs | 18 +- Items/Weapons/RareVariants/Swordsplosion.cs | 192 +- Items/Weapons/RareVariants/ThornBlossom.cs | 84 +- Items/Weapons/RareVariants/Thunderstorm.cs | 62 +- .../RareVariants/TrueConferenceCall.cs | 176 +- Items/Weapons/RareVariants/VoidVortex.cs | 134 +- Items/Weapons/Ravager/Hematemesis.cs | 58 +- Items/Weapons/Ravager/RealmRavager.cs | 76 +- Items/Weapons/Ravager/SpikecragStaff.cs | 54 +- Items/Weapons/Ravager/UltimusCleaver.cs | 184 +- Items/Weapons/RedSun.cs | 8 +- Items/Weapons/RedtideSword.cs | 22 +- Items/Weapons/RelicofRuin.cs | 6 +- Items/Weapons/RoyalKnivesMelee.cs | 10 +- Items/Weapons/RubberMortarRound.cs | 64 +- Items/Weapons/SDFMG.cs | 126 +- Items/Weapons/SHPC.cs | 150 +- Items/Weapons/SanguineFlare.cs | 88 +- Items/Weapons/Scorpion.cs | 134 +- Items/Weapons/ScourgeoftheCosmos.cs | 46 +- Items/Weapons/Seabow.cs | 82 +- Items/Weapons/Seadragon.cs | 90 +- Items/Weapons/ShadowboltStaff.cs | 4 +- Items/Weapons/Shredder.cs | 132 +- Items/Weapons/Shroomer.cs | 4 +- Items/Weapons/SkyGlaze.cs | 2 +- Items/Weapons/SlagMagnum.cs | 8 +- Items/Weapons/SlimeGod/CorroslimeStaff.cs | 48 +- .../Weapons/SlimeGod/CorruptedCrusherBlade.cs | 22 +- Items/Weapons/SlimeGod/CrimslimeStaff.cs | 48 +- Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs | 22 +- Items/Weapons/SlimeGod/GeliticBlade.cs | 4 +- Items/Weapons/SlimeGod/Goobow.cs | 117 +- Items/Weapons/SlimeGod/GunkShot.cs | 82 +- Items/Weapons/SlimeGod/OverloadedBlaster.cs | 76 +- Items/Weapons/SlimeGod/TheGodsGambit.cs | 4 +- Items/Weapons/SolsticeClaymore.cs | 4 +- Items/Weapons/SomaPrime.cs | 118 +- Items/Weapons/SoulHarvester.cs | 142 +- Items/Weapons/SoulPiercer.cs | 42 +- Items/Weapons/SparkSpreader.cs | 86 +- Items/Weapons/SpatialLance.cs | 6 +- Items/Weapons/SpectralstormCannon.cs | 105 +- Items/Weapons/SpectreRifle.cs | 19 +- Items/Weapons/SporeKnife.cs | 5 +- Items/Weapons/Spyker.cs | 86 +- Items/Weapons/StarCannonEX.cs | 96 +- Items/Weapons/StardustStaff.cs | 4 +- Items/Weapons/Starfleet.cs | 78 +- Items/Weapons/StarfleetMK2.cs | 36 +- Items/Weapons/StarnightLance.cs | 4 +- Items/Weapons/StellarContemptMelee.cs | 13 +- Items/Weapons/StellarStriker.cs | 191 +- Items/Weapons/StormDragoon.cs | 8 +- Items/Weapons/StormRuler.cs | 4 +- Items/Weapons/StormSaber.cs | 4 +- Items/Weapons/StormSurge.cs | 68 +- Items/Weapons/StreamGouge.cs | 40 +- Items/Weapons/SubsumingVortex.cs | 112 +- Items/Weapons/SunkenSea/AquamarineStaff.cs | 106 +- Items/Weapons/SunkenSea/AquashardShotgun.cs | 100 +- Items/Weapons/SunkenSea/ClamCrusher.cs | 52 +- Items/Weapons/SunkenSea/ClamorRifle.cs | 68 +- Items/Weapons/SunkenSea/EutrophicScimitar.cs | 48 +- Items/Weapons/SunkenSea/EutrophicShank.cs | 88 +- Items/Weapons/SunkenSea/Poseidon.cs | 52 +- Items/Weapons/SunkenSea/SeashineSword.cs | 66 +- Items/Weapons/SunkenSea/Serpentine.cs | 158 +- Items/Weapons/SunkenSea/ShellfishStaff.cs | 54 +- Items/Weapons/SunkenSea/Whirlpool.cs | 70 +- Items/Weapons/SuperballBullet.cs | 62 +- Items/Weapons/Svantechnical.cs | 10 +- Items/Weapons/T1000.cs | 80 +- Items/Weapons/TemporalFloeSword.cs | 2 +- Items/Weapons/TerraArrow.cs | 62 +- Items/Weapons/TerraBullet.cs | 62 +- Items/Weapons/TerraEdge.cs | 2 +- Items/Weapons/TerraFlameburster.cs | 80 +- Items/Weapons/TerraLance.cs | 4 +- Items/Weapons/TerraRay.cs | 4 +- Items/Weapons/TerraShiv.cs | 12 +- Items/Weapons/Terracotta.cs | 89 +- Items/Weapons/Terratomere.cs | 14 +- Items/Weapons/TheBallista.cs | 82 +- Items/Weapons/TheEmpyrean.cs | 76 +- Items/Weapons/TheEnforcer.cs | 40 +- Items/Weapons/TheMutilator.cs | 4 +- Items/Weapons/TheStorm.cs | 12 +- Items/Weapons/TheSwarmer.cs | 13 +- Items/Weapons/TheWand.cs | 82 +- Items/Weapons/TitaniumRailgun.cs | 4 +- Items/Weapons/TomeofFates.cs | 2 +- ...tisTruePaladinianMageHammerofMightMelee.cs | 8 +- Items/Weapons/Trinity.cs | 24 +- Items/Weapons/Triploon.cs | 4 +- Items/Weapons/TrueArkoftheAncients.cs | 263 +- Items/Weapons/TrueBloodyEdge.cs | 2 +- Items/Weapons/TrueCausticEdge.cs | 6 +- Items/Weapons/TrueExcaliburShortsword.cs | 12 +- Items/Weapons/TrueForbiddenOathblade.cs | 106 +- Items/Weapons/TrueNightsStabber.cs | 12 +- Items/Weapons/TruePaladinsHammerMelee.cs | 4 +- Items/Weapons/TrueTyrantYharimsUltisword.cs | 139 +- Items/Weapons/TyrantYharimsUltisword.cs | 124 +- Items/Weapons/UltraLiquidator.cs | 134 +- Items/Weapons/UrchinSpear.cs | 4 +- Items/Weapons/VanquisherArrow.cs | 90 +- Items/Weapons/VenusianTrident.cs | 6 +- Items/Weapons/Verdant.cs | 4 +- Items/Weapons/VeriumBullet.cs | 62 +- Items/Weapons/Vesuvius.cs | 228 +- Items/Weapons/Viscera.cs | 6 +- Items/Weapons/VividClarity.cs | 190 +- Items/Weapons/Vortexpopper.cs | 6 +- Items/Weapons/Waraxe.cs | 20 +- Items/Weapons/Warblade.cs | 20 +- Items/Weapons/WindBlade.cs | 22 +- Items/Weapons/Wingman.cs | 4 +- Items/Weapons/WrathoftheAncients.cs | 6 +- Items/Weapons/WulfrumStaff.cs | 66 +- Items/Weapons/YharimsCrystal.cs | 126 +- Items/Weapons/Yharon/AngryChickenStaff.cs | 52 +- Items/Weapons/Yharon/ChickenCannon.cs | 4 +- Items/Weapons/Yharon/DragonRage.cs | 26 +- Items/Weapons/Yharon/DragonsBreath.cs | 16 +- Items/Weapons/Yharon/PhoenixFlameBarrage.cs | 8 +- Items/Weapons/Yharon/TheBurningSky.cs | 10 +- Items/Weapons/YinYo.cs | 2 +- Items/Yharon/ChickenEgg.cs | 78 +- Items/Yharon/YharimsGift.cs | 12 +- Items/Yharon/YharonBag.cs | 84 +- Localization/CalamityLocalization.cs | 220 +- MiscImplementation/BezierCurve.cs | 11 +- MiscImplementation/Circle.cs | 5 +- MiscModSupport/ModCalls.cs | 1043 +- MiscModSupport/WeakReferenceSupport.cs | 111 +- NPCs/AbyssNPCs/AquaticParasite.cs | 404 +- NPCs/AbyssNPCs/AquaticScourgeBody.cs | 365 +- NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs | 111 +- NPCs/AbyssNPCs/AquaticScourgeHead.cs | 1172 +- NPCs/AbyssNPCs/AquaticScourgeTail.cs | 133 +- NPCs/AbyssNPCs/AquaticSeekerBody.cs | 131 +- NPCs/AbyssNPCs/AquaticSeekerHead.cs | 715 +- NPCs/AbyssNPCs/AquaticSeekerTail.cs | 145 +- NPCs/AbyssNPCs/AquaticUrchin.cs | 643 +- NPCs/AbyssNPCs/Bloatfish.cs | 418 +- NPCs/AbyssNPCs/BobbitWormHead.cs | 505 +- NPCs/AbyssNPCs/BobbitWormSegment.cs | 105 +- NPCs/AbyssNPCs/BoxJellyfish.cs | 395 +- NPCs/AbyssNPCs/Catfish.cs | 508 +- NPCs/AbyssNPCs/ChaoticPuffer.cs | 423 +- NPCs/AbyssNPCs/ColossalSquid.cs | 1143 +- NPCs/AbyssNPCs/Cuttlefish.cs | 641 +- NPCs/AbyssNPCs/DevilFish.cs | 667 +- NPCs/AbyssNPCs/EidolonWyrmBody.cs | 55 +- NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs | 55 +- NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs | 55 +- NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs | 55 +- NPCs/AbyssNPCs/EidolonWyrmHead.cs | 1075 +- NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs | 1037 +- NPCs/AbyssNPCs/EidolonWyrmTail.cs | 75 +- NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs | 75 +- NPCs/AbyssNPCs/Flounder.cs | 577 +- NPCs/AbyssNPCs/Frogfish.cs | 510 +- NPCs/AbyssNPCs/GiantSquid.cs | 529 +- NPCs/AbyssNPCs/Gnasher.cs | 70 +- NPCs/AbyssNPCs/GulperEelBody.cs | 67 +- NPCs/AbyssNPCs/GulperEelBodyAlt.cs | 67 +- NPCs/AbyssNPCs/GulperEelHead.cs | 651 +- NPCs/AbyssNPCs/GulperEelTail.cs | 81 +- NPCs/AbyssNPCs/Laserfish.cs | 591 +- NPCs/AbyssNPCs/LuminousCorvina.cs | 593 +- NPCs/AbyssNPCs/MantisShrimp.cs | 72 +- NPCs/AbyssNPCs/Mauler.cs | 761 +- NPCs/AbyssNPCs/MirageJelly.cs | 470 +- NPCs/AbyssNPCs/MorayEel.cs | 525 +- NPCs/AbyssNPCs/OarfishBody.cs | 69 +- NPCs/AbyssNPCs/OarfishHead.cs | 743 +- NPCs/AbyssNPCs/OarfishTail.cs | 83 +- NPCs/AbyssNPCs/Reaper.cs | 1375 +- NPCs/AbyssNPCs/SeaUrchin.cs | 645 +- NPCs/AbyssNPCs/ToxicMinnow.cs | 541 +- NPCs/AbyssNPCs/Trasher.cs | 729 +- NPCs/AbyssNPCs/Viperfish.cs | 579 +- NPCs/Astrageldon/Astrageldon.cs | 650 +- NPCs/Astrageldon/AstrageldonSlime.cs | 502 +- NPCs/AstralBiomeNPCs/Aries.cs | 44 +- NPCs/AstralBiomeNPCs/AstralProbe.cs | 557 +- NPCs/AstralBiomeNPCs/AstralSlime.cs | 47 +- NPCs/AstralBiomeNPCs/AstralachneaGround.cs | 39 +- NPCs/AstralBiomeNPCs/AstralachneaWall.cs | 37 +- NPCs/AstralBiomeNPCs/Atlas.cs | 61 +- NPCs/AstralBiomeNPCs/BigSightseer.cs | 58 +- NPCs/AstralBiomeNPCs/FusionFeeder.cs | 38 +- NPCs/AstralBiomeNPCs/Hadarian.cs | 48 +- NPCs/AstralBiomeNPCs/Hive.cs | 253 +- NPCs/AstralBiomeNPCs/Hiveling.cs | 213 +- NPCs/AstralBiomeNPCs/Mantis.cs | 42 +- NPCs/AstralBiomeNPCs/Nova.cs | 40 +- NPCs/AstralBiomeNPCs/SmallSightseer.cs | 40 +- NPCs/AstralBiomeNPCs/StellarCulex.cs | 38 +- NPCs/AstralBiomeNPCs/Twinkler.cs | 161 +- NPCs/AstrumDeus/AstrumDeusBody.cs | 476 +- NPCs/AstrumDeus/AstrumDeusBodySpectral.cs | 721 +- NPCs/AstrumDeus/AstrumDeusHead.cs | 1232 +- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 1046 +- NPCs/AstrumDeus/AstrumDeusProbe.cs | 250 +- NPCs/AstrumDeus/AstrumDeusProbe2.cs | 252 +- NPCs/AstrumDeus/AstrumDeusProbe3.cs | 588 +- NPCs/AstrumDeus/AstrumDeusTail.cs | 366 +- NPCs/AstrumDeus/AstrumDeusTailSpectral.cs | 587 +- NPCs/BrimstoneWaifu/Brimling.cs | 522 +- NPCs/BrimstoneWaifu/BrimstoneElemental.cs | 1138 +- NPCs/Bumblefuck/Bumblefuck.cs | 1234 +- NPCs/Bumblefuck/Bumblefuck2.cs | 148 +- NPCs/Calamitas/CalScreenShaderData.cs | 68 +- NPCs/Calamitas/CalSky.cs | 164 +- NPCs/Calamitas/Calamitas.cs | 776 +- NPCs/Calamitas/CalamitasRun.cs | 978 +- NPCs/Calamitas/CalamitasRun2.cs | 960 +- NPCs/Calamitas/CalamitasRun3.cs | 1124 +- NPCs/Calamitas/LifeSeeker.cs | 101 +- NPCs/Calamitas/SoulSeeker.cs | 292 +- NPCs/CalamityAI.cs | 851 +- NPCs/CalamityBiomeNPCs/CultistAssassin.cs | 140 +- NPCs/CalamityBiomeNPCs/DespairStone.cs | 717 +- NPCs/CalamityBiomeNPCs/Scryllar.cs | 550 +- NPCs/CalamityBiomeNPCs/ScryllarRage.cs | 550 +- NPCs/CalamityBiomeNPCs/SoulSlurper.cs | 519 +- NPCs/CalamityGlobalAI.cs | 27491 ++++++++-------- NPCs/CalamityGlobalNPC.cs | 682 +- NPCs/CalamityGlobalNPCLoot.cs | 2100 +- NPCs/CeaselessVoid/CeaselessVoid.cs | 694 +- NPCs/CeaselessVoid/DarkEnergy.cs | 292 +- NPCs/CeaselessVoid/DarkEnergy2.cs | 228 +- NPCs/CeaselessVoid/DarkEnergy3.cs | 278 +- NPCs/CosmicWraith/CosmicLantern.cs | 136 +- NPCs/CosmicWraith/CosmicWraith.cs | 1482 +- NPCs/CosmicWraith/SignusBomb.cs | 175 +- NPCs/Crabulon/CrabShroom.cs | 131 +- NPCs/Crabulon/CrabulonIdle.cs | 1042 +- NPCs/Cryogen/Cryocore.cs | 166 +- NPCs/Cryogen/Cryocore2.cs | 166 +- NPCs/Cryogen/Cryogen.cs | 1885 +- NPCs/Cryogen/CryogenIce.cs | 160 +- NPCs/Cryogen/IceMass.cs | 85 +- NPCs/DesertScourge/DesertScourgeBody.cs | 226 +- NPCs/DesertScourge/DesertScourgeBodySmall.cs | 158 +- NPCs/DesertScourge/DesertScourgeHead.cs | 890 +- NPCs/DesertScourge/DesertScourgeHeadSmall.cs | 774 +- NPCs/DesertScourge/DesertScourgeTail.cs | 194 +- NPCs/DesertScourge/DesertScourgeTailSmall.cs | 152 +- NPCs/DesertScourge/DriedSeekerBody.cs | 104 +- NPCs/DesertScourge/DriedSeekerHead.cs | 129 +- NPCs/DesertScourge/DriedSeekerTail.cs | 104 +- NPCs/GreatSandShark/GreatSandShark.cs | 1334 +- NPCs/HiveMind/DankCreeper.cs | 194 +- NPCs/HiveMind/DarkHeart.cs | 226 +- NPCs/HiveMind/HiveBlob.cs | 408 +- NPCs/HiveMind/HiveBlob2.cs | 386 +- NPCs/HiveMind/HiveCyst.cs | 122 +- NPCs/HiveMind/HiveMind.cs | 526 +- NPCs/HiveMind/HiveMindP2.cs | 1295 +- NPCs/Leviathan/AquaticAberration.cs | 392 +- NPCs/Leviathan/LevScreenShaderData.cs | 68 +- NPCs/Leviathan/LevSky.cs | 164 +- NPCs/Leviathan/Leviathan.cs | 1232 +- NPCs/Leviathan/LeviathanStart.cs | 146 +- NPCs/Leviathan/Parasea.cs | 136 +- NPCs/Leviathan/Siren.cs | 1646 +- NPCs/Leviathan/SirenClone.cs | 164 +- NPCs/Leviathan/SirenIce.cs | 94 +- NPCs/NormalNPCs/AeroSlime.cs | 112 +- NPCs/NormalNPCs/AngryDog.cs | 159 +- NPCs/NormalNPCs/ArmoredDiggerBody.cs | 295 +- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 814 +- NPCs/NormalNPCs/ArmoredDiggerTail.cs | 241 +- NPCs/NormalNPCs/BlightedEye.cs | 116 +- NPCs/NormalNPCs/BloomSlime.cs | 112 +- NPCs/NormalNPCs/Bohldohr.cs | 656 +- NPCs/NormalNPCs/CalamityEye.cs | 128 +- NPCs/NormalNPCs/CharredSlime.cs | 109 +- NPCs/NormalNPCs/Cnidrion.cs | 565 +- NPCs/NormalNPCs/CosmicElemental.cs | 148 +- NPCs/NormalNPCs/CrawlerAmber.cs | 505 +- NPCs/NormalNPCs/CrawlerAmethyst.cs | 505 +- NPCs/NormalNPCs/CrawlerCrystal.cs | 513 +- NPCs/NormalNPCs/CrawlerDiamond.cs | 505 +- NPCs/NormalNPCs/CrawlerEmerald.cs | 505 +- NPCs/NormalNPCs/CrawlerRuby.cs | 505 +- NPCs/NormalNPCs/CrawlerSapphire.cs | 505 +- NPCs/NormalNPCs/CrawlerTopaz.cs | 505 +- NPCs/NormalNPCs/CrimulanBlightSlime.cs | 132 +- NPCs/NormalNPCs/CryoSlime.cs | 112 +- NPCs/NormalNPCs/Cryon.cs | 69 +- NPCs/NormalNPCs/EbonianBlightSlime.cs | 124 +- NPCs/NormalNPCs/Eidolist.cs | 639 +- NPCs/NormalNPCs/FearlessGoldfishWarrior.cs | 828 +- NPCs/NormalNPCs/HeatSpirit.cs | 163 +- NPCs/NormalNPCs/Horse.cs | 451 +- NPCs/NormalNPCs/IceClasper.cs | 97 +- NPCs/NormalNPCs/ImpiousImmolator.cs | 542 +- NPCs/NormalNPCs/IrradiatedSlime.cs | 160 +- NPCs/NormalNPCs/KingSlimeJewel.cs | 238 +- NPCs/NormalNPCs/OverloadedSoldier.cs | 58 +- NPCs/NormalNPCs/PerennialSlime.cs | 112 +- NPCs/NormalNPCs/PhantomDebris.cs | 56 +- NPCs/NormalNPCs/PhantomSpirit.cs | 164 +- NPCs/NormalNPCs/PhantomSpiritL.cs | 158 +- NPCs/NormalNPCs/PhantomSpiritM.cs | 160 +- NPCs/NormalNPCs/PhantomSpiritS.cs | 160 +- NPCs/NormalNPCs/Piggy.cs | 174 +- NPCs/NormalNPCs/Pitbull.cs | 104 +- NPCs/NormalNPCs/PlagueBee.cs | 140 +- NPCs/NormalNPCs/PlagueBeeLarge.cs | 140 +- NPCs/NormalNPCs/PlaguedDerpling.cs | 107 +- NPCs/NormalNPCs/PlaguedFlyingFox.cs | 84 +- NPCs/NormalNPCs/PlaguedJungleSlime.cs | 197 +- NPCs/NormalNPCs/PlaguedTortoise.cs | 90 +- NPCs/NormalNPCs/ProfanedEnergyBody.cs | 141 +- NPCs/NormalNPCs/ProfanedEnergyLantern.cs | 354 +- NPCs/NormalNPCs/SandTortoise.cs | 112 +- NPCs/NormalNPCs/ScornEater.cs | 343 +- NPCs/NormalNPCs/ShockstormShuttle.cs | 1126 +- NPCs/NormalNPCs/StormlionCharger.cs | 116 +- NPCs/NormalNPCs/SunBat.cs | 118 +- NPCs/NormalNPCs/Sunskater.cs | 87 +- NPCs/NormalNPCs/SuperDummy.cs | 70 +- NPCs/NormalNPCs/ThiccWaifu.cs | 512 +- NPCs/NormalNPCs/WulfrumDrone.cs | 120 +- NPCs/NormalNPCs/WulfrumSlime.cs | 118 +- NPCs/Perforator/PerforatorBodyLarge.cs | 214 +- NPCs/Perforator/PerforatorBodyMedium.cs | 204 +- NPCs/Perforator/PerforatorBodySmall.cs | 204 +- NPCs/Perforator/PerforatorCyst.cs | 122 +- NPCs/Perforator/PerforatorHeadLarge.cs | 820 +- NPCs/Perforator/PerforatorHeadMedium.cs | 814 +- NPCs/Perforator/PerforatorHeadSmall.cs | 810 +- NPCs/Perforator/PerforatorHive.cs | 622 +- NPCs/Perforator/PerforatorTailLarge.cs | 152 +- NPCs/Perforator/PerforatorTailMedium.cs | 152 +- NPCs/Perforator/PerforatorTailSmall.cs | 154 +- .../PbGScreenShaderData.cs | 68 +- NPCs/PlaguebringerGoliath/PbGSky.cs | 164 +- NPCs/PlaguebringerGoliath/PlagueBeeG.cs | 426 +- NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs | 196 +- .../PlagueHomingMissile.cs | 120 +- NPCs/PlaguebringerGoliath/PlagueMine.cs | 184 +- .../PlaguebringerGoliath.cs | 2032 +- NPCs/PlaguebringerShade/PlaguebringerShade.cs | 1230 +- NPCs/Polterghast/PhantomFuckYou.cs | 178 +- NPCs/Polterghast/PolterPhantom.cs | 522 +- NPCs/Polterghast/Polterghast.cs | 1321 +- NPCs/Polterghast/PolterghastHook.cs | 681 +- .../ProfanedGuardianBoss.cs | 800 +- .../ProfanedGuardianBoss2.cs | 430 +- .../ProfanedGuardianBoss3.cs | 436 +- NPCs/Providence/ProvScreenShaderData.cs | 68 +- NPCs/Providence/ProvSky.cs | 162 +- NPCs/Providence/ProvSpawnDefense.cs | 192 +- NPCs/Providence/ProvSpawnHealer.cs | 308 +- NPCs/Providence/ProvSpawnOffense.cs | 546 +- NPCs/Providence/Providence.cs | 2286 +- NPCs/Scavenger/FlamePillar.cs | 114 +- NPCs/Scavenger/RockPillar.cs | 106 +- NPCs/Scavenger/ScavengerBody.cs | 1038 +- NPCs/Scavenger/ScavengerClawLeft.cs | 624 +- NPCs/Scavenger/ScavengerClawRight.cs | 624 +- NPCs/Scavenger/ScavengerHead.cs | 282 +- NPCs/Scavenger/ScavengerHead2.cs | 468 +- NPCs/Scavenger/ScavengerLegLeft.cs | 262 +- NPCs/Scavenger/ScavengerLegRight.cs | 262 +- NPCs/SlimeGod/SlimeGod.cs | 396 +- NPCs/SlimeGod/SlimeGodCore.cs | 632 +- NPCs/SlimeGod/SlimeGodRun.cs | 284 +- NPCs/SlimeGod/SlimeGodRunSplit.cs | 338 +- NPCs/SlimeGod/SlimeGodSplit.cs | 404 +- NPCs/SlimeGod/SlimeSpawnCorrupt.cs | 92 +- NPCs/SlimeGod/SlimeSpawnCorrupt2.cs | 97 +- NPCs/SlimeGod/SlimeSpawnCrimson.cs | 117 +- NPCs/SlimeGod/SlimeSpawnCrimson2.cs | 226 +- NPCs/StormWeaver/StasisProbe.cs | 508 +- NPCs/StormWeaver/StasisProbeNaked.cs | 512 +- NPCs/StormWeaver/StormWeaverBody.cs | 463 +- NPCs/StormWeaver/StormWeaverBodyNaked.cs | 587 +- NPCs/StormWeaver/StormWeaverHead.cs | 1126 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 1170 +- NPCs/StormWeaver/StormWeaverTail.cs | 407 +- NPCs/StormWeaver/StormWeaverTailNaked.cs | 559 +- NPCs/SunkenSeaNPCs/BlindedAngler.cs | 531 +- NPCs/SunkenSeaNPCs/Clam.cs | 414 +- NPCs/SunkenSeaNPCs/EutrophicRay.cs | 393 +- NPCs/SunkenSeaNPCs/GhostBell.cs | 283 +- NPCs/SunkenSeaNPCs/GhostBellSmall.cs | 237 +- NPCs/SunkenSeaNPCs/GiantClam.cs | 763 +- NPCs/SunkenSeaNPCs/PrismTurtle.cs | 539 +- NPCs/SunkenSeaNPCs/SeaFloaty.cs | 270 +- NPCs/SunkenSeaNPCs/SeaMinnow.cs | 66 +- NPCs/SunkenSeaNPCs/SeaSerpent1.cs | 713 +- NPCs/SunkenSeaNPCs/SeaSerpent2.cs | 305 +- NPCs/SunkenSeaNPCs/SeaSerpent3.cs | 301 +- NPCs/SunkenSeaNPCs/SeaSerpent4.cs | 301 +- NPCs/SunkenSeaNPCs/SeaSerpent5.cs | 301 +- NPCs/SupremeCalamitas/SCalScreenShaderData.cs | 68 +- NPCs/SupremeCalamitas/SCalSky.cs | 164 +- NPCs/SupremeCalamitas/SCalWormBody.cs | 200 +- NPCs/SupremeCalamitas/SCalWormBodyWeak.cs | 110 +- NPCs/SupremeCalamitas/SCalWormHead.cs | 764 +- NPCs/SupremeCalamitas/SCalWormHeart.cs | 64 +- NPCs/SupremeCalamitas/SCalWormTail.cs | 170 +- NPCs/SupremeCalamitas/SoulSeekerSupreme.cs | 260 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 4299 +-- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 468 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 488 +- NPCs/TheDevourerofGods/DevourerofGodsBody.cs | 505 +- NPCs/TheDevourerofGods/DevourerofGodsBody2.cs | 212 +- NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs | 477 +- NPCs/TheDevourerofGods/DevourerofGodsHead.cs | 1572 +- NPCs/TheDevourerofGods/DevourerofGodsHead2.cs | 920 +- NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs | 1949 +- NPCs/TheDevourerofGods/DevourerofGodsTail.cs | 441 +- NPCs/TheDevourerofGods/DevourerofGodsTail2.cs | 196 +- NPCs/TheDevourerofGods/DevourerofGodsTailS.cs | 567 +- .../TheDevourerofGods/DoGSCreenShaderDataS.cs | 68 +- NPCs/TheDevourerofGods/DoGScreenShaderData.cs | 68 +- NPCs/TheDevourerofGods/DoGSky.cs | 188 +- NPCs/TheDevourerofGods/DoGSkyS.cs | 188 +- NPCs/TownNPCs/Bandit.cs | 47 +- NPCs/TownNPCs/DILF.cs | 315 +- NPCs/TownNPCs/FAP.cs | 103 +- NPCs/TownNPCs/SEAHOE.cs | 529 +- NPCs/Yharon/DetonatingFlare.cs | 422 +- NPCs/Yharon/DetonatingFlare2.cs | 152 +- NPCs/Yharon/YScreenShader.cs | 68 +- NPCs/Yharon/YSky.cs | 164 +- NPCs/Yharon/Yharon.cs | 5711 ++-- Projectiles/Amidias/AmidiasTridentProj.cs | 114 +- Projectiles/Amidias/AmidiasWhirlpool.cs | 286 +- Projectiles/Amidias/BigCoral.cs | 48 +- Projectiles/Amidias/HermitCrab.cs | 640 +- Projectiles/Amidias/SandDollarProj.cs | 60 +- Projectiles/Amidias/Shell.cs | 72 +- Projectiles/Amidias/SmallCoral.cs | 72 +- Projectiles/Amidias/SnapClamProj.cs | 394 +- Projectiles/Amidias/UrchinBall.cs | 286 +- Projectiles/Amidias/UrchinBallSpike.cs | 346 +- Projectiles/Amidias/WaywasherProj.cs | 124 +- Projectiles/Astral/AstralCannonProjectile.cs | 184 +- Projectiles/Astral/AstralScytheProjectile.cs | 118 +- Projectiles/Astral/AstralachneaFang.cs | 176 +- Projectiles/Astral/HeavenfallenEnergy.cs | 80 +- Projectiles/Astral/HeavenfallenStardisk.cs | 328 +- Projectiles/Astral/Hive.cs | 224 +- Projectiles/Astral/Hiveling.cs | 120 +- Projectiles/Astral/Quasar.cs | 196 +- Projectiles/Astral/Quasar2.cs | 152 +- Projectiles/Astral/RadiantExplosion.cs | 106 +- Projectiles/Astral/RadiantStar.cs | 204 +- Projectiles/Astral/RadiantStar2.cs | 230 +- Projectiles/Astral/StellarKnife.cs | 182 +- Projectiles/Boss/AbyssBallVolley.cs | 24 +- Projectiles/Boss/AbyssBallVolley2.cs | 22 +- Projectiles/Boss/AbyssMine.cs | 78 +- Projectiles/Boss/AbyssMine2.cs | 76 +- Projectiles/Boss/AstralFlame.cs | 226 +- Projectiles/Boss/AstralLaser.cs | 162 +- Projectiles/Boss/AstralShot2.cs | 88 +- Projectiles/Boss/BigFlare.cs | 294 +- Projectiles/Boss/BigFlare2.cs | 292 +- Projectiles/Boss/BloodClot.cs | 56 +- Projectiles/Boss/BloodGeyser.cs | 19 +- Projectiles/Boss/BrimstoneBall.cs | 30 +- Projectiles/Boss/BrimstoneBarrage.cs | 112 +- Projectiles/Boss/BrimstoneFire.cs | 152 +- Projectiles/Boss/BrimstoneFireblast.cs | 218 +- Projectiles/Boss/BrimstoneGigaBlast.cs | 220 +- Projectiles/Boss/BrimstoneHellblast.cs | 156 +- Projectiles/Boss/BrimstoneHellblast2.cs | 130 +- Projectiles/Boss/BrimstoneHellfireball.cs | 88 +- Projectiles/Boss/BrimstoneLaser.cs | 118 +- Projectiles/Boss/BrimstoneLaserSplit.cs | 106 +- Projectiles/Boss/BrimstoneMonster.cs | 271 +- Projectiles/Boss/BrimstoneWave.cs | 144 +- Projectiles/Boss/CosmicFlameBurst.cs | 122 +- Projectiles/Boss/DarkEnergyBall.cs | 112 +- Projectiles/Boss/DestroyerHomingLaser.cs | 144 +- Projectiles/Boss/DeusMine.cs | 186 +- Projectiles/Boss/DoGBeam.cs | 140 +- Projectiles/Boss/DoGBeamPortal.cs | 268 +- Projectiles/Boss/DoGDeath.cs | 82 +- Projectiles/Boss/DoGFire.cs | 218 +- Projectiles/Boss/DoGNebulaShot.cs | 196 +- Projectiles/Boss/EssenceDust.cs | 110 +- Projectiles/Boss/Flare.cs | 322 +- Projectiles/Boss/FlareBomb.cs | 314 +- Projectiles/Boss/FlareDust.cs | 222 +- Projectiles/Boss/FlareDust2.cs | 248 +- Projectiles/Boss/Flarenado.cs | 270 +- Projectiles/Boss/FrostMist.cs | 260 +- Projectiles/Boss/GreatSandBlast.cs | 154 +- Projectiles/Boss/HealOrbProv.cs | 100 +- Projectiles/Boss/HellfireExplosion.cs | 190 +- Projectiles/Boss/HiveBombGoliath.cs | 286 +- Projectiles/Boss/HolyBlast.cs | 220 +- Projectiles/Boss/HolyBomb.cs | 208 +- Projectiles/Boss/HolyBurnOrb.cs | 196 +- Projectiles/Boss/HolyFire.cs | 200 +- Projectiles/Boss/HolyFire2.cs | 180 +- Projectiles/Boss/HolyFlare.cs | 200 +- Projectiles/Boss/HolyLight.cs | 168 +- Projectiles/Boss/HolyShot.cs | 154 +- Projectiles/Boss/HolySpear.cs | 178 +- Projectiles/Boss/IceBlast.cs | 138 +- Projectiles/Boss/IceBomb.cs | 96 +- Projectiles/Boss/IceRain.cs | 140 +- Projectiles/Boss/IchorShot.cs | 86 +- Projectiles/Boss/Infernado.cs | 272 +- Projectiles/Boss/Infernado2.cs | 262 +- Projectiles/Boss/InfernadoRevenge.cs | 268 +- Projectiles/Boss/LeviathanBomb.cs | 154 +- Projectiles/Boss/MoltenBlast.cs | 250 +- Projectiles/Boss/MoltenBlob.cs | 178 +- Projectiles/Boss/MushBomb.cs | 130 +- Projectiles/Boss/MushBombFall.cs | 132 +- Projectiles/Boss/Mushmash.cs | 28 +- Projectiles/Boss/PhantomBlast.cs | 234 +- Projectiles/Boss/PhantomBlast2.cs | 234 +- Projectiles/Boss/PhantomGhostShot.cs | 124 +- Projectiles/Boss/PhantomHookShot.cs | 124 +- Projectiles/Boss/PhantomMine.cs | 116 +- Projectiles/Boss/PhantomShot.cs | 162 +- Projectiles/Boss/PhantomShot2.cs | 162 +- Projectiles/Boss/PlagueExplosion.cs | 164 +- Projectiles/Boss/PlagueStingerGoliath.cs | 118 +- Projectiles/Boss/PlagueStingerGoliathV2.cs | 104 +- Projectiles/Boss/ProfanedSpear.cs | 164 +- Projectiles/Boss/ProvidenceCrystal.cs | 236 +- Projectiles/Boss/ProvidenceCrystalShard.cs | 372 +- Projectiles/Boss/ProvidenceHolyRay.cs | 360 +- Projectiles/Boss/RavagerFlame.cs | 72 +- Projectiles/Boss/RedLightningFeather.cs | 192 +- Projectiles/Boss/SandBlast.cs | 152 +- Projectiles/Boss/SandPoisonCloud.cs | 134 +- Projectiles/Boss/SandTooth.cs | 92 +- Projectiles/Boss/ScavengerLaser.cs | 372 +- Projectiles/Boss/ScavengerNuke.cs | 300 +- Projectiles/Boss/ShadeNimbusHostile.cs | 100 +- Projectiles/Boss/ShaderainHostile.cs | 76 +- Projectiles/Boss/Shadowflame.cs | 148 +- Projectiles/Boss/Shadowflamethrower.cs | 128 +- Projectiles/Boss/SignusScythe.cs | 260 +- Projectiles/Boss/SirenSong.cs | 122 +- Projectiles/Boss/SkyFlare.cs | 222 +- Projectiles/Boss/SkyFlareRevenge.cs | 124 +- Projectiles/Boss/SporeGasPlantera.cs | 146 +- Projectiles/Boss/VileClot.cs | 56 +- Projectiles/Boss/WaterSpear.cs | 182 +- Projectiles/Boss/YharonFireball.cs | 192 +- Projectiles/Boss/YharonFireball2.cs | 220 +- Projectiles/CalamityGlobalProjectile.cs | 2814 +- Projectiles/Enemy/AstralShot.cs | 132 +- Projectiles/Enemy/CrimsonSpike.cs | 56 +- Projectiles/Enemy/EarthRockBig.cs | 8 +- Projectiles/Enemy/EarthRockSmall.cs | 8 +- Projectiles/Enemy/FlameBurstHostile.cs | 88 +- Projectiles/Enemy/HorsWaterBlast.cs | 98 +- Projectiles/Enemy/InkBomb.cs | 38 +- Projectiles/Enemy/InkPoisonCloud.cs | 54 +- Projectiles/Enemy/InkPoisonCloud2.cs | 54 +- Projectiles/Enemy/InkPoisonCloud3.cs | 54 +- Projectiles/Enemy/LavaChunk.cs | 6 +- Projectiles/Enemy/MantisRing.cs | 133 +- Projectiles/Enemy/PufferExplosion.cs | 138 +- Projectiles/Enemy/StormMarkHostile.cs | 260 +- Projectiles/Enemy/SulphuricAcidCannon.cs | 6 +- Projectiles/Enemy/SulphuricAcidMist.cs | 38 +- Projectiles/Enemy/TornadoHostile.cs | 278 +- Projectiles/Enemy/ToxicMinnowCloud.cs | 88 +- Projectiles/Healing/AtaxiaHealOrb.cs | 90 +- Projectiles/Healing/AuricOrb.cs | 116 +- Projectiles/Healing/BurntSienna.cs | 80 +- Projectiles/Healing/CactusHealOrb.cs | 12 +- Projectiles/Healing/EarthHealOrb.cs | 90 +- Projectiles/Healing/EssenceFlame.cs | 140 +- Projectiles/Healing/Exoheal.cs | 90 +- Projectiles/Healing/FungalHeal.cs | 45 +- Projectiles/Healing/GodSlayerHealOrb.cs | 90 +- Projectiles/Healing/PhoenixHeal.cs | 82 +- Projectiles/Healing/RainHeal.cs | 12 +- Projectiles/Healing/RoyalHeal.cs | 112 +- Projectiles/Healing/SilvaOrb.cs | 116 +- Projectiles/Healing/Terracotta.cs | 102 +- Projectiles/Healing/TransfusionTrail.cs | 112 +- Projectiles/Healing/XerocHealOrb.cs | 90 +- Projectiles/Magic/AbyssBall.cs | 110 +- Projectiles/Magic/AetherBeam.cs | 80 +- Projectiles/Magic/Ancient.cs | 188 +- Projectiles/Magic/Ancient2.cs | 146 +- Projectiles/Magic/ApothChloro.cs | 68 +- Projectiles/Magic/ApothJaws.cs | 134 +- Projectiles/Magic/ApothMark.cs | 110 +- Projectiles/Magic/Asteroid.cs | 222 +- Projectiles/Magic/AsteroidMolten.cs | 326 +- Projectiles/Magic/AstralCrystal.cs | 210 +- .../Magic/AstralCrystalInvisibleExplosion.cs | 17 +- Projectiles/Magic/AstralStarMagic.cs | 234 +- Projectiles/Magic/AtlantisSpear.cs | 120 +- Projectiles/Magic/AtlantisSpear2.cs | 90 +- Projectiles/Magic/AuraRain.cs | 26 +- Projectiles/Magic/BeamingBolt.cs | 108 +- Projectiles/Magic/BeamingBolt2.cs | 142 +- Projectiles/Magic/BigBeamofDeath.cs | 50 +- Projectiles/Magic/BigBeamofDeath2.cs | 40 +- Projectiles/Magic/BlackAnurian.cs | 8 +- Projectiles/Magic/BlackAnurianPlankton.cs | 10 +- Projectiles/Magic/BloodBeam.cs | 94 +- Projectiles/Magic/BloodBlast.cs | 68 +- Projectiles/Magic/BloodBolt.cs | 38 +- Projectiles/Magic/BloodOrb.cs | 120 +- Projectiles/Magic/BloodRay.cs | 50 +- Projectiles/Magic/BlueBubble.cs | 158 +- Projectiles/Magic/BrimstoneBeam.cs | 72 +- Projectiles/Magic/BrimstoneBeam2.cs | 72 +- Projectiles/Magic/BrimstoneBeam3.cs | 72 +- Projectiles/Magic/BrimstoneBeam4.cs | 72 +- Projectiles/Magic/BrimstoneBeam5.cs | 60 +- Projectiles/Magic/BrimstoneFireball.cs | 76 +- .../Magic/BrimstoneHellfireballFriendly.cs | 92 +- .../Magic/BrimstoneHellfireballFriendly2.cs | 46 +- Projectiles/Magic/BrimstoneHomer.cs | 108 +- Projectiles/Magic/BrimstoneTentacle.cs | 146 +- Projectiles/Magic/Climax.cs | 194 +- Projectiles/Magic/Climax2.cs | 240 +- Projectiles/Magic/ClimaxBeam.cs | 38 +- Projectiles/Magic/CoralSpike.cs | 14 +- Projectiles/Magic/CosmicTentacle.cs | 144 +- Projectiles/Magic/CryoBlast.cs | 66 +- Projectiles/Magic/DemonicPitchfork.cs | 50 +- Projectiles/Magic/DustProjectile.cs | 152 +- Projectiles/Magic/EidolicWail.cs | 148 +- Projectiles/Magic/EldritchTentacle.cs | 170 +- Projectiles/Magic/ElementBolt.cs | 50 +- Projectiles/Magic/ElementBolt2.cs | 38 +- Projectiles/Magic/ElementOrb.cs | 126 +- Projectiles/Magic/ElementOrb2.cs | 126 +- Projectiles/Magic/ElementRay.cs | 66 +- Projectiles/Magic/ElementTentacle.cs | 146 +- Projectiles/Magic/EvergladeSprayProjectile.cs | 128 +- Projectiles/Magic/FabBolt.cs | 38 +- Projectiles/Magic/FabOrb.cs | 126 +- Projectiles/Magic/FabRay.cs | 54 +- Projectiles/Magic/FatesReveal.cs | 322 +- Projectiles/Magic/FlameBeamTip.cs | 144 +- Projectiles/Magic/FlameBeamTip2.cs | 122 +- Projectiles/Magic/FlamePillar.cs | 116 +- Projectiles/Magic/FlamingPumpkin.cs | 46 +- Projectiles/Magic/FlareBoltProjectile.cs | 82 +- Projectiles/Magic/ForbiddenAxeBlade.cs | 178 +- Projectiles/Magic/ForbiddenSunProjectile.cs | 52 +- Projectiles/Magic/ForbiddenSunburst.cs | 179 +- .../Magic/FrigidflashBoltProjectile.cs | 130 +- Projectiles/Magic/FrostBoltProjectile.cs | 82 +- Projectiles/Magic/GammaLaser.cs | 70 +- Projectiles/Magic/GhastlyBlast.cs | 624 +- Projectiles/Magic/GhastlyExplosion.cs | 124 +- Projectiles/Magic/GhastlyExplosionShard.cs | 110 +- Projectiles/Magic/GhastlySubBlast.cs | 174 +- Projectiles/Magic/GhastlyVisage.cs | 232 +- Projectiles/Magic/GleamingBolt.cs | 130 +- Projectiles/Magic/GleamingBolt2.cs | 100 +- Projectiles/Magic/GraniteEnergy.cs | 92 +- Projectiles/Magic/GranitePulse.cs | 236 +- Projectiles/Magic/HeliumFlashBlast.cs | 13 +- .../Magic/HellfireExplosionFriendly.cs | 180 +- .../Magic/HellfireExplosionFriendly2.cs | 138 +- Projectiles/Magic/HolyFlame.cs | 94 +- Projectiles/Magic/HolyLaser.cs | 26 +- Projectiles/Magic/IceCluster.cs | 184 +- Projectiles/Magic/IceSpike.cs | 18 +- Projectiles/Magic/InfernadoFriendly.cs | 190 +- Projectiles/Magic/InfernadoMarkFriendly.cs | 226 +- Projectiles/Magic/InfernalBlade.cs | 182 +- Projectiles/Magic/InfernalBlade2.cs | 154 +- Projectiles/Magic/IonBlast.cs | 164 +- Projectiles/Magic/LiquidBlade.cs | 190 +- Projectiles/Magic/LiquidBlade2.cs | 160 +- Projectiles/Magic/MagicNebulaShot.cs | 72 +- Projectiles/Magic/MagnaBlast.cs | 52 +- Projectiles/Magic/MagneticBeam.cs | 38 +- Projectiles/Magic/MagneticOrb.cs | 194 +- Projectiles/Magic/MagnusBeam.cs | 496 +- Projectiles/Magic/ManaBolt.cs | 44 +- Projectiles/Magic/ManaBoltSmall.cs | 16 +- Projectiles/Magic/ManaBoltSmall2.cs | 16 +- Projectiles/Magic/NightBolt.cs | 38 +- Projectiles/Magic/NightOrb.cs | 126 +- Projectiles/Magic/NightRay.cs | 50 +- Projectiles/Magic/NuclearFuryProjectile.cs | 94 +- Projectiles/Magic/ParticleBeamofDoom.cs | 40 +- Projectiles/Magic/PhantasmalFury.cs | 86 +- Projectiles/Magic/Phantom.cs | 94 +- Projectiles/Magic/PlagueFang.cs | 138 +- Projectiles/Magic/PlasmaBolt.cs | 38 +- Projectiles/Magic/PlasmaRay.cs | 170 +- Projectiles/Magic/PlasmaRay2.cs | 56 +- Projectiles/Magic/PlasmaShot.cs | 60 +- Projectiles/Magic/Purge.cs | 214 +- Projectiles/Magic/PurgeLaser.cs | 132 +- Projectiles/Magic/RougeSlashLarge.cs | 144 +- Projectiles/Magic/RougeSlashMedium.cs | 144 +- Projectiles/Magic/RougeSlashSmall.cs | 144 +- Projectiles/Magic/SHPB.cs | 154 +- Projectiles/Magic/SHPExplosion.cs | 160 +- Projectiles/Magic/SHPL.cs | 160 +- Projectiles/Magic/SanguineFlare.cs | 176 +- .../SeethingDischargeBrimstoneBarrage.cs | 96 +- .../SeethingDischargeBrimstoneHellblast.cs | 140 +- Projectiles/Magic/ShadeNimbus.cs | 134 +- Projectiles/Magic/ShadeNimbusCloud.cs | 78 +- Projectiles/Magic/ShadecrystalProjectile.cs | 68 +- Projectiles/Magic/Shaderain.cs | 22 +- Projectiles/Magic/Shadowbolt.cs | 52 +- Projectiles/Magic/ShiftingSands.cs | 300 +- Projectiles/Magic/SirensSong.cs | 138 +- Projectiles/Magic/Snowflake.cs | 94 +- Projectiles/Magic/SolarBeam2.cs | 50 +- Projectiles/Magic/SoulPiercer.cs | 112 +- Projectiles/Magic/SoulPiercerBolt.cs | 62 +- Projectiles/Magic/SpiritFlameCurse.cs | 104 +- Projectiles/Magic/Starblast.cs | 136 +- Projectiles/Magic/StickyFeather.cs | 118 +- .../Magic/SupremeDustFlakProjectile.cs | 146 +- Projectiles/Magic/SupremeDustProjectile.cs | 142 +- Projectiles/Magic/T1000.cs | 214 +- Projectiles/Magic/T1000Laser.cs | 132 +- Projectiles/Magic/TearsofHeavenProjectile.cs | 126 +- Projectiles/Magic/TerraBolt.cs | 58 +- Projectiles/Magic/TerraBolt2.cs | 46 +- Projectiles/Magic/TerraOrb.cs | 136 +- Projectiles/Magic/TerraOrb2.cs | 136 +- Projectiles/Magic/TerraRay.cs | 58 +- Projectiles/Magic/ThunderstormShot.cs | 134 +- Projectiles/Magic/ThunderstormShotSplit.cs | 110 +- Projectiles/Magic/TradewindsProjectile.cs | 114 +- Projectiles/Magic/UberBubble.cs | 88 +- Projectiles/Magic/UndinesRetribution.cs | 272 +- Projectiles/Magic/Vehemence.cs | 136 +- Projectiles/Magic/VenusianBolt.cs | 96 +- Projectiles/Magic/VenusianExplosion.cs | 142 +- Projectiles/Magic/VenusianFlame.cs | 154 +- Projectiles/Magic/Viscera.cs | 60 +- Projectiles/Magic/VividBolt.cs | 134 +- Projectiles/Magic/VividClarity.cs | 200 +- Projectiles/Magic/VividOrb.cs | 166 +- Projectiles/Magic/VolatileStarcore.cs | 10 +- Projectiles/Magic/Vortex.cs | 324 +- Projectiles/Magic/WaterStream.cs | 94 +- Projectiles/Magic/WaterStream2.cs | 76 +- Projectiles/Magic/WhiteFlame.cs | 58 +- Projectiles/Magic/WhiteFlame2.cs | 110 +- Projectiles/Magic/WintersFury.cs | 38 +- Projectiles/Magic/WulfrumBolt.cs | 42 +- Projectiles/Magic/YharimsCrystal.cs | 372 +- Projectiles/Magic/YharimsCrystalBeam.cs | 476 +- Projectiles/Melee/AccretionDisk2Melee.cs | 86 +- Projectiles/Melee/AccretionDiskMelee.cs | 218 +- Projectiles/Melee/AegisBeam.cs | 170 +- Projectiles/Melee/AegisBlast.cs | 138 +- Projectiles/Melee/AegisBlast2.cs | 128 +- Projectiles/Melee/AegisFlame.cs | 130 +- Projectiles/Melee/Aftershock.cs | 8 +- .../Melee/BalefulHarvesterProjectile.cs | 264 +- Projectiles/Melee/BallOFugu.cs | 14 +- Projectiles/Melee/BansheeHookBoom.cs | 108 +- Projectiles/Melee/BansheeHookScythe.cs | 26 +- Projectiles/Melee/BiomeOrb.cs | 250 +- Projectiles/Melee/BlazingPhantomBlade.cs | 166 +- Projectiles/Melee/Blood.cs | 108 +- Projectiles/Melee/Blood2.cs | 126 +- Projectiles/Melee/BloodBall.cs | 235 +- Projectiles/Melee/BloodScythe.cs | 32 +- Projectiles/Melee/BloodyBlade.cs | 86 +- Projectiles/Melee/BlueAura.cs | 8 +- Projectiles/Melee/Brimblast.cs | 128 +- .../Melee/BrimlanceHellfireExplosion.cs | 140 +- Projectiles/Melee/BrimlanceStandingFire.cs | 136 +- Projectiles/Melee/Brimlash.cs | 80 +- Projectiles/Melee/Brimlash2.cs | 106 +- Projectiles/Melee/BrimstoneBoom.cs | 126 +- Projectiles/Melee/BrimstoneLaserFriendly.cs | 102 +- Projectiles/Melee/BrinySpout.cs | 188 +- Projectiles/Melee/BrinyTyphoonBubble.cs | 144 +- Projectiles/Melee/BurningMeteor.cs | 206 +- Projectiles/Melee/CalamityAura.cs | 144 +- Projectiles/Melee/CalamityAuraType2.cs | 146 +- Projectiles/Melee/CalamityAuraType3.cs | 146 +- Projectiles/Melee/ChaosFlameLarge.cs | 48 +- Projectiles/Melee/ChaosFlameMedium.cs | 48 +- Projectiles/Melee/ChaosFlameSmall.cs | 48 +- Projectiles/Melee/CosmicBolt.cs | 44 +- Projectiles/Melee/CosmicDischarge.cs | 386 +- Projectiles/Melee/CosmicIceBurst.cs | 168 +- Projectiles/Melee/CosmicOrb.cs | 204 +- Projectiles/Melee/CosmicSpiritBomb1.cs | 54 +- Projectiles/Melee/CosmicSpiritBomb2.cs | 54 +- Projectiles/Melee/CosmicSpiritBomb3.cs | 54 +- Projectiles/Melee/CrystalDust.cs | 162 +- Projectiles/Melee/Cyclone.cs | 156 +- Projectiles/Melee/DNA.cs | 123 +- Projectiles/Melee/DNA2.cs | 157 +- Projectiles/Melee/Dark.cs | 88 +- Projectiles/Melee/DarkBall.cs | 237 +- Projectiles/Melee/DemonBlast.cs | 194 +- Projectiles/Melee/DemonBlastType2.cs | 200 +- Projectiles/Melee/DemonBlastType3.cs | 200 +- Projectiles/Melee/DepthOrb.cs | 136 +- Projectiles/Melee/DepthOrb2.cs | 204 +- Projectiles/Melee/DracoBeam.cs | 116 +- Projectiles/Melee/DracoBeam2.cs | 126 +- Projectiles/Melee/DragonRage.cs | 224 +- Projectiles/Melee/Earth.cs | 226 +- Projectiles/Melee/Earth2.cs | 126 +- Projectiles/Melee/Earth3.cs | 242 +- Projectiles/Melee/Earth4.cs | 150 +- Projectiles/Melee/ElementBall.cs | 92 +- Projectiles/Melee/ElementBallShiv.cs | 134 +- Projectiles/Melee/ElementalExcaliburBeam.cs | 808 +- Projectiles/Melee/EonBeam.cs | 30 +- Projectiles/Melee/EonBeamV2.cs | 20 +- Projectiles/Melee/EonBeamV3.cs | 20 +- Projectiles/Melee/EonBeamV4.cs | 20 +- .../Melee/EradicatorMeleeProjectile.cs | 154 +- Projectiles/Melee/EssenceBeam.cs | 76 +- Projectiles/Melee/EssenceFireball.cs | 178 +- Projectiles/Melee/EssenceFlame2.cs | 154 +- Projectiles/Melee/EssenceScythe.cs | 202 +- Projectiles/Melee/Excelsus.cs | 142 +- Projectiles/Melee/ExcelsusBlue.cs | 140 +- Projectiles/Melee/ExcelsusPink.cs | 140 +- Projectiles/Melee/Exobeam.cs | 344 +- Projectiles/Melee/Exoboom.cs | 158 +- Projectiles/Melee/Exocomet.cs | 224 +- Projectiles/Melee/Feather.cs | 62 +- .../Melee/FlameScytheProjectileMelee.cs | 28 +- Projectiles/Melee/Flarefrost.cs | 187 +- Projectiles/Melee/FossilSpike.cs | 32 +- Projectiles/Melee/GalacticaComet.cs | 140 +- Projectiles/Melee/Galaxia.cs | 500 +- Projectiles/Melee/Galaxia2.cs | 498 +- Projectiles/Melee/GalaxyBlast.cs | 192 +- Projectiles/Melee/GalaxyBlastType2.cs | 192 +- Projectiles/Melee/GalaxyBlastType3.cs | 192 +- Projectiles/Melee/GelWave.cs | 60 +- Projectiles/Melee/GhastlySoulLarge.cs | 114 +- Projectiles/Melee/GhastlySoulMedium.cs | 50 +- Projectiles/Melee/GhastlySoulSmall.cs | 50 +- Projectiles/Melee/GreenBall.cs | 52 +- Projectiles/Melee/GreenDust.cs | 138 +- Projectiles/Melee/GreenWater.cs | 86 +- Projectiles/Melee/HellionSpike.cs | 156 +- Projectiles/Melee/HolyColliderHolyFire.cs | 86 +- Projectiles/Melee/HyperBlade.cs | 166 +- Projectiles/Melee/IceBombFriendly.cs | 54 +- Projectiles/Melee/Iceberg.cs | 102 +- Projectiles/Melee/Icebreaker.cs | 26 +- Projectiles/Melee/Judgement.cs | 152 +- Projectiles/Melee/JudgementBlah.cs | 152 +- Projectiles/Melee/LaserFountain.cs | 34 +- Projectiles/Melee/Leech.cs | 114 +- Projectiles/Melee/LifeScythe.cs | 104 +- Projectiles/Melee/Light.cs | 90 +- .../Melee/MangroveChakramProjectileMelee.cs | 16 +- Projectiles/Melee/MarianaProjectile.cs | 108 +- Projectiles/Melee/MarniteObliterator.cs | 36 +- Projectiles/Melee/MirrorBlast.cs | 94 +- Projectiles/Melee/Mourningstar.cs | 352 +- Projectiles/Melee/Murasama.cs | 144 +- Projectiles/Melee/Nebudust.cs | 122 +- Projectiles/Melee/Nebulash.cs | 372 +- Projectiles/Melee/NeptuneOrb.cs | 148 +- Projectiles/Melee/NightStabber.cs | 106 +- Projectiles/Melee/OPHammerMelee.cs | 232 +- Projectiles/Melee/Oathblade.cs | 82 +- Projectiles/Melee/OceanBeam.cs | 78 +- Projectiles/Melee/OmegaBiomeOrb.cs | 410 +- Projectiles/Melee/PlagueBeeDust.cs | 162 +- Projectiles/Melee/PlagueDust.cs | 108 +- Projectiles/Melee/PlagueSeeker.cs | 100 +- Projectiles/Melee/PlasmaBall.cs | 160 +- Projectiles/Melee/ProfanedSword.cs | 100 +- Projectiles/Melee/PwnagehammerMelee.cs | 26 +- Projectiles/Melee/RainBolt.cs | 104 +- Projectiles/Melee/RainbowBoom.cs | 126 +- Projectiles/Melee/Razorwind.cs | 132 +- Projectiles/Melee/RedBall.cs | 52 +- Projectiles/Melee/RedDust.cs | 138 +- Projectiles/Melee/RoyalKnifeMelee.cs | 218 +- Projectiles/Melee/SHIV.cs | 88 +- Projectiles/Melee/SandBlade.cs | 96 +- Projectiles/Melee/SandFire.cs | 104 +- Projectiles/Melee/ScourgeoftheCosmos.cs | 326 +- Projectiles/Melee/ScourgeoftheCosmosMini.cs | 32 +- .../Melee/SeashellBoomerangProjectileMelee.cs | 11 +- Projectiles/Melee/ShortBeam.cs | 16 +- Projectiles/Melee/ShortNightBeam.cs | 16 +- Projectiles/Melee/ShortTerraBeam.cs | 56 +- Projectiles/Melee/SolarFlare.cs | 228 +- Projectiles/Melee/SolsticeBeam.cs | 366 +- Projectiles/Melee/SoulScythe.cs | 138 +- Projectiles/Melee/Spark.cs | 126 +- Projectiles/Melee/SpatialSpear.cs | 180 +- Projectiles/Melee/SpatialSpear2.cs | 162 +- Projectiles/Melee/SpatialSpear3.cs | 184 +- Projectiles/Melee/SpatialSpear4.cs | 128 +- Projectiles/Melee/Spears/AstralPike.cs | 208 +- Projectiles/Melee/Spears/BansheeHook.cs | 242 +- Projectiles/Melee/Spears/Brimlance.cs | 174 +- Projectiles/Melee/Spears/DiseasedPike.cs | 146 +- Projectiles/Melee/Spears/EarthenPike.cs | 162 +- .../Spears/ExsanguinationLanceProjectile.cs | 216 +- .../Melee/Spears/FulgurationHalberd.cs | 114 +- Projectiles/Melee/Spears/GildedProboscis.cs | 149 +- .../Melee/Spears/GoldplumeSpearProjectile.cs | 132 +- .../Melee/Spears/HeartRapierProjectile.cs | 114 +- .../Spears/HellionFlowerSpearProjectile.cs | 200 +- .../Melee/Spears/MarniteSpearProjectile.cs | 92 +- Projectiles/Melee/Spears/SausageMaker.cs | 134 +- .../Melee/Spears/SpatialLanceProjectile.cs | 148 +- .../Melee/Spears/StarnightLanceProjectile.cs | 134 +- Projectiles/Melee/Spears/StreamGouge.cs | 152 +- .../Melee/Spears/TerraLanceProjectile.cs | 132 +- .../Melee/Spears/UrchinSpearProjectile.cs | 124 +- Projectiles/Melee/StarCrystal.cs | 26 +- Projectiles/Melee/StarnightBeam.cs | 100 +- Projectiles/Melee/StormBeam.cs | 68 +- Projectiles/Melee/StormMark.cs | 252 +- Projectiles/Melee/StormRuler.cs | 114 +- Projectiles/Melee/SunlightBlade.cs | 94 +- .../Melee/TemporalFloeSwordProjectile.cs | 22 +- Projectiles/Melee/TerraBall.cs | 86 +- Projectiles/Melee/TerraEdgeBeam.cs | 10 +- Projectiles/Melee/TerraSpear.cs | 110 +- Projectiles/Melee/TerracottaExplosion.cs | 128 +- Projectiles/Melee/TerratomereProjectile.cs | 174 +- Projectiles/Melee/TerrorBeam.cs | 202 +- Projectiles/Melee/TerrorBoom.cs | 48 +- Projectiles/Melee/TinyCrystal.cs | 10 +- Projectiles/Melee/TinyFlare.cs | 134 +- Projectiles/Melee/Tornado.cs | 322 +- Projectiles/Melee/TriactisOPHammerMelee.cs | 266 +- Projectiles/Melee/TrueBiomeOrb.cs | 272 +- .../Melee/TrueCausticEdgeProjectile.cs | 152 +- Projectiles/Melee/Tumbleweed.cs | 16 +- Projectiles/Melee/TumbleweedRolling.cs | 8 +- Projectiles/Melee/TyphonsGreed.cs | 144 +- Projectiles/Melee/TyphonsGreedStaff.cs | 14 +- Projectiles/Melee/UltimusCleaverDust.cs | 200 +- Projectiles/Melee/UrchinSpikeFugu.cs | 16 +- Projectiles/Melee/Whirlpool.cs | 120 +- Projectiles/Melee/WhiteBoltAura.cs | 110 +- Projectiles/Melee/WhiteBoltAuraBlah.cs | 110 +- Projectiles/Melee/WhiteOrb.cs | 24 +- Projectiles/Melee/WhiteOrbBlah.cs | 24 +- Projectiles/Melee/Whiterain.cs | 104 +- Projectiles/Melee/WhiterainBlah.cs | 104 +- .../Melee/Yoyos/AirSpinnerProjectile.cs | 154 +- Projectiles/Melee/Yoyos/AortaProjectile.cs | 24 +- Projectiles/Melee/Yoyos/AzathothProjectile.cs | 38 +- Projectiles/Melee/Yoyos/ChaotrixProjectile.cs | 40 +- .../Melee/Yoyos/CnidarianProjectile.cs | 130 +- .../Melee/Yoyos/LaceratorProjectile.cs | 52 +- Projectiles/Melee/Yoyos/QuagmireProjectile.cs | 116 +- .../Melee/Yoyos/ShimmersparkProjectile.cs | 172 +- Projectiles/Melee/Yoyos/SolarFlareYoyo.cs | 82 +- .../Yoyos/TheEyeofCalamitasProjectile.cs | 156 +- .../Melee/Yoyos/TheGodsGambitProjectile.cs | 162 +- Projectiles/Melee/Yoyos/TheObliterator.cs | 162 +- Projectiles/Melee/Yoyos/ThePlaguebringer.cs | 156 +- Projectiles/Melee/Yoyos/VerdantProjectile.cs | 168 +- Projectiles/Melee/Yoyos/YinYo.cs | 170 +- Projectiles/Patreon/Akato.cs | 10 +- Projectiles/Patreon/AngelicBeam.cs | 6 +- Projectiles/Patreon/AtaraxiaHoming.cs | 4 +- Projectiles/Patreon/AtaraxiaMain.cs | 20 +- Projectiles/Patreon/AtaraxiaSide.cs | 12 +- Projectiles/Patreon/AtaraxiaSplit.cs | 8 +- Projectiles/Patreon/CorpusAvertor.cs | 154 +- Projectiles/Patreon/CorpusAvertorClone.cs | 210 +- Projectiles/Patreon/DarkSpark.cs | 426 +- Projectiles/Patreon/DarkSparkBeam.cs | 574 +- Projectiles/Patreon/DeepSeaDumbbell1.cs | 180 +- Projectiles/Patreon/DeepSeaDumbbell2.cs | 256 +- Projectiles/Patreon/DeepSeaDumbbell3.cs | 236 +- Projectiles/Patreon/DeepSeaDumbbellWeight.cs | 106 +- Projectiles/Patreon/DevilsSunrise.cs | 154 +- Projectiles/Patreon/DevilsSunriseCyclone.cs | 380 +- Projectiles/Patreon/DivineRetribution.cs | 256 +- Projectiles/Patreon/DraconicSpark.cs | 18 +- Projectiles/Patreon/DragonPowFlail.cs | 10 +- Projectiles/Patreon/HandheldTankShell.cs | 274 +- Projectiles/Patreon/IlluminatedBullet.cs | 3 +- Projectiles/Patreon/KarasawaShot.cs | 274 +- Projectiles/Patreon/KeelhaulBubble.cs | 12 +- Projectiles/Patreon/KeelhaulGeyserBottom.cs | 38 +- Projectiles/Patreon/KeelhaulGeyserTop.cs | 36 +- Projectiles/Patreon/KelvinCatalyst.cs | 270 +- Projectiles/Patreon/KelvinCatalystStar.cs | 206 +- Projectiles/Patreon/LightBall.cs | 72 +- Projectiles/Patreon/LightBallExplosion.cs | 12 +- Projectiles/Patreon/LightBead.cs | 160 +- Projectiles/Patreon/LightBeadSplit.cs | 16 +- .../Patreon/MadAlchemistsCocktailAlt.cs | 203 +- .../Patreon/MadAlchemistsCocktailBlue.cs | 97 +- .../Patreon/MadAlchemistsCocktailGasCloud.cs | 139 +- .../Patreon/MadAlchemistsCocktailGreen.cs | 111 +- .../Patreon/MadAlchemistsCocktailPurple.cs | 95 +- .../Patreon/MadAlchemistsCocktailRed.cs | 207 +- .../Patreon/MadAlchemistsCocktailShrapnel.cs | 154 +- Projectiles/Patreon/MelterAmp.cs | 212 +- Projectiles/Patreon/MelterNote1.cs | 54 +- Projectiles/Patreon/MelterNote2.cs | 54 +- Projectiles/Patreon/MiniGuardianAttack.cs | 22 +- Projectiles/Patreon/MiniGuardianDefense.cs | 22 +- Projectiles/Patreon/MiniGuardianHealer.cs | 18 +- Projectiles/Patreon/MourningSkull.cs | 296 +- Projectiles/Patreon/NadirSpear.cs | 187 +- Projectiles/Patreon/OracleYoyo.cs | 382 +- Projectiles/Patreon/PerforaMini.cs | 319 +- Projectiles/Patreon/PinkButterfly.cs | 496 +- Projectiles/Patreon/PlagueBee.cs | 278 +- Projectiles/Patreon/Plaguenade.cs | 274 +- Projectiles/Patreon/PurpleButterfly.cs | 452 +- Projectiles/Patreon/Rox1.cs | 117 +- Projectiles/Patreon/RoxShockwave.cs | 35 +- Projectiles/Patreon/RoxSlam.cs | 120 +- Projectiles/Patreon/SakuraBullet.cs | 168 +- Projectiles/Patreon/ThePackMinissile.cs | 148 +- Projectiles/Patreon/ThePackMissile.cs | 240 +- Projectiles/Patreon/TimeBolt.cs | 534 +- Projectiles/Patreon/VoidEssence.cs | 340 +- Projectiles/Patreon/VoidTentacle.cs | 158 +- Projectiles/Patreon/YateveoBloom.cs | 390 +- Projectiles/Patreon/YateveoBloomSpear.cs | 149 +- Projectiles/Permafrost/ArcticBearPaw.cs | 44 +- Projectiles/Permafrost/DarkIce.cs | 54 +- Projectiles/Permafrost/DarkIceZero.cs | 78 +- Projectiles/Permafrost/FrostShardFriendly.cs | 32 +- Projectiles/Permafrost/FrostyFlare.cs | 30 +- Projectiles/Permafrost/IceSentry.cs | 56 +- Projectiles/Permafrost/Icicle.cs | 34 +- Projectiles/Permafrost/IcicleArrow.cs | 42 +- Projectiles/Permafrost/IcyBullet.cs | 36 +- Projectiles/Permafrost/Snowball.cs | 36 +- Projectiles/Permafrost/TridentIcicle.cs | 48 +- Projectiles/Pets/Bear.cs | 708 +- Projectiles/Pets/Brimling.cs | 32 +- Projectiles/Pets/ChibiiDoggo.cs | 400 +- Projectiles/Pets/ChibiiDoggoFly.cs | 187 +- Projectiles/Pets/DannyDevito.cs | 610 +- Projectiles/Pets/Fox.cs | 10 +- Projectiles/Pets/Kendra.cs | 732 +- Projectiles/Pets/Levi.cs | 10 +- Projectiles/Pets/SirenYoung.cs | 953 +- Projectiles/Pets/ThirdSage.cs | 316 +- Projectiles/Ranged/AMR.cs | 30 +- Projectiles/Ranged/AMR2.cs | 12 +- Projectiles/Ranged/AccelerationBullet.cs | 110 +- Projectiles/Ranged/AcidBullet.cs | 114 +- Projectiles/Ranged/AquaBlast.cs | 32 +- Projectiles/Ranged/AquaBlastToxic.cs | 40 +- Projectiles/Ranged/Archerfish.cs | 38 +- Projectiles/Ranged/ArcticArrow.cs | 68 +- Projectiles/Ranged/AstralRound.cs | 282 +- Projectiles/Ranged/AstrealArrow.cs | 148 +- Projectiles/Ranged/AstrealFlame.cs | 148 +- Projectiles/Ranged/BallistaGreatArrow.cs | 112 +- Projectiles/Ranged/BeeRPG.cs | 308 +- Projectiles/Ranged/BigNuke.cs | 264 +- Projectiles/Ranged/BloodClotFriendly.cs | 28 +- Projectiles/Ranged/BloodfireArrow.cs | 90 +- Projectiles/Ranged/BloodfireBullet.cs | 56 +- Projectiles/Ranged/BloodflareSoul.cs | 106 +- Projectiles/Ranged/BlueExoArrow.cs | 142 +- Projectiles/Ranged/BlueExoArrow2.cs | 118 +- Projectiles/Ranged/Bolt.cs | 38 +- Projectiles/Ranged/BoltArrow.cs | 68 +- Projectiles/Ranged/BrimstoneBallFriendly.cs | 38 +- Projectiles/Ranged/BrimstoneBolt.cs | 56 +- Projectiles/Ranged/BrimstoneFireFriendly.cs | 118 +- Projectiles/Ranged/Butcher.cs | 274 +- Projectiles/Ranged/ChargedBlast.cs | 136 +- Projectiles/Ranged/ChargedBlast2.cs | 128 +- Projectiles/Ranged/ChargedBlast3.cs | 382 +- Projectiles/Ranged/Chicken.cs | 168 +- Projectiles/Ranged/ChickenExplosion.cs | 138 +- Projectiles/Ranged/Contagion.cs | 230 +- Projectiles/Ranged/ContagionArrow.cs | 88 +- Projectiles/Ranged/ContagionBall.cs | 28 +- Projectiles/Ranged/CorossiveFlames.cs | 136 +- Projectiles/Ranged/CosmicFire.cs | 136 +- Projectiles/Ranged/DaemonsFlame.cs | 258 +- Projectiles/Ranged/DaemonsFlameArrow.cs | 102 +- Projectiles/Ranged/DragonBurst.cs | 70 +- Projectiles/Ranged/Drataliornus.cs | 18 +- Projectiles/Ranged/DrataliornusExoArrow.cs | 138 +- Projectiles/Ranged/DrataliornusFlame.cs | 18 +- Projectiles/Ranged/ElysianArrow.cs | 212 +- Projectiles/Ranged/EnhancedNanoRound.cs | 140 +- Projectiles/Ranged/EssenceFire.cs | 140 +- Projectiles/Ranged/ExoFire.cs | 80 +- Projectiles/Ranged/ExoMark.cs | 248 +- Projectiles/Ranged/ExoTornado.cs | 240 +- Projectiles/Ranged/ExplodingStake.cs | 56 +- Projectiles/Ranged/ExplosiveShellBullet.cs | 46 +- Projectiles/Ranged/FeatherLarge.cs | 86 +- Projectiles/Ranged/FishronRPG.cs | 254 +- Projectiles/Ranged/FlakKraken.cs | 256 +- Projectiles/Ranged/FlakKrakenGun.cs | 182 +- Projectiles/Ranged/FlamingStake.cs | 34 +- Projectiles/Ranged/FlareBat.cs | 112 +- Projectiles/Ranged/Flash.cs | 132 +- Projectiles/Ranged/FlashBullet.cs | 104 +- Projectiles/Ranged/FossilShard.cs | 22 +- Projectiles/Ranged/FrostsparkBullet.cs | 148 +- Projectiles/Ranged/FungiOrb.cs | 64 +- Projectiles/Ranged/FungiOrb2.cs | 32 +- Projectiles/Ranged/GoliathRocket.cs | 324 +- Projectiles/Ranged/GreenExoArrow.cs | 146 +- Projectiles/Ranged/HalleysComet.cs | 141 +- Projectiles/Ranged/HiveBomb.cs | 324 +- Projectiles/Ranged/HiveMissile.cs | 322 +- Projectiles/Ranged/HolyFireBullet.cs | 90 +- Projectiles/Ranged/HyperiusBullet.cs | 138 +- Projectiles/Ranged/LeafArrow.cs | 162 +- Projectiles/Ranged/LunarBolt.cs | 58 +- Projectiles/Ranged/LunarBolt2.cs | 58 +- Projectiles/Ranged/MagnaStrike.cs | 50 +- Projectiles/Ranged/MechanicalBarracuda.cs | 20 +- Projectiles/Ranged/MeowFire.cs | 162 +- Projectiles/Ranged/MeowFire2.cs | 162 +- Projectiles/Ranged/MiniRocket.cs | 280 +- Projectiles/Ranged/MistArrow.cs | 36 +- Projectiles/Ranged/MortarRound.cs | 390 +- Projectiles/Ranged/Nanomachine.cs | 258 +- Projectiles/Ranged/NapalmArrow.cs | 162 +- Projectiles/Ranged/NebulaShot.cs | 82 +- Projectiles/Ranged/Needler.cs | 84 +- Projectiles/Ranged/Norfleet.cs | 66 +- Projectiles/Ranged/NorfleetComet.cs | 230 +- Projectiles/Ranged/NorfleetExplosion.cs | 128 +- Projectiles/Ranged/Nuke.cs | 298 +- Projectiles/Ranged/NullShot.cs | 88 +- Projectiles/Ranged/NullShot2.cs | 86 +- Projectiles/Ranged/OMGWTH.cs | 108 +- Projectiles/Ranged/OnyxSharkBomb.cs | 160 +- Projectiles/Ranged/OpalStrike.cs | 50 +- Projectiles/Ranged/OrangeExoArrow.cs | 174 +- Projectiles/Ranged/Phangasm.cs | 214 +- Projectiles/Ranged/PlagueArrow.cs | 78 +- Projectiles/Ranged/PlagueExplosionFriendly.cs | 132 +- Projectiles/Ranged/PlasmaBlast.cs | 130 +- Projectiles/Ranged/PlasmaExplosion.cs | 140 +- Projectiles/Ranged/ProBolt.cs | 42 +- Projectiles/Ranged/RainbowBlast.cs | 114 +- Projectiles/Ranged/RealmRavagerBullet.cs | 36 +- Projectiles/Ranged/RubberMortarRound.cs | 690 +- Projectiles/Ranged/SandWater.cs | 106 +- Projectiles/Ranged/SandstormBullet.cs | 42 +- Projectiles/Ranged/SandyWaifuShark.cs | 114 +- Projectiles/Ranged/SeaDragonRocket.cs | 238 +- Projectiles/Ranged/ShadeFire.cs | 124 +- Projectiles/Ranged/Shockblast.cs | 130 +- Projectiles/Ranged/ShockblastRound.cs | 196 +- Projectiles/Ranged/Shroom.cs | 100 +- Projectiles/Ranged/Sickness.cs | 132 +- Projectiles/Ranged/SicknessRound.cs | 152 +- Projectiles/Ranged/SicknessRound2.cs | 140 +- Projectiles/Ranged/SlagRound.cs | 66 +- Projectiles/Ranged/SlashRound.cs | 52 +- Projectiles/Ranged/SlimeBolt.cs | 20 +- Projectiles/Ranged/SparkSpreaderFire.cs | 144 +- Projectiles/Ranged/SporeBomb.cs | 136 +- Projectiles/Ranged/Spyker.cs | 132 +- Projectiles/Ranged/StarfleetMK2.cs | 49 +- Projectiles/Ranged/StormSurge.cs | 64 +- Projectiles/Ranged/SulphuricAcidCannon2.cs | 46 +- Projectiles/Ranged/SulphuricAcidMist2.cs | 36 +- Projectiles/Ranged/SuperballBullet.cs | 88 +- Projectiles/Ranged/TealExoArrow.cs | 148 +- Projectiles/Ranged/TelluricGlare.cs | 78 +- Projectiles/Ranged/TerraArrow.cs | 82 +- Projectiles/Ranged/TerraArrow2.cs | 114 +- Projectiles/Ranged/TerraBallBow.cs | 236 +- Projectiles/Ranged/TerraBullet.cs | 140 +- Projectiles/Ranged/TerraBulletSplit.cs | 242 +- Projectiles/Ranged/TerraFireGreen.cs | 130 +- Projectiles/Ranged/TerraFireGreen2.cs | 130 +- Projectiles/Ranged/TitRail.cs | 36 +- Projectiles/Ranged/TorrentialArrow.cs | 120 +- Projectiles/Ranged/Triploon.cs | 150 +- Projectiles/Ranged/TyphoonArrow.cs | 20 +- Projectiles/Ranged/TyphoonBubble.cs | 182 +- Projectiles/Ranged/VanquisherArrow.cs | 63 +- Projectiles/Ranged/VeriumBullet.cs | 238 +- Projectiles/Ranged/Voidragon.cs | 122 +- Projectiles/Ranged/WaterSpout.cs | 224 +- Projectiles/Rogue/AbyssalMirrorProjectile.cs | 13 +- Projectiles/Rogue/AccretionDisk.cs | 182 +- Projectiles/Rogue/AccretionDisk2.cs | 40 +- .../Rogue/AdamantiteThrowingAxeProjectile.cs | 40 +- Projectiles/Rogue/BallisticPoisonBomb.cs | 167 +- Projectiles/Rogue/BallisticPoisonBombSpike.cs | 68 +- Projectiles/Rogue/BarrelShrapnel.cs | 8 +- Projectiles/Rogue/BlastBarrelProjectile.cs | 12 +- Projectiles/Rogue/BloodsoakedCrashax.cs | 96 +- Projectiles/Rogue/BlueFlamePillar.cs | 12 +- .../Rogue/BouncingEyeballProjectile.cs | 24 +- .../BouncingEyeballProjectileStealthStrike.cs | 29 +- Projectiles/Rogue/BrackishFlask.cs | 74 +- Projectiles/Rogue/BrackishWater.cs | 72 +- Projectiles/Rogue/BrackishWaterBlast.cs | 168 +- Projectiles/Rogue/Brick.cs | 5 +- Projectiles/Rogue/BrickFragment.cs | 5 +- Projectiles/Rogue/Brimblade.cs | 28 +- Projectiles/Rogue/Brimblade2.cs | 16 +- Projectiles/Rogue/ButcherKnife.cs | 174 +- Projectiles/Rogue/CarvingFork.cs | 77 +- .../Rogue/CelestialReaperProjectile.cs | 4 +- Projectiles/Rogue/Celestus.cs | 206 +- Projectiles/Rogue/Celestus2.cs | 50 +- Projectiles/Rogue/CinquedeaProj.cs | 8 +- Projectiles/Rogue/CobaltKunaiProjectile.cs | 36 +- .../Rogue/ConsecratedWaterProjectile.cs | 21 +- Projectiles/Rogue/CosmicKunai.cs | 96 +- Projectiles/Rogue/CraniumSmasher.cs | 50 +- Projectiles/Rogue/CraniumSmasherExplosive.cs | 154 +- Projectiles/Rogue/Crushax.cs | 92 +- Projectiles/Rogue/CrystalPiercerProjectile.cs | 106 +- Projectiles/Rogue/Crystalline.cs | 60 +- Projectiles/Rogue/Crystalline2.cs | 30 +- Projectiles/Rogue/CursedDagger.cs | 32 +- Projectiles/Rogue/DuststormCloud.cs | 4 +- Projectiles/Rogue/DuststormInABottle.cs | 18 +- Projectiles/Rogue/EclipseMirrorBurst.cs | 7 +- Projectiles/Rogue/EclipsesFallMain.cs | 80 +- Projectiles/Rogue/EclipsesSmol.cs | 135 +- Projectiles/Rogue/EclipsesStealth.cs | 123 +- Projectiles/Rogue/EmpyreanKnives.cs | 164 +- Projectiles/Rogue/EradicatorProjectile.cs | 158 +- Projectiles/Rogue/ExecutionersBlade.cs | 162 +- Projectiles/Rogue/FeatherKnifeProjectile.cs | 20 +- Projectiles/Rogue/FlameScytheProjectile.cs | 32 +- Projectiles/Rogue/Fork.cs | 79 +- Projectiles/Rogue/FossilShardThrown.cs | 20 +- Projectiles/Rogue/GacruxianHome.cs | 160 +- Projectiles/Rogue/GacruxianProj.cs | 126 +- Projectiles/Rogue/GelDartProjectile.cs | 42 +- Projectiles/Rogue/GhoulishGouger.cs | 186 +- Projectiles/Rogue/GlaiveProj.cs | 2 +- Projectiles/Rogue/IceStarProjectile.cs | 148 +- Projectiles/Rogue/IchorSpear.cs | 96 +- Projectiles/Rogue/IchorSpear2.cs | 166 +- Projectiles/Rogue/InkBombProjectile.cs | 8 +- Projectiles/Rogue/InkCloud.cs | 8 +- Projectiles/Rogue/InkCloud2.cs | 8 +- Projectiles/Rogue/InkCloud3.cs | 8 +- Projectiles/Rogue/Knife.cs | 75 +- Projectiles/Rogue/KylieBoomerang.cs | 2 +- Projectiles/Rogue/Lionfish.cs | 16 +- Projectiles/Rogue/Malachite.cs | 108 +- Projectiles/Rogue/MalachiteBolt.cs | 170 +- .../Rogue/MangroveChakramProjectile.cs | 20 +- Projectiles/Rogue/MeteorFist.cs | 274 +- Projectiles/Rogue/MoltenAmputator.cs | 66 +- Projectiles/Rogue/MoltenBlobThrown.cs | 92 +- Projectiles/Rogue/MonkeyDart.cs | 4 +- Projectiles/Rogue/MoonSigil.cs | 18 +- Projectiles/Rogue/Mycoroot.cs | 38 +- Projectiles/Rogue/MythrilKnifeProjectile.cs | 38 +- Projectiles/Rogue/OPHammer.cs | 232 +- .../OrichalcumSpikedGemstoneProjectile.cs | 46 +- .../Rogue/PalladiumJavelinProjectile.cs | 27 +- Projectiles/Rogue/ProfanedTrident.cs | 178 +- Projectiles/Rogue/Pwnagehammer.cs | 30 +- Projectiles/Rogue/RotBallProjectile.cs | 20 +- Projectiles/Rogue/RoyalKnife.cs | 218 +- Projectiles/Rogue/ScarletBlast.cs | 138 +- Projectiles/Rogue/ScarletDevilBullet.cs | 110 +- Projectiles/Rogue/ScarletDevilProjectile.cs | 152 +- Projectiles/Rogue/ScourgeVenomCloud.cs | 90 +- Projectiles/Rogue/ScourgeoftheDesert.cs | 44 +- Projectiles/Rogue/ScourgeoftheDesert2.cs | 90 +- .../Rogue/ScourgeoftheSeasProjectile.cs | 85 +- Projectiles/Rogue/ScourgeoftheSeasStealth.cs | 103 +- .../Rogue/SeashellBoomerangProjectile.cs | 15 +- Projectiles/Rogue/ShatteredExplosion.cs | 38 +- Projectiles/Rogue/ShatteredSun.cs | 132 +- Projectiles/Rogue/ShatteredSun2.cs | 108 +- Projectiles/Rogue/ShatteredSun3.cs | 138 +- Projectiles/Rogue/SpearofPaleolith.cs | 118 +- Projectiles/Rogue/Stormfrontproj.cs | 7 +- Projectiles/Rogue/Stormfrontspark.cs | 62 +- .../Rogue/TarragonThrowingDartProjectile.cs | 96 +- .../Rogue/TitaniumShurikenProjectile.cs | 20 +- Projectiles/Rogue/ToothBallProjectile.cs | 20 +- Projectiles/Rogue/TriactisOPHammer.cs | 230 +- Projectiles/Rogue/UrchinStinger.cs | 40 +- Projectiles/Rogue/Valediction.cs | 178 +- Projectiles/Rogue/Valediction2.cs | 228 +- Projectiles/Rogue/WulfrumKnife.cs | 20 +- Projectiles/Rogue/XerocPitchforkProjectile.cs | 112 +- Projectiles/Shrines/GladiatorSword.cs | 112 +- Projectiles/Shrines/GladiatorSword2.cs | 112 +- Projectiles/Shrines/LuxorsGiftMagic.cs | 78 +- Projectiles/Shrines/LuxorsGiftMelee.cs | 114 +- Projectiles/Shrines/LuxorsGiftRanged.cs | 134 +- Projectiles/Shrines/LuxorsGiftRogue.cs | 200 +- Projectiles/Shrines/LuxorsGiftSummon.cs | 558 +- Projectiles/Shrines/UnstableSpark.cs | 168 +- Projectiles/Summon/AngryChicken.cs | 516 +- Projectiles/Summon/AquaticStar.cs | 98 +- Projectiles/Summon/BigBustyRose.cs | 118 +- Projectiles/Summon/BlackHawkBullet.cs | 59 +- Projectiles/Summon/BlackHawkSummon.cs | 431 +- Projectiles/Summon/BloodClotMinion.cs | 120 +- Projectiles/Summon/BrimstoneFireSummon.cs | 108 +- Projectiles/Summon/BrimstoneLaserSummon.cs | 76 +- Projectiles/Summon/BrittleStar.cs | 98 +- Projectiles/Summon/Calamari.cs | 74 +- Projectiles/Summon/CalamariInk.cs | 86 +- Projectiles/Summon/Calamitamini.cs | 500 +- Projectiles/Summon/Cataclymini.cs | 496 +- Projectiles/Summon/Catastromini.cs | 524 +- Projectiles/Summon/ChaosFlame.cs | 36 +- Projectiles/Summon/ChaosSpirit.cs | 298 +- Projectiles/Summon/CloudyWaifu.cs | 466 +- Projectiles/Summon/Corroslime.cs | 106 +- Projectiles/Summon/CosmicBlast.cs | 112 +- Projectiles/Summon/CosmicBlastBig.cs | 112 +- Projectiles/Summon/CosmicEnergy.cs | 234 +- Projectiles/Summon/Cosmilamp.cs | 152 +- Projectiles/Summon/Crimslime.cs | 104 +- Projectiles/Summon/DaedalusCrystal.cs | 278 +- Projectiles/Summon/DaedalusCrystalShot.cs | 68 +- Projectiles/Summon/DankCreeper.cs | 134 +- Projectiles/Summon/Dreadmine.cs | 274 +- Projectiles/Summon/DreadmineTurret.cs | 52 +- Projectiles/Summon/DrewsSandyWaifu.cs | 384 +- Projectiles/Summon/ElementalAxe.cs | 428 +- Projectiles/Summon/FlameBlast.cs | 154 +- Projectiles/Summon/FlameBurst.cs | 154 +- Projectiles/Summon/FrostMistFriendly.cs | 204 +- Projectiles/Summon/FungalClump.cs | 144 +- Projectiles/Summon/GhostFire.cs | 34 +- Projectiles/Summon/GhostlyMine.cs | 74 +- Projectiles/Summon/GigaFlareFriendly.cs | 266 +- Projectiles/Summon/Herring.cs | 434 +- Projectiles/Summon/IceClasper.cs | 436 +- Projectiles/Summon/MechwormBody.cs | 178 +- Projectiles/Summon/MechwormBody2.cs | 178 +- Projectiles/Summon/MechwormHead.cs | 402 +- Projectiles/Summon/MechwormTail.cs | 180 +- Projectiles/Summon/MiniSandShark.cs | 56 +- Projectiles/Summon/PhantomGuy.cs | 436 +- Projectiles/Summon/PhoenixFireFriendly.cs | 104 +- Projectiles/Summon/ProfanedEnergy.cs | 240 +- Projectiles/Summon/ReaverOrb.cs | 220 +- Projectiles/Summon/RedDevil.cs | 524 +- Projectiles/Summon/SandBolt.cs | 18 +- Projectiles/Summon/SandMark.cs | 268 +- Projectiles/Summon/SandTornado.cs | 252 +- Projectiles/Summon/Sandnado.cs | 86 +- Projectiles/Summon/SandyWaifu.cs | 334 +- Projectiles/Summon/SilvaCrystal.cs | 84 +- Projectiles/Summon/SilvaCrystalExplosion.cs | 16 +- Projectiles/Summon/SirenLure.cs | 328 +- Projectiles/Summon/SirenSongFriendly.cs | 72 +- Projectiles/Summon/SlimeGod.cs | 116 +- Projectiles/Summon/SlimeGodAlt.cs | 116 +- Projectiles/Summon/SolarBeam.cs | 36 +- Projectiles/Summon/SolarGod.cs | 260 +- Projectiles/Summon/SolarPixie.cs | 258 +- Projectiles/Summon/Spikecrag.cs | 202 +- Projectiles/Summon/SpikecragSpike.cs | 14 +- Projectiles/Summon/StormMarkSummon.cs | 268 +- Projectiles/Summon/Urchin.cs | 224 +- Projectiles/Summon/UrchinSpike.cs | 12 +- Projectiles/Summon/Valkyrie.cs | 522 +- Projectiles/Summon/WaterSpearFriendly.cs | 102 +- Projectiles/SunkenSea/AquaStream.cs | 62 +- Projectiles/SunkenSea/AquamarineBolt.cs | 40 +- Projectiles/SunkenSea/Aquashard.cs | 54 +- Projectiles/SunkenSea/AquashardSplit.cs | 20 +- Projectiles/SunkenSea/ClamCrusherFlail.cs | 386 +- Projectiles/SunkenSea/ClamorRifleProj.cs | 138 +- Projectiles/SunkenSea/ClamorRifleProjSplit.cs | 26 +- Projectiles/SunkenSea/CoralBubble.cs | 114 +- Projectiles/SunkenSea/CoralBubbleSmall.cs | 112 +- .../SunkenSea/EutrophicScimitarProj.cs | 134 +- Projectiles/SunkenSea/EutrophicSpark.cs | 126 +- Projectiles/SunkenSea/PearlBurst.cs | 152 +- Projectiles/SunkenSea/PearlRain.cs | 88 +- Projectiles/SunkenSea/PendantProjectile1.cs | 26 +- Projectiles/SunkenSea/PendantProjectile2.cs | 26 +- Projectiles/SunkenSea/PendantProjectile3.cs | 26 +- Projectiles/SunkenSea/PoseidonTyphoon.cs | 86 +- Projectiles/SunkenSea/Prismalline.cs | 150 +- Projectiles/SunkenSea/Prismalline2.cs | 80 +- Projectiles/SunkenSea/Prismalline3.cs | 144 +- Projectiles/SunkenSea/SeafoamBomb.cs | 44 +- Projectiles/SunkenSea/SeafoamBubble.cs | 52 +- Projectiles/SunkenSea/SeashineSwordProj.cs | 64 +- Projectiles/SunkenSea/SerpentineBody.cs | 144 +- Projectiles/SunkenSea/SerpentineHead.cs | 136 +- Projectiles/SunkenSea/SerpentineTail.cs | 146 +- Projectiles/SunkenSea/Shellfish.cs | 884 +- Projectiles/SunkenSea/WhirlpoolProjectile.cs | 104 +- Projectiles/Typeless/AstralFallingSand.cs | 3 +- Projectiles/Typeless/AstralSpray.cs | 8 +- Projectiles/Typeless/AstralStar.cs | 206 +- Projectiles/Typeless/AtaxiaOrb.cs | 18 +- Projectiles/Typeless/BallisticPoisonCloud.cs | 56 +- Projectiles/Typeless/BallisticPoisonCloud2.cs | 56 +- Projectiles/Typeless/BallisticPoisonCloud3.cs | 56 +- Projectiles/Typeless/BloodBomb.cs | 40 +- Projectiles/Typeless/BloodBombExplosion.cs | 140 +- Projectiles/Typeless/ChaosBlaze.cs | 136 +- Projectiles/Typeless/ChaosFlare.cs | 108 +- Projectiles/Typeless/ChaosFlare2.cs | 96 +- Projectiles/Typeless/ChaosGeyser.cs | 134 +- Projectiles/Typeless/DarkEnergySpawn.cs | 58 +- Projectiles/Typeless/DragonDust.cs | 128 +- Projectiles/Typeless/FabsolDust.cs | 28 +- Projectiles/Typeless/FlareExplosion.cs | 30 +- Projectiles/Typeless/FuckYou.cs | 199 +- Projectiles/Typeless/GalaxySmasherHammer.cs | 14 +- Projectiles/Typeless/GhostlyBolt.cs | 8 +- Projectiles/Typeless/GodKiller.cs | 224 +- Projectiles/Typeless/GodSlayerBlaze.cs | 108 +- Projectiles/Typeless/GodSlayerOrb.cs | 88 +- Projectiles/Typeless/GodSlayerPhantom.cs | 14 +- Projectiles/Typeless/GodSlayerShrapnel.cs | 132 +- .../Typeless/GodSlayerShrapnelRound.cs | 62 +- Projectiles/Typeless/GoldenGun.cs | 40 +- Projectiles/Typeless/GrenadeRound.cs | 54 +- Projectiles/Typeless/HolyEruption.cs | 126 +- Projectiles/Typeless/HolyExplosion.cs | 58 +- Projectiles/Typeless/HolyExplosionSupreme.cs | 60 +- Projectiles/Typeless/HolyFlameBomb.cs | 96 +- Projectiles/Typeless/LunicBeam.cs | 478 +- Projectiles/Typeless/MageHammerBoom.cs | 10 +- Projectiles/Typeless/MagnumRound.cs | 14 +- Projectiles/Typeless/MarkRound.cs | 134 +- Projectiles/Typeless/NanoblackMain.cs | 24 +- Projectiles/Typeless/NanoblackSplit.cs | 14 +- Projectiles/Typeless/Nanotech.cs | 98 +- Projectiles/Typeless/NebulaDust.cs | 78 +- Projectiles/Typeless/NebulaStar.cs | 326 +- Projectiles/Typeless/NobodyKnows.cs | 8 +- Projectiles/Typeless/OmegaBlueTentacle.cs | 7 +- Projectiles/Typeless/PoisonousSeawater.cs | 14 +- Projectiles/Typeless/ReaverBlast.cs | 130 +- Projectiles/Typeless/Seashell.cs | 14 +- Projectiles/Typeless/SkyFlareFriendly.cs | 192 +- Projectiles/Typeless/SparkInfernal.cs | 12 +- Projectiles/Typeless/StandingFire.cs | 136 +- Projectiles/Typeless/StellarContemptHammer.cs | 132 +- Projectiles/Typeless/StickyFeatherAero.cs | 58 +- Projectiles/Typeless/StormBolt.cs | 18 +- Projectiles/Typeless/TarraEnergy.cs | 114 +- .../Typeless/TheDeadlyMicrobeProjectile.cs | 348 +- Projectiles/Typeless/TrueBattleSpawn.cs | 54 +- Projectiles/Typeless/VanquisherArrow2.cs | 107 +- Projectiles/Typeless/XerocBlast.cs | 130 +- Projectiles/Typeless/XerocBubble.cs | 104 +- Projectiles/Typeless/XerocFire.cs | 126 +- Projectiles/Typeless/XerocOrb.cs | 18 +- Projectiles/Typeless/XerocStar.cs | 106 +- Skies/AstralScreenShaderData.cs | 8 +- Skies/AstralSky.cs | 3 +- Sounds/Custom/AdrenalineBurnout1.cs | 22 +- Sounds/Custom/AdrenalineBurnout2.cs | 22 +- Sounds/Custom/AngryDogGrowl.cs | 22 +- Sounds/Custom/BazookaRocket.cs | 22 +- Sounds/Custom/CorvinaScream.cs | 22 +- Sounds/Custom/DevilMaskBreak.cs | 22 +- Sounds/Custom/EidolonWyrmRoarClose.cs | 22 +- Sounds/Custom/FullAdrenaline.cs | 22 +- Sounds/Custom/FullRage.cs | 22 +- Sounds/Custom/GreatSandSharkRoar.cs | 22 +- Sounds/Custom/IronHeartBigHurt.cs | 22 +- Sounds/Custom/IronHeartHurt.cs | 22 +- Sounds/Custom/LegStomp.cs | 22 +- Sounds/Custom/MaulerRoar.cs | 22 +- Sounds/Custom/ReaperEnragedRoar.cs | 22 +- Sounds/Custom/ReaperSearchRoar.cs | 22 +- Sounds/Custom/RogueStealth.cs | 22 +- Sounds/Custom/SilvaActivation.cs | 22 +- Sounds/Custom/SilvaDispel.cs | 22 +- Sounds/Custom/WyrmScream.cs | 22 +- Sounds/Custom/YharonRoar.cs | 22 +- Sounds/Custom/YharonRoarShort.cs | 22 +- Sounds/Item/BazookaFull.cs | 22 +- Sounds/Item/ClamImpact.cs | 22 +- Sounds/Item/ELRFire.cs | 22 +- Sounds/Item/FlareSound.cs | 22 +- Sounds/Item/GatlingLaserFireEnd.cs | 22 +- Sounds/Item/GatlingLaserFireLoop.cs | 22 +- Sounds/Item/GatlingLaserFireStart.cs | 22 +- Sounds/Item/GaussWeaponFire.cs | 22 +- Sounds/Item/Hydra.cs | 22 +- Sounds/Item/IronHeartDeath.cs | 22 +- Sounds/Item/KendraBark.cs | 22 +- Sounds/Item/LargeMechGaussRifle.cs | 22 +- Sounds/Item/LargeWeaponFire.cs | 22 +- Sounds/Item/LaserCannon.cs | 22 +- Sounds/Item/LaserRifleFire.cs | 22 +- Sounds/Item/Magnum.cs | 22 +- Sounds/Item/MechGaussRifle.cs | 22 +- Sounds/Item/OpalStrike.cs | 22 +- Sounds/Item/PlasmaBlast.cs | 22 +- Sounds/Item/PlasmaBolt.cs | 22 +- Sounds/Item/PlasmaCasterFire.cs | 22 +- Sounds/Item/PulseRifleFire.cs | 22 +- Sounds/Item/TankCannon.cs | 24 +- Sounds/Item/TeslaCannonFire.cs | 22 +- Sounds/NPCHit/AngryDogHit.cs | 22 +- Sounds/NPCHit/AstrumAureusHit.cs | 22 +- Sounds/NPCKilled/Sunskater.cs | 22 +- Tiles/AbyssGravel.cs | 14 +- Tiles/AerialiteBrick.cs | 18 +- Tiles/AerialiteOre.cs | 52 +- Tiles/ArenaTile.cs | 56 +- Tiles/Astral/AstralChestLocked.cs | 360 +- Tiles/Astral/AstralCrate.cs | 1 - Tiles/Astral/AstralDirt.cs | 18 +- Tiles/Astral/AstralGrass.cs | 16 +- Tiles/Astral/AstralMonolith.cs | 4 +- Tiles/Astral/AstralNormalLargePiles.cs | 7 +- Tiles/Astral/AstralNormalMediumPiles.cs | 7 +- Tiles/Astral/AstralNormalSmallPiles.cs | 3 +- Tiles/Astral/AstralNormalStalactite.cs | 3 +- Tiles/Astral/AstralOre.cs | 44 +- Tiles/Astral/AstralStone.cs | 18 +- Tiles/Astral/AstralTree.cs | 4 +- Tiles/Astral/AstralVines.cs | 8 +- Tiles/AstralBar.cs | 2 +- Tiles/AstralBrick.cs | 12 +- Tiles/AstralDesert/AstralDesertLargePiles.cs | 7 +- Tiles/AstralDesert/AstralDesertMediumPiles.cs | 7 +- Tiles/AstralDesert/AstralDesertSmallPiles.cs | 5 +- Tiles/AstralDesert/AstralDesertStalactite.cs | 3 +- Tiles/AstralDesert/AstralPalmTree.cs | 4 +- Tiles/AstralDesert/AstralSand.cs | 18 +- Tiles/AstralDesert/AstralSandstone.cs | 18 +- Tiles/AstralDesert/HardenedAstralSand.cs | 18 +- Tiles/AstralSnow/AstralIce.cs | 18 +- Tiles/AstralSnow/AstralIceLargePiles.cs | 7 +- Tiles/AstralSnow/AstralIceMediumPiles.cs | 7 +- Tiles/AstralSnow/AstralIceSmallPiles.cs | 3 +- Tiles/AstralSnow/AstralIceStalactite.cs | 3 +- Tiles/AuricOre.cs | 50 +- Tiles/BlueCandle.cs | 78 +- Tiles/BossTrophy.cs | 156 +- Tiles/BrimstoneSlag.cs | 14 +- Tiles/CalamityGlobalTile.cs | 1077 +- Tiles/ChaosCandle.cs | 52 +- Tiles/ChaoticBrick.cs | 20 +- Tiles/ChaoticOre.cs | 42 +- Tiles/CharredOre.cs | 2 +- Tiles/Cinderplate.cs | 16 +- Tiles/CorruptionEffigy.cs | 46 +- Tiles/CrimsonEffigy.cs | 46 +- Tiles/CryonicBrick.cs | 44 +- Tiles/CryonicOre.cs | 48 +- Tiles/DraedonsForge.cs | 78 +- Tiles/ExodiumOre.cs | 12 +- Tiles/FurnitureAbyss/AbyssBath.cs | 57 +- Tiles/FurnitureAbyss/AbyssBed.cs | 136 +- Tiles/FurnitureAbyss/AbyssBookcase.cs | 62 +- Tiles/FurnitureAbyss/AbyssChair.cs | 48 +- Tiles/FurnitureAbyss/AbyssChandelier.cs | 6 +- Tiles/FurnitureAbyss/AbyssChest.cs | 356 +- Tiles/FurnitureAbyss/AbyssClock.cs | 154 +- Tiles/FurnitureAbyss/AbyssDoorClosed.cs | 94 +- Tiles/FurnitureAbyss/AbyssDoorOpen.cs | 134 +- Tiles/FurnitureAbyss/AbyssDresser.cs | 418 +- Tiles/FurnitureAbyss/AbyssLantern.cs | 3 +- Tiles/FurnitureAbyss/AbyssPiano.cs | 1 - Tiles/FurnitureAbyss/AbyssSink.cs | 56 +- Tiles/FurnitureAbyss/AbyssSofa.cs | 1 - Tiles/FurnitureAbyss/AbyssTorch.cs | 134 +- Tiles/FurnitureAbyss/AbyssWorkbench.cs | 36 +- Tiles/FurnitureAbyss/SmoothAbyssGravel.cs | 18 +- .../SmoothAbyssGravelPlatform.cs | 64 +- Tiles/FurnitureAncient/AncientAltar.cs | 22 +- Tiles/FurnitureAncient/AncientBasin.cs | 18 +- Tiles/FurnitureAncient/AncientBath.cs | 1 - Tiles/FurnitureAncient/AncientBed.cs | 100 +- Tiles/FurnitureAncient/AncientChair.cs | 54 +- Tiles/FurnitureAncient/AncientChandelier.cs | 6 +- Tiles/FurnitureAncient/AncientDoorClosed.cs | 88 +- Tiles/FurnitureAncient/AncientDoorOpen.cs | 128 +- Tiles/FurnitureAncient/AncientDresser.cs | 236 +- Tiles/FurnitureAncient/AncientMonolith.cs | 160 +- Tiles/FurnitureAncient/AncientPiano.cs | 1 - Tiles/FurnitureAncient/AncientSink.cs | 58 +- Tiles/FurnitureAncient/AncientSofa.cs | 1 - Tiles/FurnitureAncient/AncientWorkbench.cs | 42 +- Tiles/FurnitureAshen/AshenAltar.cs | 22 +- Tiles/FurnitureAshen/AshenBasin.cs | 18 +- Tiles/FurnitureAshen/AshenBath.cs | 1 - Tiles/FurnitureAshen/AshenBed.cs | 92 +- Tiles/FurnitureAshen/AshenChair.cs | 54 +- Tiles/FurnitureAshen/AshenChandelier.cs | 6 +- Tiles/FurnitureAshen/AshenChest.cs | 56 +- Tiles/FurnitureAshen/AshenDoorClosed.cs | 86 +- Tiles/FurnitureAshen/AshenDoorOpen.cs | 124 +- Tiles/FurnitureAshen/AshenDresser.cs | 240 +- Tiles/FurnitureAshen/AshenLantern.cs | 3 +- Tiles/FurnitureAshen/AshenMonolith.cs | 165 +- Tiles/FurnitureAshen/AshenPiano.cs | 1 - Tiles/FurnitureAshen/AshenPlatform.cs | 62 +- Tiles/FurnitureAshen/AshenSink.cs | 58 +- Tiles/FurnitureAshen/AshenSlab.cs | 1 - Tiles/FurnitureAshen/AshenSofa.cs | 1 - Tiles/FurnitureAshen/AshenWorkbench.cs | 42 +- Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs | 16 +- Tiles/FurnitureBotanic/BotanicBathtub.cs | 1 - Tiles/FurnitureBotanic/BotanicBed.cs | 104 +- Tiles/FurnitureBotanic/BotanicBench.cs | 1 - Tiles/FurnitureBotanic/BotanicChair.cs | 48 +- Tiles/FurnitureBotanic/BotanicChandelier.cs | 6 +- Tiles/FurnitureBotanic/BotanicChest.cs | 204 +- Tiles/FurnitureBotanic/BotanicClock.cs | 154 +- Tiles/FurnitureBotanic/BotanicDoorClosed.cs | 94 +- Tiles/FurnitureBotanic/BotanicDoorOpen.cs | 134 +- Tiles/FurnitureBotanic/BotanicDresser.cs | 242 +- Tiles/FurnitureBotanic/BotanicLantern.cs | 3 +- Tiles/FurnitureBotanic/BotanicPiano.cs | 1 - Tiles/FurnitureBotanic/BotanicPlanter.cs | 18 +- Tiles/FurnitureBotanic/BotanicPlatform.cs | 62 +- Tiles/FurnitureBotanic/BotanicSink.cs | 56 +- Tiles/FurnitureBotanic/BotanicWorkBench.cs | 36 +- Tiles/FurnitureCosmilite/CosmiliteBath.cs | 1 - Tiles/FurnitureCosmilite/CosmiliteBed.cs | 106 +- Tiles/FurnitureCosmilite/CosmiliteBrick.cs | 13 +- Tiles/FurnitureCosmilite/CosmiliteChair.cs | 50 +- .../FurnitureCosmilite/CosmiliteChandelier.cs | 6 +- Tiles/FurnitureCosmilite/CosmiliteChest.cs | 100 +- Tiles/FurnitureCosmilite/CosmiliteClock.cs | 160 +- .../FurnitureCosmilite/CosmiliteDoorClosed.cs | 96 +- Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs | 132 +- Tiles/FurnitureCosmilite/CosmiliteDresser.cs | 244 +- Tiles/FurnitureCosmilite/CosmiliteLantern.cs | 3 +- Tiles/FurnitureCosmilite/CosmilitePiano.cs | 1 - Tiles/FurnitureCosmilite/CosmilitePlatform.cs | 52 +- Tiles/FurnitureCosmilite/CosmiliteSconce.cs | 2 - Tiles/FurnitureCosmilite/CosmiliteSink.cs | 56 +- Tiles/FurnitureCosmilite/CosmiliteSofa.cs | 1 - .../FurnitureCosmilite/CosmiliteWorkbench.cs | 46 +- Tiles/FurnitureEutrophic/EutrophicBathtub.cs | 1 - Tiles/FurnitureEutrophic/EutrophicBed.cs | 104 +- Tiles/FurnitureEutrophic/EutrophicBench.cs | 1 - Tiles/FurnitureEutrophic/EutrophicChair.cs | 48 +- .../FurnitureEutrophic/EutrophicChandelier.cs | 6 +- Tiles/FurnitureEutrophic/EutrophicChest.cs | 204 +- Tiles/FurnitureEutrophic/EutrophicClock.cs | 150 +- Tiles/FurnitureEutrophic/EutrophicCrafting.cs | 16 +- .../FurnitureEutrophic/EutrophicDoorClosed.cs | 94 +- Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs | 134 +- Tiles/FurnitureEutrophic/EutrophicDresser.cs | 242 +- Tiles/FurnitureEutrophic/EutrophicLantern.cs | 3 +- Tiles/FurnitureEutrophic/EutrophicPiano.cs | 1 - Tiles/FurnitureEutrophic/EutrophicPlatform.cs | 52 +- Tiles/FurnitureEutrophic/EutrophicSink.cs | 56 +- .../FurnitureEutrophic/EutrophicWorkBench.cs | 36 +- Tiles/FurnitureEutrophic/SmoothNavystone.cs | 18 +- Tiles/FurnitureOccult/OccultBathtub.cs | 1 - Tiles/FurnitureOccult/OccultBed.cs | 104 +- Tiles/FurnitureOccult/OccultChair.cs | 48 +- Tiles/FurnitureOccult/OccultChandelier.cs | 6 +- Tiles/FurnitureOccult/OccultChest.cs | 204 +- Tiles/FurnitureOccult/OccultClock.cs | 154 +- Tiles/FurnitureOccult/OccultDoorClosed.cs | 94 +- Tiles/FurnitureOccult/OccultDoorOpen.cs | 134 +- Tiles/FurnitureOccult/OccultDresser.cs | 242 +- Tiles/FurnitureOccult/OccultLantern.cs | 3 +- Tiles/FurnitureOccult/OccultPiano.cs | 1 - Tiles/FurnitureOccult/OccultPlatform.cs | 52 +- Tiles/FurnitureOccult/OccultSink.cs | 58 +- Tiles/FurnitureOccult/OccultSofa.cs | 1 - Tiles/FurnitureOccult/OccultStone.cs | 4 +- Tiles/FurnitureOccult/OccultWorkbench.cs | 36 +- Tiles/FurniturePlaguedPlate/PlagueInfuser.cs | 170 +- Tiles/FurniturePlaguedPlate/PlaguedPlate.cs | 15 +- .../PlaguedPlateBasin.cs | 22 +- .../PlaguedPlateBathtub.cs | 1 - .../FurniturePlaguedPlate/PlaguedPlateBed.cs | 108 +- .../PlaguedPlateChair.cs | 50 +- .../PlaguedPlateChandelier.cs | 6 +- .../PlaguedPlateChest.cs | 206 +- .../PlaguedPlateClock.cs | 152 +- .../PlaguedPlateDoorClosed.cs | 96 +- .../PlaguedPlateDoorOpen.cs | 136 +- .../PlaguedPlateDresser.cs | 238 +- .../PlaguedPlateLantern.cs | 3 +- .../PlaguedPlatePiano.cs | 1 - .../PlaguedPlatePlatform.cs | 54 +- .../FurniturePlaguedPlate/PlaguedPlateSink.cs | 54 +- .../PlaguedPlateWorkbench.cs | 38 +- Tiles/FurnitureProfaned/ProfanedBasin.cs | 24 +- Tiles/FurnitureProfaned/ProfanedBath.cs | 1 - Tiles/FurnitureProfaned/ProfanedBed.cs | 106 +- Tiles/FurnitureProfaned/ProfanedBench.cs | 1 - Tiles/FurnitureProfaned/ProfanedChair.cs | 50 +- Tiles/FurnitureProfaned/ProfanedChandelier.cs | 6 +- Tiles/FurnitureProfaned/ProfanedChest.cs | 202 +- Tiles/FurnitureProfaned/ProfanedClock.cs | 154 +- Tiles/FurnitureProfaned/ProfanedCrystal.cs | 14 +- Tiles/FurnitureProfaned/ProfanedDoorClosed.cs | 96 +- Tiles/FurnitureProfaned/ProfanedDoorOpen.cs | 136 +- Tiles/FurnitureProfaned/ProfanedDresser.cs | 236 +- Tiles/FurnitureProfaned/ProfanedLantern.cs | 3 +- Tiles/FurnitureProfaned/ProfanedPiano.cs | 3 - Tiles/FurnitureProfaned/ProfanedPlatform.cs | 54 +- Tiles/FurnitureProfaned/ProfanedRock.cs | 16 +- Tiles/FurnitureProfaned/ProfanedSink.cs | 56 +- Tiles/FurnitureProfaned/ProfanedSlab.cs | 16 +- Tiles/FurnitureProfaned/ProfanedWorkbench.cs | 38 +- Tiles/FurnitureProfaned/RunicProfanedBrick.cs | 14 +- Tiles/FurnitureSilva/SilvaBasin.cs | 18 +- Tiles/FurnitureSilva/SilvaBathtub.cs | 1 - Tiles/FurnitureSilva/SilvaBed.cs | 104 +- Tiles/FurnitureSilva/SilvaBench.cs | 1 - Tiles/FurnitureSilva/SilvaChair.cs | 48 +- Tiles/FurnitureSilva/SilvaChandelier.cs | 6 +- Tiles/FurnitureSilva/SilvaChest.cs | 204 +- Tiles/FurnitureSilva/SilvaClock.cs | 154 +- Tiles/FurnitureSilva/SilvaCrystal.cs | 19 +- Tiles/FurnitureSilva/SilvaDoorClosed.cs | 94 +- Tiles/FurnitureSilva/SilvaDoorOpen.cs | 134 +- Tiles/FurnitureSilva/SilvaDresser.cs | 242 +- Tiles/FurnitureSilva/SilvaLantern.cs | 3 +- Tiles/FurnitureSilva/SilvaPiano.cs | 1 - Tiles/FurnitureSilva/SilvaSink.cs | 58 +- Tiles/FurnitureSilva/SilvaWorkBench.cs | 36 +- Tiles/FurnitureStatigel/StaticRefiner.cs | 174 +- Tiles/FurnitureStatigel/StatigelBath.cs | 1 - Tiles/FurnitureStatigel/StatigelBed.cs | 106 +- Tiles/FurnitureStatigel/StatigelBlock.cs | 18 +- Tiles/FurnitureStatigel/StatigelChair.cs | 50 +- Tiles/FurnitureStatigel/StatigelChandelier.cs | 6 +- Tiles/FurnitureStatigel/StatigelChest.cs | 198 +- Tiles/FurnitureStatigel/StatigelClock.cs | 162 +- Tiles/FurnitureStatigel/StatigelDoorClosed.cs | 96 +- Tiles/FurnitureStatigel/StatigelDoorOpen.cs | 136 +- Tiles/FurnitureStatigel/StatigelDresser.cs | 244 +- Tiles/FurnitureStatigel/StatigelLantern.cs | 3 +- Tiles/FurnitureStatigel/StatigelPiano.cs | 1 - Tiles/FurnitureStatigel/StatigelPlatform.cs | 68 +- Tiles/FurnitureStatigel/StatigelSink.cs | 54 +- Tiles/FurnitureStatigel/StatigelSofa.cs | 1 - Tiles/FurnitureStatigel/StatigelWorkbench.cs | 38 +- Tiles/FurnitureStratus/StratusBathtub.cs | 1 - Tiles/FurnitureStratus/StratusBed.cs | 100 +- Tiles/FurnitureStratus/StratusBricks.cs | 2 +- Tiles/FurnitureStratus/StratusChair.cs | 58 +- Tiles/FurnitureStratus/StratusChandelier.cs | 6 +- Tiles/FurnitureStratus/StratusChest.cs | 198 +- Tiles/FurnitureStratus/StratusClock.cs | 164 +- Tiles/FurnitureStratus/StratusDoorClosed.cs | 92 +- Tiles/FurnitureStratus/StratusDoorOpen.cs | 132 +- Tiles/FurnitureStratus/StratusDresser.cs | 244 +- Tiles/FurnitureStratus/StratusLantern.cs | 3 +- Tiles/FurnitureStratus/StratusPiano.cs | 1 - Tiles/FurnitureStratus/StratusPlatform.cs | 62 +- Tiles/FurnitureStratus/StratusSink.cs | 56 +- Tiles/FurnitureStratus/StratusWorkbench.cs | 46 +- Tiles/FurnitureVoid/SmoothVoidstone.cs | 16 +- .../FurnitureVoid/SmoothVoidstonePlatform.cs | 64 +- Tiles/FurnitureVoid/VoidBath.cs | 1 - Tiles/FurnitureVoid/VoidBed.cs | 96 +- Tiles/FurnitureVoid/VoidChair.cs | 56 +- Tiles/FurnitureVoid/VoidChandelier.cs | 6 +- Tiles/FurnitureVoid/VoidChest.cs | 198 +- Tiles/FurnitureVoid/VoidClock.cs | 164 +- Tiles/FurnitureVoid/VoidDoorClosed.cs | 90 +- Tiles/FurnitureVoid/VoidDoorOpen.cs | 130 +- Tiles/FurnitureVoid/VoidDresser.cs | 242 +- Tiles/FurnitureVoid/VoidLantern.cs | 3 +- Tiles/FurnitureVoid/VoidPiano.cs | 1 - Tiles/FurnitureVoid/VoidSink.cs | 56 +- Tiles/FurnitureVoid/VoidSofa.cs | 1 - Tiles/FurnitureVoid/VoidWorkbench.cs | 36 +- Tiles/FurnitureVoid/VoidstoneSlab.cs | 13 +- Tiles/LumenylCrystals.cs | 89 +- Tiles/MonsterBanner.cs | 1416 +- Tiles/PerennialBrick.cs | 52 +- Tiles/PerennialOre.cs | 48 +- Tiles/PinkCandle.cs | 82 +- Tiles/PlantyMush.cs | 142 +- Tiles/PurpleCandle.cs | 80 +- Tiles/RoxTile.cs | 48 +- Tiles/SulphurousSand.cs | 342 +- Tiles/SunkenSea/BrainCoral.cs | 72 +- Tiles/SunkenSea/EutrophicSand.cs | 48 +- Tiles/SunkenSea/FanCoral.cs | 42 +- Tiles/SunkenSea/Navystone.cs | 166 +- Tiles/SunkenSea/SeaAnemone.cs | 58 +- Tiles/SunkenSea/SeaPrism.cs | 168 +- Tiles/SunkenSea/SeaPrismCrystals.cs | 100 +- Tiles/SunkenSea/SmallBrainCoral.cs | 72 +- Tiles/SunkenSea/SmallTubeCoral.cs | 26 +- Tiles/SunkenSea/SunkenSeaStalactite.cs | 4 +- Tiles/SunkenSea/TableCoral.cs | 40 +- Tiles/SunkenSea/TubeCoral.cs | 40 +- Tiles/Tenebris.cs | 64 +- Tiles/TranquilityCandle.cs | 52 +- Tiles/UelibloomBrick.cs | 4 +- Tiles/UelibloomOre.cs | 46 +- Tiles/ViperVines.cs | 64 +- Tiles/Voidstone.cs | 14 +- Tiles/YellowCandle.cs | 58 +- UI/AstralArcanumUI.cs | 13 +- UI/BossHealthBarManager.cs | 85 +- UI/UIBar.cs | 231 +- UI/UIBar2.cs | 231 +- UI/UIHandler.cs | 91 +- UI/UIImage.cs | 32 +- Utilities/CalamityRecipes.cs | 1486 +- Utilities/CustomTileFraming.cs | 26 +- Utilities/DropHelper.cs | 1482 +- Walls/AerialiteBrickWall.cs | 24 +- Walls/AshenSlabWall.cs | 14 +- Walls/AstralBrickWall.cs | 24 +- Walls/AstralMonolithWall.cs | 14 +- Walls/BrimstoneSlagWall.cs | 22 +- Walls/CinderplateWall.cs | 24 +- Walls/CosmiliteBrickWall.cs | 24 +- Walls/EutrophicSandWall.cs | 18 +- Walls/EutrophicSandWallSafe.cs | 14 +- Walls/NavystoneWall.cs | 4 +- Walls/NavystoneWallSafe.cs | 18 +- Walls/OccultStoneWall.cs | 24 +- Walls/PerennialBrickWall.cs | 16 +- Walls/PlaguedPlateWall.cs | 24 +- Walls/ProfanedCrystalWall.cs | 24 +- Walls/ProfanedRockWall.cs | 24 +- Walls/ProfanedSlabWall.cs | 20 +- Walls/RunicProfanedBrickWall.cs | 20 +- Walls/SilvaWall.cs | 24 +- Walls/SmoothAbyssGravelWall.cs | 24 +- Walls/SmoothBrimstoneSlagWall.cs | 24 +- Walls/SmoothNavystoneWall.cs | 24 +- Walls/SmoothVoidstoneWall.cs | 24 +- Walls/StatigelWall.cs | 24 +- Walls/StratusWall.cs | 24 +- Walls/UelibloomBrickWall.cs | 24 +- Walls/VoidstoneWall.cs | 18 +- Waters/AbyssWater.cs | 1 - Waters/AstralWater.cs | 1 - Waters/SulphuricWater.cs | 3 +- Waters/SunkenSeaWater.cs | 1 - World/Abyss.cs | 890 +- World/CalamityWorld.cs | 2879 +- World/CustomActions.cs | 4 +- World/CustomConditions.cs | 6 +- World/Planets/GrassPlanet.cs | 10 +- World/Planets/HeartPlanet.cs | 4 +- World/Planets/MainPlanet.cs | 22 +- World/Planets/MudPlanet.cs | 11 +- World/Planets/Planetoid.cs | 41 +- World/SmallBiomes.cs | 292 +- World/SunkenSea.cs | 1134 +- World/WorldGenerationMethods.cs | 6436 ++-- 3534 files changed, 233559 insertions(+), 233633 deletions(-) diff --git a/Buffs/Amidias/AmidiasBlessing.cs b/Buffs/Amidias/AmidiasBlessing.cs index 8e559d721a..66a2a54028 100644 --- a/Buffs/Amidias/AmidiasBlessing.cs +++ b/Buffs/Amidias/AmidiasBlessing.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Amidias { public class AmidiasBlessing : ModBuff - { + { public override void SetDefaults() { DisplayName.SetDefault("Amidias' Blessing"); Description.SetDefault("You are blessed by Amidias" + - "\nLets you breathe underwater, even in the Abyss!" + - "\nJust don't get hit..."); + "\nLets you breathe underwater, even in the Abyss!" + + "\nJust don't get hit..."); Main.debuff[Type] = false; - Main.buffNoSave[Type] = false; + Main.buffNoSave[Type] = false; } public override void Update(Player player, ref int buffIndex) - { + { player.Calamity().amidiasBlessing = true; player.breath = player.breathMax + 91; } - } + } } diff --git a/Buffs/Amidias/HermitCrab.cs b/Buffs/Amidias/HermitCrab.cs index 9d36e37aa3..f5e03f9274 100644 --- a/Buffs/Amidias/HermitCrab.cs +++ b/Buffs/Amidias/HermitCrab.cs @@ -5,32 +5,32 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Amidias { public class HermitCrab : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Hermit Crab"); - Description.SetDefault("The hermit crab will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Hermit Crab"); + Description.SetDefault("The hermit crab will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("HermitCrab")] > 0) - { - modPlayer.hCrab = true; - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("HermitCrab")] > 0) + { + modPlayer.hCrab = true; + } - if (!modPlayer.hCrab) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + if (!modPlayer.hCrab) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/Amidias/SnapClamDebuff.cs b/Buffs/Amidias/SnapClamDebuff.cs index 817d931bae..b83e4c45f7 100644 --- a/Buffs/Amidias/SnapClamDebuff.cs +++ b/Buffs/Amidias/SnapClamDebuff.cs @@ -1,23 +1,22 @@ -using CalamityMod.NPCs; -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Amidias { public class SnapClamDebuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Clammed"); - Description.SetDefault("Clam clap"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Clammed"); + Description.SetDefault("Clam clap"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().clamDebuff = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().clamDebuff = true; + } + } } diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 253e917458..83c7428f82 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs { public class CalamityGlobalBuff : GlobalBuff - { + { public override void Update(int type, Player player, ref int buffIndex) { if (type == BuffID.Shine) @@ -17,11 +17,11 @@ namespace CalamityMod.Buffs { player.endurance -= 0.1f; } - else if (type == BuffID.ObsidianSkin) - { - player.lavaMax += 420; - } - else if (type == BuffID.Rage) + else if (type == BuffID.ObsidianSkin) + { + player.lavaMax += 420; + } + else if (type == BuffID.Rage) { player.Calamity().throwingCrit += 10; } @@ -33,12 +33,12 @@ namespace CalamityMod.Buffs { float nebulaDamage = 0.075f * (float)player.nebulaLevelDamage; //7.5% to 22.5% player.allDamage -= nebulaDamage; - } - else if (type >= BuffID.NebulaUpLife1 && type <= BuffID.NebulaUpLife3) - { - player.lifeRegen -= 5 * player.nebulaLevelLife; //10 to 30 changed to 5 to 15 - } - else if (type == BuffID.Warmth) + } + else if (type >= BuffID.NebulaUpLife1 && type <= BuffID.NebulaUpLife3) + { + player.lifeRegen -= 5 * player.nebulaLevelLife; //10 to 30 changed to 5 to 15 + } + else if (type == BuffID.Warmth) { player.buffImmune[mod.BuffType("GlacialState")] = true; player.buffImmune[BuffID.Frozen] = true; @@ -46,8 +46,8 @@ namespace CalamityMod.Buffs } } - public override void ModifyBuffTip(int type, ref string tip, ref int rare) - { + public override void ModifyBuffTip(int type, ref string tip, ref int rare) + { if (type == BuffID.NebulaUpDmg1) tip = "7.5% increased damage"; else if (type == BuffID.NebulaUpDmg2) @@ -69,8 +69,8 @@ namespace CalamityMod.Buffs } else if (type == BuffID.CursedInferno && CalamityWorld.revenge) tip += ". All damage taken increased by 20%"; - else if (type == BuffID.Warmth) - tip += ". Immunity to the Chilled, Frozen, and Glacial State debuffs"; - } - } + else if (type == BuffID.Warmth) + tip += ". Immunity to the Chilled, Frozen, and Glacial State debuffs"; + } + } } diff --git a/Buffs/DoTDebuffs/AbyssalFlames.cs b/Buffs/DoTDebuffs/AbyssalFlames.cs index 593b96a958..ff8702774b 100644 --- a/Buffs/DoTDebuffs/AbyssalFlames.cs +++ b/Buffs/DoTDebuffs/AbyssalFlames.cs @@ -1,32 +1,31 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.DoTDebuffs { public class AbyssalFlames : ModBuff - { + { public static int DefenseReduction = 10; public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Flames"); - Description.SetDefault("Your soul is being consumed"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + DisplayName.SetDefault("Abyssal Flames"); + Description.SetDefault("Your soul is being consumed"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().aFlames = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().aFlames = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().aFlames = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().aFlames = true; + } + } } diff --git a/Buffs/DoTDebuffs/AstralInfectionDebuff.cs b/Buffs/DoTDebuffs/AstralInfectionDebuff.cs index c946b63eb6..d5b31611ff 100644 --- a/Buffs/DoTDebuffs/AstralInfectionDebuff.cs +++ b/Buffs/DoTDebuffs/AstralInfectionDebuff.cs @@ -1,31 +1,30 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.DoTDebuffs { public class AstralInfectionDebuff : ModBuff - { + { public static int DefenseReduction = 8; public override void SetDefaults() - { - DisplayName.SetDefault("Astral Infection"); - Description.SetDefault("Your flesh is melting off"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + DisplayName.SetDefault("Astral Infection"); + Description.SetDefault("Your flesh is melting off"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().astralInfection = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().astralInfection = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().astralInfection = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().astralInfection = true; + } + } } diff --git a/Buffs/DoTDebuffs/BrimstoneFlames.cs b/Buffs/DoTDebuffs/BrimstoneFlames.cs index c9fbfdc180..5af03058b2 100644 --- a/Buffs/DoTDebuffs/BrimstoneFlames.cs +++ b/Buffs/DoTDebuffs/BrimstoneFlames.cs @@ -1,30 +1,28 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class BrimstoneFlames : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brimstone Flames"); - Description.SetDefault("Rapid health loss"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimstone Flames"); + Description.SetDefault("Rapid health loss"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().bFlames = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().bFlames = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().bFlames = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().bFlames = true; + } + } } diff --git a/Buffs/DoTDebuffs/BurningBlood.cs b/Buffs/DoTDebuffs/BurningBlood.cs index ce9d82aa0e..80040edeb9 100644 --- a/Buffs/DoTDebuffs/BurningBlood.cs +++ b/Buffs/DoTDebuffs/BurningBlood.cs @@ -1,30 +1,28 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class BurningBlood : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Burning Blood"); - Description.SetDefault("Your blood is on fire"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Burning Blood"); + Description.SetDefault("Your blood is on fire"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().bBlood = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().bBlood = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().bBlood = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().bBlood = true; + } + } } diff --git a/Buffs/DoTDebuffs/CrushDepth.cs b/Buffs/DoTDebuffs/CrushDepth.cs index 8a6c13f73b..b5eeec5dcd 100644 --- a/Buffs/DoTDebuffs/CrushDepth.cs +++ b/Buffs/DoTDebuffs/CrushDepth.cs @@ -1,21 +1,19 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class CrushDepth : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Crush Depth"); - Description.SetDefault("Aquatic pressure"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Crush Depth"); + Description.SetDefault("Aquatic pressure"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } public override void Update(Player player, ref int buffIndex) { @@ -23,8 +21,8 @@ namespace CalamityMod.Buffs.DoTDebuffs } public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().cDepth = true; - } - } + { + npc.Calamity().cDepth = true; + } + } } diff --git a/Buffs/DoTDebuffs/DemonFlames.cs b/Buffs/DoTDebuffs/DemonFlames.cs index 9f7248fc26..91e050b56a 100644 --- a/Buffs/DoTDebuffs/DemonFlames.cs +++ b/Buffs/DoTDebuffs/DemonFlames.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.DoTDebuffs { public class DemonFlames : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Demon Flames"); - Description.SetDefault("Another burning debuff"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Demon Flames"); + Description.SetDefault("Another burning debuff"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().dFlames = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().dFlames = true; + } + } } diff --git a/Buffs/DoTDebuffs/GodSlayerInferno.cs b/Buffs/DoTDebuffs/GodSlayerInferno.cs index 6c0d344e0f..2e4a5b2627 100644 --- a/Buffs/DoTDebuffs/GodSlayerInferno.cs +++ b/Buffs/DoTDebuffs/GodSlayerInferno.cs @@ -1,31 +1,30 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.DoTDebuffs { public class GodSlayerInferno : ModBuff - { + { public static int DefenseReduction = 20; public override void SetDefaults() - { - DisplayName.SetDefault("God Slayer Inferno"); - Description.SetDefault("Your flesh is burning off"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + DisplayName.SetDefault("God Slayer Inferno"); + Description.SetDefault("Your flesh is burning off"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().gsInferno = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().gsInferno = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().gsInferno = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().gsInferno = true; + } + } } diff --git a/Buffs/DoTDebuffs/HolyInferno.cs b/Buffs/DoTDebuffs/HolyInferno.cs index 2e8788f880..1f0512b5d9 100644 --- a/Buffs/DoTDebuffs/HolyInferno.cs +++ b/Buffs/DoTDebuffs/HolyInferno.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class HolyInferno : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Holy Inferno"); - Description.SetDefault("You've gone too far from the Profaned Goddess!"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Holy Inferno"); + Description.SetDefault("You've gone too far from the Profaned Goddess!"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().hInferno = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().hInferno = true; + } + } } diff --git a/Buffs/DoTDebuffs/HolyLight.cs b/Buffs/DoTDebuffs/HolyLight.cs index 1b7c0d73e0..f17eec5455 100644 --- a/Buffs/DoTDebuffs/HolyLight.cs +++ b/Buffs/DoTDebuffs/HolyLight.cs @@ -1,30 +1,28 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class HolyLight : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Holy Flames"); - Description.SetDefault("Dissolving from holy light"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Holy Flames"); + Description.SetDefault("Dissolving from holy light"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().hFlames = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().hFlames = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().hFlames = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().hFlames = true; + } + } } diff --git a/Buffs/DoTDebuffs/LethalLavaBurn.cs b/Buffs/DoTDebuffs/LethalLavaBurn.cs index da7b0e3470..76585c018d 100644 --- a/Buffs/DoTDebuffs/LethalLavaBurn.cs +++ b/Buffs/DoTDebuffs/LethalLavaBurn.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class LethalLavaBurn : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Lethal Lava Burn"); - Description.SetDefault("Losing life"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Lethal Lava Burn"); + Description.SetDefault("Losing life"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().lethalLavaBurn = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().lethalLavaBurn = true; + } + } } diff --git a/Buffs/DoTDebuffs/Nightwither.cs b/Buffs/DoTDebuffs/Nightwither.cs index 2ed20afb44..88922802d7 100644 --- a/Buffs/DoTDebuffs/Nightwither.cs +++ b/Buffs/DoTDebuffs/Nightwither.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.DoTDebuffs { public class Nightwither : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Nightwither"); - Description.SetDefault("Incinerated by lunar rays"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Nightwither"); + Description.SetDefault("Incinerated by lunar rays"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().nightwither = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().nightwither = true; + } + } } diff --git a/Buffs/DoTDebuffs/Plague.cs b/Buffs/DoTDebuffs/Plague.cs index e7429527c9..06c569477e 100644 --- a/Buffs/DoTDebuffs/Plague.cs +++ b/Buffs/DoTDebuffs/Plague.cs @@ -1,31 +1,30 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.DoTDebuffs { public class Plague : ModBuff - { + { public static int DefenseReduction = 4; public override void SetDefaults() - { - DisplayName.SetDefault("Plague"); - Description.SetDefault("Rotting from the inside"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + DisplayName.SetDefault("Plague"); + Description.SetDefault("Rotting from the inside"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().pFlames = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().pFlames = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().pFlames = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().pFlames = true; + } + } } diff --git a/Buffs/DoTDebuffs/Shadowflame.cs b/Buffs/DoTDebuffs/Shadowflame.cs index 7b4d64b87a..a6937d1dcb 100644 --- a/Buffs/DoTDebuffs/Shadowflame.cs +++ b/Buffs/DoTDebuffs/Shadowflame.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class Shadowflame : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shadowflame"); - Description.SetDefault("Losing life"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shadowflame"); + Description.SetDefault("Losing life"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().shadowflame = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().shadowflame = true; + } + } } diff --git a/Buffs/DoTDebuffs/Shred.cs b/Buffs/DoTDebuffs/Shred.cs index bdcafebe14..9c2b67d7a9 100644 --- a/Buffs/DoTDebuffs/Shred.cs +++ b/Buffs/DoTDebuffs/Shred.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.DoTDebuffs { public class Shred : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shred"); - Description.SetDefault("Blood"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shred"); + Description.SetDefault("Blood"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().pShred = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().pShred = true; + } + } } diff --git a/Buffs/DoTDebuffs/VulnerabilityHex.cs b/Buffs/DoTDebuffs/VulnerabilityHex.cs index 0e8521f7a1..320f05f009 100644 --- a/Buffs/DoTDebuffs/VulnerabilityHex.cs +++ b/Buffs/DoTDebuffs/VulnerabilityHex.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class VulnerabilityHex : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Vulnerability Hex"); - Description.SetDefault("You are weak"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Vulnerability Hex"); + Description.SetDefault("You are weak"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().vHex = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().vHex = true; + } + } } diff --git a/Buffs/Fabsol/BloodyMary.cs b/Buffs/Fabsol/BloodyMary.cs index 6362864e80..d0137bf4f5 100644 --- a/Buffs/Fabsol/BloodyMary.cs +++ b/Buffs/Fabsol/BloodyMary.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class BloodyMary : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Bloody Mary"); - Description.SetDefault("Damage, critical strike chance, movement speed, and melee speed boosted during a Blood Moon, life regen and defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bloody Mary"); + Description.SetDefault("Damage, critical strike chance, movement speed, and melee speed boosted during a Blood Moon, life regen and defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().bloodyMary = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().bloodyMary = true; + } + } } diff --git a/Buffs/Fabsol/BlueSpeedCandle.cs b/Buffs/Fabsol/BlueSpeedCandle.cs index e983edebbc..844184b1a8 100644 --- a/Buffs/Fabsol/BlueSpeedCandle.cs +++ b/Buffs/Fabsol/BlueSpeedCandle.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class BlueSpeedCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Limber"); - Description.SetDefault("The floating flame seems to uplift your very spirit"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Limber"); + Description.SetDefault("The floating flame seems to uplift your very spirit"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().blueCandle = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().blueCandle = true; + } + } } diff --git a/Buffs/Fabsol/CaribbeanRum.cs b/Buffs/Fabsol/CaribbeanRum.cs index 9a5d55ec57..b6703aad56 100644 --- a/Buffs/Fabsol/CaribbeanRum.cs +++ b/Buffs/Fabsol/CaribbeanRum.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class CaribbeanRum : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Caribbean Rum"); - Description.SetDefault("Life regen, movement speed, and wing flight time boosted, you are floaty and defense is reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Caribbean Rum"); + Description.SetDefault("Life regen, movement speed, and wing flight time boosted, you are floaty and defense is reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().caribbeanRum = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().caribbeanRum = true; + } + } } diff --git a/Buffs/Fabsol/CinnamonRoll.cs b/Buffs/Fabsol/CinnamonRoll.cs index 6fb706b8d6..2050d7e817 100644 --- a/Buffs/Fabsol/CinnamonRoll.cs +++ b/Buffs/Fabsol/CinnamonRoll.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class CinnamonRoll : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cinnamon Roll"); - Description.SetDefault("Mana regen rate and fire weapon damage boosted, defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cinnamon Roll"); + Description.SetDefault("Mana regen rate and fire weapon damage boosted, defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().cinnamonRoll = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().cinnamonRoll = true; + } + } } diff --git a/Buffs/Fabsol/Everclear.cs b/Buffs/Fabsol/Everclear.cs index bdb6d5f7ee..049f05e0db 100644 --- a/Buffs/Fabsol/Everclear.cs +++ b/Buffs/Fabsol/Everclear.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Everclear : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Everclear"); - Description.SetDefault("25% increased damage, -10 life regen and -40 defense"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Everclear"); + Description.SetDefault("25% increased damage, -10 life regen and -40 defense"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().everclear = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().everclear = true; + } + } } diff --git a/Buffs/Fabsol/EvergreenGin.cs b/Buffs/Fabsol/EvergreenGin.cs index 9f6972916f..2b0a4f0833 100644 --- a/Buffs/Fabsol/EvergreenGin.cs +++ b/Buffs/Fabsol/EvergreenGin.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class EvergreenGin : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Evergreen Gin"); - Description.SetDefault("Nature-based weapon damage and damage reduction boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Evergreen Gin"); + Description.SetDefault("Nature-based weapon damage and damage reduction boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().evergreenGin = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().evergreenGin = true; + } + } } diff --git a/Buffs/Fabsol/FabsolVodka.cs b/Buffs/Fabsol/FabsolVodka.cs index 9c655eb322..577c42d287 100644 --- a/Buffs/Fabsol/FabsolVodka.cs +++ b/Buffs/Fabsol/FabsolVodka.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class FabsolVodka : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fab"); - Description.SetDefault("You feel fabulous"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fab"); + Description.SetDefault("You feel fabulous"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().fabsolVodka = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().fabsolVodka = true; + } + } } diff --git a/Buffs/Fabsol/Fireball.cs b/Buffs/Fabsol/Fireball.cs index c2742b0963..fc40372400 100644 --- a/Buffs/Fabsol/Fireball.cs +++ b/Buffs/Fabsol/Fireball.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Fireball : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fireball"); - Description.SetDefault("Fire weapon damage boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fireball"); + Description.SetDefault("Fire weapon damage boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().fireball = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().fireball = true; + } + } } diff --git a/Buffs/Fabsol/GrapeBeer.cs b/Buffs/Fabsol/GrapeBeer.cs index 44fff50885..64de9346e8 100644 --- a/Buffs/Fabsol/GrapeBeer.cs +++ b/Buffs/Fabsol/GrapeBeer.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class GrapeBeer : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Grape Beer"); - Description.SetDefault("Defense and movement speed reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Grape Beer"); + Description.SetDefault("Defense and movement speed reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().grapeBeer = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().grapeBeer = true; + } + } } diff --git a/Buffs/Fabsol/Margarita.cs b/Buffs/Fabsol/Margarita.cs index be4da633b4..c15ca89e13 100644 --- a/Buffs/Fabsol/Margarita.cs +++ b/Buffs/Fabsol/Margarita.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Margarita : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Margarita"); - Description.SetDefault("Immunity to most debuffs, defense and life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Margarita"); + Description.SetDefault("Immunity to most debuffs, defense and life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().margarita = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().margarita = true; + } + } } diff --git a/Buffs/Fabsol/Moonshine.cs b/Buffs/Fabsol/Moonshine.cs index eab65b9311..181d290547 100644 --- a/Buffs/Fabsol/Moonshine.cs +++ b/Buffs/Fabsol/Moonshine.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Moonshine : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Moonshine"); - Description.SetDefault("Defense and damage reduction boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Moonshine"); + Description.SetDefault("Defense and damage reduction boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().moonshine = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().moonshine = true; + } + } } diff --git a/Buffs/Fabsol/MoscowMule.cs b/Buffs/Fabsol/MoscowMule.cs index 8409e83942..e071dc3fa5 100644 --- a/Buffs/Fabsol/MoscowMule.cs +++ b/Buffs/Fabsol/MoscowMule.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class MoscowMule : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Moscow Mule"); - Description.SetDefault("Damage, critical strike chance, and knockback boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Moscow Mule"); + Description.SetDefault("Damage, critical strike chance, and knockback boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().moscowMule = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().moscowMule = true; + } + } } diff --git a/Buffs/Fabsol/PinkHealthCandle.cs b/Buffs/Fabsol/PinkHealthCandle.cs index bbc6e7e89e..51431fb4a3 100644 --- a/Buffs/Fabsol/PinkHealthCandle.cs +++ b/Buffs/Fabsol/PinkHealthCandle.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class PinkHealthCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Vigor"); - Description.SetDefault("Its brilliant light suffuses those nearby with hope"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Vigor"); + Description.SetDefault("Its brilliant light suffuses those nearby with hope"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().pinkCandle = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().pinkCandle = true; + } + } } diff --git a/Buffs/Fabsol/PurpleDefenseCandle.cs b/Buffs/Fabsol/PurpleDefenseCandle.cs index 9d6ac5e555..e74f16bb6b 100644 --- a/Buffs/Fabsol/PurpleDefenseCandle.cs +++ b/Buffs/Fabsol/PurpleDefenseCandle.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class PurpleDefenseCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Resilience"); - Description.SetDefault("Neither rain nor wind can snuff its undying flame"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Resilience"); + Description.SetDefault("Neither rain nor wind can snuff its undying flame"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().purpleCandle = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().purpleCandle = true; + } + } } diff --git a/Buffs/Fabsol/RedWine.cs b/Buffs/Fabsol/RedWine.cs index b2bb26229d..e4f0ff3911 100644 --- a/Buffs/Fabsol/RedWine.cs +++ b/Buffs/Fabsol/RedWine.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class RedWine : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Red Wine"); - Description.SetDefault("Life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Red Wine"); + Description.SetDefault("Life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().redWine = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().redWine = true; + } + } } diff --git a/Buffs/Fabsol/Rum.cs b/Buffs/Fabsol/Rum.cs index bce074815b..abcde2eb49 100644 --- a/Buffs/Fabsol/Rum.cs +++ b/Buffs/Fabsol/Rum.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Rum : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Rum"); - Description.SetDefault("Movement speed and life regen boosted, defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Rum"); + Description.SetDefault("Movement speed and life regen boosted, defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().rum = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().rum = true; + } + } } diff --git a/Buffs/Fabsol/Screwdriver.cs b/Buffs/Fabsol/Screwdriver.cs index 0303f2a9b8..ca712a6150 100644 --- a/Buffs/Fabsol/Screwdriver.cs +++ b/Buffs/Fabsol/Screwdriver.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Screwdriver : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Screwdriver"); - Description.SetDefault("Piercing projectile damage boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Screwdriver"); + Description.SetDefault("Piercing projectile damage boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().screwdriver = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().screwdriver = true; + } + } } diff --git a/Buffs/Fabsol/StarBeamRye.cs b/Buffs/Fabsol/StarBeamRye.cs index 03dfca941f..e909f515c1 100644 --- a/Buffs/Fabsol/StarBeamRye.cs +++ b/Buffs/Fabsol/StarBeamRye.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class StarBeamRye : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Star Beam Rye"); - Description.SetDefault("Max mana and magic damage increased. Defense, mana usage, and life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Star Beam Rye"); + Description.SetDefault("Max mana and magic damage increased. Defense, mana usage, and life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().starBeamRye = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().starBeamRye = true; + } + } } diff --git a/Buffs/Fabsol/Tequila.cs b/Buffs/Fabsol/Tequila.cs index aadf7891fe..893db47222 100644 --- a/Buffs/Fabsol/Tequila.cs +++ b/Buffs/Fabsol/Tequila.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Tequila : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tequila"); - Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tequila"); + Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tequila = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().tequila = true; + } + } } diff --git a/Buffs/Fabsol/TequilaSunrise.cs b/Buffs/Fabsol/TequilaSunrise.cs index 0397304cea..0e3b1b8ef7 100644 --- a/Buffs/Fabsol/TequilaSunrise.cs +++ b/Buffs/Fabsol/TequilaSunrise.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class TequilaSunrise : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tequila Sunrise"); - Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tequila Sunrise"); + Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tequilaSunrise = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().tequilaSunrise = true; + } + } } diff --git a/Buffs/Fabsol/Trippy.cs b/Buffs/Fabsol/Trippy.cs index d6ecae3090..662efbd80f 100644 --- a/Buffs/Fabsol/Trippy.cs +++ b/Buffs/Fabsol/Trippy.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Trippy : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Trippy"); - Description.SetDefault("You see the world for what it truly is...and you also have a 50% increase to all damage"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Trippy"); + Description.SetDefault("You see the world for what it truly is...and you also have a 50% increase to all damage"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().trippy = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().trippy = true; + } + } } diff --git a/Buffs/Fabsol/Vodka.cs b/Buffs/Fabsol/Vodka.cs index cca197c7af..0820a8f260 100644 --- a/Buffs/Fabsol/Vodka.cs +++ b/Buffs/Fabsol/Vodka.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Vodka : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Vodka"); - Description.SetDefault("Damage and critical stike chance boosted, defense and life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Vodka"); + Description.SetDefault("Damage and critical stike chance boosted, defense and life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().vodka = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().vodka = true; + } + } } diff --git a/Buffs/Fabsol/Whiskey.cs b/Buffs/Fabsol/Whiskey.cs index 88621b2906..25f1eb1933 100644 --- a/Buffs/Fabsol/Whiskey.cs +++ b/Buffs/Fabsol/Whiskey.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class Whiskey : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Whiskey"); - Description.SetDefault("Damage, critical strike chance, and knockback boosted, defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Whiskey"); + Description.SetDefault("Damage, critical strike chance, and knockback boosted, defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().whiskey = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().whiskey = true; + } + } } diff --git a/Buffs/Fabsol/WhiteWine.cs b/Buffs/Fabsol/WhiteWine.cs index 210b7e5c51..40db564e03 100644 --- a/Buffs/Fabsol/WhiteWine.cs +++ b/Buffs/Fabsol/WhiteWine.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class WhiteWine : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("White Wine"); - Description.SetDefault("Magic damage boosted, life regen and defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("White Wine"); + Description.SetDefault("Magic damage boosted, life regen and defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().whiteWine = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().whiteWine = true; + } + } } diff --git a/Buffs/Fabsol/YellowDamageCandle.cs b/Buffs/Fabsol/YellowDamageCandle.cs index 8ba4d9b4e2..1a2559057e 100644 --- a/Buffs/Fabsol/YellowDamageCandle.cs +++ b/Buffs/Fabsol/YellowDamageCandle.cs @@ -1,32 +1,30 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Fabsol { public class YellowDamageCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spite"); - Description.SetDefault("Its hateful glow flickers with ire"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spite"); + Description.SetDefault("Its hateful glow flickers with ire"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().yellowCandle = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().yellowCandle = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().yellowCandle = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().yellowCandle = true; + } + } } diff --git a/Buffs/Permafrost/ConcoctionCooldown.cs b/Buffs/Permafrost/ConcoctionCooldown.cs index 17d2f47c0c..62f29e8eef 100644 --- a/Buffs/Permafrost/ConcoctionCooldown.cs +++ b/Buffs/Permafrost/ConcoctionCooldown.cs @@ -3,16 +3,16 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Permafrost { - public class ConcoctionCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Concoction Cooldown"); - Description.SetDefault("Revive is recharging"); - Main.debuff[Type] = true; + public class ConcoctionCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Concoction Cooldown"); + Description.SetDefault("Revive is recharging"); + Main.debuff[Type] = true; Main.buffNoSave[Type] = true; longerExpertDebuff = false; canBeCleared = false; - } - } + } + } } diff --git a/Buffs/Permafrost/Encased.cs b/Buffs/Permafrost/Encased.cs index 1f93c3119c..ef04ea8c52 100644 --- a/Buffs/Permafrost/Encased.cs +++ b/Buffs/Permafrost/Encased.cs @@ -5,18 +5,18 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Permafrost { public class Encased : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Encased"); - Description.SetDefault("30 defense and +30% damage reduction, but..."); - Main.debuff[Type] = true; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Encased"); + Description.SetDefault("30 defense and +30% damage reduction, but..."); + Main.debuff[Type] = true; Main.buffNoSave[Type] = true; longerExpertDebuff = false; canBeCleared = false; - } + } - public override void Update(Player player, ref int buffIndex) + public override void Update(Player player, ref int buffIndex) { player.statDefense += 30; player.endurance += 0.3f; @@ -36,5 +36,5 @@ namespace CalamityMod.Buffs.Permafrost player.immuneTime = 90; } } - } + } } diff --git a/Buffs/Permafrost/Popo.cs b/Buffs/Permafrost/Popo.cs index 7d028b6842..6769153a05 100644 --- a/Buffs/Permafrost/Popo.cs +++ b/Buffs/Permafrost/Popo.cs @@ -1,11 +1,11 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Permafrost { public class Popo : ModBuff - { + { public override void SetDefaults() { DisplayName.SetDefault("Popo"); @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.Permafrost } public override void Update(Player player, ref int buffIndex) - { + { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.snowmanPrevious) { @@ -29,5 +29,5 @@ namespace CalamityMod.Buffs.Permafrost buffIndex--; } } - } + } } diff --git a/Buffs/Permafrost/PopoNoseless.cs b/Buffs/Permafrost/PopoNoseless.cs index 8c40b62d4e..a0d074158a 100644 --- a/Buffs/Permafrost/PopoNoseless.cs +++ b/Buffs/Permafrost/PopoNoseless.cs @@ -1,11 +1,11 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Permafrost { public class PopoNoseless : ModBuff - { + { public override void SetDefaults() { DisplayName.SetDefault("Noseless Popo"); @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Permafrost } public override void Update(Player player, ref int buffIndex) - { + { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.snowmanPrevious) { @@ -29,5 +29,5 @@ namespace CalamityMod.Buffs.Permafrost buffIndex--; } } - } + } } diff --git a/Buffs/PetBuffs/AkatoYharonBuff.cs b/Buffs/PetBuffs/AkatoYharonBuff.cs index 8dbd1e8867..499971fcfe 100644 --- a/Buffs/PetBuffs/AkatoYharonBuff.cs +++ b/Buffs/PetBuffs/AkatoYharonBuff.cs @@ -1,21 +1,20 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class AkatoYharonBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Akato"); - Description.SetDefault("'Looks like you'll have to take care of it now'"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Akato"); + Description.SetDefault("'Looks like you'll have to take care of it now'"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().akato = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Akato")] <= 0; @@ -24,5 +23,5 @@ namespace CalamityMod.Buffs.PetBuffs Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Akato"), 0, 0f, player.whoAmI, 0f, 0f); } } - } + } } diff --git a/Buffs/PetBuffs/BearBuff.cs b/Buffs/PetBuffs/BearBuff.cs index bb40be2620..0d6f5ee61c 100644 --- a/Buffs/PetBuffs/BearBuff.cs +++ b/Buffs/PetBuffs/BearBuff.cs @@ -1,28 +1,27 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class BearBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Bear"); - Description.SetDefault("A guardian angel is following you."); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bear"); + Description.SetDefault("A guardian angel is following you."); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().bearPet = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Bear")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Bear"), 0, 0f, player.whoAmI, 0f, 0f); - } + } } - } + } } diff --git a/Buffs/PetBuffs/BloodBound.cs b/Buffs/PetBuffs/BloodBound.cs index 862053dd30..5a9651b1fb 100644 --- a/Buffs/PetBuffs/BloodBound.cs +++ b/Buffs/PetBuffs/BloodBound.cs @@ -1,31 +1,27 @@ using Terraria; -using Terraria.ID; using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { - public class BloodBound : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Blood Bound"); - Description.SetDefault("You must be desperate for company"); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } + public class BloodBound : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Blood Bound"); + Description.SetDefault("You must be desperate for company"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - player.Calamity().perfmini = true; - bool PetProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("PerforaMini")] <= 0; - if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + (player.height / 2), 0f, 0f, mod.ProjectileType("PerforaMini"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().perfmini = true; + bool PetProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("PerforaMini")] <= 0; + if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + (player.height / 2), 0f, 0f, mod.ProjectileType("PerforaMini"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } } diff --git a/Buffs/PetBuffs/BrimlingBuff.cs b/Buffs/PetBuffs/BrimlingBuff.cs index 9c18ff452f..088c1da795 100644 --- a/Buffs/PetBuffs/BrimlingBuff.cs +++ b/Buffs/PetBuffs/BrimlingBuff.cs @@ -1,28 +1,27 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class BrimlingBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brimling"); - Description.SetDefault("Protect her or suffer in agony"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimling"); + Description.SetDefault("Protect her or suffer in agony"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().brimling = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Brimling")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Brimling"), 0, 0f, player.whoAmI, 0f, 0f); - } + } } - } + } } diff --git a/Buffs/PetBuffs/ChibiiBuff.cs b/Buffs/PetBuffs/ChibiiBuff.cs index c9b9e12bf9..0aa5f6b53e 100644 --- a/Buffs/PetBuffs/ChibiiBuff.cs +++ b/Buffs/PetBuffs/ChibiiBuff.cs @@ -1,31 +1,30 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { - public class ChibiiBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Chibii Devourer"); - Description.SetDefault("What? Were you expecting someone else?"); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } + public class ChibiiBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chibii Devourer"); + Description.SetDefault("What? Were you expecting someone else?"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; player.Calamity().chibii = true; - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggo")] <= 0; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggo")] <= 0; - if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("ChibiiDoggo"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("ChibiiDoggo"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } } diff --git a/Buffs/PetBuffs/DannyDevito.cs b/Buffs/PetBuffs/DannyDevito.cs index 17eeafcd59..66bc19f614 100644 --- a/Buffs/PetBuffs/DannyDevito.cs +++ b/Buffs/PetBuffs/DannyDevito.cs @@ -1,28 +1,27 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class DannyDevito : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Danny Devito"); - Description.SetDefault("The trash man is following you."); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Danny Devito"); + Description.SetDefault("The trash man is following you."); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().trashMan = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("DannyDevito")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("DannyDevito"), 0, 0f, player.whoAmI, 0f, 0f); - } + } } - } + } } diff --git a/Buffs/PetBuffs/Fox.cs b/Buffs/PetBuffs/Fox.cs index cf88184259..44a2bf32a3 100644 --- a/Buffs/PetBuffs/Fox.cs +++ b/Buffs/PetBuffs/Fox.cs @@ -1,21 +1,20 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class Fox : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fox Pet"); - Description.SetDefault("Fox Pet? FOX PET"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fox Pet"); + Description.SetDefault("Fox Pet? FOX PET"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().fox = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Fox")] <= 0; @@ -24,5 +23,5 @@ namespace CalamityMod.Buffs.PetBuffs Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Fox"), 0, 0f, player.whoAmI, 0f, 0f); } } - } + } } diff --git a/Buffs/PetBuffs/Kendra.cs b/Buffs/PetBuffs/Kendra.cs index ed75b0f748..292703b828 100644 --- a/Buffs/PetBuffs/Kendra.cs +++ b/Buffs/PetBuffs/Kendra.cs @@ -1,28 +1,27 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class Kendra : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Kendra"); - Description.SetDefault("A loyal friend accompanies you."); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Kendra"); + Description.SetDefault("A loyal friend accompanies you."); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().kendra = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Kendra")] <= 0; if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) { Projectile.NewProjectile(player.position.X + (float)(player.width / 2), (player.position.Y + (float)(player.height / 2)) - 20f, 0f, 0f, mod.ProjectileType("Kendra"), 0, 0f, player.whoAmI, 0f, 0f); - } + } } - } + } } diff --git a/Buffs/PetBuffs/Levi.cs b/Buffs/PetBuffs/Levi.cs index 96d12239b9..bd929d46d0 100644 --- a/Buffs/PetBuffs/Levi.cs +++ b/Buffs/PetBuffs/Levi.cs @@ -1,21 +1,20 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class Levi : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Levi"); - Description.SetDefault("Small and cute"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Levi"); + Description.SetDefault("Small and cute"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().leviPet = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Levi")] <= 0; @@ -24,5 +23,5 @@ namespace CalamityMod.Buffs.PetBuffs Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Levi"), 0, 0f, player.whoAmI, 0f, 0f); } } - } + } } diff --git a/Buffs/PetBuffs/StrangeOrb.cs b/Buffs/PetBuffs/StrangeOrb.cs index 42104b0c83..b742e33edd 100644 --- a/Buffs/PetBuffs/StrangeOrb.cs +++ b/Buffs/PetBuffs/StrangeOrb.cs @@ -1,21 +1,20 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { public class StrangeOrb : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Young Siren"); - Description.SetDefault("Small and cute"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Young Siren"); + Description.SetDefault("Small and cute"); Main.buffNoTimeDisplay[Type] = true; Main.lightPet[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { + public override void Update(Player player, ref int buffIndex) + { player.buffTime[buffIndex] = 18000; player.Calamity().sirenPet = true; bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("SirenYoung")] <= 0; @@ -23,6 +22,6 @@ namespace CalamityMod.Buffs.PetBuffs { Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("SirenYoung"), 0, 0f, player.whoAmI, 0f, 0f); } - } - } + } + } } diff --git a/Buffs/PetBuffs/ThirdSageBuff.cs b/Buffs/PetBuffs/ThirdSageBuff.cs index cda2908ca2..1bca491ccf 100644 --- a/Buffs/PetBuffs/ThirdSageBuff.cs +++ b/Buffs/PetBuffs/ThirdSageBuff.cs @@ -1,34 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Terraria; -using Terraria.ID; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PetBuffs { - public class ThirdSageBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Third Sage"); - Description.SetDefault("Eh? No way it's an oni."); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } + public class ThirdSageBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Third Sage"); + Description.SetDefault("Eh? No way it's an oni."); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - player.Calamity().thirdSage = true; - bool PetProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ThirdSage")] <= 0; - if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + (player.height / 2), 0f, 0f, mod.ProjectileType("ThirdSage"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().thirdSage = true; + bool PetProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ThirdSage")] <= 0; + if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + (player.height / 2), 0f, 0f, mod.ProjectileType("ThirdSage"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } } diff --git a/Buffs/PotionBuffs/AbyssalWeapon.cs b/Buffs/PotionBuffs/AbyssalWeapon.cs index 6a38578294..2303782bc5 100644 --- a/Buffs/PotionBuffs/AbyssalWeapon.cs +++ b/Buffs/PotionBuffs/AbyssalWeapon.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class AbyssalWeapon : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Weapon"); - Description.SetDefault("Melee weapons inflict abyssal flames, 15% increased movement speed"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Weapon"); + Description.SetDefault("Melee weapons inflict abyssal flames, 15% increased movement speed"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().aWeapon = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().aWeapon = true; + } + } } diff --git a/Buffs/PotionBuffs/AnechoicCoating.cs b/Buffs/PotionBuffs/AnechoicCoating.cs index 436dbe289a..9b197298a4 100644 --- a/Buffs/PotionBuffs/AnechoicCoating.cs +++ b/Buffs/PotionBuffs/AnechoicCoating.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class AnechoicCoating : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Anechoic Coating"); - Description.SetDefault("Abyssal creature's detection radius reduced"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Anechoic Coating"); + Description.SetDefault("Abyssal creature's detection radius reduced"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().anechoicCoating = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().anechoicCoating = true; + } + } } diff --git a/Buffs/PotionBuffs/ArmorCrumbling.cs b/Buffs/PotionBuffs/ArmorCrumbling.cs index c1f42b6581..f35485b24f 100644 --- a/Buffs/PotionBuffs/ArmorCrumbling.cs +++ b/Buffs/PotionBuffs/ArmorCrumbling.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class ArmorCrumbling : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Armor Crumbling"); - Description.SetDefault("Melee and rogue attacks break enemy armor"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Armor Crumbling"); + Description.SetDefault("Melee and rogue attacks break enemy armor"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().armorCrumbling = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().armorCrumbling = true; + } + } } diff --git a/Buffs/PotionBuffs/ArmorShattering.cs b/Buffs/PotionBuffs/ArmorShattering.cs index f43869ad1f..9bf58c2ce4 100644 --- a/Buffs/PotionBuffs/ArmorShattering.cs +++ b/Buffs/PotionBuffs/ArmorShattering.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class ArmorShattering : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Armor Shattering"); - Description.SetDefault("Melee and rogue attacks break enemy armor"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Armor Shattering"); + Description.SetDefault("Melee and rogue attacks break enemy armor"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().armorShattering = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().armorShattering = true; + } + } } diff --git a/Buffs/PotionBuffs/AstralInjectionBuff.cs b/Buffs/PotionBuffs/AstralInjectionBuff.cs index 2c1f34a6e2..f22748f1db 100644 --- a/Buffs/PotionBuffs/AstralInjectionBuff.cs +++ b/Buffs/PotionBuffs/AstralInjectionBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class AstralInjectionBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Astral Injection"); - Description.SetDefault("Extreme mana recovery"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Astral Injection"); + Description.SetDefault("Extreme mana recovery"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().astralInjection = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().astralInjection = true; + } + } } diff --git a/Buffs/PotionBuffs/BoundingBuff.cs b/Buffs/PotionBuffs/BoundingBuff.cs index 2fe718a8a6..7d4ff2583d 100644 --- a/Buffs/PotionBuffs/BoundingBuff.cs +++ b/Buffs/PotionBuffs/BoundingBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class BoundingBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Bounding"); - Description.SetDefault("Increased jump height, jump speed, and fall damage resistance"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bounding"); + Description.SetDefault("Increased jump height, jump speed, and fall damage resistance"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().bounding = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().bounding = true; + } + } } diff --git a/Buffs/PotionBuffs/Cadence.cs b/Buffs/PotionBuffs/Cadence.cs index 7868a948ec..dd41c41d69 100644 --- a/Buffs/PotionBuffs/Cadence.cs +++ b/Buffs/PotionBuffs/Cadence.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class Cadence : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cadance"); - Description.SetDefault("Your heart is pure"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cadance"); + Description.SetDefault("Your heart is pure"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().cadence = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().cadence = true; + } + } } diff --git a/Buffs/PotionBuffs/CalciumBuff.cs b/Buffs/PotionBuffs/CalciumBuff.cs index 6d3f999e96..aedbeeb198 100644 --- a/Buffs/PotionBuffs/CalciumBuff.cs +++ b/Buffs/PotionBuffs/CalciumBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class CalciumBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Calcium"); - Description.SetDefault("You are immune to fall damage"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Calcium"); + Description.SetDefault("You are immune to fall damage"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().calcium = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().calcium = true; + } + } } diff --git a/Buffs/PotionBuffs/CeaselessHunger.cs b/Buffs/PotionBuffs/CeaselessHunger.cs index c37af3faf9..af97d09640 100644 --- a/Buffs/PotionBuffs/CeaselessHunger.cs +++ b/Buffs/PotionBuffs/CeaselessHunger.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class CeaselessHunger : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ceaseless Hunger"); - Description.SetDefault("You are sucking up all the items"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ceaseless Hunger"); + Description.SetDefault("You are sucking up all the items"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().ceaselessHunger = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().ceaselessHunger = true; + } + } } diff --git a/Buffs/PotionBuffs/DraconicSurgeBuff.cs b/Buffs/PotionBuffs/DraconicSurgeBuff.cs index a6560e460e..423299ff8c 100644 --- a/Buffs/PotionBuffs/DraconicSurgeBuff.cs +++ b/Buffs/PotionBuffs/DraconicSurgeBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class DraconicSurgeBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Draconic Surge"); - Description.SetDefault("The power of a dragon courses through your veins"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Draconic Surge"); + Description.SetDefault("The power of a dragon courses through your veins"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().draconicSurge = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().draconicSurge = true; + } + } } diff --git a/Buffs/PotionBuffs/GravityNormalizerBuff.cs b/Buffs/PotionBuffs/GravityNormalizerBuff.cs index a10576f7c5..6a535340a7 100644 --- a/Buffs/PotionBuffs/GravityNormalizerBuff.cs +++ b/Buffs/PotionBuffs/GravityNormalizerBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class GravityNormalizerBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Gravity Normalizer"); - Description.SetDefault("Gravity is now normal in space, immunity to distorted"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Gravity Normalizer"); + Description.SetDefault("Gravity is now normal in space, immunity to distorted"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().gravityNormalizer = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().gravityNormalizer = true; + } + } } diff --git a/Buffs/PotionBuffs/HolyWrathBuff.cs b/Buffs/PotionBuffs/HolyWrathBuff.cs index 234c0ee07c..e71036cac4 100644 --- a/Buffs/PotionBuffs/HolyWrathBuff.cs +++ b/Buffs/PotionBuffs/HolyWrathBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class HolyWrathBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Holy Wrath"); - Description.SetDefault("Increased damage, increased movement and flight speed, and all attacks inflict holy fire"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Holy Wrath"); + Description.SetDefault("Increased damage, increased movement and flight speed, and all attacks inflict holy fire"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().holyWrath = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().holyWrath = true; + } + } } diff --git a/Buffs/PotionBuffs/Invincible.cs b/Buffs/PotionBuffs/Invincible.cs index 0a082c4f6a..764af17abb 100644 --- a/Buffs/PotionBuffs/Invincible.cs +++ b/Buffs/PotionBuffs/Invincible.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class Invincible : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Invincible"); - Description.SetDefault("Immune to damage and most debuffs"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Invincible"); + Description.SetDefault("Immune to damage and most debuffs"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().invincible = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().invincible = true; + } + } } diff --git a/Buffs/PotionBuffs/Omniscience.cs b/Buffs/PotionBuffs/Omniscience.cs index a11cf66921..b57333ecb4 100644 --- a/Buffs/PotionBuffs/Omniscience.cs +++ b/Buffs/PotionBuffs/Omniscience.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class Omniscience : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Omniscience"); - Description.SetDefault("You can see everything"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Omniscience"); + Description.SetDefault("You can see everything"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().omniscience = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().omniscience = true; + } + } } diff --git a/Buffs/PotionBuffs/PenumbraBuff.cs b/Buffs/PotionBuffs/PenumbraBuff.cs index 4fdc3b6b50..ccd63bf7ce 100644 --- a/Buffs/PotionBuffs/PenumbraBuff.cs +++ b/Buffs/PotionBuffs/PenumbraBuff.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class PenumbraBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Penumbra"); - Description.SetDefault("Stealth regenerates at 10% speed while moving\n" + - "The boost increases to 20% at night and 30% during an eclipse"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Penumbra"); + Description.SetDefault("Stealth regenerates at 10% speed while moving\n" + + "The boost increases to 20% at night and 30% during an eclipse"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().penumbra = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().penumbra = true; + } + } } diff --git a/Buffs/PotionBuffs/PhotosynthesisBuff.cs b/Buffs/PotionBuffs/PhotosynthesisBuff.cs index 39c5954a0d..d689983660 100644 --- a/Buffs/PotionBuffs/PhotosynthesisBuff.cs +++ b/Buffs/PotionBuffs/PhotosynthesisBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class PhotosynthesisBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Photosynthesis"); - Description.SetDefault("Life regen boosted, more during daytime, and hearts heal more HP"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Photosynthesis"); + Description.SetDefault("Life regen boosted, more during daytime, and hearts heal more HP"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().photosynthesis = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().photosynthesis = true; + } + } } diff --git a/Buffs/PotionBuffs/ProfanedRageBuff.cs b/Buffs/PotionBuffs/ProfanedRageBuff.cs index 6264f48266..2e7911b74e 100644 --- a/Buffs/PotionBuffs/ProfanedRageBuff.cs +++ b/Buffs/PotionBuffs/ProfanedRageBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class ProfanedRageBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Profaned Rage"); - Description.SetDefault("Increased crit chance, increased movement and flight speed, and you gain more rage when damaged"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Profaned Rage"); + Description.SetDefault("Increased crit chance, increased movement and flight speed, and you gain more rage when damaged"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().profanedRage = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().profanedRage = true; + } + } } diff --git a/Buffs/PotionBuffs/Soaring.cs b/Buffs/PotionBuffs/Soaring.cs index 5f80de1655..d1264be325 100644 --- a/Buffs/PotionBuffs/Soaring.cs +++ b/Buffs/PotionBuffs/Soaring.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class Soaring : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Soaring"); - Description.SetDefault("Increased wing flight time and speed"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Soaring"); + Description.SetDefault("Increased wing flight time and speed"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().soaring = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().soaring = true; + } + } } diff --git a/Buffs/PotionBuffs/TitanScale.cs b/Buffs/PotionBuffs/TitanScale.cs index 374dd3711b..fea7ff08b5 100644 --- a/Buffs/PotionBuffs/TitanScale.cs +++ b/Buffs/PotionBuffs/TitanScale.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class TitanScale : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Titan Scale"); - Description.SetDefault("You feel tanky"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Titan Scale"); + Description.SetDefault("You feel tanky"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tScale = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().tScale = true; + } + } } diff --git a/Buffs/PotionBuffs/TriumphBuff.cs b/Buffs/PotionBuffs/TriumphBuff.cs index ec596244f1..0a9e3b08bf 100644 --- a/Buffs/PotionBuffs/TriumphBuff.cs +++ b/Buffs/PotionBuffs/TriumphBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class TriumphBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Triumph"); - Description.SetDefault("Enemy contact damage is reduced, the lower their health the greater the reduction"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Triumph"); + Description.SetDefault("Enemy contact damage is reduced, the lower their health the greater the reduction"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().triumph = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().triumph = true; + } + } } diff --git a/Buffs/PotionBuffs/YharimPower.cs b/Buffs/PotionBuffs/YharimPower.cs index 4031d44a8a..a760267cd5 100644 --- a/Buffs/PotionBuffs/YharimPower.cs +++ b/Buffs/PotionBuffs/YharimPower.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class YharimPower : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Yharim's Power"); - Description.SetDefault("You feel like you can break the world in two...with your bare hands!"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Yharim's Power"); + Description.SetDefault("You feel like you can break the world in two...with your bare hands!"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().yPower = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().yPower = true; + } + } } diff --git a/Buffs/PotionBuffs/Zen.cs b/Buffs/PotionBuffs/Zen.cs index e82d14cdb3..e792b1333e 100644 --- a/Buffs/PotionBuffs/Zen.cs +++ b/Buffs/PotionBuffs/Zen.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class Zen : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Zen"); - Description.SetDefault("Spawn rates are reduced"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Zen"); + Description.SetDefault("Spawn rates are reduced"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().zen = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().zen = true; + } + } } diff --git a/Buffs/PotionBuffs/Zerg.cs b/Buffs/PotionBuffs/Zerg.cs index 673e467142..2b1b2b17a3 100644 --- a/Buffs/PotionBuffs/Zerg.cs +++ b/Buffs/PotionBuffs/Zerg.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.PotionBuffs { public class Zerg : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Zerg"); - Description.SetDefault("Spawn rates are boosted"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Zerg"); + Description.SetDefault("Spawn rates are boosted"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().zerg = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().zerg = true; + } + } } diff --git a/Buffs/Shrines/ChiBuff.cs b/Buffs/Shrines/ChiBuff.cs index 0b53e7c9b0..571d316e66 100644 --- a/Buffs/Shrines/ChiBuff.cs +++ b/Buffs/Shrines/ChiBuff.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Shrines { public class ChiBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Chi"); - Description.SetDefault("Your next attack is boosted and you are more resilient"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chi"); + Description.SetDefault("Your next attack is boosted and you are more resilient"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().trinketOfChiBuff = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().trinketOfChiBuff = true; + } + } } diff --git a/Buffs/Shrines/CorruptionEffigyBuff.cs b/Buffs/Shrines/CorruptionEffigyBuff.cs index f82a2ef9f2..9d6ab0e588 100644 --- a/Buffs/Shrines/CorruptionEffigyBuff.cs +++ b/Buffs/Shrines/CorruptionEffigyBuff.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Shrines { public class CorruptionEffigyBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Corruption Effigy"); - Description.SetDefault("The corruption empowers you"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Corruption Effigy"); + Description.SetDefault("The corruption empowers you"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().corrEffigy = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().corrEffigy = true; + } + } } diff --git a/Buffs/Shrines/CrimsonEffigyBuff.cs b/Buffs/Shrines/CrimsonEffigyBuff.cs index 8f806f287a..55ccb1ca54 100644 --- a/Buffs/Shrines/CrimsonEffigyBuff.cs +++ b/Buffs/Shrines/CrimsonEffigyBuff.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Shrines { public class CrimsonEffigyBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Crimson Effigy"); - Description.SetDefault("The crimson empowers you"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Crimson Effigy"); + Description.SetDefault("The crimson empowers you"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().crimEffigy = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().crimEffigy = true; + } + } } diff --git a/Buffs/Shrines/GladiatorSwords.cs b/Buffs/Shrines/GladiatorSwords.cs index e412098e6e..948e3290a4 100644 --- a/Buffs/Shrines/GladiatorSwords.cs +++ b/Buffs/Shrines/GladiatorSwords.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.Shrines { - public class GladiatorSwords : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Gladiator Swords"); - Description.SetDefault("The gladiator swords will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class GladiatorSwords : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Gladiator Swords"); + Description.SetDefault("The gladiator swords will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("GladiatorSword")] > 0) - { - modPlayer.glSword = true; - } - if (!modPlayer.glSword) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("GladiatorSword")] > 0) + { + modPlayer.glSword = true; + } + if (!modPlayer.glSword) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index 8097f76cb3..74020ab73b 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -1,11 +1,11 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class AbyssalDivingSuitBuff : ModBuff - { + { public override void SetDefaults() { DisplayName.SetDefault("Abyssal Diving Suit"); @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.StatBuffs } public override void Update(Player player, ref int buffIndex) - { + { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.abyssalDivingSuitPrevious) { @@ -42,5 +42,5 @@ namespace CalamityMod.Buffs.StatBuffs buffIndex--; } } - } + } } diff --git a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs index 9ec35174bc..c7f51f46a2 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class AbyssalDivingSuitPlates : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Diving Suit Plates"); - Description.SetDefault("The plates will absorb 15% damage"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit Plates"); + Description.SetDefault("The plates will absorb 15% damage"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().abyssalDivingSuitPlates = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().abyssalDivingSuitPlates = true; + } + } } diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index 3e5d8d4593..f5fefad9cc 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -1,35 +1,34 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class AdrenalineMode : ModBuff - { - public static string RevTip = "150% damage boost. Can burnout down to 49.5%."; - public static string DeathTip = "500% damage boost. Can burnout down to 165%."; + { + public static string RevTip = "150% damage boost. Can burnout down to 49.5%."; + public static string DeathTip = "500% damage boost. Can burnout down to 165%."; - public override void SetDefaults() - { - DisplayName.SetDefault("Adrenaline Mode"); - Description.SetDefault(RevTip); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } + public override void SetDefaults() + { + DisplayName.SetDefault("Adrenaline Mode"); + Description.SetDefault(RevTip); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().adrenalineMode = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().adrenalineMode = true; + } - public override void ModifyBuffTip(ref string tip, ref int rare) - { - if (CalamityWorld.death) - tip = DeathTip; - } - } + public override void ModifyBuffTip(ref string tip, ref int rare) + { + if (CalamityWorld.death) + tip = DeathTip; + } + } } diff --git a/Buffs/StatBuffs/Afflicted.cs b/Buffs/StatBuffs/Afflicted.cs index 4a6ea38c30..6ea97370ef 100644 --- a/Buffs/StatBuffs/Afflicted.cs +++ b/Buffs/StatBuffs/Afflicted.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class Afflicted : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Afflicted"); - Description.SetDefault("Empowered by otherworldly spirits"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Afflicted"); + Description.SetDefault("Empowered by otherworldly spirits"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().afflicted = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().afflicted = true; + } + } } diff --git a/Buffs/StatBuffs/ChaosCandle.cs b/Buffs/StatBuffs/ChaosCandle.cs index 80bf7b6b5d..552c9c241e 100644 --- a/Buffs/StatBuffs/ChaosCandle.cs +++ b/Buffs/StatBuffs/ChaosCandle.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class ChaosCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Chaos Candle"); - Description.SetDefault("Spawn rates around the candle are boosted!"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chaos Candle"); + Description.SetDefault("Spawn rates around the candle are boosted!"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().chaosCandle = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().chaosCandle = true; + } + } } diff --git a/Buffs/StatBuffs/CosmicFreeze.cs b/Buffs/StatBuffs/CosmicFreeze.cs index e1a9ab5ff2..9e49557b03 100644 --- a/Buffs/StatBuffs/CosmicFreeze.cs +++ b/Buffs/StatBuffs/CosmicFreeze.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class CosmicFreeze : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cosmic Freeze"); - Description.SetDefault("You feel as cold as the empty expanse of outer space"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmic Freeze"); + Description.SetDefault("You feel as cold as the empty expanse of outer space"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().cFreeze = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().cFreeze = true; + } + } } diff --git a/Buffs/StatBuffs/GodSlayerCooldown.cs b/Buffs/StatBuffs/GodSlayerCooldown.cs index 518bd2ae20..c3c43269db 100644 --- a/Buffs/StatBuffs/GodSlayerCooldown.cs +++ b/Buffs/StatBuffs/GodSlayerCooldown.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class GodSlayerCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("God Slayer Cooldown"); - Description.SetDefault("10% increase to all damage; godslayer effect is recharging"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("God Slayer Cooldown"); + Description.SetDefault("10% increase to all damage; godslayer effect is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().godSlayerCooldown = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().godSlayerCooldown = true; + } + } } diff --git a/Buffs/StatBuffs/GraxDefense.cs b/Buffs/StatBuffs/GraxDefense.cs index 6c45122957..7e8c832b84 100644 --- a/Buffs/StatBuffs/GraxDefense.cs +++ b/Buffs/StatBuffs/GraxDefense.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class GraxDefense : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Grax Boost"); - Description.SetDefault("Your defenses and muscles are strong"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Grax Boost"); + Description.SetDefault("Your defenses and muscles are strong"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().graxDefense = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().graxDefense = true; + } + } } diff --git a/Buffs/StatBuffs/HeartAttack.cs b/Buffs/StatBuffs/HeartAttack.cs index b5b47217fc..bd45f1b4de 100644 --- a/Buffs/StatBuffs/HeartAttack.cs +++ b/Buffs/StatBuffs/HeartAttack.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class HeartAttack : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Absolute Rage"); - Description.SetDefault("Your anger has made you more durable. Boosts max life by 5%."); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Absolute Rage"); + Description.SetDefault("Your anger has made you more durable. Boosts max life by 5%."); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().hAttack = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().hAttack = true; + } + } } diff --git a/Buffs/StatBuffs/IceShieldBuff.cs b/Buffs/StatBuffs/IceShieldBuff.cs index 211c321e52..8ddcc2408f 100644 --- a/Buffs/StatBuffs/IceShieldBuff.cs +++ b/Buffs/StatBuffs/IceShieldBuff.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class IceShieldBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ice Shield"); - Description.SetDefault("Absorbs 15% damage from the next hit you take, then shatters"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Shield"); + Description.SetDefault("Absorbs 15% damage from the next hit you take, then shatters"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sirenIce = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sirenIce = true; + } + } } diff --git a/Buffs/StatBuffs/Molten.cs b/Buffs/StatBuffs/Molten.cs index 7d43519dbd..4671568990 100644 --- a/Buffs/StatBuffs/Molten.cs +++ b/Buffs/StatBuffs/Molten.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class Molten : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Molten"); - Description.SetDefault("Resistant to cold effects"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Molten"); + Description.SetDefault("Resistant to cold effects"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().molten = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().molten = true; + } + } } diff --git a/Buffs/StatBuffs/Mushy.cs b/Buffs/StatBuffs/Mushy.cs index 0abce57ab5..c33fee1b9c 100644 --- a/Buffs/StatBuffs/Mushy.cs +++ b/Buffs/StatBuffs/Mushy.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class Mushy : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Mushy"); - Description.SetDefault("Increased defense and life regen"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mushy"); + Description.SetDefault("Increased defense and life regen"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().mushy = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().mushy = true; + } + } } diff --git a/Buffs/StatBuffs/RageMode.cs b/Buffs/StatBuffs/RageMode.cs index 31846541cd..9e4e76b70c 100644 --- a/Buffs/StatBuffs/RageMode.cs +++ b/Buffs/StatBuffs/RageMode.cs @@ -1,35 +1,34 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class RageMode : ModBuff - { - public static string RevTip = "50% damage boost. Can be boosted by other items up to 110%."; - public static string DeathTip = "170% damage boost. Can be boosted by other items up to 350%."; + { + public static string RevTip = "50% damage boost. Can be boosted by other items up to 110%."; + public static string DeathTip = "170% damage boost. Can be boosted by other items up to 350%."; - public override void SetDefaults() - { - DisplayName.SetDefault("Rage Mode"); - Description.SetDefault(RevTip); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } + public override void SetDefaults() + { + DisplayName.SetDefault("Rage Mode"); + Description.SetDefault(RevTip); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().rageMode = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().rageMode = true; + } - public override void ModifyBuffTip(ref string tip, ref int rare) - { - if (CalamityWorld.death) - tip = DeathTip; - } - } + public override void ModifyBuffTip(ref string tip, ref int rare) + { + if (CalamityWorld.death) + tip = DeathTip; + } + } } diff --git a/Buffs/StatBuffs/ReaverRage.cs b/Buffs/StatBuffs/ReaverRage.cs index 5d8952a766..02471e7e62 100644 --- a/Buffs/StatBuffs/ReaverRage.cs +++ b/Buffs/StatBuffs/ReaverRage.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class ReaverRage : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Reaver Rage"); - Description.SetDefault("You are angry"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Reaver Rage"); + Description.SetDefault("You are angry"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().rRage = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().rRage = true; + } + } } diff --git a/Buffs/StatBuffs/ScarfMeleeBoost.cs b/Buffs/StatBuffs/ScarfMeleeBoost.cs index ba9981ec1a..940411c84d 100644 --- a/Buffs/StatBuffs/ScarfMeleeBoost.cs +++ b/Buffs/StatBuffs/ScarfMeleeBoost.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class ScarfMeleeBoost : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Scarf Boost"); - Description.SetDefault("10% increased damage, 5% increased crit chance, and 10% increased melee speed"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Scarf Boost"); + Description.SetDefault("10% increased damage, 5% increased crit chance, and 10% increased melee speed"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sMeleeBoost = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sMeleeBoost = true; + } + } } diff --git a/Buffs/StatBuffs/ShellBoost.cs b/Buffs/StatBuffs/ShellBoost.cs index de8f4c196e..1e146bc8fb 100644 --- a/Buffs/StatBuffs/ShellBoost.cs +++ b/Buffs/StatBuffs/ShellBoost.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class ShellBoost : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shell Speed Boost"); - Description.SetDefault("Speed is boosted"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shell Speed Boost"); + Description.SetDefault("Speed is boosted"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().shellBoost = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().shellBoost = true; + } + } } diff --git a/Buffs/StatBuffs/SilvaRevival.cs b/Buffs/StatBuffs/SilvaRevival.cs index 6a39d07737..d7bc1578e8 100644 --- a/Buffs/StatBuffs/SilvaRevival.cs +++ b/Buffs/StatBuffs/SilvaRevival.cs @@ -1,20 +1,19 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class SilvaRevival : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Silva Invulnerability"); - Description.SetDefault("You are invulnerable"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Silva Invulnerability"); + Description.SetDefault("You are invulnerable"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + } } diff --git a/Buffs/StatBuffs/SirenBobs.cs b/Buffs/StatBuffs/SirenBobs.cs index 4a2a74c4ce..d8febe02a0 100644 --- a/Buffs/StatBuffs/SirenBobs.cs +++ b/Buffs/StatBuffs/SirenBobs.cs @@ -1,11 +1,11 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class SirenBobs : ModBuff - { + { public override void SetDefaults() { DisplayName.SetDefault("Siren"); @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.StatBuffs } public override void Update(Player player, ref int buffIndex) - { + { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.sirenBoobsPrevious) { @@ -48,5 +48,5 @@ namespace CalamityMod.Buffs.StatBuffs buffIndex--; } } - } + } } diff --git a/Buffs/StatBuffs/SirenBobsAlt.cs b/Buffs/StatBuffs/SirenBobsAlt.cs index 90b1850dfd..7a2b8348e8 100644 --- a/Buffs/StatBuffs/SirenBobsAlt.cs +++ b/Buffs/StatBuffs/SirenBobsAlt.cs @@ -1,11 +1,11 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class SirenBobsAlt : ModBuff - { + { public override void SetDefaults() { DisplayName.SetDefault("Siren"); @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.StatBuffs } public override void Update(Player player, ref int buffIndex) - { + { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.sirenBoobsAltPrevious) { @@ -41,12 +41,12 @@ namespace CalamityMod.Buffs.StatBuffs { player.AddBuff(mod.BuffType("SirenWaterSpeed"), 360); } - } + } else { player.DelBuff(buffIndex); buffIndex--; } } - } + } } diff --git a/Buffs/StatBuffs/SirenWaterSpeed.cs b/Buffs/StatBuffs/SirenWaterSpeed.cs index d558f3c884..d26aa2fbc2 100644 --- a/Buffs/StatBuffs/SirenWaterSpeed.cs +++ b/Buffs/StatBuffs/SirenWaterSpeed.cs @@ -1,11 +1,10 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class SirenWaterSpeed : ModBuff - { + { public override void SetDefaults() { DisplayName.SetDefault("Siren Speed"); @@ -17,8 +16,8 @@ namespace CalamityMod.Buffs.StatBuffs } public override void Update(Player player, ref int buffIndex) - { + { player.Calamity().sirenWaterBuff = true; } - } + } } diff --git a/Buffs/StatBuffs/TarraLifeRegen.cs b/Buffs/StatBuffs/TarraLifeRegen.cs index 5448e6d1f9..08d5c7872d 100644 --- a/Buffs/StatBuffs/TarraLifeRegen.cs +++ b/Buffs/StatBuffs/TarraLifeRegen.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class TarraLifeRegen : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tarra Life"); - Description.SetDefault("Rapid healing"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tarra Life"); + Description.SetDefault("Rapid healing"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tRegen = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().tRegen = true; + } + } } diff --git a/Buffs/StatBuffs/TranquilityCandle.cs b/Buffs/StatBuffs/TranquilityCandle.cs index 22cd1014c4..b130486793 100644 --- a/Buffs/StatBuffs/TranquilityCandle.cs +++ b/Buffs/StatBuffs/TranquilityCandle.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class TranquilityCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tranquility Candle"); - Description.SetDefault("Spawn rates around the candle are reduced!"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tranquility Candle"); + Description.SetDefault("Spawn rates around the candle are reduced!"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tranquilityCandle = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().tranquilityCandle = true; + } + } } diff --git a/Buffs/StatBuffs/TyrantsFury.cs b/Buffs/StatBuffs/TyrantsFury.cs index 98be55d9e7..488b5e5a65 100644 --- a/Buffs/StatBuffs/TyrantsFury.cs +++ b/Buffs/StatBuffs/TyrantsFury.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class TyrantsFury : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tyrant's Fury"); - Description.SetDefault("30% increased melee damage and 10% increased melee crit chance"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tyrant's Fury"); + Description.SetDefault("30% increased melee damage and 10% increased melee crit chance"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tFury = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().tFury = true; + } + } } diff --git a/Buffs/StatBuffs/XerocRage.cs b/Buffs/StatBuffs/XerocRage.cs index feec7a258a..746b5e931a 100644 --- a/Buffs/StatBuffs/XerocRage.cs +++ b/Buffs/StatBuffs/XerocRage.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class XerocRage : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Xeroc Rage"); - Description.SetDefault("Rage of the cosmos"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Xeroc Rage"); + Description.SetDefault("Rage of the cosmos"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().xRage = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().xRage = true; + } + } } diff --git a/Buffs/StatBuffs/XerocWrath.cs b/Buffs/StatBuffs/XerocWrath.cs index cc0cc8b00e..12e00dedc4 100644 --- a/Buffs/StatBuffs/XerocWrath.cs +++ b/Buffs/StatBuffs/XerocWrath.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatBuffs { public class XerocWrath : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Xeroc Wrath"); - Description.SetDefault("Wrath of the cosmos"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Xeroc Wrath"); + Description.SetDefault("Wrath of the cosmos"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().xWrath = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().xWrath = true; + } + } } diff --git a/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs b/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs index de39675b32..5d52446bc4 100644 --- a/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs +++ b/Buffs/StatDebuffs/AbyssalDivingSuitPlatesBroken.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class AbyssalDivingSuitPlatesBroken : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Diving Suit Plates Broken"); - Description.SetDefault("The plates are regenerating"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit Plates Broken"); + Description.SetDefault("The plates are regenerating"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().abyssalDivingSuitCooldown = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().abyssalDivingSuitCooldown = true; + } + } } diff --git a/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs b/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs index bf02b22d2d..2454ed80db 100644 --- a/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs +++ b/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class AbyssalMirrorCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Evade Cooldown"); - Description.SetDefault("Your Abyssal Mirror's dodge is recharging"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Evade Cooldown"); + Description.SetDefault("Your Abyssal Mirror's dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().abyssalMirrorCooldown = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().abyssalMirrorCooldown = true; + } + } } diff --git a/Buffs/StatDebuffs/ArmorCrunch.cs b/Buffs/StatDebuffs/ArmorCrunch.cs index b0289f89f3..f55c53f4dd 100644 --- a/Buffs/StatDebuffs/ArmorCrunch.cs +++ b/Buffs/StatDebuffs/ArmorCrunch.cs @@ -1,16 +1,14 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class ArmorCrunch : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Armor Crunch"); - Description.SetDefault("Your armor is shredded"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Armor Crunch"); + Description.SetDefault("Your armor is shredded"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -18,10 +16,10 @@ namespace CalamityMod.Buffs.StatDebuffs canBeCleared = false; } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().aCrunch = true; - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().aCrunch = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/StatDebuffs/BurntOut.cs b/Buffs/StatDebuffs/BurntOut.cs index 03f1feebcf..18d3ce634e 100644 --- a/Buffs/StatDebuffs/BurntOut.cs +++ b/Buffs/StatDebuffs/BurntOut.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class BurntOut : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Burnt Out"); - Description.SetDefault("You've been burnt out and your guardians are less effective"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Burnt Out"); + Description.SetDefault("You've been burnt out and your guardians are less effective"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().bOut = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().bOut = true; + } + } } diff --git a/Buffs/StatDebuffs/EclipseMirrorCooldown.cs b/Buffs/StatDebuffs/EclipseMirrorCooldown.cs index 2f9e61f36d..f1429523c4 100644 --- a/Buffs/StatDebuffs/EclipseMirrorCooldown.cs +++ b/Buffs/StatDebuffs/EclipseMirrorCooldown.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class EclipseMirrorCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Eclipse Evade Cooldown"); - Description.SetDefault("Your Eclipse Mirror's dodge is recharging"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Eclipse Evade Cooldown"); + Description.SetDefault("Your Eclipse Mirror's dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().eclipseMirrorCooldown = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().eclipseMirrorCooldown = true; + } + } } diff --git a/Buffs/StatDebuffs/Enraged.cs b/Buffs/StatDebuffs/Enraged.cs index 6bc0573b34..4d55aa45d9 100644 --- a/Buffs/StatDebuffs/Enraged.cs +++ b/Buffs/StatDebuffs/Enraged.cs @@ -1,27 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class Enraged : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Enraged"); - Description.SetDefault("All damage taken is increased by 25%"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Enraged"); + Description.SetDefault("All damage taken is increased by 25%"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().enraged = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().enraged = true; + } public override void Update(NPC npc, ref int buffIndex) { diff --git a/Buffs/StatDebuffs/ExoFreeze.cs b/Buffs/StatDebuffs/ExoFreeze.cs index cb15bbc19d..1d12a4fba5 100644 --- a/Buffs/StatDebuffs/ExoFreeze.cs +++ b/Buffs/StatDebuffs/ExoFreeze.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.StatDebuffs { public class ExoFreeze : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Exo Freeze"); - Description.SetDefault("Cannot move"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Exo Freeze"); + Description.SetDefault("Cannot move"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().eFreeze = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().eFreeze = true; + } + } } diff --git a/Buffs/StatDebuffs/ExtremeGrav.cs b/Buffs/StatDebuffs/ExtremeGrav.cs index ffec873fd3..08ef77d077 100644 --- a/Buffs/StatDebuffs/ExtremeGrav.cs +++ b/Buffs/StatDebuffs/ExtremeGrav.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class ExtremeGrav : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Extreme Gravity"); - Description.SetDefault("Your wing time is reduced by 50%, infinite flight is disabled"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Extreme Gravity"); + Description.SetDefault("Your wing time is reduced by 50%, infinite flight is disabled"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().eGrav = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().eGrav = true; + } + } } diff --git a/Buffs/StatDebuffs/ExtremeGravity.cs b/Buffs/StatDebuffs/ExtremeGravity.cs index 13e4b4a9f4..2bfb98fd8b 100644 --- a/Buffs/StatDebuffs/ExtremeGravity.cs +++ b/Buffs/StatDebuffs/ExtremeGravity.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class ExtremeGravity : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Icarus' Folly"); - Description.SetDefault("Your wing time is reduced by 75%, infinite flight is disabled"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Icarus' Folly"); + Description.SetDefault("Your wing time is reduced by 75%, infinite flight is disabled"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().eGravity = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().eGravity = true; + } + } } diff --git a/Buffs/StatDebuffs/FishAlert.cs b/Buffs/StatDebuffs/FishAlert.cs index 2fda86562e..1fc6e14abe 100644 --- a/Buffs/StatDebuffs/FishAlert.cs +++ b/Buffs/StatDebuffs/FishAlert.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class FishAlert : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fish Alert"); - Description.SetDefault("The abyssal creatures have spotted you!"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fish Alert"); + Description.SetDefault("The abyssal creatures have spotted you!"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().fishAlert = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().fishAlert = true; + } + } } diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index 6d815095fe..a6f61797ba 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -1,30 +1,28 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class GlacialState : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Glacial State"); - Description.SetDefault("Cannot move and defense is shattered"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Glacial State"); + Description.SetDefault("Cannot move and defense is shattered"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().gState = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().gState = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().gState = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().gState = true; + } + } } diff --git a/Buffs/StatDebuffs/Horror.cs b/Buffs/StatDebuffs/Horror.cs index f2da405693..f1ea0d09cf 100644 --- a/Buffs/StatDebuffs/Horror.cs +++ b/Buffs/StatDebuffs/Horror.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class Horror : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Horror"); - Description.SetDefault("The horror..."); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Horror"); + Description.SetDefault("The horror..."); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().horror = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().horror = true; + } + } } diff --git a/Buffs/StatDebuffs/IceShieldBrokenBuff.cs b/Buffs/StatDebuffs/IceShieldBrokenBuff.cs index 76ecbf194b..e4a42fef36 100644 --- a/Buffs/StatDebuffs/IceShieldBrokenBuff.cs +++ b/Buffs/StatDebuffs/IceShieldBrokenBuff.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class IceShieldBrokenBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ice Shield Cooldown"); - Description.SetDefault("The shield is regenerating"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Shield Cooldown"); + Description.SetDefault("The shield is regenerating"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sirenIceCooldown = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sirenIceCooldown = true; + } + } } diff --git a/Buffs/StatDebuffs/InkBombCooldown.cs b/Buffs/StatDebuffs/InkBombCooldown.cs index ad0e0b0601..907990eba4 100644 --- a/Buffs/StatDebuffs/InkBombCooldown.cs +++ b/Buffs/StatDebuffs/InkBombCooldown.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class InkBombCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ink Bomb Cooldown"); - Description.SetDefault("Your Ink Bomb is recharging"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ink Bomb Cooldown"); + Description.SetDefault("Your Ink Bomb is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().inkBombCooldown = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().inkBombCooldown = true; + } + } } diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index e3ba7cac19..668c2be56f 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -1,32 +1,30 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class Irradiated : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Acid Rain"); - Description.SetDefault("Your skin is burning off"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Acid Rain"); + Description.SetDefault("Your skin is burning off"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().irradiated = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().irradiated = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().irradiated = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().irradiated = true; + } + } } diff --git a/Buffs/StatDebuffs/MarkedforDeath.cs b/Buffs/StatDebuffs/MarkedforDeath.cs index 61079d7b30..dfc8088f78 100644 --- a/Buffs/StatDebuffs/MarkedforDeath.cs +++ b/Buffs/StatDebuffs/MarkedforDeath.cs @@ -1,30 +1,28 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class MarkedforDeath : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Marked"); - Description.SetDefault("Damage reduction reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Marked"); + Description.SetDefault("Damage reduction reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().marked = true; - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().marked = true; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().marked = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().marked = true; + } + } } diff --git a/Buffs/StatDebuffs/ScarfCooldown.cs b/Buffs/StatDebuffs/ScarfCooldown.cs index 1c16d4a6b2..377d711756 100644 --- a/Buffs/StatDebuffs/ScarfCooldown.cs +++ b/Buffs/StatDebuffs/ScarfCooldown.cs @@ -1,25 +1,24 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class ScarfCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Scarf Cooldown"); - Description.SetDefault("Your dodge is recharging"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Scarf Cooldown"); + Description.SetDefault("Your dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().scarfCooldown = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().scarfCooldown = true; + } + } } diff --git a/Buffs/StatDebuffs/SilvaStun.cs b/Buffs/StatDebuffs/SilvaStun.cs index 203e75f8bb..ab36d7233e 100644 --- a/Buffs/StatDebuffs/SilvaStun.cs +++ b/Buffs/StatDebuffs/SilvaStun.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.StatDebuffs { public class SilvaStun : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Silva Stun"); - Description.SetDefault("Can't move"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Silva Stun"); + Description.SetDefault("Can't move"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().silvaStun = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().silvaStun = true; + } + } } diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index 2bba3cd86a..89489d7bcf 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.StatDebuffs { public class TemporalSadness : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Temporal Sadness"); - Description.SetDefault("You are crying"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Temporal Sadness"); + Description.SetDefault("You are crying"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().tSad = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().tSad = true; + } + } } diff --git a/Buffs/StatDebuffs/TimeSlow.cs b/Buffs/StatDebuffs/TimeSlow.cs index 4b0ffd4162..a04f8d7d9c 100644 --- a/Buffs/StatDebuffs/TimeSlow.cs +++ b/Buffs/StatDebuffs/TimeSlow.cs @@ -1,16 +1,14 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class TimeSlow : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Time Distortion"); - Description.SetDefault("Time is slowed"); + { + public override void SetDefaults() + { + DisplayName.SetDefault("Time Distortion"); + Description.SetDefault("Time is slowed"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -18,10 +16,10 @@ namespace CalamityMod.Buffs.StatDebuffs canBeCleared = false; } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().timeSlow = true; - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().timeSlow = true; + } /*public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/StatDebuffs/WarCleave.cs b/Buffs/StatDebuffs/WarCleave.cs index 294d22a71e..1abfaf5c8f 100644 --- a/Buffs/StatDebuffs/WarCleave.cs +++ b/Buffs/StatDebuffs/WarCleave.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.StatDebuffs { public class WarCleave : ModBuff - { + { public static int DefenseReduction = 15; public override void SetDefaults() - { - DisplayName.SetDefault("War Cleave"); - Description.SetDefault("Defense and protection reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } + { + DisplayName.SetDefault("War Cleave"); + Description.SetDefault("Defense and protection reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().wCleave = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().wCleave = true; + } + } } diff --git a/Buffs/StatDebuffs/Warped.cs b/Buffs/StatDebuffs/Warped.cs index a19b8ba2c0..8a46d0ff91 100644 --- a/Buffs/StatDebuffs/Warped.cs +++ b/Buffs/StatDebuffs/Warped.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class Warped : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Warped"); - Description.SetDefault("Movement is being warped"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Warped"); + Description.SetDefault("Movement is being warped"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().warped = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().warped = true; + } + } } diff --git a/Buffs/StatDebuffs/WeakPetrification.cs b/Buffs/StatDebuffs/WeakPetrification.cs index 9b4030d389..afb0e2fdf0 100644 --- a/Buffs/StatDebuffs/WeakPetrification.cs +++ b/Buffs/StatDebuffs/WeakPetrification.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class WeakPetrification : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Weak Petrification"); - Description.SetDefault("Your vertical movement is weakened"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Weak Petrification"); + Description.SetDefault("Your vertical movement is weakened"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().weakPetrification = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().weakPetrification = true; + } + } } diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index 2901538c13..7c5ee47327 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -1,31 +1,30 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.StatDebuffs { public class WhisperingDeath : ModBuff - { + { public static int DefenseReduction = 50; public override void SetDefaults() - { - DisplayName.SetDefault("Whispering Death"); - Description.SetDefault("Death approaches; defense, attack power, and life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + DisplayName.SetDefault("Whispering Death"); + Description.SetDefault("Death approaches; defense, attack power, and life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().wDeath = true; - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().wDeath = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().wDeath = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().wDeath = true; + } + } } diff --git a/Buffs/SummonBuffs/AngryChicken.cs b/Buffs/SummonBuffs/AngryChicken.cs index 0b10369a34..e2a023e2e0 100644 --- a/Buffs/SummonBuffs/AngryChicken.cs +++ b/Buffs/SummonBuffs/AngryChicken.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class AngryChicken : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Son of Yharon"); - Description.SetDefault("The Son of Yharon will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class AngryChicken : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Son of Yharon"); + Description.SetDefault("The Son of Yharon will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] > 0) - { - modPlayer.aChicken = true; - } - if (!modPlayer.aChicken) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] > 0) + { + modPlayer.aChicken = true; + } + if (!modPlayer.aChicken) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/AquaticStar.cs b/Buffs/SummonBuffs/AquaticStar.cs index a2a3b98d84..ea8436a0ca 100644 --- a/Buffs/SummonBuffs/AquaticStar.cs +++ b/Buffs/SummonBuffs/AquaticStar.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class AquaticStar : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Aquatic Star"); - Description.SetDefault("The aquatic star will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class AquaticStar : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Aquatic Star"); + Description.SetDefault("The aquatic star will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("AquaticStar")] > 0) - { - modPlayer.aStar = true; - } - if (!modPlayer.aStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("AquaticStar")] > 0) + { + modPlayer.aStar = true; + } + if (!modPlayer.aStar) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/BlackHawkBuff.cs b/Buffs/SummonBuffs/BlackHawkBuff.cs index 10cf1c845b..005b3e697d 100644 --- a/Buffs/SummonBuffs/BlackHawkBuff.cs +++ b/Buffs/SummonBuffs/BlackHawkBuff.cs @@ -1,35 +1,35 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class BlackHawkBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Black Hawk"); - Description.SetDefault("The fighter jet will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class BlackHawkBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Black Hawk"); + Description.SetDefault("The fighter jet will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("BlackHawkSummon")] > 0) - { - modPlayer.blackhawk = true; - } - if (!modPlayer.blackhawk) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("BlackHawkSummon")] > 0) + { + modPlayer.blackhawk = true; + } + if (!modPlayer.blackhawk) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/BloodClot.cs b/Buffs/SummonBuffs/BloodClot.cs index e4ae2f4f06..cc9ba9effe 100644 --- a/Buffs/SummonBuffs/BloodClot.cs +++ b/Buffs/SummonBuffs/BloodClot.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class BloodClot : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Blood Clot"); - Description.SetDefault("The blood clot will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class BloodClot : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Blood Clot"); + Description.SetDefault("The blood clot will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("BloodClotMinion")] > 0) - { - modPlayer.bClot = true; - } - if (!modPlayer.bClot) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("BloodClotMinion")] > 0) + { + modPlayer.bClot = true; + } + if (!modPlayer.bClot) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/BrimstoneWaifu.cs b/Buffs/SummonBuffs/BrimstoneWaifu.cs index a2dd1d4c14..2bd2ae0b1d 100644 --- a/Buffs/SummonBuffs/BrimstoneWaifu.cs +++ b/Buffs/SummonBuffs/BrimstoneWaifu.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class BrimstoneWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Description.SetDefault("The brimstone elemental will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class BrimstoneWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimstone Elemental"); + Description.SetDefault("The brimstone elemental will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 0) - { - modPlayer.bWaifu = true; - } - if (!modPlayer.bWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 0) + { + modPlayer.bWaifu = true; + } + if (!modPlayer.bWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/BrittleStar.cs b/Buffs/SummonBuffs/BrittleStar.cs index b05e03494e..4610ea984e 100644 --- a/Buffs/SummonBuffs/BrittleStar.cs +++ b/Buffs/SummonBuffs/BrittleStar.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class BrittleStar : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brittle Star"); - Description.SetDefault("The brittle star will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class BrittleStar : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brittle Star"); + Description.SetDefault("The brittle star will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("BrittleStar")] > 0) - { - modPlayer.bStar = true; - } - if (!modPlayer.bStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("BrittleStar")] > 0) + { + modPlayer.bStar = true; + } + if (!modPlayer.bStar) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Calamari.cs b/Buffs/SummonBuffs/Calamari.cs index f17890e545..86ad68674e 100644 --- a/Buffs/SummonBuffs/Calamari.cs +++ b/Buffs/SummonBuffs/Calamari.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Calamari : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Calamari"); - Description.SetDefault("The squid will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Calamari : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Calamari"); + Description.SetDefault("The squid will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Calamari")] > 0) - { - modPlayer.calamari = true; - } - if (!modPlayer.calamari) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Calamari")] > 0) + { + modPlayer.calamari = true; + } + if (!modPlayer.calamari) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/CalamitasEyes.cs b/Buffs/SummonBuffs/CalamitasEyes.cs index bcc5ff4e4e..63ed9a75c0 100644 --- a/Buffs/SummonBuffs/CalamitasEyes.cs +++ b/Buffs/SummonBuffs/CalamitasEyes.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class CalamitasEyes : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Blighted Eyes"); - Description.SetDefault("Calamitas and her brothers will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class CalamitasEyes : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Blighted Eyes"); + Description.SetDefault("Calamitas and her brothers will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Calamitamini")] > 0) - { - modPlayer.cEyes = true; - } - if (!modPlayer.cEyes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Calamitamini")] > 0) + { + modPlayer.cEyes = true; + } + if (!modPlayer.cEyes) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/ChaosSpirit.cs b/Buffs/SummonBuffs/ChaosSpirit.cs index 9b41fa9fb7..99d4751a64 100644 --- a/Buffs/SummonBuffs/ChaosSpirit.cs +++ b/Buffs/SummonBuffs/ChaosSpirit.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class ChaosSpirit : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Chaos Spirit"); - Description.SetDefault("The chaos spirit will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class ChaosSpirit : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chaos Spirit"); + Description.SetDefault("The chaos spirit will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("ChaosSpirit")] > 0) - { - modPlayer.cSpirit = true; - } - if (!modPlayer.cSpirit) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("ChaosSpirit")] > 0) + { + modPlayer.cSpirit = true; + } + if (!modPlayer.cSpirit) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/CloudyWaifu.cs b/Buffs/SummonBuffs/CloudyWaifu.cs index 0e2162fbe0..32d6ea51c7 100644 --- a/Buffs/SummonBuffs/CloudyWaifu.cs +++ b/Buffs/SummonBuffs/CloudyWaifu.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class CloudyWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cloud Elemental"); - Description.SetDefault("The cloud elemental will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class CloudyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cloud Elemental"); + Description.SetDefault("The cloud elemental will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 0) - { - modPlayer.cWaifu = true; - } - if (!modPlayer.cWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 0) + { + modPlayer.cWaifu = true; + } + if (!modPlayer.cWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Corroslime.cs b/Buffs/SummonBuffs/Corroslime.cs index 640fb2a3e9..fa36906747 100644 --- a/Buffs/SummonBuffs/Corroslime.cs +++ b/Buffs/SummonBuffs/Corroslime.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Corroslime : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Corroslime"); - Description.SetDefault("The corroslime will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Corroslime : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Corroslime"); + Description.SetDefault("The corroslime will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Corroslime")] > 0) - { - modPlayer.cSlime = true; - } - if (!modPlayer.cSlime) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Corroslime")] > 0) + { + modPlayer.cSlime = true; + } + if (!modPlayer.cSlime) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/CosmicEnergy.cs b/Buffs/SummonBuffs/CosmicEnergy.cs index 185a78d4d9..40ad469fda 100644 --- a/Buffs/SummonBuffs/CosmicEnergy.cs +++ b/Buffs/SummonBuffs/CosmicEnergy.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class CosmicEnergy : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cosmic Energy"); - Description.SetDefault("The cosmic energy will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class CosmicEnergy : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmic Energy"); + Description.SetDefault("The cosmic energy will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("CosmicEnergy")] > 0) - { - modPlayer.cEnergy = true; - } - if (!modPlayer.cEnergy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("CosmicEnergy")] > 0) + { + modPlayer.cEnergy = true; + } + if (!modPlayer.cEnergy) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Cosmilamp.cs b/Buffs/SummonBuffs/Cosmilamp.cs index 7f78147a01..92ed2304b9 100644 --- a/Buffs/SummonBuffs/Cosmilamp.cs +++ b/Buffs/SummonBuffs/Cosmilamp.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Cosmilamp : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cosmilamp"); - Description.SetDefault("The cosmilamp will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Cosmilamp : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmilamp"); + Description.SetDefault("The cosmilamp will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Cosmilamp")] > 0) - { - modPlayer.cLamp = true; - } - if (!modPlayer.cLamp) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Cosmilamp")] > 0) + { + modPlayer.cLamp = true; + } + if (!modPlayer.cLamp) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Crimslime.cs b/Buffs/SummonBuffs/Crimslime.cs index d0349e398c..605c0b5ba9 100644 --- a/Buffs/SummonBuffs/Crimslime.cs +++ b/Buffs/SummonBuffs/Crimslime.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Crimslime : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Crimslime"); - Description.SetDefault("The crimslime will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Crimslime : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Crimslime"); + Description.SetDefault("The crimslime will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Crimslime")] > 0) - { - modPlayer.cSlime2 = true; - } - if (!modPlayer.cSlime2) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Crimslime")] > 0) + { + modPlayer.cSlime2 = true; + } + if (!modPlayer.cSlime2) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/DaedalusCrystal.cs b/Buffs/SummonBuffs/DaedalusCrystal.cs index aa9c30fa0d..72954eec26 100644 --- a/Buffs/SummonBuffs/DaedalusCrystal.cs +++ b/Buffs/SummonBuffs/DaedalusCrystal.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class DaedalusCrystal : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Daedalus Crystal"); - Description.SetDefault("The daedalus crystal will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class DaedalusCrystal : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Daedalus Crystal"); + Description.SetDefault("The daedalus crystal will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("DaedalusCrystal")] > 0) - { - modPlayer.dCrystal = true; - } - if (!modPlayer.dCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("DaedalusCrystal")] > 0) + { + modPlayer.dCrystal = true; + } + if (!modPlayer.dCrystal) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/DankCreeper.cs b/Buffs/SummonBuffs/DankCreeper.cs index a3d8ca36e7..6ee6ed09a0 100644 --- a/Buffs/SummonBuffs/DankCreeper.cs +++ b/Buffs/SummonBuffs/DankCreeper.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class DankCreeper : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Dank Creeper"); - Description.SetDefault("The dank creeper will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class DankCreeper : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + Description.SetDefault("The dank creeper will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("DankCreeper")] > 0) - { - modPlayer.dCreeper = true; - } - if (!modPlayer.dCreeper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("DankCreeper")] > 0) + { + modPlayer.dCreeper = true; + } + if (!modPlayer.dCreeper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/DrewsSandyWaifu.cs b/Buffs/SummonBuffs/DrewsSandyWaifu.cs index ff9e1337fb..df4b5f0541 100644 --- a/Buffs/SummonBuffs/DrewsSandyWaifu.cs +++ b/Buffs/SummonBuffs/DrewsSandyWaifu.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class DrewsSandyWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Rare Sand Elemental"); - Description.SetDefault("The sand elemental will heal you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class DrewsSandyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Rare Sand Elemental"); + Description.SetDefault("The sand elemental will heal you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 0) - { - modPlayer.dWaifu = true; - } - if (!modPlayer.dWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 0) + { + modPlayer.dWaifu = true; + } + if (!modPlayer.dWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/ElementalAxe.cs b/Buffs/SummonBuffs/ElementalAxe.cs index b4a23a5c8e..c42320bb9a 100644 --- a/Buffs/SummonBuffs/ElementalAxe.cs +++ b/Buffs/SummonBuffs/ElementalAxe.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class ElementalAxe : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Elemental Axe"); - Description.SetDefault("The elemental axe will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class ElementalAxe : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Elemental Axe"); + Description.SetDefault("The elemental axe will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("ElementalAxe")] > 0) - { - modPlayer.eAxe = true; - } - if (!modPlayer.eAxe) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("ElementalAxe")] > 0) + { + modPlayer.eAxe = true; + } + if (!modPlayer.eAxe) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/FungalClump.cs b/Buffs/SummonBuffs/FungalClump.cs index 8d85b17a2b..0fe051536e 100644 --- a/Buffs/SummonBuffs/FungalClump.cs +++ b/Buffs/SummonBuffs/FungalClump.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class FungalClump : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fungal Clump"); - Description.SetDefault("The fungal clump will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class FungalClump : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fungal Clump"); + Description.SetDefault("The fungal clump will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 0) - { - modPlayer.fClump = true; - } - if (!modPlayer.fClump) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 0) + { + modPlayer.fClump = true; + } + if (!modPlayer.fClump) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/GuardianDefense.cs b/Buffs/SummonBuffs/GuardianDefense.cs index 096d4ea539..b5bb6b89f0 100644 --- a/Buffs/SummonBuffs/GuardianDefense.cs +++ b/Buffs/SummonBuffs/GuardianDefense.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class GuardianDefense : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Defensive Guardian"); - Description.SetDefault("The defender will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class GuardianDefense : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Defensive Guardian"); + Description.SetDefault("The defender will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianDefense")] > 0) - { - modPlayer.gDefense = true; - } - if (!modPlayer.gDefense) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianDefense")] > 0) + { + modPlayer.gDefense = true; + } + if (!modPlayer.gDefense) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/GuardianHealer.cs b/Buffs/SummonBuffs/GuardianHealer.cs index deca6b9dd6..432d61eda2 100644 --- a/Buffs/SummonBuffs/GuardianHealer.cs +++ b/Buffs/SummonBuffs/GuardianHealer.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class GuardianHealer : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Healer Guardian"); - Description.SetDefault("The guardian will heal you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class GuardianHealer : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Healer Guardian"); + Description.SetDefault("The guardian will heal you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianHealer")] > 0) - { - modPlayer.gHealer = true; - } - if (!modPlayer.gHealer) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianHealer")] > 0) + { + modPlayer.gHealer = true; + } + if (!modPlayer.gHealer) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/GuardianOffense.cs b/Buffs/SummonBuffs/GuardianOffense.cs index 651ac6ab56..85c1f9f1f5 100644 --- a/Buffs/SummonBuffs/GuardianOffense.cs +++ b/Buffs/SummonBuffs/GuardianOffense.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class GuardianOffense : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Offensive Guardian"); - Description.SetDefault("The attacker will fight for you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class GuardianOffense : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Offensive Guardian"); + Description.SetDefault("The attacker will fight for you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianAttack")] > 0) - { - modPlayer.gOffense = true; - } - if (!modPlayer.gOffense) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianAttack")] > 0) + { + modPlayer.gOffense = true; + } + if (!modPlayer.gOffense) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Herring.cs b/Buffs/SummonBuffs/Herring.cs index 14a8c0999f..f15a3b22c9 100644 --- a/Buffs/SummonBuffs/Herring.cs +++ b/Buffs/SummonBuffs/Herring.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Herring : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Herring"); - Description.SetDefault("The herring will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Herring : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Herring"); + Description.SetDefault("The herring will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Herring")] > 0) - { - modPlayer.herring = true; - } - if (!modPlayer.herring) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Herring")] > 0) + { + modPlayer.herring = true; + } + if (!modPlayer.herring) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/HotE.cs b/Buffs/SummonBuffs/HotE.cs index 1b52dcb67a..72aad2eb16 100644 --- a/Buffs/SummonBuffs/HotE.cs +++ b/Buffs/SummonBuffs/HotE.cs @@ -1,32 +1,32 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class HotE : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Heart of the Elements"); - Description.SetDefault("All elementals will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - - if (!modPlayer.allWaifus) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } + public class HotE : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Heart of the Elements"); + Description.SetDefault("All elementals will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; } - } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + + if (!modPlayer.allWaifus) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/IceClasper.cs b/Buffs/SummonBuffs/IceClasper.cs index ce79148c44..c1d71b9615 100644 --- a/Buffs/SummonBuffs/IceClasper.cs +++ b/Buffs/SummonBuffs/IceClasper.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class IceClasper : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ice Clasper"); - Description.SetDefault("The ice clasper will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class IceClasper : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Clasper"); + Description.SetDefault("The ice clasper will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("IceClasper")] > 0) - { - modPlayer.iClasper = true; - } - if (!modPlayer.iClasper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("IceClasper")] > 0) + { + modPlayer.iClasper = true; + } + if (!modPlayer.iClasper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Mechworm.cs b/Buffs/SummonBuffs/Mechworm.cs index d0ec90328d..1a320910b0 100644 --- a/Buffs/SummonBuffs/Mechworm.cs +++ b/Buffs/SummonBuffs/Mechworm.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Mechworm : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Mechworm"); - Description.SetDefault("The mechworm will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Mechworm : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mechworm"); + Description.SetDefault("The mechworm will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] > 0) - { - modPlayer.mWorm = true; - } - if (!modPlayer.mWorm) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] > 0) + { + modPlayer.mWorm = true; + } + if (!modPlayer.mWorm) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Phantom.cs b/Buffs/SummonBuffs/Phantom.cs index 14db043b47..5463b35bb8 100644 --- a/Buffs/SummonBuffs/Phantom.cs +++ b/Buffs/SummonBuffs/Phantom.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Phantom : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Phantom"); - Description.SetDefault("The phantom will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Phantom : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Phantom"); + Description.SetDefault("The phantom will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("PhantomGuy")] > 0) - { - modPlayer.pGuy = true; - } - if (!modPlayer.pGuy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("PhantomGuy")] > 0) + { + modPlayer.pGuy = true; + } + if (!modPlayer.pGuy) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/ReaverOrb.cs b/Buffs/SummonBuffs/ReaverOrb.cs index 14f257f9ac..1e0d4b5018 100644 --- a/Buffs/SummonBuffs/ReaverOrb.cs +++ b/Buffs/SummonBuffs/ReaverOrb.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class ReaverOrb : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Reaver Orb"); - Description.SetDefault("The reaver orb will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class ReaverOrb : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Reaver Orb"); + Description.SetDefault("The reaver orb will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("ReaverOrb")] > 0) - { - modPlayer.rOrb = true; - } - if (!modPlayer.rOrb) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("ReaverOrb")] > 0) + { + modPlayer.rOrb = true; + } + if (!modPlayer.rOrb) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/RedDevil.cs b/Buffs/SummonBuffs/RedDevil.cs index e8b9754973..8a5a63763c 100644 --- a/Buffs/SummonBuffs/RedDevil.cs +++ b/Buffs/SummonBuffs/RedDevil.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class RedDevil : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Red Devil"); - Description.SetDefault("The red devil will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class RedDevil : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Red Devil"); + Description.SetDefault("The red devil will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] > 0) - { - modPlayer.rDevil = true; - } - if (!modPlayer.rDevil) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] > 0) + { + modPlayer.rDevil = true; + } + if (!modPlayer.rDevil) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs b/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs index c0374ae659..b02911cb17 100644 --- a/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs +++ b/Buffs/SummonBuffs/ResurrectionButterflyBuff.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class ResurrectionButterflyBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Resurrection Butterfly"); - Description.SetDefault("Sleep beneath the Cherry Blossoms, Red-White Butterfly"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class ResurrectionButterflyBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Resurrection Butterfly"); + Description.SetDefault("Sleep beneath the Cherry Blossoms, Red-White Butterfly"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("PinkButterfly")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("PurpleButterfly")] > 0) - { - modPlayer.resButterfly = true; - } - if (!modPlayer.resButterfly) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("PinkButterfly")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("PurpleButterfly")] > 0) + { + modPlayer.resButterfly = true; + } + if (!modPlayer.resButterfly) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Sandnado.cs b/Buffs/SummonBuffs/Sandnado.cs index 64093a35e8..22ee6db9d6 100644 --- a/Buffs/SummonBuffs/Sandnado.cs +++ b/Buffs/SummonBuffs/Sandnado.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Sandnado : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Sandnado"); - Description.SetDefault("The sandnado will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Sandnado : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sandnado"); + Description.SetDefault("The sandnado will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Sandnado")] > 0) - { - modPlayer.sandnado = true; - } - if (!modPlayer.sandnado) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Sandnado")] > 0) + { + modPlayer.sandnado = true; + } + if (!modPlayer.sandnado) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/SandyWaifu.cs b/Buffs/SummonBuffs/SandyWaifu.cs index 1ad87a5ae4..61e40e357b 100644 --- a/Buffs/SummonBuffs/SandyWaifu.cs +++ b/Buffs/SummonBuffs/SandyWaifu.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class SandyWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Sand Elemental"); - Description.SetDefault("The sand elemental will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class SandyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sand Elemental"); + Description.SetDefault("The sand elemental will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 0) - { - modPlayer.sWaifu = true; - } - if (!modPlayer.sWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 0) + { + modPlayer.sWaifu = true; + } + if (!modPlayer.sWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/SilvaCrystal.cs b/Buffs/SummonBuffs/SilvaCrystal.cs index c1c8ed44af..37dbab2b63 100644 --- a/Buffs/SummonBuffs/SilvaCrystal.cs +++ b/Buffs/SummonBuffs/SilvaCrystal.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class SilvaCrystal : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Silva Crystal"); - Description.SetDefault("The crystal will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class SilvaCrystal : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Silva Crystal"); + Description.SetDefault("The crystal will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] > 0) - { - modPlayer.sCrystal = true; - } - if (!modPlayer.sCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] > 0) + { + modPlayer.sCrystal = true; + } + if (!modPlayer.sCrystal) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/SirenLure.cs b/Buffs/SummonBuffs/SirenLure.cs index 44ed75f8d2..dbac4303a7 100644 --- a/Buffs/SummonBuffs/SirenLure.cs +++ b/Buffs/SummonBuffs/SirenLure.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class SirenLure : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Siren"); - Description.SetDefault("The siren will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class SirenLure : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Siren"); + Description.SetDefault("The siren will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 0) - { - modPlayer.slWaifu = true; - } - if (!modPlayer.slWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 0) + { + modPlayer.slWaifu = true; + } + if (!modPlayer.slWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/SlimeGod.cs b/Buffs/SummonBuffs/SlimeGod.cs index a9a9002012..a23ffe5335 100644 --- a/Buffs/SummonBuffs/SlimeGod.cs +++ b/Buffs/SummonBuffs/SlimeGod.cs @@ -1,39 +1,39 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class SlimeGod : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Baby Slime God"); - Description.SetDefault("The slime god will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class SlimeGod : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Baby Slime God"); + Description.SetDefault("The slime god will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGodAlt")] > 0) - { - modPlayer.sGod = true; - } - else if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGod")] > 0) - { - modPlayer.sGod = true; - } - if (!modPlayer.sGod) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGodAlt")] > 0) + { + modPlayer.sGod = true; + } + else if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGod")] > 0) + { + modPlayer.sGod = true; + } + if (!modPlayer.sGod) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/SolarSpirit.cs b/Buffs/SummonBuffs/SolarSpirit.cs index a6e77ad69d..25c636cf4e 100644 --- a/Buffs/SummonBuffs/SolarSpirit.cs +++ b/Buffs/SummonBuffs/SolarSpirit.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class SolarSpirit : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Solar Spirit"); - Description.SetDefault("The solar spirit will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class SolarSpirit : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Solar Spirit"); + Description.SetDefault("The solar spirit will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("SolarPixie")] > 0) - { - modPlayer.SP = true; - } - if (!modPlayer.SP) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("SolarPixie")] > 0) + { + modPlayer.SP = true; + } + if (!modPlayer.SP) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/SolarSpiritGod.cs b/Buffs/SummonBuffs/SolarSpiritGod.cs index 484f15813a..e56f077509 100644 --- a/Buffs/SummonBuffs/SolarSpiritGod.cs +++ b/Buffs/SummonBuffs/SolarSpiritGod.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class SolarSpiritGod : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Solar God Spirit"); - Description.SetDefault("The solar god spirit will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class SolarSpiritGod : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Solar God Spirit"); + Description.SetDefault("The solar god spirit will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("SolarGod")] > 0) - { - modPlayer.SPG = true; - } - if (!modPlayer.SPG) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("SolarGod")] > 0) + { + modPlayer.SPG = true; + } + if (!modPlayer.SPG) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs b/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs index 375bdd5e76..518bc8da1b 100644 --- a/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs +++ b/Buffs/SummonBuffs/SpiritGeneratorAtkBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { public class SpiritGeneratorAtkBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spirit Power"); - Description.SetDefault("Minion damage boosted by 10%"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spirit Power"); + Description.SetDefault("Minion damage boosted by 10%"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sPower = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sPower = true; + } + } } diff --git a/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs b/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs index c997806868..cd4c40e1e3 100644 --- a/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs +++ b/Buffs/SummonBuffs/SpiritGeneratorDefBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { public class SpiritGeneratorDefBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spirit Defense"); - Description.SetDefault("Defense boosted by 5 and damage reduction boosted by 5%"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spirit Defense"); + Description.SetDefault("Defense boosted by 5 and damage reduction boosted by 5%"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sDefense = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sDefense = true; + } + } } diff --git a/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs b/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs index fe51919e10..19a4fd6ae1 100644 --- a/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs +++ b/Buffs/SummonBuffs/SpiritGeneratorRegenBuff.cs @@ -1,24 +1,23 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { public class SpiritGeneratorRegenBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spirit Regen"); - Description.SetDefault("Regenerating life"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spirit Regen"); + Description.SetDefault("Regenerating life"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sRegen = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sRegen = true; + } + } } diff --git a/Buffs/SummonBuffs/Urchin.cs b/Buffs/SummonBuffs/Urchin.cs index d945733ecc..c077673f11 100644 --- a/Buffs/SummonBuffs/Urchin.cs +++ b/Buffs/SummonBuffs/Urchin.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Urchin : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Urchin"); - Description.SetDefault("The urchin will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Urchin : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Urchin"); + Description.SetDefault("The urchin will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Urchin")] > 0) - { - modPlayer.vUrchin = true; - } - if (!modPlayer.vUrchin) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Urchin")] > 0) + { + modPlayer.vUrchin = true; + } + if (!modPlayer.vUrchin) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SummonBuffs/Valkyrie.cs b/Buffs/SummonBuffs/Valkyrie.cs index 9206903790..bdd936151b 100644 --- a/Buffs/SummonBuffs/Valkyrie.cs +++ b/Buffs/SummonBuffs/Valkyrie.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SummonBuffs { - public class Valkyrie : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Valkyrie"); - Description.SetDefault("The valkyrie will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Valkyrie : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Valkyrie"); + Description.SetDefault("The valkyrie will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Valkyrie")] > 0) - { - modPlayer.aValkyrie = true; - } - if (!modPlayer.aValkyrie) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Valkyrie")] > 0) + { + modPlayer.aValkyrie = true; + } + if (!modPlayer.aValkyrie) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SunkenSea/Clamity.cs b/Buffs/SunkenSea/Clamity.cs index 49d30ab2ed..59cb380666 100644 --- a/Buffs/SunkenSea/Clamity.cs +++ b/Buffs/SunkenSea/Clamity.cs @@ -1,26 +1,25 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SunkenSea { public class Clamity : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Clamity"); - Description.SetDefault("The clams have been angered!"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; + { + public override void SetDefaults() + { + DisplayName.SetDefault("Clamity"); + Description.SetDefault("The clams have been angered!"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; canBeCleared = false; - } + } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().clamity = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().clamity = true; + } + } } diff --git a/Buffs/SunkenSea/PearlAura.cs b/Buffs/SunkenSea/PearlAura.cs index d06b948a35..2488896c06 100644 --- a/Buffs/SunkenSea/PearlAura.cs +++ b/Buffs/SunkenSea/PearlAura.cs @@ -1,23 +1,22 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.SunkenSea { public class PearlAura : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Pearl Aura"); - Description.SetDefault("Slowed down"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Pearl Aura"); + Description.SetDefault("Slowed down"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().pearlAura = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().pearlAura = true; + } + } } diff --git a/Buffs/SunkenSea/Shellfish.cs b/Buffs/SunkenSea/Shellfish.cs index 2d80366f7e..92621db6d7 100644 --- a/Buffs/SunkenSea/Shellfish.cs +++ b/Buffs/SunkenSea/Shellfish.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.SunkenSea { - public class Shellfish : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shellfish"); - Description.SetDefault("The shellfish will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + public class Shellfish : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shellfish"); + Description.SetDefault("The shellfish will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[mod.ProjectileType("Shellfish")] > 0) - { - modPlayer.shellfish = true; - } - if (!modPlayer.shellfish) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[mod.ProjectileType("Shellfish")] > 0) + { + modPlayer.shellfish = true; + } + if (!modPlayer.shellfish) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } diff --git a/Buffs/SunkenSea/ShellfishEating.cs b/Buffs/SunkenSea/ShellfishEating.cs index 438be73529..d1df0019b6 100644 --- a/Buffs/SunkenSea/ShellfishEating.cs +++ b/Buffs/SunkenSea/ShellfishEating.cs @@ -1,23 +1,22 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Buffs.SunkenSea { public class ShellfishEating : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shellfish Claps"); - Description.SetDefault("Clamfest"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shellfish Claps"); + Description.SetDefault("Clamfest"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().shellfishVore = true; - } - } + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().shellfishVore = true; + } + } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 4a7db80e73..1379a7d719 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1,8 +1,6 @@ -using CalamityMod.Items; using CalamityMod.Items.Armor; using CalamityMod.Items.Permafrost; using CalamityMod.NPCs; -using CalamityMod.Projectiles; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -23,74 +21,74 @@ using Terraria.ModLoader.IO; namespace CalamityMod.CalPlayer { public class CalamityPlayer : ModPlayer - { - #region Variables - // No Category - public static bool areThereAnyDamnBosses = false; - public bool drawBossHPBar = true; - public bool shouldDrawSmallText = true; - private const int saveVersion = 0; - //public int distanceFromBoss = -1; - public int dashMod; - public int projTypeJustHitBy; - public int sCalDeathCount = 0; - public int sCalKillCount = 0; - public int deathCount = 0; - public double radiation = 0; + { + #region Variables + // No Category + public static bool areThereAnyDamnBosses = false; + public bool drawBossHPBar = true; + public bool shouldDrawSmallText = true; + private const int saveVersion = 0; + //public int distanceFromBoss = -1; + public int dashMod; + public int projTypeJustHitBy; + public int sCalDeathCount = 0; + public int sCalKillCount = 0; + public int deathCount = 0; + public double radiation = 0; - // Timer and Counter - public int bossRushImmunityFrameCurseTimer = 0; - public int aBulwarkRareMeleeBoostTimer = 0; - public int nebulaManaNerfCounter = 0; - public int alcoholPoisonLevel = 0; - public int modStealthTimer; - public int dashTimeMod; - public int hInfernoBoost = 0; - public int pissWaterBoost = 0; - public int packetTimer = 0; - public int bloodflareHeartTimer = 180; - public int bloodflareManaTimer = 180; + // Timer and Counter + public int bossRushImmunityFrameCurseTimer = 0; + public int aBulwarkRareMeleeBoostTimer = 0; + public int nebulaManaNerfCounter = 0; + public int alcoholPoisonLevel = 0; + public int modStealthTimer; + public int dashTimeMod; + public int hInfernoBoost = 0; + public int pissWaterBoost = 0; + public int packetTimer = 0; + public int bloodflareHeartTimer = 180; + public int bloodflareManaTimer = 180; public int moneyStolenByBandit = 0; public int reforges = 0; public float modStealth = 1f; - public float aquaticBoost = 1f; - public float shieldInvinc = 5f; + public float aquaticBoost = 1f; + public float shieldInvinc = 5f; // Sound public bool playRogueStealthSound = false; - public bool playFullRageSound = true; - public bool playFullAdrenalineSound = true; - public bool playAdrenalineBurnoutSound = true; - public bool playFullAdrenalineBurnoutSound = true; + public bool playFullRageSound = true; + public bool playFullAdrenalineSound = true; + public bool playAdrenalineBurnoutSound = true; + public bool playFullAdrenalineBurnoutSound = true; - // Proficiency - public int meleeLevel = 0; - public int rangedLevel = 0; - public int magicLevel = 0; - public int rogueLevel = 0; - public int summonLevel = 0; - public bool shootFireworksLevelUpMelee = true; - public bool shootFireworksLevelUpRanged = true; - public bool shootFireworksLevelUpMagic = true; - public bool shootFireworksLevelUpSummon = true; - public bool shootFireworksLevelUpRogue = true; - public int exactMeleeLevel = 0; - public int exactRangedLevel = 0; - public int exactMagicLevel = 0; - public int exactSummonLevel = 0; - public int exactRogueLevel = 0; - public int gainLevelCooldown = 120; + // Proficiency + public int meleeLevel = 0; + public int rangedLevel = 0; + public int magicLevel = 0; + public int rogueLevel = 0; + public int summonLevel = 0; + public bool shootFireworksLevelUpMelee = true; + public bool shootFireworksLevelUpRanged = true; + public bool shootFireworksLevelUpMagic = true; + public bool shootFireworksLevelUpSummon = true; + public bool shootFireworksLevelUpRogue = true; + public int exactMeleeLevel = 0; + public int exactRangedLevel = 0; + public int exactMagicLevel = 0; + public int exactSummonLevel = 0; + public int exactRogueLevel = 0; + public int gainLevelCooldown = 120; - //Rogue - public float rogueStealth = 0f; - public float rogueStealthMax = 0f; - public float stealthGenStandstill = 1f; - public float stealthGenMoving = 0f; - public float stealthGenMultiplier = 1f; + //Rogue + public float rogueStealth = 0f; + public float rogueStealthMax = 0f; + public float stealthGenStandstill = 1f; + public float stealthGenMoving = 0f; + public float stealthGenMultiplier = 1f; private float stealthGenAcceleration = 1f; private bool stealthStrikeThisFrame = false; - public bool stealthStrikeHalfCost = false; - public bool stealthStrikeAlwaysCrits = false; + public bool stealthStrikeHalfCost = false; + public bool stealthStrikeAlwaysCrits = false; public bool wearingRogueArmor = false; public float throwingDamage = 1f; @@ -99,208 +97,208 @@ namespace CalamityMod.CalPlayer public bool throwingAmmoCost66 = false; public bool throwingAmmoCost50 = false; - // Mount - public bool onyxExcavator = false; - public bool angryDog = false; - public bool fab = false; - public bool crysthamyr = false; + // Mount + public bool onyxExcavator = false; + public bool angryDog = false; + public bool fab = false; + public bool crysthamyr = false; - // Pet - public bool thirdSage = false; - public bool thirdSageH = true; // Third sage healing - public bool perfmini = false; - public bool akato = false; - public bool leviPet = false; - public bool sirenPet = false; - public bool fox = false; - public bool chibii = false; - public bool brimling = false; - public bool bearPet = false; - public bool kendra = false; - public bool trashMan = false; - public int trashManChest = -1; + // Pet + public bool thirdSage = false; + public bool thirdSageH = true; // Third sage healing + public bool perfmini = false; + public bool akato = false; + public bool leviPet = false; + public bool sirenPet = false; + public bool fox = false; + public bool chibii = false; + public bool brimling = false; + public bool bearPet = false; + public bool kendra = false; + public bool trashMan = false; + public int trashManChest = -1; - // Rage - public const int stressMax = 10000; - public int stress; - public int stressCD; - public bool stressLevel500 = false; - public bool rageMode = false; - public int gainRageCooldown = 60; + // Rage + public const int stressMax = 10000; + public int stress; + public int stressCD; + public bool stressLevel500 = false; + public bool rageMode = false; + public int gainRageCooldown = 60; - // Adrenaline - public const int adrenalineMax = 10000; - public int adrenalineMaxTimer = 300; - public int adrenalineDmgDown = 600; - public float adrenalineDmgMult = 1f; - public int adrenaline; - public int adrenalineCD; - public bool adrenalineMode = false; + // Adrenaline + public const int adrenalineMax = 10000; + public int adrenalineMaxTimer = 300; + public int adrenalineDmgDown = 600; + public float adrenalineDmgMult = 1f; + public int adrenaline; + public int adrenalineCD; + public bool adrenalineMode = false; - // Permanent Buff - public bool extraAccessoryML = false; - public bool eCore = false; - public bool pHeart = false; - public bool cShard = false; - public bool mFruit = false; - public bool bOrange = false; - public bool eBerry = false; - public bool dFruit = false; - public bool revJamDrop = false; - public bool rageBoostOne = false; - public bool rageBoostTwo = false; - public bool rageBoostThree = false; - public bool adrenalineBoostOne = false; - public bool adrenalineBoostTwo = false; - public bool adrenalineBoostThree = false; + // Permanent Buff + public bool extraAccessoryML = false; + public bool eCore = false; + public bool pHeart = false; + public bool cShard = false; + public bool mFruit = false; + public bool bOrange = false; + public bool eBerry = false; + public bool dFruit = false; + public bool revJamDrop = false; + public bool rageBoostOne = false; + public bool rageBoostTwo = false; + public bool rageBoostThree = false; + public bool adrenalineBoostOne = false; + public bool adrenalineBoostTwo = false; + public bool adrenalineBoostThree = false; - // Lore - public bool desertScourgeLore = false; - public bool eaterOfWorldsLore = false; - public bool hiveMindLore = false; - public bool perforatorLore = false; - public bool queenBeeLore = false; - public bool skeletronLore = false; - public bool wallOfFleshLore = false; - public bool destroyerLore = false; - public bool aquaticScourgeLore = false; - public bool skeletronPrimeLore = false; - public bool brimstoneElementalLore = false; - public bool calamitasLore = false; - public bool planteraLore = false; - public bool leviathanAndSirenLore = false; - public bool astrumAureusLore = false; - public bool astrumDeusLore = false; - public bool golemLore = false; - public bool plaguebringerGoliathLore = false; - public bool dukeFishronLore = false; - public bool ravagerLore = false; - public bool lunaticCultistLore = false; - public bool moonLordLore = false; - public bool providenceLore = false; - public bool polterghastLore = false; - public bool DoGLore = false; - public bool yharonLore = false; - public bool SCalLore = false; + // Lore + public bool desertScourgeLore = false; + public bool eaterOfWorldsLore = false; + public bool hiveMindLore = false; + public bool perforatorLore = false; + public bool queenBeeLore = false; + public bool skeletronLore = false; + public bool wallOfFleshLore = false; + public bool destroyerLore = false; + public bool aquaticScourgeLore = false; + public bool skeletronPrimeLore = false; + public bool brimstoneElementalLore = false; + public bool calamitasLore = false; + public bool planteraLore = false; + public bool leviathanAndSirenLore = false; + public bool astrumAureusLore = false; + public bool astrumDeusLore = false; + public bool golemLore = false; + public bool plaguebringerGoliathLore = false; + public bool dukeFishronLore = false; + public bool ravagerLore = false; + public bool lunaticCultistLore = false; + public bool moonLordLore = false; + public bool providenceLore = false; + public bool polterghastLore = false; + public bool DoGLore = false; + public bool yharonLore = false; + public bool SCalLore = false; - // Accessory - public bool fasterMeleeLevel = false; - public bool fasterRangedLevel = false; - public bool fasterMagicLevel = false; - public bool fasterSummonLevel = false; - public bool fasterRogueLevel = false; - public bool luxorsGift = false; - public bool fungalSymbiote = false; - public bool trinketOfChi = false; - public bool gladiatorSword = false; - public bool unstablePrism = false; - public bool regenator = false; - public bool theBee = false; - public int theBeeDamage = 0; - public bool rBrain = false; - public bool bloodyWormTooth = false; - public bool afflicted = false; - public bool affliction = false; - public bool stressPills = false; - public bool laudanum = false; - public bool heartOfDarkness = false; - public bool draedonsHeart = false; - public bool draedonsStressGain = false; - public bool rampartOfDeities = false; - public bool vexation = false; - public bool fBulwark = false; - public bool dodgeScarf = false; - public bool badgeOfBravery = false; - public bool badgeOfBraveryRare = false; - public bool scarfCooldown = false; - public bool cryogenSoul = false; - public bool yInsignia = false; - public bool eGauntlet = false; - public bool eTalisman = false; - public bool statisBeltOfCurses = false; - public bool elysianAegis = false; - public bool elysianGuard = false; - public bool nCore = false; - public bool deepDiver = false; - public bool abyssalDivingSuitPlates = false; - public bool abyssalDivingSuitCooldown = false; - public int abyssalDivingSuitPlateHits = 0; - public bool sirenWaterBuff = false; - public bool sirenIce = false; - public bool sirenIceCooldown = false; - public bool aSpark = false; - public bool aSparkRare = false; - public bool aBulwark = false; - public bool aBulwarkRare = false; - public bool dAmulet = false; - public bool fCarapace = false; - public bool gShell = false; - public bool absorber = false; - public bool aAmpoule = false; - public bool pAmulet = false; - public bool fBarrier = false; - public bool aBrain = false; - public bool lol = false; - public bool raiderTalisman = false; - public int raiderStack = 0; - public bool sGenerator = false; - public bool sDefense = false; - public bool sPower = false; - public bool sRegen = false; - public bool IBoots = false; - public bool elysianFire = false; - public bool sTracers = false; - public bool eTracers = false; - public bool cTracers = false; - public bool frostFlare = false; - public bool beeResist = false; - public bool uberBees = false; - public bool projRef = false; - public bool projRefRare = false; - public int projRefRareLifeRegenCounter = 0; - public bool nanotech = false; - public bool eQuiver = false; - public bool shadowMinions = false; - public bool tearMinions = false; - public bool alchFlask = false; - public bool community = false; - public bool fleshTotem = false; - public int fleshTotemCooldown = 0; - public bool bloodPact = false; - public bool bloodflareCore = false; - public bool coreOfTheBloodGod = false; - public bool elementalHeart = false; - public bool crownJewel = false; - public bool celestialJewel = false; - public bool astralArcanum = false; - public bool harpyRing = false; - public bool ironBoots = false; - public bool depthCharm = false; - public bool anechoicPlating = false; - public bool jellyfishNecklace = false; - public bool abyssalAmulet = false; - public bool lumenousAmulet = false; - public bool reaperToothNecklace = false; - public bool aquaticEmblem = false; - public bool darkSunRing = false; - public bool calamityRing = false; - public bool eArtifact = false; - public bool dArtifact = false; - public bool gArtifact = false; - public bool pArtifact = false; - public bool giantPearl = false; - public bool normalityRelocator = false; - public bool fabledTortoise = false; - public bool manaOverloader = false; - public bool royalGel = false; + // Accessory + public bool fasterMeleeLevel = false; + public bool fasterRangedLevel = false; + public bool fasterMagicLevel = false; + public bool fasterSummonLevel = false; + public bool fasterRogueLevel = false; + public bool luxorsGift = false; + public bool fungalSymbiote = false; + public bool trinketOfChi = false; + public bool gladiatorSword = false; + public bool unstablePrism = false; + public bool regenator = false; + public bool theBee = false; + public int theBeeDamage = 0; + public bool rBrain = false; + public bool bloodyWormTooth = false; + public bool afflicted = false; + public bool affliction = false; + public bool stressPills = false; + public bool laudanum = false; + public bool heartOfDarkness = false; + public bool draedonsHeart = false; + public bool draedonsStressGain = false; + public bool rampartOfDeities = false; + public bool vexation = false; + public bool fBulwark = false; + public bool dodgeScarf = false; + public bool badgeOfBravery = false; + public bool badgeOfBraveryRare = false; + public bool scarfCooldown = false; + public bool cryogenSoul = false; + public bool yInsignia = false; + public bool eGauntlet = false; + public bool eTalisman = false; + public bool statisBeltOfCurses = false; + public bool elysianAegis = false; + public bool elysianGuard = false; + public bool nCore = false; + public bool deepDiver = false; + public bool abyssalDivingSuitPlates = false; + public bool abyssalDivingSuitCooldown = false; + public int abyssalDivingSuitPlateHits = 0; + public bool sirenWaterBuff = false; + public bool sirenIce = false; + public bool sirenIceCooldown = false; + public bool aSpark = false; + public bool aSparkRare = false; + public bool aBulwark = false; + public bool aBulwarkRare = false; + public bool dAmulet = false; + public bool fCarapace = false; + public bool gShell = false; + public bool absorber = false; + public bool aAmpoule = false; + public bool pAmulet = false; + public bool fBarrier = false; + public bool aBrain = false; + public bool lol = false; + public bool raiderTalisman = false; + public int raiderStack = 0; + public bool sGenerator = false; + public bool sDefense = false; + public bool sPower = false; + public bool sRegen = false; + public bool IBoots = false; + public bool elysianFire = false; + public bool sTracers = false; + public bool eTracers = false; + public bool cTracers = false; + public bool frostFlare = false; + public bool beeResist = false; + public bool uberBees = false; + public bool projRef = false; + public bool projRefRare = false; + public int projRefRareLifeRegenCounter = 0; + public bool nanotech = false; + public bool eQuiver = false; + public bool shadowMinions = false; + public bool tearMinions = false; + public bool alchFlask = false; + public bool community = false; + public bool fleshTotem = false; + public int fleshTotemCooldown = 0; + public bool bloodPact = false; + public bool bloodflareCore = false; + public bool coreOfTheBloodGod = false; + public bool elementalHeart = false; + public bool crownJewel = false; + public bool celestialJewel = false; + public bool astralArcanum = false; + public bool harpyRing = false; + public bool ironBoots = false; + public bool depthCharm = false; + public bool anechoicPlating = false; + public bool jellyfishNecklace = false; + public bool abyssalAmulet = false; + public bool lumenousAmulet = false; + public bool reaperToothNecklace = false; + public bool aquaticEmblem = false; + public bool darkSunRing = false; + public bool calamityRing = false; + public bool eArtifact = false; + public bool dArtifact = false; + public bool gArtifact = false; + public bool pArtifact = false; + public bool giantPearl = false; + public bool normalityRelocator = false; + public bool fabledTortoise = false; + public bool manaOverloader = false; + public bool royalGel = false; public bool oldDie = false; public bool ursaSergeant = false; - public bool sandWaifu = false; - public bool sandBoobWaifu = false; - public bool cloudWaifu = false; - public bool brimstoneWaifu = false; - public bool sirenWaifu = false; - public bool fungalClump = false; + public bool sandWaifu = false; + public bool sandBoobWaifu = false; + public bool cloudWaifu = false; + public bool brimstoneWaifu = false; + public bool sirenWaifu = false; + public bool fungalClump = false; public bool darkGodSheath = false; public bool inkBomb = false; public bool inkBombCooldown = false; @@ -314,456 +312,456 @@ namespace CalamityMod.CalPlayer // Armor Set public bool victideSet = false; public bool aeroSet = false; - public bool statigelSet = false; - public bool tarraSet = false; - public bool tarraMelee = false; - public bool tarraDefense = false; - public int tarraCooldown = 0; - public int tarraDefenseTime = 600; - public bool tarraMage = false; - public int tarraMageHealCooldown = 0; - public int tarraCrits = 0; - public bool tarraRanged = false; - public bool tarraThrowing = false; - public int tarraThrowingCrits = 0; - public int tarraThrowingCritTimer = 0; - public bool tarraSummon = false; - public bool bloodflareSet = false; - public bool bloodflareMelee = false; - public int bloodflareMeleeHits = 0; - public int bloodflareFrenzyTimer = 0; - public int bloodflareFrenzyCooldown = 0; - public bool bloodflareRanged = false; - public int bloodflareRangedCooldown = 0; - public bool bloodflareThrowing = false; - public bool bloodflareMage = false; - public int bloodflareMageCooldown = 0; - public bool bloodflareSummon = false; - public int bloodflareSummonTimer = 0; - public bool godSlayer = false; - public bool godSlayerDamage = false; - public bool godSlayerMage = false; - public bool godSlayerRanged = false; - public bool godSlayerThrowing = false; - public bool godSlayerSummon = false; - public float godSlayerDmg; - public bool godSlayerReflect = false; - public bool godSlayerCooldown = false; - public bool ataxiaBolt = false; - public bool ataxiaFire = false; - public bool ataxiaVolley = false; - public bool ataxiaBlaze = false; - public bool daedalusAbsorb = false; - public bool daedalusShard = false; - public bool reaverSpore = false; - public bool reaverDoubleTap = false; - public bool flamethrowerBoost = false; - public bool shadeRegen = false; - public bool shadowSpeed = false; - public bool dsSetBonus = false; - public bool auricBoost = false; - public bool daedalusReflect = false; - public bool daedalusSplit = false; - public bool reaverBlast = false; - public bool reaverBurst = false; - public bool astralStarRain = false; - public int astralStarRainCooldown = 0; - public float ataxiaDmg; - public bool ataxiaMage = false; - public bool ataxiaGeyser = false; - public float xerocDmg; - public bool xerocSet = false; - public bool silvaSet = false; - public bool silvaMelee = false; - public bool silvaRanged = false; - public bool silvaThrowing = false; - public bool silvaMage = false; - public bool silvaSummon = false; - public bool hasSilvaEffect = false; - public int silvaCountdown = 600; - public int silvaHitCounter = 0; - public bool auricSet = false; - public bool omegaBlueChestplate = false; - public bool omegaBlueSet = false; - public bool omegaBlueHentai = false; - public int omegaBlueCooldown = 0; - public bool urchin = false; - public bool valkyrie = false; - public bool slimeGod = false; - public bool molluskSet = false; - public bool daedalusCrystal = false; - public bool reaverOrb = false; - public bool chaosSpirit = false; - public bool redDevil = false; + public bool statigelSet = false; + public bool tarraSet = false; + public bool tarraMelee = false; + public bool tarraDefense = false; + public int tarraCooldown = 0; + public int tarraDefenseTime = 600; + public bool tarraMage = false; + public int tarraMageHealCooldown = 0; + public int tarraCrits = 0; + public bool tarraRanged = false; + public bool tarraThrowing = false; + public int tarraThrowingCrits = 0; + public int tarraThrowingCritTimer = 0; + public bool tarraSummon = false; + public bool bloodflareSet = false; + public bool bloodflareMelee = false; + public int bloodflareMeleeHits = 0; + public int bloodflareFrenzyTimer = 0; + public int bloodflareFrenzyCooldown = 0; + public bool bloodflareRanged = false; + public int bloodflareRangedCooldown = 0; + public bool bloodflareThrowing = false; + public bool bloodflareMage = false; + public int bloodflareMageCooldown = 0; + public bool bloodflareSummon = false; + public int bloodflareSummonTimer = 0; + public bool godSlayer = false; + public bool godSlayerDamage = false; + public bool godSlayerMage = false; + public bool godSlayerRanged = false; + public bool godSlayerThrowing = false; + public bool godSlayerSummon = false; + public float godSlayerDmg; + public bool godSlayerReflect = false; + public bool godSlayerCooldown = false; + public bool ataxiaBolt = false; + public bool ataxiaFire = false; + public bool ataxiaVolley = false; + public bool ataxiaBlaze = false; + public bool daedalusAbsorb = false; + public bool daedalusShard = false; + public bool reaverSpore = false; + public bool reaverDoubleTap = false; + public bool flamethrowerBoost = false; + public bool shadeRegen = false; + public bool shadowSpeed = false; + public bool dsSetBonus = false; + public bool auricBoost = false; + public bool daedalusReflect = false; + public bool daedalusSplit = false; + public bool reaverBlast = false; + public bool reaverBurst = false; + public bool astralStarRain = false; + public int astralStarRainCooldown = 0; + public float ataxiaDmg; + public bool ataxiaMage = false; + public bool ataxiaGeyser = false; + public float xerocDmg; + public bool xerocSet = false; + public bool silvaSet = false; + public bool silvaMelee = false; + public bool silvaRanged = false; + public bool silvaThrowing = false; + public bool silvaMage = false; + public bool silvaSummon = false; + public bool hasSilvaEffect = false; + public int silvaCountdown = 600; + public int silvaHitCounter = 0; + public bool auricSet = false; + public bool omegaBlueChestplate = false; + public bool omegaBlueSet = false; + public bool omegaBlueHentai = false; + public int omegaBlueCooldown = 0; + public bool urchin = false; + public bool valkyrie = false; + public bool slimeGod = false; + public bool molluskSet = false; + public bool daedalusCrystal = false; + public bool reaverOrb = false; + public bool chaosSpirit = false; + public bool redDevil = false; - // Debuff - public bool shadowflame = false; - public bool wDeath = false; - public bool lethalLavaBurn = false; - public bool aCrunch = false; - public bool hAttack = false; - public bool horror = false; - public bool irradiated = false; - public bool bFlames = false; - public bool aFlames = false; - public bool gsInferno = false; - public bool astralInfection = false; - public bool pFlames = false; - public bool hFlames = false; - public bool hInferno = false; - public bool gState = false; - public bool bBlood = false; - public bool eGravity = false; - public bool weakPetrification = false; - public bool vHex = false; - public bool eGrav = false; - public bool warped = false; - public bool marked = false; - public bool cDepth = false; - public bool fishAlert = false; - public bool bOut = false; - public bool clamity = false; + // Debuff + public bool shadowflame = false; + public bool wDeath = false; + public bool lethalLavaBurn = false; + public bool aCrunch = false; + public bool hAttack = false; + public bool horror = false; + public bool irradiated = false; + public bool bFlames = false; + public bool aFlames = false; + public bool gsInferno = false; + public bool astralInfection = false; + public bool pFlames = false; + public bool hFlames = false; + public bool hInferno = false; + public bool gState = false; + public bool bBlood = false; + public bool eGravity = false; + public bool weakPetrification = false; + public bool vHex = false; + public bool eGrav = false; + public bool warped = false; + public bool marked = false; + public bool cDepth = false; + public bool fishAlert = false; + public bool bOut = false; + public bool clamity = false; - // Buff - public bool trinketOfChiBuff = false; - public int chiBuffTimer = 0; - public bool corrEffigy = false; - public bool crimEffigy = false; - public bool rRage = false; - public bool tRegen = false; - public bool xRage = false; - public bool xWrath = false; - public bool graxDefense = false; - public bool sMeleeBoost = false; - public bool tFury = false; - public bool cadence = false; - public bool omniscience = false; - public bool zerg = false; - public bool zen = false; - public bool yPower = false; - public bool aWeapon = false; - public bool tScale = false; - public bool fabsolVodka = false; - public bool mushy = false; - public bool molten = false; - public bool shellBoost = false; - public bool cFreeze = false; - public bool invincible = false; - public bool shine = false; - public bool anechoicCoating = false; - public bool enraged = false; - public int revivifyTimer = 0; - public bool permafrostsConcoction = false; - public bool armorCrumbling = false; - public bool armorShattering = false; - public bool ceaselessHunger = false; - public bool calcium = false; - public bool soaring = false; - public bool bounding = false; - public bool triumph = false; - public bool penumbra = false; - public bool photosynthesis = false; - public bool astralInjection = false; - public bool gravityNormalizer = false; - public bool holyWrath = false; - public bool profanedRage = false; - public bool draconicSurge = false; - public int draconicSurgeCooldown = 0; - public bool vodka = false; - public bool redWine = false; - public bool grapeBeer = false; - public bool moonshine = false; - public bool rum = false; - public bool whiskey = false; - public bool fireball = false; - public bool everclear = false; - public bool bloodyMary = false; - public bool tequila = false; - public bool caribbeanRum = false; - public bool cinnamonRoll = false; - public bool tequilaSunrise = false; - public bool margarita = false; - public bool starBeamRye = false; - public bool screwdriver = false; - public bool moscowMule = false; - public bool whiteWine = false; - public bool evergreenGin = false; - public bool tranquilityCandle = false; - public bool chaosCandle = false; - public bool purpleCandle = false; - public bool blueCandle = false; - public bool pinkCandle = false; - public double pinkCandleHealFraction = 0D; - public bool yellowCandle = false; - public bool trippy = false; - public bool amidiasBlessing = false; + // Buff + public bool trinketOfChiBuff = false; + public int chiBuffTimer = 0; + public bool corrEffigy = false; + public bool crimEffigy = false; + public bool rRage = false; + public bool tRegen = false; + public bool xRage = false; + public bool xWrath = false; + public bool graxDefense = false; + public bool sMeleeBoost = false; + public bool tFury = false; + public bool cadence = false; + public bool omniscience = false; + public bool zerg = false; + public bool zen = false; + public bool yPower = false; + public bool aWeapon = false; + public bool tScale = false; + public bool fabsolVodka = false; + public bool mushy = false; + public bool molten = false; + public bool shellBoost = false; + public bool cFreeze = false; + public bool invincible = false; + public bool shine = false; + public bool anechoicCoating = false; + public bool enraged = false; + public int revivifyTimer = 0; + public bool permafrostsConcoction = false; + public bool armorCrumbling = false; + public bool armorShattering = false; + public bool ceaselessHunger = false; + public bool calcium = false; + public bool soaring = false; + public bool bounding = false; + public bool triumph = false; + public bool penumbra = false; + public bool photosynthesis = false; + public bool astralInjection = false; + public bool gravityNormalizer = false; + public bool holyWrath = false; + public bool profanedRage = false; + public bool draconicSurge = false; + public int draconicSurgeCooldown = 0; + public bool vodka = false; + public bool redWine = false; + public bool grapeBeer = false; + public bool moonshine = false; + public bool rum = false; + public bool whiskey = false; + public bool fireball = false; + public bool everclear = false; + public bool bloodyMary = false; + public bool tequila = false; + public bool caribbeanRum = false; + public bool cinnamonRoll = false; + public bool tequilaSunrise = false; + public bool margarita = false; + public bool starBeamRye = false; + public bool screwdriver = false; + public bool moscowMule = false; + public bool whiteWine = false; + public bool evergreenGin = false; + public bool tranquilityCandle = false; + public bool chaosCandle = false; + public bool purpleCandle = false; + public bool blueCandle = false; + public bool pinkCandle = false; + public double pinkCandleHealFraction = 0D; + public bool yellowCandle = false; + public bool trippy = false; + public bool amidiasBlessing = false; - // Minion - public bool resButterfly = false; - public bool glSword = false; - public bool mWorm = false; - public bool iClasper = false; - public bool herring = false; - public bool blackhawk = false; - public bool calamari = false; - public bool cEyes = false; - public bool cSlime = false; - public bool cSlime2 = false; - public bool bStar = false; - public bool aStar = false; - public bool SP = false; - public bool dCreeper = false; - public bool bClot = false; - public bool eAxe = false; - public bool SPG = false; - public bool aChicken = false; - public bool cLamp = false; - public bool pGuy = false; - public bool sandnado = false; - public bool gDefense = false; - public bool gOffense = false; - public bool gHealer = false; - public bool cEnergy = false; - public int healCounter = 300; - public bool shellfish = false; - public bool hCrab = false; - public bool allWaifus = false; - public bool sCrystal = false; - public bool sWaifu = false; - public bool dWaifu = false; - public bool cWaifu = false; - public bool bWaifu = false; - public bool slWaifu = false; - public bool fClump = false; - public bool rDevil = false; - public bool aValkyrie = false; - public bool sGod = false; - public bool vUrchin = false; - public bool cSpirit = false; - public bool rOrb = false; - public bool dCrystal = false; + // Minion + public bool resButterfly = false; + public bool glSword = false; + public bool mWorm = false; + public bool iClasper = false; + public bool herring = false; + public bool blackhawk = false; + public bool calamari = false; + public bool cEyes = false; + public bool cSlime = false; + public bool cSlime2 = false; + public bool bStar = false; + public bool aStar = false; + public bool SP = false; + public bool dCreeper = false; + public bool bClot = false; + public bool eAxe = false; + public bool SPG = false; + public bool aChicken = false; + public bool cLamp = false; + public bool pGuy = false; + public bool sandnado = false; + public bool gDefense = false; + public bool gOffense = false; + public bool gHealer = false; + public bool cEnergy = false; + public int healCounter = 300; + public bool shellfish = false; + public bool hCrab = false; + public bool allWaifus = false; + public bool sCrystal = false; + public bool sWaifu = false; + public bool dWaifu = false; + public bool cWaifu = false; + public bool bWaifu = false; + public bool slWaifu = false; + public bool fClump = false; + public bool rDevil = false; + public bool aValkyrie = false; + public bool sGod = false; + public bool vUrchin = false; + public bool cSpirit = false; + public bool rOrb = false; + public bool dCrystal = false; - // Biome - public bool ZoneCalamity = false; - public bool ZoneAstral = false; - public bool ZoneSunkenSea = false; - public bool ZoneSulphur = false; - public bool ZoneAbyss = false; - public bool ZoneAbyssLayer1 = false; - public bool ZoneAbyssLayer2 = false; - public bool ZoneAbyssLayer3 = false; - public bool ZoneAbyssLayer4 = false; - public int abyssBreathCD; + // Biome + public bool ZoneCalamity = false; + public bool ZoneAstral = false; + public bool ZoneSunkenSea = false; + public bool ZoneSulphur = false; + public bool ZoneAbyss = false; + public bool ZoneAbyssLayer1 = false; + public bool ZoneAbyssLayer2 = false; + public bool ZoneAbyssLayer3 = false; + public bool ZoneAbyssLayer4 = false; + public int abyssBreathCD; - // Transformation - public bool abyssalDivingSuitPrevious; - public bool abyssalDivingSuit; - public bool abyssalDivingSuitHide; - public bool abyssalDivingSuitForce; - public bool abyssalDivingSuitPower; - public bool sirenBoobsPrevious; - public bool sirenBoobs; - public bool sirenBoobsHide; - public bool sirenBoobsForce; - public bool sirenBoobsPower; - public bool sirenBoobsAltPrevious; - public bool sirenBoobsAlt; - public bool sirenBoobsAltHide; - public bool sirenBoobsAltForce; - public bool sirenBoobsAltPower; - public bool snowmanPrevious; - public bool snowman; - public bool snowmanHide; - public bool snowmanForce; - public bool snowmanNoseless; - public bool snowmanPower; + // Transformation + public bool abyssalDivingSuitPrevious; + public bool abyssalDivingSuit; + public bool abyssalDivingSuitHide; + public bool abyssalDivingSuitForce; + public bool abyssalDivingSuitPower; + public bool sirenBoobsPrevious; + public bool sirenBoobs; + public bool sirenBoobsHide; + public bool sirenBoobsForce; + public bool sirenBoobsPower; + public bool sirenBoobsAltPrevious; + public bool sirenBoobsAlt; + public bool sirenBoobsAltHide; + public bool sirenBoobsAltForce; + public bool sirenBoobsAltPower; + public bool snowmanPrevious; + public bool snowman; + public bool snowmanHide; + public bool snowmanForce; + public bool snowmanNoseless; + public bool snowmanPower; - #endregion + #endregion - #region SavingAndLoading - public override void Initialize() - { - extraAccessoryML = false; - eCore = false; - mFruit = false; - bOrange = false; - eBerry = false; - dFruit = false; - pHeart = false; - cShard = false; - revJamDrop = false; - rageBoostOne = false; - rageBoostTwo = false; - rageBoostThree = false; - adrenalineBoostOne = false; - adrenalineBoostTwo = false; - adrenalineBoostThree = false; - drawBossHPBar = true; - shouldDrawSmallText = true; - } + #region SavingAndLoading + public override void Initialize() + { + extraAccessoryML = false; + eCore = false; + mFruit = false; + bOrange = false; + eBerry = false; + dFruit = false; + pHeart = false; + cShard = false; + revJamDrop = false; + rageBoostOne = false; + rageBoostTwo = false; + rageBoostThree = false; + adrenalineBoostOne = false; + adrenalineBoostTwo = false; + adrenalineBoostThree = false; + drawBossHPBar = true; + shouldDrawSmallText = true; + } - public override TagCompound Save() - { + public override TagCompound Save() + { var boost = new List(); boost.AddWithCondition("extraAccessoryML", extraAccessoryML); boost.AddWithCondition("etherealCore", eCore); boost.AddWithCondition("miracleFruit", mFruit); boost.AddWithCondition("bloodOrange", bOrange); boost.AddWithCondition("elderBerry", eBerry); - boost.AddWithCondition("dragonFruit", dFruit); - boost.AddWithCondition("phantomHeart", pHeart); - boost.AddWithCondition("cometShard", cShard); - boost.AddWithCondition("revJam", revJamDrop); - boost.AddWithCondition("rageOne", rageBoostOne); - boost.AddWithCondition("rageTwo", rageBoostTwo); - boost.AddWithCondition("rageThree", rageBoostThree); - boost.AddWithCondition("adrenalineOne", adrenalineBoostOne); - boost.AddWithCondition("adrenalineTwo", adrenalineBoostTwo); - boost.AddWithCondition("adrenalineThree", adrenalineBoostThree); - boost.AddWithCondition("bossHPBar", drawBossHPBar); - boost.AddWithCondition("drawSmallText", shouldDrawSmallText); + boost.AddWithCondition("dragonFruit", dFruit); + boost.AddWithCondition("phantomHeart", pHeart); + boost.AddWithCondition("cometShard", cShard); + boost.AddWithCondition("revJam", revJamDrop); + boost.AddWithCondition("rageOne", rageBoostOne); + boost.AddWithCondition("rageTwo", rageBoostTwo); + boost.AddWithCondition("rageThree", rageBoostThree); + boost.AddWithCondition("adrenalineOne", adrenalineBoostOne); + boost.AddWithCondition("adrenalineTwo", adrenalineBoostTwo); + boost.AddWithCondition("adrenalineThree", adrenalineBoostThree); + boost.AddWithCondition("bossHPBar", drawBossHPBar); + boost.AddWithCondition("drawSmallText", shouldDrawSmallText); - return new TagCompound - { - { "boost", boost }, - { "stress", stress }, - { "adrenaline", adrenaline }, - { "sCalDeathCount", sCalDeathCount }, - { "sCalKillCount", sCalKillCount }, - { "meleeLevel", meleeLevel }, - { "exactMeleeLevel", exactMeleeLevel }, - { "rangedLevel", rangedLevel }, - { "exactRangedLevel", exactRangedLevel }, - { "magicLevel", magicLevel }, - { "exactMagicLevel", exactMagicLevel }, - { "summonLevel", summonLevel }, - { "exactSummonLevel", exactSummonLevel }, - { "rogueLevel", rogueLevel }, - { "exactRogueLevel", exactRogueLevel }, - { "deathCount", deathCount }, - { "radiation", radiation }, + return new TagCompound + { + { "boost", boost }, + { "stress", stress }, + { "adrenaline", adrenaline }, + { "sCalDeathCount", sCalDeathCount }, + { "sCalKillCount", sCalKillCount }, + { "meleeLevel", meleeLevel }, + { "exactMeleeLevel", exactMeleeLevel }, + { "rangedLevel", rangedLevel }, + { "exactRangedLevel", exactRangedLevel }, + { "magicLevel", magicLevel }, + { "exactMagicLevel", exactMagicLevel }, + { "summonLevel", summonLevel }, + { "exactSummonLevel", exactSummonLevel }, + { "rogueLevel", rogueLevel }, + { "exactRogueLevel", exactRogueLevel }, + { "deathCount", deathCount }, + { "radiation", radiation }, { "moneyStolenByBandit", moneyStolenByBandit }, { "reforges", reforges } }; - } + } - public override void Load(TagCompound tag) - { - var boost = tag.GetList("boost"); - extraAccessoryML = boost.Contains("extraAccessoryML"); - eCore = boost.Contains("etherealCore"); - mFruit = boost.Contains("miracleFruit"); - bOrange = boost.Contains("bloodOrange"); - eBerry = boost.Contains("elderBerry"); - dFruit = boost.Contains("dragonFruit"); - pHeart = boost.Contains("phantomHeart"); - cShard = boost.Contains("cometShard"); - revJamDrop = boost.Contains("revJam"); - rageBoostOne = boost.Contains("rageOne"); - rageBoostTwo = boost.Contains("rageTwo"); - rageBoostThree = boost.Contains("rageThree"); - adrenalineBoostOne = boost.Contains("adrenalineOne"); - adrenalineBoostTwo = boost.Contains("adrenalineTwo"); - adrenalineBoostThree = boost.Contains("adrenalineThree"); - drawBossHPBar = boost.Contains("bossHPBar"); - shouldDrawSmallText = boost.Contains("drawSmallText"); + public override void Load(TagCompound tag) + { + var boost = tag.GetList("boost"); + extraAccessoryML = boost.Contains("extraAccessoryML"); + eCore = boost.Contains("etherealCore"); + mFruit = boost.Contains("miracleFruit"); + bOrange = boost.Contains("bloodOrange"); + eBerry = boost.Contains("elderBerry"); + dFruit = boost.Contains("dragonFruit"); + pHeart = boost.Contains("phantomHeart"); + cShard = boost.Contains("cometShard"); + revJamDrop = boost.Contains("revJam"); + rageBoostOne = boost.Contains("rageOne"); + rageBoostTwo = boost.Contains("rageTwo"); + rageBoostThree = boost.Contains("rageThree"); + adrenalineBoostOne = boost.Contains("adrenalineOne"); + adrenalineBoostTwo = boost.Contains("adrenalineTwo"); + adrenalineBoostThree = boost.Contains("adrenalineThree"); + drawBossHPBar = boost.Contains("bossHPBar"); + shouldDrawSmallText = boost.Contains("drawSmallText"); - stress = tag.GetInt("stress"); - adrenaline = tag.GetInt("adrenaline"); - sCalDeathCount = tag.GetInt("sCalDeathCount"); - sCalKillCount = tag.GetInt("sCalKillCount"); - deathCount = tag.GetInt("deathCount"); + stress = tag.GetInt("stress"); + adrenaline = tag.GetInt("adrenaline"); + sCalDeathCount = tag.GetInt("sCalDeathCount"); + sCalKillCount = tag.GetInt("sCalKillCount"); + deathCount = tag.GetInt("deathCount"); moneyStolenByBandit = tag.GetInt("moneyStolenByBandit"); reforges = tag.GetInt("reforges"); radiation = tag.GetDouble("radiation"); meleeLevel = tag.GetInt("meleeLevel"); - rangedLevel = tag.GetInt("rangedLevel"); - magicLevel = tag.GetInt("magicLevel"); - summonLevel = tag.GetInt("summonLevel"); - rogueLevel = tag.GetInt("rogueLevel"); - exactMeleeLevel = tag.GetInt("exactMeleeLevel"); - exactRangedLevel = tag.GetInt("exactRangedLevel"); - exactMagicLevel = tag.GetInt("exactMagicLevel"); - exactSummonLevel = tag.GetInt("exactSummonLevel"); - exactRogueLevel = tag.GetInt("exactRogueLevel"); - } + rangedLevel = tag.GetInt("rangedLevel"); + magicLevel = tag.GetInt("magicLevel"); + summonLevel = tag.GetInt("summonLevel"); + rogueLevel = tag.GetInt("rogueLevel"); + exactMeleeLevel = tag.GetInt("exactMeleeLevel"); + exactRangedLevel = tag.GetInt("exactRangedLevel"); + exactMagicLevel = tag.GetInt("exactMagicLevel"); + exactSummonLevel = tag.GetInt("exactSummonLevel"); + exactRogueLevel = tag.GetInt("exactRogueLevel"); + } - public override void LoadLegacy(BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - stress = reader.ReadInt32(); - adrenaline = reader.ReadInt32(); - sCalDeathCount = reader.ReadInt32(); - sCalKillCount = reader.ReadInt32(); - deathCount = reader.ReadInt32(); + public override void LoadLegacy(BinaryReader reader) + { + int loadVersion = reader.ReadInt32(); + stress = reader.ReadInt32(); + adrenaline = reader.ReadInt32(); + sCalDeathCount = reader.ReadInt32(); + sCalKillCount = reader.ReadInt32(); + deathCount = reader.ReadInt32(); moneyStolenByBandit = reader.ReadInt32(); reforges = reader.ReadInt32(); radiation = reader.ReadDouble(); - meleeLevel = reader.ReadInt32(); - rangedLevel = reader.ReadInt32(); - magicLevel = reader.ReadInt32(); - summonLevel = reader.ReadInt32(); - rogueLevel = reader.ReadInt32(); - exactMeleeLevel = reader.ReadInt32(); - exactRangedLevel = reader.ReadInt32(); - exactMagicLevel = reader.ReadInt32(); - exactSummonLevel = reader.ReadInt32(); - exactRogueLevel = reader.ReadInt32(); + meleeLevel = reader.ReadInt32(); + rangedLevel = reader.ReadInt32(); + magicLevel = reader.ReadInt32(); + summonLevel = reader.ReadInt32(); + rogueLevel = reader.ReadInt32(); + exactMeleeLevel = reader.ReadInt32(); + exactRangedLevel = reader.ReadInt32(); + exactMagicLevel = reader.ReadInt32(); + exactSummonLevel = reader.ReadInt32(); + exactRogueLevel = reader.ReadInt32(); - if (loadVersion == 0) - { - BitsByte flags = reader.ReadByte(); - extraAccessoryML = flags[0]; - eCore = flags[1]; - mFruit = flags[2]; - bOrange = flags[3]; - eBerry = flags[4]; - dFruit = flags[5]; - pHeart = flags[6]; - cShard = flags[7]; + if (loadVersion == 0) + { + BitsByte flags = reader.ReadByte(); + extraAccessoryML = flags[0]; + eCore = flags[1]; + mFruit = flags[2]; + bOrange = flags[3]; + eBerry = flags[4]; + dFruit = flags[5]; + pHeart = flags[6]; + cShard = flags[7]; - BitsByte flags2 = reader.ReadByte(); - revJamDrop = flags2[0]; - rageBoostOne = flags2[1]; - rageBoostTwo = flags2[2]; - rageBoostThree = flags2[3]; - adrenalineBoostOne = flags2[4]; - adrenalineBoostTwo = flags2[5]; - adrenalineBoostThree = flags2[6]; - drawBossHPBar = flags2[7]; + BitsByte flags2 = reader.ReadByte(); + revJamDrop = flags2[0]; + rageBoostOne = flags2[1]; + rageBoostTwo = flags2[2]; + rageBoostThree = flags2[3]; + adrenalineBoostOne = flags2[4]; + adrenalineBoostTwo = flags2[5]; + adrenalineBoostThree = flags2[6]; + drawBossHPBar = flags2[7]; - BitsByte flags3 = reader.ReadByte(); - shouldDrawSmallText = flags3[0]; - } - else - { - ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); - } - } - #endregion + BitsByte flags3 = reader.ReadByte(); + shouldDrawSmallText = flags3[0]; + } + else + { + ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); + } + } + #endregion - #region ResetEffects - public override void ResetEffects() - { - if (extraAccessoryML) - { - player.extraAccessorySlots = 1; - } - if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) - { - player.extraAccessorySlots = 2; - } - if (CalamityWorld.bossRushActive) - { - if (Config.BossRushAccessoryCurse) - { - player.extraAccessorySlots = 0; - } - } + #region ResetEffects + public override void ResetEffects() + { + if (extraAccessoryML) + { + player.extraAccessorySlots = 1; + } + if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) + { + player.extraAccessorySlots = 2; + } + if (CalamityWorld.bossRushActive) + { + if (Config.BossRushAccessoryCurse) + { + player.extraAccessorySlots = 0; + } + } - ResetRogueStealth(); + ResetRogueStealth(); throwingDamage = 1f; throwingVelocity = 1f; @@ -772,244 +770,244 @@ namespace CalamityMod.CalPlayer throwingAmmoCost50 = false; dashMod = 0; - alcoholPoisonLevel = 0; + alcoholPoisonLevel = 0; - thirdSage = false; - if (player.immuneTime == 0) - thirdSageH = false; - perfmini = false; - akato = false; - leviPet = false; - sirenPet = false; - fox = false; - chibii = false; - brimling = false; - bearPet = false; - kendra = false; - trashMan = false; - onyxExcavator = false; - angryDog = false; - fab = false; - crysthamyr = false; + thirdSage = false; + if (player.immuneTime == 0) + thirdSageH = false; + perfmini = false; + akato = false; + leviPet = false; + sirenPet = false; + fox = false; + chibii = false; + brimling = false; + bearPet = false; + kendra = false; + trashMan = false; + onyxExcavator = false; + angryDog = false; + fab = false; + crysthamyr = false; - abyssalDivingSuitPlates = false; - abyssalDivingSuitCooldown = false; + abyssalDivingSuitPlates = false; + abyssalDivingSuitCooldown = false; - sirenWaterBuff = false; - sirenIce = false; - sirenIceCooldown = false; + sirenWaterBuff = false; + sirenIce = false; + sirenIceCooldown = false; - draedonsHeart = false; - draedonsStressGain = false; + draedonsHeart = false; + draedonsStressGain = false; - afflicted = false; - affliction = false; + afflicted = false; + affliction = false; - fasterMeleeLevel = false; - fasterRangedLevel = false; - fasterMagicLevel = false; - fasterSummonLevel = false; - fasterRogueLevel = false; + fasterMeleeLevel = false; + fasterRangedLevel = false; + fasterMagicLevel = false; + fasterSummonLevel = false; + fasterRogueLevel = false; - dodgeScarf = false; - scarfCooldown = false; + dodgeScarf = false; + scarfCooldown = false; - elysianAegis = false; + elysianAegis = false; - nCore = false; + nCore = false; - godSlayer = false; - godSlayerDamage = false; - godSlayerMage = false; - godSlayerRanged = false; - godSlayerThrowing = false; - godSlayerSummon = false; - godSlayerReflect = false; - godSlayerCooldown = false; + godSlayer = false; + godSlayerDamage = false; + godSlayerMage = false; + godSlayerRanged = false; + godSlayerThrowing = false; + godSlayerSummon = false; + godSlayerReflect = false; + godSlayerCooldown = false; - silvaSet = false; - silvaMelee = false; - silvaRanged = false; - silvaThrowing = false; - silvaMage = false; - silvaSummon = false; + silvaSet = false; + silvaMelee = false; + silvaRanged = false; + silvaThrowing = false; + silvaMage = false; + silvaSummon = false; - auricSet = false; - auricBoost = false; + auricSet = false; + auricBoost = false; - omegaBlueChestplate = false; - omegaBlueSet = false; - omegaBlueHentai = false; + omegaBlueChestplate = false; + omegaBlueSet = false; + omegaBlueHentai = false; - molluskSet = false; + molluskSet = false; - ataxiaBolt = false; - ataxiaGeyser = false; - ataxiaFire = false; - ataxiaVolley = false; - ataxiaBlaze = false; - ataxiaMage = false; + ataxiaBolt = false; + ataxiaGeyser = false; + ataxiaFire = false; + ataxiaVolley = false; + ataxiaBlaze = false; + ataxiaMage = false; - shadeRegen = false; + shadeRegen = false; - flamethrowerBoost = false; + flamethrowerBoost = false; - shadowSpeed = false; - dsSetBonus = false; + shadowSpeed = false; + dsSetBonus = false; wearingRogueArmor = false; - desertScourgeLore = false; - eaterOfWorldsLore = false; - hiveMindLore = false; - perforatorLore = false; - queenBeeLore = false; - skeletronLore = false; - wallOfFleshLore = false; - destroyerLore = false; - aquaticScourgeLore = false; - skeletronPrimeLore = false; - brimstoneElementalLore = false; - calamitasLore = false; - planteraLore = false; - leviathanAndSirenLore = false; - astrumAureusLore = false; - astrumDeusLore = false; - golemLore = false; - plaguebringerGoliathLore = false; - dukeFishronLore = false; - ravagerLore = false; - lunaticCultistLore = false; - moonLordLore = false; - providenceLore = false; - polterghastLore = false; - DoGLore = false; - yharonLore = false; - SCalLore = false; + desertScourgeLore = false; + eaterOfWorldsLore = false; + hiveMindLore = false; + perforatorLore = false; + queenBeeLore = false; + skeletronLore = false; + wallOfFleshLore = false; + destroyerLore = false; + aquaticScourgeLore = false; + skeletronPrimeLore = false; + brimstoneElementalLore = false; + calamitasLore = false; + planteraLore = false; + leviathanAndSirenLore = false; + astrumAureusLore = false; + astrumDeusLore = false; + golemLore = false; + plaguebringerGoliathLore = false; + dukeFishronLore = false; + ravagerLore = false; + lunaticCultistLore = false; + moonLordLore = false; + providenceLore = false; + polterghastLore = false; + DoGLore = false; + yharonLore = false; + SCalLore = false; - luxorsGift = false; - fungalSymbiote = false; - trinketOfChi = false; - gladiatorSword = false; - unstablePrism = false; - regenator = false; - deepDiver = false; - theBee = false; - rBrain = false; - bloodyWormTooth = false; - rampartOfDeities = false; - vexation = false; - fBulwark = false; - badgeOfBravery = false; - badgeOfBraveryRare = false; - aSpark = false; - aSparkRare = false; - aBulwark = false; - aBulwarkRare = false; - dAmulet = false; - fCarapace = false; - gShell = false; - absorber = false; - aAmpoule = false; - pAmulet = false; - fBarrier = false; - aBrain = false; - frostFlare = false; - beeResist = false; - uberBees = false; - projRef = false; - projRefRare = false; - nanotech = false; - eQuiver = false; - cryogenSoul = false; - yInsignia = false; - eGauntlet = false; - eTalisman = false; - statisBeltOfCurses = false; - heartOfDarkness = false; - shadowMinions = false; - tearMinions = false; - alchFlask = false; - community = false; - stressPills = false; - laudanum = false; - fleshTotem = false; - bloodPact = false; - bloodflareCore = false; - coreOfTheBloodGod = false; - elementalHeart = false; - crownJewel = false; - celestialJewel = false; - astralArcanum = false; - harpyRing = false; - darkSunRing = false; - calamityRing = false; - eArtifact = false; - dArtifact = false; - gArtifact = false; - pArtifact = false; - giantPearl = false; - normalityRelocator = false; - fabledTortoise = false; - manaOverloader = false; - royalGel = false; - lol = false; - raiderTalisman = false; - sGenerator = false; - sDefense = false; - sRegen = false; - sPower = false; - IBoots = false; - elysianFire = false; - sTracers = false; - eTracers = false; - cTracers = false; + luxorsGift = false; + fungalSymbiote = false; + trinketOfChi = false; + gladiatorSword = false; + unstablePrism = false; + regenator = false; + deepDiver = false; + theBee = false; + rBrain = false; + bloodyWormTooth = false; + rampartOfDeities = false; + vexation = false; + fBulwark = false; + badgeOfBravery = false; + badgeOfBraveryRare = false; + aSpark = false; + aSparkRare = false; + aBulwark = false; + aBulwarkRare = false; + dAmulet = false; + fCarapace = false; + gShell = false; + absorber = false; + aAmpoule = false; + pAmulet = false; + fBarrier = false; + aBrain = false; + frostFlare = false; + beeResist = false; + uberBees = false; + projRef = false; + projRefRare = false; + nanotech = false; + eQuiver = false; + cryogenSoul = false; + yInsignia = false; + eGauntlet = false; + eTalisman = false; + statisBeltOfCurses = false; + heartOfDarkness = false; + shadowMinions = false; + tearMinions = false; + alchFlask = false; + community = false; + stressPills = false; + laudanum = false; + fleshTotem = false; + bloodPact = false; + bloodflareCore = false; + coreOfTheBloodGod = false; + elementalHeart = false; + crownJewel = false; + celestialJewel = false; + astralArcanum = false; + harpyRing = false; + darkSunRing = false; + calamityRing = false; + eArtifact = false; + dArtifact = false; + gArtifact = false; + pArtifact = false; + giantPearl = false; + normalityRelocator = false; + fabledTortoise = false; + manaOverloader = false; + royalGel = false; + lol = false; + raiderTalisman = false; + sGenerator = false; + sDefense = false; + sRegen = false; + sPower = false; + IBoots = false; + elysianFire = false; + sTracers = false; + eTracers = false; + cTracers = false; oldDie = false; ursaSergeant = false; - daedalusReflect = false; - daedalusSplit = false; - daedalusAbsorb = false; - daedalusShard = false; + daedalusReflect = false; + daedalusSplit = false; + daedalusAbsorb = false; + daedalusShard = false; - reaverSpore = false; - reaverDoubleTap = false; - reaverBlast = false; - reaverBurst = false; + reaverSpore = false; + reaverDoubleTap = false; + reaverBlast = false; + reaverBurst = false; - ironBoots = false; - depthCharm = false; - anechoicPlating = false; - jellyfishNecklace = false; - abyssalAmulet = false; - lumenousAmulet = false; - reaperToothNecklace = false; - aquaticEmblem = false; + ironBoots = false; + depthCharm = false; + anechoicPlating = false; + jellyfishNecklace = false; + abyssalAmulet = false; + lumenousAmulet = false; + reaperToothNecklace = false; + aquaticEmblem = false; - astralStarRain = false; + astralStarRain = false; - victideSet = false; + victideSet = false; - aeroSet = false; + aeroSet = false; - statigelSet = false; + statigelSet = false; - tarraSet = false; - tarraMelee = false; - tarraMage = false; - tarraRanged = false; - tarraThrowing = false; - tarraSummon = false; + tarraSet = false; + tarraMelee = false; + tarraMage = false; + tarraRanged = false; + tarraThrowing = false; + tarraSummon = false; - bloodflareSet = false; - bloodflareMelee = false; - bloodflareRanged = false; - bloodflareThrowing = false; - bloodflareMage = false; - bloodflareSummon = false; + bloodflareSet = false; + bloodflareMelee = false; + bloodflareRanged = false; + bloodflareThrowing = false; + bloodflareMage = false; + bloodflareSummon = false; - xerocSet = false; + xerocSet = false; - weakPetrification = false; + weakPetrification = false; inkBomb = false; inkBombCooldown = false; @@ -1022,225 +1020,225 @@ namespace CalamityMod.CalPlayer moonCrown = false; shadowflame = false; - wDeath = false; - lethalLavaBurn = false; - aCrunch = false; - hAttack = false; - horror = false; - irradiated = false; - bFlames = false; - aFlames = false; - gsInferno = false; - astralInfection = false; - pFlames = false; - hFlames = false; - hInferno = false; - gState = false; - bBlood = false; - eGravity = false; - vHex = false; - eGrav = false; - warped = false; - marked = false; - cDepth = false; - fishAlert = false; - bOut = false; - clamity = false; - enraged = false; - snowmanNoseless = false; + wDeath = false; + lethalLavaBurn = false; + aCrunch = false; + hAttack = false; + horror = false; + irradiated = false; + bFlames = false; + aFlames = false; + gsInferno = false; + astralInfection = false; + pFlames = false; + hFlames = false; + hInferno = false; + gState = false; + bBlood = false; + eGravity = false; + vHex = false; + eGrav = false; + warped = false; + marked = false; + cDepth = false; + fishAlert = false; + bOut = false; + clamity = false; + enraged = false; + snowmanNoseless = false; - trinketOfChiBuff = false; - corrEffigy = false; - crimEffigy = false; - rRage = false; - xRage = false; - xWrath = false; - graxDefense = false; - sMeleeBoost = false; - tFury = false; - cadence = false; - omniscience = false; - zerg = false; - zen = false; - permafrostsConcoction = false; - armorCrumbling = false; - armorShattering = false; - ceaselessHunger = false; - calcium = false; - soaring = false; - bounding = false; - triumph = false; - penumbra = false; - photosynthesis = false; - astralInjection = false; - gravityNormalizer = false; - holyWrath = false; - profanedRage = false; - draconicSurge = false; - trippy = false; - amidiasBlessing = false; - yPower = false; - aWeapon = false; - tScale = false; - fabsolVodka = false; - invincible = false; - shine = false; - anechoicCoating = false; - mushy = false; - molten = false; - shellBoost = false; - cFreeze = false; - tRegen = false; + trinketOfChiBuff = false; + corrEffigy = false; + crimEffigy = false; + rRage = false; + xRage = false; + xWrath = false; + graxDefense = false; + sMeleeBoost = false; + tFury = false; + cadence = false; + omniscience = false; + zerg = false; + zen = false; + permafrostsConcoction = false; + armorCrumbling = false; + armorShattering = false; + ceaselessHunger = false; + calcium = false; + soaring = false; + bounding = false; + triumph = false; + penumbra = false; + photosynthesis = false; + astralInjection = false; + gravityNormalizer = false; + holyWrath = false; + profanedRage = false; + draconicSurge = false; + trippy = false; + amidiasBlessing = false; + yPower = false; + aWeapon = false; + tScale = false; + fabsolVodka = false; + invincible = false; + shine = false; + anechoicCoating = false; + mushy = false; + molten = false; + shellBoost = false; + cFreeze = false; + tRegen = false; - vodka = false; - redWine = false; - grapeBeer = false; - moonshine = false; - rum = false; - whiskey = false; - fireball = false; - everclear = false; - bloodyMary = false; - tequila = false; - caribbeanRum = false; - cinnamonRoll = false; - tequilaSunrise = false; - margarita = false; - starBeamRye = false; - screwdriver = false; - moscowMule = false; - whiteWine = false; - evergreenGin = false; + vodka = false; + redWine = false; + grapeBeer = false; + moonshine = false; + rum = false; + whiskey = false; + fireball = false; + everclear = false; + bloodyMary = false; + tequila = false; + caribbeanRum = false; + cinnamonRoll = false; + tequilaSunrise = false; + margarita = false; + starBeamRye = false; + screwdriver = false; + moscowMule = false; + whiteWine = false; + evergreenGin = false; - tranquilityCandle = false; - chaosCandle = false; - purpleCandle = false; - blueCandle = false; - pinkCandle = false; - yellowCandle = false; + tranquilityCandle = false; + chaosCandle = false; + purpleCandle = false; + blueCandle = false; + pinkCandle = false; + yellowCandle = false; - resButterfly = false; - glSword = false; - mWorm = false; - iClasper = false; - herring = false; - blackhawk = false; - calamari = false; - cEyes = false; - cSlime = false; - cSlime2 = false; - bStar = false; - aStar = false; - SP = false; - dCreeper = false; - bClot = false; - eAxe = false; - SPG = false; - aChicken = false; - cLamp = false; - pGuy = false; - cEnergy = false; - gDefense = false; - gOffense = false; - gHealer = false; - sWaifu = false; - dWaifu = false; - cWaifu = false; - bWaifu = false; - slWaifu = false; - fClump = false; - rDevil = false; - aValkyrie = false; - sCrystal = false; - sGod = false; - sandnado = false; - vUrchin = false; - cSpirit = false; - rOrb = false; - dCrystal = false; - sandWaifu = false; - sandBoobWaifu = false; - cloudWaifu = false; - brimstoneWaifu = false; - sirenWaifu = false; - allWaifus = false; - fungalClump = false; - redDevil = false; - valkyrie = false; - slimeGod = false; - urchin = false; - chaosSpirit = false; - reaverOrb = false; - daedalusCrystal = false; - shellfish = false; - hCrab = false; + resButterfly = false; + glSword = false; + mWorm = false; + iClasper = false; + herring = false; + blackhawk = false; + calamari = false; + cEyes = false; + cSlime = false; + cSlime2 = false; + bStar = false; + aStar = false; + SP = false; + dCreeper = false; + bClot = false; + eAxe = false; + SPG = false; + aChicken = false; + cLamp = false; + pGuy = false; + cEnergy = false; + gDefense = false; + gOffense = false; + gHealer = false; + sWaifu = false; + dWaifu = false; + cWaifu = false; + bWaifu = false; + slWaifu = false; + fClump = false; + rDevil = false; + aValkyrie = false; + sCrystal = false; + sGod = false; + sandnado = false; + vUrchin = false; + cSpirit = false; + rOrb = false; + dCrystal = false; + sandWaifu = false; + sandBoobWaifu = false; + cloudWaifu = false; + brimstoneWaifu = false; + sirenWaifu = false; + allWaifus = false; + fungalClump = false; + redDevil = false; + valkyrie = false; + slimeGod = false; + urchin = false; + chaosSpirit = false; + reaverOrb = false; + daedalusCrystal = false; + shellfish = false; + hCrab = false; - abyssalDivingSuitPrevious = abyssalDivingSuit; - abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; + abyssalDivingSuitPrevious = abyssalDivingSuit; + abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; - sirenBoobsPrevious = sirenBoobs; - sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false; - sirenBoobsAltPrevious = sirenBoobsAlt; - sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; + sirenBoobsPrevious = sirenBoobs; + sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false; + sirenBoobsAltPrevious = sirenBoobsAlt; + sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; - snowmanPrevious = snowman; - snowman = snowmanHide = snowmanForce = snowmanPower = false; + snowmanPrevious = snowman; + snowman = snowmanHide = snowmanForce = snowmanPower = false; - rageMode = false; - adrenalineMode = false; - } - #endregion + rageMode = false; + adrenalineMode = false; + } + #endregion - #region UpdateDead - public override void UpdateDead() - { - #region Debuffs - //distanceFromBoss = -1; - stress = 0; - adrenaline = 0; - adrenalineMaxTimer = 300; - adrenalineDmgDown = 600; - adrenalineDmgMult = 1f; - raiderStack = 0; - fleshTotemCooldown = 0; - astralStarRainCooldown = 0; - bloodflareMageCooldown = 0; - tarraMageHealCooldown = 0; - bossRushImmunityFrameCurseTimer = 0; - aBulwarkRareMeleeBoostTimer = 0; - theBeeDamage = 0; + #region UpdateDead + public override void UpdateDead() + { + #region Debuffs + //distanceFromBoss = -1; + stress = 0; + adrenaline = 0; + adrenalineMaxTimer = 300; + adrenalineDmgDown = 600; + adrenalineDmgMult = 1f; + raiderStack = 0; + fleshTotemCooldown = 0; + astralStarRainCooldown = 0; + bloodflareMageCooldown = 0; + tarraMageHealCooldown = 0; + bossRushImmunityFrameCurseTimer = 0; + aBulwarkRareMeleeBoostTimer = 0; + theBeeDamage = 0; - shadowflame = false; - wDeath = false; - lethalLavaBurn = false; - aCrunch = false; - hAttack = false; - horror = false; - irradiated = false; - bFlames = false; - aFlames = false; - gsInferno = false; - astralInfection = false; - pFlames = false; - hFlames = false; - hInferno = false; - gState = false; - bBlood = false; - eGravity = false; - vHex = false; - eGrav = false; - warped = false; - marked = false; - cDepth = false; - fishAlert = false; - bOut = false; - clamity = false; - snowmanNoseless = false; - scarfCooldown = false; - godSlayerCooldown = false; - abyssalDivingSuitCooldown = false; - abyssalDivingSuitPlateHits = 0; - sirenIceCooldown = false; + shadowflame = false; + wDeath = false; + lethalLavaBurn = false; + aCrunch = false; + hAttack = false; + horror = false; + irradiated = false; + bFlames = false; + aFlames = false; + gsInferno = false; + astralInfection = false; + pFlames = false; + hFlames = false; + hInferno = false; + gState = false; + bBlood = false; + eGravity = false; + vHex = false; + eGrav = false; + warped = false; + marked = false; + cDepth = false; + fishAlert = false; + bOut = false; + clamity = false; + snowmanNoseless = false; + scarfCooldown = false; + godSlayerCooldown = false; + abyssalDivingSuitCooldown = false; + abyssalDivingSuitPlateHits = 0; + sirenIceCooldown = false; inkBombCooldown = false; abyssalMirrorCooldown = false; eclipseMirrorCooldown = false; @@ -1249,7 +1247,7 @@ namespace CalamityMod.CalPlayer #region Rogue // Stealth rogueStealth = 0f; - rogueStealthMax = 0f; + rogueStealthMax = 0f; throwingDamage = 1f; throwingVelocity = 1f; @@ -1260,3413 +1258,3431 @@ namespace CalamityMod.CalPlayer #region Buffs sDefense = false; - sRegen = false; - sPower = false; - onyxExcavator = false; - angryDog = false; - fab = false; - crysthamyr = false; - abyssalDivingSuitPlates = false; - sirenWaterBuff = false; - sirenIce = false; - trinketOfChiBuff = false; - chiBuffTimer = 0; - corrEffigy = false; - crimEffigy = false; - rRage = false; - xRage = false; - xWrath = false; - graxDefense = false; - sMeleeBoost = false; - tFury = false; - cadence = false; - omniscience = false; - zerg = false; - zen = false; - permafrostsConcoction = false; - armorCrumbling = false; - armorShattering = false; - ceaselessHunger = false; - calcium = false; - soaring = false; - bounding = false; - triumph = false; - penumbra = false; - photosynthesis = false; - astralInjection = false; - gravityNormalizer = false; - holyWrath = false; - profanedRage = false; - draconicSurge = false; - draconicSurgeCooldown = 0; - yPower = false; - aWeapon = false; - tScale = false; - fabsolVodka = false; - invincible = false; - shine = false; - anechoicCoating = false; - mushy = false; - molten = false; - enraged = false; - shellBoost = false; - cFreeze = false; - tRegen = false; - rageMode = false; - adrenalineMode = false; - vodka = false; - redWine = false; - grapeBeer = false; - moonshine = false; - rum = false; - whiskey = false; - fireball = false; - everclear = false; - bloodyMary = false; - tequila = false; - caribbeanRum = false; - cinnamonRoll = false; - tequilaSunrise = false; - margarita = false; - starBeamRye = false; - screwdriver = false; - moscowMule = false; - whiteWine = false; - evergreenGin = false; - tranquilityCandle = false; - chaosCandle = false; - purpleCandle = false; - blueCandle = false; - pinkCandle = false; - pinkCandleHealFraction = 0D; - yellowCandle = false; - trippy = false; - amidiasBlessing = false; - revivifyTimer = 0; - healCounter = 300; - #endregion + sRegen = false; + sPower = false; + onyxExcavator = false; + angryDog = false; + fab = false; + crysthamyr = false; + abyssalDivingSuitPlates = false; + sirenWaterBuff = false; + sirenIce = false; + trinketOfChiBuff = false; + chiBuffTimer = 0; + corrEffigy = false; + crimEffigy = false; + rRage = false; + xRage = false; + xWrath = false; + graxDefense = false; + sMeleeBoost = false; + tFury = false; + cadence = false; + omniscience = false; + zerg = false; + zen = false; + permafrostsConcoction = false; + armorCrumbling = false; + armorShattering = false; + ceaselessHunger = false; + calcium = false; + soaring = false; + bounding = false; + triumph = false; + penumbra = false; + photosynthesis = false; + astralInjection = false; + gravityNormalizer = false; + holyWrath = false; + profanedRage = false; + draconicSurge = false; + draconicSurgeCooldown = 0; + yPower = false; + aWeapon = false; + tScale = false; + fabsolVodka = false; + invincible = false; + shine = false; + anechoicCoating = false; + mushy = false; + molten = false; + enraged = false; + shellBoost = false; + cFreeze = false; + tRegen = false; + rageMode = false; + adrenalineMode = false; + vodka = false; + redWine = false; + grapeBeer = false; + moonshine = false; + rum = false; + whiskey = false; + fireball = false; + everclear = false; + bloodyMary = false; + tequila = false; + caribbeanRum = false; + cinnamonRoll = false; + tequilaSunrise = false; + margarita = false; + starBeamRye = false; + screwdriver = false; + moscowMule = false; + whiteWine = false; + evergreenGin = false; + tranquilityCandle = false; + chaosCandle = false; + purpleCandle = false; + blueCandle = false; + pinkCandle = false; + pinkCandleHealFraction = 0D; + yellowCandle = false; + trippy = false; + amidiasBlessing = false; + revivifyTimer = 0; + healCounter = 300; + #endregion - #region Armorbonuses - flamethrowerBoost = false; - shadowSpeed = false; - godSlayer = false; - godSlayerDamage = false; - godSlayerMage = false; - godSlayerRanged = false; - godSlayerThrowing = false; - godSlayerSummon = false; - godSlayerReflect = false; - auricBoost = false; - silvaSet = false; - silvaMelee = false; - silvaRanged = false; - silvaThrowing = false; - silvaMage = false; - silvaSummon = false; - hasSilvaEffect = false; - silvaCountdown = 600; - silvaHitCounter = 0; - auricSet = false; - omegaBlueChestplate = false; - omegaBlueSet = false; - omegaBlueCooldown = 0; - molluskSet = false; - daedalusReflect = false; - daedalusSplit = false; - daedalusAbsorb = false; - daedalusShard = false; - reaverSpore = false; - reaverDoubleTap = false; - shadeRegen = false; - dsSetBonus = false; - reaverBlast = false; - reaverBurst = false; - astralStarRain = false; - ataxiaMage = false; - ataxiaBolt = false; - ataxiaGeyser = false; - ataxiaFire = false; - ataxiaVolley = false; - ataxiaBlaze = false; - victideSet = false; - aeroSet = false; - statigelSet = false; - tarraSet = false; - tarraMelee = false; - tarraMage = false; - tarraRanged = false; - tarraThrowing = false; - tarraThrowingCrits = 0; - tarraThrowingCritTimer = 0; - tarraSummon = false; - bloodflareSet = false; - bloodflareMelee = false; - bloodflareMeleeHits = 0; - bloodflareFrenzyTimer = 0; - bloodflareFrenzyCooldown = 0; - bloodflareRanged = false; - bloodflareRangedCooldown = 0; - bloodflareThrowing = false; - bloodflareMage = false; - bloodflareSummon = false; - bloodflareSummonTimer = 0; - xerocSet = false; - IBoots = false; - elysianFire = false; - elysianAegis = false; - elysianGuard = false; - #endregion + #region Armorbonuses + flamethrowerBoost = false; + shadowSpeed = false; + godSlayer = false; + godSlayerDamage = false; + godSlayerMage = false; + godSlayerRanged = false; + godSlayerThrowing = false; + godSlayerSummon = false; + godSlayerReflect = false; + auricBoost = false; + silvaSet = false; + silvaMelee = false; + silvaRanged = false; + silvaThrowing = false; + silvaMage = false; + silvaSummon = false; + hasSilvaEffect = false; + silvaCountdown = 600; + silvaHitCounter = 0; + auricSet = false; + omegaBlueChestplate = false; + omegaBlueSet = false; + omegaBlueCooldown = 0; + molluskSet = false; + daedalusReflect = false; + daedalusSplit = false; + daedalusAbsorb = false; + daedalusShard = false; + reaverSpore = false; + reaverDoubleTap = false; + shadeRegen = false; + dsSetBonus = false; + reaverBlast = false; + reaverBurst = false; + astralStarRain = false; + ataxiaMage = false; + ataxiaBolt = false; + ataxiaGeyser = false; + ataxiaFire = false; + ataxiaVolley = false; + ataxiaBlaze = false; + victideSet = false; + aeroSet = false; + statigelSet = false; + tarraSet = false; + tarraMelee = false; + tarraMage = false; + tarraRanged = false; + tarraThrowing = false; + tarraThrowingCrits = 0; + tarraThrowingCritTimer = 0; + tarraSummon = false; + bloodflareSet = false; + bloodflareMelee = false; + bloodflareMeleeHits = 0; + bloodflareFrenzyTimer = 0; + bloodflareFrenzyCooldown = 0; + bloodflareRanged = false; + bloodflareRangedCooldown = 0; + bloodflareThrowing = false; + bloodflareMage = false; + bloodflareSummon = false; + bloodflareSummonTimer = 0; + xerocSet = false; + IBoots = false; + elysianFire = false; + elysianAegis = false; + elysianGuard = false; + #endregion - if (CalamityWorld.bossRushActive) - { - if (!CalamityGlobalNPC.AnyLivingPlayers()) - { - CalamityWorld.bossRushActive = false; - CalamityWorld.bossRushStage = 0; - CalamityMod.UpdateServerBoolean(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); - netMessage.Send(); - } - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && Main.npc[doom].boss) - { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - } - } - if (CalamityWorld.armageddon && !areThereAnyDamnBosses) - { - player.respawnTimer -= 5; - } - else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert - { - player.respawnTimer--; - } - } - #endregion + if (CalamityWorld.bossRushActive) + { + if (!CalamityGlobalNPC.AnyLivingPlayers()) + { + CalamityWorld.bossRushActive = false; + CalamityWorld.bossRushStage = 0; + CalamityMod.UpdateServerBoolean(); + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(CalamityWorld.bossRushStage); + netMessage.Send(); + } + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && Main.npc[doom].boss) + { + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + } + } + if (CalamityWorld.armageddon && !areThereAnyDamnBosses) + { + player.respawnTimer -= 5; + } + else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert + { + player.respawnTimer--; + } + } + #endregion - #region BiomeStuff - public override void UpdateBiomeVisuals() - { - bool useNebula = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")); - player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", useNebula); + #region BiomeStuff + public override void UpdateBiomeVisuals() + { + bool useNebula = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")); + player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", useNebula); - bool useNebulaS = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")); - player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHeadS", useNebulaS); + bool useNebulaS = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")); + player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHeadS", useNebulaS); - bool useBrimstone = NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); - player.ManageSpecialBiomeVisuals("CalamityMod:CalamitasRun3", useBrimstone); + bool useBrimstone = NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); + player.ManageSpecialBiomeVisuals("CalamityMod:CalamitasRun3", useBrimstone); - bool usePlague = NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); - player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague); + bool usePlague = NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); + player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague); - Point point = player.Center.ToTileCoordinates(); - bool aboveGround = point.Y > Main.maxTilesY - 320; - bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); - bool useFire = NPC.AnyNPCs(mod.NPCType("Yharon")); - player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); - player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || trippy || - (aboveGround || ((double)point.Y < Main.worldSurface && player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive())))); + Point point = player.Center.ToTileCoordinates(); + bool aboveGround = point.Y > Main.maxTilesY - 320; + bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); + bool useFire = NPC.AnyNPCs(mod.NPCType("Yharon")); + player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); + player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || trippy || + (aboveGround || ((double)point.Y < Main.worldSurface && player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive())))); - bool useWater = NPC.AnyNPCs(mod.NPCType("Leviathan")); - player.ManageSpecialBiomeVisuals("CalamityMod:Leviathan", useWater); + bool useWater = NPC.AnyNPCs(mod.NPCType("Leviathan")); + player.ManageSpecialBiomeVisuals("CalamityMod:Leviathan", useWater); - bool useHoly = NPC.AnyNPCs(mod.NPCType("Providence")); - player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); + bool useHoly = NPC.AnyNPCs(mod.NPCType("Providence")); + player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); - bool useSBrimstone = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); - player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); + bool useSBrimstone = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); - bool inAstral = ZoneAstral; - player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); - } + bool inAstral = ZoneAstral; + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); + } - public override void UpdateBiomes() - { - Point point = player.Center.ToTileCoordinates(); - ZoneCalamity = CalamityWorld.calamityTiles > 50; - ZoneAstral = !player.ZoneDungeon && (CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300)); - ZoneSunkenSea = CalamityWorld.sunkenSeaTiles > 150; + public override void UpdateBiomes() + { + Point point = player.Center.ToTileCoordinates(); + ZoneCalamity = CalamityWorld.calamityTiles > 50; + ZoneAstral = !player.ZoneDungeon && (CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300)); + ZoneSunkenSea = CalamityWorld.sunkenSeaTiles > 150; - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmY = y - 250; - int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmY = y - 250; + int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); - bool abyssPosX = false; - bool sulphurPosX = false; - bool abyssPosY = (point.Y <= abyssChasmY); - if (CalamityWorld.abyssSide) - { - if (point.X < 380) - { - sulphurPosX = true; - } - if (point.X < abyssChasmX + 80) - { - abyssPosX = true; - } - } - else - { - if (point.X > Main.maxTilesX - 380) - { - sulphurPosX = true; - } - if (point.X > abyssChasmX - 80) - { - abyssPosX = true; - } - } + bool abyssPosX = false; + bool sulphurPosX = false; + bool abyssPosY = (point.Y <= abyssChasmY); + if (CalamityWorld.abyssSide) + { + if (point.X < 380) + { + sulphurPosX = true; + } + if (point.X < abyssChasmX + 80) + { + abyssPosX = true; + } + } + else + { + if (point.X > Main.maxTilesX - 380) + { + sulphurPosX = true; + } + if (point.X > abyssChasmX - 80) + { + abyssPosX = true; + } + } - ZoneAbyss = (((double)point.Y > (Main.rockLayer - (double)y * 0.05)) && - !player.lavaWet && - !player.honeyWet && - abyssPosY && - abyssPosX); + ZoneAbyss = (((double)point.Y > (Main.rockLayer - (double)y * 0.05)) && + !player.lavaWet && + !player.honeyWet && + abyssPosY && + abyssPosX); - ZoneAbyssLayer1 = ZoneAbyss && - (double)point.Y <= (Main.rockLayer + (double)y * 0.03); + ZoneAbyssLayer1 = ZoneAbyss && + (double)point.Y <= (Main.rockLayer + (double)y * 0.03); - ZoneAbyssLayer2 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.03) && - (double)point.Y <= (Main.rockLayer + (double)y * 0.14); + ZoneAbyssLayer2 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.03) && + (double)point.Y <= (Main.rockLayer + (double)y * 0.14); - ZoneAbyssLayer3 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.14) && - (double)point.Y <= (Main.rockLayer + (double)y * 0.26); + ZoneAbyssLayer3 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.14) && + (double)point.Y <= (Main.rockLayer + (double)y * 0.26); - ZoneAbyssLayer4 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.26); + ZoneAbyssLayer4 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.26); - ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; - } + ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; + } - public override bool CustomBiomesMatch(Player other) - { - CalamityPlayer modOther = other.Calamity(); - return ZoneCalamity == modOther.ZoneCalamity || ZoneAstral == modOther.ZoneAstral || ZoneAbyss == modOther.ZoneAbyss || - ZoneAbyssLayer1 == modOther.ZoneAbyssLayer1 || ZoneAbyssLayer2 == modOther.ZoneAbyssLayer2 || - ZoneAbyssLayer3 == modOther.ZoneAbyssLayer3 || ZoneAbyssLayer4 == modOther.ZoneAbyssLayer4 || - ZoneSulphur == modOther.ZoneSulphur || ZoneSunkenSea == modOther.ZoneSunkenSea; - } + public override bool CustomBiomesMatch(Player other) + { + CalamityPlayer modOther = other.Calamity(); + return ZoneCalamity == modOther.ZoneCalamity || ZoneAstral == modOther.ZoneAstral || ZoneAbyss == modOther.ZoneAbyss || + ZoneAbyssLayer1 == modOther.ZoneAbyssLayer1 || ZoneAbyssLayer2 == modOther.ZoneAbyssLayer2 || + ZoneAbyssLayer3 == modOther.ZoneAbyssLayer3 || ZoneAbyssLayer4 == modOther.ZoneAbyssLayer4 || + ZoneSulphur == modOther.ZoneSulphur || ZoneSunkenSea == modOther.ZoneSunkenSea; + } - public override void CopyCustomBiomesTo(Player other) - { - CalamityPlayer modOther = other.Calamity(); - modOther.ZoneCalamity = ZoneCalamity; - modOther.ZoneAstral = ZoneAstral; - modOther.ZoneSulphur = ZoneSulphur; - modOther.ZoneSunkenSea = ZoneSunkenSea; - modOther.ZoneAbyss = ZoneAbyss; - modOther.ZoneAbyssLayer1 = ZoneAbyssLayer1; - modOther.ZoneAbyssLayer2 = ZoneAbyssLayer2; - modOther.ZoneAbyssLayer3 = ZoneAbyssLayer3; - modOther.ZoneAbyssLayer4 = ZoneAbyssLayer4; - } + public override void CopyCustomBiomesTo(Player other) + { + CalamityPlayer modOther = other.Calamity(); + modOther.ZoneCalamity = ZoneCalamity; + modOther.ZoneAstral = ZoneAstral; + modOther.ZoneSulphur = ZoneSulphur; + modOther.ZoneSunkenSea = ZoneSunkenSea; + modOther.ZoneAbyss = ZoneAbyss; + modOther.ZoneAbyssLayer1 = ZoneAbyssLayer1; + modOther.ZoneAbyssLayer2 = ZoneAbyssLayer2; + modOther.ZoneAbyssLayer3 = ZoneAbyssLayer3; + modOther.ZoneAbyssLayer4 = ZoneAbyssLayer4; + } - public override void SendCustomBiomes(BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = ZoneCalamity; - flags[1] = ZoneAstral; - flags[2] = ZoneAbyss; - flags[3] = ZoneAbyssLayer1; - flags[4] = ZoneAbyssLayer2; - flags[5] = ZoneAbyssLayer3; - flags[6] = ZoneAbyssLayer4; - flags[7] = ZoneSulphur; + public override void SendCustomBiomes(BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = ZoneCalamity; + flags[1] = ZoneAstral; + flags[2] = ZoneAbyss; + flags[3] = ZoneAbyssLayer1; + flags[4] = ZoneAbyssLayer2; + flags[5] = ZoneAbyssLayer3; + flags[6] = ZoneAbyssLayer4; + flags[7] = ZoneSulphur; - BitsByte flags2 = new BitsByte(); - flags2[0] = ZoneSunkenSea; + BitsByte flags2 = new BitsByte(); + flags2[0] = ZoneSunkenSea; - writer.Write(flags); - writer.Write(flags2); - } + writer.Write(flags); + writer.Write(flags2); + } - public override void ReceiveCustomBiomes(BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - ZoneCalamity = flags[0]; - ZoneAstral = flags[1]; - ZoneAbyss = flags[2]; - ZoneAbyssLayer1 = flags[3]; - ZoneAbyssLayer2 = flags[4]; - ZoneAbyssLayer3 = flags[5]; - ZoneAbyssLayer4 = flags[6]; - ZoneSulphur = flags[7]; + public override void ReceiveCustomBiomes(BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + ZoneCalamity = flags[0]; + ZoneAstral = flags[1]; + ZoneAbyss = flags[2]; + ZoneAbyssLayer1 = flags[3]; + ZoneAbyssLayer2 = flags[4]; + ZoneAbyssLayer3 = flags[5]; + ZoneAbyssLayer4 = flags[6]; + ZoneSulphur = flags[7]; - BitsByte flags2 = reader.ReadByte(); - ZoneSunkenSea = flags2[0]; - } + BitsByte flags2 = reader.ReadByte(); + ZoneSunkenSea = flags2[0]; + } - public override Texture2D GetMapBackgroundImage() - { - if (ZoneSulphur) - { - return mod.GetTexture("Backgrounds/MapBackgrounds/SulphurBG"); - } - if (ZoneAstral) - { - return mod.GetTexture("Backgrounds/MapBackgrounds/AstralBG"); - } - return null; - } - #endregion + public override Texture2D GetMapBackgroundImage() + { + if (ZoneSulphur) + { + return mod.GetTexture("Backgrounds/MapBackgrounds/SulphurBG"); + } + if (ZoneAstral) + { + return mod.GetTexture("Backgrounds/MapBackgrounds/AstralBG"); + } + return null; + } + #endregion - #region InventoryStartup - public override void SetupStartInventory(IList items, bool mediumcoreDeath) - { - if (!mediumcoreDeath) - { - player.inventory[9].SetDefaults(mod.ItemType("Revenge")); - player.inventory[8].SetDefaults(mod.ItemType("IronHeart")); - player.inventory[7].SetDefaults(mod.ItemType("StarterBag")); - } - } - #endregion + #region InventoryStartup + public override void SetupStartInventory(IList items, bool mediumcoreDeath) + { + if (!mediumcoreDeath) + { + player.inventory[9].SetDefaults(mod.ItemType("Revenge")); + player.inventory[8].SetDefaults(mod.ItemType("IronHeart")); + player.inventory[7].SetDefaults(mod.ItemType("StarterBag")); + } + } + #endregion - #region Life Regen - public override void UpdateBadLifeRegen() - { - CalamityPlayerLifeRegen.CalamityUpdateBadLifeRegen(player, mod); - } + #region Life Regen + public override void UpdateBadLifeRegen() + { + CalamityPlayerLifeRegen.CalamityUpdateBadLifeRegen(player, mod); + } - public override void UpdateLifeRegen() - { - CalamityPlayerLifeRegen.CalamityUpdateLifeRegen(player, mod); - } - #endregion + public override void UpdateLifeRegen() + { + CalamityPlayerLifeRegen.CalamityUpdateLifeRegen(player, mod); + } + #endregion - #region HotKeys - public override void ProcessTriggers(TriggersSet triggersSet) - { - if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == player.whoAmI) - { - Vector2 teleportLocation; - teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) - { - teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; - } - else - { - teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; - } - teleportLocation.X -= (float)(player.width / 2); - if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) - { - int x = (int)(teleportLocation.X / 16f); - int y = (int)(teleportLocation.Y / 16f); - if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) - { - player.Teleport(teleportLocation, 4, 0); - NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (player.chaosState) - { - player.statLife -= player.statLifeMax2 / 4; - PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13); - if (Main.rand.NextBool(2)) - { - damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); - } - if (player.statLife <= 0) - { - player.KillMe(damageSource, 1.0, 0, false); - } - player.lifeRegenCount = 0; - player.lifeRegenTime = 0; - } - player.AddBuff(BuffID.ChaosState, 360, true); - } - } - } - if (CalamityMod.BossBarToggleHotKey.JustPressed) - { - if (drawBossHPBar) - { - drawBossHPBar = false; - } - else - { - drawBossHPBar = true; - } - } - if (CalamityMod.BossBarToggleSmallTextHotKey.JustPressed) - { - if (shouldDrawSmallText) - { - shouldDrawSmallText = false; - } - else - { - shouldDrawSmallText = true; - } - } - if (CalamityMod.TarraHotKey.JustPressed) - { - if (tarraMelee && tarraCooldown <= 0) - { - tarraDefense = true; - } - if (bloodflareRanged && bloodflareRangedCooldown <= 0) - { - bloodflareRangedCooldown = 1800; - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 64; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 60, 0f, 0f, 0, default, 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 1.15f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int damage = 800; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 8; i++) - { - float ai1 = (Main.rand.NextFloat() + 0.5f); - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); - } - } - } - if (omegaBlueSet && omegaBlueCooldown <= 0) - { - omegaBlueCooldown = 1800; - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int i = 0; i < 66; i++) - { - int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].velocity *= 6.6f; - } - } - if (dsSetBonus) - { - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 36; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default, 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 1.15f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (player.whoAmI == Main.myPlayer) - { - player.AddBuff(mod.BuffType("Enraged"), 600, false); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= 3000f) - { - nPC.AddBuff(mod.BuffType("Enraged"), 600, false); - } - } - } - } - } - if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) - { - AstralArcanumUI.Toggle(); - } - if (CalamityMod.AstralTeleportHotKey.JustPressed) - { - if (celestialJewel) - { - if (Main.netMode == NetmodeID.SinglePlayer) - { - player.TeleportationPotion(); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); - } - else if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(73, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - if (CalamityMod.AegisHotKey.JustPressed) - { - if (elysianAegis && !player.mount.Active) - { - elysianGuard = !elysianGuard; - } - } - if (CalamityMod.RageHotKey.JustPressed) - { - if (stress == stressMax && !rageMode) - { - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 64; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default, 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 1.15f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - player.AddBuff(mod.BuffType("RageMode"), 300); - } - } - if (CalamityMod.AdrenalineHotKey.JustPressed) - { - if (adrenaline == adrenalineMax && !adrenalineMode) - { - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 64; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 206, 0f, 0f, 0, default, 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 2f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 206, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - player.AddBuff(mod.BuffType("AdrenalineMode"), 300); - } - } - } - #endregion + #region HotKeys + public override void ProcessTriggers(TriggersSet triggersSet) + { + if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == player.whoAmI) + { + Vector2 teleportLocation; + teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; + if (player.gravDir == 1f) + { + teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; + } + else + { + teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; + } + teleportLocation.X -= (float)(player.width / 2); + if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) + { + int x = (int)(teleportLocation.X / 16f); + int y = (int)(teleportLocation.Y / 16f); + if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) + { + player.Teleport(teleportLocation, 4, 0); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + if (player.chaosState) + { + player.statLife -= player.statLifeMax2 / 4; + PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13); + if (Main.rand.NextBool(2)) + { + damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); + } + if (player.statLife <= 0) + { + player.KillMe(damageSource, 1.0, 0, false); + } + player.lifeRegenCount = 0; + player.lifeRegenTime = 0; + } + player.AddBuff(BuffID.ChaosState, 360, true); + } + } + } + if (CalamityMod.BossBarToggleHotKey.JustPressed) + { + if (drawBossHPBar) + { + drawBossHPBar = false; + } + else + { + drawBossHPBar = true; + } + } + if (CalamityMod.BossBarToggleSmallTextHotKey.JustPressed) + { + if (shouldDrawSmallText) + { + shouldDrawSmallText = false; + } + else + { + shouldDrawSmallText = true; + } + } + if (CalamityMod.TarraHotKey.JustPressed) + { + if (tarraMelee && tarraCooldown <= 0) + { + tarraDefense = true; + } + if (bloodflareRanged && bloodflareRangedCooldown <= 0) + { + bloodflareRangedCooldown = 1800; + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 64; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 60, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 1.15f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int damage = 800; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 8; i++) + { + float ai1 = (Main.rand.NextFloat() + 0.5f); + float randomSpeed = (float)Main.rand.Next(1, 7); + float randomSpeed2 = (float)Main.rand.Next(1, 7); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); + } + } + } + if (omegaBlueSet && omegaBlueCooldown <= 0) + { + omegaBlueCooldown = 1800; + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int i = 0; i < 66; i++) + { + int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); + Main.dust[d].noGravity = true; + Main.dust[d].noLight = true; + Main.dust[d].fadeIn = 1f; + Main.dust[d].velocity *= 6.6f; + } + } + if (dsSetBonus) + { + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 36; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 1.15f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(mod.BuffType("Enraged"), 600, false); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= 3000f) + { + nPC.AddBuff(mod.BuffType("Enraged"), 600, false); + } + } + } + } + } + if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) + { + AstralArcanumUI.Toggle(); + } + if (CalamityMod.AstralTeleportHotKey.JustPressed) + { + if (celestialJewel) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + player.TeleportationPotion(); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); + } + else if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(73, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + if (CalamityMod.AegisHotKey.JustPressed) + { + if (elysianAegis && !player.mount.Active) + { + elysianGuard = !elysianGuard; + } + } + if (CalamityMod.RageHotKey.JustPressed) + { + if (stress == stressMax && !rageMode) + { + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 64; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 1.15f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + player.AddBuff(mod.BuffType("RageMode"), 300); + } + } + if (CalamityMod.AdrenalineHotKey.JustPressed) + { + if (adrenaline == adrenalineMax && !adrenalineMode) + { + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 64; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 206, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 2f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 206, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + player.AddBuff(mod.BuffType("AdrenalineMode"), 300); + } + } + } + #endregion - #region TeleportMethods - public void HandleTeleport(int teleportType, bool forceHandle = false, int whoAmI = 0) - { - bool syncData = forceHandle || Main.netMode == NetmodeID.SinglePlayer; - if (syncData) - { - TeleportPlayer(teleportType, forceHandle, whoAmI); - } - else - { - SyncTeleport(teleportType); - } - } + #region TeleportMethods + public void HandleTeleport(int teleportType, bool forceHandle = false, int whoAmI = 0) + { + bool syncData = forceHandle || Main.netMode == NetmodeID.SinglePlayer; + if (syncData) + { + TeleportPlayer(teleportType, forceHandle, whoAmI); + } + else + { + SyncTeleport(teleportType); + } + } - public static void TeleportPlayer(int teleportType, bool syncData = false, int whoAmI = 0) - { - Player player; - if (!syncData) - { - player = Main.LocalPlayer; - } - else - { - player = Main.player[whoAmI]; - } - switch (teleportType) - { - case 0: UnderworldTeleport(player, syncData); break; - case 1: DungeonTeleport(player, syncData); break; - case 2: JungleTeleport(player, syncData); break; - default: break; - } - } + public static void TeleportPlayer(int teleportType, bool syncData = false, int whoAmI = 0) + { + Player player; + if (!syncData) + { + player = Main.LocalPlayer; + } + else + { + player = Main.player[whoAmI]; + } + switch (teleportType) + { + case 0: + UnderworldTeleport(player, syncData); + break; + case 1: + DungeonTeleport(player, syncData); + break; + case 2: + JungleTeleport(player, syncData); + break; + default: + break; + } + } - public void SyncTeleport(int teleportType) - { - ModPacket netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.TeleportPlayer); - netMessage.Write(teleportType); - netMessage.Send(); - } + public void SyncTeleport(int teleportType) + { + ModPacket netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.TeleportPlayer); + netMessage.Write(teleportType); + netMessage.Send(); + } - public static void UnderworldTeleport(Player player, bool syncData = false) - { - int teleportStartX = 100; - int teleportRangeX = Main.maxTilesX - 200; - int teleportStartY = Main.maxTilesY - 200; - int teleportRangeY = 50; - bool flag = false; - int num = 0; - int num2 = 0; - int num3 = 0; - int width = player.width; - Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - while (!flag && num < 1000) - { - num++; - num2 = teleportStartX + Main.rand.Next(teleportRangeX); - num3 = teleportStartY + Main.rand.Next(teleportRangeY); - vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - if (!Collision.SolidCollision(vector, width, player.height)) - { - if (Main.tile[num2, num3] == null) - { - Main.tile[num2, num3] = new Tile(); - } - int i = 0; - while (i < 100) - { - if (Main.tile[num2, num3 + i] == null) - { - Main.tile[num2, num3 + i] = new Tile(); - } - Tile tile = Main.tile[num2, num3 + i]; - vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); - if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) - { - bool arg_1FE_0 = vector2.Y == vector.Y; - } - if (arg_1FF_0) - { - i++; - } - else - { - if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) - { - break; - } - i++; - } - } - if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) - { - Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - if (Collision.SolidCollision(vector, width, player.height) && i < 99) - { - Vector2 vector3 = Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - flag = true; - num3 += i; - break; - } - } - } - } - } - } - } - } - if (!flag) - { - return; - } - ModTeleport(player, vector, syncData, false); - } + public static void UnderworldTeleport(Player player, bool syncData = false) + { + int teleportStartX = 100; + int teleportRangeX = Main.maxTilesX - 200; + int teleportStartY = Main.maxTilesY - 200; + int teleportRangeY = 50; + bool flag = false; + int num = 0; + int num2 = 0; + int num3 = 0; + int width = player.width; + Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + while (!flag && num < 1000) + { + num++; + num2 = teleportStartX + Main.rand.Next(teleportRangeX); + num3 = teleportStartY + Main.rand.Next(teleportRangeY); + vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + if (!Collision.SolidCollision(vector, width, player.height)) + { + if (Main.tile[num2, num3] == null) + { + Main.tile[num2, num3] = new Tile(); + } + int i = 0; + while (i < 100) + { + if (Main.tile[num2, num3 + i] == null) + { + Main.tile[num2, num3 + i] = new Tile(); + } + Tile tile = Main.tile[num2, num3 + i]; + vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); + if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) + { + bool arg_1FE_0 = vector2.Y == vector.Y; + } + if (arg_1FF_0) + { + i++; + } + else + { + if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) + { + break; + } + i++; + } + } + if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) + { + Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + if (Collision.SolidCollision(vector, width, player.height) && i < 99) + { + Vector2 vector3 = Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + flag = true; + num3 += i; + break; + } + } + } + } + } + } + } + } + if (!flag) + { + return; + } + ModTeleport(player, vector, syncData, false); + } - public static void DungeonTeleport(Player player, bool syncData = false) - { - ModTeleport(player, new Vector2(Main.dungeonX, Main.dungeonY), syncData, true); - } + public static void DungeonTeleport(Player player, bool syncData = false) + { + ModTeleport(player, new Vector2(Main.dungeonX, Main.dungeonY), syncData, true); + } - public static void JungleTeleport(Player player, bool syncData = false) - { - int teleportStartX = CalamityWorld.abyssSide ? (int)((double)Main.maxTilesX * 0.65) : (int)((double)Main.maxTilesX * 0.2); - int teleportRangeX = (int)((double)Main.maxTilesX * 0.15); + public static void JungleTeleport(Player player, bool syncData = false) + { + int teleportStartX = CalamityWorld.abyssSide ? (int)((double)Main.maxTilesX * 0.65) : (int)((double)Main.maxTilesX * 0.2); + int teleportRangeX = (int)((double)Main.maxTilesX * 0.15); - int teleportStartY = (int)Main.worldSurface - 75; - int teleportRangeY = 50; + int teleportStartY = (int)Main.worldSurface - 75; + int teleportRangeY = 50; - bool flag = false; - int num = 0; - int num2 = 0; - int num3 = 0; - int width = player.width; - Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - while (!flag && num < 1000) - { - num++; - num2 = teleportStartX + Main.rand.Next(teleportRangeX); - num3 = teleportStartY + Main.rand.Next(teleportRangeY); - vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - if (!Collision.SolidCollision(vector, width, player.height)) - { - if (Main.tile[num2, num3] == null) - { - Main.tile[num2, num3] = new Tile(); - } - int i = 0; - while (i < 100) - { - if (Main.tile[num2, num3 + i] == null) - { - Main.tile[num2, num3 + i] = new Tile(); - } - Tile tile = Main.tile[num2, num3 + i]; - vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); - if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) - { - bool arg_1FE_0 = vector2.Y == vector.Y; - } - if (arg_1FF_0) - { - i++; - } - else - { - if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) - { - break; - } - i++; - } - } - if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) - { - Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - if (Collision.SolidCollision(vector, width, player.height) && i < 99) - { - Vector2 vector3 = Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - flag = true; - num3 += i; - break; - } - } - } - } - } - } - } - } - if (!flag) - { - return; - } + bool flag = false; + int num = 0; + int num2 = 0; + int num3 = 0; + int width = player.width; + Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + while (!flag && num < 1000) + { + num++; + num2 = teleportStartX + Main.rand.Next(teleportRangeX); + num3 = teleportStartY + Main.rand.Next(teleportRangeY); + vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + if (!Collision.SolidCollision(vector, width, player.height)) + { + if (Main.tile[num2, num3] == null) + { + Main.tile[num2, num3] = new Tile(); + } + int i = 0; + while (i < 100) + { + if (Main.tile[num2, num3 + i] == null) + { + Main.tile[num2, num3 + i] = new Tile(); + } + Tile tile = Main.tile[num2, num3 + i]; + vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); + if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) + { + bool arg_1FE_0 = vector2.Y == vector.Y; + } + if (arg_1FF_0) + { + i++; + } + else + { + if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) + { + break; + } + i++; + } + } + if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) + { + Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + if (Collision.SolidCollision(vector, width, player.height) && i < 99) + { + Vector2 vector3 = Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + flag = true; + num3 += i; + break; + } + } + } + } + } + } + } + } + if (!flag) + { + return; + } - ModTeleport(player, vector, syncData, false); - } + ModTeleport(player, vector, syncData, false); + } - public static void ModTeleport(Player player, Vector2 pos, bool syncData = false, bool convertFromTiles = false) - { - bool postImmune = player.immune; - int postImmunteTime = player.immuneTime; - if (convertFromTiles) - { - pos = new Vector2(pos.X * 16 + 8 - player.width / 2, pos.Y * 16 - player.height); - } - player.grappling[0] = -1; - player.grapCount = 0; - for (int index = 0; index < 1000; ++index) - { - if (Main.projectile[index].active && Main.projectile[index].owner == player.whoAmI && Main.projectile[index].aiStyle == 7) - { - Main.projectile[index].Kill(); - } - } - player.Teleport(pos, 2, 0); - player.velocity = Vector2.Zero; - player.immune = postImmune; - player.immuneTime = postImmunteTime; - for (int index = 0; index < 100; ++index) - { - Main.dust[Dust.NewDust(player.position, player.width, player.height, 164, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; - } - Main.TeleportEffect(player.getRect(), 1); - Main.TeleportEffect(player.getRect(), 3); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); - if (Main.netMode != NetmodeID.Server) - { - return; - } - if (syncData) - { - RemoteClient.CheckSection(player.whoAmI, player.position, 1); - NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, 3, 0, 0); - } - } - #endregion + public static void ModTeleport(Player player, Vector2 pos, bool syncData = false, bool convertFromTiles = false) + { + bool postImmune = player.immune; + int postImmunteTime = player.immuneTime; + if (convertFromTiles) + { + pos = new Vector2(pos.X * 16 + 8 - player.width / 2, pos.Y * 16 - player.height); + } + player.grappling[0] = -1; + player.grapCount = 0; + for (int index = 0; index < 1000; ++index) + { + if (Main.projectile[index].active && Main.projectile[index].owner == player.whoAmI && Main.projectile[index].aiStyle == 7) + { + Main.projectile[index].Kill(); + } + } + player.Teleport(pos, 2, 0); + player.velocity = Vector2.Zero; + player.immune = postImmune; + player.immuneTime = postImmunteTime; + for (int index = 0; index < 100; ++index) + { + Main.dust[Dust.NewDust(player.position, player.width, player.height, 164, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; + } + Main.TeleportEffect(player.getRect(), 1); + Main.TeleportEffect(player.getRect(), 3); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); + if (Main.netMode != NetmodeID.Server) + { + return; + } + if (syncData) + { + RemoteClient.CheckSection(player.whoAmI, player.position, 1); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, 3, 0, 0); + } + } + #endregion - #region UpdateEquips - public override void UpdateVanityAccessories() - { - for (int n = 13; n < 18 + player.extraAccessorySlots; n++) - { - Item item = player.armor[n]; - if (item.type == ModContent.ItemType()) - { - snowmanHide = false; - snowmanForce = true; - } - else if (item.type == ModContent.ItemType()) - { - abyssalDivingSuitHide = false; - abyssalDivingSuitForce = true; - } - else if (item.type == ModContent.ItemType()) - { - sirenBoobsHide = false; - sirenBoobsForce = true; - } - else if (item.type == ModContent.ItemType()) - { - sirenBoobsAltHide = false; - sirenBoobsAltForce = true; - } - } - } + #region UpdateEquips + public override void UpdateVanityAccessories() + { + for (int n = 13; n < 18 + player.extraAccessorySlots; n++) + { + Item item = player.armor[n]; + if (item.type == ModContent.ItemType()) + { + snowmanHide = false; + snowmanForce = true; + } + else if (item.type == ModContent.ItemType()) + { + abyssalDivingSuitHide = false; + abyssalDivingSuitForce = true; + } + else if (item.type == ModContent.ItemType()) + { + sirenBoobsHide = false; + sirenBoobsForce = true; + } + else if (item.type == ModContent.ItemType()) + { + sirenBoobsAltHide = false; + sirenBoobsAltForce = true; + } + } + } - public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) - { - if (Config.MiningSpeedBoost) - { - player.pickSpeed *= 0.75f; - } + public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) + { + if (Config.MiningSpeedBoost) + { + player.pickSpeed *= 0.75f; + } - #region MeleeSpeed - float meleeSpeedMult = 0f; - if (bBlood) - { - meleeSpeedMult += 0.025f; - } - if (rRage) - { - meleeSpeedMult += 0.05f; - } - if (graxDefense) - { - meleeSpeedMult += 0.1f; - } - if (sMeleeBoost) - { - meleeSpeedMult += 0.05f; - } - if (yPower) - { - meleeSpeedMult += 0.05f; - } - if (darkSunRing) - { - meleeSpeedMult += 0.12f; - } - if (badgeOfBravery) - { - meleeSpeedMult += 0.15f; - } - if (badgeOfBraveryRare) - { - meleeSpeedMult += 0.2f; - } - if (eGauntlet) - { - meleeSpeedMult += 0.15f; - } - if (yInsignia) - { - meleeSpeedMult += 0.1f; - } - if (bloodyMary) - { - if (Main.bloodMoon) - { - meleeSpeedMult += 0.15f; - } - } - if (community) - { - float floatTypeBoost = 0.01f + - (NPC.downedSlimeKing ? 0.01f : 0f) + - (NPC.downedBoss1 ? 0.01f : 0f) + - (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + - (Main.hardMode ? 0.01f : 0f) + - (NPC.downedMechBossAny ? 0.01f : 0f) + - (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + - (NPC.downedAncientCultist ? 0.01f : 0f) + - (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 - meleeSpeedMult += (floatTypeBoost * 0.25f); - } - if (eArtifact) - { - meleeSpeedMult += 0.1f; - } - if (Config.ProficiencyEnabled) - { - meleeSpeedMult += GetMeleeSpeedBonus(); - } - player.meleeSpeed += meleeSpeedMult; - #endregion + #region MeleeSpeed + float meleeSpeedMult = 0f; + if (bBlood) + { + meleeSpeedMult += 0.025f; + } + if (rRage) + { + meleeSpeedMult += 0.05f; + } + if (graxDefense) + { + meleeSpeedMult += 0.1f; + } + if (sMeleeBoost) + { + meleeSpeedMult += 0.05f; + } + if (yPower) + { + meleeSpeedMult += 0.05f; + } + if (darkSunRing) + { + meleeSpeedMult += 0.12f; + } + if (badgeOfBravery) + { + meleeSpeedMult += 0.15f; + } + if (badgeOfBraveryRare) + { + meleeSpeedMult += 0.2f; + } + if (eGauntlet) + { + meleeSpeedMult += 0.15f; + } + if (yInsignia) + { + meleeSpeedMult += 0.1f; + } + if (bloodyMary) + { + if (Main.bloodMoon) + { + meleeSpeedMult += 0.15f; + } + } + if (community) + { + float floatTypeBoost = 0.01f + + (NPC.downedSlimeKing ? 0.01f : 0f) + + (NPC.downedBoss1 ? 0.01f : 0f) + + (NPC.downedBoss2 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 + (NPC.downedBoss3 ? 0.01f : 0f) + + (Main.hardMode ? 0.01f : 0f) + + (NPC.downedMechBossAny ? 0.01f : 0f) + + (NPC.downedPlantBoss ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 + (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedAncientCultist ? 0.01f : 0f) + + (NPC.downedMoonlord ? 0.01f : 0f) + + (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 + (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 + (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + meleeSpeedMult += (floatTypeBoost * 0.25f); + } + if (eArtifact) + { + meleeSpeedMult += 0.1f; + } + if (Config.ProficiencyEnabled) + { + meleeSpeedMult += GetMeleeSpeedBonus(); + } + player.meleeSpeed += meleeSpeedMult; + #endregion - if (snowman) - { - if (player.whoAmI == Main.myPlayer && !snowmanNoseless) - { - player.AddBuff(ModContent.BuffType(), 60, true); - } - } - if (abyssalDivingSuit) - { - player.AddBuff(ModContent.BuffType(), 60, true); - if (player.whoAmI == Main.myPlayer) - { - if (abyssalDivingSuitCooldown) - { - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] < 30 && hasBuff == mod.BuffType("AbyssalDivingSuitPlatesBroken")) - { - abyssalDivingSuitPlateHits = 0; - player.DelBuff(l); - l = -1; - } - } - } - else - { - player.AddBuff(mod.BuffType("AbyssalDivingSuitPlates"), 2); - } - } - } - if (sirenBoobs) - { - player.AddBuff(ModContent.BuffType(), 60, true); - } - else if (sirenBoobsAlt) - { - player.AddBuff(ModContent.BuffType(), 60, true); - } - if ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) - { - if (player.whoAmI == Main.myPlayer && !sirenIceCooldown) - { - player.AddBuff(mod.BuffType("IceShieldBuff"), 2); - } - } - } - #endregion + if (snowman) + { + if (player.whoAmI == Main.myPlayer && !snowmanNoseless) + { + player.AddBuff(ModContent.BuffType(), 60, true); + } + } + if (abyssalDivingSuit) + { + player.AddBuff(ModContent.BuffType(), 60, true); + if (player.whoAmI == Main.myPlayer) + { + if (abyssalDivingSuitCooldown) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] < 30 && hasBuff == mod.BuffType("AbyssalDivingSuitPlatesBroken")) + { + abyssalDivingSuitPlateHits = 0; + player.DelBuff(l); + l = -1; + } + } + } + else + { + player.AddBuff(mod.BuffType("AbyssalDivingSuitPlates"), 2); + } + } + } + if (sirenBoobs) + { + player.AddBuff(ModContent.BuffType(), 60, true); + } + else if (sirenBoobsAlt) + { + player.AddBuff(ModContent.BuffType(), 60, true); + } + if ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) + { + if (player.whoAmI == Main.myPlayer && !sirenIceCooldown) + { + player.AddBuff(mod.BuffType("IceShieldBuff"), 2); + } + } + } + #endregion - #region PreUpdateBuffs - public override void PreUpdateBuffs() - { - //Remove the mighty wind buff if the player is in the astral desert. - if (player.ZoneDesert && ZoneAstral && player.HasBuff(BuffID.WindPushed)) - { - player.ClearBuff(BuffID.WindPushed); - } - } - #endregion + #region PreUpdateBuffs + public override void PreUpdateBuffs() + { + //Remove the mighty wind buff if the player is in the astral desert. + if (player.ZoneDesert && ZoneAstral && player.HasBuff(BuffID.WindPushed)) + { + player.ClearBuff(BuffID.WindPushed); + } + } + #endregion - #region PostUpdate + #region PostUpdate - #region PostUpdateBuffs - public override void PostUpdateBuffs() - { - if (CalamityWorld.defiled) - Defiled(); + #region PostUpdateBuffs + public override void PostUpdateBuffs() + { + if (CalamityWorld.defiled) + Defiled(); - if (weakPetrification) - WeakPetrification(); + if (weakPetrification) + WeakPetrification(); - if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) - { - player.dashDelay = 60; - dashMod = 0; - } + if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) + { + player.dashDelay = 60; + dashMod = 0; + } - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - if (player.lifeRegen < 0) - player.lifeRegen = 0; - } - } - #endregion + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + { + if (player.lifeRegen < 0) + player.lifeRegen = 0; + } + } + #endregion - #region PostUpdateEquips - public override void PostUpdateEquips() - { - if (CalamityWorld.defiled) - Defiled(); + #region PostUpdateEquips + public override void PostUpdateEquips() + { + if (CalamityWorld.defiled) + Defiled(); - if (weakPetrification) - WeakPetrification(); + if (weakPetrification) + WeakPetrification(); - if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) - { - player.dashDelay = 60; - dashMod = 0; - } + if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) + { + player.dashDelay = 60; + dashMod = 0; + } - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - if (player.lifeRegen < 0) - player.lifeRegen = 0; - } - } - #endregion + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + { + if (player.lifeRegen < 0) + player.lifeRegen = 0; + } + } + #endregion - public override void PostUpdateMiscEffects() - { - if (Config.ExpertDebuffDurationReduction) - Main.expertDebuffTime = 1f; + public override void PostUpdateMiscEffects() + { + if (Config.ExpertDebuffDurationReduction) + Main.expertDebuffTime = 1f; - areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); + areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); - #region RevengeanceEffects - /*if (!areThereAnyDamnBosses) - { - distanceFromBoss = -1; - }*/ - if (CalamityWorld.revenge) - { - if (player.lifeSteal > (CalamityWorld.death ? 30f : 40f)) - { - player.lifeSteal = (CalamityWorld.death ? 30f : 40f); - } - if (player.whoAmI == Main.myPlayer) - { - if (player.onHitDodge) - { - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) - { - player.buffTime[l] = 360; - } - } - } - if (player.immuneTime > (tarraThrowing ? 300 : 120)) - { - player.immuneTime = (tarraThrowing ? 300 : 120); - } - if (Config.AdrenalineAndRage) - { - int stressGain = 0; - if (rageMode) - { - stressGain = -2000; - } - else - { - if (draedonsHeart) - { - if (draedonsStressGain) - { - stressGain += 60; - } - } - else if (heartOfDarkness) - { - stressGain += 30; - } - } - stressCD++; - if (stressCD >= 60) - { - stressCD = 0; - stress += stressGain; - if (stress < 0) - { - stress = 0; - } - if (stress >= stressMax) - { - if (playFullRageSound) - { - playFullRageSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); - } - stress = stressMax; - } - else - { - playFullRageSound = true; - } - } - stressLevel500 = stress >= 9800; - if (stressLevel500 && !hAttack) - { - int heartAttackChance = ((draedonsHeart || heartOfDarkness) ? 2000 : 10000); - if (Main.rand.Next(heartAttackChance) == 0) - { - player.AddBuff(mod.BuffType("HeartAttack"), 18000); - } - } - if (adrenaline >= adrenalineMax) - { - adrenalineMaxTimer--; - if (adrenalineMaxTimer <= 0) - { - if (playAdrenalineBurnoutSound) - { - playAdrenalineBurnoutSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout1"), (int)player.position.X, (int)player.position.Y); - } - adrenalineDmgDown--; - if (adrenalineDmgDown < 0) - { - if (playFullAdrenalineBurnoutSound) - { - playFullAdrenalineBurnoutSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout2"), (int)player.position.X, (int)player.position.Y); - } - adrenalineDmgDown = 0; - } - adrenalineMaxTimer = 0; - } - } - else if (!adrenalineMode && adrenaline <= 0) - { - playAdrenalineBurnoutSound = true; - playFullAdrenalineBurnoutSound = true; - adrenalineDmgDown = 600; - adrenalineMaxTimer = 300; - adrenalineDmgMult = 1f; - } - adrenalineDmgMult = 0.1f * (float)(adrenalineDmgDown / 60); - if (adrenalineDmgMult < 0.33f) - adrenalineDmgMult = 0.33f; - int adrenalineGain = 0; - bool SCalAlive = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); - if (adrenalineMode) - { - adrenalineGain = (SCalAlive ? -10000 : -2000); - } - else - { - if (Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16)) // > - { - adrenaline = 0; - } - else if (areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0) - { - int adrenalineTickBoost = 0 + - (adrenalineBoostOne ? 63 : 0) + //286 - (adrenalineBoostTwo ? 115 : 0) + //401 - (adrenalineBoostThree ? 100 : 0); //501 - adrenalineGain = 223 + adrenalineTickBoost; //pre-slime god = 45, pre-astrum deus = 35, pre-polterghast = 25, post-polter = 20 - /*if (distanceFromBoss == -1 || distanceFromBoss > 5600) - { - adrenalineGain /= 4; - }*/ - } - else - { - adrenaline = 0; - } - } - adrenalineCD++; - if (adrenalineCD >= (SCalAlive ? 135 : 60)) - { - adrenalineCD = 0; - adrenaline += adrenalineGain; - if (adrenaline < 0) - { - adrenaline = 0; - } - if (adrenaline >= adrenalineMax) - { - if (playFullAdrenalineSound) - { - playFullAdrenalineSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); - } - adrenaline = adrenalineMax; - } - else - { - playFullAdrenalineSound = true; - } - } - } - } - } - else - { - if (player.whoAmI == Main.myPlayer) - { - stressCD++; - if (stressCD >= 60) - { - stressCD = 0; - stress += -30; - if (stress < 0) - { - stress = 0; - } - } - adrenalineCD++; - if (adrenalineCD >= 60) - { - adrenalineCD = 0; - adrenaline += -30; - if (adrenaline < 0) - { - adrenaline = 0; - } - } - } - } - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) - { - packetTimer++; - if (packetTimer == 60) - { - packetTimer = 0; - StressPacket(false); - AdrenalinePacket(false); - RadiationPacket(false); - /*if (areThereAnyDamnBosses) - DistanceFromBossPacket(false);*/ - } - } - #endregion + #region RevengeanceEffects + /*if (!areThereAnyDamnBosses) + { + distanceFromBoss = -1; + }*/ + if (CalamityWorld.revenge) + { + if (player.lifeSteal > (CalamityWorld.death ? 30f : 40f)) + { + player.lifeSteal = (CalamityWorld.death ? 30f : 40f); + } + if (player.whoAmI == Main.myPlayer) + { + if (player.onHitDodge) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) + { + player.buffTime[l] = 360; + } + } + } + if (player.immuneTime > (tarraThrowing ? 300 : 120)) + { + player.immuneTime = (tarraThrowing ? 300 : 120); + } + if (Config.AdrenalineAndRage) + { + int stressGain = 0; + if (rageMode) + { + stressGain = -2000; + } + else + { + if (draedonsHeart) + { + if (draedonsStressGain) + { + stressGain += 60; + } + } + else if (heartOfDarkness) + { + stressGain += 30; + } + } + stressCD++; + if (stressCD >= 60) + { + stressCD = 0; + stress += stressGain; + if (stress < 0) + { + stress = 0; + } + if (stress >= stressMax) + { + if (playFullRageSound) + { + playFullRageSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); + } + stress = stressMax; + } + else + { + playFullRageSound = true; + } + } + stressLevel500 = stress >= 9800; + if (stressLevel500 && !hAttack) + { + int heartAttackChance = ((draedonsHeart || heartOfDarkness) ? 2000 : 10000); + if (Main.rand.Next(heartAttackChance) == 0) + { + player.AddBuff(mod.BuffType("HeartAttack"), 18000); + } + } + if (adrenaline >= adrenalineMax) + { + adrenalineMaxTimer--; + if (adrenalineMaxTimer <= 0) + { + if (playAdrenalineBurnoutSound) + { + playAdrenalineBurnoutSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout1"), (int)player.position.X, (int)player.position.Y); + } + adrenalineDmgDown--; + if (adrenalineDmgDown < 0) + { + if (playFullAdrenalineBurnoutSound) + { + playFullAdrenalineBurnoutSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout2"), (int)player.position.X, (int)player.position.Y); + } + adrenalineDmgDown = 0; + } + adrenalineMaxTimer = 0; + } + } + else if (!adrenalineMode && adrenaline <= 0) + { + playAdrenalineBurnoutSound = true; + playFullAdrenalineBurnoutSound = true; + adrenalineDmgDown = 600; + adrenalineMaxTimer = 300; + adrenalineDmgMult = 1f; + } + adrenalineDmgMult = 0.1f * (float)(adrenalineDmgDown / 60); + if (adrenalineDmgMult < 0.33f) + adrenalineDmgMult = 0.33f; + int adrenalineGain = 0; + bool SCalAlive = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + if (adrenalineMode) + { + adrenalineGain = (SCalAlive ? -10000 : -2000); + } + else + { + if (Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16)) // > + { + adrenaline = 0; + } + else if (areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0) + { + int adrenalineTickBoost = 0 + + (adrenalineBoostOne ? 63 : 0) + //286 + (adrenalineBoostTwo ? 115 : 0) + //401 + (adrenalineBoostThree ? 100 : 0); //501 + adrenalineGain = 223 + adrenalineTickBoost; //pre-slime god = 45, pre-astrum deus = 35, pre-polterghast = 25, post-polter = 20 + /*if (distanceFromBoss == -1 || distanceFromBoss > 5600) + { + adrenalineGain /= 4; + }*/ + } + else + { + adrenaline = 0; + } + } + adrenalineCD++; + if (adrenalineCD >= (SCalAlive ? 135 : 60)) + { + adrenalineCD = 0; + adrenaline += adrenalineGain; + if (adrenaline < 0) + { + adrenaline = 0; + } + if (adrenaline >= adrenalineMax) + { + if (playFullAdrenalineSound) + { + playFullAdrenalineSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); + } + adrenaline = adrenalineMax; + } + else + { + playFullAdrenalineSound = true; + } + } + } + } + } + else + { + if (player.whoAmI == Main.myPlayer) + { + stressCD++; + if (stressCD >= 60) + { + stressCD = 0; + stress += -30; + if (stress < 0) + { + stress = 0; + } + } + adrenalineCD++; + if (adrenalineCD >= 60) + { + adrenalineCD = 0; + adrenaline += -30; + if (adrenaline < 0) + { + adrenaline = 0; + } + } + } + } + if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + { + packetTimer++; + if (packetTimer == 60) + { + packetTimer = 0; + StressPacket(false); + AdrenalinePacket(false); + RadiationPacket(false); + /*if (areThereAnyDamnBosses) + DistanceFromBossPacket(false);*/ + } + } + #endregion - #region StressTiedEffects - if (stressPills) - { - player.statDefense += 8; - player.allDamage += 0.08f; - } - if (laudanum) - { - player.statDefense += 6; - player.allDamage += 0.06f; - } - if (draedonsHeart) - { - player.allDamage += 0.1f; - } - if (!stressLevel500 && player.FindBuffIndex(mod.BuffType("HeartAttack")) > -1) { player.ClearBuff(mod.BuffType("HeartAttack")); } - if (draedonsHeart && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.statDefense += 25; - } - if (hAttack) - { - if (heartOfDarkness || draedonsHeart) - { - player.allDamage += 0.1f; - } - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; - } - if (affliction || afflicted) - { - player.lifeRegen += 1; - player.endurance += 0.07f; - player.statDefense += 20; - player.allDamage += 0.12f; + #region StressTiedEffects + if (stressPills) + { + player.statDefense += 8; + player.allDamage += 0.08f; + } + if (laudanum) + { + player.statDefense += 6; + player.allDamage += 0.06f; + } + if (draedonsHeart) + { + player.allDamage += 0.1f; + } + if (!stressLevel500 && player.FindBuffIndex(mod.BuffType("HeartAttack")) > -1) + { player.ClearBuff(mod.BuffType("HeartAttack")); } + if (draedonsHeart && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.statDefense += 25; + } + if (hAttack) + { + if (heartOfDarkness || draedonsHeart) + { + player.allDamage += 0.1f; + } + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; + } + if (affliction || afflicted) + { + player.lifeRegen += 1; + player.endurance += 0.07f; + player.statDefense += 20; + player.allDamage += 0.12f; player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; - } - #endregion + } + #endregion - #region MaxLifeAndManaBoosts - player.statLifeMax2 += - (mFruit ? 25 : 0) + - (bOrange ? 25 : 0) + - (eBerry ? 25 : 0) + - (dFruit ? 25 : 0); - if (silvaHitCounter > 0) - { - player.statLifeMax2 -= silvaHitCounter * 100; - if (player.statLifeMax2 <= 400) - { - player.statLifeMax2 = 400; - if (silvaCountdown > 0) - { - if (player.FindBuffIndex(mod.BuffType("SilvaRevival")) > -1) { player.ClearBuff(mod.BuffType("SilvaRevival")); } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); - } - silvaCountdown = 0; - } - } - player.statManaMax2 += - (pHeart ? 50 : 0) + - (eCore ? 50 : 0) + - (cShard ? 50 : 0) + - (starBeamRye ? 50 : 0); - if (Main.netMode != NetmodeID.Server && player.whoAmI == Main.myPlayer) - { - Texture2D rain3 = mod.GetTexture("ExtraTextures/Rain3"); - Texture2D rainOriginal = mod.GetTexture("ExtraTextures/RainOriginal"); - Texture2D mana2 = mod.GetTexture("ExtraTextures/Mana2"); - Texture2D mana3 = mod.GetTexture("ExtraTextures/Mana3"); - Texture2D mana4 = mod.GetTexture("ExtraTextures/Mana4"); - Texture2D manaOriginal = mod.GetTexture("ExtraTextures/ManaOriginal"); - Texture2D carpetAuric = mod.GetTexture("ExtraTextures/AuricCarpet"); - Texture2D carpetOriginal = mod.GetTexture("ExtraTextures/Carpet"); - int totalManaBoost = - (pHeart ? 1 : 0) + - (eCore ? 1 : 0) + - (cShard ? 1 : 0); - switch (totalManaBoost) - { - default: - Main.manaTexture = manaOriginal; - break; - case 3: - Main.manaTexture = mana4; - break; - case 2: - Main.manaTexture = mana3; - break; - case 1: - Main.manaTexture = mana2; - break; - } - if (Main.bloodMoon) { Main.rainTexture = rainOriginal; } - else if (Main.raining && ZoneSulphur) { Main.rainTexture = rain3; } - else { Main.rainTexture = rainOriginal; } - if (auricSet) { Main.flyingCarpetTexture = carpetAuric; } - else { Main.flyingCarpetTexture = carpetOriginal; } - } - #endregion + #region MaxLifeAndManaBoosts + player.statLifeMax2 += + (mFruit ? 25 : 0) + + (bOrange ? 25 : 0) + + (eBerry ? 25 : 0) + + (dFruit ? 25 : 0); + if (silvaHitCounter > 0) + { + player.statLifeMax2 -= silvaHitCounter * 100; + if (player.statLifeMax2 <= 400) + { + player.statLifeMax2 = 400; + if (silvaCountdown > 0) + { + if (player.FindBuffIndex(mod.BuffType("SilvaRevival")) > -1) + { player.ClearBuff(mod.BuffType("SilvaRevival")); } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); + } + silvaCountdown = 0; + } + } + player.statManaMax2 += + (pHeart ? 50 : 0) + + (eCore ? 50 : 0) + + (cShard ? 50 : 0) + + (starBeamRye ? 50 : 0); + if (Main.netMode != NetmodeID.Server && player.whoAmI == Main.myPlayer) + { + Texture2D rain3 = mod.GetTexture("ExtraTextures/Rain3"); + Texture2D rainOriginal = mod.GetTexture("ExtraTextures/RainOriginal"); + Texture2D mana2 = mod.GetTexture("ExtraTextures/Mana2"); + Texture2D mana3 = mod.GetTexture("ExtraTextures/Mana3"); + Texture2D mana4 = mod.GetTexture("ExtraTextures/Mana4"); + Texture2D manaOriginal = mod.GetTexture("ExtraTextures/ManaOriginal"); + Texture2D carpetAuric = mod.GetTexture("ExtraTextures/AuricCarpet"); + Texture2D carpetOriginal = mod.GetTexture("ExtraTextures/Carpet"); + int totalManaBoost = + (pHeart ? 1 : 0) + + (eCore ? 1 : 0) + + (cShard ? 1 : 0); + switch (totalManaBoost) + { + default: + Main.manaTexture = manaOriginal; + break; + case 3: + Main.manaTexture = mana4; + break; + case 2: + Main.manaTexture = mana3; + break; + case 1: + Main.manaTexture = mana2; + break; + } + if (Main.bloodMoon) + { Main.rainTexture = rainOriginal; } + else if (Main.raining && ZoneSulphur) + { Main.rainTexture = rain3; } + else + { Main.rainTexture = rainOriginal; } + if (auricSet) + { Main.flyingCarpetTexture = carpetAuric; } + else + { Main.flyingCarpetTexture = carpetOriginal; } + } + #endregion - #region MiscEffects - if (Config.ProficiencyEnabled) - { - GetExactLevelUp(); - } + #region MiscEffects + if (Config.ProficiencyEnabled) + { + GetExactLevelUp(); + } - if (gainRageCooldown > 0) - gainRageCooldown--; + if (gainRageCooldown > 0) + gainRageCooldown--; - if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) - { - int num = 12; - nebulaManaNerfCounter += player.nebulaLevelMana; - if (nebulaManaNerfCounter >= num) - { - nebulaManaNerfCounter -= num; - player.statMana--; - if (player.statMana < 0) - { - player.statMana = 0; - } - } - } - else - { - nebulaManaNerfCounter = 0; - } - if (Main.myPlayer == player.whoAmI) - { - BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = shouldDrawSmallText; - /*if (player.chest != -1) - { - if (player.chest != -2) - { - trashManChest = -1; - } - if (trashManChest >= 0) - { - if (!Main.projectile[trashManChest].active || Main.projectile[trashManChest].type != mod.ProjectileType("DannyDevito")) - { - Main.PlaySound(SoundID.Item11, -1, -1); - player.chest = -1; - Recipe.FindRecipes(); - } - else - { - int num16 = (int)(((double)player.position.X + (double)player.width * 0.5) / 16.0); - int num17 = (int)(((double)player.position.Y + (double)player.height * 0.5) / 16.0); - player.chestX = (int)Main.projectile[trashManChest].Center.X / 16; - player.chestY = (int)Main.projectile[trashManChest].Center.Y / 16; - if (num16 < player.chestX - Player.tileRangeX || num16 > player.chestX + Player.tileRangeX + 1 || num17 < player.chestY - Player.tileRangeY || num17 > player.chestY + Player.tileRangeY + 1) - { - if (player.chest != -1) - { - Main.PlaySound(SoundID.Item11, -1, -1); - } - player.chest = -1; - Recipe.FindRecipes(); - } - } - } - } - else - { - trashManChest = -1; - }*/ - } - if (silvaSet || invincible || margarita) - { - foreach (int debuff in CalamityMod.debuffList) - player.buffImmune[debuff] = true; - } - if (aSparkRare) - { - player.buffImmune[BuffID.Electrified] = true; - } - if (Config.ExpertChilledWaterRemoval) - { - if (Main.expertMode && player.ZoneSnow && player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear) - { - player.buffImmune[BuffID.Chilled] = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - if (Main.myPlayer == player.whoAmI && !player.gills && !player.merman) - { - if (player.breath > 0) - player.breath--; - } - } - } - } - if (ZoneAbyss) - { - if (abyssalAmulet) - { - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); - } - if (Main.myPlayer == player.whoAmI) //4200 total tiles small world - { - int breathLoss = 2; - int lifeLossAtZeroBreath = 3; - int lightStrength = 0 + - ((player.lightOrb || player.crimsonHeart || player.magicLantern) ? 1 : 0) + //1 - (aquaticEmblem ? 1 : 0) + //2 - (player.arcticDivingGear ? 1 : 0) + //3 - (jellyfishNecklace ? 1 : 0) + //4 - ((player.blueFairy || player.greenFairy || player.redFairy || player.petFlagDD2Ghost) ? 2 : 0) + //6 - ((shine || lumenousAmulet) ? 2 : 0) + //8 - ((player.wisp || player.suspiciouslookingTentacle || sirenPet) ? 3 : 0); //11 - bool lightLevelOne = lightStrength > 0; //1+ - bool lightLevelTwo = lightStrength > 2; //3+ - bool lightLevelThree = lightStrength > 4; //5+ - bool lightLevelFour = lightStrength > 6; //7+ - if (ZoneAbyssLayer4) //3200 and below - { - breathLoss = 54; - if (!lightLevelFour) - player.blind = true; - if (!lightLevelThree) - player.headcovered = true; - player.bleed = true; - lifeLossAtZeroBreath = 24; - player.statDefense -= (anechoicPlating ? 40 : 120); - } - else if (ZoneAbyssLayer3) //2700 to 3200 - { - breathLoss = 18; - if (!lightLevelThree) - player.blind = true; - if (!lightLevelTwo) - player.headcovered = true; - if (!abyssalDivingSuit) - player.bleed = true; - lifeLossAtZeroBreath = 12; - player.statDefense -= (anechoicPlating ? 20 : 60); - } - else if (ZoneAbyssLayer2) //2100 to 2700 - { - breathLoss = 6; - if (!lightLevelTwo) - player.blind = true; - if (!depthCharm) - player.bleed = true; - lifeLossAtZeroBreath = 6; - player.statDefense -= (anechoicPlating ? 10 : 30); - } - else if (ZoneAbyssLayer1) //1500 to 2100 - { - if (!lightLevelOne) - player.blind = true; - player.statDefense -= (anechoicPlating ? 5 : 15); - } - double breathLossMult = 1.0 - - (player.gills ? 0.2 : 0.0) - //0.8 - (player.accDivingHelm ? 0.25 : 0.0) - //0.75 - (player.arcticDivingGear ? 0.25 : 0.0) - //0.75 - (aquaticEmblem ? 0.25 : 0.0) - //0.75 - (player.accMerman ? 0.3 : 0.0) - //0.7 - (victideSet ? 0.2 : 0.0) - //0.85 - (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 0.3 : 0.0) - //0.7 - (abyssalDivingSuit ? 0.3 : 0.0); //0.7 - if (breathLossMult < 0.05) - { - breathLossMult = 0.05; - } - breathLoss = (int)((double)breathLoss * breathLossMult); - int tick = 6; - double tickMult = 1.0 + - (player.gills ? 4.0 : 0.0) + //5 - (player.ignoreWater ? 5.0 : 0.0) + //10 - (player.accDivingHelm ? 10.0 : 0.0) + //20 - (player.arcticDivingGear ? 10.0 : 0.0) + //30 - (aquaticEmblem ? 10.0 : 0.0) + //40 - (player.accMerman ? 15.0 : 0.0) + //55 - (victideSet ? 5.0 : 0.0) + //60 - (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 15.0 : 0.0) + //75 - (abyssalDivingSuit ? 15.0 : 0.0); //90 - if (tickMult > 50.0) - { - tickMult = 50.0; - } - tick = (int)((double)tick * tickMult); - abyssBreathCD++; - if (player.gills || player.merman) - { - if (player.breath > 0) - player.breath -= 3; - } - if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - if (player.statLife > 100) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 160; - } - } - if (abyssBreathCD >= tick) - { - abyssBreathCD = 0; - if (player.breath > 0) - player.breath -= breathLoss; - if (cDepth) - { - if (player.breath > 0) - player.breath--; - } - if (player.breath <= 0) - { - if (depthCharm) - { - lifeLossAtZeroBreath -= 3; - if (abyssalDivingSuit) - lifeLossAtZeroBreath -= 6; - } - if (lifeLossAtZeroBreath < 0) - { - lifeLossAtZeroBreath = 0; - } - player.statLife -= lifeLossAtZeroBreath; - if (player.statLife <= 0) - { - KillPlayer(); - } - } - } - } - } - else - { - abyssBreathCD = 0; - } - if (!player.mount.Active) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && ironBoots) - { - player.maxFallSpeed = 9f; - } - if (aeroSet && !player.wet) - { - player.maxFallSpeed = 15f; - } - if (normalityRelocator) - { - player.maxFallSpeed *= 1.1f; - } - } - if (normalityRelocator) - { - player.moveSpeed += 0.1f; - } - if (player.ZoneSkyHeight) - { - if (astrumDeusLore) - { - player.moveSpeed += 0.2f; - } - if (astrumAureusLore) - { - player.jumpSpeedBoost += 0.5f; - } - } - if (omegaBlueSet) //should apply after rev caps, actually those are gone so AAAAA - { - //add tentacles - if (player.ownedProjectileCounts[mod.ProjectileType("OmegaBlueTentacle")] < 6) - { - bool[] tentaclesPresent = new bool[6]; - for (int i = 0; i < 1000; i++) - { - Projectile projectile = Main.projectile[i]; - if (projectile.active && projectile.type == mod.ProjectileType("OmegaBlueTentacle") && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f) - { - tentaclesPresent[(int)projectile.ai[1]] = true; - } - } - for (int i = 0; i < 6; i++) - { - if (!tentaclesPresent[i]) - { - float modifier = player.meleeDamage + player.magicDamage + player.rangedDamage + - player.Calamity().throwingDamage + player.minionDamage; - modifier /= 5f; - int damage = (int)(666 * modifier); - Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; - Projectile.NewProjectile(player.Center, vel, mod.ProjectileType("OmegaBlueTentacle"), damage, 8f, Main.myPlayer, Main.rand.Next(120), i); - } - } - } - float damageUp = 0.1f; - int critUp = 10; - if (omegaBlueHentai) - { - damageUp *= 2f; - critUp *= 2; - } - player.allDamage += damageUp; - AllCritBoost(critUp); - } - if (!bOut) - { - if (gHealer) - { - if (healCounter > 0) - { - healCounter--; - } - if (healCounter <= 0) - { - healCounter = 300; - if (player.whoAmI == Main.myPlayer) - { - int healAmount = 5 + - (gDefense ? 5 : 0) + - (gOffense ? 5 : 0); - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - } - if (gDefense) - { - player.moveSpeed += 0.1f + - (gOffense ? 0.1f : 0f); - player.endurance += 0.025f + - (gOffense ? 0.025f : 0f); - } - if (gOffense) - { - player.minionDamage += 0.1f + - (gDefense ? 0.05f : 0f); - player.maxMinions++; - } - } - if (draconicSurgeCooldown > 0) - draconicSurgeCooldown--; - if (revivifyTimer > 0) - revivifyTimer--; - if (fleshTotemCooldown > 0) - fleshTotemCooldown--; - if (astralStarRainCooldown > 0) - astralStarRainCooldown--; - if (bloodflareMageCooldown > 0) - bloodflareMageCooldown--; - if (tarraMageHealCooldown > 0) - tarraMageHealCooldown--; - if (ataxiaDmg > 0f) - ataxiaDmg -= 1.5f; - if (ataxiaDmg < 0f) - ataxiaDmg = 0f; - if (xerocDmg > 0f) - xerocDmg -= 2f; - if (xerocDmg < 0f) - xerocDmg = 0f; - if (godSlayerDmg > 0f) - godSlayerDmg -= 2.5f; - if (godSlayerDmg < 0f) - godSlayerDmg = 0f; - if (aBulwarkRareMeleeBoostTimer > 0) - aBulwarkRareMeleeBoostTimer--; - if (bossRushImmunityFrameCurseTimer > 0) - bossRushImmunityFrameCurseTimer--; - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - player.buffImmune[mod.BuffType("VulnerabilityHex")] = true; - silvaCountdown--; - if (silvaCountdown <= 0) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); - } - for (int j = 0; j < 2; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].noGravity = true; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - } - if (tarraMelee) - { - if (tarraDefense) - { - tarraDefenseTime--; - if (tarraDefenseTime <= 0) - { - tarraDefenseTime = 600; - tarraCooldown = 1800; - tarraDefense = false; - } - for (int j = 0; j < 2; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].noGravity = true; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - } - if (tarraCooldown > 0) - tarraCooldown--; - } - if (tarraThrowing) - { - if (tarraThrowingCritTimer > 0) - { - tarraThrowingCritTimer--; - } - if (tarraThrowingCrits >= 25) - { - tarraThrowingCrits = 0; - tarraThrowingCritTimer = 1800; - player.immune = true; - player.immuneTime = 300; - } - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); - if (shouldAffect) - { - player.Calamity().throwingDamage += 0.1f; - } - } - } - if (bloodflareSet) - { - if (bloodflareHeartTimer > 0) - bloodflareHeartTimer--; - if (bloodflareManaTimer > 0) - bloodflareManaTimer--; - } - if (bloodflareMelee) - { - if (bloodflareMeleeHits >= 15) - { - bloodflareMeleeHits = 0; - bloodflareFrenzyTimer = 300; - } - if (bloodflareFrenzyTimer > 0) - { - bloodflareFrenzyTimer--; - if (bloodflareFrenzyTimer <= 0) - { - bloodflareFrenzyCooldown = 1800; - } - player.meleeCrit += 25; - player.meleeDamage += 0.25f; - for (int j = 0; j < 2; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default, 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].noGravity = true; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - } - if (bloodflareFrenzyCooldown > 0) - bloodflareFrenzyCooldown--; - } - if (bloodflareRanged) - { - if (bloodflareRangedCooldown > 0) - bloodflareRangedCooldown--; - } - if (Main.raining && ZoneSulphur) - { - if (player.ZoneOverworldHeight || player.ZoneSkyHeight) - player.AddBuff(mod.BuffType("Irradiated"), 2); - } - if (raiderTalisman) - { - player.Calamity().throwingDamage += ((float)raiderStack / 250f) * 0.25f; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon) - { - player.maxMinions += 2; - } - if (sDefense) - { - player.statDefense += 5; - player.endurance += 0.05f; - } - if (absorber) - { - player.moveSpeed += 0.12f; - player.jumpSpeedBoost += 1.2f; - player.statLifeMax2 += 20; - player.thorns = 0.5f; - player.endurance += 0.05f; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 2; - player.manaRegenBonus += 2; - } - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 5; - player.endurance += 0.05f; - player.moveSpeed += 0.2f; - } - } - if (coreOfTheBloodGod) - { - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; - } - if (bloodPact) - { - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; - } - if (aAmpoule) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 1f, 0.6f); - player.endurance += 0.05f; - player.pickSpeed -= 0.25f; - player.buffImmune[70] = true; - player.buffImmune[47] = true; - player.buffImmune[46] = true; - player.buffImmune[44] = true; - player.buffImmune[20] = true; - if (!player.honey && player.lifeRegen < 0) - { - player.lifeRegen += 2; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - } - player.lifeRegenTime += 1; - player.lifeRegen += 2; - } - else if (cFreeze) - { - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.3f, ((float)Main.DiscoG / 400f), 0.5f); - } - else if (sirenIce) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.35f, 1f, 1.25f); - } - else if (sirenBoobs || sirenBoobsAlt) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1.5f, 1f, 0.1f); - } - else if (tarraSummon) - { - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 3f, 0f); - } - if (cFreeze) - { - int num = mod.BuffType("GlacialState"); - float num2 = 200f; - int random = Main.rand.Next(5); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 120, false); - } - } - } - } - } - } - if (ursaSergeant) - { - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.lifeRegen += 3; - player.lifeRegenTime += 3; - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) - { - player.lifeRegen += 2; - player.lifeRegenTime += 2; - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.lifeRegen += 1; - player.lifeRegenTime += 1; - } - } - if (invincible || lol) - { - player.thorns = 0f; - player.turtleThorns = false; - } - if (player.vortexStealthActive) - { - player.rangedDamage -= (1f - player.stealth) * 0.4f; //change 80 to 40 - player.rangedCrit -= (int)((1f - player.stealth) * 5f); //change 20 to 15 - } - if (projRefRareLifeRegenCounter > 0) - { - projRefRareLifeRegenCounter--; - player.lifeRegenTime += 2; - player.lifeRegen += 2; - } - if (desertScourgeLore) - { - player.statDefense += 5; - } - if (skeletronPrimeLore) - { - player.armorPenetration += 5; - } - if (destroyerLore) - { - player.pickSpeed -= 0.05f; - } - if (golemLore) - { - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.statDefense += 10; - } - } - if (aquaticScourgeLore && player.wellFed) - { - player.statDefense += 1; - player.allDamage += 0.025f; - AllCritBoost(1); - player.meleeSpeed += 0.025f; - player.minionKB += 0.25f; - player.moveSpeed += 0.1f; - } - if (eaterOfWorldsLore) - { - int damage = 10; - float knockBack = 1f; - if (Main.rand.NextBool(15)) - { - int num = 0; - for (int i = 0; i < 1000; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == mod.ProjectileType("TheDeadlyMicrobeProjectile")) - { - num++; - } - } - if (Main.rand.Next(15) >= num && num < 6) - { - int num2 = 50; - int num3 = 24; - int num4 = 90; - for (int j = 0; j < num2; j++) - { - int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2); - Vector2 center = player.Center; - center.X += (float)Main.rand.Next(-num5, num5 + 1); - center.Y += (float)Main.rand.Next(-num5, num5 + 1); - if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3)) - { - center.X += (float)(num3 / 2); - center.Y += (float)(num3 / 2); - if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) - { - int num6 = (int)center.X / 16; - int num7 = (int)center.Y / 16; - bool flag = false; - if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0) - { - flag = true; - } - else - { - center.X -= (float)(num4 / 2); - center.Y -= (float)(num4 / 2); - if (Collision.SolidCollision(center, num4, num4)) - { - center.X += (float)(num4 / 2); - center.Y += (float)(num4 / 2); - flag = true; - } - } - if (flag) - { - for (int k = 0; k < 1000; k++) - { - if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == mod.ProjectileType("TheDeadlyMicrobeProjectile") && (center - Main.projectile[k].Center).Length() < 48f) - { - flag = false; - break; - } - } - if (flag && Main.myPlayer == player.whoAmI) - { - Projectile.NewProjectile(center.X, center.Y, 0f, 0f, mod.ProjectileType("TheDeadlyMicrobeProjectile"), damage, knockBack, player.whoAmI, 0f, 0f); - } - } - } - } - } - } - } - } - if (calcium) - { - player.noFallDmg = true; - } - if (skeletronLore) - { - player.allDamage += 0.05f; - AllCritBoost(5); - player.statDefense += 5; - } - if (ceaselessHunger) - { - for (int j = 0; j < 400; j++) - { - if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == player.whoAmI) - { - Main.item[j].beingGrabbed = true; - if ((double)player.position.X + (double)player.width * 0.5 > (double)Main.item[j].position.X + (double)Main.item[j].width * 0.5) - { - if (Main.item[j].velocity.X < 90f + player.velocity.X) - { - Item item = Main.item[j]; - item.velocity.X += 9f; - } - if (Main.item[j].velocity.X < 0f) - { - Item item = Main.item[j]; - item.velocity.X += 9f * 0.75f; - } - } - else - { - if (Main.item[j].velocity.X > -90f + player.velocity.X) - { - Item item = Main.item[j]; - item.velocity.X -= 9f; - } - if (Main.item[j].velocity.X > 0f) - { - Item item = Main.item[j]; - item.velocity.X -= 9f * 0.75f; - } - } - if ((double)player.position.Y + (double)player.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5) - { - if (Main.item[j].velocity.Y < 90f) - { - Item item = Main.item[j]; - item.velocity.Y += 9f; - } - if (Main.item[j].velocity.Y < 0f) - { - Item item = Main.item[j]; - item.velocity.Y += 9f * 0.75f; - } - } - else - { - if (Main.item[j].velocity.Y > -90f) - { - Item item = Main.item[j]; - item.velocity.Y -= 9f; - } - if (Main.item[j].velocity.Y > 0f) - { - Item item = Main.item[j]; - item.velocity.Y -= 9f * 0.75f; - } - } - } - } - } - if (dukeFishronLore) - { - player.allDamage += 0.05f; - AllCritBoost(5); - player.moveSpeed += 0.1f; - } - if (lunaticCultistLore) - { - player.endurance += 0.04f; - player.statDefense += 4; - player.allDamage += 0.04f; - AllCritBoost(4); - player.minionKB += 0.5f; - player.moveSpeed += 0.1f; - } - if (moonLordLore) - { - if (player.gravDir == -1f && player.gravControl2) - { - player.endurance += 0.05f; - player.statDefense += 10; - player.allDamage += 0.1f; - AllCritBoost(10); - player.minionKB += 1.5f; - player.moveSpeed += 0.15f; - } - } - if (leviathanAndSirenLore) - { - if (sirenBoobsPrevious || sirenBoobsAltPrevious) - { - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; - } - if (sirenPet) - { - player.spelunkerTimer += 1; - if (player.spelunkerTimer >= 10) - { - player.spelunkerTimer = 0; - int num65 = 30; - int num66 = (int)player.Center.X / 16; - int num67 = (int)player.Center.Y / 16; - for (int num68 = num66 - num65; num68 <= num66 + num65; num68++) - { - for (int num69 = num67 - num65; num69 <= num67 + num65; num69++) - { - if (Main.rand.NextBool(4)) - { - Vector2 vector = new Vector2((float)(num66 - num68), (float)(num67 - num69)); - if (vector.Length() < (float)num65 && num68 > 0 && num68 < Main.maxTilesX - 1 && num69 > 0 && num69 < Main.maxTilesY - 1 && Main.tile[num68, num69] != null && Main.tile[num68, num69].active()) - { - bool flag7 = false; - if (Main.tile[num68, num69].type == 185 && Main.tile[num68, num69].frameY == 18) - { - if (Main.tile[num68, num69].frameX >= 576 && Main.tile[num68, num69].frameX <= 882) - { - flag7 = true; - } - } - else if (Main.tile[num68, num69].type == 186 && Main.tile[num68, num69].frameX >= 864 && Main.tile[num68, num69].frameX <= 1170) - { - flag7 = true; - } - if (flag7 || Main.tileSpelunker[(int)Main.tile[num68, num69].type] || (Main.tileAlch[(int)Main.tile[num68, num69].type] && Main.tile[num68, num69].type != 82)) - { - int num70 = Dust.NewDust(new Vector2((float)(num68 * 16), (float)(num69 * 16)), 16, 16, 204, 0f, 0f, 150, default, 0.3f); - Main.dust[num70].fadeIn = 0.75f; - Main.dust[num70].velocity *= 0.1f; - Main.dust[num70].noLight = true; - } - } - } - } - } - } - } - } - #endregion + if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) + { + int num = 12; + nebulaManaNerfCounter += player.nebulaLevelMana; + if (nebulaManaNerfCounter >= num) + { + nebulaManaNerfCounter -= num; + player.statMana--; + if (player.statMana < 0) + { + player.statMana = 0; + } + } + } + else + { + nebulaManaNerfCounter = 0; + } + if (Main.myPlayer == player.whoAmI) + { + BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = shouldDrawSmallText; + /*if (player.chest != -1) + { + if (player.chest != -2) + { + trashManChest = -1; + } + if (trashManChest >= 0) + { + if (!Main.projectile[trashManChest].active || Main.projectile[trashManChest].type != mod.ProjectileType("DannyDevito")) + { + Main.PlaySound(SoundID.Item11, -1, -1); + player.chest = -1; + Recipe.FindRecipes(); + } + else + { + int num16 = (int)(((double)player.position.X + (double)player.width * 0.5) / 16.0); + int num17 = (int)(((double)player.position.Y + (double)player.height * 0.5) / 16.0); + player.chestX = (int)Main.projectile[trashManChest].Center.X / 16; + player.chestY = (int)Main.projectile[trashManChest].Center.Y / 16; + if (num16 < player.chestX - Player.tileRangeX || num16 > player.chestX + Player.tileRangeX + 1 || num17 < player.chestY - Player.tileRangeY || num17 > player.chestY + Player.tileRangeY + 1) + { + if (player.chest != -1) + { + Main.PlaySound(SoundID.Item11, -1, -1); + } + player.chest = -1; + Recipe.FindRecipes(); + } + } + } + } + else + { + trashManChest = -1; + }*/ + } + if (silvaSet || invincible || margarita) + { + foreach (int debuff in CalamityMod.debuffList) + player.buffImmune[debuff] = true; + } + if (aSparkRare) + { + player.buffImmune[BuffID.Electrified] = true; + } + if (Config.ExpertChilledWaterRemoval) + { + if (Main.expertMode && player.ZoneSnow && player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear) + { + player.buffImmune[BuffID.Chilled] = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + if (Main.myPlayer == player.whoAmI && !player.gills && !player.merman) + { + if (player.breath > 0) + player.breath--; + } + } + } + } + if (ZoneAbyss) + { + if (abyssalAmulet) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); + } + if (Main.myPlayer == player.whoAmI) //4200 total tiles small world + { + int breathLoss = 2; + int lifeLossAtZeroBreath = 3; + int lightStrength = 0 + + ((player.lightOrb || player.crimsonHeart || player.magicLantern) ? 1 : 0) + //1 + (aquaticEmblem ? 1 : 0) + //2 + (player.arcticDivingGear ? 1 : 0) + //3 + (jellyfishNecklace ? 1 : 0) + //4 + ((player.blueFairy || player.greenFairy || player.redFairy || player.petFlagDD2Ghost) ? 2 : 0) + //6 + ((shine || lumenousAmulet) ? 2 : 0) + //8 + ((player.wisp || player.suspiciouslookingTentacle || sirenPet) ? 3 : 0); //11 + bool lightLevelOne = lightStrength > 0; //1+ + bool lightLevelTwo = lightStrength > 2; //3+ + bool lightLevelThree = lightStrength > 4; //5+ + bool lightLevelFour = lightStrength > 6; //7+ + if (ZoneAbyssLayer4) //3200 and below + { + breathLoss = 54; + if (!lightLevelFour) + player.blind = true; + if (!lightLevelThree) + player.headcovered = true; + player.bleed = true; + lifeLossAtZeroBreath = 24; + player.statDefense -= (anechoicPlating ? 40 : 120); + } + else if (ZoneAbyssLayer3) //2700 to 3200 + { + breathLoss = 18; + if (!lightLevelThree) + player.blind = true; + if (!lightLevelTwo) + player.headcovered = true; + if (!abyssalDivingSuit) + player.bleed = true; + lifeLossAtZeroBreath = 12; + player.statDefense -= (anechoicPlating ? 20 : 60); + } + else if (ZoneAbyssLayer2) //2100 to 2700 + { + breathLoss = 6; + if (!lightLevelTwo) + player.blind = true; + if (!depthCharm) + player.bleed = true; + lifeLossAtZeroBreath = 6; + player.statDefense -= (anechoicPlating ? 10 : 30); + } + else if (ZoneAbyssLayer1) //1500 to 2100 + { + if (!lightLevelOne) + player.blind = true; + player.statDefense -= (anechoicPlating ? 5 : 15); + } + double breathLossMult = 1.0 - + (player.gills ? 0.2 : 0.0) - //0.8 + (player.accDivingHelm ? 0.25 : 0.0) - //0.75 + (player.arcticDivingGear ? 0.25 : 0.0) - //0.75 + (aquaticEmblem ? 0.25 : 0.0) - //0.75 + (player.accMerman ? 0.3 : 0.0) - //0.7 + (victideSet ? 0.2 : 0.0) - //0.85 + (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 0.3 : 0.0) - //0.7 + (abyssalDivingSuit ? 0.3 : 0.0); //0.7 + if (breathLossMult < 0.05) + { + breathLossMult = 0.05; + } + breathLoss = (int)((double)breathLoss * breathLossMult); + int tick = 6; + double tickMult = 1.0 + + (player.gills ? 4.0 : 0.0) + //5 + (player.ignoreWater ? 5.0 : 0.0) + //10 + (player.accDivingHelm ? 10.0 : 0.0) + //20 + (player.arcticDivingGear ? 10.0 : 0.0) + //30 + (aquaticEmblem ? 10.0 : 0.0) + //40 + (player.accMerman ? 15.0 : 0.0) + //55 + (victideSet ? 5.0 : 0.0) + //60 + (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 15.0 : 0.0) + //75 + (abyssalDivingSuit ? 15.0 : 0.0); //90 + if (tickMult > 50.0) + { + tickMult = 50.0; + } + tick = (int)((double)tick * tickMult); + abyssBreathCD++; + if (player.gills || player.merman) + { + if (player.breath > 0) + player.breath -= 3; + } + if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + if (player.statLife > 100) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 160; + } + } + if (abyssBreathCD >= tick) + { + abyssBreathCD = 0; + if (player.breath > 0) + player.breath -= breathLoss; + if (cDepth) + { + if (player.breath > 0) + player.breath--; + } + if (player.breath <= 0) + { + if (depthCharm) + { + lifeLossAtZeroBreath -= 3; + if (abyssalDivingSuit) + lifeLossAtZeroBreath -= 6; + } + if (lifeLossAtZeroBreath < 0) + { + lifeLossAtZeroBreath = 0; + } + player.statLife -= lifeLossAtZeroBreath; + if (player.statLife <= 0) + { + KillPlayer(); + } + } + } + } + } + else + { + abyssBreathCD = 0; + } + if (!player.mount.Active) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && ironBoots) + { + player.maxFallSpeed = 9f; + } + if (aeroSet && !player.wet) + { + player.maxFallSpeed = 15f; + } + if (normalityRelocator) + { + player.maxFallSpeed *= 1.1f; + } + } + if (normalityRelocator) + { + player.moveSpeed += 0.1f; + } + if (player.ZoneSkyHeight) + { + if (astrumDeusLore) + { + player.moveSpeed += 0.2f; + } + if (astrumAureusLore) + { + player.jumpSpeedBoost += 0.5f; + } + } + if (omegaBlueSet) //should apply after rev caps, actually those are gone so AAAAA + { + //add tentacles + if (player.ownedProjectileCounts[mod.ProjectileType("OmegaBlueTentacle")] < 6) + { + bool[] tentaclesPresent = new bool[6]; + for (int i = 0; i < 1000; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.active && projectile.type == mod.ProjectileType("OmegaBlueTentacle") && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f) + { + tentaclesPresent[(int)projectile.ai[1]] = true; + } + } + for (int i = 0; i < 6; i++) + { + if (!tentaclesPresent[i]) + { + float modifier = player.meleeDamage + player.magicDamage + player.rangedDamage + + player.Calamity().throwingDamage + player.minionDamage; + modifier /= 5f; + int damage = (int)(666 * modifier); + Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; + Projectile.NewProjectile(player.Center, vel, mod.ProjectileType("OmegaBlueTentacle"), damage, 8f, Main.myPlayer, Main.rand.Next(120), i); + } + } + } + float damageUp = 0.1f; + int critUp = 10; + if (omegaBlueHentai) + { + damageUp *= 2f; + critUp *= 2; + } + player.allDamage += damageUp; + AllCritBoost(critUp); + } + if (!bOut) + { + if (gHealer) + { + if (healCounter > 0) + { + healCounter--; + } + if (healCounter <= 0) + { + healCounter = 300; + if (player.whoAmI == Main.myPlayer) + { + int healAmount = 5 + + (gDefense ? 5 : 0) + + (gOffense ? 5 : 0); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + } + if (gDefense) + { + player.moveSpeed += 0.1f + + (gOffense ? 0.1f : 0f); + player.endurance += 0.025f + + (gOffense ? 0.025f : 0f); + } + if (gOffense) + { + player.minionDamage += 0.1f + + (gDefense ? 0.05f : 0f); + player.maxMinions++; + } + } + if (draconicSurgeCooldown > 0) + draconicSurgeCooldown--; + if (revivifyTimer > 0) + revivifyTimer--; + if (fleshTotemCooldown > 0) + fleshTotemCooldown--; + if (astralStarRainCooldown > 0) + astralStarRainCooldown--; + if (bloodflareMageCooldown > 0) + bloodflareMageCooldown--; + if (tarraMageHealCooldown > 0) + tarraMageHealCooldown--; + if (ataxiaDmg > 0f) + ataxiaDmg -= 1.5f; + if (ataxiaDmg < 0f) + ataxiaDmg = 0f; + if (xerocDmg > 0f) + xerocDmg -= 2f; + if (xerocDmg < 0f) + xerocDmg = 0f; + if (godSlayerDmg > 0f) + godSlayerDmg -= 2.5f; + if (godSlayerDmg < 0f) + godSlayerDmg = 0f; + if (aBulwarkRareMeleeBoostTimer > 0) + aBulwarkRareMeleeBoostTimer--; + if (bossRushImmunityFrameCurseTimer > 0) + bossRushImmunityFrameCurseTimer--; + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + { + player.buffImmune[mod.BuffType("VulnerabilityHex")] = true; + silvaCountdown--; + if (silvaCountdown <= 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); + } + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + if (tarraMelee) + { + if (tarraDefense) + { + tarraDefenseTime--; + if (tarraDefenseTime <= 0) + { + tarraDefenseTime = 600; + tarraCooldown = 1800; + tarraDefense = false; + } + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + if (tarraCooldown > 0) + tarraCooldown--; + } + if (tarraThrowing) + { + if (tarraThrowingCritTimer > 0) + { + tarraThrowingCritTimer--; + } + if (tarraThrowingCrits >= 25) + { + tarraThrowingCrits = 0; + tarraThrowingCritTimer = 1800; + player.immune = true; + player.immuneTime = 300; + } + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); + if (shouldAffect) + { + player.Calamity().throwingDamage += 0.1f; + } + } + } + if (bloodflareSet) + { + if (bloodflareHeartTimer > 0) + bloodflareHeartTimer--; + if (bloodflareManaTimer > 0) + bloodflareManaTimer--; + } + if (bloodflareMelee) + { + if (bloodflareMeleeHits >= 15) + { + bloodflareMeleeHits = 0; + bloodflareFrenzyTimer = 300; + } + if (bloodflareFrenzyTimer > 0) + { + bloodflareFrenzyTimer--; + if (bloodflareFrenzyTimer <= 0) + { + bloodflareFrenzyCooldown = 1800; + } + player.meleeCrit += 25; + player.meleeDamage += 0.25f; + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default, 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + if (bloodflareFrenzyCooldown > 0) + bloodflareFrenzyCooldown--; + } + if (bloodflareRanged) + { + if (bloodflareRangedCooldown > 0) + bloodflareRangedCooldown--; + } + if (Main.raining && ZoneSulphur) + { + if (player.ZoneOverworldHeight || player.ZoneSkyHeight) + player.AddBuff(mod.BuffType("Irradiated"), 2); + } + if (raiderTalisman) + { + player.Calamity().throwingDamage += ((float)raiderStack / 250f) * 0.25f; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon) + { + player.maxMinions += 2; + } + if (sDefense) + { + player.statDefense += 5; + player.endurance += 0.05f; + } + if (absorber) + { + player.moveSpeed += 0.12f; + player.jumpSpeedBoost += 1.2f; + player.statLifeMax2 += 20; + player.thorns = 0.5f; + player.endurance += 0.05f; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.lifeRegen += 2; + player.manaRegenBonus += 2; + } + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 5; + player.endurance += 0.05f; + player.moveSpeed += 0.2f; + } + } + if (coreOfTheBloodGod) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; + } + if (bloodPact) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; + } + if (aAmpoule) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 1f, 0.6f); + player.endurance += 0.05f; + player.pickSpeed -= 0.25f; + player.buffImmune[70] = true; + player.buffImmune[47] = true; + player.buffImmune[46] = true; + player.buffImmune[44] = true; + player.buffImmune[20] = true; + if (!player.honey && player.lifeRegen < 0) + { + player.lifeRegen += 2; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + } + player.lifeRegenTime += 1; + player.lifeRegen += 2; + } + else if (cFreeze) + { + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.3f, ((float)Main.DiscoG / 400f), 0.5f); + } + else if (sirenIce) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.35f, 1f, 1.25f); + } + else if (sirenBoobs || sirenBoobsAlt) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1.5f, 1f, 0.1f); + } + else if (tarraSummon) + { + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 3f, 0f); + } + if (cFreeze) + { + int num = mod.BuffType("GlacialState"); + float num2 = 200f; + int random = Main.rand.Next(5); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 120, false); + } + } + } + } + } + } + if (ursaSergeant) + { + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.lifeRegen += 3; + player.lifeRegenTime += 3; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) + { + player.lifeRegen += 2; + player.lifeRegenTime += 2; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.lifeRegen += 1; + player.lifeRegenTime += 1; + } + } + if (invincible || lol) + { + player.thorns = 0f; + player.turtleThorns = false; + } + if (player.vortexStealthActive) + { + player.rangedDamage -= (1f - player.stealth) * 0.4f; //change 80 to 40 + player.rangedCrit -= (int)((1f - player.stealth) * 5f); //change 20 to 15 + } + if (projRefRareLifeRegenCounter > 0) + { + projRefRareLifeRegenCounter--; + player.lifeRegenTime += 2; + player.lifeRegen += 2; + } + if (desertScourgeLore) + { + player.statDefense += 5; + } + if (skeletronPrimeLore) + { + player.armorPenetration += 5; + } + if (destroyerLore) + { + player.pickSpeed -= 0.05f; + } + if (golemLore) + { + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.statDefense += 10; + } + } + if (aquaticScourgeLore && player.wellFed) + { + player.statDefense += 1; + player.allDamage += 0.025f; + AllCritBoost(1); + player.meleeSpeed += 0.025f; + player.minionKB += 0.25f; + player.moveSpeed += 0.1f; + } + if (eaterOfWorldsLore) + { + int damage = 10; + float knockBack = 1f; + if (Main.rand.NextBool(15)) + { + int num = 0; + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == mod.ProjectileType("TheDeadlyMicrobeProjectile")) + { + num++; + } + } + if (Main.rand.Next(15) >= num && num < 6) + { + int num2 = 50; + int num3 = 24; + int num4 = 90; + for (int j = 0; j < num2; j++) + { + int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2); + Vector2 center = player.Center; + center.X += (float)Main.rand.Next(-num5, num5 + 1); + center.Y += (float)Main.rand.Next(-num5, num5 + 1); + if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3)) + { + center.X += (float)(num3 / 2); + center.Y += (float)(num3 / 2); + if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) + { + int num6 = (int)center.X / 16; + int num7 = (int)center.Y / 16; + bool flag = false; + if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0) + { + flag = true; + } + else + { + center.X -= (float)(num4 / 2); + center.Y -= (float)(num4 / 2); + if (Collision.SolidCollision(center, num4, num4)) + { + center.X += (float)(num4 / 2); + center.Y += (float)(num4 / 2); + flag = true; + } + } + if (flag) + { + for (int k = 0; k < 1000; k++) + { + if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == mod.ProjectileType("TheDeadlyMicrobeProjectile") && (center - Main.projectile[k].Center).Length() < 48f) + { + flag = false; + break; + } + } + if (flag && Main.myPlayer == player.whoAmI) + { + Projectile.NewProjectile(center.X, center.Y, 0f, 0f, mod.ProjectileType("TheDeadlyMicrobeProjectile"), damage, knockBack, player.whoAmI, 0f, 0f); + } + } + } + } + } + } + } + } + if (calcium) + { + player.noFallDmg = true; + } + if (skeletronLore) + { + player.allDamage += 0.05f; + AllCritBoost(5); + player.statDefense += 5; + } + if (ceaselessHunger) + { + for (int j = 0; j < 400; j++) + { + if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == player.whoAmI) + { + Main.item[j].beingGrabbed = true; + if ((double)player.position.X + (double)player.width * 0.5 > (double)Main.item[j].position.X + (double)Main.item[j].width * 0.5) + { + if (Main.item[j].velocity.X < 90f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X += 9f; + } + if (Main.item[j].velocity.X < 0f) + { + Item item = Main.item[j]; + item.velocity.X += 9f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.X > -90f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X -= 9f; + } + if (Main.item[j].velocity.X > 0f) + { + Item item = Main.item[j]; + item.velocity.X -= 9f * 0.75f; + } + } + if ((double)player.position.Y + (double)player.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5) + { + if (Main.item[j].velocity.Y < 90f) + { + Item item = Main.item[j]; + item.velocity.Y += 9f; + } + if (Main.item[j].velocity.Y < 0f) + { + Item item = Main.item[j]; + item.velocity.Y += 9f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.Y > -90f) + { + Item item = Main.item[j]; + item.velocity.Y -= 9f; + } + if (Main.item[j].velocity.Y > 0f) + { + Item item = Main.item[j]; + item.velocity.Y -= 9f * 0.75f; + } + } + } + } + } + if (dukeFishronLore) + { + player.allDamage += 0.05f; + AllCritBoost(5); + player.moveSpeed += 0.1f; + } + if (lunaticCultistLore) + { + player.endurance += 0.04f; + player.statDefense += 4; + player.allDamage += 0.04f; + AllCritBoost(4); + player.minionKB += 0.5f; + player.moveSpeed += 0.1f; + } + if (moonLordLore) + { + if (player.gravDir == -1f && player.gravControl2) + { + player.endurance += 0.05f; + player.statDefense += 10; + player.allDamage += 0.1f; + AllCritBoost(10); + player.minionKB += 1.5f; + player.moveSpeed += 0.15f; + } + } + if (leviathanAndSirenLore) + { + if (sirenBoobsPrevious || sirenBoobsAltPrevious) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; + } + if (sirenPet) + { + player.spelunkerTimer += 1; + if (player.spelunkerTimer >= 10) + { + player.spelunkerTimer = 0; + int num65 = 30; + int num66 = (int)player.Center.X / 16; + int num67 = (int)player.Center.Y / 16; + for (int num68 = num66 - num65; num68 <= num66 + num65; num68++) + { + for (int num69 = num67 - num65; num69 <= num67 + num65; num69++) + { + if (Main.rand.NextBool(4)) + { + Vector2 vector = new Vector2((float)(num66 - num68), (float)(num67 - num69)); + if (vector.Length() < (float)num65 && num68 > 0 && num68 < Main.maxTilesX - 1 && num69 > 0 && num69 < Main.maxTilesY - 1 && Main.tile[num68, num69] != null && Main.tile[num68, num69].active()) + { + bool flag7 = false; + if (Main.tile[num68, num69].type == 185 && Main.tile[num68, num69].frameY == 18) + { + if (Main.tile[num68, num69].frameX >= 576 && Main.tile[num68, num69].frameX <= 882) + { + flag7 = true; + } + } + else if (Main.tile[num68, num69].type == 186 && Main.tile[num68, num69].frameX >= 864 && Main.tile[num68, num69].frameX <= 1170) + { + flag7 = true; + } + if (flag7 || Main.tileSpelunker[(int)Main.tile[num68, num69].type] || (Main.tileAlch[(int)Main.tile[num68, num69].type] && Main.tile[num68, num69].type != 82)) + { + int num70 = Dust.NewDust(new Vector2((float)(num68 * 16), (float)(num69 * 16)), 16, 16, 204, 0f, 0f, 150, default, 0.3f); + Main.dust[num70].fadeIn = 0.75f; + Main.dust[num70].velocity *= 0.1f; + Main.dust[num70].noLight = true; + } + } + } + } + } + } + } + } + #endregion - #region StandingStillEffects - UpdateRogueStealth(); + #region StandingStillEffects + UpdateRogueStealth(); - if (trinketOfChi) - { - if (trinketOfChiBuff) - { - player.allDamage += 0.5f; - if (player.itemAnimation > 0) - chiBuffTimer = 0; - } - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) - { - if (chiBuffTimer < 120) - chiBuffTimer++; - else - player.AddBuff(mod.BuffType("ChiBuff"), 6); - } - else - chiBuffTimer--; - } - else - chiBuffTimer = 0; + if (trinketOfChi) + { + if (trinketOfChiBuff) + { + player.allDamage += 0.5f; + if (player.itemAnimation > 0) + chiBuffTimer = 0; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (chiBuffTimer < 120) + chiBuffTimer++; + else + player.AddBuff(mod.BuffType("ChiBuff"), 6); + } + else + chiBuffTimer--; + } + else + chiBuffTimer = 0; - if (aquaticEmblem) - { - if ((Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && player.wet && !player.lavaWet && !player.honeyWet) && - !player.mount.Active) - { - if (aquaticBoost > 0f) - { - aquaticBoost -= 0.0002f; //0.015 - if ((double)aquaticBoost <= 0.0) - { - aquaticBoost = 0f; - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - aquaticBoost += 0.0002f; - if (aquaticBoost > 1f) - aquaticBoost = 1f; - if (player.mount.Active) - aquaticBoost = 1f; - } - player.statDefense += (int)((1f - aquaticBoost) * 30f); - player.moveSpeed -= (1f - aquaticBoost) * 0.1f; - } - else - aquaticBoost = 1f; + if (aquaticEmblem) + { + if ((Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && player.wet && !player.lavaWet && !player.honeyWet) && + !player.mount.Active) + { + if (aquaticBoost > 0f) + { + aquaticBoost -= 0.0002f; //0.015 + if ((double)aquaticBoost <= 0.0) + { + aquaticBoost = 0f; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + aquaticBoost += 0.0002f; + if (aquaticBoost > 1f) + aquaticBoost = 1f; + if (player.mount.Active) + aquaticBoost = 1f; + } + player.statDefense += (int)((1f - aquaticBoost) * 30f); + player.moveSpeed -= (1f - aquaticBoost) * 0.1f; + } + else + aquaticBoost = 1f; - if (auricBoost) - { - if (player.itemAnimation > 0) - { - modStealthTimer = 5; - } - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) - { - if (modStealthTimer == 0 && modStealth > 0f) - { - modStealth -= 0.015f; - if ((double)modStealth <= 0.0) - { - modStealth = 0f; - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - modStealth += num27 * 0.0075f; - if (modStealth > 1f) - modStealth = 1f; - if (player.mount.Active) - modStealth = 1f; - } - float damageBoost = (1f - modStealth) * 0.2f; - player.allDamage += damageBoost; - int critBoost = (int)((1f - modStealth) * 10f); - AllCritBoost(critBoost); - if (modStealthTimer > 0) - modStealthTimer--; - } - else if (pAmulet) - { - if (player.itemAnimation > 0) - { - modStealthTimer = 5; - } - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) - { - if (modStealthTimer == 0 && modStealth > 0f) - { - modStealth -= 0.015f; - if ((double)modStealth <= 0.0) - { - modStealth = 0f; - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - modStealth += num27 * 0.0075f; - if (modStealth > 1f) - modStealth = 1f; - if (player.mount.Active) - modStealth = 1f; - } - player.Calamity().throwingDamage += (1f - modStealth) * 0.2f; - player.Calamity().throwingCrit += (int)((1f - modStealth) * 10f); - player.aggro -= (int)((1f - modStealth) * 750f); - if (modStealthTimer > 0) - modStealthTimer--; - } - else - modStealth = 1f; - #endregion + if (auricBoost) + { + if (player.itemAnimation > 0) + { + modStealthTimer = 5; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (modStealthTimer == 0 && modStealth > 0f) + { + modStealth -= 0.015f; + if ((double)modStealth <= 0.0) + { + modStealth = 0f; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + modStealth += num27 * 0.0075f; + if (modStealth > 1f) + modStealth = 1f; + if (player.mount.Active) + modStealth = 1f; + } + float damageBoost = (1f - modStealth) * 0.2f; + player.allDamage += damageBoost; + int critBoost = (int)((1f - modStealth) * 10f); + AllCritBoost(critBoost); + if (modStealthTimer > 0) + modStealthTimer--; + } + else if (pAmulet) + { + if (player.itemAnimation > 0) + { + modStealthTimer = 5; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (modStealthTimer == 0 && modStealth > 0f) + { + modStealth -= 0.015f; + if ((double)modStealth <= 0.0) + { + modStealth = 0f; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + modStealth += num27 * 0.0075f; + if (modStealth > 1f) + modStealth = 1f; + if (player.mount.Active) + modStealth = 1f; + } + player.Calamity().throwingDamage += (1f - modStealth) * 0.2f; + player.Calamity().throwingCrit += (int)((1f - modStealth) * 10f); + player.aggro -= (int)((1f - modStealth) * 750f); + if (modStealthTimer > 0) + modStealthTimer--; + } + else + modStealth = 1f; + #endregion - #region ElysianAegis - if (elysianAegis) - { - bool flag14 = false; - if (elysianGuard) - { - float num29 = shieldInvinc; - shieldInvinc -= 0.08f; - if (shieldInvinc < 0f) - { - shieldInvinc = 0f; - } - else - { - flag14 = true; - } - if (shieldInvinc == 0f && num29 != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - float damageBoost = (5f - shieldInvinc) * 0.03f; - player.allDamage += damageBoost; - int critBoost = (int)((5f - shieldInvinc) * 2f); - AllCritBoost(critBoost); - player.aggro += (int)((5f - shieldInvinc) * 220f); - player.statDefense += (int)((5f - shieldInvinc) * 4f); - player.moveSpeed *= 0.85f; - if (player.mount.Active) - { - elysianGuard = false; - } - } - else - { - float num30 = shieldInvinc; - shieldInvinc += 0.08f; - if (shieldInvinc > 5f) - { - shieldInvinc = 5f; - } - else - { - flag14 = true; - } - if (shieldInvinc == 5f && num30 != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - if (flag14) - { - if (Main.rand.NextBool(2)) - { - Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, 244, 0f, 0f, 0, default, 1f)]; - dust.noGravity = true; - dust.position = player.Center - vector * (float)Main.rand.Next(5, 11); - dust.velocity = vector.RotatedBy(1.5707963705062866, default) * 4f; - dust.scale = 0.5f + Main.rand.NextFloat(); - dust.fadeIn = 0.5f; - } - if (Main.rand.NextBool(2)) - { - Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default, 1f)]; - dust2.noGravity = true; - dust2.position = player.Center - vector2 * 12f; - dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default) * 2f; - dust2.scale = 0.5f + Main.rand.NextFloat(); - dust2.fadeIn = 0.5f; - } - } - } - else - { - elysianGuard = false; - } - #endregion + #region ElysianAegis + if (elysianAegis) + { + bool flag14 = false; + if (elysianGuard) + { + float num29 = shieldInvinc; + shieldInvinc -= 0.08f; + if (shieldInvinc < 0f) + { + shieldInvinc = 0f; + } + else + { + flag14 = true; + } + if (shieldInvinc == 0f && num29 != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + float damageBoost = (5f - shieldInvinc) * 0.03f; + player.allDamage += damageBoost; + int critBoost = (int)((5f - shieldInvinc) * 2f); + AllCritBoost(critBoost); + player.aggro += (int)((5f - shieldInvinc) * 220f); + player.statDefense += (int)((5f - shieldInvinc) * 4f); + player.moveSpeed *= 0.85f; + if (player.mount.Active) + { + elysianGuard = false; + } + } + else + { + float num30 = shieldInvinc; + shieldInvinc += 0.08f; + if (shieldInvinc > 5f) + { + shieldInvinc = 5f; + } + else + { + flag14 = true; + } + if (shieldInvinc == 5f && num30 != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + if (flag14) + { + if (Main.rand.NextBool(2)) + { + Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, 244, 0f, 0f, 0, default, 1f)]; + dust.noGravity = true; + dust.position = player.Center - vector * (float)Main.rand.Next(5, 11); + dust.velocity = vector.RotatedBy(1.5707963705062866, default) * 4f; + dust.scale = 0.5f + Main.rand.NextFloat(); + dust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(2)) + { + Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default, 1f)]; + dust2.noGravity = true; + dust2.position = player.Center - vector2 * 12f; + dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default) * 2f; + dust2.scale = 0.5f + Main.rand.NextFloat(); + dust2.fadeIn = 0.5f; + } + } + } + else + { + elysianGuard = false; + } + #endregion - #region OtherBuffs - if (gravityNormalizer) - { - player.buffImmune[BuffID.VortexDebuff] = true; - float x = (float)(Main.maxTilesX / 4200); - x *= x; - float spaceGravityMult = (float)((double)(player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); - if (spaceGravityMult < 1f) - { - player.gravity = Player.defaultGravity; - if (player.wet) - { - if (player.honeyWet) - player.gravity = 0.1f; - else if (player.merman) - player.gravity = 0.3f; - else - player.gravity = 0.2f; - } - } - } - if (astralInjection) - { - if (player.statMana < player.statManaMax2) - { - player.statMana += 3; - } - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - } - if (armorCrumbling) - { - player.Calamity().throwingCrit += 5; - player.meleeCrit += 5; - } - if (armorShattering) - { - if (player.FindBuffIndex(mod.BuffType("ArmorCrumbling")) > -1) { player.ClearBuff(mod.BuffType("ArmorCrumbling")); } - player.Calamity().throwingDamage += 0.08f; - player.meleeDamage += 0.08f; - player.Calamity().throwingCrit += 8; - player.meleeCrit += 8; - } - if (holyWrath) - { - if (player.FindBuffIndex(BuffID.Wrath) > -1) { player.ClearBuff(BuffID.Wrath); } - player.allDamage += 0.12f; - player.moveSpeed += 0.05f; - } - if (profanedRage) - { - if (player.FindBuffIndex(BuffID.Rage) > -1) { player.ClearBuff(BuffID.Rage); } - AllCritBoost(12); - player.moveSpeed += 0.05f; - } - if (irradiated) - { - player.statDefense -= 10; - player.allDamage += 0.05f; - player.minionKB += 0.5f; - player.moveSpeed += 0.05f; - } - if (rRage) - { - player.allDamage += 0.05f; - player.moveSpeed += 0.05f; - } - if (xRage) - { - player.allDamage += 0.1f; - } - if (xWrath) - { - AllCritBoost(5); - } - if (godSlayerCooldown) - { - player.allDamage += 0.1f; - } - if (graxDefense) - { - player.statDefense += 30; - player.endurance += 0.1f; - player.meleeDamage += 0.2f; - } - if (sMeleeBoost) - { - player.allDamage += 0.1f; - AllCritBoost(5); - } - if (tFury) - { - player.meleeDamage += 0.3f; - player.meleeCrit += 10; - } - if (yPower) - { - player.endurance += 0.05f; - player.statDefense += 5; - player.allDamage += 0.06f; - AllCritBoost(2); - player.minionKB += 1f; - player.moveSpeed += 0.15f; - } - if (tScale) - { - player.endurance += 0.05f; - player.statDefense += 5; - player.kbBuff = true; - } - if (darkSunRing) - { - player.maxMinions += 2; - player.allDamage += 0.12f; - player.minionKB += 1.2f; - player.pickSpeed -= 0.15f; - if (Main.dayTime) - { - player.lifeRegen += 3; - } - else - { - player.statDefense += 30; - } - } - if (eGauntlet) - { - player.longInvince = true; - player.kbGlove = true; - player.meleeDamage += 0.15f; - player.meleeCrit += 5; - player.lavaMax += 240; - } - if (fabsolVodka) - { - alcoholPoisonLevel++; - player.allDamage += 0.08f; - player.statDefense -= 20; - } - if (vodka) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 4; - player.allDamage += 0.06f; - AllCritBoost(2); - } - if (redWine) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - } - if (grapeBeer) - { - alcoholPoisonLevel++; - player.statDefense -= 2; - player.moveSpeed -= 0.05f; - } - if (moonshine) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense += 10; - player.endurance += 0.05f; - } - if (rum) - { - alcoholPoisonLevel++; - player.lifeRegen += 2; - player.moveSpeed += 0.1f; - player.statDefense -= 8; - } - if (fireball) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - } - if (whiskey) - { - alcoholPoisonLevel++; - player.statDefense -= 8; - player.allDamage += 0.04f; - AllCritBoost(2); - } - if (everclear) - { - alcoholPoisonLevel += 2; - player.lifeRegen -= 10; - player.statDefense -= 40; - player.allDamage += 0.25f; - } - if (bloodyMary) - { - alcoholPoisonLevel++; - player.lifeRegen -= 2; - if (Main.bloodMoon) - { - player.statDefense -= 6; - player.allDamage += 0.15f; - AllCritBoost(7); - player.moveSpeed += 0.15f; - } - } - if (tequila) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - if (Main.dayTime) - { - player.statDefense += 5; - player.allDamage += 0.03f; - AllCritBoost(2); - player.endurance += 0.03f; - } - } - if (tequilaSunrise) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - if (Main.dayTime) - { - player.statDefense += 15; - player.allDamage += 0.07f; - AllCritBoost(3); - player.endurance += 0.07f; - } - } - if (screwdriver) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - } - if (caribbeanRum) - { - alcoholPoisonLevel++; - player.lifeRegen += 2; - player.moveSpeed += 0.2f; - player.statDefense -= 12; - } - if (cinnamonRoll) - { - alcoholPoisonLevel++; - player.statDefense -= 12; - player.manaRegenDelay--; - player.manaRegenBonus += 10; - } - if (margarita) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 6; - } - if (starBeamRye) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 6; - player.magicDamage += 0.08f; - player.manaCost *= 0.9f; - } - if (moscowMule) - { - alcoholPoisonLevel++; - player.lifeRegen -= 2; - player.allDamage += 0.09f; - AllCritBoost(3); - } - if (whiteWine) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 6; - player.magicDamage += 0.1f; - } - if (evergreenGin) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.endurance += 0.05f; - } - if (alcoholPoisonLevel > 3) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 3 * alcoholPoisonLevel; - } - if (giantPearl) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - float distance = (Main.npc[m].Center - player.Center).Length(); - if (distance < 120f) - Main.npc[m].AddBuff(mod.BuffType("PearlAura"), 2, false); - } - } - } - } - if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type)) - { - player.scope = true; - } - if (harpyRing) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); - player.moveSpeed += 0.2f; - } - if (blueCandle) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); - player.moveSpeed += 0.15f; - } - if (plaguebringerGoliathLore) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); - } - if (soaring) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); - } - if (draconicSurge) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.35); - } - if (bounding) - { - player.jumpSpeedBoost += 0.5f; - Player.jumpHeight += 10; - player.extraFall += 25; - } - if (community) - { - float floatTypeBoost = 0.01f + - (NPC.downedSlimeKing ? 0.01f : 0f) + - (NPC.downedBoss1 ? 0.01f : 0f) + - (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + - (Main.hardMode ? 0.01f : 0f) + - (NPC.downedMechBossAny ? 0.01f : 0f) + - (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + - (NPC.downedAncientCultist ? 0.01f : 0f) + - (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 - int integerTypeBoost = (int)(floatTypeBoost * 50f); - int critBoost = integerTypeBoost / 2; - int regenBoost = 1 + (integerTypeBoost / 5); - float damageBoost = floatTypeBoost * 0.5f; - player.endurance += (floatTypeBoost * 0.25f); - player.statDefense += integerTypeBoost; - player.allDamage += damageBoost; - AllCritBoost(critBoost); - player.minionKB += floatTypeBoost; - player.moveSpeed += floatTypeBoost; - player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; - bool lesserEffect = false; - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); - if (shouldAffect) - lesserEffect = true; - } - if (player.lifeRegen < 0) - player.lifeRegen += lesserEffect ? 1 : regenBoost; - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15); - } - if (ravagerLore) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); - player.allDamage += 0.1f; - } - if (corrEffigy) - { - player.moveSpeed += 0.15f; - AllCritBoost(10); - } - if (crimEffigy) - { - player.allDamage += 0.15f; - player.statDefense += 10; - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); - } - if (badgeOfBraveryRare) - { - player.meleeDamage += 0.2f; - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); - } - if (regenator) - { - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.5); - player.lifeRegenTime += 8; - player.lifeRegen += 16; - } - if (calamitasLore) - { - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); - player.maxMinions += 2; - } - if (thirdSageH && !player.dead && player.HasBuff(mod.BuffType("ThirdSageBuff"))) - { - player.statLife = player.statLifeMax2; - } - if (pinkCandle) - { - // every frame, add up 1/60th of the healing value (0.4% max HP per second) - pinkCandleHealFraction += player.statLifeMax2 * 0.004 / 60; - if (pinkCandleHealFraction >= 1D) - { - pinkCandleHealFraction = 0D; - if (player.statLife < player.statLifeMax2) - player.statLife++; - } - } - else - pinkCandleHealFraction = 0D; + #region OtherBuffs + if (gravityNormalizer) + { + player.buffImmune[BuffID.VortexDebuff] = true; + float x = (float)(Main.maxTilesX / 4200); + x *= x; + float spaceGravityMult = (float)((double)(player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); + if (spaceGravityMult < 1f) + { + player.gravity = Player.defaultGravity; + if (player.wet) + { + if (player.honeyWet) + player.gravity = 0.1f; + else if (player.merman) + player.gravity = 0.3f; + else + player.gravity = 0.2f; + } + } + } + if (astralInjection) + { + if (player.statMana < player.statManaMax2) + { + player.statMana += 3; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + } + if (armorCrumbling) + { + player.Calamity().throwingCrit += 5; + player.meleeCrit += 5; + } + if (armorShattering) + { + if (player.FindBuffIndex(mod.BuffType("ArmorCrumbling")) > -1) + { player.ClearBuff(mod.BuffType("ArmorCrumbling")); } + player.Calamity().throwingDamage += 0.08f; + player.meleeDamage += 0.08f; + player.Calamity().throwingCrit += 8; + player.meleeCrit += 8; + } + if (holyWrath) + { + if (player.FindBuffIndex(BuffID.Wrath) > -1) + { player.ClearBuff(BuffID.Wrath); } + player.allDamage += 0.12f; + player.moveSpeed += 0.05f; + } + if (profanedRage) + { + if (player.FindBuffIndex(BuffID.Rage) > -1) + { player.ClearBuff(BuffID.Rage); } + AllCritBoost(12); + player.moveSpeed += 0.05f; + } + if (irradiated) + { + player.statDefense -= 10; + player.allDamage += 0.05f; + player.minionKB += 0.5f; + player.moveSpeed += 0.05f; + } + if (rRage) + { + player.allDamage += 0.05f; + player.moveSpeed += 0.05f; + } + if (xRage) + { + player.allDamage += 0.1f; + } + if (xWrath) + { + AllCritBoost(5); + } + if (godSlayerCooldown) + { + player.allDamage += 0.1f; + } + if (graxDefense) + { + player.statDefense += 30; + player.endurance += 0.1f; + player.meleeDamage += 0.2f; + } + if (sMeleeBoost) + { + player.allDamage += 0.1f; + AllCritBoost(5); + } + if (tFury) + { + player.meleeDamage += 0.3f; + player.meleeCrit += 10; + } + if (yPower) + { + player.endurance += 0.05f; + player.statDefense += 5; + player.allDamage += 0.06f; + AllCritBoost(2); + player.minionKB += 1f; + player.moveSpeed += 0.15f; + } + if (tScale) + { + player.endurance += 0.05f; + player.statDefense += 5; + player.kbBuff = true; + } + if (darkSunRing) + { + player.maxMinions += 2; + player.allDamage += 0.12f; + player.minionKB += 1.2f; + player.pickSpeed -= 0.15f; + if (Main.dayTime) + { + player.lifeRegen += 3; + } + else + { + player.statDefense += 30; + } + } + if (eGauntlet) + { + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.15f; + player.meleeCrit += 5; + player.lavaMax += 240; + } + if (fabsolVodka) + { + alcoholPoisonLevel++; + player.allDamage += 0.08f; + player.statDefense -= 20; + } + if (vodka) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 4; + player.allDamage += 0.06f; + AllCritBoost(2); + } + if (redWine) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + } + if (grapeBeer) + { + alcoholPoisonLevel++; + player.statDefense -= 2; + player.moveSpeed -= 0.05f; + } + if (moonshine) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense += 10; + player.endurance += 0.05f; + } + if (rum) + { + alcoholPoisonLevel++; + player.lifeRegen += 2; + player.moveSpeed += 0.1f; + player.statDefense -= 8; + } + if (fireball) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + } + if (whiskey) + { + alcoholPoisonLevel++; + player.statDefense -= 8; + player.allDamage += 0.04f; + AllCritBoost(2); + } + if (everclear) + { + alcoholPoisonLevel += 2; + player.lifeRegen -= 10; + player.statDefense -= 40; + player.allDamage += 0.25f; + } + if (bloodyMary) + { + alcoholPoisonLevel++; + player.lifeRegen -= 2; + if (Main.bloodMoon) + { + player.statDefense -= 6; + player.allDamage += 0.15f; + AllCritBoost(7); + player.moveSpeed += 0.15f; + } + } + if (tequila) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + if (Main.dayTime) + { + player.statDefense += 5; + player.allDamage += 0.03f; + AllCritBoost(2); + player.endurance += 0.03f; + } + } + if (tequilaSunrise) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + if (Main.dayTime) + { + player.statDefense += 15; + player.allDamage += 0.07f; + AllCritBoost(3); + player.endurance += 0.07f; + } + } + if (screwdriver) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + } + if (caribbeanRum) + { + alcoholPoisonLevel++; + player.lifeRegen += 2; + player.moveSpeed += 0.2f; + player.statDefense -= 12; + } + if (cinnamonRoll) + { + alcoholPoisonLevel++; + player.statDefense -= 12; + player.manaRegenDelay--; + player.manaRegenBonus += 10; + } + if (margarita) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 6; + } + if (starBeamRye) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 6; + player.magicDamage += 0.08f; + player.manaCost *= 0.9f; + } + if (moscowMule) + { + alcoholPoisonLevel++; + player.lifeRegen -= 2; + player.allDamage += 0.09f; + AllCritBoost(3); + } + if (whiteWine) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 6; + player.magicDamage += 0.1f; + } + if (evergreenGin) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.endurance += 0.05f; + } + if (alcoholPoisonLevel > 3) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 3 * alcoholPoisonLevel; + } + if (giantPearl) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + float distance = (Main.npc[m].Center - player.Center).Length(); + if (distance < 120f) + Main.npc[m].AddBuff(mod.BuffType("PearlAura"), 2, false); + } + } + } + } + if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + player.scope = true; + } + if (harpyRing) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); + player.moveSpeed += 0.2f; + } + if (blueCandle) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); + player.moveSpeed += 0.15f; + } + if (plaguebringerGoliathLore) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); + } + if (soaring) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); + } + if (draconicSurge) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.35); + } + if (bounding) + { + player.jumpSpeedBoost += 0.5f; + Player.jumpHeight += 10; + player.extraFall += 25; + } + if (community) + { + float floatTypeBoost = 0.01f + + (NPC.downedSlimeKing ? 0.01f : 0f) + + (NPC.downedBoss1 ? 0.01f : 0f) + + (NPC.downedBoss2 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 + (NPC.downedBoss3 ? 0.01f : 0f) + + (Main.hardMode ? 0.01f : 0f) + + (NPC.downedMechBossAny ? 0.01f : 0f) + + (NPC.downedPlantBoss ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 + (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedAncientCultist ? 0.01f : 0f) + + (NPC.downedMoonlord ? 0.01f : 0f) + + (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 + (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 + (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + int integerTypeBoost = (int)(floatTypeBoost * 50f); + int critBoost = integerTypeBoost / 2; + int regenBoost = 1 + (integerTypeBoost / 5); + float damageBoost = floatTypeBoost * 0.5f; + player.endurance += (floatTypeBoost * 0.25f); + player.statDefense += integerTypeBoost; + player.allDamage += damageBoost; + AllCritBoost(critBoost); + player.minionKB += floatTypeBoost; + player.moveSpeed += floatTypeBoost; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; + bool lesserEffect = false; + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); + if (shouldAffect) + lesserEffect = true; + } + if (player.lifeRegen < 0) + player.lifeRegen += lesserEffect ? 1 : regenBoost; + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15); + } + if (ravagerLore) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); + player.allDamage += 0.1f; + } + if (corrEffigy) + { + player.moveSpeed += 0.15f; + AllCritBoost(10); + } + if (crimEffigy) + { + player.allDamage += 0.15f; + player.statDefense += 10; + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); + } + if (badgeOfBraveryRare) + { + player.meleeDamage += 0.2f; + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + } + if (regenator) + { + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.5); + player.lifeRegenTime += 8; + player.lifeRegen += 16; + } + if (calamitasLore) + { + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + player.maxMinions += 2; + } + if (thirdSageH && !player.dead && player.HasBuff(mod.BuffType("ThirdSageBuff"))) + { + player.statLife = player.statLifeMax2; + } + if (pinkCandle) + { + // every frame, add up 1/60th of the healing value (0.4% max HP per second) + pinkCandleHealFraction += player.statLifeMax2 * 0.004 / 60; + if (pinkCandleHealFraction >= 1D) + { + pinkCandleHealFraction = 0D; + if (player.statLife < player.statLifeMax2) + player.statLife++; + } + } + else + pinkCandleHealFraction = 0D; - if (manaOverloader) - { - player.magicDamage += 0.06f; - if (player.statMana > (int)((double)player.statManaMax2 * 0.5)) - player.lifeRegen -= 3; - if (player.statMana < (int)((double)player.statManaMax2 * 0.1)) - player.ghostHeal = true; - } - if (rBrain) - { - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) - player.allDamage += 0.1f; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - player.moveSpeed -= 0.05f; - } - if (bloodyWormTooth) - { - if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) - { - player.meleeDamage += 0.1f; - player.meleeSpeed += 0.1f; - player.endurance += 0.1f; - } - else - { - player.meleeDamage += 0.05f; - player.meleeSpeed += 0.05f; - player.endurance += 0.05f; - } - } - if (dAmulet) - { - player.panic = true; - player.pStone = true; - player.armorPenetration += 10; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 1.35f, 0.3f, 0.9f); - } - } - if (rampartOfDeities) - { - player.armorPenetration += 10; - player.noKnockback = true; - if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) - { - player.hasPaladinShield = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) - { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) - { - float arg = player.position.X - Main.player[myPlayer].position.X; - float num3 = player.position.Y - Main.player[myPlayer].position.Y; - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) - { - Main.player[myPlayer].AddBuff(43, 20, true); - } - } - } - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(62, 5, true); - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.endurance += 0.05f; - } - } - else if (fBulwark) - { - player.noKnockback = true; - if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) - { - player.hasPaladinShield = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) - { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) - { - float arg = player.position.X - Main.player[myPlayer].position.X; - float num3 = player.position.Y - Main.player[myPlayer].position.Y; - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) - { - Main.player[myPlayer].AddBuff(43, 20, true); - } - } - } - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(62, 5, true); - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.endurance += 0.05f; - } - } - if (frostFlare) - { - player.resistCold = true; - player.buffImmune[44] = true; - player.buffImmune[46] = true; - player.buffImmune[47] = true; - if (player.statLife > (int)((double)player.statLifeMax2 * 0.75)) - { - player.allDamage += 0.1f; - } - if (player.statLife < (int)((double)player.statLifeMax2 * 0.25)) - { - player.statDefense += 10; - } - } - if (vexation) - { - if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) - { - player.allDamage += 0.15f; - } - } - if (ataxiaBlaze) - { - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(BuffID.Inferno, 2); - } - } - if (bloodflareThrowing) - { - if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) - { - player.Calamity().throwingCrit += 5; - player.statDefense += 30; - } - else - { - player.Calamity().throwingDamage += 0.1f; - } - } - if (bloodflareSummon) - { - if (player.statLife >= (int)((double)player.statLifeMax2 * 0.9)) - { - player.minionDamage += 0.1f; - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.statDefense += 20; - player.lifeRegen += 2; - } - if (bloodflareSummonTimer > 0) { bloodflareSummonTimer--; } - if (player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) - { - bloodflareSummonTimer = 900; - for (int I = 0; I < 3; I++) - { - float ai1 = (float)(I * 120); - Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, - mod.ProjectileType("GhostlyMine"), (int)((auricSet ? 15000f : 5000f) * player.minionDamage), 1f, player.whoAmI, ai1, 0f); - } - } - } - if (yInsignia) - { - player.longInvince = true; - player.kbGlove = true; - player.meleeDamage += 0.05f; - player.lavaMax += 240; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.allDamage += 0.1f; - } - } - if (reaperToothNecklace) - { - player.allDamage += 0.25f; - player.statDefense /= 2; - } - if (deepDiver) - { - player.allDamage += 0.15f; - player.statDefense += (int)((double)player.statDefense * 0.15); - player.moveSpeed += 0.15f; - } - if (coreOfTheBloodGod) - { - player.endurance += 0.05f; - player.allDamage += 0.07f; - if (player.statDefense < 100) - { - player.allDamage += 0.15f; - } - } - else if (bloodflareCore) - { - if (player.statDefense < 100) - { - player.allDamage += 0.15f; - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.endurance += 0.1f; - player.allDamage += 0.2f; - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.endurance += 0.05f; - player.allDamage += 0.1f; - } - } - if (godSlayerThrowing) - { - if (player.statLife >= player.statLifeMax2) - { - player.Calamity().throwingCrit += 10; - player.Calamity().throwingDamage += 0.1f; - player.Calamity().throwingVelocity += 0.1f; - } - } - if (tarraSummon) - { - int lifeCounter = 0; - float num2 = 300f; - bool flag = lifeCounter % 60 == 0; - int num3 = 200; - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - lifeCounter++; - if (lifeCounter >= 180) - { - lifeCounter = 0; - } - } - if (brimstoneElementalLore && player.inferno) - { - int num = mod.BuffType("BrimstoneFlames"); - float num2 = 300f; - bool flag = player.infernoCounter % 30 == 0; - int damage = 50; - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1 && !nPC.buffImmune[num]) - { - nPC.AddBuff(num, 120, false); - } - if (flag) - { - player.ApplyDamageToNPC(nPC, damage, 0f, 0, false); - } - } - } - } - } - if (plaguebringerGoliathLore) - { - player.lifeRegen /= 2; - } - if (royalGel) - { - player.npcTypeNoAggro[mod.NPCType("AeroSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("BloomSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("CharredSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("CrimulanBlightSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("CryoSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("EbonianBlightSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("IrradiatedSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("PerennialSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("PlaguedJungleSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("AstralSlime")] = true; - player.npcTypeNoAggro[mod.NPCType("WulfrumSlime")] = true; //remove when wulfrum slime redesigned - } - #endregion + if (manaOverloader) + { + player.magicDamage += 0.06f; + if (player.statMana > (int)((double)player.statManaMax2 * 0.5)) + player.lifeRegen -= 3; + if (player.statMana < (int)((double)player.statManaMax2 * 0.1)) + player.ghostHeal = true; + } + if (rBrain) + { + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) + player.allDamage += 0.1f; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + player.moveSpeed -= 0.05f; + } + if (bloodyWormTooth) + { + if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) + { + player.meleeDamage += 0.1f; + player.meleeSpeed += 0.1f; + player.endurance += 0.1f; + } + else + { + player.meleeDamage += 0.05f; + player.meleeSpeed += 0.05f; + player.endurance += 0.05f; + } + } + if (dAmulet) + { + player.panic = true; + player.pStone = true; + player.armorPenetration += 10; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 1.35f, 0.3f, 0.9f); + } + } + if (rampartOfDeities) + { + player.armorPenetration += 10; + player.noKnockback = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) + { + player.hasPaladinShield = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + int myPlayer = Main.myPlayer; + if (Main.player[myPlayer].team == player.team && player.team != 0) + { + float arg = player.position.X - Main.player[myPlayer].position.X; + float num3 = player.position.Y - Main.player[myPlayer].position.Y; + if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) + { + Main.player[myPlayer].AddBuff(43, 20, true); + } + } + } + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(62, 5, true); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.05f; + } + } + else if (fBulwark) + { + player.noKnockback = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) + { + player.hasPaladinShield = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + int myPlayer = Main.myPlayer; + if (Main.player[myPlayer].team == player.team && player.team != 0) + { + float arg = player.position.X - Main.player[myPlayer].position.X; + float num3 = player.position.Y - Main.player[myPlayer].position.Y; + if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) + { + Main.player[myPlayer].AddBuff(43, 20, true); + } + } + } + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(62, 5, true); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.05f; + } + } + if (frostFlare) + { + player.resistCold = true; + player.buffImmune[44] = true; + player.buffImmune[46] = true; + player.buffImmune[47] = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.75)) + { + player.allDamage += 0.1f; + } + if (player.statLife < (int)((double)player.statLifeMax2 * 0.25)) + { + player.statDefense += 10; + } + } + if (vexation) + { + if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) + { + player.allDamage += 0.15f; + } + } + if (ataxiaBlaze) + { + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(BuffID.Inferno, 2); + } + } + if (bloodflareThrowing) + { + if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) + { + player.Calamity().throwingCrit += 5; + player.statDefense += 30; + } + else + { + player.Calamity().throwingDamage += 0.1f; + } + } + if (bloodflareSummon) + { + if (player.statLife >= (int)((double)player.statLifeMax2 * 0.9)) + { + player.minionDamage += 0.1f; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.statDefense += 20; + player.lifeRegen += 2; + } + if (bloodflareSummonTimer > 0) + { bloodflareSummonTimer--; } + if (player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) + { + bloodflareSummonTimer = 900; + for (int I = 0; I < 3; I++) + { + float ai1 = (float)(I * 120); + Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, + mod.ProjectileType("GhostlyMine"), (int)((auricSet ? 15000f : 5000f) * player.minionDamage), 1f, player.whoAmI, ai1, 0f); + } + } + } + if (yInsignia) + { + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.05f; + player.lavaMax += 240; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.allDamage += 0.1f; + } + } + if (reaperToothNecklace) + { + player.allDamage += 0.25f; + player.statDefense /= 2; + } + if (deepDiver) + { + player.allDamage += 0.15f; + player.statDefense += (int)((double)player.statDefense * 0.15); + player.moveSpeed += 0.15f; + } + if (coreOfTheBloodGod) + { + player.endurance += 0.05f; + player.allDamage += 0.07f; + if (player.statDefense < 100) + { + player.allDamage += 0.15f; + } + } + else if (bloodflareCore) + { + if (player.statDefense < 100) + { + player.allDamage += 0.15f; + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.1f; + player.allDamage += 0.2f; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.endurance += 0.05f; + player.allDamage += 0.1f; + } + } + if (godSlayerThrowing) + { + if (player.statLife >= player.statLifeMax2) + { + player.Calamity().throwingCrit += 10; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingVelocity += 0.1f; + } + } + if (tarraSummon) + { + int lifeCounter = 0; + float num2 = 300f; + bool flag = lifeCounter % 60 == 0; + int num3 = 200; + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + lifeCounter++; + if (lifeCounter >= 180) + { + lifeCounter = 0; + } + } + if (brimstoneElementalLore && player.inferno) + { + int num = mod.BuffType("BrimstoneFlames"); + float num2 = 300f; + bool flag = player.infernoCounter % 30 == 0; + int damage = 50; + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1 && !nPC.buffImmune[num]) + { + nPC.AddBuff(num, 120, false); + } + if (flag) + { + player.ApplyDamageToNPC(nPC, damage, 0f, 0, false); + } + } + } + } + } + if (plaguebringerGoliathLore) + { + player.lifeRegen /= 2; + } + if (royalGel) + { + player.npcTypeNoAggro[mod.NPCType("AeroSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("BloomSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("CharredSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("CrimulanBlightSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("CryoSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("EbonianBlightSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("IrradiatedSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("PerennialSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("PlaguedJungleSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("AstralSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("WulfrumSlime")] = true; //remove when wulfrum slime redesigned + } + #endregion - #region LimitsAndOtherShit - if (player.meleeSpeed < 0.5f) - { - player.meleeSpeed = 0.5f; - } - if (auricSet && silvaMelee) - { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; - player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times - } - // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% - player.endurance = 1f - (1f / (1f + player.endurance)); - if (vHex) - { - player.endurance -= 0.3f; - } - if (irradiated) - { - player.endurance -= 0.1f; - } - if (corrEffigy) - { - player.endurance -= 0.2f; - } - if (CalamityWorld.revenge) - { - if (player.statLife < player.statLifeMax2) - { - bool noLifeRegenCap = ((player.shinyStone || draedonsHeart || cFreeze || shadeRegen || photosynthesis) && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0); - if (!noLifeRegenCap) - { - //Max HP = 400 - //350 HP = 1 - 0.875 * 10 = 1.25 = 1 - //100 HP = 1 - 0.25 * 10 = 7.5 = 7 - //200 HP = 1 - 0.5 * 10 = 5 - int lifeRegenScale = (int)((1f - ((float)player.statLife / (float)player.statLifeMax2)) * 10f); //9 to 0 (1% HP to 100%) - if (player.lifeRegen > lifeRegenScale) - { - double lifeRegenScalar = (double)(1f + ((float)player.statLife / (float)player.statLifeMax2)); //1 to 2 (1% HP to 100%) - int defLifeRegen = (int)((double)player.lifeRegen / lifeRegenScalar); - player.lifeRegen = defLifeRegen; - } - } - } - } - if (CalamityWorld.bossRushActive) - { - if (Config.BossRushHealthCurse) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + #region LimitsAndOtherShit + if (player.meleeSpeed < 0.5f) + { + player.meleeSpeed = 0.5f; + } + if (auricSet && silvaMelee) + { + double multiplier = (double)player.statLife / (double)player.statLifeMax2; + player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times + } + // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% + player.endurance = 1f - (1f / (1f + player.endurance)); + if (vHex) + { + player.endurance -= 0.3f; + } + if (irradiated) + { + player.endurance -= 0.1f; + } + if (corrEffigy) + { + player.endurance -= 0.2f; + } + if (CalamityWorld.revenge) + { + if (player.statLife < player.statLifeMax2) + { + bool noLifeRegenCap = ((player.shinyStone || draedonsHeart || cFreeze || shadeRegen || photosynthesis) && + (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0); + if (!noLifeRegenCap) + { + //Max HP = 400 + //350 HP = 1 - 0.875 * 10 = 1.25 = 1 + //100 HP = 1 - 0.25 * 10 = 7.5 = 7 + //200 HP = 1 - 0.5 * 10 = 5 + int lifeRegenScale = (int)((1f - ((float)player.statLife / (float)player.statLifeMax2)) * 10f); //9 to 0 (1% HP to 100%) + if (player.lifeRegen > lifeRegenScale) + { + double lifeRegenScalar = (double)(1f + ((float)player.statLife / (float)player.statLifeMax2)); //1 to 2 (1% HP to 100%) + int defLifeRegen = (int)((double)player.lifeRegen / lifeRegenScalar); + player.lifeRegen = defLifeRegen; + } + } + } + } + if (CalamityWorld.bossRushActive) + { + if (Config.BossRushHealthCurse) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; - player.lifeRegenTime = 0; + player.lifeRegenTime = 0; - if (player.lifeRegenCount > 0) - player.lifeRegenCount = 0; - } - } - if (Config.ProficiencyEnabled) - { - GetStatBonuses(); - } - if (dArtifact) - { - player.allDamage += 0.25f; - } - if (trippy) - { - player.allDamage += 0.5f; - } - if (eArtifact) - { - player.manaCost *= 0.85f; - player.Calamity().throwingDamage += 0.15f; - player.maxMinions += 2; - } - if (gArtifact) - { - player.maxMinions += 8; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("AngryChicken")) == -1) - { - player.AddBuff(mod.BuffType("AngryChicken"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] < 2) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("AngryChicken"), (int)(232f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - if (pArtifact) - { - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("GuardianHealer")) == -1) - { - player.AddBuff(mod.BuffType("GuardianHealer"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianHealer")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, mod.ProjectileType("MiniGuardianHealer"), 0, 0f, Main.myPlayer, 0f, 0f); - } - float baseDamage = 100f + - (CalamityWorld.downedDoG ? 100f : 0f) + - (CalamityWorld.downedYharon ? 100f : 0f); - if (player.maxMinions >= 8) - { - if (player.FindBuffIndex(mod.BuffType("GuardianDefense")) == -1) - { - player.AddBuff(mod.BuffType("GuardianDefense"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianDefense")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, mod.ProjectileType("MiniGuardianDefense"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); - } - } - if (tarraSummon || bloodflareSummon || godSlayerSummon || silvaSummon || dsSetBonus || omegaBlueSet) - { - if (player.FindBuffIndex(mod.BuffType("GuardianOffense")) == -1) - { - player.AddBuff(mod.BuffType("GuardianOffense"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianAttack")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("MiniGuardianAttack"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); - } - } - } - } - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 1 || - player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 1 || - player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 1) - { - for (int projIndex = 0; projIndex < 1000; projIndex++) - { - if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI) - { - if (Main.projectile[projIndex].type == mod.ProjectileType("BigBustyRose") || Main.projectile[projIndex].type == mod.ProjectileType("SirenLure") || - Main.projectile[projIndex].type == mod.ProjectileType("DrewsSandyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("SandyWaifu") || - Main.projectile[projIndex].type == mod.ProjectileType("CloudyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("FungalClump")) - { - Main.projectile[projIndex].Kill(); - } - } - } - } - if (marked || reaperToothNecklace) - { - if (player.endurance > 0f) - player.endurance *= 0.5f; - } - if (yharonLore && !CalamityWorld.defiled) - { - if (player.wingTimeMax < 50000) - player.wingTimeMax = 50000; - } + if (player.lifeRegenCount > 0) + player.lifeRegenCount = 0; + } + } + if (Config.ProficiencyEnabled) + { + GetStatBonuses(); + } + if (dArtifact) + { + player.allDamage += 0.25f; + } + if (trippy) + { + player.allDamage += 0.5f; + } + if (eArtifact) + { + player.manaCost *= 0.85f; + player.Calamity().throwingDamage += 0.15f; + player.maxMinions += 2; + } + if (gArtifact) + { + player.maxMinions += 8; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("AngryChicken")) == -1) + { + player.AddBuff(mod.BuffType("AngryChicken"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] < 2) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("AngryChicken"), (int)(232f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + if (pArtifact) + { + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("GuardianHealer")) == -1) + { + player.AddBuff(mod.BuffType("GuardianHealer"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianHealer")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, mod.ProjectileType("MiniGuardianHealer"), 0, 0f, Main.myPlayer, 0f, 0f); + } + float baseDamage = 100f + + (CalamityWorld.downedDoG ? 100f : 0f) + + (CalamityWorld.downedYharon ? 100f : 0f); + if (player.maxMinions >= 8) + { + if (player.FindBuffIndex(mod.BuffType("GuardianDefense")) == -1) + { + player.AddBuff(mod.BuffType("GuardianDefense"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianDefense")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, mod.ProjectileType("MiniGuardianDefense"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + if (tarraSummon || bloodflareSummon || godSlayerSummon || silvaSummon || dsSetBonus || omegaBlueSet) + { + if (player.FindBuffIndex(mod.BuffType("GuardianOffense")) == -1) + { + player.AddBuff(mod.BuffType("GuardianOffense"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianAttack")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("MiniGuardianAttack"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 1 || + player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 1 || + player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 1) + { + for (int projIndex = 0; projIndex < 1000; projIndex++) + { + if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI) + { + if (Main.projectile[projIndex].type == mod.ProjectileType("BigBustyRose") || Main.projectile[projIndex].type == mod.ProjectileType("SirenLure") || + Main.projectile[projIndex].type == mod.ProjectileType("DrewsSandyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("SandyWaifu") || + Main.projectile[projIndex].type == mod.ProjectileType("CloudyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("FungalClump")) + { + Main.projectile[projIndex].Kill(); + } + } + } + } + if (marked || reaperToothNecklace) + { + if (player.endurance > 0f) + player.endurance *= 0.5f; + } + if (yharonLore && !CalamityWorld.defiled) + { + if (player.wingTimeMax < 50000) + player.wingTimeMax = 50000; + } #endregion #region Rogue Mirrors @@ -4709,88 +4725,88 @@ namespace CalamityMod.CalPlayer } public override void PostUpdateRunSpeeds() - { - #region SpeedBoosts - float runAccMult = 1f + - ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + - ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + - (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (shadowSpeed ? 0.5f : 0f) + - (auricSet ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + - (cTracers ? 0.1f : 0f) + - (eTracers ? 0.05f : 0f) + - (blueCandle ? 0.05f : 0f) + - ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + - (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + { + #region SpeedBoosts + float runAccMult = 1f + + ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + + ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (shadowSpeed ? 0.5f : 0f) + + (auricSet ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (cTracers ? 0.1f : 0f) + + (eTracers ? 0.05f : 0f) + + (blueCandle ? 0.05f : 0f) + + ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - float runSpeedMult = 1f + - ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + - ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + - (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (shadowSpeed ? 0.5f : 0f) + - (auricSet ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + - (cTracers ? 0.1f : 0f) + - (eTracers ? 0.05f : 0f) + - ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + - (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + float runSpeedMult = 1f + + ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + + ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (shadowSpeed ? 0.5f : 0f) + + (auricSet ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (cTracers ? 0.1f : 0f) + + (eTracers ? 0.05f : 0f) + + ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - if (abyssalDivingSuit && !Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - runAccMult *= 0.4f; - runSpeedMult *= 0.4f; - } - if (horror) - { - runAccMult *= 0.85f; - runSpeedMult *= 0.85f; - } - if (fabledTortoise) - { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; - } - if (ursaSergeant) - { - runAccMult *= 0.8f; - runSpeedMult *= 0.8f; - } - if (elysianGuard) - { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; - } - if (player.powerrun && CalamityWorld.revenge) - { - runSpeedMult *= 0.6666667f; - } + if (abyssalDivingSuit && !Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + runAccMult *= 0.4f; + runSpeedMult *= 0.4f; + } + if (horror) + { + runAccMult *= 0.85f; + runSpeedMult *= 0.85f; + } + if (fabledTortoise) + { + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; + } + if (ursaSergeant) + { + runAccMult *= 0.8f; + runSpeedMult *= 0.8f; + } + if (elysianGuard) + { + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; + } + if (player.powerrun && CalamityWorld.revenge) + { + runSpeedMult *= 0.6666667f; + } - player.runAcceleration *= runAccMult; - player.maxRunSpeed *= runSpeedMult; - #endregion + player.runAcceleration *= runAccMult; + player.maxRunSpeed *= runSpeedMult; + #endregion - #region DashEffects - if (player.pulley && dashMod > 0) - { - ModDashMovement(); - } - else if (player.grappling[0] == -1 && !player.tongued) - { - ModHorizontalMovement(); - if (dashMod > 0) - { - ModDashMovement(); - } - if (pAmulet && modStealth < 1f) - { - float num43 = player.maxRunSpeed / 2f * (1f - modStealth); - player.maxRunSpeed -= num43; - player.accRunSpeed = player.maxRunSpeed; - } - } + #region DashEffects + if (player.pulley && dashMod > 0) + { + ModDashMovement(); + } + else if (player.grappling[0] == -1 && !player.tongued) + { + ModHorizontalMovement(); + if (dashMod > 0) + { + ModDashMovement(); + } + if (pAmulet && modStealth < 1f) + { + float num43 = player.maxRunSpeed / 2f * (1f - modStealth); + player.maxRunSpeed -= num43; + player.accRunSpeed = player.maxRunSpeed; + } + } #endregion } @@ -4846,1120 +4862,1120 @@ namespace CalamityMod.CalPlayer #region Pre Kill public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) - { - if (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle")) - { - if (player.statLife <= 0) - { - player.statLife = 1; - } - return false; - } - if (hInferno) - { - for (int x = 0; x < 200; x++) - { - if (Main.npc[x].active && Main.npc[x].type == mod.NPCType("Providence")) - { - Main.npc[x].active = false; - } - } - } - if (nCore && Main.rand.NextBool(10)) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); - for (int j = 0; j < 25; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default, 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - player.statLife += 100; - player.HealEffect(100); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - return false; - } - if (godSlayer && !godSlayerCooldown) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); - for (int j = 0; j < 50; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default, 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - int heal = draconicSurge ? player.statLifeMax2 : 150; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.FindBuffIndex(mod.BuffType("DraconicSurgeBuff")) > -1) - { - player.ClearBuff(mod.BuffType("DraconicSurgeBuff")); - draconicSurgeCooldown = 1800; - } - player.AddBuff(mod.BuffType("GodSlayerCooldown"), 2700); - return false; - } - if (silvaSet && silvaCountdown > 0) - { - if (hasSilvaEffect) - { - silvaHitCounter++; - } - if (player.FindBuffIndex(mod.BuffType("SilvaRevival")) == -1) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)player.position.X, (int)player.position.Y); - player.AddBuff(mod.BuffType("SilvaRevival"), 600); - if (draconicSurge) - { - player.statLife += player.statLifeMax2; - player.HealEffect(player.statLifeMax2); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.FindBuffIndex(mod.BuffType("DraconicSurgeBuff")) > -1) - { - player.ClearBuff(mod.BuffType("DraconicSurgeBuff")); - draconicSurgeCooldown = 1800; - } - } - } - hasSilvaEffect = true; - if (player.statLife < 1) - { - player.statLife = 1; - } - return false; - } - if (permafrostsConcoction && player.FindBuffIndex(mod.BuffType("ConcoctionCooldown")) == -1) - { - player.AddBuff(mod.BuffType("ConcoctionCooldown"), 10800); - player.AddBuff(mod.BuffType("Encased"), 300); - player.statLife = player.statLifeMax2 * 3 / 10; - Main.PlaySound(SoundID.Item92, player.position); - for (int i = 0; i < 60; i++) - { - int d = Dust.NewDust(player.position, player.width, player.height, 88, 0f, 0f, 0, default, 2.5f); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= 5f; - } - return false; - } - if (bBlood && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser."); - } - if ((bFlames || aFlames) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames."); - } - if (pFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague."); - } - if ((hFlames || hInferno) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins."); - } - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - if (sCalDeathCount < 51) - { - sCalDeathCount++; - } - } - deathCount++; - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) - { - DeathPacket(false); - } - if (CalamityWorld.ironHeart && areThereAnyDamnBosses) - { - KillPlayer(); - return false; - } - return true; - } - #endregion + { + if (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle")) + { + if (player.statLife <= 0) + { + player.statLife = 1; + } + return false; + } + if (hInferno) + { + for (int x = 0; x < 200; x++) + { + if (Main.npc[x].active && Main.npc[x].type == mod.NPCType("Providence")) + { + Main.npc[x].active = false; + } + } + } + if (nCore && Main.rand.NextBool(10)) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); + for (int j = 0; j < 25; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default, 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + player.statLife += 100; + player.HealEffect(100); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + return false; + } + if (godSlayer && !godSlayerCooldown) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); + for (int j = 0; j < 50; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default, 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + int heal = draconicSurge ? player.statLifeMax2 : 150; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.FindBuffIndex(mod.BuffType("DraconicSurgeBuff")) > -1) + { + player.ClearBuff(mod.BuffType("DraconicSurgeBuff")); + draconicSurgeCooldown = 1800; + } + player.AddBuff(mod.BuffType("GodSlayerCooldown"), 2700); + return false; + } + if (silvaSet && silvaCountdown > 0) + { + if (hasSilvaEffect) + { + silvaHitCounter++; + } + if (player.FindBuffIndex(mod.BuffType("SilvaRevival")) == -1) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)player.position.X, (int)player.position.Y); + player.AddBuff(mod.BuffType("SilvaRevival"), 600); + if (draconicSurge) + { + player.statLife += player.statLifeMax2; + player.HealEffect(player.statLifeMax2); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.FindBuffIndex(mod.BuffType("DraconicSurgeBuff")) > -1) + { + player.ClearBuff(mod.BuffType("DraconicSurgeBuff")); + draconicSurgeCooldown = 1800; + } + } + } + hasSilvaEffect = true; + if (player.statLife < 1) + { + player.statLife = 1; + } + return false; + } + if (permafrostsConcoction && player.FindBuffIndex(mod.BuffType("ConcoctionCooldown")) == -1) + { + player.AddBuff(mod.BuffType("ConcoctionCooldown"), 10800); + player.AddBuff(mod.BuffType("Encased"), 300); + player.statLife = player.statLifeMax2 * 3 / 10; + Main.PlaySound(SoundID.Item92, player.position); + for (int i = 0; i < 60; i++) + { + int d = Dust.NewDust(player.position, player.width, player.height, 88, 0f, 0f, 0, default, 2.5f); + Main.dust[d].noGravity = true; + Main.dust[d].velocity *= 5f; + } + return false; + } + if (bBlood && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser."); + } + if ((bFlames || aFlames) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames."); + } + if (pFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague."); + } + if ((hFlames || hInferno) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins."); + } + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + if (sCalDeathCount < 51) + { + sCalDeathCount++; + } + } + deathCount++; + if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + { + DeathPacket(false); + } + if (CalamityWorld.ironHeart && areThereAnyDamnBosses) + { + KillPlayer(); + return false; + } + return true; + } + #endregion - #region On Respawn - public override void OnRespawn(Player player) - { - thirdSageH = true; - } - #endregion + #region On Respawn + public override void OnRespawn(Player player) + { + thirdSageH = true; + } + #endregion - #region Use Time Mult - public override float UseTimeMultiplier(Item item) - { - if (silvaRanged) - { - if (item.ranged && !item.Calamity().rogue && item.useTime > 3) - return (auricSet ? 1.2f : 1.1f); - } - if (silvaThrowing) - { - if (player.statLife > (int)((double)player.statLifeMax2 * 0.5) && - item.Calamity().rogue && item.useTime > 3) - return 1.1f; - } - return 1f; - } - #endregion + #region Use Time Mult + public override float UseTimeMultiplier(Item item) + { + if (silvaRanged) + { + if (item.ranged && !item.Calamity().rogue && item.useTime > 3) + return (auricSet ? 1.2f : 1.1f); + } + if (silvaThrowing) + { + if (player.statLife > (int)((double)player.statLifeMax2 * 0.5) && + item.Calamity().rogue && item.useTime > 3) + return 1.1f; + } + return 1f; + } + #endregion - #region Get Weapon Damage And KB - public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) - { - bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); - if (isTrueMelee) - { - float damageAdd = (dodgeScarf ? 0.2f : 0f) + - ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2f : 0f) + - (DoGLore ? 0.5f : 0f) + - (fungalSymbiote ? 0.25f : 0f); + #region Get Weapon Damage And KB + public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) + { + bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); + if (isTrueMelee) + { + float damageAdd = (dodgeScarf ? 0.2f : 0f) + + ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2f : 0f) + + (DoGLore ? 0.5f : 0f) + + (fungalSymbiote ? 0.25f : 0f); - add += damageAdd; - } - if (flamethrowerBoost && item.ranged && item.useAmmo == 23) - { - add += 0.25f; - } - if ((cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) || (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type))) - { - add += 0.15f; - } - if (fireball && CalamityMod.fireWeaponList.Contains(item.type)) - { - add += 0.1f; - } + add += damageAdd; + } + if (flamethrowerBoost && item.ranged && item.useAmmo == 23) + { + add += 0.25f; + } + if ((cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) || (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type))) + { + add += 0.15f; + } + if (fireball && CalamityMod.fireWeaponList.Contains(item.type)) + { + add += 0.1f; + } - if (theBee && player.statLife >= player.statLifeMax2) - { - if (item.melee || item.ranged || item.magic || item.Calamity().rogue) - { - double useTimeBeeMultiplier = (double)(item.useTime * item.useAnimation) / 3600.0; //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 = 21.7% boost - if (item.type == mod.ItemType("ScarletDevil")) - { - if (useTimeBeeMultiplier > 0.1) - useTimeBeeMultiplier = 0.1; - } - else - { - if (useTimeBeeMultiplier > 0.35) - useTimeBeeMultiplier = 0.35; - } - theBeeDamage = (int)((double)item.damage * useTimeBeeMultiplier); - } - } - else - { - theBeeDamage = 0; - } - if (!theBee) - { - theBeeDamage = 0; - } - } + if (theBee && player.statLife >= player.statLifeMax2) + { + if (item.melee || item.ranged || item.magic || item.Calamity().rogue) + { + double useTimeBeeMultiplier = (double)(item.useTime * item.useAnimation) / 3600.0; //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 = 21.7% boost + if (item.type == mod.ItemType("ScarletDevil")) + { + if (useTimeBeeMultiplier > 0.1) + useTimeBeeMultiplier = 0.1; + } + else + { + if (useTimeBeeMultiplier > 0.35) + useTimeBeeMultiplier = 0.35; + } + theBeeDamage = (int)((double)item.damage * useTimeBeeMultiplier); + } + } + else + { + theBeeDamage = 0; + } + if (!theBee) + { + theBeeDamage = 0; + } + } - public override void GetWeaponKnockback(Item item, ref float knockback) - { - if (auricBoost) - { - knockback *= 1f + (1f - modStealth) * 0.5f; - } - if (whiskey) - { - knockback *= 1.04f; - } - if (tequila && Main.dayTime) - { - knockback *= 1.03f; - } - if (tequilaSunrise && Main.dayTime) - { - knockback *= 1.07f; - } - if (moscowMule) - { - knockback *= 1.09f; - } - } - #endregion + public override void GetWeaponKnockback(Item item, ref float knockback) + { + if (auricBoost) + { + knockback *= 1f + (1f - modStealth) * 0.5f; + } + if (whiskey) + { + knockback *= 1.04f; + } + if (tequila && Main.dayTime) + { + knockback *= 1.03f; + } + if (tequilaSunrise && Main.dayTime) + { + knockback *= 1.07f; + } + if (moscowMule) + { + knockback *= 1.09f; + } + } + #endregion - #region Melee Effects - public override void MeleeEffects(Item item, Rectangle hitbox) - { - bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); - if (isTrueMelee) - { - if (fungalSymbiote && player.whoAmI == Main.myPlayer) - { - if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) - { - float num339 = 0f; - float num340 = 0f; - float num341 = 0f; - float num342 = 0f; - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) - { - num339 = -7f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num339 = -6f; - num340 = 2f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) - { - num339 = -4f; - num340 = 4f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) - { - num339 = -2f; - num340 = 6f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) - { - num340 = 7f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num342 = 26f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) - { - num342 -= 4f; - num341 -= 20f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) - { - num341 += 6f; - } - if (player.direction == -1) - { - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) - { - num342 -= 8f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num342 -= 6f; - } - } - num339 *= 1.5f; - num340 *= 1.5f; - num342 *= (float)player.direction; - num341 *= player.gravDir; - Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Mushroom, (int)((float)item.damage * 0.25f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); - } - } - if (aWeapon) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); - } - } - if (aChicken) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 244, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); - } - } - if (eGauntlet) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num280].noGravity = true; - } - } - if (cryogenSoul) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); - } - } - if (xerocSet) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 1.25f); - } - } - if (reaverBlast) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); - } - } - if (dsSetBonus) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 27, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 2.5f); - } - } - } - } - #endregion + #region Melee Effects + public override void MeleeEffects(Item item, Rectangle hitbox) + { + bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); + if (isTrueMelee) + { + if (fungalSymbiote && player.whoAmI == Main.myPlayer) + { + if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) + { + float num339 = 0f; + float num340 = 0f; + float num341 = 0f; + float num342 = 0f; + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num339 = -7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num339 = -6f; + num340 = 2f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) + { + num339 = -4f; + num340 = 4f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num339 = -2f; + num340 = 6f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num340 = 7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 = 26f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num342 -= 4f; + num341 -= 20f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num341 += 6f; + } + if (player.direction == -1) + { + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num342 -= 8f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 -= 6f; + } + } + num339 *= 1.5f; + num340 *= 1.5f; + num342 *= (float)player.direction; + num341 *= player.gravDir; + Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Mushroom, (int)((float)item.damage * 0.25f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); + } + } + if (aWeapon) + { + if (Main.rand.NextBool(3)) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); + } + } + if (aChicken) + { + if (Main.rand.NextBool(3)) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 244, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); + } + } + if (eGauntlet) + { + if (Main.rand.NextBool(3)) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num280].noGravity = true; + } + } + if (cryogenSoul) + { + if (Main.rand.NextBool(3)) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); + } + } + if (xerocSet) + { + if (Main.rand.NextBool(3)) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 1.25f); + } + } + if (reaverBlast) + { + if (Main.rand.NextBool(3)) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); + } + } + if (dsSetBonus) + { + if (Main.rand.NextBool(3)) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 27, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 2.5f); + } + } + } + } + #endregion - #region On Hit NPC - public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) - { - if (omegaBlueChestplate) - target.AddBuff(mod.BuffType("CrushDepth"), 240); + #region On Hit NPC + public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) + { + if (omegaBlueChestplate) + target.AddBuff(mod.BuffType("CrushDepth"), 240); - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - if (dsSetBonus) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("DemonFlames"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("DemonFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("DemonFlames"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - if (alchFlask) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("Plague"), 120, false); - } - } - if (armorCrumbling || armorShattering) - { - if (item.melee || item.Calamity().rogue) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); - } - } - } - if (holyWrath) - { - target.AddBuff(mod.BuffType("HolyLight"), 600, false); - } - } - #endregion + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + if (dsSetBonus) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("DemonFlames"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("DemonFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("DemonFlames"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + if (alchFlask) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("Plague"), 120, false); + } + } + if (armorCrumbling || armorShattering) + { + if (item.melee || item.Calamity().rogue) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); + } + } + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + } + #endregion - #region On Hit NPC With Proj - public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) - { - if (omegaBlueChestplate && proj.friendly && !target.friendly) - target.AddBuff(mod.BuffType("CrushDepth"), 240); + #region On Hit NPC With Proj + public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) + { + if (omegaBlueChestplate && proj.friendly && !target.friendly) + target.AddBuff(mod.BuffType("CrushDepth"), 240); - if (proj.melee && silvaMelee && Main.rand.NextBool(4)) - target.AddBuff(mod.BuffType("SilvaStun"), 20); + if (proj.melee && silvaMelee && Main.rand.NextBool(4)) + target.AddBuff(mod.BuffType("SilvaStun"), 20); - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - if (dsSetBonus) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("DemonFlames"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("DemonFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("DemonFlames"), 120, false); - } - } - if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) - { - target.AddBuff(mod.BuffType("Plague"), 360); - } - else if (alchFlask) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("Plague"), 120, false); - } - } - if (proj.melee) - { - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } - if (armorCrumbling || armorShattering) - { - if (proj.melee || proj.Calamity().rogue) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); - } - } - } - if (perforatorLore) - { - target.AddBuff(BuffID.Ichor, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(mod.BuffType("HolyLight"), 600, false); - } - else if (providenceLore) - { - target.AddBuff(mod.BuffType("HolyLight"), 420, false); - } - if (proj.Calamity().rogue) - { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - } - } - } - } - #endregion + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + if (dsSetBonus) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("DemonFlames"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("DemonFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("DemonFlames"), 120, false); + } + } + if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + else if (alchFlask) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("Plague"), 120, false); + } + } + if (proj.melee) + { + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } + if (armorCrumbling || armorShattering) + { + if (proj.melee || proj.Calamity().rogue) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); + } + } + } + if (perforatorLore) + { + target.AddBuff(BuffID.Ichor, 90); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + else if (providenceLore) + { + target.AddBuff(mod.BuffType("HolyLight"), 420, false); + } + if (proj.Calamity().rogue) + { + if (player.meleeEnchant > 0) + { + if (player.meleeEnchant == 1) + { + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 2) + { + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 3) + { + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 5) + { + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + } + if (player.meleeEnchant == 6) + { + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + } + if (player.meleeEnchant == 8) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 4) + { + target.AddBuff(BuffID.Midas, 120, false); + } + } + } + } + #endregion - #region PvP - public override void OnHitPvp(Item item, Player target, int damage, bool crit) - { - if (omegaBlueChestplate) - target.AddBuff(mod.BuffType("CrushDepth"), 240); + #region PvP + public override void OnHitPvp(Item item, Player target, int damage, bool crit) + { + if (omegaBlueChestplate) + target.AddBuff(mod.BuffType("CrushDepth"), 240); - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - if (alchFlask) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("Plague"), 120, false); - } - } - if (holyWrath) - { - target.AddBuff(mod.BuffType("HolyLight"), 600, false); - } - } + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + if (alchFlask) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("Plague"), 120, false); + } + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + } - public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) - { - if (omegaBlueChestplate) - target.AddBuff(mod.BuffType("CrushDepth"), 240); + public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) + { + if (omegaBlueChestplate) + target.AddBuff(mod.BuffType("CrushDepth"), 240); - if (proj.melee && silvaMelee && Main.rand.NextBool(4)) - target.AddBuff(mod.BuffType("SilvaStun"), 20); + if (proj.melee && silvaMelee && Main.rand.NextBool(4)) + target.AddBuff(mod.BuffType("SilvaStun"), 20); - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) - { - target.AddBuff(mod.BuffType("Plague"), 360); - } - else if (alchFlask) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("Plague"), 120, false); - } - } - if (proj.melee) - { - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } - if (armorCrumbling || armorShattering) - { - if (proj.melee || proj.Calamity().rogue) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); - } - } - } - if (perforatorLore) - { - target.AddBuff(BuffID.Ichor, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(mod.BuffType("HolyLight"), 600, false); - } - else if (providenceLore) - { - target.AddBuff(mod.BuffType("HolyLight"), 420, false); - } - if (proj.Calamity().rogue) - { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - } - } - } - } - #endregion + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + else if (alchFlask) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("Plague"), 120, false); + } + } + if (proj.melee) + { + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } + if (armorCrumbling || armorShattering) + { + if (proj.melee || proj.Calamity().rogue) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); + } + } + } + if (perforatorLore) + { + target.AddBuff(BuffID.Ichor, 90); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + else if (providenceLore) + { + target.AddBuff(mod.BuffType("HolyLight"), 420, false); + } + if (proj.Calamity().rogue) + { + if (player.meleeEnchant > 0) + { + if (player.meleeEnchant == 1) + { + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 2) + { + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 3) + { + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 5) + { + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + } + if (player.meleeEnchant == 6) + { + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + } + if (player.meleeEnchant == 8) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 4) + { + target.AddBuff(BuffID.Midas, 120, false); + } + } + } + } + #endregion - #region Modify Hit NPC - public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) - { - #region MultiplierBoosts - double damageMult = 1.0; - if (silvaMelee && Main.rand.NextBool(4) && item.melee) - { - damageMult += 4.0; - } - if (enraged && !Config.BossRushXerocCurse) - { - damageMult += 1.25; - } - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - bool DHorHoD = (draedonsHeart || heartOfDarkness); - if (rageMode && adrenalineMode) - { - if (item.melee) - { - damageMult += (CalamityWorld.death ? (DHorHoD ? 7.6 : 6.8) : (DHorHoD ? 2.3 : 2.0)); // Death Mode values: 8.9 and 8.0, rev: 2.3 and 2.0 - } - } - else if (rageMode) - { - if (item.melee) - { - double rageDamageBoost = 0.0 + - (rageBoostOne ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 - (rageBoostTwo ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 - (rageBoostThree ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0); // Death Mode values: 0.6, rev: 0.15 - double rageDamage = (CalamityWorld.death ? (DHorHoD ? 2.0 : 1.7) : (DHorHoD ? 0.65 : 0.5)) + rageDamageBoost; // Death Mode values: 2.3 and 2.0, rev: 0.65 and 0.5 - damageMult += rageDamage; - } - } - else if (adrenalineMode) - { - if (item.melee) - { - double damageMultAdr = (CalamityWorld.death ? 5.0 : 1.5) * (double)adrenalineDmgMult; // Death Mode values: 6, rev: 1.5 - damageMult += damageMultAdr; - } - } - } - damage = (int)((double)damage * damageMult); + #region Modify Hit NPC + public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) + { + #region MultiplierBoosts + double damageMult = 1.0; + if (silvaMelee && Main.rand.NextBool(4) && item.melee) + { + damageMult += 4.0; + } + if (enraged && !Config.BossRushXerocCurse) + { + damageMult += 1.25; + } + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + bool DHorHoD = (draedonsHeart || heartOfDarkness); + if (rageMode && adrenalineMode) + { + if (item.melee) + { + damageMult += (CalamityWorld.death ? (DHorHoD ? 7.6 : 6.8) : (DHorHoD ? 2.3 : 2.0)); // Death Mode values: 8.9 and 8.0, rev: 2.3 and 2.0 + } + } + else if (rageMode) + { + if (item.melee) + { + double rageDamageBoost = 0.0 + + (rageBoostOne ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 + (rageBoostTwo ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 + (rageBoostThree ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0); // Death Mode values: 0.6, rev: 0.15 + double rageDamage = (CalamityWorld.death ? (DHorHoD ? 2.0 : 1.7) : (DHorHoD ? 0.65 : 0.5)) + rageDamageBoost; // Death Mode values: 2.3 and 2.0, rev: 0.65 and 0.5 + damageMult += rageDamage; + } + } + else if (adrenalineMode) + { + if (item.melee) + { + double damageMultAdr = (CalamityWorld.death ? 5.0 : 1.5) * (double)adrenalineDmgMult; // Death Mode values: 6, rev: 1.5 + damageMult += damageMultAdr; + } + } + } + damage = (int)((double)damage * damageMult); if (oldDie) { @@ -5974,261 +5990,261 @@ namespace CalamityMod.CalPlayer #endregion if (yharonLore) - damage = (int)((double)damage * 0.75); + damage = (int)((double)damage * 0.75); - if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) - { - if (item.melee && !item.noMelee && !item.noUseGraphic) - { - if (ataxiaGeyser) - { - if (player.ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)damage * 0.15), 2f, player.whoAmI, 0f, 0f); - } - } - if (unstablePrism && crit) - { - for (int num252 = 0; num252 < 3; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(30, 61) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("UnstableSpark"), (int)((double)damage * 0.15), 0f, player.whoAmI, 0f, 0f); - } - } - } - if (astralStarRain && crit && astralStarRainCooldown <= 0) - { - astralStarRainCooldown = 60; - for (int n = 0; n < 3; n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - float num15 = 25f; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("AstralStar"); - } - else if (projectileType == 1) - { - projectileType = 92; - } - else - { - projectileType = 12; - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].ranged = false; - } - } - if (bloodflareMelee && item.melee) - { - if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) - { - bloodflareMeleeHits++; - } - if (player.whoAmI == Main.myPlayer) - { - int healAmount = (Main.rand.Next(3) + 1); - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - if (Config.ProficiencyEnabled) - { - if (gainLevelCooldown <= 0) - { - gainLevelCooldown = 120; - if (item.melee && meleeLevel <= 12500) - { - if (!Main.hardMode && meleeLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && meleeLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - meleeLevel++; - shootFireworksLevelUpMelee = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 0); - } - } - } - } - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - if (item.melee) - { - int stressGain = (int)((double)damage * 0.1); - int stressMaxGain = 10; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - } + if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) + { + if (item.melee && !item.noMelee && !item.noUseGraphic) + { + if (ataxiaGeyser) + { + if (player.ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)damage * 0.15), 2f, player.whoAmI, 0f, 0f); + } + } + if (unstablePrism && crit) + { + for (int num252 = 0; num252 < 3; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(30, 61) * 0.1f; + Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("UnstableSpark"), (int)((double)damage * 0.15), 0f, player.whoAmI, 0f, 0f); + } + } + } + if (astralStarRain && crit && astralStarRainCooldown <= 0) + { + astralStarRainCooldown = 60; + for (int n = 0; n < 3; n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + float num15 = 25f; + int projectileType = Main.rand.Next(3); + if (projectileType == 0) + { + projectileType = mod.ProjectileType("AstralStar"); + } + else if (projectileType == 1) + { + projectileType = 92; + } + else + { + projectileType = 12; + } + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num17].ranged = false; + } + } + if (bloodflareMelee && item.melee) + { + if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) + { + bloodflareMeleeHits++; + } + if (player.whoAmI == Main.myPlayer) + { + int healAmount = (Main.rand.Next(3) + 1); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + if (Config.ProficiencyEnabled) + { + if (gainLevelCooldown <= 0) + { + gainLevelCooldown = 120; + if (item.melee && meleeLevel <= 12500) + { + if (!Main.hardMode && meleeLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && meleeLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + meleeLevel++; + if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 + meleeLevel++; + shootFireworksLevelUpMelee = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + LevelPacket(false, 0); + } + } + } + } + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + if (item.melee) + { + int stressGain = (int)((double)damage * 0.1); + int stressMaxGain = 10; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + } - public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - bool isTrueMelee = proj.Calamity().trueMelee; - bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); - bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; + public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + bool isTrueMelee = proj.Calamity().trueMelee; + bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); + bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; - if (proj.Calamity().rogue) - { - crit = (Main.rand.Next(1, 101) < player.Calamity().throwingCrit); - } + if (proj.Calamity().rogue) + { + crit = (Main.rand.Next(1, 101) < player.Calamity().throwingCrit); + } - #region MultiplierBoosts - double damageMult = 1.0; - if (isSummon) - { - if (player.inventory[player.selectedItem].type > 0) - { - if ((player.inventory[player.selectedItem].summon && - !player.inventory[player.selectedItem].melee && - !player.inventory[player.selectedItem].ranged && - !player.inventory[player.selectedItem].magic && - !player.inventory[player.selectedItem].Calamity().rogue) || - player.inventory[player.selectedItem].hammer > 0 || - player.inventory[player.selectedItem].pick > 0 || - player.inventory[player.selectedItem].axe > 0) - { - damageMult += 0.1; - } - } - } - if (screwdriver) - { - if (proj.penetrate > 1 || proj.penetrate == -1) - damageMult += 0.1; - } - if (sPower) - { - if (isSummon) - damageMult += 0.1; - } - if (providenceLore && hasClassType) - { - damageMult += 0.05; - } - if (silvaMelee && Main.rand.NextBool(4) && isTrueMelee) - { - damageMult += 4.0; - } - if (enraged && !Config.BossRushXerocCurse) - { - damageMult += 1.25; - } - if (auricSet) - { - if (silvaThrowing && proj.Calamity().rogue && - crit && player.statLife > (int)((double)player.statLifeMax2 * 0.5)) - { - damageMult += 0.25; - } - if (silvaMelee && proj.melee) - { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; - damageMult += multiplier * 0.2; - } - } - if (godSlayerRanged && crit && proj.ranged) - { - int randomChance = 100 - player.rangedCrit; //100 min to 15 max with cap + #region MultiplierBoosts + double damageMult = 1.0; + if (isSummon) + { + if (player.inventory[player.selectedItem].type > 0) + { + if ((player.inventory[player.selectedItem].summon && + !player.inventory[player.selectedItem].melee && + !player.inventory[player.selectedItem].ranged && + !player.inventory[player.selectedItem].magic && + !player.inventory[player.selectedItem].Calamity().rogue) || + player.inventory[player.selectedItem].hammer > 0 || + player.inventory[player.selectedItem].pick > 0 || + player.inventory[player.selectedItem].axe > 0) + { + damageMult += 0.1; + } + } + } + if (screwdriver) + { + if (proj.penetrate > 1 || proj.penetrate == -1) + damageMult += 0.1; + } + if (sPower) + { + if (isSummon) + damageMult += 0.1; + } + if (providenceLore && hasClassType) + { + damageMult += 0.05; + } + if (silvaMelee && Main.rand.NextBool(4) && isTrueMelee) + { + damageMult += 4.0; + } + if (enraged && !Config.BossRushXerocCurse) + { + damageMult += 1.25; + } + if (auricSet) + { + if (silvaThrowing && proj.Calamity().rogue && + crit && player.statLife > (int)((double)player.statLifeMax2 * 0.5)) + { + damageMult += 0.25; + } + if (silvaMelee && proj.melee) + { + double multiplier = (double)player.statLife / (double)player.statLifeMax2; + damageMult += multiplier * 0.2; + } + } + if (godSlayerRanged && crit && proj.ranged) + { + int randomChance = 100 - player.rangedCrit; //100 min to 15 max with cap - if (randomChance < 15) - randomChance = 15; - if (Main.rand.Next(randomChance) == 0) - damageMult += 1.0; - } - if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) - { - damageMult += 0.4; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.Calamity().rogue) - { - damageMult += 0.1; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) - { - damageMult += 0.1; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && isSummon) - { - damageMult += 0.1; - } - if (proj.type == mod.ProjectileType("FrostsparkBullet")) - { - if (target.buffImmune[mod.BuffType("GlacialState")]) - damageMult += 0.2; - } - else if (proj.type == ProjectileID.InfernoFriendlyBlast) - { - damageMult += 0.33; - } - if (CalamityWorld.revenge) - { - bool DHorHoD = (draedonsHeart || heartOfDarkness); - if (rageMode && adrenalineMode) - { - if (hasClassType) - { - damageMult += (CalamityWorld.death ? (DHorHoD ? 7.6 : 6.8) : (DHorHoD ? 2.3 : 2.0)); // Death Mode values: 8.9 and 8.0, rev: 2.3 and 2.0 - } - } - else if (rageMode) - { - if (hasClassType) - { - double rageDamageBoost = 0.0 + - (rageBoostOne ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 - (rageBoostTwo ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 - (rageBoostThree ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0); // Death Mode values: 0.6, rev: 0.15 - double rageDamage = (CalamityWorld.death ? (DHorHoD ? 2.0 : 1.7) : (DHorHoD ? 0.65 : 0.5)) + rageDamageBoost; // Death Mode values: 2.3 and 2.0, rev: 0.65 and 0.5 - damageMult += rageDamage; - } - } - else if (adrenalineMode) - { - if (hasClassType) - { - double damageMultAdr = (CalamityWorld.death ? 5.0 : 1.5) * (double)adrenalineDmgMult; // Death Mode values: 6, rev: 1.5 - damageMult += damageMultAdr; - } - } - } - damage = (int)((double)damage * damageMult); + if (randomChance < 15) + randomChance = 15; + if (Main.rand.Next(randomChance) == 0) + damageMult += 1.0; + } + if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) + { + damageMult += 0.4; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.Calamity().rogue) + { + damageMult += 0.1; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) + { + damageMult += 0.1; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && isSummon) + { + damageMult += 0.1; + } + if (proj.type == mod.ProjectileType("FrostsparkBullet")) + { + if (target.buffImmune[mod.BuffType("GlacialState")]) + damageMult += 0.2; + } + else if (proj.type == ProjectileID.InfernoFriendlyBlast) + { + damageMult += 0.33; + } + if (CalamityWorld.revenge) + { + bool DHorHoD = (draedonsHeart || heartOfDarkness); + if (rageMode && adrenalineMode) + { + if (hasClassType) + { + damageMult += (CalamityWorld.death ? (DHorHoD ? 7.6 : 6.8) : (DHorHoD ? 2.3 : 2.0)); // Death Mode values: 8.9 and 8.0, rev: 2.3 and 2.0 + } + } + else if (rageMode) + { + if (hasClassType) + { + double rageDamageBoost = 0.0 + + (rageBoostOne ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 + (rageBoostTwo ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0) + // Death Mode values: 0.6, rev: 0.15 + (rageBoostThree ? (CalamityWorld.death ? 0.5 : 0.15) : 0.0); // Death Mode values: 0.6, rev: 0.15 + double rageDamage = (CalamityWorld.death ? (DHorHoD ? 2.0 : 1.7) : (DHorHoD ? 0.65 : 0.5)) + rageDamageBoost; // Death Mode values: 2.3 and 2.0, rev: 0.65 and 0.5 + damageMult += rageDamage; + } + } + else if (adrenalineMode) + { + if (hasClassType) + { + double damageMultAdr = (CalamityWorld.death ? 5.0 : 1.5) * (double)adrenalineDmgMult; // Death Mode values: 6, rev: 1.5 + damageMult += damageMultAdr; + } + } + } + damage = (int)((double)damage * damageMult); if (oldDie) { @@ -6244,654 +6260,654 @@ namespace CalamityMod.CalPlayer #region AdditiveBoosts if (theBee && !isSummon) - { - if (hasClassType) - damage += theBeeDamage; - } - if (proj.type == mod.ProjectileType("AcidBullet")) - { - int defenseAdd = (int)((double)target.defense * 0.1 * ((double)damage / 50.0)); //100 defense * 0.1 = 10 - damage += defenseAdd; - } - if (uberBees && (proj.type == ProjectileID.GiantBee || proj.type == ProjectileID.Bee || proj.type == ProjectileID.Wasp || proj.type == mod.ProjectileType("PlagueBee"))) - { - damage += Main.rand.Next(20, 31); - } - #endregion + { + if (hasClassType) + damage += theBeeDamage; + } + if (proj.type == mod.ProjectileType("AcidBullet")) + { + int defenseAdd = (int)((double)target.defense * 0.1 * ((double)damage / 50.0)); //100 defense * 0.1 = 10 + damage += defenseAdd; + } + if (uberBees && (proj.type == ProjectileID.GiantBee || proj.type == ProjectileID.Bee || proj.type == ProjectileID.Wasp || proj.type == mod.ProjectileType("PlagueBee"))) + { + damage += Main.rand.Next(20, 31); + } + #endregion - #region MultiplicativeReductions - if (isSummon) - { - if (player.inventory[player.selectedItem].type > 0) - { - if (!player.inventory[player.selectedItem].summon && - (player.inventory[player.selectedItem].melee || - player.inventory[player.selectedItem].ranged || - player.inventory[player.selectedItem].magic || - player.inventory[player.selectedItem].Calamity().rogue) && - player.inventory[player.selectedItem].hammer == 0 && - player.inventory[player.selectedItem].pick == 0 && - player.inventory[player.selectedItem].axe == 0) - { - damage = (int)((double)damage * 0.75); - } - } - } - if (proj.ranged) - { - switch (proj.type) - { - case ProjectileID.CrystalShard: - damage = (int)((double)damage * 0.6); - break; - case ProjectileID.ChlorophyteBullet: - damage = (int)((double)damage * 0.8); - break; - case ProjectileID.HallowStar: - damage = (int)((double)damage * 0.7); - break; - } - if (proj.type == mod.ProjectileType("VeriumBullet")) - damage = (int)((double)damage * 0.8); - } - if (proj.type == ProjectileID.SpectreWrath && player.ghostHurt) - damage = (int)((double)damage * 0.7); - if (yharonLore) - damage = (int)((double)damage * 0.75); - #endregion + #region MultiplicativeReductions + if (isSummon) + { + if (player.inventory[player.selectedItem].type > 0) + { + if (!player.inventory[player.selectedItem].summon && + (player.inventory[player.selectedItem].melee || + player.inventory[player.selectedItem].ranged || + player.inventory[player.selectedItem].magic || + player.inventory[player.selectedItem].Calamity().rogue) && + player.inventory[player.selectedItem].hammer == 0 && + player.inventory[player.selectedItem].pick == 0 && + player.inventory[player.selectedItem].axe == 0) + { + damage = (int)((double)damage * 0.75); + } + } + } + if (proj.ranged) + { + switch (proj.type) + { + case ProjectileID.CrystalShard: + damage = (int)((double)damage * 0.6); + break; + case ProjectileID.ChlorophyteBullet: + damage = (int)((double)damage * 0.8); + break; + case ProjectileID.HallowStar: + damage = (int)((double)damage * 0.7); + break; + } + if (proj.type == mod.ProjectileType("VeriumBullet")) + damage = (int)((double)damage * 0.8); + } + if (proj.type == ProjectileID.SpectreWrath && player.ghostHurt) + damage = (int)((double)damage * 0.7); + if (yharonLore) + damage = (int)((double)damage * 0.75); + #endregion - if (tarraMage && crit && proj.magic) - { - tarraCrits++; - } - if (tarraThrowing && tarraThrowingCritTimer <= 0 && tarraThrowingCrits < 25 && crit && - proj.Calamity().rogue) - { - tarraThrowingCrits++; - } + if (tarraMage && crit && proj.magic) + { + tarraCrits++; + } + if (tarraThrowing && tarraThrowingCritTimer <= 0 && tarraThrowingCrits < 25 && crit && + proj.Calamity().rogue) + { + tarraThrowingCrits++; + } - if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) - { - if (theBeeDamage > 0 && (proj.melee || proj.ranged || proj.magic || proj.Calamity().rogue)) - { - Main.PlaySound(2, (int)proj.position.X, (int)proj.position.Y, 110); - } - if (unstablePrism && crit) - { - for (int num252 = 0; num252 < 3; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(30, 61) * 0.1f; - Projectile.NewProjectile(proj.oldPosition.X + (float)(proj.width / 2), proj.oldPosition.Y + (float)(proj.height / 2), value15.X, value15.Y, mod.ProjectileType("UnstableSpark"), (int)((double)damage * 0.15), 0f, player.whoAmI, 0f, 0f); - } - } - if (astralStarRain && crit && astralStarRainCooldown <= 0) - { - astralStarRainCooldown = 60; - for (int n = 0; n < 3; n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - float num15 = 25f; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("AstralStar"); - } - else if (projectileType == 1) - { - projectileType = 92; - } - else - { - projectileType = 12; - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].ranged = false; - } - } - if (tarraRanged && crit && proj.ranged) - { - int num251 = Main.rand.Next(2, 4); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int FUCKYOU = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), - value15.X, value15.Y, 206, (int)((double)damage * 0.25), 0f, player.whoAmI, 0f, 0f); - Main.projectile[FUCKYOU].magic = false; - Main.projectile[FUCKYOU].netUpdate = true; - } - } - if (bloodflareThrowing && proj.Calamity().rogue && crit && Main.rand.NextBool(2)) - { - if (target.canGhostHeal) - { - float num11 = 0.03f; - num11 -= (float)proj.numHits * 0.015f; - if (num11 < 0f) - { - num11 = 0f; - } - float num12 = (float)proj.damage * num11; - if (num12 < 0f) - { - num12 = 0f; - } - if (player.lifeSteal > 0f) - { - player.statLife += 1; - player.HealEffect(1); - player.lifeSteal -= num12 * 2f; - } - } - } - if (bloodflareMage && bloodflareMageCooldown <= 0 && crit && proj.magic) - { - bloodflareMageCooldown = 120; - for (int i = 0; i < 3; i++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int fire = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), - value15.X, value15.Y, 15, (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); - Main.projectile[fire].magic = false; - Main.projectile[fire].netUpdate = true; - } - } - if (bloodflareMelee && isTrueMelee) - { - if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) - { - bloodflareMeleeHits++; - } - if (player.whoAmI == Main.myPlayer) - { - int healAmount = (Main.rand.Next(3) + 1); - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - if (Config.ProficiencyEnabled) - { - if (gainLevelCooldown <= 0) //max is 12501 to avoid setting off fireworks forever - { - gainLevelCooldown = 120; //2 seconds - if (proj.melee && meleeLevel <= 12500) - { - if (!Main.hardMode && meleeLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && meleeLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - meleeLevel++; - shootFireworksLevelUpMelee = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 0); - } - } - else if (proj.ranged && rangedLevel <= 12500) - { - if (!Main.hardMode && rangedLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && rangedLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - rangedLevel++; - if (fasterRangedLevel && rangedLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - rangedLevel++; - shootFireworksLevelUpRanged = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 1); - } - } - else if (proj.magic && magicLevel <= 12500) - { - if (!Main.hardMode && magicLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && magicLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - magicLevel++; - if (fasterMagicLevel && magicLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - magicLevel++; - shootFireworksLevelUpMagic = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 2); - } - } - else if (isSummon && summonLevel <= 12500) - { - if (!Main.hardMode && summonLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && summonLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - summonLevel++; - if (fasterSummonLevel && summonLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - summonLevel++; - shootFireworksLevelUpSummon = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 3); - } - } - else if (proj.Calamity().rogue && rogueLevel <= 12500) - { - if (!Main.hardMode && rogueLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && rogueLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - rogueLevel++; - if (fasterRogueLevel && rogueLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - rogueLevel++; - shootFireworksLevelUpRogue = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 4); - } - } - } - } - if (raiderTalisman && raiderStack < 250 && proj.Calamity().rogue && crit) - { - raiderStack++; - } - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - if (isTrueMelee) - { - int stressGain = (int)((double)damage * 0.1); - int stressMaxGain = 10; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - } - #endregion + if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) + { + if (theBeeDamage > 0 && (proj.melee || proj.ranged || proj.magic || proj.Calamity().rogue)) + { + Main.PlaySound(2, (int)proj.position.X, (int)proj.position.Y, 110); + } + if (unstablePrism && crit) + { + for (int num252 = 0; num252 < 3; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(30, 61) * 0.1f; + Projectile.NewProjectile(proj.oldPosition.X + (float)(proj.width / 2), proj.oldPosition.Y + (float)(proj.height / 2), value15.X, value15.Y, mod.ProjectileType("UnstableSpark"), (int)((double)damage * 0.15), 0f, player.whoAmI, 0f, 0f); + } + } + if (astralStarRain && crit && astralStarRainCooldown <= 0) + { + astralStarRainCooldown = 60; + for (int n = 0; n < 3; n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + float num15 = 25f; + int projectileType = Main.rand.Next(3); + if (projectileType == 0) + { + projectileType = mod.ProjectileType("AstralStar"); + } + else if (projectileType == 1) + { + projectileType = 92; + } + else + { + projectileType = 12; + } + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num17].ranged = false; + } + } + if (tarraRanged && crit && proj.ranged) + { + int num251 = Main.rand.Next(2, 4); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int FUCKYOU = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), + value15.X, value15.Y, 206, (int)((double)damage * 0.25), 0f, player.whoAmI, 0f, 0f); + Main.projectile[FUCKYOU].magic = false; + Main.projectile[FUCKYOU].netUpdate = true; + } + } + if (bloodflareThrowing && proj.Calamity().rogue && crit && Main.rand.NextBool(2)) + { + if (target.canGhostHeal) + { + float num11 = 0.03f; + num11 -= (float)proj.numHits * 0.015f; + if (num11 < 0f) + { + num11 = 0f; + } + float num12 = (float)proj.damage * num11; + if (num12 < 0f) + { + num12 = 0f; + } + if (player.lifeSteal > 0f) + { + player.statLife += 1; + player.HealEffect(1); + player.lifeSteal -= num12 * 2f; + } + } + } + if (bloodflareMage && bloodflareMageCooldown <= 0 && crit && proj.magic) + { + bloodflareMageCooldown = 120; + for (int i = 0; i < 3; i++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int fire = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), + value15.X, value15.Y, 15, (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); + Main.projectile[fire].magic = false; + Main.projectile[fire].netUpdate = true; + } + } + if (bloodflareMelee && isTrueMelee) + { + if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) + { + bloodflareMeleeHits++; + } + if (player.whoAmI == Main.myPlayer) + { + int healAmount = (Main.rand.Next(3) + 1); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + if (Config.ProficiencyEnabled) + { + if (gainLevelCooldown <= 0) //max is 12501 to avoid setting off fireworks forever + { + gainLevelCooldown = 120; //2 seconds + if (proj.melee && meleeLevel <= 12500) + { + if (!Main.hardMode && meleeLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && meleeLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + meleeLevel++; + if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 + meleeLevel++; + shootFireworksLevelUpMelee = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + LevelPacket(false, 0); + } + } + else if (proj.ranged && rangedLevel <= 12500) + { + if (!Main.hardMode && rangedLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && rangedLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + rangedLevel++; + if (fasterRangedLevel && rangedLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 + rangedLevel++; + shootFireworksLevelUpRanged = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + LevelPacket(false, 1); + } + } + else if (proj.magic && magicLevel <= 12500) + { + if (!Main.hardMode && magicLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && magicLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + magicLevel++; + if (fasterMagicLevel && magicLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 + magicLevel++; + shootFireworksLevelUpMagic = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + LevelPacket(false, 2); + } + } + else if (isSummon && summonLevel <= 12500) + { + if (!Main.hardMode && summonLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && summonLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + summonLevel++; + if (fasterSummonLevel && summonLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 + summonLevel++; + shootFireworksLevelUpSummon = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + LevelPacket(false, 3); + } + } + else if (proj.Calamity().rogue && rogueLevel <= 12500) + { + if (!Main.hardMode && rogueLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && rogueLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + rogueLevel++; + if (fasterRogueLevel && rogueLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 + rogueLevel++; + shootFireworksLevelUpRogue = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + LevelPacket(false, 4); + } + } + } + } + if (raiderTalisman && raiderStack < 250 && proj.Calamity().rogue && crit) + { + raiderStack++; + } + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + if (isTrueMelee) + { + int stressGain = (int)((double)damage * 0.1); + int stressMaxGain = 10; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + } + #endregion - #region Modify Hit By NPC - public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) - { - int bossRushDamage = (Main.expertMode ? 500 : 300) + (CalamityWorld.bossRushStage * 2); - if (CalamityWorld.bossRushActive) - { - if (damage < bossRushDamage) - damage = bossRushDamage; - } - if (triumph) - { - double HPMultiplier = 0.15 * (1.0 - ((double)npc.life / (double)npc.lifeMax)); - int damageReduction = (int)((double)damage * HPMultiplier); - damage -= damageReduction; - } - if (aSparkRare) - { - if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || - npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper || - npc.type == NPCID.MartianTurret || npc.type == mod.NPCType("StormlionCharger")) - damage /= 2; - } - if (fleshTotem && fleshTotemCooldown <= 0) - { - fleshTotemCooldown = 1200; //20 seconds - damage /= 2; - } - if (tarraDefense && tarraMelee) - { - damage /= 2; - } - if (bloodflareMelee && bloodflareFrenzyTimer > 0) - { - damage /= 2; - } - if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) - { - damage = (int)((double)damage * 0.8); - } - if (aBulwarkRare) - { - aBulwarkRareMeleeBoostTimer += 3 * damage; - if (aBulwarkRareMeleeBoostTimer > 900) - aBulwarkRareMeleeBoostTimer = 900; - } - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) - { - if (CalamityWorld.revenge && Config.AdrenalineAndRage && !npc.SpawnedFromStatue) - { - gainRageCooldown = 60; - int stressGain = damage * (profanedRage ? 3 : 2); - int stressMaxGain = 2500; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - #endregion + #region Modify Hit By NPC + public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) + { + int bossRushDamage = (Main.expertMode ? 500 : 300) + (CalamityWorld.bossRushStage * 2); + if (CalamityWorld.bossRushActive) + { + if (damage < bossRushDamage) + damage = bossRushDamage; + } + if (triumph) + { + double HPMultiplier = 0.15 * (1.0 - ((double)npc.life / (double)npc.lifeMax)); + int damageReduction = (int)((double)damage * HPMultiplier); + damage -= damageReduction; + } + if (aSparkRare) + { + if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || + npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper || + npc.type == NPCID.MartianTurret || npc.type == mod.NPCType("StormlionCharger")) + damage /= 2; + } + if (fleshTotem && fleshTotemCooldown <= 0) + { + fleshTotemCooldown = 1200; //20 seconds + damage /= 2; + } + if (tarraDefense && tarraMelee) + { + damage /= 2; + } + if (bloodflareMelee && bloodflareFrenzyTimer > 0) + { + damage /= 2; + } + if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) + { + damage = (int)((double)damage * 0.8); + } + if (aBulwarkRare) + { + aBulwarkRareMeleeBoostTimer += 3 * damage; + if (aBulwarkRareMeleeBoostTimer > 900) + aBulwarkRareMeleeBoostTimer = 900; + } + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + { + if (CalamityWorld.revenge && Config.AdrenalineAndRage && !npc.SpawnedFromStatue) + { + gainRageCooldown = 60; + int stressGain = damage * (profanedRage ? 3 : 2); + int stressMaxGain = 2500; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + #endregion - #region Modify Hit By Proj - public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) - { - int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2); - if (CalamityWorld.bossRushActive) - { - if (damage < bossRushDamage) - damage = bossRushDamage; - } - if (projRefRare) - { - if (proj.type == projTypeJustHitBy) - damage = (int)((double)damage * 0.85); - } - if (aSparkRare) - { - if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || - proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) - damage /= 2; - } - if (proj.type == ProjectileID.Nail) - { - damage = (int)((double)damage * 0.75); - } - if (beeResist) - { - if (CalamityMod.beeProjectileList.Contains(proj.type)) - damage = (int)((double)damage * 0.75); - } - if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) - { - if (CalamityMod.hardModeNerfList.Contains(proj.type)) - damage = (int)((double)damage * 0.75); - } - if (CalamityWorld.revenge) - { - if (CalamityMod.revengeanceProjectileBuffList.Contains(proj.type)) - damage = (int)((double)damage * 1.25); - } - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) - { - if (CalamityWorld.revenge && Config.AdrenalineAndRage && !CalamityMod.trapProjectileList.Contains(proj.type)) - { - gainRageCooldown = 60; - int stressGain = damage * (profanedRage ? 3 : 2); - int stressMaxGain = 2500; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - #endregion + #region Modify Hit By Proj + public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) + { + int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2); + if (CalamityWorld.bossRushActive) + { + if (damage < bossRushDamage) + damage = bossRushDamage; + } + if (projRefRare) + { + if (proj.type == projTypeJustHitBy) + damage = (int)((double)damage * 0.85); + } + if (aSparkRare) + { + if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || + proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) + damage /= 2; + } + if (proj.type == ProjectileID.Nail) + { + damage = (int)((double)damage * 0.75); + } + if (beeResist) + { + if (CalamityMod.beeProjectileList.Contains(proj.type)) + damage = (int)((double)damage * 0.75); + } + if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) + { + if (CalamityMod.hardModeNerfList.Contains(proj.type)) + damage = (int)((double)damage * 0.75); + } + if (CalamityWorld.revenge) + { + if (CalamityMod.revengeanceProjectileBuffList.Contains(proj.type)) + damage = (int)((double)damage * 1.25); + } + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + { + if (CalamityWorld.revenge && Config.AdrenalineAndRage && !CalamityMod.trapProjectileList.Contains(proj.type)) + { + gainRageCooldown = 60; + int stressGain = damage * (profanedRage ? 3 : 2); + int stressMaxGain = 2500; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + #endregion - #region On Hit - public override void OnHitByNPC(NPC npc, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - if (npc.type == NPCID.ShadowFlameApparition || (npc.type == NPCID.ChaosBall && Main.hardMode)) - { - player.AddBuff(mod.BuffType("Shadowflame"), 180); - } - else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeSaw) - { - player.AddBuff(BuffID.Bleeding, 300); - } - else if (npc.type == NPCID.Spazmatism && npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - { - player.AddBuff(BuffID.Bleeding, 300); - } - else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) - { - player.AddBuff(BuffID.Poisoned, 180); - player.AddBuff(BuffID.Bleeding, 300); - } - else if (npc.type == NPCID.PlanterasTentacle) - { - player.AddBuff(BuffID.Poisoned, 120); - player.AddBuff(BuffID.Bleeding, 180); - } - else if (npc.type == NPCID.Golem || npc.type == NPCID.GolemFistLeft || npc.type == NPCID.GolemFistRight || - npc.type == NPCID.GolemHead || npc.type == NPCID.GolemHeadFree) - { - player.AddBuff(BuffID.BrokenArmor, 180); - } - } - } + #region On Hit + public override void OnHitByNPC(NPC npc, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + if (npc.type == NPCID.ShadowFlameApparition || (npc.type == NPCID.ChaosBall && Main.hardMode)) + { + player.AddBuff(mod.BuffType("Shadowflame"), 180); + } + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeSaw) + { + player.AddBuff(BuffID.Bleeding, 300); + } + else if (npc.type == NPCID.Spazmatism && npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) + { + player.AddBuff(BuffID.Bleeding, 300); + } + else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) + { + player.AddBuff(BuffID.Poisoned, 180); + player.AddBuff(BuffID.Bleeding, 300); + } + else if (npc.type == NPCID.PlanterasTentacle) + { + player.AddBuff(BuffID.Poisoned, 120); + player.AddBuff(BuffID.Bleeding, 180); + } + else if (npc.type == NPCID.Golem || npc.type == NPCID.GolemFistLeft || npc.type == NPCID.GolemFistRight || + npc.type == NPCID.GolemHead || npc.type == NPCID.GolemHeadFree) + { + player.AddBuff(BuffID.BrokenArmor, 180); + } + } + } - public override void OnHitByProjectile(Projectile proj, int damage, bool crit) - { - if (CalamityWorld.revenge && proj.hostile) - { - if (proj.type == ProjectileID.FrostBeam && !player.frozen && !gState) - { - player.AddBuff(mod.BuffType("GlacialState"), 120); - } - else if (proj.type == ProjectileID.DeathLaser) - { - player.AddBuff(BuffID.OnFire, 240); - } - else if (proj.type == ProjectileID.Skull) - { - player.AddBuff(BuffID.Weak, 180); - } - else if (proj.type == ProjectileID.ThornBall) - { - player.AddBuff(BuffID.Poisoned, 240); - } - else if (proj.type == ProjectileID.CultistBossIceMist) - { - player.AddBuff(BuffID.Frozen, 60); - player.AddBuff(BuffID.Chilled, 120); - player.AddBuff(BuffID.Frostburn, 240); - } - else if (proj.type == ProjectileID.CultistBossLightningOrbArc) - { - player.AddBuff(BuffID.Electrified, 120); - } - } - if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20)) - { - player.statLife += damage; - player.HealEffect(damage); - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X; - proj.velocity.Y = -proj.velocity.Y; - } - if (projRefRare && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(2)) - { - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X * 2f; - proj.velocity.Y = -proj.velocity.Y * 2f; - proj.damage *= 10; - projRefRareLifeRegenCounter = 120; - projTypeJustHitBy = proj.type; - } - if (aSparkRare && proj.active && !proj.friendly && proj.hostile && damage > 0) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) - { - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X; - proj.velocity.Y = -proj.velocity.Y; - proj.damage *= 8; - } - } - if (daedalusReflect && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(3)) - { - int healAmt = damage / 5; - player.statLife += healAmt; - player.HealEffect(healAmt); - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X; - proj.velocity.Y = -proj.velocity.Y; - } - } - #endregion + public override void OnHitByProjectile(Projectile proj, int damage, bool crit) + { + if (CalamityWorld.revenge && proj.hostile) + { + if (proj.type == ProjectileID.FrostBeam && !player.frozen && !gState) + { + player.AddBuff(mod.BuffType("GlacialState"), 120); + } + else if (proj.type == ProjectileID.DeathLaser) + { + player.AddBuff(BuffID.OnFire, 240); + } + else if (proj.type == ProjectileID.Skull) + { + player.AddBuff(BuffID.Weak, 180); + } + else if (proj.type == ProjectileID.ThornBall) + { + player.AddBuff(BuffID.Poisoned, 240); + } + else if (proj.type == ProjectileID.CultistBossIceMist) + { + player.AddBuff(BuffID.Frozen, 60); + player.AddBuff(BuffID.Chilled, 120); + player.AddBuff(BuffID.Frostburn, 240); + } + else if (proj.type == ProjectileID.CultistBossLightningOrbArc) + { + player.AddBuff(BuffID.Electrified, 120); + } + } + if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20)) + { + player.statLife += damage; + player.HealEffect(damage); + proj.hostile = false; + proj.friendly = true; + proj.velocity.X = -proj.velocity.X; + proj.velocity.Y = -proj.velocity.Y; + } + if (projRefRare && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(2)) + { + proj.hostile = false; + proj.friendly = true; + proj.velocity.X = -proj.velocity.X * 2f; + proj.velocity.Y = -proj.velocity.Y * 2f; + proj.damage *= 10; + projRefRareLifeRegenCounter = 120; + projTypeJustHitBy = proj.type; + } + if (aSparkRare && proj.active && !proj.friendly && proj.hostile && damage > 0) + { + if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) + { + proj.hostile = false; + proj.friendly = true; + proj.velocity.X = -proj.velocity.X; + proj.velocity.Y = -proj.velocity.Y; + proj.damage *= 8; + } + } + if (daedalusReflect && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(3)) + { + int healAmt = damage / 5; + player.statLife += healAmt; + player.HealEffect(healAmt); + proj.hostile = false; + proj.friendly = true; + proj.velocity.X = -proj.velocity.X; + proj.velocity.Y = -proj.velocity.Y; + } + } + #endregion - #region Fishing - public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) - { - if (ZoneAstral && liquidType == 0) //Astral Infection, fishing in water - { - if (caughtType == ItemID.WoodenCrate) - { - caughtType = ItemID.WoodenCrate; - } - else if (caughtType == ItemID.IronCrate) - { - caughtType = ItemID.IronCrate; - } - else if (caughtType == ItemID.GoldenCrate) - { - caughtType = ItemID.GoldenCrate; - } - else if (caughtType == ItemID.FrogLeg) - { - caughtType = ItemID.FrogLeg; - } - else if (caughtType == ItemID.BalloonPufferfish) - { - caughtType = ItemID.BalloonPufferfish; - } - else if (caughtType == ItemID.ZephyrFish) - { - caughtType = ItemID.ZephyrFish; - } - else if (Main.rand.NextBool(10)) - { - caughtType = mod.ItemType("ProcyonidPrawn"); - } - else if (Main.rand.NextBool(15)) - { - caughtType = mod.ItemType("ArcturusAstroidean"); - } - else if (player.cratePotion && Main.rand.NextBool(5)) - { - caughtType = mod.ItemType("AstralCrate"); - } - else if (Main.rand.NextBool(10)) - { - caughtType = mod.ItemType("AstralCrate"); - } - else if (Main.rand.NextBool(25)) - { - caughtType = mod.ItemType("UrsaSergeant"); - } - else if (Main.rand.NextBool(25)) - { - caughtType = mod.ItemType("GacruxianMollusk"); - } - else - { - caughtType = mod.ItemType("TwinklingPollox"); - } - } - Point point = player.Center.ToTileCoordinates(); - bool abyssPosX = false; - if (CalamityWorld.abyssSide) - { - if (point.X < 380) - { - abyssPosX = true; - } - } - else - { - if (point.X > Main.maxTilesX - 380) - { - abyssPosX = true; - } - } - if (junk) - { - if (abyssPosX && liquidType == 0 && power < 40) - { - caughtType = mod.ItemType("PlantyMush"); - } - return; - } - /*if (abyssPosX && liquidType == 0 && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) + #region Fishing + public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) + { + if (ZoneAstral && liquidType == 0) //Astral Infection, fishing in water + { + if (caughtType == ItemID.WoodenCrate) + { + caughtType = ItemID.WoodenCrate; + } + else if (caughtType == ItemID.IronCrate) + { + caughtType = ItemID.IronCrate; + } + else if (caughtType == ItemID.GoldenCrate) + { + caughtType = ItemID.GoldenCrate; + } + else if (caughtType == ItemID.FrogLeg) + { + caughtType = ItemID.FrogLeg; + } + else if (caughtType == ItemID.BalloonPufferfish) + { + caughtType = ItemID.BalloonPufferfish; + } + else if (caughtType == ItemID.ZephyrFish) + { + caughtType = ItemID.ZephyrFish; + } + else if (Main.rand.NextBool(10)) + { + caughtType = mod.ItemType("ProcyonidPrawn"); + } + else if (Main.rand.NextBool(15)) + { + caughtType = mod.ItemType("ArcturusAstroidean"); + } + else if (player.cratePotion && Main.rand.NextBool(5)) + { + caughtType = mod.ItemType("AstralCrate"); + } + else if (Main.rand.NextBool(10)) + { + caughtType = mod.ItemType("AstralCrate"); + } + else if (Main.rand.NextBool(25)) + { + caughtType = mod.ItemType("UrsaSergeant"); + } + else if (Main.rand.NextBool(25)) + { + caughtType = mod.ItemType("GacruxianMollusk"); + } + else + { + caughtType = mod.ItemType("TwinklingPollox"); + } + } + Point point = player.Center.ToTileCoordinates(); + bool abyssPosX = false; + if (CalamityWorld.abyssSide) + { + if (point.X < 380) + { + abyssPosX = true; + } + } + else + { + if (point.X > Main.maxTilesX - 380) + { + abyssPosX = true; + } + } + if (junk) + { + if (abyssPosX && liquidType == 0 && power < 40) + { + caughtType = mod.ItemType("PlantyMush"); + } + return; + } + /*if (abyssPosX && liquidType == 0 && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6910,620 +6926,629 @@ namespace CalamityMod.CalPlayer } return; }*/ - if (power >= 20) - { - if (power >= 40) - { - if (abyssPosX && liquidType == 0 && Main.rand.NextBool(15) && power < 80) - { - caughtType = mod.ItemType("PlantyMush"); - } - if (power >= 60) - { - if (player.FindBuffIndex(BuffID.Gills) > -1 && NPC.downedPlantBoss && liquidType == 0 && Main.rand.NextBool(25) && power < 160) - { - caughtType = mod.ItemType("Floodtide"); - } - if (abyssPosX && liquidType == 0 && Main.rand.NextBool(25) && power < 160) - { - caughtType = mod.ItemType("AlluringBait"); - } - if (power >= 80) - { - if (abyssPosX && Main.hardMode && liquidType == 0 && Main.rand.NextBool(15) && power < 210) - { - switch (Main.rand.Next(4)) - { - case 0: caughtType = mod.ItemType("IronBoots"); break; //movement acc - case 1: caughtType = mod.ItemType("DepthCharm"); break; //regen acc - case 2: caughtType = mod.ItemType("AnechoicPlating"); break; //defense acc - case 3: caughtType = mod.ItemType("StrangeOrb"); break; //light pet - } - } - if (power >= 110) - { - if (abyssPosX && liquidType == 0 && Main.rand.NextBool(25) && power < 240) - { - caughtType = mod.ItemType("AbyssalAmulet"); - } - } - } - } - } - } - } + if (power >= 20) + { + if (power >= 40) + { + if (abyssPosX && liquidType == 0 && Main.rand.NextBool(15) && power < 80) + { + caughtType = mod.ItemType("PlantyMush"); + } + if (power >= 60) + { + if (player.FindBuffIndex(BuffID.Gills) > -1 && NPC.downedPlantBoss && liquidType == 0 && Main.rand.NextBool(25) && power < 160) + { + caughtType = mod.ItemType("Floodtide"); + } + if (abyssPosX && liquidType == 0 && Main.rand.NextBool(25) && power < 160) + { + caughtType = mod.ItemType("AlluringBait"); + } + if (power >= 80) + { + if (abyssPosX && Main.hardMode && liquidType == 0 && Main.rand.NextBool(15) && power < 210) + { + switch (Main.rand.Next(4)) + { + case 0: + caughtType = mod.ItemType("IronBoots"); + break; //movement acc + case 1: + caughtType = mod.ItemType("DepthCharm"); + break; //regen acc + case 2: + caughtType = mod.ItemType("AnechoicPlating"); + break; //defense acc + case 3: + caughtType = mod.ItemType("StrangeOrb"); + break; //light pet + } + } + if (power >= 110) + { + if (abyssPosX && liquidType == 0 && Main.rand.NextBool(25) && power < 240) + { + caughtType = mod.ItemType("AbyssalAmulet"); + } + } + } + } + } + } + } - public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel) - { - if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == mod.ItemType("ArcturusAstroidean")) - fishingLevel = (int)(fishingLevel * 1.1f); - } - #endregion + public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel) + { + if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == mod.ItemType("ArcturusAstroidean")) + fishingLevel = (int)(fishingLevel * 1.1f); + } + #endregion - #region Frame Effects - public override void FrameEffects() - { - if ((snowmanPower || snowmanForce) && !snowmanHide) - { - player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); - player.head = (snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head)); - } - else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); - player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); - } - else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) - { - player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); - } - else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) - { - player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); - } + #region Frame Effects + public override void FrameEffects() + { + if ((snowmanPower || snowmanForce) && !snowmanHide) + { + player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); + player.head = (snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head)); + } + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); + player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); + } + else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) + { + player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); + } + else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) + { + player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); + } - if (CalamityWorld.defiled) - Defiled(); + if (CalamityWorld.defiled) + Defiled(); - if (weakPetrification) - WeakPetrification(); - } - #endregion + if (weakPetrification) + WeakPetrification(); + } + #endregion - #region Limitations - private void WeakPetrification() - { - player.doubleJumpCloud = false; - player.doubleJumpSandstorm = false; - player.doubleJumpBlizzard = false; - player.rocketBoots = 0; - player.jumpBoost = false; - player.slowFall = false; - player.gravControl = false; - player.gravControl2 = false; - player.jumpSpeedBoost = 0f; - player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); - player.balloon = -1; - weakPetrification = true; - } + #region Limitations + private void WeakPetrification() + { + player.doubleJumpCloud = false; + player.doubleJumpSandstorm = false; + player.doubleJumpBlizzard = false; + player.rocketBoots = 0; + player.jumpBoost = false; + player.slowFall = false; + player.gravControl = false; + player.gravControl2 = false; + player.jumpSpeedBoost = 0f; + player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); + player.balloon = -1; + weakPetrification = true; + } - private void Defiled() - { - player.wingTimeMax = 0; - } - #endregion + private void Defiled() + { + player.wingTimeMax = 0; + } + #endregion - #region Pre Hurt - public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) - { - if (CalamityWorld.armageddon || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) - { - if (areThereAnyDamnBosses || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) - { - if (SCalLore) - { - string key = "Mods.CalamityMod.SupremeBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - KillPlayer(); - } - } + #region Pre Hurt + public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) + { + if (CalamityWorld.armageddon || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) + { + if (areThereAnyDamnBosses || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) + { + if (SCalLore) + { + string key = "Mods.CalamityMod.SupremeBossText2"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + KillPlayer(); + } + } - if (lol || (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle"))) - { - return false; - } - if (godSlayerReflect && Main.rand.NextBool(50)) - { - return false; - } + if (lol || (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle"))) + { + return false; + } + if (godSlayerReflect && Main.rand.NextBool(50)) + { + return false; + } - if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - playSound = false; - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise - } - else if (((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) || ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide)) - { - playSound = false; - Main.PlaySound(20, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise - } + if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + playSound = false; + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise + } + else if (((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) || ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide)) + { + playSound = false; + Main.PlaySound(20, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise + } - #region MultiplierBoosts - double damageMult = 1.0 + - (dArtifact ? 0.25 : 0.0) + - ((player.beetleDefense && player.beetleOrbs > 0) ? (0.05 * (double)player.beetleOrbs) : 0.0) + - (enraged ? 0.25 : 0.0) + - ((CalamityWorld.defiled && Main.rand.NextBool(4)) ? 0.5 : 0.0) + - ((bloodPact && Main.rand.NextBool(4)) ? 1.5 : 0.0); + #region MultiplierBoosts + double damageMult = 1.0 + + (dArtifact ? 0.25 : 0.0) + + ((player.beetleDefense && player.beetleOrbs > 0) ? (0.05 * (double)player.beetleOrbs) : 0.0) + + (enraged ? 0.25 : 0.0) + + ((CalamityWorld.defiled && Main.rand.NextBool(4)) ? 0.5 : 0.0) + + ((bloodPact && Main.rand.NextBool(4)) ? 1.5 : 0.0); - if (CalamityWorld.revenge) - { - if (player.chaosState) - damageMult += 0.25; - if (CalamityWorld.death) - damageMult += 0.15; - if (player.ichor) - damageMult += 0.25; - else if (player.onFire2) - damageMult += 0.2; - } + if (CalamityWorld.revenge) + { + if (player.chaosState) + damageMult += 0.25; + if (CalamityWorld.death) + damageMult += 0.15; + if (player.ichor) + damageMult += 0.25; + else if (player.onFire2) + damageMult += 0.2; + } - damage = (int)((double)damage * damageMult); - #endregion + damage = (int)((double)damage * damageMult); + #endregion - if (CalamityWorld.revenge) - { - customDamage = true; - double defenseMult = Main.hardMode ? 0.75 : 0.5; - double newDamage = (double)damage - ((double)player.statDefense * defenseMult); - double newDamageLimit = 5.0 + (Main.hardMode ? 5.0 : 0.0) + (NPC.downedPlantBoss ? 5.0 : 0.0) + (NPC.downedMoonlord ? 5.0 : 0.0); //5, 10, 15, 20 - if (newDamage < newDamageLimit) - { - newDamage = newDamageLimit; - } - damage = (int)newDamage; - } + if (CalamityWorld.revenge) + { + customDamage = true; + double defenseMult = Main.hardMode ? 0.75 : 0.5; + double newDamage = (double)damage - ((double)player.statDefense * defenseMult); + double newDamageLimit = 5.0 + (Main.hardMode ? 5.0 : 0.0) + (NPC.downedPlantBoss ? 5.0 : 0.0) + (NPC.downedMoonlord ? 5.0 : 0.0); //5, 10, 15, 20 + if (newDamage < newDamageLimit) + { + newDamage = newDamageLimit; + } + damage = (int)newDamage; + } - #region MultiplicativeReductions - if (trinketOfChiBuff) - { - damage = (int)((double)damage * 0.85); - } - if (purpleCandle) - { - damage = (int)((double)damage - ((double)player.statDefense * 0.05)); - } - if (abyssalDivingSuitPlates) - { - damage = (int)((double)damage * 0.85); - } - if (sirenIce) - { - damage = (int)((double)damage * 0.85); - } - if (CalamityWorld.revenge) - { - if (!CalamityWorld.downedBossAny) - damage = (int)((double)damage * 0.8); - } - if (player.mount.Active && (player.mount.Type == mod.MountType("AngryDog") || player.mount.Type == mod.MountType("OnyxExcavator")) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) - { - damage = (int)((double)damage * 0.9); - } - #endregion + #region MultiplicativeReductions + if (trinketOfChiBuff) + { + damage = (int)((double)damage * 0.85); + } + if (purpleCandle) + { + damage = (int)((double)damage - ((double)player.statDefense * 0.05)); + } + if (abyssalDivingSuitPlates) + { + damage = (int)((double)damage * 0.85); + } + if (sirenIce) + { + damage = (int)((double)damage * 0.85); + } + if (CalamityWorld.revenge) + { + if (!CalamityWorld.downedBossAny) + damage = (int)((double)damage * 0.8); + } + if (player.mount.Active && (player.mount.Type == mod.MountType("AngryDog") || player.mount.Type == mod.MountType("OnyxExcavator")) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + { + damage = (int)((double)damage * 0.9); + } + #endregion - if ((godSlayerDamage && damage <= 80) || damage < 1) - { - damage = 1; - } + if ((godSlayerDamage && damage <= 80) || damage < 1) + { + damage = 1; + } - #region HealingEffects - if (revivifyTimer > 0) - { - int healAmt = damage / 20; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - if (daedalusAbsorb && Main.rand.NextBool(10)) - { - int healAmt = damage / 2; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - if (absorber) - { - int healAmt = damage / 20; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - #endregion + #region HealingEffects + if (revivifyTimer > 0) + { + int healAmt = damage / 20; + player.statLife += healAmt; + player.HealEffect(healAmt); + } + if (daedalusAbsorb && Main.rand.NextBool(10)) + { + int healAmt = damage / 2; + player.statLife += healAmt; + player.HealEffect(healAmt); + } + if (absorber) + { + int healAmt = damage / 20; + player.statLife += healAmt; + player.HealEffect(healAmt); + } + #endregion - return true; - } - #endregion + return true; + } + #endregion - #region Hurt - public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) - { - modStealth = 1f; - if (player.whoAmI == Main.myPlayer) - { - if (rageMode) - { - stress = 0; - if (player.FindBuffIndex(mod.BuffType("RageMode")) > -1) { player.ClearBuff(mod.BuffType("RageMode")); } - } - if (amidiasBlessing) - { - player.ClearBuff(mod.BuffType("AmidiasBlessing")); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 96); - } - if (!adrenalineMode && adrenaline != adrenalineMax) - { - adrenaline = 0; - } - if ((gShell || fabledTortoise) && !player.panic) - { - player.AddBuff(mod.BuffType("ShellBoost"), 300); - } - if (abyssalDivingSuitPlates && damage > 50) - { - abyssalDivingSuitPlateHits++; - if (abyssalDivingSuitPlateHits >= 3) - { - Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 14); - player.AddBuff(mod.BuffType("AbyssalDivingSuitPlatesBroken"), 10830); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } - if (sirenIce) - { - Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 7); - player.AddBuff(mod.BuffType("IceShieldBrokenBuff"), 1800); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - if (tarraMelee) - { - if (Main.rand.NextBool(4)) - { - player.AddBuff(mod.BuffType("TarraLifeRegen"), 120); - } - } - else if (xerocSet) - { - player.AddBuff(mod.BuffType("XerocRage"), 240); - player.AddBuff(mod.BuffType("XerocWrath"), 240); - } - else if (reaverBlast) - { - player.AddBuff(mod.BuffType("ReaverRage"), 180); - } - if (fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); - for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - float distance = (Main.npc[m].Center - player.Center).Length(); - float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); - if (num10 > 500f) - { - num10 = 500f + (num10 - 500f) * 0.75f; - } - if (num10 > 700f) - { - num10 = 700f + (num10 - 700f) * 0.5f; - } - if (num10 > 900f) - { - num10 = 900f + (num10 - 900f) * 0.25f; - } - if (distance < num10) - { - float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 240 + (int)damage / 2); - Main.npc[m].AddBuff(mod.BuffType("GlacialState"), (int)num11, false); - } - } - } - } - if (aBrain) - { - for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - float arg_67A_0 = (Main.npc[m].Center - player.Center).Length(); - float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); - if (num10 > 500f) - { - num10 = 500f + (num10 - 500f) * 0.75f; - } - if (num10 > 700f) - { - num10 = 700f + (num10 - 700f) * 0.5f; - } - if (num10 > 900f) - { - num10 = 900f + (num10 - 900f) * 0.25f; - } - if (arg_67A_0 < num10) - { - float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); - Main.npc[m].AddBuff(31, (int)num11, false); - } - } - } - Projectile.NewProjectile(player.Center.X + (float)Main.rand.Next(-40, 40), player.Center.Y - (float)Main.rand.Next(20, 60), player.velocity.X * 0.3f, player.velocity.Y * 0.3f, 565, 0, 0f, player.whoAmI, 0f, 0f); - } - } - if (player.ownedProjectileCounts[mod.ProjectileType("Drataliornus")] != 0) - { - for (int i = 0; i < 1000; i++) - { - if (Main.projectile[i].active && Main.projectile[i].type == mod.ProjectileType("Drataliornus") && Main.projectile[i].owner == player.whoAmI) - { - Main.projectile[i].Kill(); - break; - } - } - if (player.wingTime > player.wingTimeMax / 2) - player.wingTime = player.wingTimeMax / 2; - } - } - #endregion + #region Hurt + public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) + { + modStealth = 1f; + if (player.whoAmI == Main.myPlayer) + { + if (rageMode) + { + stress = 0; + if (player.FindBuffIndex(mod.BuffType("RageMode")) > -1) + { player.ClearBuff(mod.BuffType("RageMode")); } + } + if (amidiasBlessing) + { + player.ClearBuff(mod.BuffType("AmidiasBlessing")); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 96); + } + if (!adrenalineMode && adrenaline != adrenalineMax) + { + adrenaline = 0; + } + if ((gShell || fabledTortoise) && !player.panic) + { + player.AddBuff(mod.BuffType("ShellBoost"), 300); + } + if (abyssalDivingSuitPlates && damage > 50) + { + abyssalDivingSuitPlateHits++; + if (abyssalDivingSuitPlateHits >= 3) + { + Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 14); + player.AddBuff(mod.BuffType("AbyssalDivingSuitPlatesBroken"), 10830); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } + if (sirenIce) + { + Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 7); + player.AddBuff(mod.BuffType("IceShieldBrokenBuff"), 1800); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + if (tarraMelee) + { + if (Main.rand.NextBool(4)) + { + player.AddBuff(mod.BuffType("TarraLifeRegen"), 120); + } + } + else if (xerocSet) + { + player.AddBuff(mod.BuffType("XerocRage"), 240); + player.AddBuff(mod.BuffType("XerocWrath"), 240); + } + else if (reaverBlast) + { + player.AddBuff(mod.BuffType("ReaverRage"), 180); + } + if (fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + float distance = (Main.npc[m].Center - player.Center).Length(); + float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); + if (num10 > 500f) + { + num10 = 500f + (num10 - 500f) * 0.75f; + } + if (num10 > 700f) + { + num10 = 700f + (num10 - 700f) * 0.5f; + } + if (num10 > 900f) + { + num10 = 900f + (num10 - 900f) * 0.25f; + } + if (distance < num10) + { + float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 240 + (int)damage / 2); + Main.npc[m].AddBuff(mod.BuffType("GlacialState"), (int)num11, false); + } + } + } + } + if (aBrain) + { + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + float arg_67A_0 = (Main.npc[m].Center - player.Center).Length(); + float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); + if (num10 > 500f) + { + num10 = 500f + (num10 - 500f) * 0.75f; + } + if (num10 > 700f) + { + num10 = 700f + (num10 - 700f) * 0.5f; + } + if (num10 > 900f) + { + num10 = 900f + (num10 - 900f) * 0.25f; + } + if (arg_67A_0 < num10) + { + float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); + Main.npc[m].AddBuff(31, (int)num11, false); + } + } + } + Projectile.NewProjectile(player.Center.X + (float)Main.rand.Next(-40, 40), player.Center.Y - (float)Main.rand.Next(20, 60), player.velocity.X * 0.3f, player.velocity.Y * 0.3f, 565, 0, 0f, player.whoAmI, 0f, 0f); + } + } + if (player.ownedProjectileCounts[mod.ProjectileType("Drataliornus")] != 0) + { + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == mod.ProjectileType("Drataliornus") && Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].Kill(); + break; + } + } + if (player.wingTime > player.wingTimeMax / 2) + player.wingTime = player.wingTimeMax / 2; + } + } + #endregion - #region Post Hurt - public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) - { - if (pArtifact) - { - player.AddBuff(mod.BuffType("BurntOut"), 300, true); - } - bool hardMode = Main.hardMode; - if (player.whoAmI == Main.myPlayer) - { - if (cTracers && damage > 200) - { - player.immuneTime += 60; - } - if (godSlayerThrowing && damage > 80) - { - player.immuneTime += 30; - } - if (statigelSet && damage > 100) - { - player.immuneTime += 30; - } - if (dAmulet) - { - if (damage == 1.0) - { - player.immuneTime += 10; - } - else - { - player.immuneTime += 20; - } - } - if (fabsolVodka) - { - if (damage == 1.0) - { - player.immuneTime += 5; - } - else - { - player.immuneTime += 10; - } - } - if (CalamityWorld.bossRushActive && Config.BossRushImmunityFrameCurse) - { - bossRushImmunityFrameCurseTimer = 300 + player.immuneTime; - } - if (damage > 25) - { - if (aeroSet) - { - for (int n = 0; n < 4; n++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 20; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("StickyFeatherAero"), 20, 1f, player.whoAmI, 0f, 0f); - } - } - } - if (aBulwark) - { - if (aBulwarkRare) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerBlaze"), 25, 5f, player.whoAmI, 0f, 1f); - } - int starAmt = aBulwarkRare ? 12 : 5; - for (int n = 0; n < starAmt; n++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("AstralStar"), 320, 5f, player.whoAmI, 0f, 0f); - } - } - if (dAmulet) - { - for (int n = 0; n < 3; n++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, 92, 130, 4f, player.whoAmI, 0f, 0f); - Main.projectile[num17].usesLocalNPCImmunity = true; - Main.projectile[num17].localNPCHitCooldown = 5; - Main.projectile[num17].ranged = false; - } - } - } - if (fCarapace) - { - if (damage > 0) - { - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 45); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int fDamage = 56; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - Main.projectile[spore1].timeLeft = 120; - Main.projectile[spore2].timeLeft = 120; - } - } - } - } - if (aSpark) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 93); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int sDamage = hardMode ? 36 : 6; - if (aSparkRare) - sDamage += hardMode ? 12 : 2; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); - int spark2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); - Main.projectile[spark1].timeLeft = 120; - Main.projectile[spark2].timeLeft = 120; - } - } - } + #region Post Hurt + public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) + { + if (pArtifact) + { + player.AddBuff(mod.BuffType("BurntOut"), 300, true); + } + bool hardMode = Main.hardMode; + if (player.whoAmI == Main.myPlayer) + { + if (cTracers && damage > 200) + { + player.immuneTime += 60; + } + if (godSlayerThrowing && damage > 80) + { + player.immuneTime += 30; + } + if (statigelSet && damage > 100) + { + player.immuneTime += 30; + } + if (dAmulet) + { + if (damage == 1.0) + { + player.immuneTime += 10; + } + else + { + player.immuneTime += 20; + } + } + if (fabsolVodka) + { + if (damage == 1.0) + { + player.immuneTime += 5; + } + else + { + player.immuneTime += 10; + } + } + if (CalamityWorld.bossRushActive && Config.BossRushImmunityFrameCurse) + { + bossRushImmunityFrameCurseTimer = 300 + player.immuneTime; + } + if (damage > 25) + { + if (aeroSet) + { + for (int n = 0; n < 4; n++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = player.position.X + (float)(player.width / 2) - vector.X; + float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 20; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("StickyFeatherAero"), 20, 1f, player.whoAmI, 0f, 0f); + } + } + } + if (aBulwark) + { + if (aBulwarkRare) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerBlaze"), 25, 5f, player.whoAmI, 0f, 1f); + } + int starAmt = aBulwarkRare ? 12 : 5; + for (int n = 0; n < starAmt; n++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = player.position.X + (float)(player.width / 2) - vector.X; + float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("AstralStar"), 320, 5f, player.whoAmI, 0f, 0f); + } + } + if (dAmulet) + { + for (int n = 0; n < 3; n++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = player.position.X + (float)(player.width / 2) - vector.X; + float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, 92, 130, 4f, player.whoAmI, 0f, 0f); + Main.projectile[num17].usesLocalNPCImmunity = true; + Main.projectile[num17].localNPCHitCooldown = 5; + Main.projectile[num17].ranged = false; + } + } + } + if (fCarapace) + { + if (damage > 0) + { + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 45); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int fDamage = 56; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; + Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + Main.projectile[spore1].timeLeft = 120; + Main.projectile[spore2].timeLeft = 120; + } + } + } + } + if (aSpark) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 93); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int sDamage = hardMode ? 36 : 6; + if (aSparkRare) + sDamage += hardMode ? 12 : 2; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); + int spark2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); + Main.projectile[spark1].timeLeft = 120; + Main.projectile[spark2].timeLeft = 120; + } + } + } } if (inkBomb) { @@ -7539,1972 +7564,1981 @@ namespace CalamityMod.CalPlayer } } if (ataxiaBlaze && Main.rand.NextBool(5)) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); - int eDamage = 100; - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("ChaosBlaze"), eDamage, 1f, player.whoAmI, 0f, 0f); - } - } - } - else if (daedalusShard) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int sDamage = 27; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 8; i++) - { - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, 90, sDamage, 1f, player.whoAmI, 0f, 0f); - int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, 90, sDamage, 1f, player.whoAmI, 0f, 0f); - Main.projectile[shard].ranged = false; - Main.projectile[shard2].ranged = false; - } - } - } - } - else if (reaverSpore) - { - if (damage > 0) - { - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 1); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int rDamage = 58; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 568, rDamage, 2f, player.whoAmI, 0f, 0f); - } - } - } - } - else if (godSlayerDamage) - { - if (damage > 80) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); - } - } - } - } - else if (godSlayerMage) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerBlaze"), (auricSet ? 2400 : 1200), 1f, player.whoAmI, 0f, 0f); - } - } - } - else if (dsSetBonus) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 2; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, 294, 3000, 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } - for (int l = 0; l < 5; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, 45, 5000, 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } - } - } - } - #endregion + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + int eDamage = 100; + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("ChaosBlaze"), eDamage, 1f, player.whoAmI, 0f, 0f); + } + } + } + else if (daedalusShard) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int sDamage = 27; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 8; i++) + { + float randomSpeed = (float)Main.rand.Next(1, 7); + float randomSpeed2 = (float)Main.rand.Next(1, 7); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, 90, sDamage, 1f, player.whoAmI, 0f, 0f); + int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, 90, sDamage, 1f, player.whoAmI, 0f, 0f); + Main.projectile[shard].ranged = false; + Main.projectile[shard2].ranged = false; + } + } + } + } + else if (reaverSpore) + { + if (damage > 0) + { + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 1); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int rDamage = 58; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; + Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 568, rDamage, 2f, player.whoAmI, 0f, 0f); + } + } + } + } + else if (godSlayerDamage) + { + if (damage > 80) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); + } + } + } + } + else if (godSlayerMage) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerBlaze"), (auricSet ? 2400 : 1200), 1f, player.whoAmI, 0f, 0f); + } + } + } + else if (dsSetBonus) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 2; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, 294, 3000, 7f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + } + for (int l = 0; l < 5; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, 45, 5000, 7f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + } + } + } + } + #endregion - #region Kill Player - public void KillPlayer() - { - deathCount++; - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) - { - DeathPacket(false); - } - player.lastDeathPostion = player.Center; - player.lastDeathTime = DateTime.Now; - player.showLastDeath = true; - bool specialDeath = CalamityWorld.ironHeart && areThereAnyDamnBosses; + #region Kill Player + public void KillPlayer() + { + deathCount++; + if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + { + DeathPacket(false); + } + player.lastDeathPostion = player.Center; + player.lastDeathTime = DateTime.Now; + player.showLastDeath = true; + bool specialDeath = CalamityWorld.ironHeart && areThereAnyDamnBosses; int coinsOwned = (int)Utils.CoinsCount(out bool flag, player.inventory, new int[0]); if (Main.myPlayer == player.whoAmI) - { - player.lostCoins = coinsOwned; - player.lostCoinString = Main.ValueToCoins(player.lostCoins); - } - if (Main.myPlayer == player.whoAmI) - { - Main.mapFullscreen = false; - } - if (Main.myPlayer == player.whoAmI) - { - player.trashItem.SetDefaults(0, false); - if (specialDeath) - { - player.difficulty = 2; - player.DropItems(); - player.KillMeForGood(); - } - else if (player.difficulty == 0) - { - for (int i = 0; i < 59; i++) - { - if (player.inventory[i].stack > 0 && ((player.inventory[i].type >= 1522 && player.inventory[i].type <= 1527) || player.inventory[i].type == 3643)) - { - int num = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[i].type, 1, false, 0, false, false); - Main.item[num].netDefaults(player.inventory[i].netID); - Main.item[num].Prefix((int)player.inventory[i].prefix); - Main.item[num].stack = player.inventory[i].stack; - Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; - Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; - Main.item[num].noGrabDelay = 100; - Main.item[num].favorited = false; - Main.item[num].newAndShiny = false; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(21, -1, -1, null, num, 0f, 0f, 0f, 0, 0, 0); - } - player.inventory[i].SetDefaults(0, false); - } - } - } - else if (player.difficulty == 1) - { - player.DropItems(); - } - else if (player.difficulty == 2) - { - player.DropItems(); - player.KillMeForGood(); - } - } - if (specialDeath) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/IronHeartDeath"), (int)player.position.X, (int)player.position.Y); - } - else - { - Main.PlaySound(5, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); - } - player.headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.headVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - player.bodyVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - player.legVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - if (player.stoned) - { - player.headPosition = Vector2.Zero; - player.bodyPosition = Vector2.Zero; - player.legPosition = Vector2.Zero; - } - for (int j = 0; j < 100; j++) - { - Dust.NewDust(player.position, player.width, player.height, (specialDeath ? 91 : 235), (float)(2 * 0), -2f, 0, default, 1f); - } - player.mount.Dismount(player); - player.dead = true; - player.respawnTimer = 600; - if (Main.expertMode) - { - player.respawnTimer = (int)((double)player.respawnTimer * 1.5); - } - player.immuneAlpha = 0; - player.palladiumRegen = false; - player.iceBarrier = false; - player.crystalLeaf = false; - PlayerDeathReason damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); - NetworkText deathText = damageSource.GetDeathText(player.name); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(deathText, new Color(225, 25, 25), -1); - } - else if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(deathText.ToString(), 225, 25, 25, false); - } - if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) - { - NetMessage.SendPlayerDeath(player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); - } - if (player.whoAmI == Main.myPlayer && player.difficulty == 0) - { - player.DropCoins(); - } - player.DropTombstone(coinsOwned, deathText, 0); - if (player.whoAmI == Main.myPlayer) - { - try - { - WorldGen.saveToonWhilePlaying(); - } - catch - { - } - } - } - #endregion + { + player.lostCoins = coinsOwned; + player.lostCoinString = Main.ValueToCoins(player.lostCoins); + } + if (Main.myPlayer == player.whoAmI) + { + Main.mapFullscreen = false; + } + if (Main.myPlayer == player.whoAmI) + { + player.trashItem.SetDefaults(0, false); + if (specialDeath) + { + player.difficulty = 2; + player.DropItems(); + player.KillMeForGood(); + } + else if (player.difficulty == 0) + { + for (int i = 0; i < 59; i++) + { + if (player.inventory[i].stack > 0 && ((player.inventory[i].type >= 1522 && player.inventory[i].type <= 1527) || player.inventory[i].type == 3643)) + { + int num = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[i].type, 1, false, 0, false, false); + Main.item[num].netDefaults(player.inventory[i].netID); + Main.item[num].Prefix((int)player.inventory[i].prefix); + Main.item[num].stack = player.inventory[i].stack; + Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; + Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; + Main.item[num].noGrabDelay = 100; + Main.item[num].favorited = false; + Main.item[num].newAndShiny = false; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(21, -1, -1, null, num, 0f, 0f, 0f, 0, 0, 0); + } + player.inventory[i].SetDefaults(0, false); + } + } + } + else if (player.difficulty == 1) + { + player.DropItems(); + } + else if (player.difficulty == 2) + { + player.DropItems(); + player.KillMeForGood(); + } + } + if (specialDeath) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/IronHeartDeath"), (int)player.position.X, (int)player.position.Y); + } + else + { + Main.PlaySound(5, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); + } + player.headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + player.bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + player.legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + player.headVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + player.bodyVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + player.legVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + if (player.stoned) + { + player.headPosition = Vector2.Zero; + player.bodyPosition = Vector2.Zero; + player.legPosition = Vector2.Zero; + } + for (int j = 0; j < 100; j++) + { + Dust.NewDust(player.position, player.width, player.height, (specialDeath ? 91 : 235), (float)(2 * 0), -2f, 0, default, 1f); + } + player.mount.Dismount(player); + player.dead = true; + player.respawnTimer = 600; + if (Main.expertMode) + { + player.respawnTimer = (int)((double)player.respawnTimer * 1.5); + } + player.immuneAlpha = 0; + player.palladiumRegen = false; + player.iceBarrier = false; + player.crystalLeaf = false; + PlayerDeathReason damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); + NetworkText deathText = damageSource.GetDeathText(player.name); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(deathText, new Color(225, 25, 25), -1); + } + else if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(deathText.ToString(), 225, 25, 25, false); + } + if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + { + NetMessage.SendPlayerDeath(player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); + } + if (player.whoAmI == Main.myPlayer && player.difficulty == 0) + { + player.DropCoins(); + } + player.DropTombstone(coinsOwned, deathText, 0); + if (player.whoAmI == Main.myPlayer) + { + try + { + WorldGen.saveToonWhilePlaying(); + } catch + { + } + } + } + #endregion - #region Dash Stuff - public void ModDashMovement() - { - if (dashMod == 6 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) - { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) - { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) - { - float num = 50f * player.meleeDamage; - float num2 = 3f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); - } - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(mod.BuffType("GlacialState"), 300); - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - } - } - } - } - if (dashMod == 4 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) - { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) - { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) - { - float num = 1500f * player.meleeDamage; - float num2 = 15f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); - int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 1000, 20f, Main.myPlayer, 0f, 0f); - Main.projectile[num6].Kill(); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 780, 5f, Main.myPlayer, 0f, 0f); - } - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - } - } - } - } - if (dashMod == 3 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) - { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) - { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) - { - float num = 500f * player.meleeDamage; - float num2 = 12f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); - int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 500, 15f, Main.myPlayer, 0f, 0f); - Main.projectile[num6].Kill(); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 380, 5f, Main.myPlayer, 0f, 0f); - } - nPC.immune[player.whoAmI] = 6; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - } - } - } - } - if (dashMod == 2 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) - { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) - { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) - { - float num = 100f * player.meleeDamage; - float num2 = 9f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); - int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosion"), 100, 15f, Main.myPlayer, 0f, 0f); - Main.projectile[num6].Kill(); - } - nPC.immune[player.whoAmI] = 6; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - } - } - } - } - if (dashMod == 1 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) - { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); - for (int i = 0; i < 200; i++) - { - if ((Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0)) - { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) - { - OnDodge(); - break; - } - } - } - for (int i = 0; i < 1000; i++) - { - if ((Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0)) - { - Projectile proj = Main.projectile[i]; - Rectangle rect = proj.getRect(); - if (rectangle.Intersects(rect)) - { - OnDodge(); - break; - } - } - } - } - if (player.dashDelay > 0) - { - return; - } - if (player.dashDelay < 0) - { - float num7 = 12f; - float num8 = 0.985f; - float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); - float num10 = 0.94f; - int num11 = 20; - if (dashMod == 1) - { - for (int k = 0; k < 2; k++) - { - int num12; - if (player.velocity.Y == 0f) - { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)player.height - 4f), player.width, 8, 235, 0f, 0f, 100, default, 1.4f); - } - else - { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)(player.height / 2) - 8f), player.width, 16, 235, 0f, 0f, 100, default, 1.4f); - } - Main.dust[num12].velocity *= 0.1f; - Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - } - else if (dashMod == 2) - { - for (int m = 0; m < 4; m++) - { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 246, 0f, 0f, 100, default, 2.75f); - Main.dust[num14].velocity *= 0.1f; - Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num14].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num14].fadeIn = 0.5f; - } - } - } - else if (dashMod == 3) - { - for (int m = 0; m < 12; m++) - { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 0f, 0f, 100, default, 2.75f); - Main.dust[num14].velocity *= 0.1f; - Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num14].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num14].fadeIn = 0.5f; - } - } - num7 = 14f; //14 - } - else if (dashMod == 4) - { - for (int m = 0; m < 24; m++) - { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 0f, 0f, 100, default, 2.75f); - Main.dust[num14].velocity *= 0.1f; - Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num14].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num14].fadeIn = 0.5f; - } - } - num7 = 16f; //14 - } - else if (dashMod == 5) - { - for (int m = 0; m < 24; m++) - { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 33, 0f, 0f, 100, default, 2.75f); - Main.dust[num14].velocity *= 0.1f; - Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num14].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num14].fadeIn = 0.5f; - } - } - num7 = 18f; //14 - } - else if (dashMod == 6) - { - for (int m = 0; m < 24; m++) - { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 67, 0f, 0f, 100, default, 1f); - Main.dust[num14].velocity *= 0.1f; - Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num14].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num14].fadeIn = 0.5f; - } - } - num7 = 12.5f; //14 - } - if (dashMod > 0) - { - player.vortexStealthActive = false; - if (player.velocity.X > num7 || player.velocity.X < -num7) - { - player.velocity.X = player.velocity.X * num8; - return; - } - if (player.velocity.X > num9 || player.velocity.X < -num9) - { - player.velocity.X = player.velocity.X * num10; - return; - } - player.dashDelay = num11; - if (player.velocity.X < 0f) - { - player.velocity.X = -num9; - return; - } - if (player.velocity.X > 0f) - { - player.velocity.X = num9; - return; - } - } - } - else if (dashMod > 0 && !player.mount.Active) - { - if (dashMod == 1) - { - int num16 = 0; - bool flag = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - num16 = 1; - flag = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - num16 = -1; - flag = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (flag) - { - player.velocity.X = 14.5f * (float)num16; //eoc dash amount - Point point = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point2 = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num17 = 0; num17 < 20; num17++) - { - int num18 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default, 2f); - Dust expr_CDB_cp_0 = Main.dust[num18]; - expr_CDB_cp_0.position.X += (float)Main.rand.Next(-5, 6); - Dust expr_D02_cp_0 = Main.dust[num18]; - expr_D02_cp_0.position.Y += (float)Main.rand.Next(-5, 6); - Main.dust[num18].velocity *= 0.2f; - Main.dust[num18].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num18].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - return; - } - } - else if (dashMod == 2) - { - int num23 = 0; - bool flag3 = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - num23 = 1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - num23 = -1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (flag3) - { - player.velocity.X = 16.9f * (float)num23; //tabi dash amount - Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 20; num24++) - { - int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 246, 0f, 0f, 100, default, 3f); - Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); - Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); - Main.dust[num25].velocity *= 0.2f; - Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num25].noGravity = true; - Main.dust[num25].fadeIn = 0.5f; - } - } - } - else if (dashMod == 3) - { - int num23 = 0; - bool flag3 = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - num23 = 1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - num23 = -1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (flag3) - { - player.velocity.X = 21.9f * (float)num23; //solar dash amount - Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 40; num24++) - { - int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); - Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); - Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); - Main.dust[num25].velocity *= 0.2f; - Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num25].noGravity = true; - Main.dust[num25].fadeIn = 0.5f; - } - } - } - else if (dashMod == 4) - { - int num23 = 0; - bool flag3 = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - num23 = 1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - num23 = -1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (flag3) - { - player.velocity.X = 23.9f * (float)num23; //slighty more powerful solar dash - Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 60; num24++) - { - int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); - Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); - Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); - Main.dust[num25].velocity *= 0.2f; - Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num25].noGravity = true; - Main.dust[num25].fadeIn = 0.5f; - } - } - } - else if (dashMod == 5) - { - int num23 = 0; - bool flag3 = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - num23 = 1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - num23 = -1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (flag3) - { - player.velocity.X = 25.9f * (float)num23; - Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 60; num24++) - { - int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 33, 0f, 0f, 100, default, 3f); - Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); - Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); - Main.dust[num25].velocity *= 0.2f; - Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num25].noGravity = true; - Main.dust[num25].fadeIn = 0.5f; - } - } - } - else if (dashMod == 6) - { - int num23 = 0; - bool flag3 = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - num23 = 1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - num23 = -1; - flag3 = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (flag3) - { - player.velocity.X = 15.7f * (float)num23; - Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 60; num24++) - { - int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 1.25f); - Dust expr_13AF_cp_0 = Main.dust[num25]; - expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); - Dust expr_13D6_cp_0 = Main.dust[num25]; - expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); - Main.dust[num25].velocity *= 0.2f; - Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - Main.dust[num25].noGravity = true; - Main.dust[num25].fadeIn = 0.5f; - } - } - } - } - } + #region Dash Stuff + public void ModDashMovement() + { + if (dashMod == 6 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) + { + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + float num = 50f * player.meleeDamage; + float num2 = 3f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + } + nPC.immune[player.whoAmI] = 6; + nPC.AddBuff(mod.BuffType("GlacialState"), 300); + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } + if (dashMod == 4 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) + { + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + float num = 1500f * player.meleeDamage; + float num2 = 15f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 1000, 20f, Main.myPlayer, 0f, 0f); + Main.projectile[num6].Kill(); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 780, 5f, Main.myPlayer, 0f, 0f); + } + nPC.immune[player.whoAmI] = 6; + nPC.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } + if (dashMod == 3 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) + { + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + float num = 500f * player.meleeDamage; + float num2 = 12f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 500, 15f, Main.myPlayer, 0f, 0f); + Main.projectile[num6].Kill(); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 380, 5f, Main.myPlayer, 0f, 0f); + } + nPC.immune[player.whoAmI] = 6; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } + if (dashMod == 2 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) + { + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + float num = 100f * player.meleeDamage; + float num2 = 9f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosion"), 100, 15f, Main.myPlayer, 0f, 0f); + Main.projectile[num6].Kill(); + } + nPC.immune[player.whoAmI] = 6; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } + if (dashMod == 1 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) + { + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if ((Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0)) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + OnDodge(); + break; + } + } + } + for (int i = 0; i < 1000; i++) + { + if ((Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0)) + { + Projectile proj = Main.projectile[i]; + Rectangle rect = proj.getRect(); + if (rectangle.Intersects(rect)) + { + OnDodge(); + break; + } + } + } + } + if (player.dashDelay > 0) + { + return; + } + if (player.dashDelay < 0) + { + float num7 = 12f; + float num8 = 0.985f; + float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); + float num10 = 0.94f; + int num11 = 20; + if (dashMod == 1) + { + for (int k = 0; k < 2; k++) + { + int num12; + if (player.velocity.Y == 0f) + { + num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)player.height - 4f), player.width, 8, 235, 0f, 0f, 100, default, 1.4f); + } + else + { + num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)(player.height / 2) - 8f), player.width, 16, 235, 0f, 0f, 100, default, 1.4f); + } + Main.dust[num12].velocity *= 0.1f; + Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + } + else if (dashMod == 2) + { + for (int m = 0; m < 4; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 246, 0f, 0f, 100, default, 2.75f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + } + else if (dashMod == 3) + { + for (int m = 0; m < 12; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 0f, 0f, 100, default, 2.75f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 14f; //14 + } + else if (dashMod == 4) + { + for (int m = 0; m < 24; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 0f, 0f, 100, default, 2.75f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 16f; //14 + } + else if (dashMod == 5) + { + for (int m = 0; m < 24; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 33, 0f, 0f, 100, default, 2.75f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 18f; //14 + } + else if (dashMod == 6) + { + for (int m = 0; m < 24; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 67, 0f, 0f, 100, default, 1f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 12.5f; //14 + } + if (dashMod > 0) + { + player.vortexStealthActive = false; + if (player.velocity.X > num7 || player.velocity.X < -num7) + { + player.velocity.X = player.velocity.X * num8; + return; + } + if (player.velocity.X > num9 || player.velocity.X < -num9) + { + player.velocity.X = player.velocity.X * num10; + return; + } + player.dashDelay = num11; + if (player.velocity.X < 0f) + { + player.velocity.X = -num9; + return; + } + if (player.velocity.X > 0f) + { + player.velocity.X = num9; + return; + } + } + } + else if (dashMod > 0 && !player.mount.Active) + { + if (dashMod == 1) + { + int num16 = 0; + bool flag = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num16 = 1; + flag = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num16 = -1; + flag = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag) + { + player.velocity.X = 14.5f * (float)num16; //eoc dash amount + Point point = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point2 = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num17 = 0; num17 < 20; num17++) + { + int num18 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default, 2f); + Dust expr_CDB_cp_0 = Main.dust[num18]; + expr_CDB_cp_0.position.X += (float)Main.rand.Next(-5, 6); + Dust expr_D02_cp_0 = Main.dust[num18]; + expr_D02_cp_0.position.Y += (float)Main.rand.Next(-5, 6); + Main.dust[num18].velocity *= 0.2f; + Main.dust[num18].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num18].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + return; + } + } + else if (dashMod == 2) + { + int num23 = 0; + bool flag3 = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num23 = 1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num23 = -1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag3) + { + player.velocity.X = 16.9f * (float)num23; //tabi dash amount + Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 20; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 246, 0f, 0f, 100, default, 3f); + Dust expr_13AF_cp_0 = Main.dust[num25]; + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); + Dust expr_13D6_cp_0 = Main.dust[num25]; + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); + Main.dust[num25].velocity *= 0.2f; + Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num25].noGravity = true; + Main.dust[num25].fadeIn = 0.5f; + } + } + } + else if (dashMod == 3) + { + int num23 = 0; + bool flag3 = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num23 = 1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num23 = -1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag3) + { + player.velocity.X = 21.9f * (float)num23; //solar dash amount + Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 40; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); + Dust expr_13AF_cp_0 = Main.dust[num25]; + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); + Dust expr_13D6_cp_0 = Main.dust[num25]; + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); + Main.dust[num25].velocity *= 0.2f; + Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num25].noGravity = true; + Main.dust[num25].fadeIn = 0.5f; + } + } + } + else if (dashMod == 4) + { + int num23 = 0; + bool flag3 = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num23 = 1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num23 = -1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag3) + { + player.velocity.X = 23.9f * (float)num23; //slighty more powerful solar dash + Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 60; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); + Dust expr_13AF_cp_0 = Main.dust[num25]; + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); + Dust expr_13D6_cp_0 = Main.dust[num25]; + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); + Main.dust[num25].velocity *= 0.2f; + Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num25].noGravity = true; + Main.dust[num25].fadeIn = 0.5f; + } + } + } + else if (dashMod == 5) + { + int num23 = 0; + bool flag3 = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num23 = 1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num23 = -1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag3) + { + player.velocity.X = 25.9f * (float)num23; + Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 60; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 33, 0f, 0f, 100, default, 3f); + Dust expr_13AF_cp_0 = Main.dust[num25]; + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); + Dust expr_13D6_cp_0 = Main.dust[num25]; + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); + Main.dust[num25].velocity *= 0.2f; + Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num25].noGravity = true; + Main.dust[num25].fadeIn = 0.5f; + } + } + } + else if (dashMod == 6) + { + int num23 = 0; + bool flag3 = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num23 = 1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num23 = -1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag3) + { + player.velocity.X = 15.7f * (float)num23; + Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 60; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 1.25f); + Dust expr_13AF_cp_0 = Main.dust[num25]; + expr_13AF_cp_0.position.X += (float)Main.rand.Next(-5, 6); + Dust expr_13D6_cp_0 = Main.dust[num25]; + expr_13D6_cp_0.position.Y += (float)Main.rand.Next(-5, 6); + Main.dust[num25].velocity *= 0.2f; + Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num25].noGravity = true; + Main.dust[num25].fadeIn = 0.5f; + } + } + } + } + } - private void OnDodge() - { - if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown) - { - player.AddBuff(mod.BuffType("ScarfMeleeBoost"), 540); - player.AddBuff(mod.BuffType("ScarfCooldown"), (player.chaosState ? 1800 : 900)); - player.immune = true; - player.immuneTime = 60; - if (player.longInvince) - { - player.immuneTime += 40; - } - for (int k = 0; k < player.hurtCooldowns.Length; k++) - { - player.hurtCooldowns[k] = player.immuneTime; - } - for (int j = 0; j < 100; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default, 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.4f; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].noGravity = true; - } - } - if (player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(62, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); - } - } - } + private void OnDodge() + { + if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown) + { + player.AddBuff(mod.BuffType("ScarfMeleeBoost"), 540); + player.AddBuff(mod.BuffType("ScarfCooldown"), (player.chaosState ? 1800 : 900)); + player.immune = true; + player.immuneTime = 60; + if (player.longInvince) + { + player.immuneTime += 40; + } + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + for (int j = 0; j < 100; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default, 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.4f; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].noGravity = true; + } + } + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(62, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + } + } - public void ModHorizontalMovement() - { - float num = (player.accRunSpeed + player.maxRunSpeed) / 2f; - if (player.controlLeft && player.velocity.X > -player.accRunSpeed && player.dashDelay >= 0) - { - if (player.velocity.X < -num && player.velocity.Y == 0f && !player.mount.Active) - { - int num3 = 0; - if (player.gravDir == -1f) - { - num3 -= player.height; - } - if (dashMod == 1) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 2) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 3) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 4) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 5) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 6) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - } - } - else if (player.controlRight && player.velocity.X < player.accRunSpeed && player.dashDelay >= 0) - { - if (player.velocity.X > num && player.velocity.Y == 0f && !player.mount.Active) - { - int num8 = 0; - if (player.gravDir == -1f) - { - num8 -= player.height; - } - if (dashMod == 1) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 2) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 3) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 4) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 5) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - else if (dashMod == 6) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - } - } + public void ModHorizontalMovement() + { + float num = (player.accRunSpeed + player.maxRunSpeed) / 2f; + if (player.controlLeft && player.velocity.X > -player.accRunSpeed && player.dashDelay >= 0) + { + if (player.velocity.X < -num && player.velocity.Y == 0f && !player.mount.Active) + { + int num3 = 0; + if (player.gravDir == -1f) + { + num3 -= player.height; + } + if (dashMod == 1) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 2) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 3) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 4) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 5) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 6) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + } + } + else if (player.controlRight && player.velocity.X < player.accRunSpeed && player.dashDelay >= 0) + { + if (player.velocity.X > num && player.velocity.Y == 0f && !player.mount.Active) + { + int num8 = 0; + if (player.gravDir == -1f) + { + num8 -= player.height; + } + if (dashMod == 1) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 2) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 3) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 4) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 5) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 6) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + } + } - if (player.mount.Active && player.mount.Type == mod.MountType("Fab") && Math.Abs(player.velocity.X) > player.mount.DashSpeed - player.mount.RunSpeed / 2f) - { - Rectangle rect = player.getRect(); + if (player.mount.Active && player.mount.Type == mod.MountType("Fab") && Math.Abs(player.velocity.X) > player.mount.DashSpeed - player.mount.RunSpeed / 2f) + { + Rectangle rect = player.getRect(); - if (player.direction == 1) - rect.Offset(player.width - 1, 0); + if (player.direction == 1) + rect.Offset(player.width - 1, 0); - rect.Width = 2; - rect.Inflate(6, 12); - float damage = 800f * player.minionDamage; - float knockback = 10f; - int nPCImmuneTime = 30; - int playerImmuneTime = 6; - ModCollideWithNPCs(rect, damage, knockback, nPCImmuneTime, playerImmuneTime); - } + rect.Width = 2; + rect.Inflate(6, 12); + float damage = 800f * player.minionDamage; + float knockback = 10f; + int nPCImmuneTime = 30; + int playerImmuneTime = 6; + ModCollideWithNPCs(rect, damage, knockback, nPCImmuneTime, playerImmuneTime); + } - if (player.mount.Active && player.mount.Type == mod.MountType("AngryDog") && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) - { - Rectangle rect2 = player.getRect(); + if (player.mount.Active && player.mount.Type == mod.MountType("AngryDog") && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + { + Rectangle rect2 = player.getRect(); - if (player.direction == 1) - rect2.Offset(player.width - 1, 0); + if (player.direction == 1) + rect2.Offset(player.width - 1, 0); - rect2.Width = 2; - rect2.Inflate(6, 12); - float damage2 = 50f * player.minionDamage; - float knockback2 = 8f; - int nPCImmuneTime2 = 30; - int playerImmuneTime2 = 6; - ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); - } + rect2.Width = 2; + rect2.Inflate(6, 12); + float damage2 = 50f * player.minionDamage; + float knockback2 = 8f; + int nPCImmuneTime2 = 30; + int playerImmuneTime2 = 6; + ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); + } - if (player.mount.Active && player.mount.Type == mod.MountType("OnyxExcavator") && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) - { - Rectangle rect2 = player.getRect(); + if (player.mount.Active && player.mount.Type == mod.MountType("OnyxExcavator") && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + { + Rectangle rect2 = player.getRect(); - if (player.direction == 1) - rect2.Offset(player.width - 1, 0); + if (player.direction == 1) + rect2.Offset(player.width - 1, 0); - rect2.Width = 2; - rect2.Inflate(6, 12); - float damage2 = 25f * player.minionDamage; - float knockback2 = 5f; - int nPCImmuneTime2 = 30; - int playerImmuneTime2 = 6; - ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); - } - } + rect2.Width = 2; + rect2.Inflate(6, 12); + float damage2 = 25f * player.minionDamage; + float knockback2 = 5f; + int nPCImmuneTime2 = 30; + int playerImmuneTime2 = 6; + ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); + } + } - private int ModCollideWithNPCs(Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime) - { - int num = 0; - for (int i = 0; i < 200; i++) - { - NPC nPC = Main.npc[i]; - if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.immune[player.whoAmI] == 0) - { - Rectangle rect = nPC.getRect(); - if (myRect.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(player.position, player.width, player.height, nPC.position, nPC.width, nPC.height))) - { - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(nPC, (int)Damage, Knockback, direction, false); - } - nPC.immune[player.whoAmI] = NPCImmuneTime; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = PlayerImmuneTime; - num++; - break; - } - } - } - return num; - } - #endregion + private int ModCollideWithNPCs(Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime) + { + int num = 0; + for (int i = 0; i < 200; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.immune[player.whoAmI] == 0) + { + Rectangle rect = nPC.getRect(); + if (myRect.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(player.position, player.width, player.height, nPC.position, nPC.width, nPC.height))) + { + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)Damage, Knockback, direction, false); + } + nPC.immune[player.whoAmI] = NPCImmuneTime; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = PlayerImmuneTime; + num++; + break; + } + } + } + return num; + } + #endregion - #region Drawing - public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) - { - if (drawInfo.shadow != 0f) - { - return; - } - Player drawPlayer = drawInfo.drawPlayer; - Mod mod = ModLoader.GetMod("CalamityMod"); - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (modPlayer.sirenIce) - { - Texture2D texture = mod.GetTexture("ExtraTextures/IceShield"); - int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); - int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 - DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.Cyan, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); - Main.playerDrawData.Add(data); - } - if (modPlayer.amidiasBlessing) - { - Texture2D texture = mod.GetTexture("ExtraTextures/AmidiasBubble"); - int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); - int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 - DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); - Main.playerDrawData.Add(data); - } - }); + #region Drawing + public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) + { + if (drawInfo.shadow != 0f) + { + return; + } + Player drawPlayer = drawInfo.drawPlayer; + Mod mod = ModLoader.GetMod("CalamityMod"); + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (modPlayer.sirenIce) + { + Texture2D texture = mod.GetTexture("ExtraTextures/IceShield"); + int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); + int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 + DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.Cyan, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); + Main.playerDrawData.Add(data); + } + if (modPlayer.amidiasBlessing) + { + Texture2D texture = mod.GetTexture("ExtraTextures/AmidiasBubble"); + int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); + int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 + DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); + Main.playerDrawData.Add(data); + } + }); - public static readonly PlayerLayer MiscEffects = new PlayerLayer("CalamityMod", "MiscEffects", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) - { - if (drawInfo.shadow != 0f) - return; + public static readonly PlayerLayer MiscEffects = new PlayerLayer("CalamityMod", "MiscEffects", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) + { + if (drawInfo.shadow != 0f) + return; - Player drawPlayer = drawInfo.drawPlayer; - Mod mod = ModLoader.GetMod("CalamityMod"); - Item item = drawPlayer.inventory[drawPlayer.selectedItem]; + Player drawPlayer = drawInfo.drawPlayer; + Mod mod = ModLoader.GetMod("CalamityMod"); + Item item = drawPlayer.inventory[drawPlayer.selectedItem]; - if (!drawPlayer.frozen && - ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) && - item.type > 0 && - !drawPlayer.dead && - !item.noUseGraphic && - (!drawPlayer.wet || !item.noWet)) - { - Vector2 vector = drawPlayer.position + (drawPlayer.itemLocation - drawPlayer.position); - SpriteEffects effect = SpriteEffects.FlipHorizontally; + if (!drawPlayer.frozen && + ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) && + item.type > 0 && + !drawPlayer.dead && + !item.noUseGraphic && + (!drawPlayer.wet || !item.noWet)) + { + Vector2 vector = drawPlayer.position + (drawPlayer.itemLocation - drawPlayer.position); + SpriteEffects effect = SpriteEffects.FlipHorizontally; - if (drawPlayer.gravDir == 1f) - { - if (drawPlayer.direction == 1) - effect = SpriteEffects.None; - else - effect = SpriteEffects.FlipHorizontally; - } - else - { - if (drawPlayer.direction == 1) - effect = SpriteEffects.FlipVertically; - else - effect = (SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically); - } + if (drawPlayer.gravDir == 1f) + { + if (drawPlayer.direction == 1) + effect = SpriteEffects.None; + else + effect = SpriteEffects.FlipHorizontally; + } + else + { + if (drawPlayer.direction == 1) + effect = SpriteEffects.FlipVertically; + else + effect = (SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically); + } - if (item.type == mod.ItemType("DeathhailStaff") || item.type == mod.ItemType("Vesuvius") || item.type == mod.ItemType("SoulPiercer")) - { - Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"); - if (item.type == mod.ItemType("Vesuvius")) - texture = mod.GetTexture("Items/Weapons/VesuviusGlow"); - else if (item.type == mod.ItemType("SoulPiercer")) - texture = mod.GetTexture("Items/Weapons/SoulPiercerGlow"); + if (item.type == mod.ItemType("DeathhailStaff") || item.type == mod.ItemType("Vesuvius") || item.type == mod.ItemType("SoulPiercer")) + { + Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"); + if (item.type == mod.ItemType("Vesuvius")) + texture = mod.GetTexture("Items/Weapons/VesuviusGlow"); + else if (item.type == mod.ItemType("SoulPiercer")) + texture = mod.GetTexture("Items/Weapons/SoulPiercerGlow"); - float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; - int num105 = 0; - Vector2 zero3 = new Vector2(0f, (float)Main.itemTexture[item.type].Height); + float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; + int num105 = 0; + Vector2 zero3 = new Vector2(0f, (float)Main.itemTexture[item.type].Height); - if (drawPlayer.gravDir == -1f) - { - if (drawPlayer.direction == -1) - { - num104 += 1.57f; - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, 0f); - num105 -= Main.itemTexture[item.type].Width; - } - else - { - num104 -= 1.57f; - zero3 = Vector2.Zero; - } - } - else if (drawPlayer.direction == -1) - { - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, (float)Main.itemTexture[item.type].Height); - num105 -= Main.itemTexture[item.type].Width; - } + if (drawPlayer.gravDir == -1f) + { + if (drawPlayer.direction == -1) + { + num104 += 1.57f; + zero3 = new Vector2((float)Main.itemTexture[item.type].Width, 0f); + num105 -= Main.itemTexture[item.type].Width; + } + else + { + num104 -= 1.57f; + zero3 = Vector2.Zero; + } + } + else if (drawPlayer.direction == -1) + { + zero3 = new Vector2((float)Main.itemTexture[item.type].Width, (float)Main.itemTexture[item.type].Height); + num105 -= Main.itemTexture[item.type].Width; + } - DrawData data = new DrawData(texture, - new Vector2((float)((int)(vector.X - Main.screenPosition.X + zero3.X + (float)num105)), (float)((int)(vector.Y - Main.screenPosition.Y + 0f))), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - num104, - zero3, - item.scale, - effect, - 0); + DrawData data = new DrawData(texture, + new Vector2((float)((int)(vector.X - Main.screenPosition.X + zero3.X + (float)num105)), (float)((int)(vector.Y - Main.screenPosition.Y + 0f))), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + num104, + zero3, + item.scale, + effect, + 0); - Main.playerDrawData.Add(data); - } + Main.playerDrawData.Add(data); + } - else if (item.type == mod.ItemType("Deathwind") || item.type == mod.ItemType("Apotheosis") || item.type == mod.ItemType("CleansingBlaze") || - item.type == mod.ItemType("SubsumingVortex")) - { - Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"); - int offsetX = 10; - if (item.type == mod.ItemType("Apotheosis")) - { - texture = mod.GetTexture("Items/Weapons/ApotheosisGlow"); - offsetX = 6; - } - else if (item.type == mod.ItemType("CleansingBlaze")) - { - texture = mod.GetTexture("Items/Weapons/CleansingBlazeGlow"); - offsetX = 37; - } - else if (item.type == mod.ItemType("SubsumingVortex")) - { - texture = mod.GetTexture("Items/Weapons/SubsumingVortexGlow"); - offsetX = 9; - } + else if (item.type == mod.ItemType("Deathwind") || item.type == mod.ItemType("Apotheosis") || item.type == mod.ItemType("CleansingBlaze") || + item.type == mod.ItemType("SubsumingVortex")) + { + Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"); + int offsetX = 10; + if (item.type == mod.ItemType("Apotheosis")) + { + texture = mod.GetTexture("Items/Weapons/ApotheosisGlow"); + offsetX = 6; + } + else if (item.type == mod.ItemType("CleansingBlaze")) + { + texture = mod.GetTexture("Items/Weapons/CleansingBlazeGlow"); + offsetX = 37; + } + else if (item.type == mod.ItemType("SubsumingVortex")) + { + texture = mod.GetTexture("Items/Weapons/SubsumingVortexGlow"); + offsetX = 9; + } - Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); - Vector2 vector14 = vector13; - int num107 = (int)vector14.X - offsetX; - vector13.Y = vector14.Y; + Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); + Vector2 vector14 = vector13; + int num107 = (int)vector14.X - offsetX; + vector13.Y = vector14.Y; - Vector2 origin4 = new Vector2(-(float)num107, (float)(Main.itemTexture[item.type].Height / 2)); - if (drawPlayer.direction == -1) - origin4 = new Vector2((float)(Main.itemTexture[item.type].Width + num107), (float)(Main.itemTexture[item.type].Height / 2)); + Vector2 origin4 = new Vector2(-(float)num107, (float)(Main.itemTexture[item.type].Height / 2)); + if (drawPlayer.direction == -1) + origin4 = new Vector2((float)(Main.itemTexture[item.type].Width + num107), (float)(Main.itemTexture[item.type].Height / 2)); - DrawData data = new DrawData(texture, - new Vector2((float)((int)(vector.X - Main.screenPosition.X + vector13.X)), (float)((int)(vector.Y - Main.screenPosition.Y + vector13.Y))), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - origin4, - item.scale, - effect, - 0); + DrawData data = new DrawData(texture, + new Vector2((float)((int)(vector.X - Main.screenPosition.X + vector13.X)), (float)((int)(vector.Y - Main.screenPosition.Y + vector13.Y))), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + drawPlayer.itemRotation, + origin4, + item.scale, + effect, + 0); - Main.playerDrawData.Add(data); - } + Main.playerDrawData.Add(data); + } - else if (item.type == mod.ItemType("Excelsus") || item.type == mod.ItemType("EssenceFlayer") || item.type == mod.ItemType("TheEnforcer") || - item.type == mod.ItemType("ElementalExcalibur")) - { - Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"); - if (item.type == mod.ItemType("EssenceFlayer")) - texture = mod.GetTexture("Items/Weapons/EssenceFlayerGlow"); - else if (item.type == mod.ItemType("TheEnforcer")) - texture = mod.GetTexture("Items/Weapons/TheEnforcerGlow"); - else if (item.type == mod.ItemType("ElementalExcalibur")) - texture = mod.GetTexture("Items/Weapons/ElementalExcaliburGlow"); + else if (item.type == mod.ItemType("Excelsus") || item.type == mod.ItemType("EssenceFlayer") || item.type == mod.ItemType("TheEnforcer") || + item.type == mod.ItemType("ElementalExcalibur")) + { + Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"); + if (item.type == mod.ItemType("EssenceFlayer")) + texture = mod.GetTexture("Items/Weapons/EssenceFlayerGlow"); + else if (item.type == mod.ItemType("TheEnforcer")) + texture = mod.GetTexture("Items/Weapons/TheEnforcerGlow"); + else if (item.type == mod.ItemType("ElementalExcalibur")) + texture = mod.GetTexture("Items/Weapons/ElementalExcaliburGlow"); - float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[item.type].Height; + float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[item.type].Height; - DrawData data = new DrawData(texture, - new Vector2((float)((int)(vector.X - Main.screenPosition.X)), (float)((int)(vector.Y - Main.screenPosition.Y))), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, yOffset) + Vector2.Zero, - item.scale, - effect, - 0); + DrawData data = new DrawData(texture, + new Vector2((float)((int)(vector.X - Main.screenPosition.X)), (float)((int)(vector.Y - Main.screenPosition.Y))), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + drawPlayer.itemRotation, + new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, yOffset) + Vector2.Zero, + item.scale, + effect, + 0); - Main.playerDrawData.Add(data); - } - } - }); + Main.playerDrawData.Add(data); + } + } + }); - public override void ModifyDrawLayers(List list) - { - MiscEffectsBack.visible = true; - list.Insert(0, MiscEffectsBack); - MiscEffects.visible = true; - list.Add(MiscEffects); - if (fab || crysthamyr || onyxExcavator) { AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); } - } + public override void ModifyDrawLayers(List list) + { + MiscEffectsBack.visible = true; + list.Insert(0, MiscEffectsBack); + MiscEffects.visible = true; + list.Add(MiscEffects); + if (fab || crysthamyr || onyxExcavator) + { AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); } + } - public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo edi) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Player drawPlayer = edi.drawPlayer; - if (drawPlayer.mount != null && (drawPlayer.Calamity().fab || drawPlayer.Calamity().crysthamyr || - drawPlayer.Calamity().onyxExcavator)) - { - drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, edi.position, edi.mountColor, edi.spriteEffects, edi.shadow); - } - }); + public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo edi) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Player drawPlayer = edi.drawPlayer; + if (drawPlayer.mount != null && (drawPlayer.Calamity().fab || drawPlayer.Calamity().crysthamyr || + drawPlayer.Calamity().onyxExcavator)) + { + drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, edi.position, edi.mountColor, edi.spriteEffects, edi.shadow); + } + }); - public static void AddPlayerLayer(List list, PlayerLayer layer, PlayerLayer parent, bool first) - { - int insertAt = -1; - for (int m = 0; m < list.Count; m++) - { - PlayerLayer dl = list[m]; - if (dl.Name.Equals(parent.Name)) { insertAt = m; break; } - } - if (insertAt == -1) list.Add(layer); else list.Insert(first ? insertAt : insertAt + 1, layer); - } + public static void AddPlayerLayer(List list, PlayerLayer layer, PlayerLayer parent, bool first) + { + int insertAt = -1; + for (int m = 0; m < list.Count; m++) + { + PlayerLayer dl = list[m]; + if (dl.Name.Equals(parent.Name)) + { insertAt = m; break; } + } + if (insertAt == -1) + list.Add(layer); + else + list.Insert(first ? insertAt : insertAt + 1, layer); + } - public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) - { - bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f; - if (rogueStealth > 0f && rogueStealthMax > 0f && player.townNPCs < 3f) - { - //A translucent orchid color, the rogue class color - float colorValue = (rogueStealth / rogueStealthMax) * 0.9f; //0 to 0.9 - r *= 1f - (colorValue * 0.89f); //255 to 50 - g *= 1f - colorValue; //255 to 25 - b *= 1f - (colorValue * 0.89f); //255 to 50 - a *= 1f - colorValue; //255 to 25 - player.armorEffectDrawOutlines = false; - player.armorEffectDrawShadow = false; - player.armorEffectDrawShadowSubtle = false; - } - if (CalamityWorld.ironHeart && !Main.gameMenu) - { - Texture2D ironHeart = mod.GetTexture("ExtraTextures/IronHeart"); - Main.heartTexture = Main.heart2Texture = ironHeart; - } - else - { - Texture2D heart3 = mod.GetTexture("ExtraTextures/Heart3"); - Texture2D heart4 = mod.GetTexture("ExtraTextures/Heart4"); - Texture2D heart5 = mod.GetTexture("ExtraTextures/Heart5"); - Texture2D heart6 = mod.GetTexture("ExtraTextures/Heart6"); - Texture2D heartOriginal = mod.GetTexture("ExtraTextures/HeartOriginal"); - Texture2D heartOriginal2 = mod.GetTexture("ExtraTextures/HeartOriginal2"); + public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) + { + bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f; + if (rogueStealth > 0f && rogueStealthMax > 0f && player.townNPCs < 3f) + { + //A translucent orchid color, the rogue class color + float colorValue = (rogueStealth / rogueStealthMax) * 0.9f; //0 to 0.9 + r *= 1f - (colorValue * 0.89f); //255 to 50 + g *= 1f - colorValue; //255 to 25 + b *= 1f - (colorValue * 0.89f); //255 to 50 + a *= 1f - colorValue; //255 to 25 + player.armorEffectDrawOutlines = false; + player.armorEffectDrawShadow = false; + player.armorEffectDrawShadowSubtle = false; + } + if (CalamityWorld.ironHeart && !Main.gameMenu) + { + Texture2D ironHeart = mod.GetTexture("ExtraTextures/IronHeart"); + Main.heartTexture = Main.heart2Texture = ironHeart; + } + else + { + Texture2D heart3 = mod.GetTexture("ExtraTextures/Heart3"); + Texture2D heart4 = mod.GetTexture("ExtraTextures/Heart4"); + Texture2D heart5 = mod.GetTexture("ExtraTextures/Heart5"); + Texture2D heart6 = mod.GetTexture("ExtraTextures/Heart6"); + Texture2D heartOriginal = mod.GetTexture("ExtraTextures/HeartOriginal"); + Texture2D heartOriginal2 = mod.GetTexture("ExtraTextures/HeartOriginal2"); - int totalFruit = - (mFruit ? 1 : 0) + - (bOrange ? 1 : 0) + - (eBerry ? 1 : 0) + - (dFruit ? 1 : 0); - switch (totalFruit) - { - default: - Main.heart2Texture = heartOriginal; Main.heartTexture = heartOriginal2; - break; - case 4: - Main.heart2Texture = heart6; Main.heartTexture = heartOriginal2; - break; - case 3: - Main.heart2Texture = heart5; Main.heartTexture = heartOriginal2; - break; - case 2: - Main.heart2Texture = heart4; Main.heartTexture = heartOriginal2; - break; - case 1: - Main.heart2Texture = heart3; Main.heartTexture = heartOriginal2; - break; - } - } - if (revivifyTimer > 0) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 91, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - } - if (tRegen) - { - if (Main.rand.NextBool(10) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 107, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.75f; - Main.dust[dust].velocity.Y -= 0.35f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.025f; - g *= 0.15f; - b *= 0.035f; - fullBright = true; - } - } - if (IBoots) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 229, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.05f; - g *= 0.05f; - b *= 0.05f; - fullBright = true; - } - } - } - if (elysianFire) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 246, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.75f; - g *= 0.55f; - b *= 0f; - fullBright = true; - } - } - } - if (dsSetBonus) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.025f; - b *= 0.1f; - fullBright = true; - } - } - } - if (auricSet) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, Main.rand.NextBool(2) ? 57 : 244, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.025f; - b *= 0.1f; - fullBright = true; - } - } - } - if (bFlames || aFlames || rageMode) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (shadowflame) - { - if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.95f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.75f; - Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; - if (Main.rand.NextBool(4)) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - } - if (adrenalineMode) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 206, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.01f; - g *= 0.15f; - b *= 0.1f; - fullBright = true; - } - } - if (gsInferno) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 173, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (astralInfection) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dustType = (Main.rand.NextBool(2) ? mod.DustType("AstralOrange") : mod.DustType("AstralBlue")); - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, dustType, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 0.7f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.dust[dust].color = new Color(255, 255, 255, 0); - Main.playerDrawDust.Add(dust); - } - } - if (hFlames || hInferno) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("HolyFlame"), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.25f; - b *= 0.1f; - fullBright = true; - } - } - else if (eGravity) - { - if (Main.rand.NextBool(12) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 244, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - } - if (pFlames) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 89, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.07f; - g *= 0.15f; - b *= 0.01f; - fullBright = true; - } - } - if (gState || cDepth) - { - if (noRogueStealth) - { - r *= 0f; - g *= 0.05f; - b *= 0.3f; - fullBright = true; - } - } - if (draedonsHeart && !shadeRegen && !cFreeze && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (noRogueStealth) - { - r *= 0f; - g *= 0.5f; - b *= 0f; - fullBright = true; - } - } - if (bBlood) - { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 5, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (mushy) - { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 56, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity.Y -= 0.1f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - } - #endregion + int totalFruit = + (mFruit ? 1 : 0) + + (bOrange ? 1 : 0) + + (eBerry ? 1 : 0) + + (dFruit ? 1 : 0); + switch (totalFruit) + { + default: + Main.heart2Texture = heartOriginal; + Main.heartTexture = heartOriginal2; + break; + case 4: + Main.heart2Texture = heart6; + Main.heartTexture = heartOriginal2; + break; + case 3: + Main.heart2Texture = heart5; + Main.heartTexture = heartOriginal2; + break; + case 2: + Main.heart2Texture = heart4; + Main.heartTexture = heartOriginal2; + break; + case 1: + Main.heart2Texture = heart3; + Main.heartTexture = heartOriginal2; + break; + } + } + if (revivifyTimer > 0) + { + if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 91, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + } + if (tRegen) + { + if (Main.rand.NextBool(10) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 107, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].velocity.Y -= 0.35f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.025f; + g *= 0.15f; + b *= 0.035f; + fullBright = true; + } + } + if (IBoots) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 229, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.05f; + g *= 0.05f; + b *= 0.05f; + fullBright = true; + } + } + } + if (elysianFire) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 246, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.75f; + g *= 0.55f; + b *= 0f; + fullBright = true; + } + } + } + if (dsSetBonus) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.025f; + b *= 0.1f; + fullBright = true; + } + } + } + if (auricSet) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, Main.rand.NextBool(2) ? 57 : 244, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.025f; + b *= 0.1f; + fullBright = true; + } + } + } + if (bFlames || aFlames || rageMode) + { + if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (shadowflame) + { + if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.95f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; + Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + if (Main.rand.NextBool(4)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } + if (adrenalineMode) + { + if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 206, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.01f; + g *= 0.15f; + b *= 0.1f; + fullBright = true; + } + } + if (gsInferno) + { + if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 173, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (astralInfection) + { + if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + { + int dustType = (Main.rand.NextBool(2) ? mod.DustType("AstralOrange") : mod.DustType("AstralBlue")); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, dustType, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 0.7f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.dust[dust].color = new Color(255, 255, 255, 0); + Main.playerDrawDust.Add(dust); + } + } + if (hFlames || hInferno) + { + if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("HolyFlame"), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.25f; + b *= 0.1f; + fullBright = true; + } + } + else if (eGravity) + { + if (Main.rand.NextBool(12) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 244, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + } + if (pFlames) + { + if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 89, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.07f; + g *= 0.15f; + b *= 0.01f; + fullBright = true; + } + } + if (gState || cDepth) + { + if (noRogueStealth) + { + r *= 0f; + g *= 0.05f; + b *= 0.3f; + fullBright = true; + } + } + if (draedonsHeart && !shadeRegen && !cFreeze && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + if (noRogueStealth) + { + r *= 0f; + g *= 0.5f; + b *= 0f; + fullBright = true; + } + } + if (bBlood) + { + if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 5, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (mushy) + { + if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 56, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity.Y -= 0.1f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + } + #endregion - #region Nurse Modifications - public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) - { - // In Rev+, nurse costs scale as the game progresses. - // Base: 300 3 silver - // EoC: 900 9 silver - // Skeletron: 1200 12 silver - // Hardmode: 2400 24 silver - // Any Mech Boss: 4000 40 silver - // Plantera/Cal: 6000 60 silver - // Golem: 9000 90 silver - // Fish/PBG/Rav: 12000 1 gold 20 silver - // Moon Lord: 20000 2 gold - // Providence: 32000 3 gold 20 silver - // DoG: 60000 6 gold - // Yharon: 90000 9 gold + #region Nurse Modifications + public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) + { + // In Rev+, nurse costs scale as the game progresses. + // Base: 300 3 silver + // EoC: 900 9 silver + // Skeletron: 1200 12 silver + // Hardmode: 2400 24 silver + // Any Mech Boss: 4000 40 silver + // Plantera/Cal: 6000 60 silver + // Golem: 9000 90 silver + // Fish/PBG/Rav: 12000 1 gold 20 silver + // Moon Lord: 20000 2 gold + // Providence: 32000 3 gold 20 silver + // DoG: 60000 6 gold + // Yharon: 90000 9 gold - if (CalamityWorld.revenge && price > 0) - { - // start with a vanilla cost of zero instead of 3 silver - price -= Item.buyPrice(0, 0, 3, 0); + if (CalamityWorld.revenge && price > 0) + { + // start with a vanilla cost of zero instead of 3 silver + price -= Item.buyPrice(0, 0, 3, 0); - if (CalamityWorld.downedYharon) - price += Item.buyPrice(0, 9, 0, 0); - else if (CalamityWorld.downedDoG) - price += Item.buyPrice(0, 6, 0, 0); - else if (CalamityWorld.downedProvidence) - price += Item.buyPrice(0, 3, 20, 0); - else if (NPC.downedMoonlord) - price += Item.buyPrice(0, 2, 0, 0); - else if (NPC.downedFishron || CalamityWorld.downedPlaguebringer || CalamityWorld.downedScavenger) - price += Item.buyPrice(0, 1, 20, 0); - else if (NPC.downedGolemBoss) - price += Item.buyPrice(0, 0, 90, 0); - else if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - price += Item.buyPrice(0, 0, 60, 0); - else if (NPC.downedMechBossAny) - price += Item.buyPrice(0, 0, 40, 0); - else if (Main.hardMode) - price += Item.buyPrice(0, 0, 24, 0); - else if (NPC.downedBoss3) - price += Item.buyPrice(0, 0, 12, 0); - else if (NPC.downedBoss1) - price += Item.buyPrice(0, 0, 6, 0); - else - price += Item.buyPrice(0, 0, 3, 0); + if (CalamityWorld.downedYharon) + price += Item.buyPrice(0, 9, 0, 0); + else if (CalamityWorld.downedDoG) + price += Item.buyPrice(0, 6, 0, 0); + else if (CalamityWorld.downedProvidence) + price += Item.buyPrice(0, 3, 20, 0); + else if (NPC.downedMoonlord) + price += Item.buyPrice(0, 2, 0, 0); + else if (NPC.downedFishron || CalamityWorld.downedPlaguebringer || CalamityWorld.downedScavenger) + price += Item.buyPrice(0, 1, 20, 0); + else if (NPC.downedGolemBoss) + price += Item.buyPrice(0, 0, 90, 0); + else if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + price += Item.buyPrice(0, 0, 60, 0); + else if (NPC.downedMechBossAny) + price += Item.buyPrice(0, 0, 40, 0); + else if (Main.hardMode) + price += Item.buyPrice(0, 0, 24, 0); + else if (NPC.downedBoss3) + price += Item.buyPrice(0, 0, 12, 0); + else if (NPC.downedBoss1) + price += Item.buyPrice(0, 0, 6, 0); + else + price += Item.buyPrice(0, 0, 3, 0); - if (areThereAnyDamnBosses) - price *= 5; - } + if (areThereAnyDamnBosses) + price *= 5; + } - // It costs 600,000 (60 gold) to remove a full radiation meter. - price += (int)(600D * radiation); - } + // It costs 600,000 (60 gold) to remove a full radiation meter. + price += (int)(600D * radiation); + } - public override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price) - { - radiation = 0.0; - } - #endregion + public override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price) + { + radiation = 0.0; + } + #endregion - #region All-Class Crit Boost - public void AllCritBoost(int boost) - { - player.meleeCrit += boost; - player.rangedCrit += boost; - player.magicCrit += boost; - player.thrownCrit += boost; - player.Calamity().throwingCrit += boost; - } - #endregion + #region All-Class Crit Boost + public void AllCritBoost(int boost) + { + player.meleeCrit += boost; + player.rangedCrit += boost; + player.magicCrit += boost; + player.thrownCrit += boost; + player.Calamity().throwingCrit += boost; + } + #endregion - #region Rogue Stealth - private void ResetRogueStealth() - { - // rogueStealth doesn't reset every frame because it's a continuously building resource + #region Rogue Stealth + private void ResetRogueStealth() + { + // rogueStealth doesn't reset every frame because it's a continuously building resource - // these other parameters are rebuilt every frame based on the items you have equipped - rogueStealthMax = 0f; - stealthGenStandstill = 1f; - stealthGenMoving = 0f; - stealthGenMultiplier = 1f; - stealthStrikeThisFrame = false; - stealthStrikeHalfCost = false; - stealthStrikeAlwaysCrits = false; - } + // these other parameters are rebuilt every frame based on the items you have equipped + rogueStealthMax = 0f; + stealthGenStandstill = 1f; + stealthGenMoving = 0f; + stealthGenMultiplier = 1f; + stealthStrikeThisFrame = false; + stealthStrikeHalfCost = false; + stealthStrikeAlwaysCrits = false; + } - private void UpdateRogueStealth() - { - // If the player un-equips rogue armor, then reset the sound so it'll play again when they re-equip it - if (rogueStealthMax <= 0f) - { - rogueStealth = 0f; - playRogueStealthSound = false; - return; - } + private void UpdateRogueStealth() + { + // If the player un-equips rogue armor, then reset the sound so it'll play again when they re-equip it + if (rogueStealthMax <= 0f) + { + rogueStealth = 0f; + playRogueStealthSound = false; + return; + } - // Sound plays upon hitting full stealth, not upon having stealth strike available (this can occur at lower than 100% stealth) - if (playRogueStealthSound && rogueStealth >= rogueStealthMax) - { - playRogueStealthSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/RogueStealth"), (int)player.position.X, (int)player.position.Y); - } + // Sound plays upon hitting full stealth, not upon having stealth strike available (this can occur at lower than 100% stealth) + if (playRogueStealthSound && rogueStealth >= rogueStealthMax) + { + playRogueStealthSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/RogueStealth"), (int)player.position.X, (int)player.position.Y); + } - // If the player isn't at full stealth, reset the sound so it'll play again when they hit full stealth. - else if (rogueStealth < rogueStealthMax) - playRogueStealthSound = true; + // If the player isn't at full stealth, reset the sound so it'll play again when they hit full stealth. + else if (rogueStealth < rogueStealthMax) + playRogueStealthSound = true; - // Calculate stealth generation and gain stealth accordingly - float currentStealthGen = UpdateStealthGenStats(); - rogueStealth += rogueStealthMax * 0.006f * currentStealthGen; - if (rogueStealth > rogueStealthMax) - rogueStealth = rogueStealthMax; + // Calculate stealth generation and gain stealth accordingly + float currentStealthGen = UpdateStealthGenStats(); + rogueStealth += rogueStealthMax * 0.006f * currentStealthGen; + if (rogueStealth > rogueStealthMax) + rogueStealth = rogueStealthMax; - ProvideStealthStatBonuses(); + ProvideStealthStatBonuses(); - // If the player is using an item that deals damage and is on their first frame of doing so, - // consume stealth if a stealth strike wasn't triggered manually by item code. + // If the player is using an item that deals damage and is on their first frame of doing so, + // consume stealth if a stealth strike wasn't triggered manually by item code. - // This doesn't trigger stealth strike effects (ConsumeStealthStrike instead of StealthStrike) - // so non-rogue weapons can't call lasers down from the sky and such. - if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && player.HeldItem.damage > 0) - ConsumeStealthByAttacking(); - } + // This doesn't trigger stealth strike effects (ConsumeStealthStrike instead of StealthStrike) + // so non-rogue weapons can't call lasers down from the sky and such. + if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && player.HeldItem.damage > 0) + ConsumeStealthByAttacking(); + } - private void ProvideStealthStatBonuses() - { - CalamityPlayer roguePlayer = player.Calamity(); + private void ProvideStealthStatBonuses() + { + CalamityPlayer roguePlayer = player.Calamity(); - // At full stealth, you get 100% of the max possible bonus. Partial stealth only gives you 75% of the partial bonus you have. - if (rogueStealth >= rogueStealthMax) - roguePlayer.throwingDamage += rogueStealth * 1.0f; - else - roguePlayer.throwingDamage += rogueStealth * 0.75f; + // At full stealth, you get 100% of the max possible bonus. Partial stealth only gives you 75% of the partial bonus you have. + if (rogueStealth >= rogueStealthMax) + roguePlayer.throwingDamage += rogueStealth * 1.0f; + else + roguePlayer.throwingDamage += rogueStealth * 0.75f; - // Crit increases massively based on your stealth value. With certain gear, it's locked at 100% for stealth strikes. - if (stealthStrikeAlwaysCrits && StealthStrikeAvailable()) - roguePlayer.throwingCrit = 100; - else - roguePlayer.throwingCrit += (int)(rogueStealth * 30f); + // Crit increases massively based on your stealth value. With certain gear, it's locked at 100% for stealth strikes. + if (stealthStrikeAlwaysCrits && StealthStrikeAvailable()) + roguePlayer.throwingCrit = 100; + else + roguePlayer.throwingCrit += (int)(rogueStealth * 30f); - // Stealth increases movement speed and significantly decreases aggro. - player.moveSpeed += rogueStealth * 0.05f; - player.aggro -= (int)((rogueStealth / rogueStealthMax) * 900f); - } + // Stealth increases movement speed and significantly decreases aggro. + player.moveSpeed += rogueStealth * 0.05f; + player.aggro -= (int)((rogueStealth / rogueStealthMax) * 900f); + } - private float UpdateStealthGenStats() - { - // If you are actively using an item, you cannot gain stealth even while moving. - if (player.itemAnimation > 0) - return 0f; + private float UpdateStealthGenStats() + { + // If you are actively using an item, you cannot gain stealth even while moving. + if (player.itemAnimation > 0) + return 0f; - // Penumbra Potion provides 10% stealth regen while moving, 20% at night and 30% during an eclipse - if (penumbra) - { - if (Main.eclipse) - stealthGenMoving += 0.3f; - else if (!Main.dayTime) - stealthGenMoving += 0.2f; - else - stealthGenMoving += 0.1f; + // Penumbra Potion provides 10% stealth regen while moving, 20% at night and 30% during an eclipse + if (penumbra) + { + if (Main.eclipse) + stealthGenMoving += 0.3f; + else if (!Main.dayTime) + stealthGenMoving += 0.2f; + else + stealthGenMoving += 0.1f; } bool standstill = Math.Abs(player.velocity.X) < 0.1f && Math.Abs(player.velocity.Y) < 0.1f && !player.mount.Active; @@ -9545,1155 +9579,1155 @@ namespace CalamityMod.CalPlayer } } - public bool StealthStrikeAvailable() - { - if (rogueStealthMax <= 0f) - return false; - return rogueStealth >= rogueStealthMax * (stealthStrikeHalfCost ? 0.5f : 1f); - } + public bool StealthStrikeAvailable() + { + if (rogueStealthMax <= 0f) + return false; + return rogueStealth >= rogueStealthMax * (stealthStrikeHalfCost ? 0.5f : 1f); + } - public void StealthStrike() - { - // - // Stuff that happens on stealth strike goes here. Call this from item code. - // + public void StealthStrike() + { + // + // Stuff that happens on stealth strike goes here. Call this from item code. + // - ConsumeStealthByAttacking(); - } + ConsumeStealthByAttacking(); + } - private void ConsumeStealthByAttacking() - { - stealthStrikeThisFrame = true; + private void ConsumeStealthByAttacking() + { + stealthStrikeThisFrame = true; - if (stealthStrikeHalfCost) - { - rogueStealth -= 0.5f * rogueStealthMax; - if (rogueStealth <= 0f) - rogueStealth = 0f; - } - else - rogueStealth = 0f; - } - #endregion + if (stealthStrikeHalfCost) + { + rogueStealth -= 0.5f * rogueStealthMax; + if (rogueStealth <= 0f) + rogueStealth = 0f; + } + else + rogueStealth = 0f; + } + #endregion - #region Packet Stuff - private void ExactLevelPacket(bool server, int levelType) - { - ModPacket packet = mod.GetPacket(256); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactMeleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactRangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactMagicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactSummonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactRogueLevel); - break; - } + #region Packet Stuff + private void ExactLevelPacket(bool server, int levelType) + { + ModPacket packet = mod.GetPacket(256); + switch (levelType) + { + case 0: + packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactMeleeLevel); + break; + case 1: + packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactRangedLevel); + break; + case 2: + packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactMagicLevel); + break; + case 3: + packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactSummonLevel); + break; + case 4: + packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactRogueLevel); + break; + } - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - private void LevelPacket(bool server, int levelType) - { - ModPacket packet = mod.GetPacket(256); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.MeleeLevelSync); - packet.Write(player.whoAmI); - packet.Write(meleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.RangedLevelSync); - packet.Write(player.whoAmI); - packet.Write(rangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.MagicLevelSync); - packet.Write(player.whoAmI); - packet.Write(magicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.SummonLevelSync); - packet.Write(player.whoAmI); - packet.Write(summonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.RogueLevelSync); - packet.Write(player.whoAmI); - packet.Write(rogueLevel); - break; - } + private void LevelPacket(bool server, int levelType) + { + ModPacket packet = mod.GetPacket(256); + switch (levelType) + { + case 0: + packet.Write((byte)CalamityModMessageType.MeleeLevelSync); + packet.Write(player.whoAmI); + packet.Write(meleeLevel); + break; + case 1: + packet.Write((byte)CalamityModMessageType.RangedLevelSync); + packet.Write(player.whoAmI); + packet.Write(rangedLevel); + break; + case 2: + packet.Write((byte)CalamityModMessageType.MagicLevelSync); + packet.Write(player.whoAmI); + packet.Write(magicLevel); + break; + case 3: + packet.Write((byte)CalamityModMessageType.SummonLevelSync); + packet.Write(player.whoAmI); + packet.Write(summonLevel); + break; + case 4: + packet.Write((byte)CalamityModMessageType.RogueLevelSync); + packet.Write(player.whoAmI); + packet.Write(rogueLevel); + break; + } - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - private void StressPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.StressSync); - packet.Write(player.whoAmI); - packet.Write(stress); + private void StressPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.StressSync); + packet.Write(player.whoAmI); + packet.Write(stress); - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - private void AdrenalinePacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.AdrenalineSync); - packet.Write(player.whoAmI); - packet.Write(adrenaline); + private void AdrenalinePacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.AdrenalineSync); + packet.Write(player.whoAmI); + packet.Write(adrenaline); - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - private void RadiationPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.RadiationSync); - packet.Write(player.whoAmI); - packet.Write(radiation); + private void RadiationPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.RadiationSync); + packet.Write(player.whoAmI); + packet.Write(radiation); - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - /*private void DistanceFromBossPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DistanceFromBossSync); - packet.Write(player.whoAmI); - packet.Write(distanceFromBoss); - if (!server) - { - packet.Send(); - } - else - { - packet.Send(-1, player.whoAmI); - } - }*/ + /*private void DistanceFromBossPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DistanceFromBossSync); + packet.Write(player.whoAmI); + packet.Write(distanceFromBoss); + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + }*/ - private void DeathPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DeathCountSync); - packet.Write(player.whoAmI); - packet.Write(deathCount); + private void DeathPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DeathCountSync); + packet.Write(player.whoAmI); + packet.Write(deathCount); - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - internal void HandleExactLevels(BinaryReader reader, int levelType) - { - switch (levelType) - { - case 0: - exactMeleeLevel = reader.ReadInt32(); - break; - case 1: - exactRangedLevel = reader.ReadInt32(); - break; - case 2: - exactMagicLevel = reader.ReadInt32(); - break; - case 3: - exactSummonLevel = reader.ReadInt32(); - break; - case 4: - exactRogueLevel = reader.ReadInt32(); - break; - } + internal void HandleExactLevels(BinaryReader reader, int levelType) + { + switch (levelType) + { + case 0: + exactMeleeLevel = reader.ReadInt32(); + break; + case 1: + exactRangedLevel = reader.ReadInt32(); + break; + case 2: + exactMagicLevel = reader.ReadInt32(); + break; + case 3: + exactSummonLevel = reader.ReadInt32(); + break; + case 4: + exactRogueLevel = reader.ReadInt32(); + break; + } - if (Main.netMode == NetmodeID.Server) - ExactLevelPacket(true, levelType); - } + if (Main.netMode == NetmodeID.Server) + ExactLevelPacket(true, levelType); + } - internal void HandleLevels(BinaryReader reader, int levelType) - { - switch (levelType) - { - case 0: - meleeLevel = reader.ReadInt32(); - break; - case 1: - rangedLevel = reader.ReadInt32(); - break; - case 2: - magicLevel = reader.ReadInt32(); - break; - case 3: - summonLevel = reader.ReadInt32(); - break; - case 4: - rogueLevel = reader.ReadInt32(); - break; - } + internal void HandleLevels(BinaryReader reader, int levelType) + { + switch (levelType) + { + case 0: + meleeLevel = reader.ReadInt32(); + break; + case 1: + rangedLevel = reader.ReadInt32(); + break; + case 2: + magicLevel = reader.ReadInt32(); + break; + case 3: + summonLevel = reader.ReadInt32(); + break; + case 4: + rogueLevel = reader.ReadInt32(); + break; + } - if (Main.netMode == NetmodeID.Server) - LevelPacket(true, levelType); - } + if (Main.netMode == NetmodeID.Server) + LevelPacket(true, levelType); + } - internal void HandleStress(BinaryReader reader) - { - stress = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - StressPacket(true); - } + internal void HandleStress(BinaryReader reader) + { + stress = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + StressPacket(true); + } - internal void HandleAdrenaline(BinaryReader reader) - { - adrenaline = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - AdrenalinePacket(true); - } + internal void HandleAdrenaline(BinaryReader reader) + { + adrenaline = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + AdrenalinePacket(true); + } - internal void HandleRadiation(BinaryReader reader) - { - radiation = reader.ReadDouble(); - if (Main.netMode == NetmodeID.Server) - RadiationPacket(true); - } + internal void HandleRadiation(BinaryReader reader) + { + radiation = reader.ReadDouble(); + if (Main.netMode == NetmodeID.Server) + RadiationPacket(true); + } - /*internal void HandleDistanceFromBoss(BinaryReader reader) - { - distanceFromBoss = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - { - DistanceFromBossPacket(true); - } - }*/ + /*internal void HandleDistanceFromBoss(BinaryReader reader) + { + distanceFromBoss = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + { + DistanceFromBossPacket(true); + } + }*/ - internal void HandleDeathCount(BinaryReader reader) - { - deathCount = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - DeathPacket(true); - } + internal void HandleDeathCount(BinaryReader reader) + { + deathCount = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + DeathPacket(true); + } - public override void OnEnterWorld(Player player) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - ExactLevelPacket(false, 0); - ExactLevelPacket(false, 1); - ExactLevelPacket(false, 2); - ExactLevelPacket(false, 3); - ExactLevelPacket(false, 4); - LevelPacket(false, 0); - LevelPacket(false, 1); - LevelPacket(false, 2); - LevelPacket(false, 3); - LevelPacket(false, 4); - StressPacket(false); - AdrenalinePacket(false); - RadiationPacket(false); - //DistanceFromBossPacket(false); - DeathPacket(false); - } - } - #endregion + public override void OnEnterWorld(Player player) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + ExactLevelPacket(false, 0); + ExactLevelPacket(false, 1); + ExactLevelPacket(false, 2); + ExactLevelPacket(false, 3); + ExactLevelPacket(false, 4); + LevelPacket(false, 0); + LevelPacket(false, 1); + LevelPacket(false, 2); + LevelPacket(false, 3); + LevelPacket(false, 4); + StressPacket(false); + AdrenalinePacket(false); + RadiationPacket(false); + //DistanceFromBossPacket(false); + DeathPacket(false); + } + } + #endregion - #region Proficiency Stuff - private void GetExactLevelUp() - { - if (gainLevelCooldown > 0) - gainLevelCooldown--; + #region Proficiency Stuff + private void GetExactLevelUp() + { + if (gainLevelCooldown > 0) + gainLevelCooldown--; - #region MeleeLevels - switch (meleeLevel) - { - case 100: - this.ExactLevelUp(0, 1, false); - break; - case 300: - this.ExactLevelUp(0, 2, false); - break; - case 600: - this.ExactLevelUp(0, 3, false); - break; - case 1000: - this.ExactLevelUp(0, 4, false); - break; - case 1500: - this.ExactLevelUp(0, 5, false); - break; - case 2100: - this.ExactLevelUp(0, 6, false); - break; - case 2800: - this.ExactLevelUp(0, 7, false); - break; - case 3600: - this.ExactLevelUp(0, 8, false); - break; - case 4500: - this.ExactLevelUp(0, 9, false); - break; - case 5500: - this.ExactLevelUp(0, 10, false); - break; - case 6600: - this.ExactLevelUp(0, 11, false); - break; - case 7800: - this.ExactLevelUp(0, 12, false); - break; - case 9100: - this.ExactLevelUp(0, 13, false); - break; - case 10500: - this.ExactLevelUp(0, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(0, 15, true); - break; - default: - break; - } - #endregion + #region MeleeLevels + switch (meleeLevel) + { + case 100: + this.ExactLevelUp(0, 1, false); + break; + case 300: + this.ExactLevelUp(0, 2, false); + break; + case 600: + this.ExactLevelUp(0, 3, false); + break; + case 1000: + this.ExactLevelUp(0, 4, false); + break; + case 1500: + this.ExactLevelUp(0, 5, false); + break; + case 2100: + this.ExactLevelUp(0, 6, false); + break; + case 2800: + this.ExactLevelUp(0, 7, false); + break; + case 3600: + this.ExactLevelUp(0, 8, false); + break; + case 4500: + this.ExactLevelUp(0, 9, false); + break; + case 5500: + this.ExactLevelUp(0, 10, false); + break; + case 6600: + this.ExactLevelUp(0, 11, false); + break; + case 7800: + this.ExactLevelUp(0, 12, false); + break; + case 9100: + this.ExactLevelUp(0, 13, false); + break; + case 10500: + this.ExactLevelUp(0, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(0, 15, true); + break; + default: + break; + } + #endregion - #region RangedLevels - switch (rangedLevel) - { - case 100: - this.ExactLevelUp(1, 1, false); - break; - case 300: - this.ExactLevelUp(1, 2, false); - break; - case 600: - this.ExactLevelUp(1, 3, false); - break; - case 1000: - this.ExactLevelUp(1, 4, false); - break; - case 1500: - this.ExactLevelUp(1, 5, false); - break; - case 2100: - this.ExactLevelUp(1, 6, false); - break; - case 2800: - this.ExactLevelUp(1, 7, false); - break; - case 3600: - this.ExactLevelUp(1, 8, false); - break; - case 4500: - this.ExactLevelUp(1, 9, false); - break; - case 5500: - this.ExactLevelUp(1, 10, false); - break; - case 6600: - this.ExactLevelUp(1, 11, false); - break; - case 7800: - this.ExactLevelUp(1, 12, false); - break; - case 9100: - this.ExactLevelUp(1, 13, false); - break; - case 10500: - this.ExactLevelUp(1, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(1, 15, true); - break; - default: - break; - } - #endregion + #region RangedLevels + switch (rangedLevel) + { + case 100: + this.ExactLevelUp(1, 1, false); + break; + case 300: + this.ExactLevelUp(1, 2, false); + break; + case 600: + this.ExactLevelUp(1, 3, false); + break; + case 1000: + this.ExactLevelUp(1, 4, false); + break; + case 1500: + this.ExactLevelUp(1, 5, false); + break; + case 2100: + this.ExactLevelUp(1, 6, false); + break; + case 2800: + this.ExactLevelUp(1, 7, false); + break; + case 3600: + this.ExactLevelUp(1, 8, false); + break; + case 4500: + this.ExactLevelUp(1, 9, false); + break; + case 5500: + this.ExactLevelUp(1, 10, false); + break; + case 6600: + this.ExactLevelUp(1, 11, false); + break; + case 7800: + this.ExactLevelUp(1, 12, false); + break; + case 9100: + this.ExactLevelUp(1, 13, false); + break; + case 10500: + this.ExactLevelUp(1, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(1, 15, true); + break; + default: + break; + } + #endregion - #region MagicLevels - switch (magicLevel) - { - case 100: - this.ExactLevelUp(2, 1, false); - break; - case 300: - this.ExactLevelUp(2, 2, false); - break; - case 600: - this.ExactLevelUp(2, 3, false); - break; - case 1000: - this.ExactLevelUp(2, 4, false); - break; - case 1500: - this.ExactLevelUp(2, 5, false); - break; - case 2100: - this.ExactLevelUp(2, 6, false); - break; - case 2800: - this.ExactLevelUp(2, 7, false); - break; - case 3600: - this.ExactLevelUp(2, 8, false); - break; - case 4500: - this.ExactLevelUp(2, 9, false); - break; - case 5500: - this.ExactLevelUp(2, 10, false); - break; - case 6600: - this.ExactLevelUp(2, 11, false); - break; - case 7800: - this.ExactLevelUp(2, 12, false); - break; - case 9100: - this.ExactLevelUp(2, 13, false); - break; - case 10500: - this.ExactLevelUp(2, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(2, 15, true); - break; - default: - break; - } - #endregion + #region MagicLevels + switch (magicLevel) + { + case 100: + this.ExactLevelUp(2, 1, false); + break; + case 300: + this.ExactLevelUp(2, 2, false); + break; + case 600: + this.ExactLevelUp(2, 3, false); + break; + case 1000: + this.ExactLevelUp(2, 4, false); + break; + case 1500: + this.ExactLevelUp(2, 5, false); + break; + case 2100: + this.ExactLevelUp(2, 6, false); + break; + case 2800: + this.ExactLevelUp(2, 7, false); + break; + case 3600: + this.ExactLevelUp(2, 8, false); + break; + case 4500: + this.ExactLevelUp(2, 9, false); + break; + case 5500: + this.ExactLevelUp(2, 10, false); + break; + case 6600: + this.ExactLevelUp(2, 11, false); + break; + case 7800: + this.ExactLevelUp(2, 12, false); + break; + case 9100: + this.ExactLevelUp(2, 13, false); + break; + case 10500: + this.ExactLevelUp(2, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(2, 15, true); + break; + default: + break; + } + #endregion - #region SummonLevels - switch (summonLevel) - { - case 100: - this.ExactLevelUp(3, 1, false); - break; - case 300: - this.ExactLevelUp(3, 2, false); - break; - case 600: - this.ExactLevelUp(3, 3, false); - break; - case 1000: - this.ExactLevelUp(3, 4, false); - break; - case 1500: - this.ExactLevelUp(3, 5, false); - break; - case 2100: - this.ExactLevelUp(3, 6, false); - break; - case 2800: - this.ExactLevelUp(3, 7, false); - break; - case 3600: - this.ExactLevelUp(3, 8, false); - break; - case 4500: - this.ExactLevelUp(3, 9, false); - break; - case 5500: - this.ExactLevelUp(3, 10, false); - break; - case 6600: - this.ExactLevelUp(3, 11, false); - break; - case 7800: - this.ExactLevelUp(3, 12, false); - break; - case 9100: - this.ExactLevelUp(3, 13, false); - break; - case 10500: - this.ExactLevelUp(3, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(3, 15, true); - break; - default: - break; - } - #endregion + #region SummonLevels + switch (summonLevel) + { + case 100: + this.ExactLevelUp(3, 1, false); + break; + case 300: + this.ExactLevelUp(3, 2, false); + break; + case 600: + this.ExactLevelUp(3, 3, false); + break; + case 1000: + this.ExactLevelUp(3, 4, false); + break; + case 1500: + this.ExactLevelUp(3, 5, false); + break; + case 2100: + this.ExactLevelUp(3, 6, false); + break; + case 2800: + this.ExactLevelUp(3, 7, false); + break; + case 3600: + this.ExactLevelUp(3, 8, false); + break; + case 4500: + this.ExactLevelUp(3, 9, false); + break; + case 5500: + this.ExactLevelUp(3, 10, false); + break; + case 6600: + this.ExactLevelUp(3, 11, false); + break; + case 7800: + this.ExactLevelUp(3, 12, false); + break; + case 9100: + this.ExactLevelUp(3, 13, false); + break; + case 10500: + this.ExactLevelUp(3, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(3, 15, true); + break; + default: + break; + } + #endregion - #region RogueLevels - switch (rogueLevel) - { - case 100: - this.ExactLevelUp(4, 1, false); - break; - case 300: - this.ExactLevelUp(4, 2, false); - break; - case 600: - this.ExactLevelUp(4, 3, false); - break; - case 1000: - this.ExactLevelUp(4, 4, false); - break; - case 1500: - this.ExactLevelUp(4, 5, false); - break; - case 2100: - this.ExactLevelUp(4, 6, false); - break; - case 2800: - this.ExactLevelUp(4, 7, false); - break; - case 3600: - this.ExactLevelUp(4, 8, false); - break; - case 4500: - this.ExactLevelUp(4, 9, false); - break; - case 5500: - this.ExactLevelUp(4, 10, false); - break; - case 6600: - this.ExactLevelUp(4, 11, false); - break; - case 7800: - this.ExactLevelUp(4, 12, false); - break; - case 9100: - this.ExactLevelUp(4, 13, false); - break; - case 10500: - this.ExactLevelUp(4, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(4, 15, true); - break; - default: - break; - } - #endregion - } + #region RogueLevels + switch (rogueLevel) + { + case 100: + this.ExactLevelUp(4, 1, false); + break; + case 300: + this.ExactLevelUp(4, 2, false); + break; + case 600: + this.ExactLevelUp(4, 3, false); + break; + case 1000: + this.ExactLevelUp(4, 4, false); + break; + case 1500: + this.ExactLevelUp(4, 5, false); + break; + case 2100: + this.ExactLevelUp(4, 6, false); + break; + case 2800: + this.ExactLevelUp(4, 7, false); + break; + case 3600: + this.ExactLevelUp(4, 8, false); + break; + case 4500: + this.ExactLevelUp(4, 9, false); + break; + case 5500: + this.ExactLevelUp(4, 10, false); + break; + case 6600: + this.ExactLevelUp(4, 11, false); + break; + case 7800: + this.ExactLevelUp(4, 12, false); + break; + case 9100: + this.ExactLevelUp(4, 13, false); + break; + case 10500: + this.ExactLevelUp(4, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(4, 15, true); + break; + default: + break; + } + #endregion + } - private void ExactLevelUp(int levelUpType, int level, bool final) - { - Color messageColor = Color.Orange; - switch (levelUpType) - { - case 0: - exactMeleeLevel = level; - if (shootFireworksLevelUpMelee) - { - string key = (final ? "Mods.CalamityMod.MeleeLevelUpFinal" : "Mods.CalamityMod.MeleeLevelUp"); - shootFireworksLevelUpMelee = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 1: - exactRangedLevel = level; - if (shootFireworksLevelUpRanged) - { - string key = (final ? "Mods.CalamityMod.RangedLevelUpFinal" : "Mods.CalamityMod.RangedLevelUp"); - messageColor = Color.GreenYellow; - shootFireworksLevelUpRanged = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 2: - exactMagicLevel = level; - if (shootFireworksLevelUpMagic) - { - string key = (final ? "Mods.CalamityMod.MagicLevelUpFinal" : "Mods.CalamityMod.MagicLevelUp"); - messageColor = Color.DodgerBlue; - shootFireworksLevelUpMagic = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 3: - exactSummonLevel = level; - if (shootFireworksLevelUpSummon) - { - string key = (final ? "Mods.CalamityMod.SummonLevelUpFinal" : "Mods.CalamityMod.SummonLevelUp"); - messageColor = Color.Aquamarine; - shootFireworksLevelUpSummon = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 4: - exactRogueLevel = level; - if (shootFireworksLevelUpRogue) - { - string key = (final ? "Mods.CalamityMod.RogueLevelUpFinal" : "Mods.CalamityMod.RogueLevelUp"); - messageColor = Color.Orchid; - shootFireworksLevelUpRogue = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - ExactLevelPacket(false, levelUpType); - } - } + private void ExactLevelUp(int levelUpType, int level, bool final) + { + Color messageColor = Color.Orange; + switch (levelUpType) + { + case 0: + exactMeleeLevel = level; + if (shootFireworksLevelUpMelee) + { + string key = (final ? "Mods.CalamityMod.MeleeLevelUpFinal" : "Mods.CalamityMod.MeleeLevelUp"); + shootFireworksLevelUpMelee = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 1: + exactRangedLevel = level; + if (shootFireworksLevelUpRanged) + { + string key = (final ? "Mods.CalamityMod.RangedLevelUpFinal" : "Mods.CalamityMod.RangedLevelUp"); + messageColor = Color.GreenYellow; + shootFireworksLevelUpRanged = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 2: + exactMagicLevel = level; + if (shootFireworksLevelUpMagic) + { + string key = (final ? "Mods.CalamityMod.MagicLevelUpFinal" : "Mods.CalamityMod.MagicLevelUp"); + messageColor = Color.DodgerBlue; + shootFireworksLevelUpMagic = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 3: + exactSummonLevel = level; + if (shootFireworksLevelUpSummon) + { + string key = (final ? "Mods.CalamityMod.SummonLevelUpFinal" : "Mods.CalamityMod.SummonLevelUp"); + messageColor = Color.Aquamarine; + shootFireworksLevelUpSummon = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 4: + exactRogueLevel = level; + if (shootFireworksLevelUpRogue) + { + string key = (final ? "Mods.CalamityMod.RogueLevelUpFinal" : "Mods.CalamityMod.RogueLevelUp"); + messageColor = Color.Orchid; + shootFireworksLevelUpRogue = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + ExactLevelPacket(false, levelUpType); + } + } - private void GetStatBonuses() - { - #region MeleeLevelBoosts - if (meleeLevel >= 12500) - { - player.meleeDamage += 0.12f; - player.meleeCrit += 6; - } - else if (meleeLevel >= 10500) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - } - else if (meleeLevel >= 9100) - { - player.meleeDamage += 0.09f; - player.meleeCrit += 5; - } - else if (meleeLevel >= 7800) - { - player.meleeDamage += 0.08f; - player.meleeCrit += 4; - } - else if (meleeLevel >= 6600) - { - player.meleeDamage += 0.07f; - player.meleeCrit += 4; - } - else if (meleeLevel >= 5500) //hm limit - { - player.meleeDamage += 0.06f; - player.meleeCrit += 3; - } - else if (meleeLevel >= 4500) - { - player.meleeDamage += 0.05f; - player.meleeCrit += 3; - } - else if (meleeLevel >= 3600) - { - player.meleeDamage += 0.05f; - player.meleeCrit += 2; - } - else if (meleeLevel >= 2800) - { - player.meleeDamage += 0.04f; - player.meleeCrit += 2; - } - else if (meleeLevel >= 2100) - { - player.meleeDamage += 0.04f; - player.meleeCrit += 1; - } - else if (meleeLevel >= 1500) //prehm limit - { - player.meleeDamage += 0.03f; - player.meleeCrit += 1; - } - else if (meleeLevel >= 1000) - { - player.meleeDamage += 0.03f; - player.meleeCrit += 1; - } - else if (meleeLevel >= 600) - { - player.meleeDamage += 0.02f; - } - else if (meleeLevel >= 300) - player.meleeDamage += 0.02f; - else if (meleeLevel >= 100) - player.meleeDamage += 0.01f; - #endregion + private void GetStatBonuses() + { + #region MeleeLevelBoosts + if (meleeLevel >= 12500) + { + player.meleeDamage += 0.12f; + player.meleeCrit += 6; + } + else if (meleeLevel >= 10500) + { + player.meleeDamage += 0.1f; + player.meleeCrit += 5; + } + else if (meleeLevel >= 9100) + { + player.meleeDamage += 0.09f; + player.meleeCrit += 5; + } + else if (meleeLevel >= 7800) + { + player.meleeDamage += 0.08f; + player.meleeCrit += 4; + } + else if (meleeLevel >= 6600) + { + player.meleeDamage += 0.07f; + player.meleeCrit += 4; + } + else if (meleeLevel >= 5500) //hm limit + { + player.meleeDamage += 0.06f; + player.meleeCrit += 3; + } + else if (meleeLevel >= 4500) + { + player.meleeDamage += 0.05f; + player.meleeCrit += 3; + } + else if (meleeLevel >= 3600) + { + player.meleeDamage += 0.05f; + player.meleeCrit += 2; + } + else if (meleeLevel >= 2800) + { + player.meleeDamage += 0.04f; + player.meleeCrit += 2; + } + else if (meleeLevel >= 2100) + { + player.meleeDamage += 0.04f; + player.meleeCrit += 1; + } + else if (meleeLevel >= 1500) //prehm limit + { + player.meleeDamage += 0.03f; + player.meleeCrit += 1; + } + else if (meleeLevel >= 1000) + { + player.meleeDamage += 0.03f; + player.meleeCrit += 1; + } + else if (meleeLevel >= 600) + { + player.meleeDamage += 0.02f; + } + else if (meleeLevel >= 300) + player.meleeDamage += 0.02f; + else if (meleeLevel >= 100) + player.meleeDamage += 0.01f; + #endregion - #region RangedLevelBoosts - if (rangedLevel >= 12500) - { - player.rangedDamage += 0.12f; - player.moveSpeed += 0.12f; - player.rangedCrit += 6; - } - else if (rangedLevel >= 10500) - { - player.rangedDamage += 0.1f; - player.moveSpeed += 0.1f; - player.rangedCrit += 5; - } - else if (rangedLevel >= 9100) - { - player.rangedDamage += 0.09f; - player.moveSpeed += 0.09f; - player.rangedCrit += 5; - } - else if (rangedLevel >= 7800) - { - player.rangedDamage += 0.08f; - player.moveSpeed += 0.08f; - player.rangedCrit += 4; - } - else if (rangedLevel >= 6600) - { - player.rangedDamage += 0.07f; - player.moveSpeed += 0.07f; - player.rangedCrit += 4; - } - else if (rangedLevel >= 5500) - { - player.rangedDamage += 0.06f; - player.moveSpeed += 0.06f; - player.rangedCrit += 3; - } - else if (rangedLevel >= 4500) - { - player.rangedDamage += 0.05f; - player.moveSpeed += 0.05f; - player.rangedCrit += 3; - } - else if (rangedLevel >= 3600) - { - player.rangedDamage += 0.05f; - player.moveSpeed += 0.05f; - player.rangedCrit += 2; - } - else if (rangedLevel >= 2800) - { - player.rangedDamage += 0.04f; - player.moveSpeed += 0.04f; - player.rangedCrit += 2; - } - else if (rangedLevel >= 2100) - { - player.rangedDamage += 0.04f; - player.moveSpeed += 0.03f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 1500) - { - player.rangedDamage += 0.03f; - player.moveSpeed += 0.02f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 1000) - { - player.rangedDamage += 0.03f; - player.moveSpeed += 0.01f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 600) - { - player.rangedDamage += 0.02f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 300) - player.rangedDamage += 0.02f; - else if (rangedLevel >= 100) - player.rangedDamage += 0.01f; - #endregion + #region RangedLevelBoosts + if (rangedLevel >= 12500) + { + player.rangedDamage += 0.12f; + player.moveSpeed += 0.12f; + player.rangedCrit += 6; + } + else if (rangedLevel >= 10500) + { + player.rangedDamage += 0.1f; + player.moveSpeed += 0.1f; + player.rangedCrit += 5; + } + else if (rangedLevel >= 9100) + { + player.rangedDamage += 0.09f; + player.moveSpeed += 0.09f; + player.rangedCrit += 5; + } + else if (rangedLevel >= 7800) + { + player.rangedDamage += 0.08f; + player.moveSpeed += 0.08f; + player.rangedCrit += 4; + } + else if (rangedLevel >= 6600) + { + player.rangedDamage += 0.07f; + player.moveSpeed += 0.07f; + player.rangedCrit += 4; + } + else if (rangedLevel >= 5500) + { + player.rangedDamage += 0.06f; + player.moveSpeed += 0.06f; + player.rangedCrit += 3; + } + else if (rangedLevel >= 4500) + { + player.rangedDamage += 0.05f; + player.moveSpeed += 0.05f; + player.rangedCrit += 3; + } + else if (rangedLevel >= 3600) + { + player.rangedDamage += 0.05f; + player.moveSpeed += 0.05f; + player.rangedCrit += 2; + } + else if (rangedLevel >= 2800) + { + player.rangedDamage += 0.04f; + player.moveSpeed += 0.04f; + player.rangedCrit += 2; + } + else if (rangedLevel >= 2100) + { + player.rangedDamage += 0.04f; + player.moveSpeed += 0.03f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 1500) + { + player.rangedDamage += 0.03f; + player.moveSpeed += 0.02f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 1000) + { + player.rangedDamage += 0.03f; + player.moveSpeed += 0.01f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 600) + { + player.rangedDamage += 0.02f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 300) + player.rangedDamage += 0.02f; + else if (rangedLevel >= 100) + player.rangedDamage += 0.01f; + #endregion - #region MagicLevelBoosts - if (magicLevel >= 12500) - { - player.magicDamage += 0.12f; - player.manaCost *= 0.88f; - player.magicCrit += 6; - } - else if (magicLevel >= 10500) - { - player.magicDamage += 0.1f; - player.manaCost *= 0.9f; - player.magicCrit += 5; - } - else if (magicLevel >= 9100) - { - player.magicDamage += 0.09f; - player.manaCost *= 0.91f; - player.magicCrit += 5; - } - else if (magicLevel >= 7800) - { - player.magicDamage += 0.08f; - player.manaCost *= 0.92f; - player.magicCrit += 4; - } - else if (magicLevel >= 6600) - { - player.magicDamage += 0.07f; - player.manaCost *= 0.93f; - player.magicCrit += 4; - } - else if (magicLevel >= 5500) - { - player.magicDamage += 0.06f; - player.manaCost *= 0.94f; - player.magicCrit += 3; - } - else if (magicLevel >= 4500) - { - player.magicDamage += 0.05f; - player.manaCost *= 0.95f; - player.magicCrit += 3; - } - else if (magicLevel >= 3600) - { - player.magicDamage += 0.05f; - player.manaCost *= 0.95f; - player.magicCrit += 2; - } - else if (magicLevel >= 2800) - { - player.magicDamage += 0.04f; - player.manaCost *= 0.96f; - player.magicCrit += 2; - } - else if (magicLevel >= 2100) - { - player.magicDamage += 0.04f; - player.manaCost *= 0.97f; - player.magicCrit += 1; - } - else if (magicLevel >= 1500) - { - player.magicDamage += 0.03f; - player.manaCost *= 0.98f; - player.magicCrit += 1; - } - else if (magicLevel >= 1000) - { - player.magicDamage += 0.03f; - player.manaCost *= 0.99f; - player.magicCrit += 1; - } - else if (magicLevel >= 600) - { - player.magicDamage += 0.02f; - player.manaCost *= 0.99f; - } - else if (magicLevel >= 300) - player.magicDamage += 0.02f; - else if (magicLevel >= 100) - player.magicDamage += 0.01f; - #endregion + #region MagicLevelBoosts + if (magicLevel >= 12500) + { + player.magicDamage += 0.12f; + player.manaCost *= 0.88f; + player.magicCrit += 6; + } + else if (magicLevel >= 10500) + { + player.magicDamage += 0.1f; + player.manaCost *= 0.9f; + player.magicCrit += 5; + } + else if (magicLevel >= 9100) + { + player.magicDamage += 0.09f; + player.manaCost *= 0.91f; + player.magicCrit += 5; + } + else if (magicLevel >= 7800) + { + player.magicDamage += 0.08f; + player.manaCost *= 0.92f; + player.magicCrit += 4; + } + else if (magicLevel >= 6600) + { + player.magicDamage += 0.07f; + player.manaCost *= 0.93f; + player.magicCrit += 4; + } + else if (magicLevel >= 5500) + { + player.magicDamage += 0.06f; + player.manaCost *= 0.94f; + player.magicCrit += 3; + } + else if (magicLevel >= 4500) + { + player.magicDamage += 0.05f; + player.manaCost *= 0.95f; + player.magicCrit += 3; + } + else if (magicLevel >= 3600) + { + player.magicDamage += 0.05f; + player.manaCost *= 0.95f; + player.magicCrit += 2; + } + else if (magicLevel >= 2800) + { + player.magicDamage += 0.04f; + player.manaCost *= 0.96f; + player.magicCrit += 2; + } + else if (magicLevel >= 2100) + { + player.magicDamage += 0.04f; + player.manaCost *= 0.97f; + player.magicCrit += 1; + } + else if (magicLevel >= 1500) + { + player.magicDamage += 0.03f; + player.manaCost *= 0.98f; + player.magicCrit += 1; + } + else if (magicLevel >= 1000) + { + player.magicDamage += 0.03f; + player.manaCost *= 0.99f; + player.magicCrit += 1; + } + else if (magicLevel >= 600) + { + player.magicDamage += 0.02f; + player.manaCost *= 0.99f; + } + else if (magicLevel >= 300) + player.magicDamage += 0.02f; + else if (magicLevel >= 100) + player.magicDamage += 0.01f; + #endregion - #region SummonLevelBoosts - if (summonLevel >= 12500) - { - player.minionDamage += 0.12f; - player.minionKB += 3.0f; - player.maxMinions += 3; - } - else if (summonLevel >= 10500) - { - player.minionDamage += 0.1f; - player.minionKB += 3.0f; - player.maxMinions += 2; - } - else if (summonLevel >= 9100) - { - player.minionDamage += 0.09f; - player.minionKB += 2.7f; - player.maxMinions += 2; - } - else if (summonLevel >= 7800) - { - player.minionDamage += 0.08f; - player.minionKB += 2.4f; - player.maxMinions += 2; - } - else if (summonLevel >= 6600) - { - player.minionDamage += 0.07f; - player.minionKB += 2.1f; - player.maxMinions += 2; - } - else if (summonLevel >= 5500) - { - player.minionDamage += 0.06f; - player.minionKB += 1.8f; - player.maxMinions += 2; - } - else if (summonLevel >= 4500) - { - player.minionDamage += 0.06f; - player.minionKB += 1.8f; - player.maxMinions++; - } - else if (summonLevel >= 3600) - { - player.minionDamage += 0.05f; - player.minionKB += 1.5f; - player.maxMinions++; - } - else if (summonLevel >= 2800) - { - player.minionDamage += 0.04f; - player.minionKB += 1.2f; - player.maxMinions++; - } - else if (summonLevel >= 2100) - { - player.minionDamage += 0.04f; - player.minionKB += 0.9f; - player.maxMinions++; - } - else if (summonLevel >= 1500) - { - player.minionDamage += 0.03f; - player.minionKB += 0.6f; - } - else if (summonLevel >= 1000) - { - player.minionDamage += 0.03f; - player.minionKB += 0.3f; - } - else if (summonLevel >= 600) - { - player.minionDamage += 0.02f; - player.minionKB += 0.3f; - } - else if (summonLevel >= 300) - player.minionDamage += 0.02f; - else if (summonLevel >= 100) - player.minionDamage += 0.01f; - #endregion + #region SummonLevelBoosts + if (summonLevel >= 12500) + { + player.minionDamage += 0.12f; + player.minionKB += 3.0f; + player.maxMinions += 3; + } + else if (summonLevel >= 10500) + { + player.minionDamage += 0.1f; + player.minionKB += 3.0f; + player.maxMinions += 2; + } + else if (summonLevel >= 9100) + { + player.minionDamage += 0.09f; + player.minionKB += 2.7f; + player.maxMinions += 2; + } + else if (summonLevel >= 7800) + { + player.minionDamage += 0.08f; + player.minionKB += 2.4f; + player.maxMinions += 2; + } + else if (summonLevel >= 6600) + { + player.minionDamage += 0.07f; + player.minionKB += 2.1f; + player.maxMinions += 2; + } + else if (summonLevel >= 5500) + { + player.minionDamage += 0.06f; + player.minionKB += 1.8f; + player.maxMinions += 2; + } + else if (summonLevel >= 4500) + { + player.minionDamage += 0.06f; + player.minionKB += 1.8f; + player.maxMinions++; + } + else if (summonLevel >= 3600) + { + player.minionDamage += 0.05f; + player.minionKB += 1.5f; + player.maxMinions++; + } + else if (summonLevel >= 2800) + { + player.minionDamage += 0.04f; + player.minionKB += 1.2f; + player.maxMinions++; + } + else if (summonLevel >= 2100) + { + player.minionDamage += 0.04f; + player.minionKB += 0.9f; + player.maxMinions++; + } + else if (summonLevel >= 1500) + { + player.minionDamage += 0.03f; + player.minionKB += 0.6f; + } + else if (summonLevel >= 1000) + { + player.minionDamage += 0.03f; + player.minionKB += 0.3f; + } + else if (summonLevel >= 600) + { + player.minionDamage += 0.02f; + player.minionKB += 0.3f; + } + else if (summonLevel >= 300) + player.minionDamage += 0.02f; + else if (summonLevel >= 100) + player.minionDamage += 0.01f; + #endregion - #region RogueLevelBoosts - if (rogueLevel >= 12500) - { - player.Calamity().throwingDamage += 0.12f; - player.Calamity().throwingVelocity += 0.12f; - player.Calamity().throwingCrit += 6; - } - else if (rogueLevel >= 10500) - { - player.Calamity().throwingDamage += 0.1f; - player.Calamity().throwingVelocity += 0.1f; - player.Calamity().throwingCrit += 5; - } - else if (rogueLevel >= 9100) - { - player.Calamity().throwingDamage += 0.09f; - player.Calamity().throwingVelocity += 0.09f; - player.Calamity().throwingCrit += 5; - } - else if (rogueLevel >= 7800) - { - player.Calamity().throwingDamage += 0.08f; - player.Calamity().throwingVelocity += 0.08f; - player.Calamity().throwingCrit += 4; - } - else if (rogueLevel >= 6600) - { - player.Calamity().throwingDamage += 0.07f; - player.Calamity().throwingVelocity += 0.07f; - player.Calamity().throwingCrit += 4; - } - else if (rogueLevel >= 5500) - { - player.Calamity().throwingDamage += 0.06f; - player.Calamity().throwingVelocity += 0.06f; - player.Calamity().throwingCrit += 3; - } - else if (rogueLevel >= 4500) - { - player.Calamity().throwingDamage += 0.05f; - player.Calamity().throwingVelocity += 0.05f; - player.Calamity().throwingCrit += 3; - } - else if (rogueLevel >= 3600) - { - player.Calamity().throwingDamage += 0.05f; - player.Calamity().throwingVelocity += 0.05f; - player.Calamity().throwingCrit += 2; - } - else if (rogueLevel >= 2800) - { - player.Calamity().throwingDamage += 0.04f; - player.Calamity().throwingVelocity += 0.04f; - player.Calamity().throwingCrit += 2; - } - else if (rogueLevel >= 2100) - { - player.Calamity().throwingDamage += 0.04f; - player.Calamity().throwingVelocity += 0.03f; - player.Calamity().throwingCrit += 1; - } - else if (rogueLevel >= 1500) - { - player.Calamity().throwingDamage += 0.03f; - player.Calamity().throwingVelocity += 0.02f; - player.Calamity().throwingCrit += 1; - } - else if (rogueLevel >= 1000) - { - player.Calamity().throwingDamage += 0.03f; - player.Calamity().throwingVelocity += 0.01f; - player.Calamity().throwingCrit += 1; - } - else if (rogueLevel >= 600) - { - player.Calamity().throwingDamage += 0.02f; - player.Calamity().throwingVelocity += 0.01f; - } - else if (rogueLevel >= 300) - player.Calamity().throwingDamage += 0.02f; - else if (rogueLevel >= 100) - player.Calamity().throwingDamage += 0.01f; - #endregion - } + #region RogueLevelBoosts + if (rogueLevel >= 12500) + { + player.Calamity().throwingDamage += 0.12f; + player.Calamity().throwingVelocity += 0.12f; + player.Calamity().throwingCrit += 6; + } + else if (rogueLevel >= 10500) + { + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingVelocity += 0.1f; + player.Calamity().throwingCrit += 5; + } + else if (rogueLevel >= 9100) + { + player.Calamity().throwingDamage += 0.09f; + player.Calamity().throwingVelocity += 0.09f; + player.Calamity().throwingCrit += 5; + } + else if (rogueLevel >= 7800) + { + player.Calamity().throwingDamage += 0.08f; + player.Calamity().throwingVelocity += 0.08f; + player.Calamity().throwingCrit += 4; + } + else if (rogueLevel >= 6600) + { + player.Calamity().throwingDamage += 0.07f; + player.Calamity().throwingVelocity += 0.07f; + player.Calamity().throwingCrit += 4; + } + else if (rogueLevel >= 5500) + { + player.Calamity().throwingDamage += 0.06f; + player.Calamity().throwingVelocity += 0.06f; + player.Calamity().throwingCrit += 3; + } + else if (rogueLevel >= 4500) + { + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingVelocity += 0.05f; + player.Calamity().throwingCrit += 3; + } + else if (rogueLevel >= 3600) + { + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingVelocity += 0.05f; + player.Calamity().throwingCrit += 2; + } + else if (rogueLevel >= 2800) + { + player.Calamity().throwingDamage += 0.04f; + player.Calamity().throwingVelocity += 0.04f; + player.Calamity().throwingCrit += 2; + } + else if (rogueLevel >= 2100) + { + player.Calamity().throwingDamage += 0.04f; + player.Calamity().throwingVelocity += 0.03f; + player.Calamity().throwingCrit += 1; + } + else if (rogueLevel >= 1500) + { + player.Calamity().throwingDamage += 0.03f; + player.Calamity().throwingVelocity += 0.02f; + player.Calamity().throwingCrit += 1; + } + else if (rogueLevel >= 1000) + { + player.Calamity().throwingDamage += 0.03f; + player.Calamity().throwingVelocity += 0.01f; + player.Calamity().throwingCrit += 1; + } + else if (rogueLevel >= 600) + { + player.Calamity().throwingDamage += 0.02f; + player.Calamity().throwingVelocity += 0.01f; + } + else if (rogueLevel >= 300) + player.Calamity().throwingDamage += 0.02f; + else if (rogueLevel >= 100) + player.Calamity().throwingDamage += 0.01f; + #endregion + } - private float GetMeleeSpeedBonus() - { - float meleeSpeedBonus = 0f; - if (meleeLevel >= 12500) - { - meleeSpeedBonus += 0.12f; - } - else if (meleeLevel >= 10500) - { - meleeSpeedBonus += 0.1f; - } - else if (meleeLevel >= 9100) - { - meleeSpeedBonus += 0.09f; - } - else if (meleeLevel >= 7800) - { - meleeSpeedBonus += 0.08f; - } - else if (meleeLevel >= 6600) - { - meleeSpeedBonus += 0.07f; - } - else if (meleeLevel >= 5500) //hm limit - { - meleeSpeedBonus += 0.06f; - } - else if (meleeLevel >= 4500) - { - meleeSpeedBonus += 0.05f; - } - else if (meleeLevel >= 3600) - { - meleeSpeedBonus += 0.05f; - } - else if (meleeLevel >= 2800) - { - meleeSpeedBonus += 0.04f; - } - else if (meleeLevel >= 2100) - { - meleeSpeedBonus += 0.03f; - } - else if (meleeLevel >= 1500) //prehm limit - { - meleeSpeedBonus += 0.02f; - } - else if (meleeLevel >= 1000) - { - meleeSpeedBonus += 0.01f; - } - else if (meleeLevel >= 600) - { - meleeSpeedBonus += 0.01f; - } - return meleeSpeedBonus; - } + private float GetMeleeSpeedBonus() + { + float meleeSpeedBonus = 0f; + if (meleeLevel >= 12500) + { + meleeSpeedBonus += 0.12f; + } + else if (meleeLevel >= 10500) + { + meleeSpeedBonus += 0.1f; + } + else if (meleeLevel >= 9100) + { + meleeSpeedBonus += 0.09f; + } + else if (meleeLevel >= 7800) + { + meleeSpeedBonus += 0.08f; + } + else if (meleeLevel >= 6600) + { + meleeSpeedBonus += 0.07f; + } + else if (meleeLevel >= 5500) //hm limit + { + meleeSpeedBonus += 0.06f; + } + else if (meleeLevel >= 4500) + { + meleeSpeedBonus += 0.05f; + } + else if (meleeLevel >= 3600) + { + meleeSpeedBonus += 0.05f; + } + else if (meleeLevel >= 2800) + { + meleeSpeedBonus += 0.04f; + } + else if (meleeLevel >= 2100) + { + meleeSpeedBonus += 0.03f; + } + else if (meleeLevel >= 1500) //prehm limit + { + meleeSpeedBonus += 0.02f; + } + else if (meleeLevel >= 1000) + { + meleeSpeedBonus += 0.01f; + } + else if (meleeLevel >= 600) + { + meleeSpeedBonus += 0.01f; + } + return meleeSpeedBonus; + } #endregion #region Misc Stuff diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 80e7843a99..77f6da2cb7 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -1,572 +1,573 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.CalPlayer { public class CalamityPlayerLifeRegen - { - #region Update Bad Life Regen - public static void CalamityUpdateBadLifeRegen(Player player, Mod mod) - { - Point point = player.Center.ToTileCoordinates(); - CalamityPlayer modPlayer = player.Calamity(); - - //Initial Debuffs - - if (modPlayer.shadowflame) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= 30; - } - - if (modPlayer.wDeath) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.statDefense -= 50; - player.allDamage -= 0.1f; - } - - if (modPlayer.bFlames || modPlayer.aFlames) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= 16; - } - - if (modPlayer.gsInferno || (modPlayer.ZoneCalamity && player.lavaWet)) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= 30; - } - - if (modPlayer.astralInfection) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= 20; - } - - if (modPlayer.ZoneSulphur && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && !modPlayer.aquaticScourgeLore) - { - player.AddBuff(BuffID.Poisoned, 2, true); - modPlayer.pissWaterBoost++; - - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= modPlayer.pissWaterBoost / 200; - - if (player.lifeRegen < -8) - player.lifeRegen = -8; - } - else - modPlayer.pissWaterBoost = 0; - - if (modPlayer.hFlames) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= 20; - } - - if (modPlayer.pFlames) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= 20; - player.blind = true; - player.statDefense -= 8; - player.moveSpeed -= 0.15f; - } - - if (modPlayer.bBlood) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 8; - player.blind = true; - player.statDefense -= 3; - player.moveSpeed += 0.2f; - player.meleeDamage += 0.05f; - player.rangedDamage -= 0.1f; - player.magicDamage -= 0.1f; - } - - if (modPlayer.horror) - { - player.blind = true; - player.statDefense -= 15; - player.moveSpeed -= 0.15f; - } - - if (modPlayer.aCrunch) - { - player.statDefense /= 3; - player.endurance *= 0.33f; - } - - if (modPlayer.vHex) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= 16; - player.blind = true; - player.statDefense -= 30; - player.moveSpeed -= 0.1f; - - if (player.wingTimeMax <= 0) - player.wingTimeMax = 0; - - player.wingTimeMax /= 2; - } - - if (modPlayer.cDepth) - { - if (player.statDefense > 0) - { - int depthDamage = modPlayer.depthCharm ? 9 : 18; - int subtractDefense = (int)((double)player.statDefense * 0.05); //240 defense = 0 damage taken with depth charm - int calcDepthDamage = depthDamage - subtractDefense; - - if (calcDepthDamage < 0) - calcDepthDamage = 0; - - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= calcDepthDamage; - } - } - - // Buffs - - if (modPlayer.tRegen) - player.lifeRegen += 3; - - if (modPlayer.sRegen) - player.lifeRegen += 2; - - if (modPlayer.tarraSet) - { - player.calmed = (modPlayer.tarraMelee ? false : true); - player.lifeMagnet = true; - } - - if (modPlayer.aChicken) - { - player.lifeRegen += 1; - player.statDefense += 5; - player.moveSpeed += 0.1f; - } - - if (modPlayer.cadence) - { - if (player.FindBuffIndex(BuffID.Regeneration) > -1) { player.ClearBuff(BuffID.Regeneration); } - if (player.FindBuffIndex(BuffID.Lifeforce) > -1) { player.ClearBuff(BuffID.Lifeforce); } - player.discount = true; - player.lifeMagnet = true; - player.calmed = true; - player.loveStruck = true; - player.lifeRegen += 5; - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; - } - - if (modPlayer.omniscience) - { - player.detectCreature = true; - player.dangerSense = true; - player.findTreasure = true; - } - - if (modPlayer.aWeapon) - player.moveSpeed += 0.15f; - - if (modPlayer.mushy) - { - player.statDefense += 5; - player.lifeRegen += 1; - } - - if (modPlayer.molten) - player.resistCold = true; - - if (modPlayer.shellBoost) - player.moveSpeed += 0.9f; - - if (modPlayer.celestialJewel || modPlayer.astralArcanum) - { - bool lesserEffect = false; - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); - } - - if (lesserEffect) - { - player.lifeRegen += 1; - player.statDefense += 20; - } - else - { - if (player.lifeRegen < 0) - { - if (player.lifeRegenTime < 1800) - player.lifeRegenTime = 1800; - - player.lifeRegen += 4; - player.statDefense += 20; - } - else - player.lifeRegen += 2; - } - } - else if (modPlayer.crownJewel) - { - bool lesserEffect = false; - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); - } - - if (lesserEffect) - player.statDefense += 10; - else - { - if (player.lifeRegen < 0) - { - if (player.lifeRegenTime < 1800) - player.lifeRegenTime = 1800; - - player.lifeRegen += 2; - player.statDefense += 10; - } - else - player.lifeRegen += 1; - } - } - - if (modPlayer.permafrostsConcoction) - { - if (player.statLife < player.statLifeMax2 / 2) - player.lifeRegen++; - if (player.statLife < player.statLifeMax2 / 4) - player.lifeRegen++; - if (player.statLife < player.statLifeMax2 / 10) - player.lifeRegen += 2; - - if (player.poisoned || player.onFire || modPlayer.bFlames) - player.lifeRegen += 4; - } - - // Last Debuffs - - if (modPlayer.omegaBlueChestplate) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - - if (player.lifeRegenCount > 0) - player.lifeRegenCount = 0; - } - - if (Config.LethalLava) - { - if (Main.myPlayer == player.whoAmI) - { - if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) - { - if (player.lavaImmune && !player.immune) - { - if (player.lavaTime > 0) - player.lavaTime--; - } - - if (player.lavaTime <= 0) - player.AddBuff(mod.BuffType("LethalLavaBurn"), 2, true); - } - } - - if (modPlayer.lethalLavaBurn) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - int lifeRegenDown = (player.lavaImmune ? 9 : 18); - - if (player.lavaRose) - lifeRegenDown = 3; - - player.lifeRegen -= lifeRegenDown; - } - } - - if (modPlayer.hInferno) - { - modPlayer.hInfernoBoost++; - - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - player.lifeRegen -= modPlayer.hInfernoBoost; - - if (player.lifeRegen < -200) - player.lifeRegen = -200; - } - else - modPlayer.hInfernoBoost = 0; - - if (modPlayer.gState) - { - player.statDefense /= 2; - player.velocity.Y = 0f; - player.velocity.X = 0f; - } - - if (modPlayer.eGravity) - { - if (player.wingTimeMax < 0) - player.wingTimeMax = 0; - - if (player.wingTimeMax > 400) - player.wingTimeMax = 400; - - player.wingTimeMax /= 4; - } - - if (modPlayer.eGrav) - { - if (player.wingTimeMax < 0) - player.wingTimeMax = 0; - - if (player.wingTimeMax > 400) - player.wingTimeMax = 400; - - player.wingTimeMax /= 2; - } - - if (modPlayer.molluskSet) - player.velocity.X *= 0.985f; - - if ((modPlayer.warped || modPlayer.caribbeanRum) && !player.slowFall) - player.velocity.Y *= 1.01f; - - if (modPlayer.weakPetrification || CalamityWorld.bossRushActive) - { - if (player.mount.Active) - player.mount.Dismount(player); - } - - if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) - { - if (player.lifeRegen < 0) - player.lifeRegen = 0; - } - } - #endregion - - #region Update Life Regen - public static void CalamityUpdateLifeRegen(Player player, Mod mod) - { - CalamityPlayer modPlayer = player.Calamity(); - - if (!player.shinyStone) - { - int lifeRegenTimeMaxBoost = (CalamityPlayer.areThereAnyDamnBosses ? 450 : 1800); - int lifeRegenMaxBoost = (CalamityPlayer.areThereAnyDamnBosses ? 1 : 4); - float lifeRegenLifeRegenTimeMaxBoost = (CalamityPlayer.areThereAnyDamnBosses ? 8f : 30f); - - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (modPlayer.shadeRegen) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; - - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - - float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30))) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.cFreeze) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; - - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - - float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30))) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.draedonsHeart) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; - - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - - float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2))) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.photosynthesis) - { - int lifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenTimeMaxBoost : (lifeRegenTimeMaxBoost / 5); - int lifeRegenMaxBoost2 = Main.dayTime ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); - float lifeRegenLifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); - - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) - player.lifeRegenTime = lifeRegenTimeMaxBoost2; - - player.lifeRegenTime += lifeRegenMaxBoost2; - player.lifeRegen += lifeRegenMaxBoost2; - - float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost2) - num3 = lifeRegenLifeRegenTimeMaxBoost2; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2))) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - } - } - } - #endregion - } + { + #region Update Bad Life Regen + public static void CalamityUpdateBadLifeRegen(Player player, Mod mod) + { + Point point = player.Center.ToTileCoordinates(); + CalamityPlayer modPlayer = player.Calamity(); + + //Initial Debuffs + + if (modPlayer.shadowflame) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= 30; + } + + if (modPlayer.wDeath) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.statDefense -= 50; + player.allDamage -= 0.1f; + } + + if (modPlayer.bFlames || modPlayer.aFlames) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= 16; + } + + if (modPlayer.gsInferno || (modPlayer.ZoneCalamity && player.lavaWet)) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= 30; + } + + if (modPlayer.astralInfection) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= 20; + } + + if (modPlayer.ZoneSulphur && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && !modPlayer.aquaticScourgeLore) + { + player.AddBuff(BuffID.Poisoned, 2, true); + modPlayer.pissWaterBoost++; + + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= modPlayer.pissWaterBoost / 200; + + if (player.lifeRegen < -8) + player.lifeRegen = -8; + } + else + modPlayer.pissWaterBoost = 0; + + if (modPlayer.hFlames) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= 20; + } + + if (modPlayer.pFlames) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= 20; + player.blind = true; + player.statDefense -= 8; + player.moveSpeed -= 0.15f; + } + + if (modPlayer.bBlood) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 8; + player.blind = true; + player.statDefense -= 3; + player.moveSpeed += 0.2f; + player.meleeDamage += 0.05f; + player.rangedDamage -= 0.1f; + player.magicDamage -= 0.1f; + } + + if (modPlayer.horror) + { + player.blind = true; + player.statDefense -= 15; + player.moveSpeed -= 0.15f; + } + + if (modPlayer.aCrunch) + { + player.statDefense /= 3; + player.endurance *= 0.33f; + } + + if (modPlayer.vHex) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= 16; + player.blind = true; + player.statDefense -= 30; + player.moveSpeed -= 0.1f; + + if (player.wingTimeMax <= 0) + player.wingTimeMax = 0; + + player.wingTimeMax /= 2; + } + + if (modPlayer.cDepth) + { + if (player.statDefense > 0) + { + int depthDamage = modPlayer.depthCharm ? 9 : 18; + int subtractDefense = (int)((double)player.statDefense * 0.05); //240 defense = 0 damage taken with depth charm + int calcDepthDamage = depthDamage - subtractDefense; + + if (calcDepthDamage < 0) + calcDepthDamage = 0; + + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= calcDepthDamage; + } + } + + // Buffs + + if (modPlayer.tRegen) + player.lifeRegen += 3; + + if (modPlayer.sRegen) + player.lifeRegen += 2; + + if (modPlayer.tarraSet) + { + player.calmed = (modPlayer.tarraMelee ? false : true); + player.lifeMagnet = true; + } + + if (modPlayer.aChicken) + { + player.lifeRegen += 1; + player.statDefense += 5; + player.moveSpeed += 0.1f; + } + + if (modPlayer.cadence) + { + if (player.FindBuffIndex(BuffID.Regeneration) > -1) + { player.ClearBuff(BuffID.Regeneration); } + if (player.FindBuffIndex(BuffID.Lifeforce) > -1) + { player.ClearBuff(BuffID.Lifeforce); } + player.discount = true; + player.lifeMagnet = true; + player.calmed = true; + player.loveStruck = true; + player.lifeRegen += 5; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; + } + + if (modPlayer.omniscience) + { + player.detectCreature = true; + player.dangerSense = true; + player.findTreasure = true; + } + + if (modPlayer.aWeapon) + player.moveSpeed += 0.15f; + + if (modPlayer.mushy) + { + player.statDefense += 5; + player.lifeRegen += 1; + } + + if (modPlayer.molten) + player.resistCold = true; + + if (modPlayer.shellBoost) + player.moveSpeed += 0.9f; + + if (modPlayer.celestialJewel || modPlayer.astralArcanum) + { + bool lesserEffect = false; + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); + } + + if (lesserEffect) + { + player.lifeRegen += 1; + player.statDefense += 20; + } + else + { + if (player.lifeRegen < 0) + { + if (player.lifeRegenTime < 1800) + player.lifeRegenTime = 1800; + + player.lifeRegen += 4; + player.statDefense += 20; + } + else + player.lifeRegen += 2; + } + } + else if (modPlayer.crownJewel) + { + bool lesserEffect = false; + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); + } + + if (lesserEffect) + player.statDefense += 10; + else + { + if (player.lifeRegen < 0) + { + if (player.lifeRegenTime < 1800) + player.lifeRegenTime = 1800; + + player.lifeRegen += 2; + player.statDefense += 10; + } + else + player.lifeRegen += 1; + } + } + + if (modPlayer.permafrostsConcoction) + { + if (player.statLife < player.statLifeMax2 / 2) + player.lifeRegen++; + if (player.statLife < player.statLifeMax2 / 4) + player.lifeRegen++; + if (player.statLife < player.statLifeMax2 / 10) + player.lifeRegen += 2; + + if (player.poisoned || player.onFire || modPlayer.bFlames) + player.lifeRegen += 4; + } + + // Last Debuffs + + if (modPlayer.omegaBlueChestplate) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + + if (player.lifeRegenCount > 0) + player.lifeRegenCount = 0; + } + + if (Config.LethalLava) + { + if (Main.myPlayer == player.whoAmI) + { + if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) + { + if (player.lavaImmune && !player.immune) + { + if (player.lavaTime > 0) + player.lavaTime--; + } + + if (player.lavaTime <= 0) + player.AddBuff(mod.BuffType("LethalLavaBurn"), 2, true); + } + } + + if (modPlayer.lethalLavaBurn) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + int lifeRegenDown = (player.lavaImmune ? 9 : 18); + + if (player.lavaRose) + lifeRegenDown = 3; + + player.lifeRegen -= lifeRegenDown; + } + } + + if (modPlayer.hInferno) + { + modPlayer.hInfernoBoost++; + + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + player.lifeRegen -= modPlayer.hInfernoBoost; + + if (player.lifeRegen < -200) + player.lifeRegen = -200; + } + else + modPlayer.hInfernoBoost = 0; + + if (modPlayer.gState) + { + player.statDefense /= 2; + player.velocity.Y = 0f; + player.velocity.X = 0f; + } + + if (modPlayer.eGravity) + { + if (player.wingTimeMax < 0) + player.wingTimeMax = 0; + + if (player.wingTimeMax > 400) + player.wingTimeMax = 400; + + player.wingTimeMax /= 4; + } + + if (modPlayer.eGrav) + { + if (player.wingTimeMax < 0) + player.wingTimeMax = 0; + + if (player.wingTimeMax > 400) + player.wingTimeMax = 400; + + player.wingTimeMax /= 2; + } + + if (modPlayer.molluskSet) + player.velocity.X *= 0.985f; + + if ((modPlayer.warped || modPlayer.caribbeanRum) && !player.slowFall) + player.velocity.Y *= 1.01f; + + if (modPlayer.weakPetrification || CalamityWorld.bossRushActive) + { + if (player.mount.Active) + player.mount.Dismount(player); + } + + if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) + { + if (player.lifeRegen < 0) + player.lifeRegen = 0; + } + } + #endregion + + #region Update Life Regen + public static void CalamityUpdateLifeRegen(Player player, Mod mod) + { + CalamityPlayer modPlayer = player.Calamity(); + + if (!player.shinyStone) + { + int lifeRegenTimeMaxBoost = (CalamityPlayer.areThereAnyDamnBosses ? 450 : 1800); + int lifeRegenMaxBoost = (CalamityPlayer.areThereAnyDamnBosses ? 1 : 4); + float lifeRegenLifeRegenTimeMaxBoost = (CalamityPlayer.areThereAnyDamnBosses ? 8f : 30f); + + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + if (modPlayer.shadeRegen) + { + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + player.lifeRegenTime = lifeRegenTimeMaxBoost; + + player.lifeRegenTime += lifeRegenMaxBoost; + player.lifeRegen += lifeRegenMaxBoost; + + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost) + num3 = lifeRegenLifeRegenTimeMaxBoost; + + player.lifeRegen += (int)num3; + } + + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30))) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.cFreeze) + { + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + player.lifeRegenTime = lifeRegenTimeMaxBoost; + + player.lifeRegenTime += lifeRegenMaxBoost; + player.lifeRegen += lifeRegenMaxBoost; + + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost) + num3 = lifeRegenLifeRegenTimeMaxBoost; + + player.lifeRegen += (int)num3; + } + + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30))) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.draedonsHeart) + { + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + player.lifeRegenTime = lifeRegenTimeMaxBoost; + + player.lifeRegenTime += lifeRegenMaxBoost; + player.lifeRegen += lifeRegenMaxBoost; + + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost) + num3 = lifeRegenLifeRegenTimeMaxBoost; + + player.lifeRegen += (int)num3; + } + + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2))) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.photosynthesis) + { + int lifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenTimeMaxBoost : (lifeRegenTimeMaxBoost / 5); + int lifeRegenMaxBoost2 = Main.dayTime ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); + float lifeRegenLifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); + + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) + player.lifeRegenTime = lifeRegenTimeMaxBoost2; + + player.lifeRegenTime += lifeRegenMaxBoost2; + player.lifeRegen += lifeRegenMaxBoost2; + + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost2) + num3 = lifeRegenLifeRegenTimeMaxBoost2; + + player.lifeRegen += (int)num3; + } + + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2))) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + } + } + } + #endregion + } } diff --git a/CalamityMod.cs b/CalamityMod.cs index daba10954e..243e99c8f5 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1,543 +1,543 @@ -using System; -using System.Collections.Generic; -using System.IO; +using CalamityMod.CalPlayer; +using CalamityMod.Localization; +using CalamityMod.MiscModSupport; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.TheDevourerofGods; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Skies; +using CalamityMod.UI; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; using Terraria; -using Terraria.UI; using Terraria.DataStructures; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs.TheDevourerofGods; -using CalamityMod.NPCs.Calamitas; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Yharon; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.UI; -using CalamityMod.Skies; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Localization; -using CalamityMod.Utilities; -using CalamityMod.MiscModSupport; +using Terraria.UI; namespace CalamityMod { public class CalamityMod : Mod - { - // Hotkeys - public static ModHotKey NormalityRelocatorHotKey; - public static ModHotKey AegisHotKey; - public static ModHotKey TarraHotKey; - public static ModHotKey RageHotKey; - public static ModHotKey AdrenalineHotKey; - public static ModHotKey AstralTeleportHotKey; - public static ModHotKey AstralArcanumUIHotkey; - public static ModHotKey BossBarToggleHotKey; - public static ModHotKey BossBarToggleSmallTextHotKey; + { + // Hotkeys + public static ModHotKey NormalityRelocatorHotKey; + public static ModHotKey AegisHotKey; + public static ModHotKey TarraHotKey; + public static ModHotKey RageHotKey; + public static ModHotKey AdrenalineHotKey; + public static ModHotKey AstralTeleportHotKey; + public static ModHotKey AstralArcanumUIHotkey; + public static ModHotKey BossBarToggleHotKey; + public static ModHotKey BossBarToggleSmallTextHotKey; - // Boss Spawners - public static int ghostKillCount = 0; - public static int sharkKillCount = 0; - public static int astralKillCount = 0; + // Boss Spawners + public static int ghostKillCount = 0; + public static int sharkKillCount = 0; + public static int astralKillCount = 0; - // Textures & Shaders - public static Texture2D heartOriginal2; - public static Texture2D heartOriginal; - public static Texture2D rainOriginal; - public static Texture2D manaOriginal; - public static Texture2D carpetOriginal; - public static Texture2D AstralCactusTexture; - public static Texture2D AstralCactusGlowTexture; - public static Texture2D AstralSky; - public static Effect CustomShader; + // Textures & Shaders + public static Texture2D heartOriginal2; + public static Texture2D heartOriginal; + public static Texture2D rainOriginal; + public static Texture2D manaOriginal; + public static Texture2D carpetOriginal; + public static Texture2D AstralCactusTexture; + public static Texture2D AstralCactusGlowTexture; + public static Texture2D AstralSky; + public static Effect CustomShader; // DR data structure public static SortedDictionary DRValues; // Lists public static IList donatorList; - public static List rangedProjectileExceptionList; - public static List projectileMinionList; - public static List enemyImmunityList; - public static List dungeonEnemyBuffList; - public static List dungeonProjectileBuffList; - public static List bossScaleList; + public static List rangedProjectileExceptionList; + public static List projectileMinionList; + public static List enemyImmunityList; + public static List dungeonEnemyBuffList; + public static List dungeonProjectileBuffList; + public static List bossScaleList; public static List bossHPScaleList; - public static List beeEnemyList; - public static List beeProjectileList; - public static List hardModeNerfList; - public static List debuffList; - public static List fireWeaponList; - public static List natureWeaponList; - public static List alcoholList; - public static List doubleDamageBuffList; //100% buff - public static List sixtySixDamageBuffList; //66% buff - public static List fiftyDamageBuffList; //50% buff - public static List thirtyThreeDamageBuffList; //33% buff - public static List twentyFiveDamageBuffList; //25% buff - public static List twentyDamageBuffList; //20% buff - public static List weaponAutoreuseList; - public static List quarterDamageNerfList; //25% nerf - public static List pumpkinMoonBuffList; - public static List frostMoonBuffList; - public static List eclipseBuffList; - public static List eventProjectileBuffList; - public static List revengeanceEnemyBuffList; - public static List revengeanceProjectileBuffList; + public static List beeEnemyList; + public static List beeProjectileList; + public static List hardModeNerfList; + public static List debuffList; + public static List fireWeaponList; + public static List natureWeaponList; + public static List alcoholList; + public static List doubleDamageBuffList; //100% buff + public static List sixtySixDamageBuffList; //66% buff + public static List fiftyDamageBuffList; //50% buff + public static List thirtyThreeDamageBuffList; //33% buff + public static List twentyFiveDamageBuffList; //25% buff + public static List twentyDamageBuffList; //20% buff + public static List weaponAutoreuseList; + public static List quarterDamageNerfList; //25% nerf + public static List pumpkinMoonBuffList; + public static List frostMoonBuffList; + public static List eclipseBuffList; + public static List eventProjectileBuffList; + public static List revengeanceEnemyBuffList; + public static List revengeanceProjectileBuffList; public static List revengeanceLifeStealExceptionList; public static List movementImpairImmuneList; - public static List trapProjectileList; - public static List scopedWeaponList; - public static List trueMeleeBoostExceptionList; - public static List tableList; - public static List chairList; - public static List lightList; - public static List doorList; + public static List trapProjectileList; + public static List scopedWeaponList; + public static List trueMeleeBoostExceptionList; + public static List tableList; + public static List chairList; + public static List lightList; + public static List doorList; - public static List zombieList; - public static List demonEyeList; - public static List skeletonList; - public static List angryBonesList; - public static List hornetList; - public static List mossHornetList; + public static List zombieList; + public static List demonEyeList; + public static List skeletonList; + public static List angryBonesList; + public static List hornetList; + public static List mossHornetList; #region Load public override void Load() - { + { heartOriginal2 = Main.heartTexture; - heartOriginal = Main.heart2Texture; - rainOriginal = Main.rainTexture; - manaOriginal = Main.manaTexture; - carpetOriginal = Main.flyingCarpetTexture; + heartOriginal = Main.heart2Texture; + rainOriginal = Main.rainTexture; + manaOriginal = Main.manaTexture; + carpetOriginal = Main.flyingCarpetTexture; - NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); - RageHotKey = RegisterHotKey("Rage Mode", "V"); - AdrenalineHotKey = RegisterHotKey("Adrenaline Mode", "B"); - AegisHotKey = RegisterHotKey("Elysian Guard", "N"); - TarraHotKey = RegisterHotKey("Armor Set Bonus", "Y"); - AstralTeleportHotKey = RegisterHotKey("Astral Teleport", "P"); - AstralArcanumUIHotkey = RegisterHotKey("Astral Arcanum UI Toggle", "O"); - BossBarToggleHotKey = RegisterHotKey("Boss Health Bar Toggle", "NumPad0"); - BossBarToggleSmallTextHotKey = RegisterHotKey("Boss Health Bar Small Text Toggle", "NumPad1"); + NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); + RageHotKey = RegisterHotKey("Rage Mode", "V"); + AdrenalineHotKey = RegisterHotKey("Adrenaline Mode", "B"); + AegisHotKey = RegisterHotKey("Elysian Guard", "N"); + TarraHotKey = RegisterHotKey("Armor Set Bonus", "Y"); + AstralTeleportHotKey = RegisterHotKey("Astral Teleport", "P"); + AstralArcanumUIHotkey = RegisterHotKey("Astral Arcanum UI Toggle", "O"); + BossBarToggleHotKey = RegisterHotKey("Boss Health Bar Toggle", "NumPad0"); + BossBarToggleSmallTextHotKey = RegisterHotKey("Boss Health Bar Small Text Toggle", "NumPad1"); - if (!Main.dedServ) - { - LoadClient(); - } + if (!Main.dedServ) + { + LoadClient(); + } - BossHealthBarManager.Load(this); + BossHealthBarManager.Load(this); - Config.Load(); + Config.Load(); - SetupLists(); + SetupLists(); SetupVanillaDR(); SetupThoriumBossDR(ModLoader.GetMod("ThoriumMod")); - CalamityLocalization.AddLocalizations(); - } + CalamityLocalization.AddLocalizations(); + } - private void LoadClient() - { - AddEquipTexture(new Items.Armor.AbyssalDivingSuitHead(), null, EquipType.Head, "AbyssalDivingSuitHead", "CalamityMod/Items/Armor/AbyssalDivingSuit_Head"); - AddEquipTexture(new Items.Armor.AbyssalDivingSuitBody(), null, EquipType.Body, "AbyssalDivingSuitBody", "CalamityMod/Items/Armor/AbyssalDivingSuit_Body", "CalamityMod/Items/Armor/AbyssalDivingSuit_Arms"); - AddEquipTexture(new Items.Armor.AbyssalDivingSuitLegs(), null, EquipType.Legs, "AbyssalDivingSuitLeg", "CalamityMod/Items/Armor/AbyssalDivingSuit_Legs"); + private void LoadClient() + { + AddEquipTexture(new Items.Armor.AbyssalDivingSuitHead(), null, EquipType.Head, "AbyssalDivingSuitHead", "CalamityMod/Items/Armor/AbyssalDivingSuit_Head"); + AddEquipTexture(new Items.Armor.AbyssalDivingSuitBody(), null, EquipType.Body, "AbyssalDivingSuitBody", "CalamityMod/Items/Armor/AbyssalDivingSuit_Body", "CalamityMod/Items/Armor/AbyssalDivingSuit_Arms"); + AddEquipTexture(new Items.Armor.AbyssalDivingSuitLegs(), null, EquipType.Legs, "AbyssalDivingSuitLeg", "CalamityMod/Items/Armor/AbyssalDivingSuit_Legs"); - AddEquipTexture(new Items.Armor.SirenHead(), null, EquipType.Head, "SirenHead", "CalamityMod/Items/Armor/SirenTrans_Head"); - AddEquipTexture(new Items.Armor.SirenBody(), null, EquipType.Body, "SirenBody", "CalamityMod/Items/Armor/SirenTrans_Body", "CalamityMod/Items/Armor/SirenTrans_Arms"); - AddEquipTexture(new Items.Armor.SirenLegs(), null, EquipType.Legs, "SirenLeg", "CalamityMod/Items/Armor/SirenTrans_Legs"); + AddEquipTexture(new Items.Armor.SirenHead(), null, EquipType.Head, "SirenHead", "CalamityMod/Items/Armor/SirenTrans_Head"); + AddEquipTexture(new Items.Armor.SirenBody(), null, EquipType.Body, "SirenBody", "CalamityMod/Items/Armor/SirenTrans_Body", "CalamityMod/Items/Armor/SirenTrans_Arms"); + AddEquipTexture(new Items.Armor.SirenLegs(), null, EquipType.Legs, "SirenLeg", "CalamityMod/Items/Armor/SirenTrans_Legs"); - AddEquipTexture(new Items.Armor.SirenHeadAlt(), null, EquipType.Head, "SirenHeadAlt", "CalamityMod/Items/Armor/SirenTransAlt_Head"); - AddEquipTexture(new Items.Armor.SirenBodyAlt(), null, EquipType.Body, "SirenBodyAlt", "CalamityMod/Items/Armor/SirenTransAlt_Body", "CalamityMod/Items/Armor/SirenTransAlt_Arms"); - AddEquipTexture(new Items.Armor.SirenLegsAlt(), null, EquipType.Legs, "SirenLegAlt", "CalamityMod/Items/Armor/SirenTransAlt_Legs"); + AddEquipTexture(new Items.Armor.SirenHeadAlt(), null, EquipType.Head, "SirenHeadAlt", "CalamityMod/Items/Armor/SirenTransAlt_Head"); + AddEquipTexture(new Items.Armor.SirenBodyAlt(), null, EquipType.Body, "SirenBodyAlt", "CalamityMod/Items/Armor/SirenTransAlt_Body", "CalamityMod/Items/Armor/SirenTransAlt_Arms"); + AddEquipTexture(new Items.Armor.SirenLegsAlt(), null, EquipType.Legs, "SirenLegAlt", "CalamityMod/Items/Armor/SirenTransAlt_Legs"); - AddEquipTexture(new Items.Permafrost.PopoHead(), null, EquipType.Head, "PopoHead", "CalamityMod/Items/Permafrost/Popo_Head"); - AddEquipTexture(new Items.Permafrost.PopoNoselessHead(), null, EquipType.Head, "PopoNoselessHead", "CalamityMod/Items/Permafrost/PopoNoseless_Head"); - AddEquipTexture(new Items.Permafrost.PopoBody(), null, EquipType.Body, "PopoBody", "CalamityMod/Items/Permafrost/Popo_Body", "CalamityMod/Items/Permafrost/Popo_Arms"); - AddEquipTexture(new Items.Permafrost.PopoLegs(), null, EquipType.Legs, "PopoLeg", "CalamityMod/Items/Permafrost/Popo_Legs"); + AddEquipTexture(new Items.Permafrost.PopoHead(), null, EquipType.Head, "PopoHead", "CalamityMod/Items/Permafrost/Popo_Head"); + AddEquipTexture(new Items.Permafrost.PopoNoselessHead(), null, EquipType.Head, "PopoNoselessHead", "CalamityMod/Items/Permafrost/PopoNoseless_Head"); + AddEquipTexture(new Items.Permafrost.PopoBody(), null, EquipType.Body, "PopoBody", "CalamityMod/Items/Permafrost/Popo_Body", "CalamityMod/Items/Permafrost/Popo_Arms"); + AddEquipTexture(new Items.Permafrost.PopoLegs(), null, EquipType.Legs, "PopoLeg", "CalamityMod/Items/Permafrost/Popo_Legs"); - AstralCactusTexture = GetTexture("ExtraTextures/Tiles/AstralCactus"); - AstralCactusGlowTexture = GetTexture("ExtraTextures/Tiles/AstralCactusGlow"); - AstralSky = GetTexture("ExtraTextures/AstralSky"); - CustomShader = GetEffect("Effects/CustomShader"); + AstralCactusTexture = GetTexture("ExtraTextures/Tiles/AstralCactus"); + AstralCactusGlowTexture = GetTexture("ExtraTextures/Tiles/AstralCactusGlow"); + AstralSky = GetTexture("ExtraTextures/AstralSky"); + CustomShader = GetEffect("Effects/CustomShader"); - Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); + Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); - Filters.Scene["CalamityMod:DevourerofGodsHeadS"] = new Filter(new DoGScreenShaderDataS("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:DevourerofGodsHeadS"] = new DoGSkyS(); + Filters.Scene["CalamityMod:DevourerofGodsHeadS"] = new Filter(new DoGScreenShaderDataS("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:DevourerofGodsHeadS"] = new DoGSkyS(); - Filters.Scene["CalamityMod:CalamitasRun3"] = new Filter(new CalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.6f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:CalamitasRun3"] = new CalSky(); + Filters.Scene["CalamityMod:CalamitasRun3"] = new Filter(new CalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.6f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:CalamitasRun3"] = new CalSky(); - Filters.Scene["CalamityMod:PlaguebringerGoliath"] = new Filter(new PbGScreenShaderData("FilterMiniTower").UseColor(0.2f, 0.6f, 0.2f).UseOpacity(0.35f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:PlaguebringerGoliath"] = new PbGSky(); + Filters.Scene["CalamityMod:PlaguebringerGoliath"] = new Filter(new PbGScreenShaderData("FilterMiniTower").UseColor(0.2f, 0.6f, 0.2f).UseOpacity(0.35f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:PlaguebringerGoliath"] = new PbGSky(); - Filters.Scene["CalamityMod:Yharon"] = new Filter(new YScreenShaderData("FilterMiniTower").UseColor(1f, 0.4f, 0f).UseOpacity(0.75f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Yharon"] = new YSky(); + Filters.Scene["CalamityMod:Yharon"] = new Filter(new YScreenShaderData("FilterMiniTower").UseColor(1f, 0.4f, 0f).UseOpacity(0.75f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Yharon"] = new YSky(); - Filters.Scene["CalamityMod:Leviathan"] = new Filter(new LevScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.5f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Leviathan"] = new LevSky(); + Filters.Scene["CalamityMod:Leviathan"] = new Filter(new LevScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.5f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Leviathan"] = new LevSky(); - Filters.Scene["CalamityMod:Providence"] = new Filter(new ProvScreenShaderData("FilterMiniTower").UseColor(0.45f, 0.4f, 0.2f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Providence"] = new ProvSky(); + Filters.Scene["CalamityMod:Providence"] = new Filter(new ProvScreenShaderData("FilterMiniTower").UseColor(0.45f, 0.4f, 0.2f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Providence"] = new ProvSky(); - Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); + Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); - Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(CustomShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); + Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(CustomShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); - UIHandler.OnLoad(this); - AstralArcanumUI.Load(this); - } - #endregion + UIHandler.OnLoad(this); + AstralArcanumUI.Load(this); + } + #endregion - #region Unload - public override void Unload() - { - NormalityRelocatorHotKey = null; - RageHotKey = null; - AdrenalineHotKey = null; - AegisHotKey = null; - TarraHotKey = null; - AstralTeleportHotKey = null; - AstralArcanumUIHotkey = null; - BossBarToggleHotKey = null; - BossBarToggleSmallTextHotKey = null; + #region Unload + public override void Unload() + { + NormalityRelocatorHotKey = null; + RageHotKey = null; + AdrenalineHotKey = null; + AegisHotKey = null; + TarraHotKey = null; + AstralTeleportHotKey = null; + AstralArcanumUIHotkey = null; + BossBarToggleHotKey = null; + BossBarToggleSmallTextHotKey = null; - AstralCactusTexture = null; - AstralCactusGlowTexture = null; - AstralSky = null; + AstralCactusTexture = null; + AstralCactusGlowTexture = null; + AstralSky = null; DRValues?.Clear(); DRValues = null; - donatorList = null; - rangedProjectileExceptionList = null; - projectileMinionList = null; - enemyImmunityList = null; - dungeonEnemyBuffList = null; - dungeonProjectileBuffList = null; - bossScaleList = null; + donatorList = null; + rangedProjectileExceptionList = null; + projectileMinionList = null; + enemyImmunityList = null; + dungeonEnemyBuffList = null; + dungeonProjectileBuffList = null; + bossScaleList = null; bossHPScaleList = null; - beeEnemyList = null; - beeProjectileList = null; - hardModeNerfList = null; - debuffList = null; - fireWeaponList = null; - natureWeaponList = null; - alcoholList = null; - doubleDamageBuffList = null; - sixtySixDamageBuffList = null; - fiftyDamageBuffList = null; - thirtyThreeDamageBuffList = null; - twentyFiveDamageBuffList = null; - weaponAutoreuseList = null; - quarterDamageNerfList = null; - pumpkinMoonBuffList = null; - frostMoonBuffList = null; - eclipseBuffList = null; - eventProjectileBuffList = null; - revengeanceEnemyBuffList = null; - revengeanceProjectileBuffList = null; + beeEnemyList = null; + beeProjectileList = null; + hardModeNerfList = null; + debuffList = null; + fireWeaponList = null; + natureWeaponList = null; + alcoholList = null; + doubleDamageBuffList = null; + sixtySixDamageBuffList = null; + fiftyDamageBuffList = null; + thirtyThreeDamageBuffList = null; + twentyFiveDamageBuffList = null; + weaponAutoreuseList = null; + quarterDamageNerfList = null; + pumpkinMoonBuffList = null; + frostMoonBuffList = null; + eclipseBuffList = null; + eventProjectileBuffList = null; + revengeanceEnemyBuffList = null; + revengeanceProjectileBuffList = null; revengeanceLifeStealExceptionList = null; movementImpairImmuneList = null; trapProjectileList = null; - scopedWeaponList = null; - trueMeleeBoostExceptionList = null; - tableList = null; - chairList = null; - lightList = null; - doorList = null; + scopedWeaponList = null; + trueMeleeBoostExceptionList = null; + tableList = null; + chairList = null; + lightList = null; + doorList = null; - zombieList = null; - demonEyeList = null; - skeletonList = null; - angryBonesList = null; - hornetList = null; - mossHornetList = null; + zombieList = null; + demonEyeList = null; + skeletonList = null; + angryBonesList = null; + hornetList = null; + mossHornetList = null; - BossHealthBarManager.Unload(); - base.Unload(); + BossHealthBarManager.Unload(); + base.Unload(); - AstralArcanumUI.Unload(); - base.Unload(); + AstralArcanumUI.Unload(); + base.Unload(); - if (!Main.dedServ) - { - Main.heartTexture = heartOriginal2; - Main.heart2Texture = heartOriginal; - Main.rainTexture = rainOriginal; - Main.manaTexture = manaOriginal; - Main.flyingCarpetTexture = carpetOriginal; - } + if (!Main.dedServ) + { + Main.heartTexture = heartOriginal2; + Main.heart2Texture = heartOriginal; + Main.rainTexture = rainOriginal; + Main.manaTexture = manaOriginal; + Main.flyingCarpetTexture = carpetOriginal; + } - heartOriginal2 = null; - heartOriginal = null; - rainOriginal = null; - manaOriginal = null; - carpetOriginal = null; - } - #endregion + heartOriginal2 = null; + heartOriginal = null; + rainOriginal = null; + manaOriginal = null; + carpetOriginal = null; + } + #endregion - #region SetupLists - public static void SetupLists() - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (calamity != null) - { - donatorList = new List() - { - "Vorbis", - "SoloMael", - "Chaotic Reks", - "The Buildmonger", - "Yuh", - "Littlepiggy", - "LompL", - "Lilith Saintclaire", - "Ben Shapiro", - "Frederik Henschel", - "Faye", - "Gibb50", - "Braden Hajer", - "Hannes Holmlund", - "profoundmango69", - "Jack M Sargent", - "Hans Volter", - "Krankwagon", - "MishiroUsui", - "pixlgray", - "Arkhine", - "Lodude", - "DevAesthetic", - "Mister Winchester", - "Zacky", - "Veine", - "Javyz", - "Shifter", - "Crysthamyr", - "Elfinlocks", - "Ein", - "2Larry2", - "Jenonen", - "Dodu", - "Arti", - "Tervastator", - "Luis Arguello", - "Alexander Davis", - "BakaQing", - "Laura Coonrod", - "Xaphlactus", - "MajinBagel", - "Bendy", - "Rando Calrissian", - "Tails the Fox 92", - "Bread", - "Minty Candy", - "Preston Card", - "MovingTarget_086", - "Shiro", - "Chip", - "Taylor Riverpaw", - "ShotgunAngel", - "Sandblast", - "ThomasThePencil", - "Aero (Aero#4599)", - "GlitchOut", - "Daawnz", - "CrabBar", - "Yatagarasu", - "Jarod Isaac Gordon", - "Zombieh", - "MingWhy", - "Random Weeb", - "Ahmed Fahad Zamel Al Sharif", - "Eragon3942", - "TheBlackHand", - "william", - "Samuel Foreman", - "Christopher Pham", - "DemoN K!ng", - "Malik Ciaramella", - "Ryan Baker-Ortiz", - "Aleksanders Denisovs", - "TheSilverGhost", - "Lucazii", - "Shay", - "Prism", - "BobIsNotMyRealName", - "Guwahavel", - "Azura", - "Joshua Miranda", - "Doveda", - "William Chang", - "Arche", - "DevilSunrise", - "Yanmei", - "Chaos", - "Ryan Tucker", - "Fish Repairs", - "Melvin Brouwers", - "Vroomy Has -3,000 IQ", - "The Goliath", - "DaPyRo" - }; + #region SetupLists + public static void SetupLists() + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + Mod thorium = ModLoader.GetMod("ThoriumMod"); + if (calamity != null) + { + donatorList = new List() + { + "Vorbis", + "SoloMael", + "Chaotic Reks", + "The Buildmonger", + "Yuh", + "Littlepiggy", + "LompL", + "Lilith Saintclaire", + "Ben Shapiro", + "Frederik Henschel", + "Faye", + "Gibb50", + "Braden Hajer", + "Hannes Holmlund", + "profoundmango69", + "Jack M Sargent", + "Hans Volter", + "Krankwagon", + "MishiroUsui", + "pixlgray", + "Arkhine", + "Lodude", + "DevAesthetic", + "Mister Winchester", + "Zacky", + "Veine", + "Javyz", + "Shifter", + "Crysthamyr", + "Elfinlocks", + "Ein", + "2Larry2", + "Jenonen", + "Dodu", + "Arti", + "Tervastator", + "Luis Arguello", + "Alexander Davis", + "BakaQing", + "Laura Coonrod", + "Xaphlactus", + "MajinBagel", + "Bendy", + "Rando Calrissian", + "Tails the Fox 92", + "Bread", + "Minty Candy", + "Preston Card", + "MovingTarget_086", + "Shiro", + "Chip", + "Taylor Riverpaw", + "ShotgunAngel", + "Sandblast", + "ThomasThePencil", + "Aero (Aero#4599)", + "GlitchOut", + "Daawnz", + "CrabBar", + "Yatagarasu", + "Jarod Isaac Gordon", + "Zombieh", + "MingWhy", + "Random Weeb", + "Ahmed Fahad Zamel Al Sharif", + "Eragon3942", + "TheBlackHand", + "william", + "Samuel Foreman", + "Christopher Pham", + "DemoN K!ng", + "Malik Ciaramella", + "Ryan Baker-Ortiz", + "Aleksanders Denisovs", + "TheSilverGhost", + "Lucazii", + "Shay", + "Prism", + "BobIsNotMyRealName", + "Guwahavel", + "Azura", + "Joshua Miranda", + "Doveda", + "William Chang", + "Arche", + "DevilSunrise", + "Yanmei", + "Chaos", + "Ryan Tucker", + "Fish Repairs", + "Melvin Brouwers", + "Vroomy Has -3,000 IQ", + "The Goliath", + "DaPyRo" + }; - rangedProjectileExceptionList = new List() - { - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - ProjectileID.DD2PhoenixBow, - ProjectileID.IchorDart, - ProjectileID.PhantasmArrow, - calamity.ProjectileType("Phangasm"), - calamity.ProjectileType("Contagion"), - calamity.ProjectileType("DaemonsFlame"), - calamity.ProjectileType("ExoTornado"), - calamity.ProjectileType("Drataliornus"), - calamity.ProjectileType("FlakKrakenGun"), - calamity.ProjectileType("Butcher"), - calamity.ProjectileType("StarfleetMK2"), - calamity.ProjectileType("TerraBulletSplit"), - calamity.ProjectileType("TerraArrow2"), - calamity.ProjectileType("OMGWTH"), - calamity.ProjectileType("Norfleet"), - calamity.ProjectileType("NorfleetComet"), - calamity.ProjectileType("NorfleetExplosion") - }; + rangedProjectileExceptionList = new List() + { + ProjectileID.Phantasm, + ProjectileID.VortexBeater, + ProjectileID.DD2PhoenixBow, + ProjectileID.IchorDart, + ProjectileID.PhantasmArrow, + calamity.ProjectileType("Phangasm"), + calamity.ProjectileType("Contagion"), + calamity.ProjectileType("DaemonsFlame"), + calamity.ProjectileType("ExoTornado"), + calamity.ProjectileType("Drataliornus"), + calamity.ProjectileType("FlakKrakenGun"), + calamity.ProjectileType("Butcher"), + calamity.ProjectileType("StarfleetMK2"), + calamity.ProjectileType("TerraBulletSplit"), + calamity.ProjectileType("TerraArrow2"), + calamity.ProjectileType("OMGWTH"), + calamity.ProjectileType("Norfleet"), + calamity.ProjectileType("NorfleetComet"), + calamity.ProjectileType("NorfleetExplosion") + }; - projectileMinionList = new List() - { - ProjectileID.PygmySpear, - ProjectileID.UFOMinion, - ProjectileID.UFOLaser, - ProjectileID.StardustCellMinionShot, - ProjectileID.MiniSharkron, - ProjectileID.MiniRetinaLaser, - ProjectileID.ImpFireball, - ProjectileID.HornetStinger, - ProjectileID.DD2FlameBurstTowerT1Shot, - ProjectileID.DD2FlameBurstTowerT2Shot, - ProjectileID.DD2FlameBurstTowerT3Shot, - ProjectileID.DD2BallistraProj, - ProjectileID.DD2ExplosiveTrapT1Explosion, - ProjectileID.DD2ExplosiveTrapT2Explosion, - ProjectileID.DD2ExplosiveTrapT3Explosion, - ProjectileID.SpiderEgg, - ProjectileID.BabySpider, - ProjectileID.FrostBlastFriendly, - ProjectileID.MoonlordTurretLaser, - ProjectileID.RainbowCrystalExplosion - }; + projectileMinionList = new List() + { + ProjectileID.PygmySpear, + ProjectileID.UFOMinion, + ProjectileID.UFOLaser, + ProjectileID.StardustCellMinionShot, + ProjectileID.MiniSharkron, + ProjectileID.MiniRetinaLaser, + ProjectileID.ImpFireball, + ProjectileID.HornetStinger, + ProjectileID.DD2FlameBurstTowerT1Shot, + ProjectileID.DD2FlameBurstTowerT2Shot, + ProjectileID.DD2FlameBurstTowerT3Shot, + ProjectileID.DD2BallistraProj, + ProjectileID.DD2ExplosiveTrapT1Explosion, + ProjectileID.DD2ExplosiveTrapT2Explosion, + ProjectileID.DD2ExplosiveTrapT3Explosion, + ProjectileID.SpiderEgg, + ProjectileID.BabySpider, + ProjectileID.FrostBlastFriendly, + ProjectileID.MoonlordTurretLaser, + ProjectileID.RainbowCrystalExplosion + }; - enemyImmunityList = new List() - { - NPCID.KingSlime, - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.BrainofCthulhu, - NPCID.Creeper, - NPCID.EyeofCthulhu, - NPCID.QueenBee, - NPCID.SkeletronHead, - NPCID.SkeletronHand, - NPCID.WallofFlesh, - NPCID.WallofFleshEye, - NPCID.Retinazer, - NPCID.Spazmatism, - NPCID.SkeletronPrime, - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.Plantera, - NPCID.IceQueen, - NPCID.Pumpking, - NPCID.Mothron, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.DukeFishron, - NPCID.CultistBoss, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, - NPCID.DD2Betsy - }; + enemyImmunityList = new List() + { + NPCID.KingSlime, + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.BrainofCthulhu, + NPCID.Creeper, + NPCID.EyeofCthulhu, + NPCID.QueenBee, + NPCID.SkeletronHead, + NPCID.SkeletronHand, + NPCID.WallofFlesh, + NPCID.WallofFleshEye, + NPCID.Retinazer, + NPCID.Spazmatism, + NPCID.SkeletronPrime, + NPCID.PrimeCannon, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.Plantera, + NPCID.IceQueen, + NPCID.Pumpking, + NPCID.Mothron, + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.DukeFishron, + NPCID.CultistBoss, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCID.MoonLordCore, + NPCID.MoonLordFreeEye, + NPCID.DD2Betsy + }; - dungeonEnemyBuffList = new List() - { - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.SkeletonCommando, - NPCID.Paladin, - NPCID.GiantCursedSkull, - NPCID.BoneLee, - NPCID.DiabolistWhite, - NPCID.DiabolistRed, - NPCID.NecromancerArmored, - NPCID.Necromancer, - NPCID.RaggedCasterOpenCoat, - NPCID.RaggedCaster, - NPCID.HellArmoredBonesSword, - NPCID.HellArmoredBonesMace, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBones, - NPCID.BlueArmoredBonesSword, - NPCID.BlueArmoredBonesNoPants, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBones, - NPCID.RustyArmoredBonesSwordNoArmor, - NPCID.RustyArmoredBonesSword, - NPCID.RustyArmoredBonesFlail, - NPCID.RustyArmoredBonesAxe - }; + dungeonEnemyBuffList = new List() + { + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.SkeletonCommando, + NPCID.Paladin, + NPCID.GiantCursedSkull, + NPCID.BoneLee, + NPCID.DiabolistWhite, + NPCID.DiabolistRed, + NPCID.NecromancerArmored, + NPCID.Necromancer, + NPCID.RaggedCasterOpenCoat, + NPCID.RaggedCaster, + NPCID.HellArmoredBonesSword, + NPCID.HellArmoredBonesMace, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBones, + NPCID.BlueArmoredBonesSword, + NPCID.BlueArmoredBonesNoPants, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBones, + NPCID.RustyArmoredBonesSwordNoArmor, + NPCID.RustyArmoredBonesSword, + NPCID.RustyArmoredBonesFlail, + NPCID.RustyArmoredBonesAxe + }; - dungeonProjectileBuffList = new List() - { - ProjectileID.PaladinsHammerHostile, - ProjectileID.ShadowBeamHostile, - ProjectileID.InfernoHostileBolt, - ProjectileID.InfernoHostileBlast, - ProjectileID.LostSoulHostile, - ProjectileID.SniperBullet, - ProjectileID.RocketSkeleton, - ProjectileID.BulletDeadeye, - ProjectileID.Shadowflames - }; + dungeonProjectileBuffList = new List() + { + ProjectileID.PaladinsHammerHostile, + ProjectileID.ShadowBeamHostile, + ProjectileID.InfernoHostileBolt, + ProjectileID.InfernoHostileBlast, + ProjectileID.LostSoulHostile, + ProjectileID.SniperBullet, + ProjectileID.RocketSkeleton, + ProjectileID.BulletDeadeye, + ProjectileID.Shadowflames + }; - bossScaleList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PlanterasTentacle, - NPCID.Pumpking, - NPCID.IceQueen, - NPCID.Mothron, - NPCID.GolemHead - }; + bossScaleList = new List() + { + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + NPCID.SkeletronHand, + NPCID.WallofFleshEye, + NPCID.TheHungry, + NPCID.TheHungryII, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.PrimeCannon, + NPCID.PrimeVice, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PlanterasTentacle, + NPCID.Pumpking, + NPCID.IceQueen, + NPCID.Mothron, + NPCID.GolemHead + }; bossHPScaleList = new List() { @@ -561,880 +561,880 @@ namespace CalamityMod }; beeEnemyList = new List() - { - NPCID.GiantMossHornet, - NPCID.BigMossHornet, - NPCID.LittleMossHornet, - NPCID.TinyMossHornet, - NPCID.MossHornet, - NPCID.VortexHornetQueen, - NPCID.VortexHornet, - NPCID.Bee, - NPCID.BeeSmall, - NPCID.QueenBee, - calamity.NPCType("PlaguebringerGoliath"), - calamity.NPCType("PlaguebringerShade"), - calamity.NPCType("PlagueBeeLargeG"), - calamity.NPCType("PlagueBeeLarge"), - calamity.NPCType("PlagueBeeG"), - calamity.NPCType("PlagueBee") - }; + { + NPCID.GiantMossHornet, + NPCID.BigMossHornet, + NPCID.LittleMossHornet, + NPCID.TinyMossHornet, + NPCID.MossHornet, + NPCID.VortexHornetQueen, + NPCID.VortexHornet, + NPCID.Bee, + NPCID.BeeSmall, + NPCID.QueenBee, + calamity.NPCType("PlaguebringerGoliath"), + calamity.NPCType("PlaguebringerShade"), + calamity.NPCType("PlagueBeeLargeG"), + calamity.NPCType("PlagueBeeLarge"), + calamity.NPCType("PlagueBeeG"), + calamity.NPCType("PlagueBee") + }; - beeProjectileList = new List() - { - ProjectileID.Stinger, - ProjectileID.HornetStinger, - calamity.ProjectileType("PlagueStingerGoliath"), - calamity.ProjectileType("PlagueStingerGoliathV2"), - calamity.ProjectileType("PlagueExplosion") - }; + beeProjectileList = new List() + { + ProjectileID.Stinger, + ProjectileID.HornetStinger, + calamity.ProjectileType("PlagueStingerGoliath"), + calamity.ProjectileType("PlagueStingerGoliathV2"), + calamity.ProjectileType("PlagueExplosion") + }; - hardModeNerfList = new List() - { - ProjectileID.WebSpit, - ProjectileID.PinkLaser, - ProjectileID.FrostBlastHostile, - ProjectileID.RuneBlast, - ProjectileID.GoldenShowerHostile, - ProjectileID.RainNimbus, - ProjectileID.Stinger, - ProjectileID.FlamingArrow, - ProjectileID.BulletDeadeye, - ProjectileID.CannonballHostile - }; + hardModeNerfList = new List() + { + ProjectileID.WebSpit, + ProjectileID.PinkLaser, + ProjectileID.FrostBlastHostile, + ProjectileID.RuneBlast, + ProjectileID.GoldenShowerHostile, + ProjectileID.RainNimbus, + ProjectileID.Stinger, + ProjectileID.FlamingArrow, + ProjectileID.BulletDeadeye, + ProjectileID.CannonballHostile + }; - debuffList = new List() - { - BuffID.Poisoned, - BuffID.Darkness, - BuffID.Cursed, - BuffID.OnFire, - BuffID.Bleeding, - BuffID.Confused, - BuffID.Slow, - BuffID.Weak, - BuffID.Silenced, - BuffID.BrokenArmor, - BuffID.CursedInferno, - BuffID.Frostburn, - BuffID.Chilled, - BuffID.Frozen, - BuffID.Burning, - BuffID.Suffocation, - BuffID.Ichor, - BuffID.Venom, - BuffID.Blackout, - BuffID.Electrified, - BuffID.Rabies, - BuffID.Webbed, - BuffID.Stoned, - BuffID.Dazed, - BuffID.VortexDebuff, - BuffID.WitheredArmor, - BuffID.WitheredWeapon, - BuffID.OgreSpit, - BuffID.BetsysCurse, - calamity.BuffType("Shadowflame"), - calamity.BuffType("BrimstoneFlames"), - calamity.BuffType("BurningBlood"), - calamity.BuffType("GlacialState"), - calamity.BuffType("GodSlayerInferno"), - calamity.BuffType("AstralInfectionDebuff"), - calamity.BuffType("HolyLight"), - calamity.BuffType("Irradiated"), - calamity.BuffType("Plague"), - calamity.BuffType("AbyssalFlames"), - calamity.BuffType("CrushDepth"), - calamity.BuffType("Horror"), - calamity.BuffType("MarkedforDeath") - }; + debuffList = new List() + { + BuffID.Poisoned, + BuffID.Darkness, + BuffID.Cursed, + BuffID.OnFire, + BuffID.Bleeding, + BuffID.Confused, + BuffID.Slow, + BuffID.Weak, + BuffID.Silenced, + BuffID.BrokenArmor, + BuffID.CursedInferno, + BuffID.Frostburn, + BuffID.Chilled, + BuffID.Frozen, + BuffID.Burning, + BuffID.Suffocation, + BuffID.Ichor, + BuffID.Venom, + BuffID.Blackout, + BuffID.Electrified, + BuffID.Rabies, + BuffID.Webbed, + BuffID.Stoned, + BuffID.Dazed, + BuffID.VortexDebuff, + BuffID.WitheredArmor, + BuffID.WitheredWeapon, + BuffID.OgreSpit, + BuffID.BetsysCurse, + calamity.BuffType("Shadowflame"), + calamity.BuffType("BrimstoneFlames"), + calamity.BuffType("BurningBlood"), + calamity.BuffType("GlacialState"), + calamity.BuffType("GodSlayerInferno"), + calamity.BuffType("AstralInfectionDebuff"), + calamity.BuffType("HolyLight"), + calamity.BuffType("Irradiated"), + calamity.BuffType("Plague"), + calamity.BuffType("AbyssalFlames"), + calamity.BuffType("CrushDepth"), + calamity.BuffType("Horror"), + calamity.BuffType("MarkedforDeath") + }; - fireWeaponList = new List() - { - ItemID.FieryGreatsword, - ItemID.DD2SquireDemonSword, - ItemID.TheHorsemansBlade, - ItemID.DD2SquireBetsySword, - ItemID.Cascade, - ItemID.HelFire, - ItemID.MonkStaffT2, - ItemID.Flamarang, - ItemID.MoltenFury, - ItemID.Sunfury, - ItemID.PhoenixBlaster, - ItemID.Flamelash, - ItemID.SolarEruption, - ItemID.DayBreak, - ItemID.MonkStaffT3, - ItemID.HellwingBow, - ItemID.DD2PhoenixBow, - ItemID.DD2BetsyBow, - ItemID.FlareGun, - ItemID.Flamethrower, - ItemID.EldMelter, - ItemID.FlowerofFire, - ItemID.MeteorStaff, - ItemID.ApprenticeStaffT3, - ItemID.InfernoFork, - ItemID.HeatRay, - ItemID.BookofSkulls, - ItemID.ImpStaff, - ItemID.DD2FlameburstTowerT1Popper, - ItemID.DD2FlameburstTowerT2Popper, - ItemID.DD2FlameburstTowerT3Popper, - ItemID.MolotovCocktail, - calamity.ItemType("AegisBlade"), - calamity.ItemType("BalefulHarvester"), - calamity.ItemType("Chaotrix"), - calamity.ItemType("CometQuasher"), - calamity.ItemType("DraconicDestruction"), - calamity.ItemType("Drataliornus"), - calamity.ItemType("EnergyStaff"), - calamity.ItemType("ExsanguinationLance"), - calamity.ItemType("FirestormCannon"), - calamity.ItemType("FlameburstShortsword"), - calamity.ItemType("FlameScythe"), - calamity.ItemType("FlameScytheMelee"), - calamity.ItemType("FlareBolt"), - calamity.ItemType("FlarefrostBlade"), - calamity.ItemType("FlarewingBow"), - calamity.ItemType("ForbiddenSun"), - calamity.ItemType("FrigidflashBolt"), - calamity.ItemType("GreatbowofTurmoil"), - calamity.ItemType("HarvestStaff"), - calamity.ItemType("Hellborn"), - calamity.ItemType("HellBurst"), - calamity.ItemType("HellfireFlamberge"), - calamity.ItemType("Hellkite"), - calamity.ItemType("HellwingStaff"), - calamity.ItemType("Helstorm"), - calamity.ItemType("InfernaCutter"), - calamity.ItemType("Lazhar"), - calamity.ItemType("MeteorFist"), - calamity.ItemType("Mourningstar"), - calamity.ItemType("PhoenixBlade"), - calamity.ItemType("Photoviscerator"), - calamity.ItemType("RedSun"), - calamity.ItemType("SpectralstormCannon"), - calamity.ItemType("SunGodStaff"), - calamity.ItemType("SunSpiritStaff"), - calamity.ItemType("TearsofHeaven"), - calamity.ItemType("TerraFlameburster"), - calamity.ItemType("TheEmpyrean"), - calamity.ItemType("TheLastMourning"), - calamity.ItemType("TheWand"), - calamity.ItemType("VenusianTrident"), - calamity.ItemType("Vesuvius"), - calamity.ItemType("BlissfulBombardier"), - calamity.ItemType("HolyCollider"), - calamity.ItemType("MoltenAmputator"), - calamity.ItemType("PurgeGuzzler"), - calamity.ItemType("SolarFlare"), - calamity.ItemType("TelluricGlare"), - calamity.ItemType("AngryChickenStaff"), - calamity.ItemType("ChickenCannon"), - calamity.ItemType("DragonRage"), - calamity.ItemType("DragonsBreath"), - calamity.ItemType("PhoenixFlameBarrage"), - calamity.ItemType("ProfanedTrident"), - calamity.ItemType("TheBurningSky"), - calamity.ItemType("HeliumFlash") - }; + fireWeaponList = new List() + { + ItemID.FieryGreatsword, + ItemID.DD2SquireDemonSword, + ItemID.TheHorsemansBlade, + ItemID.DD2SquireBetsySword, + ItemID.Cascade, + ItemID.HelFire, + ItemID.MonkStaffT2, + ItemID.Flamarang, + ItemID.MoltenFury, + ItemID.Sunfury, + ItemID.PhoenixBlaster, + ItemID.Flamelash, + ItemID.SolarEruption, + ItemID.DayBreak, + ItemID.MonkStaffT3, + ItemID.HellwingBow, + ItemID.DD2PhoenixBow, + ItemID.DD2BetsyBow, + ItemID.FlareGun, + ItemID.Flamethrower, + ItemID.EldMelter, + ItemID.FlowerofFire, + ItemID.MeteorStaff, + ItemID.ApprenticeStaffT3, + ItemID.InfernoFork, + ItemID.HeatRay, + ItemID.BookofSkulls, + ItemID.ImpStaff, + ItemID.DD2FlameburstTowerT1Popper, + ItemID.DD2FlameburstTowerT2Popper, + ItemID.DD2FlameburstTowerT3Popper, + ItemID.MolotovCocktail, + calamity.ItemType("AegisBlade"), + calamity.ItemType("BalefulHarvester"), + calamity.ItemType("Chaotrix"), + calamity.ItemType("CometQuasher"), + calamity.ItemType("DraconicDestruction"), + calamity.ItemType("Drataliornus"), + calamity.ItemType("EnergyStaff"), + calamity.ItemType("ExsanguinationLance"), + calamity.ItemType("FirestormCannon"), + calamity.ItemType("FlameburstShortsword"), + calamity.ItemType("FlameScythe"), + calamity.ItemType("FlameScytheMelee"), + calamity.ItemType("FlareBolt"), + calamity.ItemType("FlarefrostBlade"), + calamity.ItemType("FlarewingBow"), + calamity.ItemType("ForbiddenSun"), + calamity.ItemType("FrigidflashBolt"), + calamity.ItemType("GreatbowofTurmoil"), + calamity.ItemType("HarvestStaff"), + calamity.ItemType("Hellborn"), + calamity.ItemType("HellBurst"), + calamity.ItemType("HellfireFlamberge"), + calamity.ItemType("Hellkite"), + calamity.ItemType("HellwingStaff"), + calamity.ItemType("Helstorm"), + calamity.ItemType("InfernaCutter"), + calamity.ItemType("Lazhar"), + calamity.ItemType("MeteorFist"), + calamity.ItemType("Mourningstar"), + calamity.ItemType("PhoenixBlade"), + calamity.ItemType("Photoviscerator"), + calamity.ItemType("RedSun"), + calamity.ItemType("SpectralstormCannon"), + calamity.ItemType("SunGodStaff"), + calamity.ItemType("SunSpiritStaff"), + calamity.ItemType("TearsofHeaven"), + calamity.ItemType("TerraFlameburster"), + calamity.ItemType("TheEmpyrean"), + calamity.ItemType("TheLastMourning"), + calamity.ItemType("TheWand"), + calamity.ItemType("VenusianTrident"), + calamity.ItemType("Vesuvius"), + calamity.ItemType("BlissfulBombardier"), + calamity.ItemType("HolyCollider"), + calamity.ItemType("MoltenAmputator"), + calamity.ItemType("PurgeGuzzler"), + calamity.ItemType("SolarFlare"), + calamity.ItemType("TelluricGlare"), + calamity.ItemType("AngryChickenStaff"), + calamity.ItemType("ChickenCannon"), + calamity.ItemType("DragonRage"), + calamity.ItemType("DragonsBreath"), + calamity.ItemType("PhoenixFlameBarrage"), + calamity.ItemType("ProfanedTrident"), + calamity.ItemType("TheBurningSky"), + calamity.ItemType("HeliumFlash") + }; - natureWeaponList = new List() - { - ItemID.BladeofGrass, - ItemID.ChlorophyteClaymore, - ItemID.ChlorophyteSaber, - ItemID.ChlorophytePartisan, - ItemID.ChlorophyteShotbow, - ItemID.Seedler, - ItemID.ChristmasTreeSword, - ItemID.TerraBlade, - ItemID.JungleYoyo, - ItemID.Yelets, - ItemID.MushroomSpear, - ItemID.ThornChakram, - ItemID.Bananarang, - ItemID.FlowerPow, - ItemID.BeesKnees, - ItemID.Toxikarp, - ItemID.Bladetongue, - ItemID.PoisonStaff, - ItemID.VenomStaff, - ItemID.StaffofEarth, - ItemID.BeeGun, - ItemID.LeafBlower, - ItemID.WaspGun, - ItemID.CrystalSerpent, - ItemID.Razorpine, - ItemID.HornetStaff, - ItemID.QueenSpiderStaff, - ItemID.SlimeStaff, - ItemID.PygmyStaff, - ItemID.RavenStaff, - ItemID.BatScepter, - ItemID.SpiderStaff, - ItemID.Beenade, - ItemID.FrostDaggerfish, - calamity.ItemType("DepthBlade"), - calamity.ItemType("AbyssBlade"), - calamity.ItemType("NeptunesBounty"), - calamity.ItemType("AquaticDissolution"), - calamity.ItemType("ArchAmaryllis"), - calamity.ItemType("ThornBlossom"), - calamity.ItemType("BiomeBlade"), - calamity.ItemType("TrueBiomeBlade"), - calamity.ItemType("OmegaBiomeBlade"), - calamity.ItemType("BladedgeGreatbow"), - calamity.ItemType("BlossomFlux"), - calamity.ItemType("EvergladeSpray"), - calamity.ItemType("FeralthornClaymore"), - calamity.ItemType("Floodtide"), - calamity.ItemType("FourSeasonsGalaxia"), - calamity.ItemType("GammaFusillade"), - calamity.ItemType("GleamingMagnolia"), - calamity.ItemType("HarvestStaff"), - calamity.ItemType("HellionFlowerSpear"), - calamity.ItemType("Lazhar"), - calamity.ItemType("LifefruitScythe"), - calamity.ItemType("ManaRose"), - calamity.ItemType("MangroveChakram"), - calamity.ItemType("MangroveChakramMelee"), - calamity.ItemType("MantisClaws"), - calamity.ItemType("Mariana"), - calamity.ItemType("Mistlestorm"), - calamity.ItemType("Monsoon"), - calamity.ItemType("Alluvion"), - calamity.ItemType("Needler"), - calamity.ItemType("NettlelineGreatbow"), - calamity.ItemType("Quagmire"), - calamity.ItemType("Shroomer"), - calamity.ItemType("SolsticeClaymore"), - calamity.ItemType("SporeKnife"), - calamity.ItemType("Spyker"), - calamity.ItemType("StormSaber"), - calamity.ItemType("StormRuler"), - calamity.ItemType("StormSurge"), - calamity.ItemType("TarragonThrowingDart"), - calamity.ItemType("TerraEdge"), - calamity.ItemType("TerraLance"), - calamity.ItemType("TerraRay"), - calamity.ItemType("TerraShiv"), - calamity.ItemType("Terratomere"), - calamity.ItemType("TerraFlameburster"), - calamity.ItemType("TheSwarmer"), - calamity.ItemType("Verdant"), - calamity.ItemType("Barinautical"), - calamity.ItemType("DeepseaStaff"), - calamity.ItemType("Downpour"), - calamity.ItemType("SubmarineShocker"), - calamity.ItemType("Archerfish"), - calamity.ItemType("BallOFugu"), - calamity.ItemType("BlackAnurian"), - calamity.ItemType("CalamarisLament"), - calamity.ItemType("HerringStaff"), - calamity.ItemType("Lionfish") - }; - - alcoholList = new List() - { - calamity.BuffType("BloodyMary"), - calamity.BuffType("CaribbeanRum"), - calamity.BuffType("CinnamonRoll"), - calamity.BuffType("Everclear"), - calamity.BuffType("EvergreenGin"), - calamity.BuffType("Fireball"), - calamity.BuffType("GrapeBeer"), - calamity.BuffType("Margarita"), - calamity.BuffType("Moonshine"), - calamity.BuffType("MoscowMule"), - calamity.BuffType("RedWine"), - calamity.BuffType("Rum"), - calamity.BuffType("Screwdriver"), - calamity.BuffType("StarBeamRye"), - calamity.BuffType("Tequila"), - calamity.BuffType("TequilaSunrise"), - calamity.BuffType("Vodka"), - calamity.BuffType("Whiskey"), - calamity.BuffType("WhiteWine") - }; - - doubleDamageBuffList = new List() - { - ItemID.BallOHurt, - ItemID.TheMeatball, - ItemID.BlueMoon, - ItemID.Sunfury, - ItemID.DaoofPow, - ItemID.FlowerPow, - ItemID.Anchor, - ItemID.KOCannon, - ItemID.GolemFist, - ItemID.BreakerBlade, - ItemID.MonkStaffT2, - ItemID.ProximityMineLauncher, - ItemID.FireworksLauncher - }; - - sixtySixDamageBuffList = new List() - { - ItemID.TrueNightsEdge, - ItemID.WandofSparking, - ItemID.MedusaHead, - ItemID.StaffofEarth, - ItemID.ChristmasTreeSword, - ItemID.MonkStaffT1, - ItemID.InfernoFork, - ItemID.VenomStaff - }; - - fiftyDamageBuffList = new List() - { - ItemID.NightsEdge, - ItemID.EldMelter, - ItemID.Flamethrower, - ItemID.MoonlordTurretStaff, + natureWeaponList = new List() + { + ItemID.BladeofGrass, + ItemID.ChlorophyteClaymore, + ItemID.ChlorophyteSaber, + ItemID.ChlorophytePartisan, + ItemID.ChlorophyteShotbow, + ItemID.Seedler, + ItemID.ChristmasTreeSword, + ItemID.TerraBlade, + ItemID.JungleYoyo, + ItemID.Yelets, + ItemID.MushroomSpear, + ItemID.ThornChakram, + ItemID.Bananarang, + ItemID.FlowerPow, + ItemID.BeesKnees, + ItemID.Toxikarp, + ItemID.Bladetongue, + ItemID.PoisonStaff, + ItemID.VenomStaff, + ItemID.StaffofEarth, + ItemID.BeeGun, + ItemID.LeafBlower, ItemID.WaspGun, - ItemID.Keybrand, - ItemID.PulseBow, - ItemID.PaladinsHammer - }; - - thirtyThreeDamageBuffList = new List() - { - ItemID.CrystalVileShard, - ItemID.SoulDrain, - ItemID.ClingerStaff, - ItemID.ChargedBlasterCannon, - ItemID.NettleBurst, - ItemID.Excalibur, - ItemID.AmberStaff, - ItemID.BluePhasesaber, - ItemID.RedPhasesaber, - ItemID.GreenPhasesaber, - ItemID.WhitePhasesaber, - ItemID.YellowPhasesaber, - ItemID.PurplePhasesaber, - ItemID.TheRottedFork, - ItemID.VampireKnives, - ItemID.Cascade - }; - - twentyFiveDamageBuffList = new List() - { - ItemID.Muramasa, - ItemID.StakeLauncher, - ItemID.BookStaff - }; - - twentyDamageBuffList = new List() - { - ItemID.TerraBlade, - ItemID.ChainGuillotines, - ItemID.FlowerofFrost, - ItemID.PoisonStaff, - ItemID.Gungnir - }; - - weaponAutoreuseList = new List() - { - ItemID.NightsEdge, - ItemID.TrueNightsEdge, - ItemID.TrueExcalibur, - ItemID.PhoenixBlaster, - ItemID.VenusMagnum, - ItemID.MagicDagger, - ItemID.BeamSword, - ItemID.MonkStaffT2, - ItemID.PaladinsHammer - }; - - quarterDamageNerfList = new List() - { - ItemID.DaedalusStormbow, - ItemID.PhoenixBlaster, - ItemID.VenusMagnum, - ItemID.BlizzardStaff, - ItemID.Phantasm - }; - - pumpkinMoonBuffList = new List() - { - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.HeadlessHorseman, - NPCID.MourningWood, - NPCID.Splinterling, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.Hellhound, - NPCID.Poltergeist - }; - - frostMoonBuffList = new List() - { - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.PresentMimic, - NPCID.GingerbreadMan, - NPCID.Yeti, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.ElfCopter, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.ElfArcher, - NPCID.Krampus, - NPCID.Flocko - }; - - eclipseBuffList = new List() - { - NPCID.Eyezor, - NPCID.Reaper, - NPCID.Frankenstein, - NPCID.SwampThing, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.Fritz, - NPCID.Nailhead, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.DrManFly, - NPCID.ThePossessed, - NPCID.Mothron, - NPCID.MothronEgg, - NPCID.MothronSpawn - }; - - eventProjectileBuffList = new List() - { - ProjectileID.FlamingWood, - ProjectileID.GreekFire1, - ProjectileID.GreekFire2, - ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, - ProjectileID.FlamingArrow, - ProjectileID.PineNeedleHostile, - ProjectileID.OrnamentHostile, - ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, - ProjectileID.FrostShard, - ProjectileID.Missile, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.BulletDeadeye, - ProjectileID.EyeLaser, - ProjectileID.Nail, - ProjectileID.DrManFlyFlask - }; - - revengeanceEnemyBuffList = new List() - { - NPCID.KingSlime, - - NPCID.ServantofCthulhu, - NPCID.EyeofCthulhu, - - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - - NPCID.BrainofCthulhu, - NPCID.Creeper, - - NPCID.QueenBee, - NPCID.Bee, - NPCID.BeeSmall, - - NPCID.SkeletronHead, - NPCID.SkeletronHand, - - NPCID.WallofFlesh, - NPCID.TheHungryII, - NPCID.LeechHead, - - NPCID.Spazmatism, - NPCID.Retinazer, - - NPCID.SkeletronPrime, - NPCID.PrimeSaw, - NPCID.PrimeVice, - NPCID.PrimeLaser, - NPCID.PrimeCannon, - - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.Probe, - - NPCID.Plantera, - NPCID.PlanterasTentacle, - NPCID.Spore, - - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight, - - NPCID.DukeFishron, - NPCID.DetonatingBubble, - NPCID.Sharkron, - NPCID.Sharkron2, - - NPCID.DD2Betsy, - - NPCID.CultistDragonHead, - NPCID.AncientCultistSquidhead, - NPCID.AncientLight, - - NPCID.MoonLordHand, - - NPCID.DevourerHead, - NPCID.GiantWormHead, - NPCID.MeteorHead, - NPCID.BoneSerpentHead, - NPCID.ManEater, - NPCID.Snatcher, - NPCID.Piranha, - NPCID.Shark, - NPCID.SpikeBall, - NPCID.BlazingWheel, - NPCID.Mimic, - NPCID.WyvernHead, - NPCID.DiggerHead, - NPCID.SeekerHead, - NPCID.AnglerFish, - NPCID.Werewolf, - NPCID.Wraith, - NPCID.Arapaima, - NPCID.BlackRecluse, - NPCID.WallCreeper, - NPCID.WallCreeperWall, - NPCID.BlackRecluseWall, - NPCID.AngryTrapper, - NPCID.Lihzahrd, - NPCID.LihzahrdCrawler, - NPCID.PirateCaptain, - NPCID.FlyingSnake, - NPCID.Reaper, - NPCID.Paladin, - NPCID.BoneLee, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.PresentMimic, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.StardustWormHead, - NPCID.SolarCrawltipedeHead, - NPCID.Butcher, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.BigMimicCorruption, - NPCID.BigMimicCrimson, - NPCID.BigMimicHallow, - NPCID.Mothron, - NPCID.DuneSplicerHead, - NPCID.SlimeSpiked, - NPCID.SandShark, - NPCID.SandsharkCorrupt, - NPCID.SandsharkCrimson, - NPCID.SandsharkHallow, - - calamity.NPCType("DesertScourgeHead"), - calamity.NPCType("DesertScourgeHeadSmall"), - calamity.NPCType("DriedSeekerHead"), - - calamity.NPCType("CrabulonIdle"), - calamity.NPCType("CrabShroom"), - - calamity.NPCType("HiveMind"), - calamity.NPCType("HiveMindP2"), - calamity.NPCType("DankCreeper"), - - calamity.NPCType("PerforatorHeadLarge"), - calamity.NPCType("PerforatorHeadMedium"), - calamity.NPCType("PerforatorHeadSmall"), - calamity.NPCType("PerforatorHive"), - - calamity.NPCType("SlimeGod"), - calamity.NPCType("SlimeGodRun"), - calamity.NPCType("SlimeGodCore"), - calamity.NPCType("SlimeGodSplit"), - calamity.NPCType("SlimeGodRunSplit"), - calamity.NPCType("SlimeSpawnCorrupt"), - calamity.NPCType("SlimeSpawnCrimson2"), - - calamity.NPCType("Cryogen"), - calamity.NPCType("CryogenIce"), - calamity.NPCType("Cryocore"), - calamity.NPCType("Cryocore2"), - calamity.NPCType("IceMass"), - - calamity.NPCType("AquaticScourgeHead"), - calamity.NPCType("AquaticScourgeBody"), - calamity.NPCType("AquaticScourgeBodyAlt"), - calamity.NPCType("AquaticScourgeTail"), - - calamity.NPCType("BrimstoneElemental"), - - calamity.NPCType("Calamitas"), - calamity.NPCType("CalamitasRun3"), - calamity.NPCType("CalamitasRun"), - calamity.NPCType("CalamitasRun2"), - calamity.NPCType("LifeSeeker"), - calamity.NPCType("SoulSeeker"), - - calamity.NPCType("Parasea"), - calamity.NPCType("AquaticAberration"), - calamity.NPCType("Leviathan"), - calamity.NPCType("SirenIce"), - calamity.NPCType("Siren"), - - calamity.NPCType("Astrageldon"), - - calamity.NPCType("PlaguebringerGoliath"), - calamity.NPCType("PlaguebringerShade"), - calamity.NPCType("PlagueHomingMissile"), - calamity.NPCType("PlagueBeeG"), - calamity.NPCType("PlagueBeeLargeG"), - - calamity.NPCType("FlamePillar"), - calamity.NPCType("RockPillar"), - calamity.NPCType("ScavengerHead2"), - calamity.NPCType("ScavengerBody"), - calamity.NPCType("ScavengerClawRight"), - calamity.NPCType("ScavengerClawLeft"), - - calamity.NPCType("AstrumDeusHead"), - calamity.NPCType("AstrumDeusHeadSpectral"), - - calamity.NPCType("ProfanedGuardianBoss"), - calamity.NPCType("ProfanedGuardianBoss2"), - calamity.NPCType("ProfanedGuardianBoss3"), - - calamity.NPCType("Bumblefuck"), - calamity.NPCType("Bumblefuck2"), - - calamity.NPCType("OldDuke"), - calamity.NPCType("DukeUrchin"), - - calamity.NPCType("ProvSpawnDefense"), - calamity.NPCType("ProvSpawnOffense"), - - calamity.NPCType("CeaselessVoid"), - - calamity.NPCType("StormWeaverHead"), - calamity.NPCType("StormWeaverHeadNaked"), - - calamity.NPCType("CosmicWraith"), - calamity.NPCType("CosmicLantern"), - - calamity.NPCType("Polterghast"), - calamity.NPCType("PolterPhantom"), - - calamity.NPCType("DevourerofGodsHead"), - calamity.NPCType("DevourerofGodsBody"), - calamity.NPCType("DevourerofGodsTail"), - calamity.NPCType("DevourerofGodsHead2"), - calamity.NPCType("DevourerofGodsHeadS"), - calamity.NPCType("DevourerofGodsBodyS"), - calamity.NPCType("DevourerofGodsTailS"), - - calamity.NPCType("Yharon"), - calamity.NPCType("DetonatingFlare"), - calamity.NPCType("DetonatingFlare2"), - - calamity.NPCType("SupremeCalamitas"), - - calamity.NPCType("BobbitWormHead"), - calamity.NPCType("AquaticSeekerHead"), - calamity.NPCType("ColossalSquid"), - calamity.NPCType("EidolonWyrmHead"), - calamity.NPCType("EidolonWyrmHeadHuge"), - calamity.NPCType("GulperEelHead"), - calamity.NPCType("Mauler"), - calamity.NPCType("Reaper"), - - calamity.NPCType("Atlas"), - calamity.NPCType("ArmoredDiggerHead"), - calamity.NPCType("Cnidrion"), - calamity.NPCType("GreatSandShark"), - calamity.NPCType("Horse"), - calamity.NPCType("ScornEater"), - - calamity.NPCType("PrismTurtle"), - calamity.NPCType("GhostBell"), - calamity.NPCType("EutrophicRay"), - calamity.NPCType("Clam"), - calamity.NPCType("SeaSerpent1"), - calamity.NPCType("BlindedAngler"), - calamity.NPCType("GiantClam") - }; - - revengeanceProjectileBuffList = new List() - { - ProjectileID.Sharknado, - ProjectileID.Cthulunado, - ProjectileID.DD2BetsyFireball, - ProjectileID.DD2BetsyFlameBreath, - ProjectileID.PhantasmalEye, - ProjectileID.PhantasmalSphere, - ProjectileID.PhantasmalDeathray, - ProjectileID.PhantasmalBolt, - - ProjectileID.SandBallFalling, - ProjectileID.AshBallFalling, - ProjectileID.DemonSickle, - ProjectileID.EbonsandBallFalling, - ProjectileID.PearlSandBallFalling, - ProjectileID.Boulder, - ProjectileID.PoisonDartTrap, - ProjectileID.SpikyBallTrap, - ProjectileID.SpearTrap, - ProjectileID.FlamethrowerTrap, - ProjectileID.FlamesTrap, - ProjectileID.CrimsandBallFalling, - ProjectileID.Fireball, - ProjectileID.PaladinsHammerHostile, - ProjectileID.FlamingWood, - ProjectileID.FlamingScythe, - ProjectileID.FrostWave, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.SaucerDeathray, - ProjectileID.NebulaBolt, - ProjectileID.NebulaSphere, - ProjectileID.NebulaLaser, - ProjectileID.StardustSoldierLaser, - ProjectileID.VortexLaser, - ProjectileID.VortexVortexLightning, - ProjectileID.VortexLightning, - ProjectileID.VortexAcid, - ProjectileID.GeyserTrap, - ProjectileID.SandnadoHostile, - - calamity.ProjectileType("SandBlast"), - - calamity.ProjectileType("MushBomb"), - calamity.ProjectileType("MushBombFall"), - calamity.ProjectileType("Mushmash"), - - calamity.ProjectileType("ShaderainHostile"), - - calamity.ProjectileType("BloodGeyser"), - calamity.ProjectileType("IchorShot"), - - calamity.ProjectileType("AbyssMine"), - calamity.ProjectileType("AbyssMine2"), - calamity.ProjectileType("AbyssBallVolley"), - calamity.ProjectileType("AbyssBallVolley2"), - - calamity.ProjectileType("IceBlast"), - calamity.ProjectileType("IceBomb"), - calamity.ProjectileType("IceRain"), - - calamity.ProjectileType("SandPoisonCloud"), - calamity.ProjectileType("SandTooth"), - - calamity.ProjectileType("BrimstoneHellfireball"), - calamity.ProjectileType("HellfireExplosion"), - calamity.ProjectileType("BrimstoneBarrage"), - calamity.ProjectileType("BrimstoneHellblast"), - - calamity.ProjectileType("BrimstoneLaser"), - calamity.ProjectileType("BrimstoneLaserSplit"), - calamity.ProjectileType("BrimstoneBall"), - calamity.ProjectileType("BrimstoneFire"), - - calamity.ProjectileType("LeviathanBomb"), - calamity.ProjectileType("WaterSpear"), - calamity.ProjectileType("FrostMist"), - calamity.ProjectileType("SirenSong"), - - calamity.ProjectileType("AstralFlame"), - calamity.ProjectileType("AstralLaser"), - - calamity.ProjectileType("PlagueExplosion"), - calamity.ProjectileType("PlagueStingerGoliath"), - calamity.ProjectileType("PlagueStingerGoliathV2"), - calamity.ProjectileType("HiveBombGoliath"), - - calamity.ProjectileType("ScavengerNuke"), - - calamity.ProjectileType("AstralShot2"), - calamity.ProjectileType("DeusMine"), - - calamity.ProjectileType("ProfanedSpear"), - calamity.ProjectileType("FlareDust"), - - calamity.ProjectileType("RedLightningFeather"), - - calamity.ProjectileType("HolyBlast"), - calamity.ProjectileType("HolyBomb"), - calamity.ProjectileType("HolyFire"), - calamity.ProjectileType("HolyFire2"), - calamity.ProjectileType("HolyFlare"), - calamity.ProjectileType("HolyShot"), - calamity.ProjectileType("HolySpear"), - calamity.ProjectileType("MoltenBlast"), - calamity.ProjectileType("MoltenBlob"), - calamity.ProjectileType("ProvidenceCrystalShard"), - calamity.ProjectileType("ProvidenceHolyRay"), - - calamity.ProjectileType("DarkEnergyBall"), - calamity.ProjectileType("DoGBeam"), - - calamity.ProjectileType("CosmicFlameBurst"), - calamity.ProjectileType("SignusScythe"), - calamity.ProjectileType("EssenceDust"), - - calamity.ProjectileType("PhantomBlast"), - calamity.ProjectileType("PhantomBlast2"), - calamity.ProjectileType("PhantomGhostShot"), - calamity.ProjectileType("PhantomHookShot"), - calamity.ProjectileType("PhantomMine"), - calamity.ProjectileType("PhantomShot"), - calamity.ProjectileType("PhantomShot2"), - - calamity.ProjectileType("DoGDeath"), - calamity.ProjectileType("DoGFire"), - calamity.ProjectileType("DoGNebulaShot"), - - calamity.ProjectileType("FlareBomb"), - calamity.ProjectileType("FlareDust2"), - calamity.ProjectileType("Flarenado"), - calamity.ProjectileType("Infernado"), - calamity.ProjectileType("Infernado2"), - calamity.ProjectileType("YharonFireball"), - calamity.ProjectileType("YharonFireball2"), - - calamity.ProjectileType("BrimstoneFireblast"), - calamity.ProjectileType("BrimstoneGigaBlast"), - calamity.ProjectileType("BrimstoneHellblast2"), - calamity.ProjectileType("BrimstoneMonster"), - calamity.ProjectileType("BrimstoneWave"), - - calamity.ProjectileType("GreatSandBlast"), - calamity.ProjectileType("PearlBurst"), - calamity.ProjectileType("PearlRain") - }; + ItemID.CrystalSerpent, + ItemID.Razorpine, + ItemID.HornetStaff, + ItemID.QueenSpiderStaff, + ItemID.SlimeStaff, + ItemID.PygmyStaff, + ItemID.RavenStaff, + ItemID.BatScepter, + ItemID.SpiderStaff, + ItemID.Beenade, + ItemID.FrostDaggerfish, + calamity.ItemType("DepthBlade"), + calamity.ItemType("AbyssBlade"), + calamity.ItemType("NeptunesBounty"), + calamity.ItemType("AquaticDissolution"), + calamity.ItemType("ArchAmaryllis"), + calamity.ItemType("ThornBlossom"), + calamity.ItemType("BiomeBlade"), + calamity.ItemType("TrueBiomeBlade"), + calamity.ItemType("OmegaBiomeBlade"), + calamity.ItemType("BladedgeGreatbow"), + calamity.ItemType("BlossomFlux"), + calamity.ItemType("EvergladeSpray"), + calamity.ItemType("FeralthornClaymore"), + calamity.ItemType("Floodtide"), + calamity.ItemType("FourSeasonsGalaxia"), + calamity.ItemType("GammaFusillade"), + calamity.ItemType("GleamingMagnolia"), + calamity.ItemType("HarvestStaff"), + calamity.ItemType("HellionFlowerSpear"), + calamity.ItemType("Lazhar"), + calamity.ItemType("LifefruitScythe"), + calamity.ItemType("ManaRose"), + calamity.ItemType("MangroveChakram"), + calamity.ItemType("MangroveChakramMelee"), + calamity.ItemType("MantisClaws"), + calamity.ItemType("Mariana"), + calamity.ItemType("Mistlestorm"), + calamity.ItemType("Monsoon"), + calamity.ItemType("Alluvion"), + calamity.ItemType("Needler"), + calamity.ItemType("NettlelineGreatbow"), + calamity.ItemType("Quagmire"), + calamity.ItemType("Shroomer"), + calamity.ItemType("SolsticeClaymore"), + calamity.ItemType("SporeKnife"), + calamity.ItemType("Spyker"), + calamity.ItemType("StormSaber"), + calamity.ItemType("StormRuler"), + calamity.ItemType("StormSurge"), + calamity.ItemType("TarragonThrowingDart"), + calamity.ItemType("TerraEdge"), + calamity.ItemType("TerraLance"), + calamity.ItemType("TerraRay"), + calamity.ItemType("TerraShiv"), + calamity.ItemType("Terratomere"), + calamity.ItemType("TerraFlameburster"), + calamity.ItemType("TheSwarmer"), + calamity.ItemType("Verdant"), + calamity.ItemType("Barinautical"), + calamity.ItemType("DeepseaStaff"), + calamity.ItemType("Downpour"), + calamity.ItemType("SubmarineShocker"), + calamity.ItemType("Archerfish"), + calamity.ItemType("BallOFugu"), + calamity.ItemType("BlackAnurian"), + calamity.ItemType("CalamarisLament"), + calamity.ItemType("HerringStaff"), + calamity.ItemType("Lionfish") + }; + + alcoholList = new List() + { + calamity.BuffType("BloodyMary"), + calamity.BuffType("CaribbeanRum"), + calamity.BuffType("CinnamonRoll"), + calamity.BuffType("Everclear"), + calamity.BuffType("EvergreenGin"), + calamity.BuffType("Fireball"), + calamity.BuffType("GrapeBeer"), + calamity.BuffType("Margarita"), + calamity.BuffType("Moonshine"), + calamity.BuffType("MoscowMule"), + calamity.BuffType("RedWine"), + calamity.BuffType("Rum"), + calamity.BuffType("Screwdriver"), + calamity.BuffType("StarBeamRye"), + calamity.BuffType("Tequila"), + calamity.BuffType("TequilaSunrise"), + calamity.BuffType("Vodka"), + calamity.BuffType("Whiskey"), + calamity.BuffType("WhiteWine") + }; + + doubleDamageBuffList = new List() + { + ItemID.BallOHurt, + ItemID.TheMeatball, + ItemID.BlueMoon, + ItemID.Sunfury, + ItemID.DaoofPow, + ItemID.FlowerPow, + ItemID.Anchor, + ItemID.KOCannon, + ItemID.GolemFist, + ItemID.BreakerBlade, + ItemID.MonkStaffT2, + ItemID.ProximityMineLauncher, + ItemID.FireworksLauncher + }; + + sixtySixDamageBuffList = new List() + { + ItemID.TrueNightsEdge, + ItemID.WandofSparking, + ItemID.MedusaHead, + ItemID.StaffofEarth, + ItemID.ChristmasTreeSword, + ItemID.MonkStaffT1, + ItemID.InfernoFork, + ItemID.VenomStaff + }; + + fiftyDamageBuffList = new List() + { + ItemID.NightsEdge, + ItemID.EldMelter, + ItemID.Flamethrower, + ItemID.MoonlordTurretStaff, + ItemID.WaspGun, + ItemID.Keybrand, + ItemID.PulseBow, + ItemID.PaladinsHammer + }; + + thirtyThreeDamageBuffList = new List() + { + ItemID.CrystalVileShard, + ItemID.SoulDrain, + ItemID.ClingerStaff, + ItemID.ChargedBlasterCannon, + ItemID.NettleBurst, + ItemID.Excalibur, + ItemID.AmberStaff, + ItemID.BluePhasesaber, + ItemID.RedPhasesaber, + ItemID.GreenPhasesaber, + ItemID.WhitePhasesaber, + ItemID.YellowPhasesaber, + ItemID.PurplePhasesaber, + ItemID.TheRottedFork, + ItemID.VampireKnives, + ItemID.Cascade + }; + + twentyFiveDamageBuffList = new List() + { + ItemID.Muramasa, + ItemID.StakeLauncher, + ItemID.BookStaff + }; + + twentyDamageBuffList = new List() + { + ItemID.TerraBlade, + ItemID.ChainGuillotines, + ItemID.FlowerofFrost, + ItemID.PoisonStaff, + ItemID.Gungnir + }; + + weaponAutoreuseList = new List() + { + ItemID.NightsEdge, + ItemID.TrueNightsEdge, + ItemID.TrueExcalibur, + ItemID.PhoenixBlaster, + ItemID.VenusMagnum, + ItemID.MagicDagger, + ItemID.BeamSword, + ItemID.MonkStaffT2, + ItemID.PaladinsHammer + }; + + quarterDamageNerfList = new List() + { + ItemID.DaedalusStormbow, + ItemID.PhoenixBlaster, + ItemID.VenusMagnum, + ItemID.BlizzardStaff, + ItemID.Phantasm + }; + + pumpkinMoonBuffList = new List() + { + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.HeadlessHorseman, + NPCID.MourningWood, + NPCID.Splinterling, + NPCID.Pumpking, + NPCID.PumpkingBlade, + NPCID.Hellhound, + NPCID.Poltergeist + }; + + frostMoonBuffList = new List() + { + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, + NPCID.PresentMimic, + NPCID.GingerbreadMan, + NPCID.Yeti, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.ElfCopter, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.ElfArcher, + NPCID.Krampus, + NPCID.Flocko + }; + + eclipseBuffList = new List() + { + NPCID.Eyezor, + NPCID.Reaper, + NPCID.Frankenstein, + NPCID.SwampThing, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.Fritz, + NPCID.Nailhead, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.DrManFly, + NPCID.ThePossessed, + NPCID.Mothron, + NPCID.MothronEgg, + NPCID.MothronSpawn + }; + + eventProjectileBuffList = new List() + { + ProjectileID.FlamingWood, + ProjectileID.GreekFire1, + ProjectileID.GreekFire2, + ProjectileID.GreekFire3, + ProjectileID.FlamingScythe, + ProjectileID.FlamingArrow, + ProjectileID.PineNeedleHostile, + ProjectileID.OrnamentHostile, + ProjectileID.OrnamentHostileShrapnel, + ProjectileID.FrostWave, + ProjectileID.FrostShard, + ProjectileID.Missile, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.BulletDeadeye, + ProjectileID.EyeLaser, + ProjectileID.Nail, + ProjectileID.DrManFlyFlask + }; + + revengeanceEnemyBuffList = new List() + { + NPCID.KingSlime, + + NPCID.ServantofCthulhu, + NPCID.EyeofCthulhu, + + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + + NPCID.BrainofCthulhu, + NPCID.Creeper, + + NPCID.QueenBee, + NPCID.Bee, + NPCID.BeeSmall, + + NPCID.SkeletronHead, + NPCID.SkeletronHand, + + NPCID.WallofFlesh, + NPCID.TheHungryII, + NPCID.LeechHead, + + NPCID.Spazmatism, + NPCID.Retinazer, + + NPCID.SkeletronPrime, + NPCID.PrimeSaw, + NPCID.PrimeVice, + NPCID.PrimeLaser, + NPCID.PrimeCannon, + + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.Probe, + + NPCID.Plantera, + NPCID.PlanterasTentacle, + NPCID.Spore, + + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight, + + NPCID.DukeFishron, + NPCID.DetonatingBubble, + NPCID.Sharkron, + NPCID.Sharkron2, + + NPCID.DD2Betsy, + + NPCID.CultistDragonHead, + NPCID.AncientCultistSquidhead, + NPCID.AncientLight, + + NPCID.MoonLordHand, + + NPCID.DevourerHead, + NPCID.GiantWormHead, + NPCID.MeteorHead, + NPCID.BoneSerpentHead, + NPCID.ManEater, + NPCID.Snatcher, + NPCID.Piranha, + NPCID.Shark, + NPCID.SpikeBall, + NPCID.BlazingWheel, + NPCID.Mimic, + NPCID.WyvernHead, + NPCID.DiggerHead, + NPCID.SeekerHead, + NPCID.AnglerFish, + NPCID.Werewolf, + NPCID.Wraith, + NPCID.Arapaima, + NPCID.BlackRecluse, + NPCID.WallCreeper, + NPCID.WallCreeperWall, + NPCID.BlackRecluseWall, + NPCID.AngryTrapper, + NPCID.Lihzahrd, + NPCID.LihzahrdCrawler, + NPCID.PirateCaptain, + NPCID.FlyingSnake, + NPCID.Reaper, + NPCID.Paladin, + NPCID.BoneLee, + NPCID.MourningWood, + NPCID.Pumpking, + NPCID.PumpkingBlade, + NPCID.PresentMimic, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.StardustWormHead, + NPCID.SolarCrawltipedeHead, + NPCID.Butcher, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.BigMimicCorruption, + NPCID.BigMimicCrimson, + NPCID.BigMimicHallow, + NPCID.Mothron, + NPCID.DuneSplicerHead, + NPCID.SlimeSpiked, + NPCID.SandShark, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson, + NPCID.SandsharkHallow, + + calamity.NPCType("DesertScourgeHead"), + calamity.NPCType("DesertScourgeHeadSmall"), + calamity.NPCType("DriedSeekerHead"), + + calamity.NPCType("CrabulonIdle"), + calamity.NPCType("CrabShroom"), + + calamity.NPCType("HiveMind"), + calamity.NPCType("HiveMindP2"), + calamity.NPCType("DankCreeper"), + + calamity.NPCType("PerforatorHeadLarge"), + calamity.NPCType("PerforatorHeadMedium"), + calamity.NPCType("PerforatorHeadSmall"), + calamity.NPCType("PerforatorHive"), + + calamity.NPCType("SlimeGod"), + calamity.NPCType("SlimeGodRun"), + calamity.NPCType("SlimeGodCore"), + calamity.NPCType("SlimeGodSplit"), + calamity.NPCType("SlimeGodRunSplit"), + calamity.NPCType("SlimeSpawnCorrupt"), + calamity.NPCType("SlimeSpawnCrimson2"), + + calamity.NPCType("Cryogen"), + calamity.NPCType("CryogenIce"), + calamity.NPCType("Cryocore"), + calamity.NPCType("Cryocore2"), + calamity.NPCType("IceMass"), + + calamity.NPCType("AquaticScourgeHead"), + calamity.NPCType("AquaticScourgeBody"), + calamity.NPCType("AquaticScourgeBodyAlt"), + calamity.NPCType("AquaticScourgeTail"), + + calamity.NPCType("BrimstoneElemental"), + + calamity.NPCType("Calamitas"), + calamity.NPCType("CalamitasRun3"), + calamity.NPCType("CalamitasRun"), + calamity.NPCType("CalamitasRun2"), + calamity.NPCType("LifeSeeker"), + calamity.NPCType("SoulSeeker"), + + calamity.NPCType("Parasea"), + calamity.NPCType("AquaticAberration"), + calamity.NPCType("Leviathan"), + calamity.NPCType("SirenIce"), + calamity.NPCType("Siren"), + + calamity.NPCType("Astrageldon"), + + calamity.NPCType("PlaguebringerGoliath"), + calamity.NPCType("PlaguebringerShade"), + calamity.NPCType("PlagueHomingMissile"), + calamity.NPCType("PlagueBeeG"), + calamity.NPCType("PlagueBeeLargeG"), + + calamity.NPCType("FlamePillar"), + calamity.NPCType("RockPillar"), + calamity.NPCType("ScavengerHead2"), + calamity.NPCType("ScavengerBody"), + calamity.NPCType("ScavengerClawRight"), + calamity.NPCType("ScavengerClawLeft"), + + calamity.NPCType("AstrumDeusHead"), + calamity.NPCType("AstrumDeusHeadSpectral"), + + calamity.NPCType("ProfanedGuardianBoss"), + calamity.NPCType("ProfanedGuardianBoss2"), + calamity.NPCType("ProfanedGuardianBoss3"), + + calamity.NPCType("Bumblefuck"), + calamity.NPCType("Bumblefuck2"), + + calamity.NPCType("OldDuke"), + calamity.NPCType("DukeUrchin"), + + calamity.NPCType("ProvSpawnDefense"), + calamity.NPCType("ProvSpawnOffense"), + + calamity.NPCType("CeaselessVoid"), + + calamity.NPCType("StormWeaverHead"), + calamity.NPCType("StormWeaverHeadNaked"), + + calamity.NPCType("CosmicWraith"), + calamity.NPCType("CosmicLantern"), + + calamity.NPCType("Polterghast"), + calamity.NPCType("PolterPhantom"), + + calamity.NPCType("DevourerofGodsHead"), + calamity.NPCType("DevourerofGodsBody"), + calamity.NPCType("DevourerofGodsTail"), + calamity.NPCType("DevourerofGodsHead2"), + calamity.NPCType("DevourerofGodsHeadS"), + calamity.NPCType("DevourerofGodsBodyS"), + calamity.NPCType("DevourerofGodsTailS"), + + calamity.NPCType("Yharon"), + calamity.NPCType("DetonatingFlare"), + calamity.NPCType("DetonatingFlare2"), + + calamity.NPCType("SupremeCalamitas"), + + calamity.NPCType("BobbitWormHead"), + calamity.NPCType("AquaticSeekerHead"), + calamity.NPCType("ColossalSquid"), + calamity.NPCType("EidolonWyrmHead"), + calamity.NPCType("EidolonWyrmHeadHuge"), + calamity.NPCType("GulperEelHead"), + calamity.NPCType("Mauler"), + calamity.NPCType("Reaper"), + + calamity.NPCType("Atlas"), + calamity.NPCType("ArmoredDiggerHead"), + calamity.NPCType("Cnidrion"), + calamity.NPCType("GreatSandShark"), + calamity.NPCType("Horse"), + calamity.NPCType("ScornEater"), + + calamity.NPCType("PrismTurtle"), + calamity.NPCType("GhostBell"), + calamity.NPCType("EutrophicRay"), + calamity.NPCType("Clam"), + calamity.NPCType("SeaSerpent1"), + calamity.NPCType("BlindedAngler"), + calamity.NPCType("GiantClam") + }; + + revengeanceProjectileBuffList = new List() + { + ProjectileID.Sharknado, + ProjectileID.Cthulunado, + ProjectileID.DD2BetsyFireball, + ProjectileID.DD2BetsyFlameBreath, + ProjectileID.PhantasmalEye, + ProjectileID.PhantasmalSphere, + ProjectileID.PhantasmalDeathray, + ProjectileID.PhantasmalBolt, + + ProjectileID.SandBallFalling, + ProjectileID.AshBallFalling, + ProjectileID.DemonSickle, + ProjectileID.EbonsandBallFalling, + ProjectileID.PearlSandBallFalling, + ProjectileID.Boulder, + ProjectileID.PoisonDartTrap, + ProjectileID.SpikyBallTrap, + ProjectileID.SpearTrap, + ProjectileID.FlamethrowerTrap, + ProjectileID.FlamesTrap, + ProjectileID.CrimsandBallFalling, + ProjectileID.Fireball, + ProjectileID.PaladinsHammerHostile, + ProjectileID.FlamingWood, + ProjectileID.FlamingScythe, + ProjectileID.FrostWave, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.SaucerDeathray, + ProjectileID.NebulaBolt, + ProjectileID.NebulaSphere, + ProjectileID.NebulaLaser, + ProjectileID.StardustSoldierLaser, + ProjectileID.VortexLaser, + ProjectileID.VortexVortexLightning, + ProjectileID.VortexLightning, + ProjectileID.VortexAcid, + ProjectileID.GeyserTrap, + ProjectileID.SandnadoHostile, + + calamity.ProjectileType("SandBlast"), + + calamity.ProjectileType("MushBomb"), + calamity.ProjectileType("MushBombFall"), + calamity.ProjectileType("Mushmash"), + + calamity.ProjectileType("ShaderainHostile"), + + calamity.ProjectileType("BloodGeyser"), + calamity.ProjectileType("IchorShot"), + + calamity.ProjectileType("AbyssMine"), + calamity.ProjectileType("AbyssMine2"), + calamity.ProjectileType("AbyssBallVolley"), + calamity.ProjectileType("AbyssBallVolley2"), + + calamity.ProjectileType("IceBlast"), + calamity.ProjectileType("IceBomb"), + calamity.ProjectileType("IceRain"), + + calamity.ProjectileType("SandPoisonCloud"), + calamity.ProjectileType("SandTooth"), + + calamity.ProjectileType("BrimstoneHellfireball"), + calamity.ProjectileType("HellfireExplosion"), + calamity.ProjectileType("BrimstoneBarrage"), + calamity.ProjectileType("BrimstoneHellblast"), + + calamity.ProjectileType("BrimstoneLaser"), + calamity.ProjectileType("BrimstoneLaserSplit"), + calamity.ProjectileType("BrimstoneBall"), + calamity.ProjectileType("BrimstoneFire"), + + calamity.ProjectileType("LeviathanBomb"), + calamity.ProjectileType("WaterSpear"), + calamity.ProjectileType("FrostMist"), + calamity.ProjectileType("SirenSong"), + + calamity.ProjectileType("AstralFlame"), + calamity.ProjectileType("AstralLaser"), + + calamity.ProjectileType("PlagueExplosion"), + calamity.ProjectileType("PlagueStingerGoliath"), + calamity.ProjectileType("PlagueStingerGoliathV2"), + calamity.ProjectileType("HiveBombGoliath"), + + calamity.ProjectileType("ScavengerNuke"), + + calamity.ProjectileType("AstralShot2"), + calamity.ProjectileType("DeusMine"), + + calamity.ProjectileType("ProfanedSpear"), + calamity.ProjectileType("FlareDust"), + + calamity.ProjectileType("RedLightningFeather"), + + calamity.ProjectileType("HolyBlast"), + calamity.ProjectileType("HolyBomb"), + calamity.ProjectileType("HolyFire"), + calamity.ProjectileType("HolyFire2"), + calamity.ProjectileType("HolyFlare"), + calamity.ProjectileType("HolyShot"), + calamity.ProjectileType("HolySpear"), + calamity.ProjectileType("MoltenBlast"), + calamity.ProjectileType("MoltenBlob"), + calamity.ProjectileType("ProvidenceCrystalShard"), + calamity.ProjectileType("ProvidenceHolyRay"), + + calamity.ProjectileType("DarkEnergyBall"), + calamity.ProjectileType("DoGBeam"), + + calamity.ProjectileType("CosmicFlameBurst"), + calamity.ProjectileType("SignusScythe"), + calamity.ProjectileType("EssenceDust"), + + calamity.ProjectileType("PhantomBlast"), + calamity.ProjectileType("PhantomBlast2"), + calamity.ProjectileType("PhantomGhostShot"), + calamity.ProjectileType("PhantomHookShot"), + calamity.ProjectileType("PhantomMine"), + calamity.ProjectileType("PhantomShot"), + calamity.ProjectileType("PhantomShot2"), + + calamity.ProjectileType("DoGDeath"), + calamity.ProjectileType("DoGFire"), + calamity.ProjectileType("DoGNebulaShot"), + + calamity.ProjectileType("FlareBomb"), + calamity.ProjectileType("FlareDust2"), + calamity.ProjectileType("Flarenado"), + calamity.ProjectileType("Infernado"), + calamity.ProjectileType("Infernado2"), + calamity.ProjectileType("YharonFireball"), + calamity.ProjectileType("YharonFireball2"), + + calamity.ProjectileType("BrimstoneFireblast"), + calamity.ProjectileType("BrimstoneGigaBlast"), + calamity.ProjectileType("BrimstoneHellblast2"), + calamity.ProjectileType("BrimstoneMonster"), + calamity.ProjectileType("BrimstoneWave"), + + calamity.ProjectileType("GreatSandBlast"), + calamity.ProjectileType("PearlBurst"), + calamity.ProjectileType("PearlRain") + }; revengeanceLifeStealExceptionList = new List() { @@ -1446,9 +1446,9 @@ namespace CalamityMod NPCID.CultistDragonBody3, NPCID.CultistDragonBody4, NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.AncientLight, - NPCID.Sharkron, + NPCID.AncientCultistSquidhead, + NPCID.AncientLight, + NPCID.Sharkron, NPCID.Sharkron2, NPCID.PlanterasTentacle, NPCID.Spore, @@ -1461,7 +1461,7 @@ namespace CalamityMod NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.GolemHead, - NPCID.GolemHeadFree, + NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.MoonLordCore @@ -1473,102 +1473,102 @@ namespace CalamityMod }; trapProjectileList = new List() - { - ProjectileID.PoisonDartTrap, - ProjectileID.SpikyBallTrap, - ProjectileID.SpearTrap, - ProjectileID.FlamethrowerTrap, - ProjectileID.FlamesTrap, - ProjectileID.PoisonDart, - ProjectileID.GeyserTrap - }; + { + ProjectileID.PoisonDartTrap, + ProjectileID.SpikyBallTrap, + ProjectileID.SpearTrap, + ProjectileID.FlamethrowerTrap, + ProjectileID.FlamesTrap, + ProjectileID.PoisonDart, + ProjectileID.GeyserTrap + }; - scopedWeaponList = new List() - { - calamity.ItemType("AMR"), - calamity.ItemType("HalleysInferno"), - calamity.ItemType("Shroomer"), - calamity.ItemType("SpectreRifle"), - calamity.ItemType("Svantechnical"), - calamity.ItemType("Skullmasher") - }; + scopedWeaponList = new List() + { + calamity.ItemType("AMR"), + calamity.ItemType("HalleysInferno"), + calamity.ItemType("Shroomer"), + calamity.ItemType("SpectreRifle"), + calamity.ItemType("Svantechnical"), + calamity.ItemType("Skullmasher") + }; - trueMeleeBoostExceptionList = new List() - { - ItemID.FlowerPow, - ItemID.Flairon, - ItemID.ChlorophytePartisan, - ItemID.MushroomSpear, - ItemID.NorthPole, - ItemID.WoodYoyo, - ItemID.CorruptYoyo, - ItemID.CrimsonYoyo, - ItemID.JungleYoyo, - ItemID.Cascade, - ItemID.Chik, - ItemID.Code2, - ItemID.Rally, - ItemID.Yelets, - ItemID.RedsYoyo, - ItemID.ValkyrieYoyo, - ItemID.Amarok, - ItemID.HelFire, - ItemID.Kraken, - ItemID.TheEyeOfCthulhu, - ItemID.FormatC, - ItemID.Gradient, - ItemID.Valor, - ItemID.Terrarian, - calamity.ItemType("BallOFugu"), - calamity.ItemType("TyphonsGreed"), - calamity.ItemType("UrchinSpear"), - calamity.ItemType("AmidiasTrident"), - calamity.ItemType("GoldplumeSpear"), - calamity.ItemType("EarthenPike"), - calamity.ItemType("HellionFlowerSpear"), - calamity.ItemType("StarnightLance"), - calamity.ItemType("TerraLance"), - calamity.ItemType("BansheeHook"), - calamity.ItemType("SpatialLance"), - calamity.ItemType("StreamGouge"), - calamity.ItemType("AirSpinner"), - calamity.ItemType("Aorta"), - calamity.ItemType("Azathoth"), - calamity.ItemType("Chaotrix"), - calamity.ItemType("Cnidarian"), - calamity.ItemType("Lacerator"), - calamity.ItemType("Quagmire"), - calamity.ItemType("Shimmerspark"), - calamity.ItemType("SolarFlare"), - calamity.ItemType("TheEyeofCalamitas"), - calamity.ItemType("TheGodsGambit"), - calamity.ItemType("TheObliterator"), - calamity.ItemType("ThePlaguebringer"), - calamity.ItemType("Verdant"), - calamity.ItemType("YinYo") - }; + trueMeleeBoostExceptionList = new List() + { + ItemID.FlowerPow, + ItemID.Flairon, + ItemID.ChlorophytePartisan, + ItemID.MushroomSpear, + ItemID.NorthPole, + ItemID.WoodYoyo, + ItemID.CorruptYoyo, + ItemID.CrimsonYoyo, + ItemID.JungleYoyo, + ItemID.Cascade, + ItemID.Chik, + ItemID.Code2, + ItemID.Rally, + ItemID.Yelets, + ItemID.RedsYoyo, + ItemID.ValkyrieYoyo, + ItemID.Amarok, + ItemID.HelFire, + ItemID.Kraken, + ItemID.TheEyeOfCthulhu, + ItemID.FormatC, + ItemID.Gradient, + ItemID.Valor, + ItemID.Terrarian, + calamity.ItemType("BallOFugu"), + calamity.ItemType("TyphonsGreed"), + calamity.ItemType("UrchinSpear"), + calamity.ItemType("AmidiasTrident"), + calamity.ItemType("GoldplumeSpear"), + calamity.ItemType("EarthenPike"), + calamity.ItemType("HellionFlowerSpear"), + calamity.ItemType("StarnightLance"), + calamity.ItemType("TerraLance"), + calamity.ItemType("BansheeHook"), + calamity.ItemType("SpatialLance"), + calamity.ItemType("StreamGouge"), + calamity.ItemType("AirSpinner"), + calamity.ItemType("Aorta"), + calamity.ItemType("Azathoth"), + calamity.ItemType("Chaotrix"), + calamity.ItemType("Cnidarian"), + calamity.ItemType("Lacerator"), + calamity.ItemType("Quagmire"), + calamity.ItemType("Shimmerspark"), + calamity.ItemType("SolarFlare"), + calamity.ItemType("TheEyeofCalamitas"), + calamity.ItemType("TheGodsGambit"), + calamity.ItemType("TheObliterator"), + calamity.ItemType("ThePlaguebringer"), + calamity.ItemType("Verdant"), + calamity.ItemType("YinYo") + }; - tableList = new List() - { - calamity.TileType("AbyssBath"), - calamity.TileType("AbyssBookcase"), - calamity.TileType("AbyssDresser"), - calamity.TileType("AbyssPiano"), - calamity.TileType("AbyssTable"), - calamity.TileType("AbyssWorkbench"), - calamity.TileType("AncientBath"), - calamity.TileType("AncientBookcase"), - calamity.TileType("AncientDresser"), - calamity.TileType("AncientPiano"), - calamity.TileType("AncientTable"), - calamity.TileType("AncientWorkbench"), - calamity.TileType("AshenBath"), - calamity.TileType("AshenBookcase"), - calamity.TileType("AshenDresser"), - calamity.TileType("AshenPiano"), - calamity.TileType("AshenTable"), - calamity.TileType("AshenWorkbench"), - calamity.TileType("BotanicBathtub"), + tableList = new List() + { + calamity.TileType("AbyssBath"), + calamity.TileType("AbyssBookcase"), + calamity.TileType("AbyssDresser"), + calamity.TileType("AbyssPiano"), + calamity.TileType("AbyssTable"), + calamity.TileType("AbyssWorkbench"), + calamity.TileType("AncientBath"), + calamity.TileType("AncientBookcase"), + calamity.TileType("AncientDresser"), + calamity.TileType("AncientPiano"), + calamity.TileType("AncientTable"), + calamity.TileType("AncientWorkbench"), + calamity.TileType("AshenBath"), + calamity.TileType("AshenBookcase"), + calamity.TileType("AshenDresser"), + calamity.TileType("AshenPiano"), + calamity.TileType("AshenTable"), + calamity.TileType("AshenWorkbench"), + calamity.TileType("BotanicBathtub"), calamity.TileType("BotanicBookcase"), calamity.TileType("BotanicDresser"), calamity.TileType("BotanicPiano"), @@ -1617,11 +1617,11 @@ namespace CalamityMod calamity.TileType("StatigelTable"), calamity.TileType("StatigelWorkbench"), calamity.TileType("StratusBathtub"), - calamity.TileType("StratusBookcase"), - calamity.TileType("StratusDresser"), - calamity.TileType("StratusPiano"), - calamity.TileType("StratusTable"), - calamity.TileType("StratusWorkbench"), + calamity.TileType("StratusBookcase"), + calamity.TileType("StratusDresser"), + calamity.TileType("StratusPiano"), + calamity.TileType("StratusTable"), + calamity.TileType("StratusWorkbench"), calamity.TileType("VoidBath"), calamity.TileType("VoidBookcase"), calamity.TileType("VoidDresser"), @@ -1630,17 +1630,17 @@ namespace CalamityMod calamity.TileType("VoidWorkbench") }; - chairList = new List() - { - calamity.TileType("AbyssBed"), - calamity.TileType("AbyssChair"), - calamity.TileType("AbyssSofa"), - calamity.TileType("AncientBed"), - calamity.TileType("AncientChair"), - calamity.TileType("AncientSofa"), - calamity.TileType("AshenBed"), - calamity.TileType("AshenChair"), - calamity.TileType("AshenSofa"), + chairList = new List() + { + calamity.TileType("AbyssBed"), + calamity.TileType("AbyssChair"), + calamity.TileType("AbyssSofa"), + calamity.TileType("AncientBed"), + calamity.TileType("AncientChair"), + calamity.TileType("AncientSofa"), + calamity.TileType("AshenBed"), + calamity.TileType("AshenChair"), + calamity.TileType("AshenSofa"), calamity.TileType("BotanicBed"), calamity.TileType("BotanicBench"), calamity.TileType("BotanicChair"), @@ -1673,34 +1673,34 @@ namespace CalamityMod calamity.TileType("VoidSofa") }; - lightList = new List() - { - calamity.TileType("BlueCandle"), - calamity.TileType("ChaosCandle"), - calamity.TileType("LumenylCrystals"), - calamity.TileType("PinkCandle"), - calamity.TileType("PurpleCandle"), - calamity.TileType("TranquilityCandle"), - calamity.TileType("YellowCandle"), - calamity.TileType("SeaPrismCrystals"), + lightList = new List() + { + calamity.TileType("BlueCandle"), + calamity.TileType("ChaosCandle"), + calamity.TileType("LumenylCrystals"), + calamity.TileType("PinkCandle"), + calamity.TileType("PurpleCandle"), + calamity.TileType("TranquilityCandle"), + calamity.TileType("YellowCandle"), + calamity.TileType("SeaPrismCrystals"), - calamity.TileType("AbyssCandelabra"), - calamity.TileType("AbyssCandle"), - calamity.TileType("AbyssChandelier"), - calamity.TileType("AbyssLamp"), - calamity.TileType("AbyssLantern"), - calamity.TileType("AbyssTorch"), - calamity.TileType("AncientAltar"), - calamity.TileType("AncientBasin"), - calamity.TileType("AncientChandelier"), - calamity.TileType("AncientLamp"), - calamity.TileType("AncientLantern"), - calamity.TileType("AshenAltar"), - calamity.TileType("AshenBasin"), - calamity.TileType("AshenChandelier"), - calamity.TileType("AshenCandle"), - calamity.TileType("AshenCandelabra"), - calamity.TileType("AshenLamp"), + calamity.TileType("AbyssCandelabra"), + calamity.TileType("AbyssCandle"), + calamity.TileType("AbyssChandelier"), + calamity.TileType("AbyssLamp"), + calamity.TileType("AbyssLantern"), + calamity.TileType("AbyssTorch"), + calamity.TileType("AncientAltar"), + calamity.TileType("AncientBasin"), + calamity.TileType("AncientChandelier"), + calamity.TileType("AncientLamp"), + calamity.TileType("AncientLantern"), + calamity.TileType("AshenAltar"), + calamity.TileType("AshenBasin"), + calamity.TileType("AshenChandelier"), + calamity.TileType("AshenCandle"), + calamity.TileType("AshenCandelabra"), + calamity.TileType("AshenLamp"), calamity.TileType("AshenLantern"), calamity.TileType("BotanicCandle"), calamity.TileType("BotanicCandelabra"), @@ -1742,10 +1742,10 @@ namespace CalamityMod calamity.TileType("SilvaLamp"), calamity.TileType("SilvaLantern"), calamity.TileType("StatigelChandelier"), - calamity.TileType("StatigelCandle"), - calamity.TileType("StatigelCandelabra"), - calamity.TileType("StatigelLamp"), - calamity.TileType("StatigelLantern"), + calamity.TileType("StatigelCandle"), + calamity.TileType("StatigelCandelabra"), + calamity.TileType("StatigelLamp"), + calamity.TileType("StatigelLantern"), calamity.TileType("StratusCandle"), calamity.TileType("StratusCandelabra"), calamity.TileType("StratusChandelier"), @@ -1758,7 +1758,7 @@ namespace CalamityMod calamity.TileType("VoidLantern") }; - doorList = new List() + doorList = new List() { calamity.TileType("AbyssDoorOpen"), calamity.TileType("AbyssDoorClosed"), @@ -1793,256 +1793,256 @@ namespace CalamityMod calamity.TileType("StratusDoorOpen"), calamity.TileType("StratusDoorClosed"), calamity.TileType("StatigelPlatform"), - calamity.TileType("StratusPlatform"), + calamity.TileType("StratusPlatform"), calamity.TileType("VoidDoorOpen"), calamity.TileType("VoidDoorClosed") }; - zombieList = new List() - { - NPCID.Zombie, - NPCID.SmallZombie, - NPCID.BigZombie, - NPCID.ArmedZombie, - NPCID.BaldZombie, - NPCID.SmallBaldZombie, - NPCID.BigBaldZombie, - NPCID.PincushionZombie, - NPCID.SmallPincushionZombie, - NPCID.BigPincushionZombie, - NPCID.ArmedZombiePincussion, // what is this spelling + zombieList = new List() + { + NPCID.Zombie, + NPCID.SmallZombie, + NPCID.BigZombie, + NPCID.ArmedZombie, + NPCID.BaldZombie, + NPCID.SmallBaldZombie, + NPCID.BigBaldZombie, + NPCID.PincushionZombie, + NPCID.SmallPincushionZombie, + NPCID.BigPincushionZombie, + NPCID.ArmedZombiePincussion, // what is this spelling NPCID.SlimedZombie, - NPCID.SmallSlimedZombie, - NPCID.BigSlimedZombie, - NPCID.ArmedZombieSlimed, - NPCID.SwampZombie, - NPCID.SmallSwampZombie, - NPCID.BigSwampZombie, - NPCID.ArmedZombieSwamp, - NPCID.TwiggyZombie, - NPCID.SmallTwiggyZombie, - NPCID.BigTwiggyZombie, - NPCID.ArmedZombieTwiggy, - NPCID.FemaleZombie, - NPCID.SmallFemaleZombie, - NPCID.BigFemaleZombie, - NPCID.ArmedZombieCenx, - NPCID.ZombieRaincoat, - NPCID.SmallRainZombie, - NPCID.BigRainZombie, - NPCID.ZombieEskimo, - NPCID.ArmedZombieEskimo + NPCID.SmallSlimedZombie, + NPCID.BigSlimedZombie, + NPCID.ArmedZombieSlimed, + NPCID.SwampZombie, + NPCID.SmallSwampZombie, + NPCID.BigSwampZombie, + NPCID.ArmedZombieSwamp, + NPCID.TwiggyZombie, + NPCID.SmallTwiggyZombie, + NPCID.BigTwiggyZombie, + NPCID.ArmedZombieTwiggy, + NPCID.FemaleZombie, + NPCID.SmallFemaleZombie, + NPCID.BigFemaleZombie, + NPCID.ArmedZombieCenx, + NPCID.ZombieRaincoat, + NPCID.SmallRainZombie, + NPCID.BigRainZombie, + NPCID.ZombieEskimo, + NPCID.ArmedZombieEskimo // halloween zombies not included because they don't drop shackles or zombie arms }; - demonEyeList = new List() - { - NPCID.DemonEye, - NPCID.DemonEye2, - NPCID.CataractEye, - NPCID.CataractEye2, - NPCID.SleepyEye, - NPCID.SleepyEye2, - NPCID.DialatedEye, // it is spelled "dilated" + demonEyeList = new List() + { + NPCID.DemonEye, + NPCID.DemonEye2, + NPCID.CataractEye, + NPCID.CataractEye2, + NPCID.SleepyEye, + NPCID.SleepyEye2, + NPCID.DialatedEye, // it is spelled "dilated" NPCID.DialatedEye2, // yep NPCID.GreenEye, - NPCID.GreenEye2, - NPCID.PurpleEye, - NPCID.PurpleEye2, - NPCID.DemonEyeOwl, - NPCID.DemonEyeSpaceship - }; + NPCID.GreenEye2, + NPCID.PurpleEye, + NPCID.PurpleEye2, + NPCID.DemonEyeOwl, + NPCID.DemonEyeSpaceship + }; - skeletonList = new List() - { - NPCID.BigPantlessSkeleton, - NPCID.SmallPantlessSkeleton, - NPCID.BigMisassembledSkeleton, - NPCID.SmallMisassembledSkeleton, - NPCID.BigHeadacheSkeleton, - NPCID.SmallHeadacheSkeleton, - NPCID.BigSkeleton, - NPCID.SmallSkeleton, - NPCID.HeavySkeleton, - NPCID.Skeleton, - NPCID.ArmoredSkeleton, - NPCID.SkeletonArcher, - NPCID.HeadacheSkeleton, - NPCID.MisassembledSkeleton, - NPCID.PantlessSkeleton, - NPCID.SkeletonTopHat, - NPCID.SkeletonAstonaut, - NPCID.SkeletonAlien, - NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, - NPCID.BoneThrowingSkeleton3, - NPCID.BoneThrowingSkeleton4, - NPCID.GreekSkeleton - }; + skeletonList = new List() + { + NPCID.BigPantlessSkeleton, + NPCID.SmallPantlessSkeleton, + NPCID.BigMisassembledSkeleton, + NPCID.SmallMisassembledSkeleton, + NPCID.BigHeadacheSkeleton, + NPCID.SmallHeadacheSkeleton, + NPCID.BigSkeleton, + NPCID.SmallSkeleton, + NPCID.HeavySkeleton, + NPCID.Skeleton, + NPCID.ArmoredSkeleton, + NPCID.SkeletonArcher, + NPCID.HeadacheSkeleton, + NPCID.MisassembledSkeleton, + NPCID.PantlessSkeleton, + NPCID.SkeletonTopHat, + NPCID.SkeletonAstonaut, + NPCID.SkeletonAlien, + NPCID.BoneThrowingSkeleton, + NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, + NPCID.BoneThrowingSkeleton4, + NPCID.GreekSkeleton + }; - angryBonesList = new List() - { - NPCID.AngryBones, - NPCID.ShortBones, - NPCID.BigBoned, - NPCID.AngryBonesBig, - NPCID.AngryBonesBigMuscle, - NPCID.AngryBonesBigHelmet - }; + angryBonesList = new List() + { + NPCID.AngryBones, + NPCID.ShortBones, + NPCID.BigBoned, + NPCID.AngryBonesBig, + NPCID.AngryBonesBigMuscle, + NPCID.AngryBonesBigHelmet + }; - hornetList = new List() - { - NPCID.Hornet, - NPCID.LittleStinger, - NPCID.BigStinger, - NPCID.HornetFatty, - NPCID.LittleHornetFatty, - NPCID.BigHornetFatty, - NPCID.HornetHoney, - NPCID.LittleHornetHoney, - NPCID.BigHornetHoney, - NPCID.HornetLeafy, - NPCID.LittleHornetLeafy, - NPCID.BigHornetLeafy, - NPCID.HornetSpikey, - NPCID.LittleHornetSpikey, - NPCID.BigHornetSpikey, - NPCID.HornetStingy, - NPCID.LittleHornetStingy, - NPCID.BigHornetStingy - }; + hornetList = new List() + { + NPCID.Hornet, + NPCID.LittleStinger, + NPCID.BigStinger, + NPCID.HornetFatty, + NPCID.LittleHornetFatty, + NPCID.BigHornetFatty, + NPCID.HornetHoney, + NPCID.LittleHornetHoney, + NPCID.BigHornetHoney, + NPCID.HornetLeafy, + NPCID.LittleHornetLeafy, + NPCID.BigHornetLeafy, + NPCID.HornetSpikey, + NPCID.LittleHornetSpikey, + NPCID.BigHornetSpikey, + NPCID.HornetStingy, + NPCID.LittleHornetStingy, + NPCID.BigHornetStingy + }; - mossHornetList = new List() - { - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.LittleMossHornet, - NPCID.BigMossHornet, - NPCID.GiantMossHornet - }; - } + mossHornetList = new List() + { + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.LittleMossHornet, + NPCID.BigMossHornet, + NPCID.GiantMossHornet + }; + } - if (Config.RevengeanceAndDeathThoriumBossBuff) - { - if (thorium != null) - { - enemyImmunityList.Add(thorium.NPCType("TheGrandThunderBirdv2")); - enemyImmunityList.Add(thorium.NPCType("QueenJelly")); - enemyImmunityList.Add(thorium.NPCType("Viscount")); - enemyImmunityList.Add(thorium.NPCType("GraniteEnergyStorm")); - enemyImmunityList.Add(thorium.NPCType("TheBuriedWarrior")); - enemyImmunityList.Add(thorium.NPCType("ThePrimeScouter")); - enemyImmunityList.Add(thorium.NPCType("BoreanStrider")); - enemyImmunityList.Add(thorium.NPCType("BoreanStriderPopped")); - enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder")); - enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder2")); - enemyImmunityList.Add(thorium.NPCType("Lich")); - enemyImmunityList.Add(thorium.NPCType("LichHeadless")); - enemyImmunityList.Add(thorium.NPCType("Abyssion")); - enemyImmunityList.Add(thorium.NPCType("AbyssionCracked")); - enemyImmunityList.Add(thorium.NPCType("AbyssionReleased")); - enemyImmunityList.Add(thorium.NPCType("SlagFury")); - enemyImmunityList.Add(thorium.NPCType("Omnicide")); - enemyImmunityList.Add(thorium.NPCType("RealityBreaker")); - enemyImmunityList.Add(thorium.NPCType("Aquaius")); - enemyImmunityList.Add(thorium.NPCType("Aquaius2")); + if (Config.RevengeanceAndDeathThoriumBossBuff) + { + if (thorium != null) + { + enemyImmunityList.Add(thorium.NPCType("TheGrandThunderBirdv2")); + enemyImmunityList.Add(thorium.NPCType("QueenJelly")); + enemyImmunityList.Add(thorium.NPCType("Viscount")); + enemyImmunityList.Add(thorium.NPCType("GraniteEnergyStorm")); + enemyImmunityList.Add(thorium.NPCType("TheBuriedWarrior")); + enemyImmunityList.Add(thorium.NPCType("ThePrimeScouter")); + enemyImmunityList.Add(thorium.NPCType("BoreanStrider")); + enemyImmunityList.Add(thorium.NPCType("BoreanStriderPopped")); + enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder")); + enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder2")); + enemyImmunityList.Add(thorium.NPCType("Lich")); + enemyImmunityList.Add(thorium.NPCType("LichHeadless")); + enemyImmunityList.Add(thorium.NPCType("Abyssion")); + enemyImmunityList.Add(thorium.NPCType("AbyssionCracked")); + enemyImmunityList.Add(thorium.NPCType("AbyssionReleased")); + enemyImmunityList.Add(thorium.NPCType("SlagFury")); + enemyImmunityList.Add(thorium.NPCType("Omnicide")); + enemyImmunityList.Add(thorium.NPCType("RealityBreaker")); + enemyImmunityList.Add(thorium.NPCType("Aquaius")); + enemyImmunityList.Add(thorium.NPCType("Aquaius2")); - revengeanceEnemyBuffList.Add(thorium.NPCType("TheGrandThunderBirdv2")); - revengeanceEnemyBuffList.Add(thorium.NPCType("QueenJelly")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Viscount")); - revengeanceEnemyBuffList.Add(thorium.NPCType("GraniteEnergyStorm")); - revengeanceEnemyBuffList.Add(thorium.NPCType("TheBuriedWarrior")); - revengeanceEnemyBuffList.Add(thorium.NPCType("ThePrimeScouter")); - revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStrider")); - revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStriderPopped")); - revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder")); - revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder2")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Lich")); - revengeanceEnemyBuffList.Add(thorium.NPCType("LichHeadless")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Abyssion")); - revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionCracked")); - revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionReleased")); - revengeanceEnemyBuffList.Add(thorium.NPCType("SlagFury")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Omnicide")); - revengeanceEnemyBuffList.Add(thorium.NPCType("RealityBreaker")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius2")); + revengeanceEnemyBuffList.Add(thorium.NPCType("TheGrandThunderBirdv2")); + revengeanceEnemyBuffList.Add(thorium.NPCType("QueenJelly")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Viscount")); + revengeanceEnemyBuffList.Add(thorium.NPCType("GraniteEnergyStorm")); + revengeanceEnemyBuffList.Add(thorium.NPCType("TheBuriedWarrior")); + revengeanceEnemyBuffList.Add(thorium.NPCType("ThePrimeScouter")); + revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStrider")); + revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStriderPopped")); + revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder")); + revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder2")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Lich")); + revengeanceEnemyBuffList.Add(thorium.NPCType("LichHeadless")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Abyssion")); + revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionCracked")); + revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionReleased")); + revengeanceEnemyBuffList.Add(thorium.NPCType("SlagFury")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Omnicide")); + revengeanceEnemyBuffList.Add(thorium.NPCType("RealityBreaker")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GrandThunderBirdZap")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ThunderGust")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BubbleBomb")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenJellyArm")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenTorrent")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountBlood")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRockFall")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GraniteCharge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedShock")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedDagger")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowF")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowP")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowC")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagic")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagicPop")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamOuter")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeam")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamCheese")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("VaporizeBlast")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonSurge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("Vaporize")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonCharge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitySpark")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DoomBeholderBeam")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("VoidLaserPro")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BeholderBeam")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBarrage")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurgeR")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardCascade")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBoom")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardFang")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostMytePro")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("IceAnomaly")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGaze")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGazeB")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareSpawn")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlare")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichPulse")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichMatter")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("SoulRenderLich")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathD")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathU")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("Whirlpool")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaRipple")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssalStrike2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("WaterPulse")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostile")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostileSmaller")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaBarrage")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnR")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnL")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawn")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniDeath")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniSphereOrb")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameLash")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulse")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulseTorn")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameNova")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MoltenFury")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("RealityFury")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("UFOBlast")); - } - } - } + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GrandThunderBirdZap")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ThunderGust")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BubbleBomb")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenJellyArm")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenTorrent")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountBlood")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRockFall")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GraniteCharge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedShock")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedDagger")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowF")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowP")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowC")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagic")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagicPop")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamOuter")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeam")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamCheese")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("VaporizeBlast")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonSurge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("Vaporize")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonCharge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitySpark")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DoomBeholderBeam")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("VoidLaserPro")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BeholderBeam")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBarrage")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurgeR")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardCascade")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBoom")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardFang")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostMytePro")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("IceAnomaly")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGaze")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGazeB")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareSpawn")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlare")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichPulse")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichMatter")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("SoulRenderLich")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathD")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathU")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("Whirlpool")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaRipple")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssalStrike2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("WaterPulse")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostile")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostileSmaller")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaBarrage")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnR")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnL")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawn")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniDeath")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniSphereOrb")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameLash")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulse")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulseTorn")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameNova")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MoltenFury")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("RealityFury")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("UFOBlast")); + } + } + } #endregion #region Vanilla Enemy DR @@ -2165,7 +2165,8 @@ namespace CalamityMod if (thorium is null || !Config.RevengeanceAndDeathThoriumBossBuff) return; - void ThoriumDR(string npcName, float dr) { DRValues.Add(thorium.NPCType(npcName), dr); } + void ThoriumDR(string npcName, float dr) + { DRValues.Add(thorium.NPCType(npcName), dr); } ThoriumDR("Viscount", 0.05f); ThoriumDR("BoreanStrider", 0.05f); ThoriumDR("FallenDeathBeholder", 0.05f); @@ -2192,677 +2193,685 @@ namespace CalamityMod #region Music public override void UpdateMusic(ref int music, ref MusicPriority priority) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (Main.musicVolume != 0) - { - if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) - { + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (Main.musicVolume != 0) + { + if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) + { Player p = Main.LocalPlayer; if (p.InCalamity()) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); - else - music = MusicID.Eerie; - priority = MusicPriority.Environment; - } - } - if (p.InSunkenSea()) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea"); - else - music = MusicID.Temple; - priority = MusicPriority.Environment; - } - } - if (p.InAstral()) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); - else - music = MusicID.Space; - priority = MusicPriority.Environment; - } - } - if (p.InAbyss(1) || p.InAbyss(2)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); - else - music = MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (p.InAbyss(3)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); - else - music = MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (p.InAbyss(4)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); - else - music = MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (p.InSulphur()) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"); - else - music = MusicID.Desert; - priority = MusicPriority.BiomeHigh; - } - } - if (CalamityWorld.DoGSecondStageCountdown <= 540 && CalamityWorld.DoGSecondStageCountdown > 60) //8 seconds before DoG spawns - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; - priority = MusicPriority.BossMedium; - } - } - } - } - } - #endregion + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); + else + music = MusicID.Eerie; + priority = MusicPriority.Environment; + } + } + if (p.InSunkenSea()) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea"); + else + music = MusicID.Temple; + priority = MusicPriority.Environment; + } + } + if (p.InAstral()) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); + else + music = MusicID.Space; + priority = MusicPriority.Environment; + } + } + if (p.InAbyss(1) || p.InAbyss(2)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); + else + music = MusicID.Hell; + priority = MusicPriority.BiomeHigh; + } + } + if (p.InAbyss(3)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); + else + music = MusicID.Hell; + priority = MusicPriority.BiomeHigh; + } + } + if (p.InAbyss(4)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); + else + music = MusicID.Hell; + priority = MusicPriority.BiomeHigh; + } + } + if (p.InSulphur()) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"); + else + music = MusicID.Desert; + priority = MusicPriority.BiomeHigh; + } + } + if (CalamityWorld.DoGSecondStageCountdown <= 540 && CalamityWorld.DoGSecondStageCountdown > 60) //8 seconds before DoG spawns + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; + priority = MusicPriority.BossMedium; + } + } + } + } + } + #endregion - #region ModSupport - public override void PostSetupContent() - { - WeakReferenceSupport.Setup(); - } + #region ModSupport + public override void PostSetupContent() + { + WeakReferenceSupport.Setup(); + } - public override object Call(params object[] args) - { - return ModCalls.Call(args); - } - #endregion + public override object Call(params object[] args) + { + return ModCalls.Call(args); + } + #endregion - #region DrawingStuff - public override void ModifyInterfaceLayers(List layers) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - UIHandler.ModifyInterfaceLayers(mod, layers); - } - int index = layers.FindIndex(layer => layer.Name == "Vanilla: Mouse Text"); - if (index != -1) - { - layers.Insert(index, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () - { - if (Main.LocalPlayer.Calamity().drawBossHPBar) - { - BossHealthBarManager.Update(); - BossHealthBarManager.Draw(Main.spriteBatch); - } - return true; - }, InterfaceScaleType.None)); - } - base.ModifyInterfaceLayers(layers); - layers.Insert(index, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () - { - AstralArcanumUI.UpdateAndDraw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - } + #region DrawingStuff + public override void ModifyInterfaceLayers(List layers) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + UIHandler.ModifyInterfaceLayers(mod, layers); + } + int index = layers.FindIndex(layer => layer.Name == "Vanilla: Mouse Text"); + if (index != -1) + { + layers.Insert(index, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () + { + if (Main.LocalPlayer.Calamity().drawBossHPBar) + { + BossHealthBarManager.Update(); + BossHealthBarManager.Draw(Main.spriteBatch); + } + return true; + }, InterfaceScaleType.None)); + } + base.ModifyInterfaceLayers(layers); + layers.Insert(index, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () + { + AstralArcanumUI.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + } - public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f) - { - return npc.GetAlpha(BuffEffects(npc, GetLightColor(position != null ? (Vector2)position : npc.Center), (shadowOverride != 0f ? shadowOverride : 0f), effects, npc.poisoned, npc.onFire, npc.onFire2, Main.player[Main.myPlayer].detectCreature, false, false, false, npc.venom, npc.midas, npc.ichor, npc.onFrostBurn, false, false, npc.dripping, npc.drippingSlime, npc.loveStruck, npc.stinky)); - } + public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f) + { + return npc.GetAlpha(BuffEffects(npc, GetLightColor(position != null ? (Vector2)position : npc.Center), (shadowOverride != 0f ? shadowOverride : 0f), effects, npc.poisoned, npc.onFire, npc.onFire2, Main.player[Main.myPlayer].detectCreature, false, false, false, npc.venom, npc.midas, npc.ichor, npc.onFrostBurn, false, false, npc.dripping, npc.drippingSlime, npc.loveStruck, npc.stinky)); + } - public static Color GetLightColor(Vector2 position) - { - return Lighting.GetColor((int)(position.X / 16f), (int)(position.Y / 16f)); - } + public static Color GetLightColor(Vector2 position) + { + return Lighting.GetColor((int)(position.X / 16f), (int)(position.Y / 16f)); + } - public static Color BuffEffects(Entity codable, Color lightColor, float shadow = 0f, bool effects = true, bool poisoned = false, bool onFire = false, bool onFire2 = false, bool hunter = false, bool noItems = false, bool blind = false, bool bleed = false, bool venom = false, bool midas = false, bool ichor = false, bool onFrostBurn = false, bool burned = false, bool honey = false, bool dripping = false, bool drippingSlime = false, bool loveStruck = false, bool stinky = false) - { - float cr = 1f; float cg = 1f; float cb = 1f; float ca = 1f; - if (effects && honey && Main.rand.NextBool(30)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 152, 0f, 0f, 150, default, 1f); - Main.dust[dustID].velocity.Y = 0.3f; - Main.dust[dustID].velocity.X *= 0.1f; - Main.dust[dustID].scale += (float)Main.rand.Next(3, 4) * 0.1f; - Main.dust[dustID].alpha = 100; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity += codable.velocity * 0.1f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - if (poisoned) - { - if (effects && Main.rand.NextBool(30)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 46, 0f, 0f, 120, default, 0.2f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].fadeIn = 1.9f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cr *= 0.65f; - cb *= 0.75f; - } - if (venom) - { - if (effects && Main.rand.NextBool(10)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 171, 0f, 0f, 100, default, 0.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].fadeIn = 1.5f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cg *= 0.45f; - cr *= 0.75f; - } - if (midas) - { - cb *= 0.3f; - cr *= 0.85f; - } - if (ichor) - { - if (codable is NPC) - { - lightColor = new Color(255, 255, 0, 255); - } - else - { - cb = 0f; - } - } - if (burned) - { - if (effects) - { - int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 2f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.75f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - if (codable is Player) - { - cr = 1f; - cb *= 0.6f; - cg *= 0.7f; - } - } - if (onFrostBurn) - { - if (effects) - { - if (Main.rand.Next(4) < 3) - { - int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 135, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.NextBool(4)) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 0.1f, 0.6f, 1f); - } - if (codable is Player) - { - cr *= 0.5f; - cg *= 0.7f; - } - } - if (onFire) - { - if (effects) - { - if (Main.rand.Next(4) != 0) - { - int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.NextBool(4)) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); - } - if (codable is Player) - { - cb *= 0.6f; - cg *= 0.7f; - } - } - if (dripping && shadow == 0f && Main.rand.Next(4) != 0) - { - Vector2 position = codable.position; - position.X -= 2f; position.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int dustID = Dust.NewDust(position, codable.width + 4, codable.height + 2, 211, 0f, 0f, 50, default, 0.8f); - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 0.2f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - else - { - int dustID = Dust.NewDust(position, codable.width + 8, codable.height + 8, 211, 0f, 0f, 50, default, 1.1f); - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 1f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - if (drippingSlime && shadow == 0f) - { - int alpha = 175; - Color newColor = new Color(0, 80, 255, 100); - if (Main.rand.Next(4) != 0) - { - if (Main.rand.NextBool(2)) - { - Vector2 position2 = codable.position; - position2.X -= 2f; position2.Y -= 2f; - int dustID = Dust.NewDust(position2, codable.width + 4, codable.height + 2, 4, 0f, 0f, alpha, newColor, 1.4f); - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 0.2f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - cr *= 0.8f; - cg *= 0.8f; - } - if (onFire2) - { - if (effects) - { - if (Main.rand.Next(4) != 0) - { - int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 75, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.NextBool(4)) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); - } - if (codable is Player) - { - cb *= 0.6f; - cg *= 0.7f; - } - } - if (noItems) - { - cr *= 0.65f; - cg *= 0.8f; - } - if (blind) - { - cr *= 0.7f; - cg *= 0.65f; - } - if (bleed) - { - bool dead = (codable is Player ? ((Player)codable).dead : codable is NPC ? ((NPC)codable).life <= 0 : false); - if (effects && !dead && Main.rand.NextBool(30)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 5, 0f, 0f, 0, default, 1f); - Main.dust[dustID].velocity.Y += 0.5f; - Main.dust[dustID].velocity *= 0.25f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cg *= 0.9f; - cb *= 0.9f; - } - if (loveStruck && effects && shadow == 0f && Main.instance.IsActive && !Main.gamePaused && Main.rand.NextBool(5)) - { - Vector2 value = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); - value.Normalize(); - value.X *= 0.66f; - int goreID = Gore.NewGore(codable.position + new Vector2((float)Main.rand.Next(codable.width + 1), (float)Main.rand.Next(codable.height + 1)), value * (float)Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f); - Main.gore[goreID].sticky = false; - Main.gore[goreID].velocity *= 0.4f; - Main.gore[goreID].velocity.Y -= 0.6f; - if (codable is Player) - { - Main.playerDrawGore.Add(goreID); - } - } - if (stinky && shadow == 0f) - { - cr *= 0.7f; - cb *= 0.55f; - if (effects && Main.rand.NextBool(5) && Main.instance.IsActive && !Main.gamePaused) - { - Vector2 value2 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); - value2.Normalize(); value2.X *= 0.66f; value2.Y = Math.Abs(value2.Y); - Vector2 vector = value2 * (float)Main.rand.Next(3, 5) * 0.25f; - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 188, vector.X, vector.Y * 0.5f, 100, default, 1.5f); - Main.dust[dustID].velocity *= 0.1f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - lightColor.R = (byte)((float)lightColor.R * cr); - lightColor.G = (byte)((float)lightColor.G * cg); - lightColor.B = (byte)((float)lightColor.B * cb); - lightColor.A = (byte)((float)lightColor.A * ca); - if (codable is NPC) - { - NPCLoader.DrawEffects((NPC)codable, ref lightColor); - } - if (hunter && (codable is NPC ? ((NPC)codable).lifeMax > 1 : true)) - { - if (effects && !Main.gamePaused && Main.instance.IsActive && Main.rand.NextBool(50)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 15, 0f, 0f, 150, default, 0.8f); - Main.dust[dustID].velocity *= 0.1f; - Main.dust[dustID].noLight = true; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - byte colorR = 50, colorG = 255, colorB = 50; - if (codable is NPC && !(((NPC)codable).friendly || ((NPC)codable).catchItem > 0 || (((NPC)codable).damage == 0 && ((NPC)codable).lifeMax == 5))) - { - colorR = 255; colorG = 50; - } - if (!(codable is NPC) && lightColor.R < 150) - { - lightColor.A = Main.mouseTextColor; - } - if (lightColor.R < colorR) - { - lightColor.R = colorR; - } - if (lightColor.G < colorG) - { - lightColor.G = colorG; - } - if (lightColor.B < colorB) - { - lightColor.B = colorB; - } - } - return lightColor; - } + public static Color BuffEffects(Entity codable, Color lightColor, float shadow = 0f, bool effects = true, bool poisoned = false, bool onFire = false, bool onFire2 = false, bool hunter = false, bool noItems = false, bool blind = false, bool bleed = false, bool venom = false, bool midas = false, bool ichor = false, bool onFrostBurn = false, bool burned = false, bool honey = false, bool dripping = false, bool drippingSlime = false, bool loveStruck = false, bool stinky = false) + { + float cr = 1f; + float cg = 1f; + float cb = 1f; + float ca = 1f; + if (effects && honey && Main.rand.NextBool(30)) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 152, 0f, 0f, 150, default, 1f); + Main.dust[dustID].velocity.Y = 0.3f; + Main.dust[dustID].velocity.X *= 0.1f; + Main.dust[dustID].scale += (float)Main.rand.Next(3, 4) * 0.1f; + Main.dust[dustID].alpha = 100; + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity += codable.velocity * 0.1f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + if (poisoned) + { + if (effects && Main.rand.NextBool(30)) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 46, 0f, 0f, 120, default, 0.2f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].fadeIn = 1.9f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + cr *= 0.65f; + cb *= 0.75f; + } + if (venom) + { + if (effects && Main.rand.NextBool(10)) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 171, 0f, 0f, 100, default, 0.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].fadeIn = 1.5f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + cg *= 0.45f; + cr *= 0.75f; + } + if (midas) + { + cb *= 0.3f; + cr *= 0.85f; + } + if (ichor) + { + if (codable is NPC) + { + lightColor = new Color(255, 255, 0, 255); + } + else + { + cb = 0f; + } + } + if (burned) + { + if (effects) + { + int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 2f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.75f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + if (codable is Player) + { + cr = 1f; + cb *= 0.6f; + cg *= 0.7f; + } + } + if (onFrostBurn) + { + if (effects) + { + if (Main.rand.Next(4) < 3) + { + int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 135, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (Main.rand.NextBool(4)) + { + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale *= 0.5f; + } + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 0.1f, 0.6f, 1f); + } + if (codable is Player) + { + cr *= 0.5f; + cg *= 0.7f; + } + } + if (onFire) + { + if (effects) + { + if (Main.rand.Next(4) != 0) + { + int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (Main.rand.NextBool(4)) + { + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale *= 0.5f; + } + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); + } + if (codable is Player) + { + cb *= 0.6f; + cg *= 0.7f; + } + } + if (dripping && shadow == 0f && Main.rand.Next(4) != 0) + { + Vector2 position = codable.position; + position.X -= 2f; + position.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int dustID = Dust.NewDust(position, codable.width + 4, codable.height + 2, 211, 0f, 0f, 50, default, 0.8f); + if (Main.rand.NextBool(2)) + { + Main.dust[dustID].alpha += 25; + } + if (Main.rand.NextBool(2)) + { + Main.dust[dustID].alpha += 25; + } + Main.dust[dustID].noLight = true; + Main.dust[dustID].velocity *= 0.2f; + Main.dust[dustID].velocity.Y += 0.2f; + Main.dust[dustID].velocity += codable.velocity; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + else + { + int dustID = Dust.NewDust(position, codable.width + 8, codable.height + 8, 211, 0f, 0f, 50, default, 1.1f); + if (Main.rand.NextBool(2)) + { + Main.dust[dustID].alpha += 25; + } + if (Main.rand.NextBool(2)) + { + Main.dust[dustID].alpha += 25; + } + Main.dust[dustID].noLight = true; + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 0.2f; + Main.dust[dustID].velocity.Y += 1f; + Main.dust[dustID].velocity += codable.velocity; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + } + if (drippingSlime && shadow == 0f) + { + int alpha = 175; + Color newColor = new Color(0, 80, 255, 100); + if (Main.rand.Next(4) != 0) + { + if (Main.rand.NextBool(2)) + { + Vector2 position2 = codable.position; + position2.X -= 2f; + position2.Y -= 2f; + int dustID = Dust.NewDust(position2, codable.width + 4, codable.height + 2, 4, 0f, 0f, alpha, newColor, 1.4f); + if (Main.rand.NextBool(2)) + { + Main.dust[dustID].alpha += 25; + } + if (Main.rand.NextBool(2)) + { + Main.dust[dustID].alpha += 25; + } + Main.dust[dustID].noLight = true; + Main.dust[dustID].velocity *= 0.2f; + Main.dust[dustID].velocity.Y += 0.2f; + Main.dust[dustID].velocity += codable.velocity; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + } + cr *= 0.8f; + cg *= 0.8f; + } + if (onFire2) + { + if (effects) + { + if (Main.rand.Next(4) != 0) + { + int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 75, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (Main.rand.NextBool(4)) + { + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale *= 0.5f; + } + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); + } + if (codable is Player) + { + cb *= 0.6f; + cg *= 0.7f; + } + } + if (noItems) + { + cr *= 0.65f; + cg *= 0.8f; + } + if (blind) + { + cr *= 0.7f; + cg *= 0.65f; + } + if (bleed) + { + bool dead = (codable is Player ? ((Player)codable).dead : codable is NPC ? ((NPC)codable).life <= 0 : false); + if (effects && !dead && Main.rand.NextBool(30)) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 5, 0f, 0f, 0, default, 1f); + Main.dust[dustID].velocity.Y += 0.5f; + Main.dust[dustID].velocity *= 0.25f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + cg *= 0.9f; + cb *= 0.9f; + } + if (loveStruck && effects && shadow == 0f && Main.instance.IsActive && !Main.gamePaused && Main.rand.NextBool(5)) + { + Vector2 value = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); + value.Normalize(); + value.X *= 0.66f; + int goreID = Gore.NewGore(codable.position + new Vector2((float)Main.rand.Next(codable.width + 1), (float)Main.rand.Next(codable.height + 1)), value * (float)Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f); + Main.gore[goreID].sticky = false; + Main.gore[goreID].velocity *= 0.4f; + Main.gore[goreID].velocity.Y -= 0.6f; + if (codable is Player) + { + Main.playerDrawGore.Add(goreID); + } + } + if (stinky && shadow == 0f) + { + cr *= 0.7f; + cb *= 0.55f; + if (effects && Main.rand.NextBool(5) && Main.instance.IsActive && !Main.gamePaused) + { + Vector2 value2 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); + value2.Normalize(); + value2.X *= 0.66f; + value2.Y = Math.Abs(value2.Y); + Vector2 vector = value2 * (float)Main.rand.Next(3, 5) * 0.25f; + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 188, vector.X, vector.Y * 0.5f, 100, default, 1.5f); + Main.dust[dustID].velocity *= 0.1f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + } + lightColor.R = (byte)((float)lightColor.R * cr); + lightColor.G = (byte)((float)lightColor.G * cg); + lightColor.B = (byte)((float)lightColor.B * cb); + lightColor.A = (byte)((float)lightColor.A * ca); + if (codable is NPC) + { + NPCLoader.DrawEffects((NPC)codable, ref lightColor); + } + if (hunter && (codable is NPC ? ((NPC)codable).lifeMax > 1 : true)) + { + if (effects && !Main.gamePaused && Main.instance.IsActive && Main.rand.NextBool(50)) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 15, 0f, 0f, 150, default, 0.8f); + Main.dust[dustID].velocity *= 0.1f; + Main.dust[dustID].noLight = true; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + byte colorR = 50, colorG = 255, colorB = 50; + if (codable is NPC && !(((NPC)codable).friendly || ((NPC)codable).catchItem > 0 || (((NPC)codable).damage == 0 && ((NPC)codable).lifeMax == 5))) + { + colorR = 255; + colorG = 50; + } + if (!(codable is NPC) && lightColor.R < 150) + { + lightColor.A = Main.mouseTextColor; + } + if (lightColor.R < colorR) + { + lightColor.R = colorR; + } + if (lightColor.G < colorG) + { + lightColor.G = colorG; + } + if (lightColor.B < colorB) + { + lightColor.B = colorB; + } + } + return lightColor; + } - public static void DrawTexture(object sb, Texture2D texture, int shader, Entity codable, Color? overrideColor = null, bool drawCentered = false) - { - Color lightColor = (overrideColor != null ? (Color)overrideColor : codable is NPC ? GetNPCColor(((NPC)codable), codable.Center, false) : codable is Projectile ? ((Projectile)codable).GetAlpha(GetLightColor(codable.Center)) : GetLightColor(codable.Center)); - int frameCount = (codable is NPC ? Main.npcFrameCount[((NPC)codable).type] : 1); - Rectangle frame = (codable is NPC ? ((NPC)codable).frame : new Rectangle(0, 0, texture.Width, texture.Height)); - float scale = (codable is NPC ? ((NPC)codable).scale : ((Projectile)codable).scale); - float rotation = (codable is NPC ? ((NPC)codable).rotation : ((Projectile)codable).rotation); - int spriteDirection = (codable is NPC ? ((NPC)codable).spriteDirection : ((Projectile)codable).spriteDirection); - float offsetY = (codable is NPC ? ((NPC)codable).gfxOffY : 0f); - DrawTexture(sb, texture, shader, codable.position + new Vector2(0f, offsetY), codable.width, codable.height, scale, rotation, spriteDirection, frameCount, frame, lightColor, drawCentered); - } + public static void DrawTexture(object sb, Texture2D texture, int shader, Entity codable, Color? overrideColor = null, bool drawCentered = false) + { + Color lightColor = (overrideColor != null ? (Color)overrideColor : codable is NPC ? GetNPCColor(((NPC)codable), codable.Center, false) : codable is Projectile ? ((Projectile)codable).GetAlpha(GetLightColor(codable.Center)) : GetLightColor(codable.Center)); + int frameCount = (codable is NPC ? Main.npcFrameCount[((NPC)codable).type] : 1); + Rectangle frame = (codable is NPC ? ((NPC)codable).frame : new Rectangle(0, 0, texture.Width, texture.Height)); + float scale = (codable is NPC ? ((NPC)codable).scale : ((Projectile)codable).scale); + float rotation = (codable is NPC ? ((NPC)codable).rotation : ((Projectile)codable).rotation); + int spriteDirection = (codable is NPC ? ((NPC)codable).spriteDirection : ((Projectile)codable).spriteDirection); + float offsetY = (codable is NPC ? ((NPC)codable).gfxOffY : 0f); + DrawTexture(sb, texture, shader, codable.position + new Vector2(0f, offsetY), codable.width, codable.height, scale, rotation, spriteDirection, frameCount, frame, lightColor, drawCentered); + } - public static void DrawTexture(object sb, Texture2D texture, int shader, Vector2 position, int width, int height, float scale, float rotation, int direction, int framecount, Rectangle frame, Color? overrideColor = null, bool drawCentered = false) - { - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / framecount / 2)); - Color lightColor = overrideColor != null ? (Color)overrideColor : GetLightColor(position + new Vector2(width * 0.5f, height * 0.5f)); - if (sb is List) - { + public static void DrawTexture(object sb, Texture2D texture, int shader, Vector2 position, int width, int height, float scale, float rotation, int direction, int framecount, Rectangle frame, Color? overrideColor = null, bool drawCentered = false) + { + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / framecount / 2)); + Color lightColor = overrideColor != null ? (Color)overrideColor : GetLightColor(position + new Vector2(width * 0.5f, height * 0.5f)); + if (sb is List) + { DrawData dd = new DrawData(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0) { shader = shader }; ((List)sb).Add(dd); - } - else if (sb is SpriteBatch) - { - bool applyDye = shader > 0; - if (applyDye) - { - ((SpriteBatch)sb).End(); - ((SpriteBatch)sb).Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); - GameShaders.Armor.ApplySecondary(shader, Main.player[Main.myPlayer], null); - } - ((SpriteBatch)sb).Draw(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - if (applyDye) - { - ((SpriteBatch)sb).End(); - ((SpriteBatch)sb).Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); - } - } - } + } + else if (sb is SpriteBatch) + { + bool applyDye = shader > 0; + if (applyDye) + { + ((SpriteBatch)sb).End(); + ((SpriteBatch)sb).Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); + GameShaders.Armor.ApplySecondary(shader, Main.player[Main.myPlayer], null); + } + ((SpriteBatch)sb).Draw(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + if (applyDye) + { + ((SpriteBatch)sb).End(); + ((SpriteBatch)sb).Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); + } + } + } - public static Vector2 GetDrawPosition(Vector2 position, Vector2 origin, int width, int height, int texWidth, int texHeight, int framecount, float scale, bool drawCentered = false) - { - Vector2 screenPos = new Vector2((int)Main.screenPosition.X, (int)Main.screenPosition.Y); - if (drawCentered) - { - Vector2 texHalf = new Vector2(texWidth / 2, texHeight / framecount / 2); - return (position + new Vector2(width * 0.5f, height * 0.5f)) - (texHalf * scale) + (origin * scale) - screenPos; - } - return position - screenPos + new Vector2(width * 0.5f, height) - new Vector2(texWidth * scale / 2f, texHeight * scale / (float)framecount) + (origin * scale) + new Vector2(0f, 5f); - } - #endregion + public static Vector2 GetDrawPosition(Vector2 position, Vector2 origin, int width, int height, int texWidth, int texHeight, int framecount, float scale, bool drawCentered = false) + { + Vector2 screenPos = new Vector2((int)Main.screenPosition.X, (int)Main.screenPosition.Y); + if (drawCentered) + { + Vector2 texHalf = new Vector2(texWidth / 2, texHeight / framecount / 2); + return (position + new Vector2(width * 0.5f, height * 0.5f)) - (texHalf * scale) + (origin * scale) - screenPos; + } + return position - screenPos + new Vector2(width * 0.5f, height) - new Vector2(texWidth * scale / 2f, texHeight * scale / (float)framecount) + (origin * scale) + new Vector2(0f, 5f); + } + #endregion - #region Recipes - public override void AddRecipeGroups() - { - CalamityRecipes.AddRecipeGroups(); - } + #region Recipes + public override void AddRecipeGroups() + { + CalamityRecipes.AddRecipeGroups(); + } - public override void AddRecipes() - { - CalamityRecipes.AddRecipes(); - } - #endregion + public override void AddRecipes() + { + CalamityRecipes.AddRecipes(); + } + #endregion - #region Seasons - public static Season season - { - get - { - DateTime date = DateTime.Now; - int day = date.DayOfYear - Convert.ToInt32((DateTime.IsLeapYear(date.Year)) && date.DayOfYear > 59); + #region Seasons + public static Season season + { + get + { + DateTime date = DateTime.Now; + int day = date.DayOfYear - Convert.ToInt32((DateTime.IsLeapYear(date.Year)) && date.DayOfYear > 59); - if (day < 80 || day >= 355) - { - return Season.Winter; - } + if (day < 80 || day >= 355) + { + return Season.Winter; + } - else if (day >= 80 && day < 172) - { - return Season.Spring; - } + else if (day >= 80 && day < 172) + { + return Season.Spring; + } - else if (day >= 172 && day < 266) - { - return Season.Summer; - } + else if (day >= 172 && day < 266) + { + return Season.Summer; + } - else - { - return Season.Fall; - } - } - } - #endregion + else + { + return Season.Fall; + } + } + } + #endregion - #region Packets - public override void HandlePacket(BinaryReader reader, int whoAmI) - { - CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); - switch (msgType) - { - case CalamityModMessageType.MeleeLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0); - break; - case CalamityModMessageType.RangedLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 1); - break; - case CalamityModMessageType.MagicLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 2); - break; - case CalamityModMessageType.SummonLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 3); - break; - case CalamityModMessageType.RogueLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 4); - break; - case CalamityModMessageType.ExactMeleeLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 0); - break; - case CalamityModMessageType.ExactRangedLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 1); - break; - case CalamityModMessageType.ExactMagicLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 2); - break; - case CalamityModMessageType.ExactSummonLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 3); - break; - case CalamityModMessageType.ExactRogueLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4); - break; - case CalamityModMessageType.StressSync: - Main.player[reader.ReadInt32()].Calamity().HandleStress(reader); - break; - case CalamityModMessageType.BossRushStage: - int stage = reader.ReadInt32(); - CalamityWorld.bossRushStage = stage; - break; - case CalamityModMessageType.AdrenalineSync: - Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader); - break; - case CalamityModMessageType.RadiationSync: - Main.player[reader.ReadInt32()].Calamity().HandleRadiation(reader); - break; - /*case CalamityModMessageType.DistanceFromBossSync: - Main.player[reader.ReadInt32()].Calamity().HandleDistanceFromBoss(reader); - break;*/ - case CalamityModMessageType.TeleportPlayer: - Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI); - break; - case CalamityModMessageType.DoGCountdownSync: - int countdown = reader.ReadInt32(); - CalamityWorld.DoGSecondStageCountdown = countdown; - break; - case CalamityModMessageType.BossSpawnCountdownSync: - int countdown2 = reader.ReadInt32(); - CalamityWorld.bossSpawnCountdown = countdown2; - break; - case CalamityModMessageType.BossTypeSync: - int type = reader.ReadInt32(); - CalamityWorld.bossType = type; - break; - case CalamityModMessageType.DeathCountSync: - Main.player[reader.ReadInt32()].Calamity().HandleDeathCount(reader); - break; - default: - Logger.Warn("Unknown Message type: " + msgType); - break; - } - } + #region Packets + public override void HandlePacket(BinaryReader reader, int whoAmI) + { + CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); + switch (msgType) + { + case CalamityModMessageType.MeleeLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0); + break; + case CalamityModMessageType.RangedLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 1); + break; + case CalamityModMessageType.MagicLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 2); + break; + case CalamityModMessageType.SummonLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 3); + break; + case CalamityModMessageType.RogueLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 4); + break; + case CalamityModMessageType.ExactMeleeLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 0); + break; + case CalamityModMessageType.ExactRangedLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 1); + break; + case CalamityModMessageType.ExactMagicLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 2); + break; + case CalamityModMessageType.ExactSummonLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 3); + break; + case CalamityModMessageType.ExactRogueLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4); + break; + case CalamityModMessageType.StressSync: + Main.player[reader.ReadInt32()].Calamity().HandleStress(reader); + break; + case CalamityModMessageType.BossRushStage: + int stage = reader.ReadInt32(); + CalamityWorld.bossRushStage = stage; + break; + case CalamityModMessageType.AdrenalineSync: + Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader); + break; + case CalamityModMessageType.RadiationSync: + Main.player[reader.ReadInt32()].Calamity().HandleRadiation(reader); + break; + /*case CalamityModMessageType.DistanceFromBossSync: + Main.player[reader.ReadInt32()].Calamity().HandleDistanceFromBoss(reader); + break;*/ + case CalamityModMessageType.TeleportPlayer: + Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI); + break; + case CalamityModMessageType.DoGCountdownSync: + int countdown = reader.ReadInt32(); + CalamityWorld.DoGSecondStageCountdown = countdown; + break; + case CalamityModMessageType.BossSpawnCountdownSync: + int countdown2 = reader.ReadInt32(); + CalamityWorld.bossSpawnCountdown = countdown2; + break; + case CalamityModMessageType.BossTypeSync: + int type = reader.ReadInt32(); + CalamityWorld.bossType = type; + break; + case CalamityModMessageType.DeathCountSync: + Main.player[reader.ReadInt32()].Calamity().HandleDeathCount(reader); + break; + default: + Logger.Warn("Unknown Message type: " + msgType); + break; + } + } #endregion #region Stop Rain @@ -2885,34 +2894,34 @@ namespace CalamityMod } public enum Season : byte - { - Winter, - Spring, - Summer, - Fall - } + { + Winter, + Spring, + Summer, + Fall + } - enum CalamityModMessageType : byte - { - MeleeLevelSync, - RangedLevelSync, - MagicLevelSync, - SummonLevelSync, - RogueLevelSync, - ExactMeleeLevelSync, - ExactRangedLevelSync, - ExactMagicLevelSync, - ExactSummonLevelSync, - ExactRogueLevelSync, - StressSync, - AdrenalineSync, - TeleportPlayer, - BossRushStage, - DoGCountdownSync, - BossSpawnCountdownSync, - BossTypeSync, - DeathCountSync, - RadiationSync - //DistanceFromBossSync - } + enum CalamityModMessageType : byte + { + MeleeLevelSync, + RangedLevelSync, + MagicLevelSync, + SummonLevelSync, + RogueLevelSync, + ExactMeleeLevelSync, + ExactRangedLevelSync, + ExactMagicLevelSync, + ExactSummonLevelSync, + ExactRogueLevelSync, + StressSync, + AdrenalineSync, + TeleportPlayer, + BossRushStage, + DoGCountdownSync, + BossSpawnCountdownSync, + BossTypeSync, + DeathCountSync, + RadiationSync + //DistanceFromBossSync + } } diff --git a/Config.cs b/Config.cs index 7a5ca607b8..ddd9fd55be 100644 --- a/Config.cs +++ b/Config.cs @@ -8,28 +8,28 @@ namespace CalamityMod public static class Config { public static bool AdrenalineAndRage = true; - public static bool ExpertDebuffDurationReduction = true; - public static bool ExpertChilledWaterRemoval = true; - public static bool ProficiencyEnabled = true; - public static bool MiningSpeedBoost = false; - public static bool DisableExpertEnemySpawnsNearHouse = false; - public static bool ExpertPillarEnemyKillCountReduction = true; - public static bool LethalLava = true; - public static bool RevengeanceAndDeathThoriumBossBuff = false; + public static bool ExpertDebuffDurationReduction = true; + public static bool ExpertChilledWaterRemoval = true; + public static bool ProficiencyEnabled = true; + public static bool MiningSpeedBoost = false; + public static bool DisableExpertEnemySpawnsNearHouse = false; + public static bool ExpertPillarEnemyKillCountReduction = true; + public static bool LethalLava = true; + public static bool RevengeanceAndDeathThoriumBossBuff = false; - public static bool BossRushAccessoryCurse = false; - public static bool BossRushHealthCurse = false; - public static bool BossRushDashCurse = false; - public static bool BossRushXerocCurse = false; - public static bool BossRushImmunityFrameCurse = false; + public static bool BossRushAccessoryCurse = false; + public static bool BossRushHealthCurse = false; + public static bool BossRushDashCurse = false; + public static bool BossRushXerocCurse = false; + public static bool BossRushImmunityFrameCurse = false; - public static int RageMeterXPos = 500; - public static int RageMeterYPos = 30; - public static int AdrenalineMeterXPos = 650; - public static int AdrenalineMeterYPos = 30; - public static int BossHealthPercentageBoost = 0; + public static int RageMeterXPos = 500; + public static int RageMeterYPos = 30; + public static int AdrenalineMeterXPos = 650; + public static int AdrenalineMeterYPos = 30; + public static int BossHealthPercentageBoost = 0; - static readonly string ConfigPath = Path.Combine(Main.SavePath, "Mod Configs", "CalamityConfig.json"); + static readonly string ConfigPath = Path.Combine(Main.SavePath, "Mod Configs", "CalamityConfig.json"); static Preferences Configuration = new Preferences(ConfigPath); public static void Load() @@ -37,62 +37,62 @@ namespace CalamityMod if (!ReadConfig()) { SetDefaults(); - ModContent.GetInstance().Logger.Warn("Couldn't find config file! Creating a new one..."); - } + ModContent.GetInstance().Logger.Warn("Couldn't find config file! Creating a new one..."); + } SaveConfig(); } - public static void SetDefaults() + public static void SetDefaults() { - AdrenalineAndRage = true; - ExpertDebuffDurationReduction = true; - ExpertChilledWaterRemoval = true; - ProficiencyEnabled = true; - MiningSpeedBoost = false; - DisableExpertEnemySpawnsNearHouse = false; - ExpertPillarEnemyKillCountReduction = true; - LethalLava = true; - RevengeanceAndDeathThoriumBossBuff = false; + AdrenalineAndRage = true; + ExpertDebuffDurationReduction = true; + ExpertChilledWaterRemoval = true; + ProficiencyEnabled = true; + MiningSpeedBoost = false; + DisableExpertEnemySpawnsNearHouse = false; + ExpertPillarEnemyKillCountReduction = true; + LethalLava = true; + RevengeanceAndDeathThoriumBossBuff = false; - BossRushAccessoryCurse = false; - BossRushHealthCurse = false; - BossRushDashCurse = false; - BossRushXerocCurse = false; - BossRushImmunityFrameCurse = false; + BossRushAccessoryCurse = false; + BossRushHealthCurse = false; + BossRushDashCurse = false; + BossRushXerocCurse = false; + BossRushImmunityFrameCurse = false; - RageMeterXPos = 500; - RageMeterYPos = 30; - AdrenalineMeterXPos = 650; - AdrenalineMeterYPos = 30; - BossHealthPercentageBoost = 0; - } + RageMeterXPos = 500; + RageMeterYPos = 30; + AdrenalineMeterXPos = 650; + AdrenalineMeterYPos = 30; + BossHealthPercentageBoost = 0; + } public static bool ReadConfig() { if (Configuration.Load()) { Configuration.Get("AdrenalineAndRage", ref AdrenalineAndRage); - Configuration.Get("ExpertDebuffDurationReduction", ref ExpertDebuffDurationReduction); - Configuration.Get("ExpertChilledWaterRemoval", ref ExpertChilledWaterRemoval); - Configuration.Get("ProficiencyEnabled", ref ProficiencyEnabled); - Configuration.Get("MiningSpeedBoost", ref MiningSpeedBoost); - Configuration.Get("DisableExpertEnemySpawnsNearHouse", ref DisableExpertEnemySpawnsNearHouse); - Configuration.Get("ExpertPillarEnemyKillCountReduction", ref ExpertPillarEnemyKillCountReduction); - Configuration.Get("LethalLava", ref LethalLava); - Configuration.Get("RevengeanceAndDeathThoriumBossBuff", ref RevengeanceAndDeathThoriumBossBuff); + Configuration.Get("ExpertDebuffDurationReduction", ref ExpertDebuffDurationReduction); + Configuration.Get("ExpertChilledWaterRemoval", ref ExpertChilledWaterRemoval); + Configuration.Get("ProficiencyEnabled", ref ProficiencyEnabled); + Configuration.Get("MiningSpeedBoost", ref MiningSpeedBoost); + Configuration.Get("DisableExpertEnemySpawnsNearHouse", ref DisableExpertEnemySpawnsNearHouse); + Configuration.Get("ExpertPillarEnemyKillCountReduction", ref ExpertPillarEnemyKillCountReduction); + Configuration.Get("LethalLava", ref LethalLava); + Configuration.Get("RevengeanceAndDeathThoriumBossBuff", ref RevengeanceAndDeathThoriumBossBuff); - Configuration.Get("BossRushAccessoryCurse", ref BossRushAccessoryCurse); - Configuration.Get("BossRushHealthCurse", ref BossRushHealthCurse); - Configuration.Get("BossRushDashCurse", ref BossRushDashCurse); - Configuration.Get("BossRushXerocCurse", ref BossRushXerocCurse); - Configuration.Get("BossRushImmunityFrameCurse", ref BossRushImmunityFrameCurse); + Configuration.Get("BossRushAccessoryCurse", ref BossRushAccessoryCurse); + Configuration.Get("BossRushHealthCurse", ref BossRushHealthCurse); + Configuration.Get("BossRushDashCurse", ref BossRushDashCurse); + Configuration.Get("BossRushXerocCurse", ref BossRushXerocCurse); + Configuration.Get("BossRushImmunityFrameCurse", ref BossRushImmunityFrameCurse); - Configuration.Get("RageMeterXPos", ref RageMeterXPos); - Configuration.Get("RageMeterYPos", ref RageMeterYPos); - Configuration.Get("AdrenalineMeterXPos", ref AdrenalineMeterXPos); - Configuration.Get("AdrenalineMeterYPos", ref AdrenalineMeterYPos); - Configuration.Get("BossHealthPercentageBoost", ref BossHealthPercentageBoost); - return true; + Configuration.Get("RageMeterXPos", ref RageMeterXPos); + Configuration.Get("RageMeterYPos", ref RageMeterYPos); + Configuration.Get("AdrenalineMeterXPos", ref AdrenalineMeterXPos); + Configuration.Get("AdrenalineMeterYPos", ref AdrenalineMeterYPos); + Configuration.Get("BossHealthPercentageBoost", ref BossHealthPercentageBoost); + return true; } return false; } @@ -101,39 +101,39 @@ namespace CalamityMod { Configuration.Clear(); Configuration.Put("AdrenalineAndRage", AdrenalineAndRage); - Configuration.Put("ExpertDebuffDurationReduction", ExpertDebuffDurationReduction); - Configuration.Put("ExpertChilledWaterRemoval", ExpertChilledWaterRemoval); - Configuration.Put("ProficiencyEnabled", ProficiencyEnabled); - Configuration.Put("MiningSpeedBoost", MiningSpeedBoost); - Configuration.Put("DisableExpertEnemySpawnsNearHouse", DisableExpertEnemySpawnsNearHouse); - Configuration.Put("ExpertPillarEnemyKillCountReduction", ExpertPillarEnemyKillCountReduction); - Configuration.Put("LethalLava", LethalLava); - Configuration.Put("RevengeanceAndDeathThoriumBossBuff", RevengeanceAndDeathThoriumBossBuff); + Configuration.Put("ExpertDebuffDurationReduction", ExpertDebuffDurationReduction); + Configuration.Put("ExpertChilledWaterRemoval", ExpertChilledWaterRemoval); + Configuration.Put("ProficiencyEnabled", ProficiencyEnabled); + Configuration.Put("MiningSpeedBoost", MiningSpeedBoost); + Configuration.Put("DisableExpertEnemySpawnsNearHouse", DisableExpertEnemySpawnsNearHouse); + Configuration.Put("ExpertPillarEnemyKillCountReduction", ExpertPillarEnemyKillCountReduction); + Configuration.Put("LethalLava", LethalLava); + Configuration.Put("RevengeanceAndDeathThoriumBossBuff", RevengeanceAndDeathThoriumBossBuff); - Configuration.Put("BossRushAccessoryCurse", BossRushAccessoryCurse); - Configuration.Put("BossRushHealthCurse", BossRushHealthCurse); - Configuration.Put("BossRushDashCurse", BossRushDashCurse); - Configuration.Put("BossRushXerocCurse", BossRushXerocCurse); - Configuration.Put("BossRushImmunityFrameCurse", BossRushImmunityFrameCurse); + Configuration.Put("BossRushAccessoryCurse", BossRushAccessoryCurse); + Configuration.Put("BossRushHealthCurse", BossRushHealthCurse); + Configuration.Put("BossRushDashCurse", BossRushDashCurse); + Configuration.Put("BossRushXerocCurse", BossRushXerocCurse); + Configuration.Put("BossRushImmunityFrameCurse", BossRushImmunityFrameCurse); - Configuration.Put("RageMeterXPos", RageMeterXPos); - if (RageMeterXPos < 0) - RageMeterXPos = 0; - Configuration.Put("RageMeterYPos", RageMeterYPos); - if (RageMeterYPos < 0) - RageMeterYPos = 0; - Configuration.Put("AdrenalineMeterXPos", AdrenalineMeterXPos); - if (AdrenalineMeterXPos < 0) - AdrenalineMeterXPos = 0; - Configuration.Put("AdrenalineMeterYPos", AdrenalineMeterYPos); - if (AdrenalineMeterYPos < 0) - AdrenalineMeterYPos = 0; - Configuration.Put("BossHealthPercentageBoost", BossHealthPercentageBoost); - if (BossHealthPercentageBoost < 0) - BossHealthPercentageBoost = 0; - if (BossHealthPercentageBoost > 900) - BossHealthPercentageBoost = 900; - Configuration.Save(); + Configuration.Put("RageMeterXPos", RageMeterXPos); + if (RageMeterXPos < 0) + RageMeterXPos = 0; + Configuration.Put("RageMeterYPos", RageMeterYPos); + if (RageMeterYPos < 0) + RageMeterYPos = 0; + Configuration.Put("AdrenalineMeterXPos", AdrenalineMeterXPos); + if (AdrenalineMeterXPos < 0) + AdrenalineMeterXPos = 0; + Configuration.Put("AdrenalineMeterYPos", AdrenalineMeterYPos); + if (AdrenalineMeterYPos < 0) + AdrenalineMeterYPos = 0; + Configuration.Put("BossHealthPercentageBoost", BossHealthPercentageBoost); + if (BossHealthPercentageBoost < 0) + BossHealthPercentageBoost = 0; + if (BossHealthPercentageBoost > 900) + BossHealthPercentageBoost = 900; + Configuration.Save(); } class MultiplayerSyncWorld : ModWorld @@ -141,50 +141,50 @@ namespace CalamityMod public override void NetSend(BinaryWriter writer) { var data = new BitsByte(AdrenalineAndRage, ExpertDebuffDurationReduction, ExpertChilledWaterRemoval, - ProficiencyEnabled, MiningSpeedBoost, DisableExpertEnemySpawnsNearHouse, ExpertPillarEnemyKillCountReduction, - LethalLava); + ProficiencyEnabled, MiningSpeedBoost, DisableExpertEnemySpawnsNearHouse, ExpertPillarEnemyKillCountReduction, + LethalLava); - var data2 = new BitsByte(BossRushAccessoryCurse, BossRushHealthCurse, BossRushDashCurse, - BossRushXerocCurse, BossRushImmunityFrameCurse, RevengeanceAndDeathThoriumBossBuff); + var data2 = new BitsByte(BossRushAccessoryCurse, BossRushHealthCurse, BossRushDashCurse, + BossRushXerocCurse, BossRushImmunityFrameCurse, RevengeanceAndDeathThoriumBossBuff); - writer.Write(data); - writer.Write(data2); + writer.Write(data); + writer.Write(data2); - writer.Write(RageMeterXPos); - writer.Write(RageMeterYPos); - writer.Write(AdrenalineMeterXPos); - writer.Write(AdrenalineMeterYPos); - writer.Write(BossHealthPercentageBoost); - } + writer.Write(RageMeterXPos); + writer.Write(RageMeterYPos); + writer.Write(AdrenalineMeterXPos); + writer.Write(AdrenalineMeterYPos); + writer.Write(BossHealthPercentageBoost); + } public override void NetReceive(BinaryReader reader) { SaveConfig(); var data = (BitsByte)reader.ReadByte(); - AdrenalineAndRage = data[0]; - ExpertDebuffDurationReduction = data[1]; - ExpertChilledWaterRemoval = data[2]; - ProficiencyEnabled = data[3]; - MiningSpeedBoost = data[4]; - DisableExpertEnemySpawnsNearHouse = data[5]; - ExpertPillarEnemyKillCountReduction = data[6]; - LethalLava = data[7]; + AdrenalineAndRage = data[0]; + ExpertDebuffDurationReduction = data[1]; + ExpertChilledWaterRemoval = data[2]; + ProficiencyEnabled = data[3]; + MiningSpeedBoost = data[4]; + DisableExpertEnemySpawnsNearHouse = data[5]; + ExpertPillarEnemyKillCountReduction = data[6]; + LethalLava = data[7]; - var data2 = (BitsByte)reader.ReadByte(); - BossRushAccessoryCurse = data2[0]; - BossRushHealthCurse = data2[1]; - BossRushDashCurse = data2[2]; - BossRushXerocCurse = data2[3]; - BossRushImmunityFrameCurse = data2[4]; - RevengeanceAndDeathThoriumBossBuff = data2[5]; + var data2 = (BitsByte)reader.ReadByte(); + BossRushAccessoryCurse = data2[0]; + BossRushHealthCurse = data2[1]; + BossRushDashCurse = data2[2]; + BossRushXerocCurse = data2[3]; + BossRushImmunityFrameCurse = data2[4]; + RevengeanceAndDeathThoriumBossBuff = data2[5]; - RageMeterXPos = reader.ReadInt32(); - RageMeterYPos = reader.ReadInt32(); - AdrenalineMeterXPos = reader.ReadInt32(); - AdrenalineMeterYPos = reader.ReadInt32(); - BossHealthPercentageBoost = reader.ReadInt32(); - } + RageMeterXPos = reader.ReadInt32(); + RageMeterYPos = reader.ReadInt32(); + AdrenalineMeterXPos = reader.ReadInt32(); + AdrenalineMeterYPos = reader.ReadInt32(); + BossHealthPercentageBoost = reader.ReadInt32(); + } } class MultiplayerSyncPlayer : ModPlayer diff --git a/Dusts/BrimstoneFlame.cs b/Dusts/BrimstoneFlame.cs index 241218f609..1c48e1fb01 100644 --- a/Dusts/BrimstoneFlame.cs +++ b/Dusts/BrimstoneFlame.cs @@ -5,35 +5,35 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts { public class BrimstoneFlame : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; - dust.velocity.X *= 0.3f; - dust.scale *= 0.7f; - } + { + public override void OnSpawn(Dust dust) + { + dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; + dust.velocity.X *= 0.3f; + dust.scale *= 0.7f; + } - public override bool MidUpdate(Dust dust) - { - if (!dust.noGravity) - { - dust.velocity.Y += 0.05f; - } - if (!dust.noLight) - { - float strength = dust.scale * 1.4f; - if (strength > 1f) - { - strength = 1f; - } - Lighting.AddLight(dust.position, 0.1f * strength, 0.025f * strength, 0.025f * strength); - } - return true; - } + public override bool MidUpdate(Dust dust) + { + if (!dust.noGravity) + { + dust.velocity.Y += 0.05f; + } + if (!dust.noLight) + { + float strength = dust.scale * 1.4f; + if (strength > 1f) + { + strength = 1f; + } + Lighting.AddLight(dust.position, 0.1f * strength, 0.025f * strength, 0.025f * strength); + } + return true; + } - public override Color? GetAlpha(Dust dust, Color lightColor) - { - return new Color(lightColor.R, lightColor.G, lightColor.B, 25); - } - } + public override Color? GetAlpha(Dust dust, Color lightColor) + { + return new Color(lightColor.R, lightColor.G, lightColor.B, 25); + } + } } diff --git a/Dusts/FurnitureDusts/BloomTileGold.cs b/Dusts/FurnitureDusts/BloomTileGold.cs index 1ecbb81818..a8bb705adb 100644 --- a/Dusts/FurnitureDusts/BloomTileGold.cs +++ b/Dusts/FurnitureDusts/BloomTileGold.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts.FurnitureDusts { public class BloomTileGold : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.noLight = true; + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; dust.noGravity = false; - dust.scale = 1.2f; - dust.alpha = 100; - } + dust.scale = 1.2f; + dust.alpha = 100; + } - public override bool Update(Dust dust) + public override bool Update(Dust dust) { dust.velocity.Y += 0.1f; dust.position += dust.velocity; - dust.rotation += dust.velocity.X; - dust.scale -= 0.03f; - if (dust.scale < 0.5f) - { - dust.active = false; - } - return false; - } - } + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } } diff --git a/Dusts/FurnitureDusts/BloomTileLeaves.cs b/Dusts/FurnitureDusts/BloomTileLeaves.cs index b473be5f1a..419240e5e2 100644 --- a/Dusts/FurnitureDusts/BloomTileLeaves.cs +++ b/Dusts/FurnitureDusts/BloomTileLeaves.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts.FurnitureDusts { public class BloomTileLeaves : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.noLight = true; + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; dust.noGravity = false; - dust.scale = 1.2f; - dust.alpha = 100; - } + dust.scale = 1.2f; + dust.alpha = 100; + } - public override bool Update(Dust dust) + public override bool Update(Dust dust) { dust.velocity.Y += 0.05f; dust.position += dust.velocity; - dust.rotation += dust.velocity.X; - dust.scale -= 0.03f; - if (dust.scale < 0.5f) - { - dust.active = false; - } - return false; - } - } + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } } diff --git a/Dusts/FurnitureDusts/OccultTileCloth.cs b/Dusts/FurnitureDusts/OccultTileCloth.cs index acd065c2d6..d8a1ddedc1 100644 --- a/Dusts/FurnitureDusts/OccultTileCloth.cs +++ b/Dusts/FurnitureDusts/OccultTileCloth.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts.FurnitureDusts { public class OccultTileCloth : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.noLight = true; + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; dust.noGravity = false; - dust.scale = 1.2f; - dust.alpha = 100; - } + dust.scale = 1.2f; + dust.alpha = 100; + } - public override bool Update(Dust dust) + public override bool Update(Dust dust) { dust.velocity.Y += 0.1f; dust.position += dust.velocity; - dust.rotation += dust.velocity.X; - dust.scale -= 0.03f; - if (dust.scale < 0.5f) - { - dust.active = false; - } - return false; - } - } + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } } diff --git a/Dusts/FurnitureDusts/ProfanedTileRock.cs b/Dusts/FurnitureDusts/ProfanedTileRock.cs index 180fa62510..225d1b6a38 100644 --- a/Dusts/FurnitureDusts/ProfanedTileRock.cs +++ b/Dusts/FurnitureDusts/ProfanedTileRock.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts.FurnitureDusts { public class ProfanedTileRock : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.noLight = true; + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; dust.noGravity = false; - dust.scale = 1.2f; - dust.alpha = 100; - } + dust.scale = 1.2f; + dust.alpha = 100; + } - public override bool Update(Dust dust) + public override bool Update(Dust dust) { dust.velocity.Y += 0.1f; dust.position += dust.velocity; - dust.rotation += dust.velocity.X; - dust.scale -= 0.03f; - if (dust.scale < 0.5f) - { - dust.active = false; - } - return false; - } - } + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } } diff --git a/Dusts/FurnitureDusts/SilvaTileGold.cs b/Dusts/FurnitureDusts/SilvaTileGold.cs index d8bcf02f59..fccd0f6718 100644 --- a/Dusts/FurnitureDusts/SilvaTileGold.cs +++ b/Dusts/FurnitureDusts/SilvaTileGold.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts.FurnitureDusts { public class SilvaTileGold : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.noLight = true; + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; dust.noGravity = false; - dust.scale = 1.2f; - dust.alpha = 100; - } + dust.scale = 1.2f; + dust.alpha = 100; + } - public override bool Update(Dust dust) + public override bool Update(Dust dust) { dust.velocity.Y += 0.1f; dust.position += dust.velocity; - dust.rotation += dust.velocity.X; - dust.scale -= 0.03f; - if (dust.scale < 0.5f) - { - dust.active = false; - } - return false; - } - } + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } } diff --git a/Dusts/HBSparkle.cs b/Dusts/HBSparkle.cs index cc6b434f4f..9c4b5071cb 100644 --- a/Dusts/HBSparkle.cs +++ b/Dusts/HBSparkle.cs @@ -4,27 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts { public class HBSparkle : ModDust -{ - public override void OnSpawn(Dust dust) { - dust.velocity *= 0.1f; - dust.alpha = 155; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.25f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X * 0.05f; - dust.scale *= 0.99f; - float light = 0.35f * dust.scale; - Lighting.AddLight(dust.position, 0.35f, 0.01f, 0.01f); - if (dust.scale < 0.15f) + public override void OnSpawn(Dust dust) { - dust.active = false; + dust.velocity *= 0.1f; + dust.alpha = 155; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.25f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.35f, 0.01f, 0.01f); + if (dust.scale < 0.15f) + { + dust.active = false; + } + return false; } - return false; } -}} +} diff --git a/Dusts/HolyFlame.cs b/Dusts/HolyFlame.cs index 3fa13e185f..10728b1ff1 100644 --- a/Dusts/HolyFlame.cs +++ b/Dusts/HolyFlame.cs @@ -5,35 +5,35 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts { public class HolyFlame : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; - dust.velocity.X *= 0.3f; - dust.scale *= 0.7f; - } + { + public override void OnSpawn(Dust dust) + { + dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; + dust.velocity.X *= 0.3f; + dust.scale *= 0.7f; + } - public override bool MidUpdate(Dust dust) - { - if (!dust.noGravity) - { - dust.velocity.Y += 0.05f; - } - if (!dust.noLight) - { - float strength = dust.scale * 1.4f; - if (strength > 1f) - { - strength = 1f; - } - Lighting.AddLight(dust.position, 0.25f * strength, 0.25f * strength, 0.1f * strength); - } - return true; - } + public override bool MidUpdate(Dust dust) + { + if (!dust.noGravity) + { + dust.velocity.Y += 0.05f; + } + if (!dust.noLight) + { + float strength = dust.scale * 1.4f; + if (strength > 1f) + { + strength = 1f; + } + Lighting.AddLight(dust.position, 0.25f * strength, 0.25f * strength, 0.1f * strength); + } + return true; + } - public override Color? GetAlpha(Dust dust, Color lightColor) - { - return new Color(lightColor.R, lightColor.G, lightColor.B, 25); - } - } + public override Color? GetAlpha(Dust dust, Color lightColor) + { + return new Color(lightColor.R, lightColor.G, lightColor.B, 25); + } + } } diff --git a/Dusts/OMGWTHSparkle.cs b/Dusts/OMGWTHSparkle.cs index a7803200aa..c4c7a4519a 100644 --- a/Dusts/OMGWTHSparkle.cs +++ b/Dusts/OMGWTHSparkle.cs @@ -4,27 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Dusts { public class OMGWTHSparkle : ModDust -{ - public override void OnSpawn(Dust dust) { - dust.velocity *= 0.1f; - dust.alpha = 155; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.25f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X * 0.05f; - dust.scale *= 0.99f; - float light = 0.35f * dust.scale; - Lighting.AddLight(dust.position, 0.35f, 0.1f, 0.1f); - if (dust.scale < 0.15f) + public override void OnSpawn(Dust dust) { - dust.active = false; + dust.velocity *= 0.1f; + dust.alpha = 155; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.25f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.35f, 0.1f, 0.1f); + if (dust.scale < 0.15f) + { + dust.active = false; + } + return false; } - return false; } -}} +} diff --git a/Gores/AstralWaterDroplet.cs b/Gores/AstralWaterDroplet.cs index 219bfd0335..7f138a3749 100644 --- a/Gores/AstralWaterDroplet.cs +++ b/Gores/AstralWaterDroplet.cs @@ -1,11 +1,10 @@  -using Terraria; -using Terraria.ModLoader; -using Terraria.Graphics.Effects; -using Terraria.GameContent.Shaders; - using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.Shaders; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; namespace CalamityMod.Gores { diff --git a/Items/AbyssItems/AbyssalAmulet.cs b/Items/AbyssItems/AbyssalAmulet.cs index a2bdb18eab..6a3035444e 100644 --- a/Items/AbyssItems/AbyssalAmulet.cs +++ b/Items/AbyssItems/AbyssalAmulet.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AbyssItems { diff --git a/Items/AbyssItems/AbyssalDivingGear.cs b/Items/AbyssItems/AbyssalDivingGear.cs index fe8b00c3d4..78b823a738 100644 --- a/Items/AbyssItems/AbyssalDivingGear.cs +++ b/Items/AbyssItems/AbyssalDivingGear.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AbyssItems { diff --git a/Items/AbyssItems/AlluringBait.cs b/Items/AbyssItems/AlluringBait.cs index 9c0f7d663c..4b3044b53d 100644 --- a/Items/AbyssItems/AlluringBait.cs +++ b/Items/AbyssItems/AlluringBait.cs @@ -24,9 +24,12 @@ namespace CalamityMod.Items.AbyssItems public override void UpdateAccessory(Player player, bool hideVisual) { - if (Main.eclipse) { player.fishingSkill += 60; } - else if (!Main.dayTime) { player.fishingSkill += 45; } - else { player.fishingSkill += 30; } + if (Main.eclipse) + { player.fishingSkill += 60; } + else if (!Main.dayTime) + { player.fishingSkill += 45; } + else + { player.fishingSkill += 30; } } } } diff --git a/Items/AbyssItems/AnechoicCoating.cs b/Items/AbyssItems/AnechoicCoating.cs index 5505f3f3f1..c45530616a 100644 --- a/Items/AbyssItems/AnechoicCoating.cs +++ b/Items/AbyssItems/AnechoicCoating.cs @@ -4,34 +4,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.AbyssItems { - public class AnechoicCoating : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Anechoic Coating"); - Tooltip.SetDefault("Reduces creature's ability to detect you in the abyss"); - } + public class AnechoicCoating : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anechoic Coating"); + Tooltip.SetDefault("Reduces creature's ability to detect you in the abyss"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("AnechoicCoating"); - item.buffTime = 7200; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("AnechoicCoating"); + item.buffTime = 7200; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CloakingGland"); recipe.AddIngredient(ItemID.BottledWater); recipe.AddTile(TileID.AlchemyTable); @@ -44,5 +44,5 @@ namespace CalamityMod.Items.AbyssItems recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/AbyssItems/AnechoicPlating.cs b/Items/AbyssItems/AnechoicPlating.cs index 052f35c78e..7868867154 100644 --- a/Items/AbyssItems/AnechoicPlating.cs +++ b/Items/AbyssItems/AnechoicPlating.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AbyssItems { diff --git a/Items/AbyssItems/CloakingGland.cs b/Items/AbyssItems/CloakingGland.cs index 96040f6f1c..8c80845ab0 100644 --- a/Items/AbyssItems/CloakingGland.cs +++ b/Items/AbyssItems/CloakingGland.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.AbyssItems item.width = 26; item.height = 26; item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 3; } } } diff --git a/Items/AbyssItems/DepthCells.cs b/Items/AbyssItems/DepthCells.cs index e0c4fa8cc3..3415508fde 100644 --- a/Items/AbyssItems/DepthCells.cs +++ b/Items/AbyssItems/DepthCells.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.AbyssItems item.width = 26; item.height = 26; item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 3; } } } diff --git a/Items/AbyssItems/DepthCharm.cs b/Items/AbyssItems/DepthCharm.cs index 5c020205b5..ac40b9d082 100644 --- a/Items/AbyssItems/DepthCharm.cs +++ b/Items/AbyssItems/DepthCharm.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AbyssItems { diff --git a/Items/AbyssItems/IronBoots.cs b/Items/AbyssItems/IronBoots.cs index d94c67fd4b..8e411d9440 100644 --- a/Items/AbyssItems/IronBoots.cs +++ b/Items/AbyssItems/IronBoots.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AbyssItems { diff --git a/Items/AbyssItems/LumenousAmulet.cs b/Items/AbyssItems/LumenousAmulet.cs index 291930cc07..fe64efb5ba 100644 --- a/Items/AbyssItems/LumenousAmulet.cs +++ b/Items/AbyssItems/LumenousAmulet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AbyssItems { diff --git a/Items/AbyssItems/ReaperTooth.cs b/Items/AbyssItems/ReaperTooth.cs index 3cbb5da08f..ad92b765f9 100644 --- a/Items/AbyssItems/ReaperTooth.cs +++ b/Items/AbyssItems/ReaperTooth.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.AbyssItems item.width = 26; item.height = 26; item.maxStack = 999; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 10; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 10; } } } diff --git a/Items/AbyssItems/ReaperToothNecklace.cs b/Items/AbyssItems/ReaperToothNecklace.cs index d6fb39becf..20ad631cc4 100644 --- a/Items/AbyssItems/ReaperToothNecklace.cs +++ b/Items/AbyssItems/ReaperToothNecklace.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AbyssItems { diff --git a/Items/AbyssItems/SunkenStew.cs b/Items/AbyssItems/SunkenStew.cs index 2b997fc09b..ab66ae49e4 100644 --- a/Items/AbyssItems/SunkenStew.cs +++ b/Items/AbyssItems/SunkenStew.cs @@ -5,88 +5,88 @@ using Terraria.ModLoader; namespace CalamityMod.Items.AbyssItems { - public class SunkenStew : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hadal Stew"); - Tooltip.SetDefault(@"Restores 150 mana + public class SunkenStew : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hadal Stew"); + Tooltip.SetDefault(@"Restores 150 mana Only gives 50 (37 with Philosopher's Stone) seconds of Potion Sickness Grants Well Fed"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.rare = 3; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.buffType = BuffID.WellFed; - item.buffTime = 216000; - item.healLife = 120; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 3; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.buffType = BuffID.WellFed; + item.buffTime = 216000; + item.healLife = 120; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } - public override bool UseItem(Player player) - { - player.statLife += 120; - player.statMana += 150; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(120, true); - player.ManaEffect(150); - } + public override bool UseItem(Player player) + { + player.statLife += 120; + player.statMana += 150; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(120, true); + player.ManaEffect(150); + } - // fixes hardcoded potion sickness duration from quick heal - player.ClearBuff(BuffID.PotionSickness); - player.AddBuff(BuffID.PotionSickness, player.pStone ? 2220 : 3000); - player.AddBuff(BuffID.WellFed, 216000); - return true; - } + // fixes hardcoded potion sickness duration from quick heal + player.ClearBuff(BuffID.PotionSickness); + player.AddBuff(BuffID.PotionSickness, player.pStone ? 2220 : 3000); + player.AddBuff(BuffID.WellFed, 216000); + return true; + } - // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. - public override void GetHealLife(Player player, bool quickHeal, ref int healValue) - { - healValue = 0; - } + // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. + public override void GetHealLife(Player player, bool quickHeal, ref int healValue) + { + healValue = 0; + } - // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). - public override void ModifyTooltips(List tooltips) - { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; - } + // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). + public override void ModifyTooltips(List tooltips) + { + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthCells", 5); - recipe.AddIngredient(ItemID.GlowingMushroom, 3); - recipe.AddIngredient(ItemID.Honeyfin); - recipe.AddIngredient(ItemID.Bowl); - recipe.AddTile(TileID.CookingPots); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthCells", 5); + recipe.AddIngredient(ItemID.GlowingMushroom, 3); + recipe.AddIngredient(ItemID.Honeyfin); + recipe.AddIngredient(ItemID.Bowl); + recipe.AddTile(TileID.CookingPots); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/AbyssItems/TorrentialTear.cs b/Items/AbyssItems/TorrentialTear.cs index 5207c9ab31..5fb35d2a36 100644 --- a/Items/AbyssItems/TorrentialTear.cs +++ b/Items/AbyssItems/TorrentialTear.cs @@ -5,34 +5,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.AbyssItems { public class TorrentialTear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Torrential Tear"); - Tooltip.SetDefault("Summons the rain\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Torrential Tear"); + Tooltip.SetDefault("Summons the rain\n" + "Rain will start some time after this item is used\n" + "If used when raining the rain will stop some time after this item is used"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item66; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return !Main.slimeRain; - } + public override bool CanUseItem(Player player) + { + return !Main.slimeRain; + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { if (!Main.raining) { int num = 86400; @@ -85,8 +85,8 @@ namespace CalamityMod.Items.AbyssItems else Main.raining = false; - CalamityMod.UpdateServerBoolean(); - return true; - } - } + CalamityMod.UpdateServerBoolean(); + return true; + } + } } diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 9f0c84f9f8..446e22efec 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -1,39 +1,39 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class AbyssalMirror : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Mirror"); - Tooltip.SetDefault("Light does not reach the depths of the ocean\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Mirror"); + Tooltip.SetDefault("Light does not reach the depths of the ocean\n" + "Significantly reduces enemy aggression, even in the abyss\n" + "15% increased stealth regeneration while moving\n" + "Grants a slight chance to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies\n" + "Evading an attack grants a lot of stealth\n" + "This evade has a 20s cooldown before it can occur again"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 6, 0, 0); item.rare = 8; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { + public override void UpdateAccessory(Player player, bool hideVisual) + { CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthGenMoving += 0.15f; modPlayer.abyssalMirror = true; player.aggro -= 450; - } + } public override void AddRecipes() { diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index e3cb0bd45c..9469fd56dc 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 9be864bcde..6ef96cd826 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -1,9 +1,9 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories item.height = 34; item.value = Item.buyPrice(0, 15, 0, 0); item.expert = true; - item.rare = 9; + item.rare = 9; item.accessory = true; } @@ -57,8 +57,8 @@ namespace CalamityMod.Items.Accessories } } } - player.allDamage += 0.12f; - } + player.allDamage += 0.12f; + } public override void AddRecipes() { diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 914d2bea3b..617e184c4f 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index 96a20bcbae..e6290155a2 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -1,31 +1,31 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class AmidiasSpark : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amidias' Spark"); - Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + - "Sparks do extra damage in Hardmode"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amidias' Spark"); + Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + + "Sparks do extra damage in Hardmode"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 1; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aSpark = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.aSpark = true; + } + } } diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index fcf0bd16e3..6bf294c7a4 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 8ab7053ace..b29ff067c3 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -19,13 +19,13 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.projRef = true; + modPlayer.projRef = true; } - } + } } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 0deeb09e1a..e4d17d9640 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -28,13 +28,14 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(0, 90, 0, 0); //30 gold reforge item.defense = 10; item.accessory = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - if (!hideVisual) { modPlayer.dashMod = 4; } + if (!hideVisual) + { modPlayer.dashMod = 4; } modPlayer.elysianAegis = true; player.noKnockback = true; player.fireWalk = true; @@ -53,7 +54,8 @@ namespace CalamityMod.Items.Accessories player.buffImmune[mod.BuffType("BrimstoneFlames")] = true; player.buffImmune[mod.BuffType("HolyLight")] = true; player.buffImmune[mod.BuffType("GlacialState")] = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.1f; } + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { player.endurance += 0.1f; } } public override void AddRecipes() diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 251d410f56..88a9beb1ea 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Accessories "Immune to most debuffs including Brimstone Flames, Holy Flames, and Glacial State\n" + "10% damage reduction while submerged in liquid\n" + "+20 max life\n" + - "Grants a holy dash which can be used to ram enemies\n" + - "Toggle visibility of this accessory to enable/disable the dash"); + "Grants a holy dash which can be used to ram enemies\n" + + "Toggle visibility of this accessory to enable/disable the dash"); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - if (!hideVisual) { modPlayer.dashMod = 2; } + if (!hideVisual) + { modPlayer.dashMod = 2; } player.buffImmune[46] = true; player.buffImmune[44] = true; player.noKnockback = true; @@ -50,7 +51,8 @@ namespace CalamityMod.Items.Accessories player.buffImmune[mod.BuffType("HolyLight")] = true; player.buffImmune[mod.BuffType("GlacialState")] = true; player.statLifeMax2 += 20; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.1f; } + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { player.endurance += 0.1f; } } public override void AddRecipes() diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index 5cf1fa8fd7..ab6d9ada1d 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -1,51 +1,51 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class AstralArcanum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Arcanum"); - Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + - "Provides immunity to the astral infection debuff\n" + - "You have a 5% chance to reflect projectiles when they hit you\n" + - "If this effect triggers you get healed for the projectile's damage\n" + - "Boosts life regen even while under the effects of a damaging debuff\n" + - "While under the effects of a damaging debuff you will gain 20 defense\n" + - "Press O to toggle teleportation UI"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Arcanum"); + Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + + "Provides immunity to the astral infection debuff\n" + + "You have a 5% chance to reflect projectiles when they hit you\n" + + "If this effect triggers you get healed for the projectile's damage\n" + + "Boosts life regen even while under the effects of a damaging debuff\n" + + "While under the effects of a damaging debuff you will gain 20 defense\n" + + "Press O to toggle teleportation UI"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.Calamity().postMoonLordRarity = 13; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astralArcanum = true; - modPlayer.aBulwark = true; - modPlayer.projRef = true; - player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.astralArcanum = true; + modPlayer.aBulwark = true; + modPlayer.projRef = true; + player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CelestialJewel"); - recipe.AddIngredient(null, "AstralBulwark"); - recipe.AddIngredient(null, "ArcanumoftheVoid"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CelestialJewel"); + recipe.AddIngredient(null, "AstralBulwark"); + recipe.AddIngredient(null, "ArcanumoftheVoid"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs index ffea86ee61..2ec67bdd45 100644 --- a/Items/Accessories/AstralBulwark.cs +++ b/Items/Accessories/AstralBulwark.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 15, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -28,6 +28,6 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.aBulwark = true; player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; - } - } + } + } } diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index d24011da22..4d99e0f5d6 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Accessories item.height = 30; item.value = Item.buyPrice(0, 21, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -38,12 +38,12 @@ namespace CalamityMod.Items.Accessories recipe.AddRecipe(); } - public override void OnCraft(Recipe recipe) - { - if (Main.rand.NextBool(40)) - recipe.createItem.type = mod.ItemType("SamuraiBadge"); - else - recipe.createItem.type = item.type; - } - } + public override void OnCraft(Recipe recipe) + { + if (Main.rand.NextBool(40)) + recipe.createItem.type = mod.ItemType("SamuraiBadge"); + else + recipe.createItem.type = item.type; + } + } } diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 529cdd5b00..a9cd27593e 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 45, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 286e404c1a..df8d854844 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Accessories item.height = 42; item.value = Item.buyPrice(0, 15, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BurdenBreaker.cs b/Items/Accessories/BurdenBreaker.cs index 2e7dcd2f02..de0ed9097b 100644 --- a/Items/Accessories/BurdenBreaker.cs +++ b/Items/Accessories/BurdenBreaker.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index 387a62477f..f2a3eaa4af 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/ChaosAmulet.cs b/Items/Accessories/ChaosAmulet.cs index 220be3ebfe..4cc290ae54 100644 --- a/Items/Accessories/ChaosAmulet.cs +++ b/Items/Accessories/ChaosAmulet.cs @@ -5,36 +5,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class ChaosAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Amulet"); - Tooltip.SetDefault("Spelunker effect and increased life regen"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Amulet"); + Tooltip.SetDefault("Spelunker effect and increased life regen"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.lifeRegen = 2; + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.lifeRegen = 2; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.findTreasure = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.findTreasure = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos", 7); - recipe.AddIngredient(ItemID.SpelunkerPotion, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos", 7); + recipe.AddIngredient(ItemID.SpelunkerPotion, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index c01980e63f..aaedd00b14 100644 --- a/Items/Accessories/CheatTestThing.cs +++ b/Items/Accessories/CheatTestThing.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 346f76bbe9..16da40711d 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -1,8 +1,7 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -20,8 +19,8 @@ namespace CalamityMod.Items.Accessories item.height = 22; item.value = Item.buyPrice(0, 2, 0, 0); item.accessory = true; - item.rare = 1; - } + item.rare = 1; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -32,25 +31,25 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 4); + recipe.AddIngredient(ItemID.GoldBar, 4); recipe.AddIngredient(ItemID.CopperBar, 8); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 4); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldBar, 4); recipe.AddIngredient(ItemID.TinBar, 8); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 4); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 4); recipe.AddIngredient(ItemID.CopperBar, 8); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 4); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 4); recipe.AddIngredient(ItemID.TinBar, 8); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index 4025a88932..71338c2d45 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 90, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index 9b21797b1e..7e7d96dad4 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index fe914f2067..8162cb00a6 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class CrawCarapace : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Craw Carapace"); - Tooltip.SetDefault("5% increased damage reduction\n" + - "Enemies take damage when they touch you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Craw Carapace"); + Tooltip.SetDefault("5% increased damage reduction\n" + + "Enemies take damage when they touch you"); + } - public override void SetDefaults() - { - item.defense = 3; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 3; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 3, 0, 0); item.rare = 1; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.endurance += 0.05f; - player.thorns = 0.25f; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.endurance += 0.05f; + player.thorns = 0.25f; + } + } } diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index 75e02694ad..763b17910f 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs index 9bbcd21a6c..f878d117b8 100644 --- a/Items/Accessories/DarkGodsSheath.cs +++ b/Items/Accessories/DarkGodsSheath.cs @@ -1,32 +1,32 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class DarkGodsSheath : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark God's Sheath"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark God's Sheath"); Tooltip.SetDefault("+100 maximum stealth\n" + "Stealth regeneration rate increases while standing still\n" + "Stealth strikes have a 100% critical hit chance\n" + "Stealth strikes only expend 50% of your max stealth\n" + "6% increased rogue damage, and 6% increased rogue crit chance"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 26, 0, 0); item.rare = 9; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthStrikeAlwaysCrits = true; diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 237af15ed1..d9cb6ba272 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -1,8 +1,8 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Dark Sun Ring"); Tooltip.SetDefault("12% increase to damage, minion knockback, and melee speed\n" + - "+1 life regen, 15% increased pick speed, and +2 max minions\n" + + "+1 life regen, 15% increased pick speed, and +2 max minions\n" + "During the day the player has +3 life regen\n" + "During the night the player has +30 defense\n" + "Contains the power of the dark sun"); @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 10; - item.lifeRegen = 1; + item.defense = 10; + item.lifeRegen = 1; item.accessory = true; - item.Calamity().postMoonLordRarity = 15; - } + item.Calamity().postMoonLordRarity = 15; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 23b3f42782..dbd0f4ce20 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -1,51 +1,51 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class DeificAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deific Amulet"); - Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + - "Increases armor penetration by 10 and immune time after being struck\n" + - "Provides light underwater and provides a small amount of light in the abyss\n" + - "Causes stars to fall when damaged\n" + - "Reduces the cooldown of healing potions"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deific Amulet"); + Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + + "Increases armor penetration by 10 and immune time after being struck\n" + + "Provides light underwater and provides a small amount of light in the abyss\n" + + "Causes stars to fall when damaged\n" + + "Reduces the cooldown of healing potions"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 8; - item.value = Item.buyPrice(0, 45, 0, 0); - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 8; + item.value = Item.buyPrice(0, 45, 0, 0); + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dAmulet = true; - modPlayer.jellyfishNecklace = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dAmulet = true; + modPlayer.jellyfishNecklace = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CharmofMyths); - recipe.AddIngredient(ItemID.JellyfishNecklace); - recipe.AddIngredient(ItemID.PanicNecklace); - recipe.AddIngredient(ItemID.SharkToothNecklace); - recipe.AddIngredient(ItemID.StarVeil); - recipe.AddIngredient(null, "Stardust", 25); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CharmofMyths); + recipe.AddIngredient(ItemID.JellyfishNecklace); + recipe.AddIngredient(ItemID.PanicNecklace); + recipe.AddIngredient(ItemID.SharkToothNecklace); + recipe.AddIngredient(ItemID.StarVeil); + recipe.AddIngredient(null, "Stardust", 25); + recipe.AddIngredient(ItemID.MeteoriteBar, 25); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 64577385dc..de2f8a17d2 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -1,29 +1,29 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class DimensionalSoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dimensional Soul Artifact"); - Tooltip.SetDefault("Power\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dimensional Soul Artifact"); + Tooltip.SetDefault("Power\n" + "Boosts all damage by 25%\n" + "But at what cost?"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); - item.accessory = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(1, 50, 0, 0); + item.accessory = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 16; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -31,16 +31,16 @@ namespace CalamityMod.Items.Accessories modPlayer.dArtifact = true; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); recipe.AddIngredient(null, "EssenceofEleum", 10); recipe.AddIngredient(null, "CosmiliteBar", 10); recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); } - } + } } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 17f27d37e1..52e3d737bd 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -1,8 +1,8 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Draedon's Heart"); Tooltip.SetDefault("Gives 10% increased damage while you have the absolute rage buff\n" + "Increases your chance of getting the absolute rage buff\n" + - "Boosts your damage by 10% and max movement speed and acceleration by 5%\n" + + "Boosts your damage by 10% and max movement speed and acceleration by 5%\n" + "Rage mode does more damage\n" + "You gain rage over time\n" + "Gives immunity to the horror debuff\n" + @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 15; - } + item.Calamity().postMoonLordRarity = 15; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -44,9 +44,9 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(null, "HeartofDarkness"); recipe.AddIngredient(null, "StressPills"); recipe.AddIngredient(null, "Laudanum"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 5fb15a6f94..0a899efaca 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -1,15 +1,15 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class EclipseMirror : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse Mirror"); - Tooltip.SetDefault("Its reflection shows naught but darkness\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse Mirror"); + Tooltip.SetDefault("Its reflection shows naught but darkness\n" + "+100 maximum stealth\n" + "8% increased rogue damage, and 8% increased rogue crit chance\n" + "Vastly reduces enemy aggression, even in the abyss\n" + @@ -20,19 +20,19 @@ namespace CalamityMod.Items.Accessories "Grants a small chance to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" + "Evading an attack grants full stealth\n" + "This evade has a 20s cooldown before it can occur again"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 22, 0, 0); item.Calamity().postMoonLordRarity = 15; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { + public override void UpdateAccessory(Player player, bool hideVisual) + { CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthGenMoving += 0.2f; modPlayer.rogueStealthMax += 1; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories modPlayer.throwingCrit += 8; modPlayer.throwingDamage += 0.08f; player.aggro -= 700; - } + } public override void AddRecipes() { diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 3d02f4a28b..f735849efa 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -1,28 +1,28 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class EldritchSoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eldritch Soul Artifact"); - Tooltip.SetDefault("Knowledge\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eldritch Soul Artifact"); + Tooltip.SetDefault("Knowledge\n" + "Boosts melee speed by 10%, shoot speed by 25%, rogue damage by 15%, max minions by 2, and reduces mana cost by 15%"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); - item.accessory = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(1, 50, 0, 0); + item.accessory = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 16; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -31,15 +31,15 @@ namespace CalamityMod.Items.Accessories } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); recipe.AddIngredient(null, "EssenceofChaos", 10); recipe.AddIngredient(null, "Phantoplasm", 10); recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); } - } + } } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 640aaeb5e4..9ad6b5ded2 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Accessories item.height = 38; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 20; - } + item.Calamity().postMoonLordRarity = 20; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 0fe34b3d41..3f26c71a29 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Ranged projectiles have a chance to split\n" + "Ranged weapons have a chance to instantly kill normal enemies\n" + "10% increased ranged damage and 5% increased ranged critical strike chance\n" + - "20% reduced ammo usage and increased life regen, minion knockback, defense, and pick speed"); + "20% reduced ammo usage and increased life regen, minion knockback, defense, and pick speed"); } public override void SetDefaults() @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 20; - } + item.Calamity().postMoonLordRarity = 20; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index db24091f4e..5c24d0e5a6 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Ethereal Talisman"); Tooltip.SetDefault("15% increased magic damage, 5% increased magic critical strike chance, and 10% decreased mana usage\n" + - "+150 max mana and reveals treasure locations\n" + - "Increases pickup range for mana stars and you restore mana when damaged\n" + - "You automatically use mana potions when needed if visibility is on\n" + + "+150 max mana and reveals treasure locations\n" + + "Increases pickup range for mana stars and you restore mana when damaged\n" + + "You automatically use mana potions when needed if visibility is on\n" + "Magic attacks have a chance to instantly kill normal enemies"); } @@ -23,19 +23,19 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 20; - } + item.Calamity().postMoonLordRarity = 20; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.eTalisman = true; player.findTreasure = true; - if (!hideVisual) - player.manaFlower = true; - player.magicCuffs = true; - player.manaMagnet = true; - player.statManaMax2 += 150; + if (!hideVisual) + player.manaFlower = true; + player.magicCuffs = true; + player.manaMagnet = true; + player.statManaMax2 += 150; player.magicDamage += 0.15f; player.manaCost *= 0.9f; player.magicCrit += 5; diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 1200f24b0c..3f23ef9fde 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -1,25 +1,25 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class EyeoftheStorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of the Storm"); - Tooltip.SetDefault("Summons a cloud elemental to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of the Storm"); + Tooltip.SetDefault("Summons a cloud elemental to fight for you"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 26; + public override void SetDefaults() + { + item.width = 20; + item.height = 26; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; - item.accessory = true; - } + item.accessory = true; + } public override bool CanEquipAccessory(Player player, int slot) { @@ -32,20 +32,20 @@ namespace CalamityMod.Items.Accessories } public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.cloudWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("CloudyWaifu")) == -1) - { - player.AddBuff(mod.BuffType("CloudyWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("CloudyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - } + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.cloudWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("CloudyWaifu")) == -1) + { + player.AddBuff(mod.BuffType("CloudyWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("CloudyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index 885267d521..5ee0f3e6e0 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -1,34 +1,34 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class FeatherCrown : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather Crown"); - Tooltip.SetDefault("15% increased rogue projectile velocity\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather Crown"); + Tooltip.SetDefault("15% increased rogue projectile velocity\n" + "Stealth strikes cause feathers to fall from the sky on enemy hits"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 0, 80, 0); item.rare = 4; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { + public override void UpdateAccessory(Player player, bool hideVisual) + { CalamityPlayer modPlayer = player.Calamity(); modPlayer.throwingVelocity += 0.15f; modPlayer.featherCrown = true; - } + } public override void AddRecipes() { diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs index 300575980a..6c7e45fad7 100644 --- a/Items/Accessories/FrigidBulwark.cs +++ b/Items/Accessories/FrigidBulwark.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fBulwark = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.fBulwark = true; } public override void AddRecipes() diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index a28388bb9b..3ba5feaef2 100644 --- a/Items/Accessories/FrostBarrier.cs +++ b/Items/Accessories/FrostBarrier.cs @@ -1,33 +1,33 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class FrostBarrier : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Barrier"); - Tooltip.SetDefault("You will freeze enemies near you when you are struck\n" + - "You are immune to the chilled debuff"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Barrier"); + Tooltip.SetDefault("You will freeze enemies near you when you are struck\n" + + "You are immune to the chilled debuff"); + } - public override void SetDefaults() - { - item.defense = 4; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 4; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 9, 0, 0); item.rare = 3; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fBarrier = true; - player.buffImmune[46] = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.fBarrier = true; + player.buffImmune[46] = true; + } + } } diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index b1e798b5da..082a8bf0bc 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -1,38 +1,38 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class FrostFlare : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Flare"); - Tooltip.SetDefault("All melee attacks and projectiles inflict frostburn\n" + - "Immunity to frostburn, chilled, and frozen\n" + - "Resistant to cold attacks and +1 life regen\n" + - "Being above 75% life grants the player 10% increased damage\n" + - "Being below 25% life grants the player 10 defense and 15% increased max movement speed and acceleration\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Flare"); + Tooltip.SetDefault("All melee attacks and projectiles inflict frostburn\n" + + "Immunity to frostburn, chilled, and frozen\n" + + "Resistant to cold attacks and +1 life regen\n" + + "Being above 75% life grants the player 10% increased damage\n" + + "Being below 25% life grants the player 10 defense and 15% increased max movement speed and acceleration\n" + "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 10)); - } + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 10)); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.lifeRegen = 1; + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.lifeRegen = 1; item.value = Item.buyPrice(0, 24, 0, 0); item.rare = 5; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.frostFlare = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.frostFlare = true; + } + } } diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs index 6f3aa9d11a..4f9ee01b98 100644 --- a/Items/Accessories/FungalCarapace.cs +++ b/Items/Accessories/FungalCarapace.cs @@ -1,31 +1,31 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class FungalCarapace : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungal Carapace"); - Tooltip.SetDefault("You emit a mushroom spore explosion when you are hit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Carapace"); + Tooltip.SetDefault("You emit a mushroom spore explosion when you are hit"); + } - public override void SetDefaults() - { - item.defense = 2; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 2; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fCarapace = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.fCarapace = true; + } + } } diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 4a8efa8966..5be9f7d194 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -1,33 +1,33 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class GiantShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Shell"); - Tooltip.SetDefault("15% reduced movement speed\n" + - "Taking a hit will make you move very fast for a short time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Shell"); + Tooltip.SetDefault("15% reduced movement speed\n" + + "Taking a hit will make you move very fast for a short time"); + } - public override void SetDefaults() - { - item.defense = 6; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 6; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 3, 0, 0); item.rare = 1; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed -= 0.15f; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.gShell = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed -= 0.15f; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.gShell = true; + } + } } diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 94ddbe4712..6d85f1fa8f 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class GiantTortoiseShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Tortoise Shell"); - Tooltip.SetDefault("10% reduced movement speed\n" + - "Enemies take damage when they hit you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Tortoise Shell"); + Tooltip.SetDefault("10% reduced movement speed\n" + + "Enemies take damage when they hit you"); + } - public override void SetDefaults() - { - item.defense = 8; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 8; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 9, 0, 0); item.rare = 5; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed -= 0.1f; - player.thorns = 0.25f; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed -= 0.1f; + player.thorns = 0.25f; + } + } } diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/GodlySoulArtifact.cs index 3a4c6afa25..a7102eeb7a 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/GodlySoulArtifact.cs @@ -1,28 +1,28 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class GodlySoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Godly Soul Artifact"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Godly Soul Artifact"); Tooltip.SetDefault("Loyalty\n" + "Boosts max minions by 8"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); - item.accessory = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(1, 50, 0, 0); + item.accessory = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 16; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -31,15 +31,15 @@ namespace CalamityMod.Items.Accessories } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); recipe.AddIngredient(null, "EssenceofCinder", 10); recipe.AddIngredient(null, "HellcasterFragment", 10); recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); } - } + } } diff --git a/Items/Accessories/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs index 9b01647074..1ff71e1628 100644 --- a/Items/Accessories/GoldBurdenBreaker.cs +++ b/Items/Accessories/GoldBurdenBreaker.cs @@ -1,46 +1,47 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Items.Accessories { public class GoldBurdenBreaker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burden Breaker"); - Tooltip.SetDefault("The good time\nGo fast\nWARNING: May have disastrous results"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burden Breaker"); + Tooltip.SetDefault("The good time\nGo fast\nWARNING: May have disastrous results"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(0, 21, 0, 0); - item.rare = 10; - item.accessory = true; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(0, 21, 0, 0); + item.rare = 10; + item.accessory = true; + item.Calamity().postMoonLordRarity = 12; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (CalamityGlobalNPC.AnyBossNPCS()) { return; } - if (player.velocity.X > 5f) - { - player.velocity.X *= 1.025f; - if (player.velocity.X >= 500f) - { - player.velocity.X = 0f; - } - } - else if (player.velocity.X < -5f) - { - player.velocity.X *= 1.025f; - if (player.velocity.X <= -500f) - { - player.velocity.X = 0f; - } - } - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (CalamityGlobalNPC.AnyBossNPCS()) + { return; } + if (player.velocity.X > 5f) + { + player.velocity.X *= 1.025f; + if (player.velocity.X >= 500f) + { + player.velocity.X = 0f; + } + } + else if (player.velocity.X < -5f) + { + player.velocity.X *= 1.025f; + if (player.velocity.X <= -500f) + { + player.velocity.X = 0f; + } + } + } + } } diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index cc1d75d3e3..a7d3785f99 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -6,47 +6,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class GrandGelatin : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grand Gelatin"); - Tooltip.SetDefault("10% increased movement speed\n" + - "200% increased jump speed\n" + - "+20 max life and mana\n" + - "Standing still boosts life and mana regen"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Gelatin"); + Tooltip.SetDefault("10% increased movement speed\n" + + "200% increased jump speed\n" + + "+20 max life and mana\n" + + "Standing still boosts life and mana regen"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 6; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += (player.autoJump ? 0.5f : 2.0f); - player.statLifeMax2 += 20; - player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 2; - player.manaRegenBonus += 2; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += (player.autoJump ? 0.5f : 2.0f); + player.statLifeMax2 += 20; + player.statManaMax2 += 20; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.lifeRegen += 2; + player.manaRegenBonus += 2; + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ManaJelly"); - recipe.AddIngredient(null, "LifeJelly"); - recipe.AddIngredient(null, "VitalJelly"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ManaJelly"); + recipe.AddIngredient(null, "LifeJelly"); + recipe.AddIngredient(null, "VitalJelly"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index 0580dffe7e..242a88b984 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 04bdecd78d..84f70f6e2f 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index f9d8040ab1..02e2719e42 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -1,28 +1,28 @@ -using Terraria; +using CalamityMod.CalPlayer; +using CalamityMod.World; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class HeartoftheElements : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heart of the Elements"); - Tooltip.SetDefault("The heart of the world\n" + - "Increases max life by 20, life regen by 1, and all damage by 8%\n" + - "Increases movement speed by 10% and jump speed by 100%\n" + - "Increases damage reduction by 5%\n" + - "Increases max mana by 50 and reduces mana usage by 5%\n" + - "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + - "Summons all elementals to protect you\n" + - "Toggling the visibility of this accessory also toggles the elementals on and off\n" + - "Stat increases are slightly higher if the elementals are turned off"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heart of the Elements"); + Tooltip.SetDefault("The heart of the world\n" + + "Increases max life by 20, life regen by 1, and all damage by 8%\n" + + "Increases movement speed by 10% and jump speed by 100%\n" + + "Increases damage reduction by 5%\n" + + "Increases max mana by 50 and reduces mana usage by 5%\n" + + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + + "Summons all elementals to protect you\n" + + "Toggling the visibility of this accessory also toggles the elementals on and off\n" + + "Stat increases are slightly higher if the elementals are turned off"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); + } public override void SetDefaults() { @@ -30,9 +30,9 @@ namespace CalamityMod.Items.Accessories item.height = 20; item.value = Item.buyPrice(0, 60, 0, 0); item.defense = 9; - item.accessory = true; - item.Calamity().postMoonLordRarity = 20; - } + item.accessory = true; + item.Calamity().postMoonLordRarity = 20; + } public override bool CanEquipAccessory(Player player, int slot) { @@ -45,10 +45,10 @@ namespace CalamityMod.Items.Accessories } public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.allWaifus = !hideVisual; + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.allWaifus = !hideVisual; modPlayer.elementalHeart = true; if (!hideVisual) { @@ -59,8 +59,8 @@ namespace CalamityMod.Items.Accessories player.endurance += 0.05f; player.statManaMax2 += 50; player.manaCost *= 0.95f; - player.allDamage += 0.08f; - int damage = NPC.downedMoonlord ? 150 : 90; + player.allDamage += 0.08f; + int damage = NPC.downedMoonlord ? 150 : 90; float damageMult = CalamityWorld.downedDoG ? 2f : 1f; if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 1 || @@ -102,127 +102,127 @@ namespace CalamityMod.Items.Accessories player.endurance += 0.06f; player.statManaMax2 += 60; player.manaCost *= 0.93f; - player.allDamage += 0.1f; - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 0 || + player.allDamage += 0.1f; + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 0) { player.ClearBuff(mod.BuffType("HotE")); } } - if (player.velocity.Y == 0f && player.grappling[0] == -1) - { - int num4 = (int)player.Center.X / 16; - int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; - if (Main.tile[num4, num5] == null) - { - Main.tile[num4, num5] = new Tile(); - } - if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) - { - Main.tile[num4, num5].frameY = 0; - Main.tile[num4, num5].slope(0); - Main.tile[num4, num5].halfBrick(false); - if (Main.tile[num4, num5 + 1].type == 0) - { - if (Main.rand.NextBool(1000)) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 227; - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - if (Main.tile[num4, num5 + 1].type == 2) - { - if (Main.rand.NextBool(2)) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 3; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 73; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 109) - { - if (Main.rand.NextBool(2)) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 110; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 113; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 60) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 74; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - } - } - } + if (player.velocity.Y == 0f && player.grappling[0] == -1) + { + int num4 = (int)player.Center.X / 16; + int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; + if (Main.tile[num4, num5] == null) + { + Main.tile[num4, num5] = new Tile(); + } + if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) + { + Main.tile[num4, num5].frameY = 0; + Main.tile[num4, num5].slope(0); + Main.tile[num4, num5].halfBrick(false); + if (Main.tile[num4, num5 + 1].type == 0) + { + if (Main.rand.NextBool(1000)) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 227; + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + if (Main.tile[num4, num5 + 1].type == 2) + { + if (Main.rand.NextBool(2)) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 3; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 73; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 109) + { + if (Main.rand.NextBool(2)) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 110; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 113; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 60) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 74; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + } + } + } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WifeinaBottle"); - recipe.AddIngredient(null, "WifeinaBottlewithBoobs"); - recipe.AddIngredient(null, "LureofEnthrallment"); - recipe.AddIngredient(null, "EyeoftheStorm"); - recipe.AddIngredient(null, "RoseStone"); - recipe.AddIngredient(null, "AeroStone"); - recipe.AddIngredient(null, "CryoStone"); - recipe.AddIngredient(null, "ChaosStone"); - recipe.AddIngredient(null, "BloomStone"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WifeinaBottle"); + recipe.AddIngredient(null, "WifeinaBottlewithBoobs"); + recipe.AddIngredient(null, "LureofEnthrallment"); + recipe.AddIngredient(null, "EyeoftheStorm"); + recipe.AddIngredient(null, "RoseStone"); + recipe.AddIngredient(null, "AeroStone"); + recipe.AddIngredient(null, "CryoStone"); + recipe.AddIngredient(null, "ChaosStone"); + recipe.AddIngredient(null, "BloomStone"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index 633f5ae0df..ee36f6da28 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index e8c895ba4f..cc67006140 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -1,30 +1,30 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class InkBomb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Bomb"); - Tooltip.SetDefault("Throws several ink bombs when hit that explode in a confusing cloud of ink\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Bomb"); + Tooltip.SetDefault("Throws several ink bombs when hit that explode in a confusing cloud of ink\n" + "Gain a lot of stealth when struck\n" + "This effect has a 20s cooldown before it can occur again"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 3, 0, 0); item.rare = 3; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { + public override void UpdateAccessory(Player player, bool hideVisual) + { CalamityPlayer modPlayer = player.Calamity(); modPlayer.inkBomb = true; } diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index 41d682ca71..6d2ba27f6e 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index 42828a1901..05c0e60ad8 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -5,30 +5,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class LifeJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Life Jelly"); - Tooltip.SetDefault("+20 max life\n" + - "Standing still boosts life regen"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Life Jelly"); + Tooltip.SetDefault("+20 max life\n" + + "Standing still boosts life regen"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 6, 0, 0); item.rare = 1; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.statLifeMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 2; - } - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.statLifeMax2 += 20; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.lifeRegen += 2; + } + } + } } diff --git a/Items/Accessories/MagicLevelMeter.cs b/Items/Accessories/MagicLevelMeter.cs index 937f186978..51d1f64228 100644 --- a/Items/Accessories/MagicLevelMeter.cs +++ b/Items/Accessories/MagicLevelMeter.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; +using CalamityMod.CalPlayer; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/ManaJelly.cs index 636f2d2df7..4beb850e8c 100644 --- a/Items/Accessories/ManaJelly.cs +++ b/Items/Accessories/ManaJelly.cs @@ -5,30 +5,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class ManaJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mana Jelly"); - Tooltip.SetDefault("+20 max mana\n" + - "Standing still boosts mana regen"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mana Jelly"); + Tooltip.SetDefault("+20 max mana\n" + + "Standing still boosts mana regen"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 6, 0, 0); item.rare = 1; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.manaRegenBonus += 2; - } - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.statManaMax2 += 20; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.manaRegenBonus += 2; + } + } + } } diff --git a/Items/Accessories/MeleeLevelMeter.cs b/Items/Accessories/MeleeLevelMeter.cs index aa3dc8c7ba..c898e93344 100644 --- a/Items/Accessories/MeleeLevelMeter.cs +++ b/Items/Accessories/MeleeLevelMeter.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; +using CalamityMod.CalPlayer; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs index 8a66fea7cb..b3b38bf07b 100644 --- a/Items/Accessories/MirageMirror.cs +++ b/Items/Accessories/MirageMirror.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class MirageMirror : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mirage Mirror"); - Tooltip.SetDefault("Bend light around you\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mirage Mirror"); + Tooltip.SetDefault("Bend light around you\n" + "Reduces enemy aggression outside of the abyss\n" + "10% increased stealth regeneration while moving"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { + public override void UpdateAccessory(Player player, bool hideVisual) + { CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthGenMoving += 0.1f; player.aggro -= 200; - } + } public override void AddRecipes() { diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 522224c5b2..1e7091f1d5 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -1,30 +1,30 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class MoonstoneCrown : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moonstone Crown"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moonstone Crown"); Tooltip.SetDefault("15% increased rogue projectile velocity\n" + "Stealth strikes summon lunar flares on enemy hits\n" + "Rogue projectiles very occasionally summon moon sigils behind them"); } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 18, 0, 0); item.Calamity().postMoonLordRarity = 12; item.accessory = true; - } + } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.throwingVelocity += 0.15f; diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 8ef1017227..696a3add75 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -14,9 +13,9 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Rogue projectiles create nanoblades as they travel\n" + "Rogue weapons have a chance to instantly kill normal enemies\n" + "10% increased rogue damage, 5% increased rogue crit chance, and 15% increased rogue velocity\n" + - "Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + - "This effect can stack up to 250 times\n" + - "Max rogue damage boost is 25%"); + "Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + + "This effect can stack up to 250 times\n" + + "Max rogue damage boost is 25%"); } public override void SetDefaults() @@ -25,15 +24,15 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 20; - } + item.Calamity().postMoonLordRarity = 20; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.nanotech = true; - modPlayer.raiderTalisman = true; - player.Calamity().throwingDamage += 0.1f; + modPlayer.raiderTalisman = true; + player.Calamity().throwingDamage += 0.1f; player.Calamity().throwingCrit += 5; player.Calamity().throwingVelocity += 0.15f; } @@ -41,9 +40,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RogueEmblem"); - recipe.AddIngredient(null, "RaidersTalisman"); - recipe.AddIngredient(ItemID.MartianConduitPlating, 250); + recipe.AddIngredient(null, "RogueEmblem"); + recipe.AddIngredient(null, "RaidersTalisman"); + recipe.AddIngredient(ItemID.MartianConduitPlating, 250); recipe.AddIngredient(ItemID.Nanites, 500); recipe.AddIngredient(null, "Phantoplasm", 20); recipe.AddIngredient(null, "NightmareFuel", 20); diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 7fe2d6eac8..338911ac03 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -25,9 +25,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.vexation = true; - } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.vexation = true; + } public override void AddRecipes() { diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index fb96d9336c..f34ee3c642 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -1,8 +1,6 @@ -using System; +using CalamityMod.CalPlayer; using Terraria; -using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 300ea838f6..dc74f490b0 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "VerstaltiteBar", 5); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Accessories recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index f227581132..0f7e976c15 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Accessories item.height = 38; item.value = Item.buyPrice(0, 60, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void AddRecipes() diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index 9c0288c4e6..7aa25d41e2 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.cs @@ -1,37 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class PsychoticAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Psychotic Amulet"); - Tooltip.SetDefault("Boosts rogue and ranged damage and critical strike chance by 5%\n" + - "Grants a massive boost to these stats if you aren't moving"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Psychotic Amulet"); + Tooltip.SetDefault("Boosts rogue and ranged damage and critical strike chance by 5%\n" + + "Grants a massive boost to these stats if you aren't moving"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 6; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 6; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.pAmulet = true; - player.shroomiteStealth = true; - modPlayer.throwingDamage += 0.05f; - modPlayer.throwingCrit += 5; - player.rangedDamage += 0.05f; - player.rangedCrit += 5; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.pAmulet = true; + player.shroomiteStealth = true; + modPlayer.throwingDamage += 0.05f; + modPlayer.throwingCrit += 5; + player.rangedDamage += 0.05f; + player.rangedCrit += 5; + } + } } diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 2f2f08e61f..2a40c74956 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index beb43c7b38..a7eeab2466 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + "Increases armor penetration by 20 and immune time after being struck\n" + "Provides light underwater and provides a small amount of light in the abyss\n" + - "Causes stars to fall when damaged\n" + + "Causes stars to fall when damaged\n" + "Absorbs 25% of damage done to players on your team\n" + "Only active above 25% life\n" + "Grants immunity to knockback and reduces the cooldown of healing potions\n" + @@ -27,15 +27,15 @@ namespace CalamityMod.Items.Accessories item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 12; item.accessory = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.dAmulet = true; - modPlayer.rampartOfDeities = true; - modPlayer.jellyfishNecklace = true; + modPlayer.rampartOfDeities = true; + modPlayer.jellyfishNecklace = true; } public override void AddRecipes() diff --git a/Items/Accessories/RangedLevelMeter.cs b/Items/Accessories/RangedLevelMeter.cs index 1ad46d86c2..87440ad6f1 100644 --- a/Items/Accessories/RangedLevelMeter.cs +++ b/Items/Accessories/RangedLevelMeter.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; +using CalamityMod.CalPlayer; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/RareVariants/DeepDiver.cs b/Items/Accessories/RareVariants/DeepDiver.cs index 0574dc1816..858b964cc2 100644 --- a/Items/Accessories/RareVariants/DeepDiver.cs +++ b/Items/Accessories/RareVariants/DeepDiver.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.RareVariants { DisplayName.SetDefault("Deep Diver"); Tooltip.SetDefault("15% increased damage, defense, and movement speed when underwater\n" + - "While underwater you gain the ability to dash great distances"); + "While underwater you gain the ability to dash great distances"); } public override void SetDefaults() @@ -21,17 +21,17 @@ namespace CalamityMod.Items.Accessories.RareVariants item.rare = 2; item.defense = 2; item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } public override void UpdateAccessory(Player player, bool hideVisual) { if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.deepDiver = true; - modPlayer.dashMod = 5; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.deepDiver = true; + modPlayer.dashMod = 5; } } - } + } } diff --git a/Items/Accessories/RareVariants/FabledTortoiseShell.cs b/Items/Accessories/RareVariants/FabledTortoiseShell.cs index 1a14b9068d..71eff71ab7 100644 --- a/Items/Accessories/RareVariants/FabledTortoiseShell.cs +++ b/Items/Accessories/RareVariants/FabledTortoiseShell.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { public class FabledTortoiseShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fabled Tortoise Shell"); - Tooltip.SetDefault("50% reduced movement speed\n" + - "Enemies take damage when they hit you\n" + - "You move quickly for a short time if you take damage"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fabled Tortoise Shell"); + Tooltip.SetDefault("50% reduced movement speed\n" + + "Enemies take damage when they hit you\n" + + "You move quickly for a short time if you take damage"); + } - public override void SetDefaults() - { - item.defense = 35; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 35; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 9, 0, 0); item.rare = 5; - item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + item.accessory = true; + item.Calamity().postMoonLordRarity = 22; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fabledTortoise = true; - player.moveSpeed -= 0.5f; - player.thorns = 0.25f; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.fabledTortoise = true; + player.moveSpeed -= 0.5f; + player.thorns = 0.25f; + } + } } diff --git a/Items/Accessories/RareVariants/HideofAstrumDeus.cs b/Items/Accessories/RareVariants/HideofAstrumDeus.cs index d5dfa85d2c..ad05e799d3 100644 --- a/Items/Accessories/RareVariants/HideofAstrumDeus.cs +++ b/Items/Accessories/RareVariants/HideofAstrumDeus.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Accessories.RareVariants { DisplayName.SetDefault("Hide of Astrum Deus"); Tooltip.SetDefault("Taking damage drops an immense amount of astral stars from the sky and boosts true melee damage by 200% for a time\n" + - "Boost duration is based on the amount of damage you took, the higher the damage the longer the boost\n" + - "Provides immunity to the astral infection, cursed inferno, on fire, and frostburn debuffs\n" + - "Enemies take damage when they hit you and are inflicted with the astral infection debuff"); + "Boost duration is based on the amount of damage you took, the higher the damage the longer the boost\n" + + "Provides immunity to the astral infection, cursed inferno, on fire, and frostburn debuffs\n" + + "Enemies take damage when they hit you and are inflicted with the astral infection debuff"); } public override void SetDefaults() @@ -22,19 +22,19 @@ namespace CalamityMod.Items.Accessories.RareVariants item.height = 26; item.value = Item.buyPrice(0, 30, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aBulwark = true; - player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; - modPlayer.aBulwarkRare = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.thorns += 0.75f; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.aBulwark = true; + player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; + modPlayer.aBulwarkRare = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Frostburn] = true; + player.thorns += 0.75f; + } + } } diff --git a/Items/Accessories/RareVariants/Regenator.cs b/Items/Accessories/RareVariants/Regenator.cs index da74034304..76f1356d2f 100644 --- a/Items/Accessories/RareVariants/Regenator.cs +++ b/Items/Accessories/RareVariants/Regenator.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories.RareVariants public override void SetStaticDefaults() { DisplayName.SetDefault("Regenator"); - Tooltip.SetDefault("Reduces max HP by 50% but greatly improves life regeneration"); - } + Tooltip.SetDefault("Reduces max HP by 50% but greatly improves life regeneration"); + } public override void SetDefaults() { @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Accessories.RareVariants item.rare = 5; item.defense = 6; item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.regenator = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.regenator = true; + } + } } diff --git a/Items/Accessories/RareVariants/SamuraiBadge.cs b/Items/Accessories/RareVariants/SamuraiBadge.cs index c0124666a3..2d3caa6a5a 100644 --- a/Items/Accessories/RareVariants/SamuraiBadge.cs +++ b/Items/Accessories/RareVariants/SamuraiBadge.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.RareVariants { DisplayName.SetDefault("Samurai Badge"); Tooltip.SetDefault("20% increased melee damage and speed\n" + - "Reduces max life by 25%"); + "Reduces max life by 25%"); } public override void SetDefaults() @@ -19,13 +19,13 @@ namespace CalamityMod.Items.Accessories.RareVariants item.height = 30; item.value = Item.buyPrice(0, 21, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.badgeOfBraveryRare = true; + modPlayer.badgeOfBraveryRare = true; } - } + } } diff --git a/Items/Accessories/RareVariants/TheBee.cs b/Items/Accessories/RareVariants/TheBee.cs index 8f391ae44e..18842cfdab 100644 --- a/Items/Accessories/RareVariants/TheBee.cs +++ b/Items/Accessories/RareVariants/TheBee.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { public class TheBee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Bee"); - Tooltip.SetDefault("Causes stars to fall and releases bees when injured\n" + - "All projectiles gain bonus damage if you are at full HP\n" + - "The amount of bonus damage is based on your weapon's damage and fire rate\n" + - "Does not work with summons or sentries"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Bee"); + Tooltip.SetDefault("Causes stars to fall and releases bees when injured\n" + + "All projectiles gain bonus damage if you are at full HP\n" + + "The amount of bonus damage is based on your weapon's damage and fire rate\n" + + "Does not work with summons or sentries"); + } - public override void SetDefaults() - { - item.width = 24; - item.height = 28; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 4; - item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.width = 24; + item.height = 28; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 4; + item.accessory = true; + item.Calamity().postMoonLordRarity = 22; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.starCloak = true; - player.bee = true; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.theBee = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.starCloak = true; + player.bee = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.theBee = true; + } + } } diff --git a/Items/Accessories/RareVariants/TheEvolution.cs b/Items/Accessories/RareVariants/TheEvolution.cs index a48119373f..26c2342903 100644 --- a/Items/Accessories/RareVariants/TheEvolution.cs +++ b/Items/Accessories/RareVariants/TheEvolution.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Accessories.RareVariants { DisplayName.SetDefault("The Evolution"); Tooltip.SetDefault("You have a 50% chance to reflect projectiles when they hit you back at the enemy for 1000% their original damage\n" + - "If this effect triggers you get a health regeneration boost for a short time\n" + - "If the same enemy projectile type hits you again you will resist its damage by 15%"); + "If this effect triggers you get a health regeneration boost for a short time\n" + + "If the same enemy projectile type hits you again you will resist its damage by 15%"); } public override void SetDefaults() @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Accessories.RareVariants item.height = 26; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.projRefRare = true; + modPlayer.projRefRare = true; } - } + } } diff --git a/Items/Accessories/RareVariants/TheTransformer.cs b/Items/Accessories/RareVariants/TheTransformer.cs index d942f08258..2a97c638d8 100644 --- a/Items/Accessories/RareVariants/TheTransformer.cs +++ b/Items/Accessories/RareVariants/TheTransformer.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.RareVariants { public class TheTransformer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Transformer"); - Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + - "Sparks do extra damage in Hardmode\n" + - "Immunity to Electrified and you resist all elctrical projectile and enemy damage\n" + - "Enemy bullets do half damage to you and are reflected back at the enemy for 800% their original damage"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Transformer"); + Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + + "Sparks do extra damage in Hardmode\n" + + "Immunity to Electrified and you resist all elctrical projectile and enemy damage\n" + + "Enemy bullets do half damage to you and are reflected back at the enemy for 800% their original damage"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 1; - item.accessory = true; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + item.Calamity().postMoonLordRarity = 22; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aSparkRare = true; - modPlayer.aSpark = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.aSparkRare = true; + modPlayer.aSpark = true; + } + } } diff --git a/Items/Accessories/RogueLevelMeter.cs b/Items/Accessories/RogueLevelMeter.cs index 66c276a657..3997c2a52c 100644 --- a/Items/Accessories/RogueLevelMeter.cs +++ b/Items/Accessories/RogueLevelMeter.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; +using CalamityMod.CalPlayer; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index 92bc615c08..9b6bdb746e 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -1,29 +1,29 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class RuinMedallion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ruin Medallion"); - Tooltip.SetDefault("Stealth strikes only expend 50% of your max stealth\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruin Medallion"); + Tooltip.SetDefault("Stealth strikes only expend 50% of your max stealth\n" + "6% increased rogue damage, and 6% increased rogue crit chance"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 13, 0, 0); item.rare = 6; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthStrikeHalfCost = true; diff --git a/Items/Accessories/SeaShell.cs b/Items/Accessories/SeaShell.cs index 60f8235da4..c47b496b3f 100644 --- a/Items/Accessories/SeaShell.cs +++ b/Items/Accessories/SeaShell.cs @@ -4,33 +4,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class SeaShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Shell"); - Tooltip.SetDefault("Increased defense and damage reduction when submerged in liquid\n" + - "Increased movement speed when submerged in liquid"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Shell"); + Tooltip.SetDefault("Increased defense and damage reduction when submerged in liquid\n" + + "Increased movement speed when submerged in liquid"); + } - public override void SetDefaults() - { - item.defense = 2; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 2; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 3, 0, 0); item.rare = 1; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 3; - player.endurance += 0.05f; - player.moveSpeed += 0.15f; - player.ignoreWater = true; - } - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 3; + player.endurance += 0.05f; + player.moveSpeed += 0.15f; + player.ignoreWater = true; + } + } + } } diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 5eb0a6800f..5aeb014610 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.statDefense += 5; + player.statDefense += 5; } } @@ -39,5 +39,5 @@ namespace CalamityMod.Items.Accessories recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 2a34a5ca09..0ee9e77e12 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -6,61 +6,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class SigilofCalamitas : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sigil of Calamitas"); - Tooltip.SetDefault("10% increased magic damage and 10% decreased mana usage\n" + - "Increases pickup range for mana stars and you restore mana when damaged\n" + - "+100 max mana and reveals treasure locations"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sigil of Calamitas"); + Tooltip.SetDefault("10% increased magic damage and 10% decreased mana usage\n" + + "Increases pickup range for mana stars and you restore mana when damaged\n" + + "+100 max mana and reveals treasure locations"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 9; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.magicCuffs = true; - player.manaMagnet = true; - player.findTreasure = true; - player.statManaMax2 += 100; - player.magicDamage += 0.1f; - player.manaCost *= 0.9f; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.magicCuffs = true; + player.manaMagnet = true; + player.findTreasure = true; + player.statManaMax2 += 100; + player.magicDamage += 0.1f; + player.manaCost *= 0.9f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SorcererEmblem); - recipe.AddIngredient(ItemID.CelestialCuffs); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(null, "CruptixBar", 2); - recipe.AddIngredient(null, "ChaosAmulet"); - recipe.AddIngredient(ItemID.UnholyWater, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SorcererEmblem); - recipe.AddIngredient(ItemID.CelestialCuffs); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(null, "CruptixBar", 2); - recipe.AddIngredient(null, "ChaosAmulet"); - recipe.AddIngredient(ItemID.BloodWater, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SorcererEmblem); + recipe.AddIngredient(ItemID.CelestialCuffs); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(null, "CruptixBar", 2); + recipe.AddIngredient(null, "ChaosAmulet"); + recipe.AddIngredient(ItemID.UnholyWater, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SorcererEmblem); + recipe.AddIngredient(ItemID.CelestialCuffs); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(null, "CruptixBar", 2); + recipe.AddIngredient(null, "ChaosAmulet"); + recipe.AddIngredient(ItemID.BloodWater, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs index e41e4848d6..29e136640a 100644 --- a/Items/Accessories/SilencingSheath.cs +++ b/Items/Accessories/SilencingSheath.cs @@ -1,34 +1,34 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class SilencingSheath : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silencing Sheath"); - Tooltip.SetDefault("+50 maximum stealth\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silencing Sheath"); + Tooltip.SetDefault("+50 maximum stealth\n" + "10% increased stealth regeneration while standing still"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { + public override void UpdateAccessory(Player player, bool hideVisual) + { CalamityPlayer modPlayer = player.Calamity(); modPlayer.rogueStealthMax += 0.5f; modPlayer.stealthGenStandstill += 0.1f; - } + } public override void AddRecipes() { diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs index 40413953b6..2a55d0cd7a 100644 --- a/Items/Accessories/SpiritGenerator.cs +++ b/Items/Accessories/SpiritGenerator.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index 80ca2f8382..76c6cc2ba4 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Accessories item.height = 20; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index dc5ba0419a..95800bf8aa 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -1,7 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -27,8 +26,8 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 7e8c12adf0..ecfda99d24 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index c6c4a6830c..cdfb5bd1ea 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 4aab837151..7b04b23dda 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index 2e98034e33..4a45ceb705 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/SummonLevelMeter.cs b/Items/Accessories/SummonLevelMeter.cs index 3294e8510d..a72c6d532f 100644 --- a/Items/Accessories/SummonLevelMeter.cs +++ b/Items/Accessories/SummonLevelMeter.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; +using CalamityMod.CalPlayer; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 46efc1bbef..a6adfae234 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -1,76 +1,76 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class TheAbsorber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Absorber"); - Tooltip.SetDefault("12% increased movement speed\n" + - "120% increased jump speed\n" + - "+20 max life and mana\n" + - "Standing still boosts life and mana regen\n" + - "Increased defense and damage reduction when submerged in liquid\n" + - "Increased movement speed when submerged in liquid\n" + - "Enemies take damage when they hit you\n" + - "Taking a hit will make you move very fast for a short time\n" + - "You emit a mushroom spore and spark explosion when you are hit\n" + - "5% increased damage reduction\n" + - "Enemy attacks will have part of their damage absorbed and used to heal you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Absorber"); + Tooltip.SetDefault("12% increased movement speed\n" + + "120% increased jump speed\n" + + "+20 max life and mana\n" + + "Standing still boosts life and mana regen\n" + + "Increased defense and damage reduction when submerged in liquid\n" + + "Increased movement speed when submerged in liquid\n" + + "Enemies take damage when they hit you\n" + + "Taking a hit will make you move very fast for a short time\n" + + "You emit a mushroom spore and spark explosion when you are hit\n" + + "5% increased damage reduction\n" + + "Enemy attacks will have part of their damage absorbed and used to heal you"); + } - public override void SetDefaults() - { - item.defense = 6; - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.defense = 6; + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 10; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aSpark = true; - modPlayer.gShell = true; - modPlayer.fCarapace = true; - modPlayer.absorber = true; - player.statManaMax2 += 20; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.aSpark = true; + modPlayer.gShell = true; + modPlayer.fCarapace = true; + modPlayer.absorber = true; + player.statManaMax2 += 20; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GrandGelatin"); - recipe.AddIngredient(null, "SeaShell"); - recipe.AddIngredient(null, "CrawCarapace"); - recipe.AddIngredient(null, "FungalCarapace"); - recipe.AddIngredient(null, "GiantTortoiseShell"); - recipe.AddIngredient(null, "AmidiasSpark"); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GrandGelatin"); + recipe.AddIngredient(null, "SeaShell"); + recipe.AddIngredient(null, "CrawCarapace"); + recipe.AddIngredient(null, "FungalCarapace"); + recipe.AddIngredient(null, "GiantTortoiseShell"); + recipe.AddIngredient(null, "AmidiasSpark"); recipe.AddIngredient(null, "DepthCells", 15); recipe.AddIngredient(null, "Lumenite", 15); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GrandGelatin"); - recipe.AddIngredient(null, "SeaShell"); - recipe.AddIngredient(null, "FungalCarapace"); - recipe.AddIngredient(null, "GiantShell"); - recipe.AddIngredient(null, "GiantTortoiseShell"); - recipe.AddIngredient(null, "AmidiasSpark"); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GrandGelatin"); + recipe.AddIngredient(null, "SeaShell"); + recipe.AddIngredient(null, "FungalCarapace"); + recipe.AddIngredient(null, "GiantShell"); + recipe.AddIngredient(null, "GiantTortoiseShell"); + recipe.AddIngredient(null, "AmidiasSpark"); recipe.AddIngredient(null, "DepthCells", 15); recipe.AddIngredient(null, "Lumenite", 15); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index e1e7c0ccf1..6fa767170e 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories "You will confuse nearby enemies when you are struck\n" + "Drops brimstone fireballs from the sky occasionally\n" + "Brimstone fire rains down while invincibility is active\n" + - "Temporary immunity to lava, greatly reduces lava burn damage, and 15% increased damage while in lava\n" + + "Temporary immunity to lava, greatly reduces lava burn damage, and 15% increased damage while in lava\n" + "Summons a fungal clump to fight for you\n" + "You leave behind poisonous seawater as you move\n" + "75% increased movement speed, 10% increase to all damage, and plus 40 defense while submerged in liquid\n" + @@ -36,8 +36,8 @@ namespace CalamityMod.Items.Accessories item.height = 34; item.value = Item.buyPrice(0, 90, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) @@ -66,18 +66,18 @@ namespace CalamityMod.Items.Accessories Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("FungalClump"), (int)(1000f * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); } } - player.allDamage += 0.15f; - player.ignoreWater = true; - player.lavaRose = true; - player.lavaMax += 240; - if (player.lavaWet) + player.allDamage += 0.15f; + player.ignoreWater = true; + player.lavaRose = true; + player.lavaMax += 240; + if (player.lavaWet) { - player.allDamage += 0.15f; - } + player.allDamage += 0.15f; + } if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.allDamage += 0.1f; - player.statDefense += 40; + player.allDamage += 0.1f; + player.statDefense += 40; player.moveSpeed += 0.75f; } if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index ebe8bc9627..01c5289459 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -1,25 +1,25 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class TheCommunity : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Community"); - Tooltip.SetDefault("The heart of (most of) the Terraria community\n" + - "Legendary Accessory\n" + - "Starts off with weak buffs to all of your stats\n" + - "The stat buffs become more powerful as you progress\n" + - "Reduces the DoT effects of harmful debuffs inflicted on you\n" + - "Boosts your maximum flight time by 15%\n" + - "Thank you to all of my supporters that made this mod a reality\n" + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Community"); + Tooltip.SetDefault("The heart of (most of) the Terraria community\n" + + "Legendary Accessory\n" + + "Starts off with weak buffs to all of your stats\n" + + "The stat buffs become more powerful as you progress\n" + + "Reduces the DoT effects of harmful debuffs inflicted on you\n" + + "Boosts your maximum flight time by 15%\n" + + "Thank you to all of my supporters that made this mod a reality\n" + "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 15)); - } + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 15)); + } public override void SetDefaults() { @@ -27,13 +27,13 @@ namespace CalamityMod.Items.Accessories item.height = 20; item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 20; - } + item.Calamity().postMoonLordRarity = 20; + } public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.community = true; - } + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.community = true; + } } } diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index 8a650aaf4f..982bd94cdd 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -11,10 +11,10 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The First Shadowflame"); Tooltip.SetDefault("It is said that in the past, Prometheus descended from the heavens to grant man fire.\n" + - "If that were true, then it is surely the demons of hell that would have risen from below to do the same.\n" + - "Minions inflict shadowflame on enemy hits."); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } + "If that were true, then it is surely the demons of hell that would have risen from below to do the same.\n" + + "Minions inflict shadowflame on enemy hits."); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } public override void SetDefaults() { diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index 72590f493b..90ccf34ca8 100644 --- a/Items/Accessories/VitalJelly.cs +++ b/Items/Accessories/VitalJelly.cs @@ -4,27 +4,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class VitalJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vital Jelly"); - Tooltip.SetDefault("10% increased movement speed\n" + - "200% increased jump speed"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vital Jelly"); + Tooltip.SetDefault("10% increased movement speed\n" + + "200% increased jump speed"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 24; + public override void SetDefaults() + { + item.width = 20; + item.height = 24; item.value = Item.buyPrice(0, 12, 0, 0); item.rare = 5; - item.accessory = true; - } + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += (player.autoJump ? 0.5f : 2.0f); - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += (player.autoJump ? 0.5f : 2.0f); + } + } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index bd0b4561b9..fc61121457 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -1,9 +1,9 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories "Drops brimstone fireballs from the sky occasionally\n" + "15% increase to all damage\n" + "Brimstone fire rains down while invincibility is active\n" + - "Temporary immunity to lava, greatly reduces lava burn damage, and 25% increased damage while in lava"); + "Temporary immunity to lava, greatly reduces lava burn damage, and 25% increased damage while in lava"); } public override void SetDefaults() @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = Item.buyPrice(0, 30, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) @@ -58,13 +58,13 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; - player.lavaRose = true; - player.lavaMax += 240; - player.allDamage += 0.15f; - if (player.lavaWet) + player.lavaRose = true; + player.lavaMax += 240; + player.allDamage += 0.15f; + if (player.lavaWet) { - player.allDamage += 0.25f; - } + player.allDamage += 0.25f; + } if (player.immune) { if (Main.rand.NextBool(10)) diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index 257d361b6e..ffe0aed4c9 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -1,25 +1,25 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class WifeinaBottle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental in a Bottle"); - Tooltip.SetDefault("Summons a sand elemental to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental in a Bottle"); + Tooltip.SetDefault("Summons a sand elemental to fight for you"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 26; + public override void SetDefaults() + { + item.width = 20; + item.height = 26; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; - item.accessory = true; - } + item.accessory = true; + } public override bool CanEquipAccessory(Player player, int slot) { @@ -32,20 +32,20 @@ namespace CalamityMod.Items.Accessories } public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sandWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("SandyWaifu")) == -1) - { - player.AddBuff(mod.BuffType("SandyWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - } + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.sandWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("SandyWaifu")) == -1) + { + player.AddBuff(mod.BuffType("SandyWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 0ccb55f109..9c933303c2 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -1,27 +1,27 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { public class WifeinaBottlewithBoobs : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rare Elemental in a Bottle"); - Tooltip.SetDefault("Summons a sand elemental to heal you\n" + - ";D"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rare Elemental in a Bottle"); + Tooltip.SetDefault("Summons a sand elemental to heal you\n" + + ";D"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 26; + public override void SetDefaults() + { + item.width = 20; + item.height = 26; item.value = Item.buyPrice(0, 15, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; - } + item.rare = 9; + item.accessory = true; + } public override bool CanEquipAccessory(Player player, int slot) { @@ -34,20 +34,20 @@ namespace CalamityMod.Items.Accessories } public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sandBoobWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("DrewsSandyWaifu")) == -1) - { - player.AddBuff(mod.BuffType("DrewsSandyWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DrewsSandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - } + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.sandBoobWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("DrewsSandyWaifu")) == -1) + { + player.AddBuff(mod.BuffType("DrewsSandyWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DrewsSandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index de2db629d0..8727b9482d 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -1,126 +1,126 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class AureateWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aureate Booster"); - Tooltip.SetDefault("Mach speed with style!\n" + - "Horizontal speed: 8\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 80\n" + - "15% increased movement speed while wearing the Reaver Armor"); - } + public class AureateWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aureate Booster"); + Tooltip.SetDefault("Mach speed with style!\n" + + "Horizontal speed: 8\n" + + "Acceleration multiplier: 1.5\n" + + "Good vertical speed\n" + + "Flight time: 80\n" + + "15% increased movement speed while wearing the Reaver Armor"); + } - public override void SetDefaults() - { - item.width = 54; - item.height = 26; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 6; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 54; + item.height = 26; + item.value = Item.buyPrice(0, 39, 99, 99); + item.rare = 6; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - player.rocketDelay2--; - if (player.rocketDelay2 <= 0) - { - Main.PlaySound(SoundID.Item13, player.position); - player.rocketDelay2 = 60; - } - int num66 = 2; - if (player.controlUp) - { - num66 = 4; - } - for (int num67 = 0; num67 < num66; num67++) - { - int type = 6; - if (player.head == 41) - { - int arg_58FD_0 = player.body; - } - float scale = 1.75f; - int alpha = 100; - float x = player.position.X + (float)(player.width / 2) + 16f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 26f; - } - float num68 = player.position.Y + (float)player.height - 18f; - if (num67 == 1 || num67 == 3) - { - x = player.position.X + (float)(player.width / 2) + 8f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 20f; - } - num68 += 6f; - } - if (num67 > 1) - { - num68 += player.velocity.Y; - } - int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale); - Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; - expr_5A11_cp_0_cp_0.velocity.X *= 0.1f; - Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; - Main.dust[num69].noGravity = true; - Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - if (num66 == 4) - { - Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; - expr_5AA6_cp_0_cp_0.velocity.Y += 6f; - } - } - } - player.wingTimeMax = 80; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + player.rocketDelay2--; + if (player.rocketDelay2 <= 0) + { + Main.PlaySound(SoundID.Item13, player.position); + player.rocketDelay2 = 60; + } + int num66 = 2; + if (player.controlUp) + { + num66 = 4; + } + for (int num67 = 0; num67 < num66; num67++) + { + int type = 6; + if (player.head == 41) + { + int arg_58FD_0 = player.body; + } + float scale = 1.75f; + int alpha = 100; + float x = player.position.X + (float)(player.width / 2) + 16f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 26f; + } + float num68 = player.position.Y + (float)player.height - 18f; + if (num67 == 1 || num67 == 3) + { + x = player.position.X + (float)(player.width / 2) + 8f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 20f; + } + num68 += 6f; + } + if (num67 > 1) + { + num68 += player.velocity.Y; + } + int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale); + Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; + expr_5A11_cp_0_cp_0.velocity.X *= 0.1f; + Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; + Main.dust[num69].noGravity = true; + Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + if (num66 == 4) + { + Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; + expr_5AA6_cp_0_cp_0.velocity.Y += 6f; + } + } + } + player.wingTimeMax = 80; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - CalamityPlayer modPlayer = player.Calamity(); + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.reaverDoubleTap || modPlayer.reaverBurst || modPlayer.reaverOrb || modPlayer.reaverBlast || modPlayer.reaverSpore) - { - player.moveSpeed += 0.15f; - } + if (modPlayer.reaverDoubleTap || modPlayer.reaverBurst || modPlayer.reaverOrb || modPlayer.reaverBlast || modPlayer.reaverSpore) + { + player.moveSpeed += 0.15f; + } - ascentWhenFalling = 0.75f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 2.5f; - constantAscend = 0.125f; - } + ascentWhenFalling = 0.75f; + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1f; + maxAscentMultiplier = 2.5f; + constantAscend = 0.125f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 8f; - acceleration *= 1.5f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 8f; + acceleration *= 1.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 5); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 5); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index f467d31e74..5ee66975fb 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -1,96 +1,96 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class CelestialTracers : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestial Tracers"); - Tooltip.SetDefault("Counts as wings\n" + - "Horizontal speed: 12\n" + - "Acceleration multiplier: 3\n" + - "Excellent vertical speed\n" + - "Flight time: 280\n" + - "Taking speed EVEN FURTHER BEYOND!\n" + - "Greater mobility on ice\n" + - "Water and lava walking\n" + - "Temporary immunity to lava\n" + - "Being hit for over 200 damage will make you immune for an extended period of time"); - } + public class CelestialTracers : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestial Tracers"); + Tooltip.SetDefault("Counts as wings\n" + + "Horizontal speed: 12\n" + + "Acceleration multiplier: 3\n" + + "Excellent vertical speed\n" + + "Flight time: 280\n" + + "Taking speed EVEN FURTHER BEYOND!\n" + + "Greater mobility on ice\n" + + "Water and lava walking\n" + + "Temporary immunity to lava\n" + + "Being hit for over 200 damage will make you immune for an extended period of time"); + } - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = Item.buyPrice(1, 20, 0, 0); - item.accessory = true; - item.Calamity().postMoonLordRarity = 15; - } + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = Item.buyPrice(1, 20, 0, 0); + item.accessory = true; + item.Calamity().postMoonLordRarity = 15; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - CalamityPlayer modPlayer = player.Calamity(); - player.accRunSpeed = 12f; - player.rocketBoots = 3; - player.moveSpeed += 0.5f; - player.iceSkate = true; - player.waterWalk = true; - player.fireWalk = true; - player.lavaMax += 240; - player.wingTimeMax = 280; - player.noFallDmg = true; - modPlayer.IBoots = !hideVisual; - modPlayer.elysianFire = !hideVisual; - modPlayer.cTracers = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + CalamityPlayer modPlayer = player.Calamity(); + player.accRunSpeed = 12f; + player.rocketBoots = 3; + player.moveSpeed += 0.5f; + player.iceSkate = true; + player.waterWalk = true; + player.fireWalk = true; + player.lavaMax += 240; + player.wingTimeMax = 280; + player.noFallDmg = true; + modPlayer.IBoots = !hideVisual; + modPlayer.elysianFire = !hideVisual; + modPlayer.cTracers = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 1f; //0.85 - ascentWhenRising = 0.175f; //0.15 - maxCanAscendMultiplier = 1.2f; //1 - maxAscentMultiplier = 3.25f; //3 - constantAscend = 0.15f; //0.135 - } + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 1f; //0.85 + ascentWhenRising = 0.175f; //0.15 + maxCanAscendMultiplier = 1.2f; //1 + maxAscentMultiplier = 3.25f; //3 + constantAscend = 0.15f; //0.135 + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 12f; - acceleration *= 3f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 12f; + acceleration *= 3f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ElysianTracers"); - recipe.AddIngredient(null, "DrewsWings"); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ElysianTracers"); + recipe.AddIngredient(null, "DrewsWings"); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/DiscordianWings.cs b/Items/Accessories/Wings/DiscordianWings.cs index 9359168856..730da9aa60 100644 --- a/Items/Accessories/Wings/DiscordianWings.cs +++ b/Items/Accessories/Wings/DiscordianWings.cs @@ -1,88 +1,88 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class DiscordianWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Discordian Wings"); - Tooltip.SetDefault("Formed from the flames of pure chaos\n" + - "Horizontal speed: 7.75\n" + - "Acceleration multiplier: 1.5\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "10% increased damage while wearing the Ataxia Armor"); - } + public class DiscordianWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Discordian Wings"); + Tooltip.SetDefault("Formed from the flames of pure chaos\n" + + "Horizontal speed: 7.75\n" + + "Acceleration multiplier: 1.5\n" + + "Average vertical speed\n" + + "Flight time: 180\n" + + "10% increased damage while wearing the Ataxia Armor"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 8; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = Item.buyPrice(0, 39, 99, 99); + item.rare = 8; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 180; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 180; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - CalamityPlayer modPlayer = player.Calamity(); + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.ataxiaBlaze) - { - player.allDamage += 0.1f; - } + if (modPlayer.ataxiaBlaze) + { + player.allDamage += 0.1f; + } - ascentWhenFalling = 0.5f; - ascentWhenRising = 0.1f; - maxCanAscendMultiplier = 0.5f; - maxAscentMultiplier = 1.5f; - constantAscend = 0.1f; - } + ascentWhenFalling = 0.5f; + ascentWhenRising = 0.1f; + maxCanAscendMultiplier = 0.5f; + maxAscentMultiplier = 1.5f; + constantAscend = 0.1f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 7.75f; - acceleration *= 1.5f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 7.75f; + acceleration *= 1.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 5); - recipe.AddIngredient(null, "EssenceofChaos"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 5); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index 00c5b47d65..00627b4f86 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -6,62 +6,62 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class DrewsWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drew's Wings"); - Tooltip.SetDefault("Absolutely Fabulous\n" + - "Horizontal speed: 12\n" + - "Acceleration multiplier: 3\n" + - "Excellent vertical speed\n" + - "Flight time: 361"); - } + public class DrewsWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drew's Wings"); + Tooltip.SetDefault("Absolutely Fabulous\n" + + "Horizontal speed: 12\n" + + "Acceleration multiplier: 3\n" + + "Excellent vertical speed\n" + + "Flight time: 361"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = Item.buyPrice(1, 0, 0, 0); - item.Calamity().postMoonLordRarity = 14; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = Item.buyPrice(1, 0, 0, 0); + item.Calamity().postMoonLordRarity = 14; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 361; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 361; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 1f; //0.85 - ascentWhenRising = 0.175f; //0.15 - maxCanAscendMultiplier = 1.2f; //1 - maxAscentMultiplier = 3.25f; //3 - constantAscend = 0.15f; //0.135 - } + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 1f; //0.85 + ascentWhenRising = 0.175f; //0.15 + maxCanAscendMultiplier = 1.2f; //1 + maxAscentMultiplier = 3.25f; //3 + constantAscend = 0.15f; //0.135 + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 12f; - acceleration *= 3f; - } - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 12f; + acceleration *= 3f; + } + } } diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index de21876b65..27c5acba3c 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -1,96 +1,96 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class ElysianTracers : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elysian Tracers"); - Tooltip.SetDefault("Counts as wings\n" + - "Horizontal speed: 10.5\n" + - "Acceleration multiplier: 2.75\n" + - "Great vertical speed\n" + - "Flight time: 160\n" + - "Ludicrous speed!\n" + - "Greater mobility on ice\n" + - "Water and lava walking\n" + - "Temporary immunity to lava"); - } + public class ElysianTracers : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elysian Tracers"); + Tooltip.SetDefault("Counts as wings\n" + + "Horizontal speed: 10.5\n" + + "Acceleration multiplier: 2.75\n" + + "Great vertical speed\n" + + "Flight time: 160\n" + + "Ludicrous speed!\n" + + "Greater mobility on ice\n" + + "Water and lava walking\n" + + "Temporary immunity to lava"); + } - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.Calamity().postMoonLordRarity = 14; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (Main.rand.NextBool(2) ? 206 : 173), 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - CalamityPlayer modPlayer = player.Calamity(); - player.accRunSpeed = 10.5f; - player.rocketBoots = 3; - player.moveSpeed += 0.36f; - player.iceSkate = true; - player.waterWalk = true; - player.fireWalk = true; - player.lavaMax += 240; - player.wingTimeMax = 160; - player.noFallDmg = true; - modPlayer.IBoots = !hideVisual; - modPlayer.elysianFire = !hideVisual; - modPlayer.eTracers = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (Main.rand.NextBool(2) ? 206 : 173), 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + CalamityPlayer modPlayer = player.Calamity(); + player.accRunSpeed = 10.5f; + player.rocketBoots = 3; + player.moveSpeed += 0.36f; + player.iceSkate = true; + player.waterWalk = true; + player.fireWalk = true; + player.lavaMax += 240; + player.wingTimeMax = 160; + player.noFallDmg = true; + modPlayer.IBoots = !hideVisual; + modPlayer.elysianFire = !hideVisual; + modPlayer.eTracers = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.95f; //0.85 - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1.1f; //1 - maxAscentMultiplier = 3.15f; //3 - constantAscend = 0.135f; - } + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 0.95f; //0.85 + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1.1f; //1 + maxAscentMultiplier = 3.15f; //3 + constantAscend = 0.135f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 10.5f; - acceleration *= 2.75f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 10.5f; + acceleration *= 2.75f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "InfinityBoots"); - recipe.AddIngredient(null, "ElysianWings"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "InfinityBoots"); + recipe.AddIngredient(null, "ElysianWings"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index a1223b282a..116727ef70 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -1,102 +1,102 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class HadarianWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hadarian Wings"); - Tooltip.SetDefault("Powered by the Astral Infection\n" + - "Hold down to hover during flight, greatly extending flight duration\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 1.75\n" + - "Good vertical speed\n" + - "Flight time: 120\n" + - "20% increased movement speed and 40% increased jump speed while wearing the Astral Armor"); - } + public class HadarianWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hadarian Wings"); + Tooltip.SetDefault("Powered by the Astral Infection\n" + + "Hold down to hover during flight, greatly extending flight duration\n" + + "Horizontal speed: 9\n" + + "Acceleration multiplier: 1.75\n" + + "Good vertical speed\n" + + "Flight time: 120\n" + + "20% increased movement speed and 40% increased jump speed while wearing the Astral Armor"); + } - public override void SetDefaults() - { - item.width = 24; - item.height = 36; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 9; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 24; + item.height = 36; + item.value = Item.buyPrice(0, 39, 99, 99); + item.rare = 9; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0) - { - if (player.controlDown && !player.merman) - { - player.velocity.Y *= 0.9f; - if (player.velocity.Y > -2f && player.velocity.Y < 1f) - { - player.velocity.Y = 1E-05f; - } - player.wingTime += 0.75f; - } - if (player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.75f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - } - player.wingTimeMax = 120; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0) + { + if (player.controlDown && !player.merman) + { + player.velocity.Y *= 0.9f; + if (player.velocity.Y > -2f && player.velocity.Y < 1f) + { + player.velocity.Y = 1E-05f; + } + player.wingTime += 0.75f; + } + if (player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.75f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + } + player.wingTimeMax = 120; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - CalamityPlayer modPlayer = player.Calamity(); + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.astralStarRain) - { - player.moveSpeed += 0.2f; - player.jumpSpeedBoost += 0.4f; - } + if (modPlayer.astralStarRain) + { + player.moveSpeed += 0.2f; + player.jumpSpeedBoost += 0.4f; + } - ascentWhenFalling = 0.8f; - ascentWhenRising = 0.155f; - maxCanAscendMultiplier = 1.05f; - maxAscentMultiplier = 2.55f; - constantAscend = 0.13f; - } + ascentWhenFalling = 0.8f; + ascentWhenRising = 0.155f; + maxCanAscendMultiplier = 1.05f; + maxAscentMultiplier = 2.55f; + constantAscend = 0.13f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 9f; - acceleration *= 1.75f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 9f; + acceleration *= 1.75f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 8); - recipe.AddIngredient(null, "HadarianMembrane", 10); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 8); + recipe.AddIngredient(null, "HadarianMembrane", 10); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/InfinityBoots.cs b/Items/Accessories/Wings/InfinityBoots.cs index aecd29e19f..3870b14e54 100644 --- a/Items/Accessories/Wings/InfinityBoots.cs +++ b/Items/Accessories/Wings/InfinityBoots.cs @@ -1,96 +1,96 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings, EquipType.Shoes)] - public class InfinityBoots : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seraph Tracers"); - Tooltip.SetDefault("Counts as wings\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Good vertical speed\n" + - "Flight time: 120\n" + - "Ludicrous speed!\n" + - "Greater mobility on ice\n" + - "Water and lava walking\n" + - "Temporary immunity to lava"); - } + public class InfinityBoots : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seraph Tracers"); + Tooltip.SetDefault("Counts as wings\n" + + "Horizontal speed: 9\n" + + "Acceleration multiplier: 2.5\n" + + "Good vertical speed\n" + + "Flight time: 120\n" + + "Ludicrous speed!\n" + + "Greater mobility on ice\n" + + "Water and lava walking\n" + + "Temporary immunity to lava"); + } - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = Item.buyPrice(0, 60, 0, 0); - item.accessory = true; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.Calamity().postMoonLordRarity = 12; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 107, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - CalamityPlayer modPlayer = player.Calamity(); - player.accRunSpeed = 9.25f; - player.rocketBoots = 3; - player.moveSpeed += 0.24f; - player.iceSkate = true; - player.waterWalk = true; - player.fireWalk = true; - player.lavaMax += 240; - player.wingTimeMax = 120; - player.noFallDmg = true; - modPlayer.IBoots = !hideVisual; - modPlayer.sTracers = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 107, 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + CalamityPlayer modPlayer = player.Calamity(); + player.accRunSpeed = 9.25f; + player.rocketBoots = 3; + player.moveSpeed += 0.24f; + player.iceSkate = true; + player.waterWalk = true; + player.fireWalk = true; + player.lavaMax += 240; + player.wingTimeMax = 120; + player.noFallDmg = true; + modPlayer.IBoots = !hideVisual; + modPlayer.sTracers = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.75f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 2.5f; - constantAscend = 0.125f; - } + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 0.75f; + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1f; + maxAscentMultiplier = 2.5f; + constantAscend = 0.125f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 9f; - acceleration *= 2.5f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 9f; + acceleration *= 2.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("WingsGroup"); - recipe.AddIngredient(null, "AngelTreads"); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddRecipeGroup("WingsGroup"); + recipe.AddIngredient(null, "AngelTreads"); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 0df4e37ccc..9807dc35f7 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -7,121 +7,121 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class MOAB : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("MOAB"); - Tooltip.SetDefault("The mother of all balloons\n" + - "Counts as wings\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1\n" + - "Good vertical speed\n" + - "Flight time: 75"); - } + public class MOAB : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("MOAB"); + Tooltip.SetDefault("The mother of all balloons\n" + + "Counts as wings\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1\n" + + "Good vertical speed\n" + + "Flight time: 75"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 8; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 39, 99, 99); + item.rare = 8; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - player.rocketDelay2--; - if (player.rocketDelay2 <= 0) - { - Main.PlaySound(SoundID.Item13, player.position); - player.rocketDelay2 = 60; - } - int num66 = 2; - if (player.controlUp) - { - num66 = 4; - } - for (int num67 = 0; num67 < num66; num67++) - { - int type = 6; - if (player.head == 41) - { - int arg_58FD_0 = player.body; - } - float scale = 1.75f; - int alpha = 100; - float x = player.position.X + (float)(player.width / 2) + 16f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 26f; - } - float num68 = player.position.Y + (float)player.height - 18f; - if (num67 == 1 || num67 == 3) - { - x = player.position.X + (float)(player.width / 2) + 8f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 20f; - } - num68 += 6f; - } - if (num67 > 1) - { - num68 += player.velocity.Y; - } - int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale); - Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; - expr_5A11_cp_0_cp_0.velocity.X *= 0.1f; - Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; - Main.dust[num69].noGravity = true; - Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - if (num66 == 4) - { - Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; - expr_5AA6_cp_0_cp_0.velocity.Y += 6f; - } - } - } - player.doubleJumpCloud = true; - player.doubleJumpSandstorm = true; - player.doubleJumpBlizzard = true; - player.jumpBoost = true; - player.autoJump = true; - player.noFallDmg = true; - player.jumpSpeedBoost += 0.8f; - player.wingTimeMax = 75; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + player.rocketDelay2--; + if (player.rocketDelay2 <= 0) + { + Main.PlaySound(SoundID.Item13, player.position); + player.rocketDelay2 = 60; + } + int num66 = 2; + if (player.controlUp) + { + num66 = 4; + } + for (int num67 = 0; num67 < num66; num67++) + { + int type = 6; + if (player.head == 41) + { + int arg_58FD_0 = player.body; + } + float scale = 1.75f; + int alpha = 100; + float x = player.position.X + (float)(player.width / 2) + 16f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 26f; + } + float num68 = player.position.Y + (float)player.height - 18f; + if (num67 == 1 || num67 == 3) + { + x = player.position.X + (float)(player.width / 2) + 8f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 20f; + } + num68 += 6f; + } + if (num67 > 1) + { + num68 += player.velocity.Y; + } + int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale); + Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; + expr_5A11_cp_0_cp_0.velocity.X *= 0.1f; + Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; + Main.dust[num69].noGravity = true; + Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + if (num66 == 4) + { + Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; + expr_5AA6_cp_0_cp_0.velocity.Y += 6f; + } + } + } + player.doubleJumpCloud = true; + player.doubleJumpSandstorm = true; + player.doubleJumpBlizzard = true; + player.jumpBoost = true; + player.autoJump = true; + player.noFallDmg = true; + player.jumpSpeedBoost += 0.8f; + player.wingTimeMax = 75; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.75f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 2.5f; - constantAscend = 0.125f; - } + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 0.75f; + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1f; + maxAscentMultiplier = 2.5f; + constantAscend = 0.125f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 6.5f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 6.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrogLeg); - recipe.AddIngredient(ItemID.BundleofBalloons); - recipe.AddIngredient(ItemID.LuckyHorseshoe); - recipe.AddIngredient(ItemID.Jetpack); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FrogLeg); + recipe.AddIngredient(ItemID.BundleofBalloons); + recipe.AddIngredient(ItemID.LuckyHorseshoe); + recipe.AddIngredient(ItemID.Jetpack); + recipe.AddIngredient(ItemID.SoulofMight); + recipe.AddIngredient(ItemID.SoulofSight); + recipe.AddIngredient(ItemID.SoulofFright); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 90f84c0094..d67d7f6722 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -5,56 +5,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class SkylineWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skyline Wings"); - Tooltip.SetDefault("Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 60"); - } + public class SkylineWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skyline Wings"); + Tooltip.SetDefault("Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 60"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.wingTimeMax = 60; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.wingTimeMax = 60; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.5f; - ascentWhenRising = 0.1f; - maxCanAscendMultiplier = 0.5f; - maxAscentMultiplier = 1.5f; - constantAscend = 0.1f; - } + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 0.5f; + ascentWhenRising = 0.1f; + maxCanAscendMultiplier = 0.5f; + maxAscentMultiplier = 1.5f; + constantAscend = 0.1f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 6.25f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 6.25f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 5); - recipe.AddIngredient(ItemID.Feather, 5); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ItemID.Bone, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 5); + recipe.AddIngredient(ItemID.Feather, 5); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddIngredient(ItemID.Bone, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index d66bf2a040..cd3ca8f607 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -1,88 +1,88 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class StarlightWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starlight Wings"); - Tooltip.SetDefault("Wings of the Nightingale\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 150\n" + - "5% increased damage and critical strike chance while wearing the Daedalus Armor"); - } + public class StarlightWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starlight Wings"); + Tooltip.SetDefault("Wings of the Nightingale\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 150\n" + + "5% increased damage and critical strike chance while wearing the Daedalus Armor"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 5; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = Item.buyPrice(0, 39, 99, 99); + item.rare = 5; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 173, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 150; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 173, 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 150; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - CalamityPlayer modPlayer = player.Calamity(); + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.daedalusReflect || modPlayer.daedalusCrystal || modPlayer.daedalusAbsorb || modPlayer.daedalusShard || modPlayer.daedalusSplit) - { - player.allDamage += 0.05f; - modPlayer.AllCritBoost(5); - } + if (modPlayer.daedalusReflect || modPlayer.daedalusCrystal || modPlayer.daedalusAbsorb || modPlayer.daedalusShard || modPlayer.daedalusSplit) + { + player.allDamage += 0.05f; + modPlayer.AllCritBoost(5); + } - ascentWhenFalling = 0.5f; - ascentWhenRising = 0.1f; - maxCanAscendMultiplier = 0.5f; - maxAscentMultiplier = 1.5f; - constantAscend = 0.1f; - } + ascentWhenFalling = 0.5f; + ascentWhenRising = 0.1f; + maxCanAscendMultiplier = 0.5f; + maxAscentMultiplier = 1.5f; + constantAscend = 0.1f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 7.5f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 7.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 5); - recipe.AddIngredient(null, "EssenceofEleum"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 5); + recipe.AddIngredient(null, "EssenceofEleum"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index d80aa172cb..916cde4ace 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -1,99 +1,99 @@ -using System.Collections.Generic; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class TarragonWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Wings"); - Tooltip.SetDefault("Born of the jungle\n" + - "Horizontal speed: 9.5\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 210\n" + - "+15 defense and +2 life regen while wearing the Tarragon Armor"); - } + public class TarragonWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Wings"); + Tooltip.SetDefault("Born of the jungle\n" + + "Horizontal speed: 9.5\n" + + "Acceleration multiplier: 2.5\n" + + "Great vertical speed\n" + + "Flight time: 210\n" + + "+15 defense and +2 life regen while wearing the Tarragon Armor"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = Item.buyPrice(0, 39, 99, 99); + item.accessory = true; + } - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 200); - } - } - } + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 200); + } + } + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 75, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 210; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 75, 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 210; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - CalamityPlayer modPlayer = player.Calamity(); + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.tarraSet) - { - player.statDefense += 15; - player.lifeRegen += 2; - } + if (modPlayer.tarraSet) + { + player.statDefense += 15; + player.lifeRegen += 2; + } - ascentWhenFalling = 0.85f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 3f; - constantAscend = 0.135f; - } + ascentWhenFalling = 0.85f; + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1f; + maxAscentMultiplier = 3f; + constantAscend = 0.135f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 9.5f; - acceleration *= 2.5f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 9.5f; + acceleration *= 2.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 5); - recipe.AddIngredient(ItemID.SoulofFlight, 30); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 5); + recipe.AddIngredient(ItemID.SoulofFlight, 30); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index ad3beb1c86..2f5f04167c 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -1,89 +1,89 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories.Wings { [AutoloadEquip(EquipType.Wings)] - public class XerocWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Wings"); - Tooltip.SetDefault("Highly radioactive\n" + - "Horizontal speed: 8.5\n" + - "Acceleration multiplier: 2\n" + - "Good vertical speed\n" + - "Flight time: 180\n" + - "5% increased rogue damage and critical strike chance while wearing the Xeroc Armor"); - } + public class XerocWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Wings"); + Tooltip.SetDefault("Highly radioactive\n" + + "Horizontal speed: 8.5\n" + + "Acceleration multiplier: 2\n" + + "Good vertical speed\n" + + "Flight time: 180\n" + + "5% increased rogue damage and critical strike chance while wearing the Xeroc Armor"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 9; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = Item.buyPrice(0, 39, 99, 99); + item.rare = 9; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 242, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 180; - player.noFallDmg = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 242, 0f, 0f, 100, default, 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 180; + player.noFallDmg = true; + } - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - CalamityPlayer modPlayer = player.Calamity(); + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.xerocSet) - { - player.Calamity().throwingDamage += 0.05f; - player.Calamity().throwingCrit += 5; - } + if (modPlayer.xerocSet) + { + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingCrit += 5; + } - ascentWhenFalling = 0.75f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 2.5f; - constantAscend = 0.125f; - } + ascentWhenFalling = 0.75f; + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1f; + maxAscentMultiplier = 2.5f; + constantAscend = 0.125f; + } - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 8.5f; - acceleration *= 2f; - } + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 8.5f; + acceleration *= 2f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 5); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 5); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 83d7d7c31d..53511cfc6d 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Accessories item.height = 38; item.value = Item.buyPrice(0, 30, 0, 0); item.accessory = true; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Amidias/AmidiasTrident.cs b/Items/Amidias/AmidiasTrident.cs index 52d5aba30d..1a031a05f8 100644 --- a/Items/Amidias/AmidiasTrident.cs +++ b/Items/Amidias/AmidiasTrident.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Amidias { public class AmidiasTrident : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amidias' Trident"); - Tooltip.SetDefault("Shoots homing whirlpools"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amidias' Trident"); + Tooltip.SetDefault("Shoots homing whirlpools"); + } - public override void SetDefaults() - { - item.width = 44; - item.damage = 12; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = 5; - item.useTime = 17; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("AmidiasTridentProj"); - item.shootSpeed = 6f; - } + public override void SetDefaults() + { + item.width = 44; + item.damage = 12; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 17; + item.useStyle = 5; + item.useTime = 17; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("AmidiasTridentProj"); + item.shootSpeed = 6f; + } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - } + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + } } diff --git a/Items/Amidias/CoralCannon.cs b/Items/Amidias/CoralCannon.cs index 069b4d70c8..8b5b01f6d7 100644 --- a/Items/Amidias/CoralCannon.cs +++ b/Items/Amidias/CoralCannon.cs @@ -6,49 +6,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Amidias { public class CoralCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Coral Cannon"); - Tooltip.SetDefault("Has a chance to shoot a big coral that stuns enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coral Cannon"); + Tooltip.SetDefault("Has a chance to shoot a big coral that stuns enemies"); + } - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 52; - item.height = 40; - item.crit += 10; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SmallCoral"); - item.shootSpeed = 10f; - } + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 52; + item.height = 40; + item.crit += 10; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SmallCoral"); + item.shootSpeed = 10f; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (Main.rand.NextBool(5)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigCoral"), (int)((double)damage * 2.0), knockBack * 2f, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (Main.rand.NextBool(5)) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigCoral"), (int)((double)damage * 2.0), knockBack * 2f, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } diff --git a/Items/Amidias/MagicalConch.cs b/Items/Amidias/MagicalConch.cs index 846cdaca64..9c6af39166 100644 --- a/Items/Amidias/MagicalConch.cs +++ b/Items/Amidias/MagicalConch.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,66 +7,66 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Amidias { public class MagicalConch : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magical Conch"); - Tooltip.SetDefault("Summons a hermit crab to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magical Conch"); + Tooltip.SetDefault("Summons a hermit crab to fight for you"); + } - public override void SetDefaults() - { - item.damage = 20; - item.mana = 10; - item.width = 34; - item.height = 24; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("HermitCrab"); - item.shootSpeed = 10f; - item.summon = true; - } + public override void SetDefaults() + { + item.damage = 20; + item.mana = 10; + item.width = 34; + item.height = 24; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("HermitCrab"); + item.shootSpeed = 10f; + item.summon = true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("HermitCrab"), num73, num74, i, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = damage; + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("HermitCrab"), num73, num74, i, 0f, 0f); + return false; + } + } } diff --git a/Items/Amidias/Shellshooter.cs b/Items/Amidias/Shellshooter.cs index 3dd9397356..a527344ca3 100644 --- a/Items/Amidias/Shellshooter.cs +++ b/Items/Amidias/Shellshooter.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Amidias { public class Shellshooter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shellshooter"); - Tooltip.SetDefault("Shoots slow, powerful shells"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shellshooter"); + Tooltip.SetDefault("Shoots slow, powerful shells"); + } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 30; - item.height = 38; - item.crit += 15; - item.useTime = 70; - item.useAnimation = 70; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Shell"); - item.shootSpeed = 1.5f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 30; + item.height = 38; + item.crit += 15; + item.useTime = 70; + item.useAnimation = 70; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Shell"); + item.shootSpeed = 1.5f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Shell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Shell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Amidias/UrchinFlail.cs b/Items/Amidias/UrchinFlail.cs index 1724be080a..dab13b76a1 100644 --- a/Items/Amidias/UrchinFlail.cs +++ b/Items/Amidias/UrchinFlail.cs @@ -5,32 +5,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Amidias { public class UrchinFlail : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin Flail"); - Tooltip.SetDefault("Launch an urchin ball, which shoots a spike on contact with an enemy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin Flail"); + Tooltip.SetDefault("Launch an urchin ball, which shoots a spike on contact with an enemy"); + } - public override void SetDefaults() - { - item.damage = 20; - item.melee = true; - item.width = 44; - item.height = 36; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = mod.ProjectileType("UrchinBall"); - item.shootSpeed = 12f; - } - } + public override void SetDefaults() + { + item.damage = 20; + item.melee = true; + item.width = 44; + item.height = 36; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.channel = true; + item.shoot = mod.ProjectileType("UrchinBall"); + item.shootSpeed = 12f; + } + } } diff --git a/Items/Amidias/Waywasher.cs b/Items/Amidias/Waywasher.cs index a306c7737d..5f8e94a2fa 100644 --- a/Items/Amidias/Waywasher.cs +++ b/Items/Amidias/Waywasher.cs @@ -5,40 +5,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Amidias { public class Waywasher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Waywasher"); - Tooltip.SetDefault("Casts inaccurate water bolts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Waywasher"); + Tooltip.SetDefault("Casts inaccurate water bolts"); + } - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 4; - item.width = 30; - item.height = 30; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WaywasherProj"); - item.shootSpeed = 12f; - } + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 4; + item.width = 30; + item.height = 30; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WaywasherProj"); + item.shootSpeed = 12f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("WaywasherProj"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("WaywasherProj"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - } + } } diff --git a/Items/AquaticScourge/AquaticEmblem.cs b/Items/AquaticScourge/AquaticEmblem.cs index 0281f2cfc3..0d8078a2a5 100644 --- a/Items/AquaticScourge/AquaticEmblem.cs +++ b/Items/AquaticScourge/AquaticEmblem.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AquaticScourge { @@ -13,8 +13,8 @@ namespace CalamityMod.Items.AquaticScourge "Being underwater slowly boosts your defense over time but also slows movement speed\n" + "The defense boost and movement speed reduction slowly vanish while outside of water\n" + "Maximum defense boost is 30, maximum movement speed reduction is 5%\n" + - "Provides a small amount of light in the abyss\n" + - "Moderately reduces breath loss in the abyss"); + "Provides a small amount of light in the abyss\n" + + "Moderately reduces breath loss in the abyss"); } public override void SetDefaults() diff --git a/Items/AquaticScourge/AquaticScourgeBag.cs b/Items/AquaticScourge/AquaticScourgeBag.cs index f7b3b8042d..c46db8bdab 100644 --- a/Items/AquaticScourge/AquaticScourgeBag.cs +++ b/Items/AquaticScourge/AquaticScourgeBag.cs @@ -1,75 +1,75 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.Utilities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.AquaticScourge { - public class AquaticScourgeBag : ModItem - { - public override int BossBagNPC => mod.NPCType("AquaticScourgeHead"); + public class AquaticScourgeBag : ModItem + { + public override int BossBagNPC => mod.NPCType("AquaticScourgeHead"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials (Souls of Sight are Hardmode only) - DropHelper.DropItemCondition(player, ItemID.SoulofSight, Main.hardMode, 25, 40); - DropHelper.DropItem(player, mod.ItemType("VictoryShard"), 15, 25); - DropHelper.DropItem(player, ItemID.Coral, 7, 11); - DropHelper.DropItem(player, ItemID.Seashell, 7, 11); - DropHelper.DropItem(player, ItemID.Starfish, 7, 11); + // Materials (Souls of Sight are Hardmode only) + DropHelper.DropItemCondition(player, ItemID.SoulofSight, Main.hardMode, 25, 40); + DropHelper.DropItem(player, mod.ItemType("VictoryShard"), 15, 25); + DropHelper.DropItem(player, ItemID.Coral, 7, 11); + DropHelper.DropItem(player, ItemID.Seashell, 7, 11); + DropHelper.DropItem(player, ItemID.Starfish, 7, 11); - // Weapons (Hardmode only) - DropHelper.DropItemCondition(player, mod.ItemType("SubmarineShocker"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("Barinautical"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("Downpour"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("DeepseaStaff"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("ScourgeoftheSeas"), Main.hardMode, 3, 1, 1); + // Weapons (Hardmode only) + DropHelper.DropItemCondition(player, mod.ItemType("SubmarineShocker"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("Barinautical"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("Downpour"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("DeepseaStaff"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("ScourgeoftheSeas"), Main.hardMode, 3, 1, 1); - // Equipment (Emblem is Hardmode only) - DropHelper.DropItemCondition(player, mod.ItemType("AquaticEmblem"), Main.hardMode); - DropHelper.DropItemChance(player, mod.ItemType("AeroStone"), 8); + // Equipment (Emblem is Hardmode only) + DropHelper.DropItemCondition(player, mod.ItemType("AquaticEmblem"), Main.hardMode); + DropHelper.DropItemChance(player, mod.ItemType("AeroStone"), 8); - // Vanity - // there is no Aquatic Scourge mask yet + // Vanity + // there is no Aquatic Scourge mask yet - // Fishing - DropHelper.DropItemChance(player, ItemID.HighTestFishingLine, 10); - DropHelper.DropItemChance(player, ItemID.AnglerTackleBag, 10); - DropHelper.DropItemChance(player, ItemID.TackleBox, 10); - DropHelper.DropItemChance(player, ItemID.AnglerEarring, 8); - DropHelper.DropItemChance(player, ItemID.FishermansGuide, 8); - DropHelper.DropItemChance(player, ItemID.WeatherRadio, 8); - DropHelper.DropItemChance(player, ItemID.Sextant, 8); - DropHelper.DropItemChance(player, ItemID.AnglerHat, 3); - DropHelper.DropItemChance(player, ItemID.AnglerVest, 3); - DropHelper.DropItemChance(player, ItemID.AnglerPants, 3); - DropHelper.DropItemChance(player, ItemID.FishingPotion, 3, 2, 3); - DropHelper.DropItemChance(player, ItemID.SonarPotion, 3, 2, 3); - DropHelper.DropItemChance(player, ItemID.CratePotion, 3, 2, 3); - DropHelper.DropItemCondition(player, ItemID.GoldenBugNet, NPC.downedBoss3, 12, 1, 1); - } - } + // Fishing + DropHelper.DropItemChance(player, ItemID.HighTestFishingLine, 10); + DropHelper.DropItemChance(player, ItemID.AnglerTackleBag, 10); + DropHelper.DropItemChance(player, ItemID.TackleBox, 10); + DropHelper.DropItemChance(player, ItemID.AnglerEarring, 8); + DropHelper.DropItemChance(player, ItemID.FishermansGuide, 8); + DropHelper.DropItemChance(player, ItemID.WeatherRadio, 8); + DropHelper.DropItemChance(player, ItemID.Sextant, 8); + DropHelper.DropItemChance(player, ItemID.AnglerHat, 3); + DropHelper.DropItemChance(player, ItemID.AnglerVest, 3); + DropHelper.DropItemChance(player, ItemID.AnglerPants, 3); + DropHelper.DropItemChance(player, ItemID.FishingPotion, 3, 2, 3); + DropHelper.DropItemChance(player, ItemID.SonarPotion, 3, 2, 3); + DropHelper.DropItemChance(player, ItemID.CratePotion, 3, 2, 3); + DropHelper.DropItemCondition(player, ItemID.GoldenBugNet, NPC.downedBoss3, 12, 1, 1); + } + } } diff --git a/Items/AquaticScourge/Seafood.cs b/Items/AquaticScourge/Seafood.cs index 86246f8b78..ef6d186bed 100644 --- a/Items/AquaticScourge/Seafood.cs +++ b/Items/AquaticScourge/Seafood.cs @@ -1,53 +1,53 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.AquaticScourge { - public class Seafood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seafood"); - Tooltip.SetDefault("The sulphuric sand stirs...\n" + + public class Seafood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seafood"); + Tooltip.SetDefault("The sulphuric sand stirs...\n" + "Summons the Aquatic Scourge"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { + public override bool CanUseItem(Player player) + { CalamityPlayer modPlayer = player.Calamity(); return modPlayer.ZoneSulphur && !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead")); - } + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AquaticScourgeHead")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AquaticScourgeHead")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SulphurousSand", 10); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SulphurousSand", 10); recipe.AddIngredient(ItemID.Starfish, 5); recipe.AddIngredient(ItemID.SharkFin, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/AbyssalDivingSuit.cs b/Items/Armor/AbyssalDivingSuit.cs index 5864b702a0..c2fef54bfb 100644 --- a/Items/Armor/AbyssalDivingSuit.cs +++ b/Items/Armor/AbyssalDivingSuit.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "Lumenite", 40); recipe.AddIngredient(null, "DepthCells", 40); recipe.AddIngredient(null, "Tenebris", 15); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/AerospecBreastplate.cs b/Items/Armor/AerospecBreastplate.cs index cd6a94e29a..cf01113300 100644 --- a/Items/Armor/AerospecBreastplate.cs +++ b/Items/Armor/AerospecBreastplate.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -18,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; item.defense = 7; } diff --git a/Items/Armor/AerospecHat.cs b/Items/Armor/AerospecHat.cs index 0da2786c8c..87823df28d 100644 --- a/Items/Armor/AerospecHat.cs +++ b/Items/Armor/AerospecHat.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; item.defense = 3; //15 } diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index 1ba9ff38bb..795beceda4 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; item.defense = 4; //17 } @@ -45,13 +44,13 @@ namespace CalamityMod.Items.Armor player.setBonus = "5% increased movement speed and rogue critical strike chance\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.aeroSet = true; - modPlayer.rogueStealthMax = 1f; - player.noFallDmg = true; + modPlayer.rogueStealthMax = 1f; + player.noFallDmg = true; player.moveSpeed += 0.05f; player.Calamity().throwingCrit += 5; player.Calamity().wearingRogueArmor = true; @@ -59,8 +58,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.Calamity().throwingDamage += 0.08f; - player.moveSpeed += 0.05f; + player.Calamity().throwingDamage += 0.08f; + player.moveSpeed += 0.05f; } public override void AddRecipes() diff --git a/Items/Armor/AerospecHelm.cs b/Items/Armor/AerospecHelm.cs index 70f8e0020a..c2672a58c4 100644 --- a/Items/Armor/AerospecHelm.cs +++ b/Items/Armor/AerospecHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; item.defense = 7; //20 } diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index f35f99b85c..1e0ca70975 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; item.defense = 2; //13 } diff --git a/Items/Armor/AerospecHood.cs b/Items/Armor/AerospecHood.cs index 796bb9f2c3..3768c9d1f6 100644 --- a/Items/Armor/AerospecHood.cs +++ b/Items/Armor/AerospecHood.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; item.defense = 5; //18 } diff --git a/Items/Armor/AerospecLeggings.cs b/Items/Armor/AerospecLeggings.cs index d4bb5f8104..afe2c9e632 100644 --- a/Items/Armor/AerospecLeggings.cs +++ b/Items/Armor/AerospecLeggings.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 3; item.defense = 6; } diff --git a/Items/Armor/AstralBreastplate.cs b/Items/Armor/AstralBreastplate.cs index 493b332585..28387c0727 100644 --- a/Items/Armor/AstralBreastplate.cs +++ b/Items/Armor/AstralBreastplate.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = 9; + item.value = Item.buyPrice(0, 32, 0, 0); + item.rare = 9; item.defense = 25; } diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs index 61c1341e36..1fa08be6a9 100644 --- a/Items/Armor/AstralHelm.cs +++ b/Items/Armor/AstralHelm.cs @@ -1,64 +1,64 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class AstralHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Helm"); - Tooltip.SetDefault("Danger detection"); - } + public class AstralHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Helm"); + Tooltip.SetDefault("Danger detection"); + } - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = 9; - item.defense = 17; //63 - } + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 40, 0, 0); + item.rare = 9; + item.defense = 17; //63 + } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AstralBreastplate") && legs.type == mod.ItemType("AstralLeggings"); - } + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AstralBreastplate") && legs.type == mod.ItemType("AstralLeggings"); + } - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } - public override void UpdateArmorSet(Player player) - { - player.setBonus = "25% increased movement speed\n" + - "28% increased damage and 21% increased critical strike chance\n" + - "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + - "This effect has a 1 second cooldown before it can trigger again"; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astralStarRain = true; - player.moveSpeed += 0.25f; - player.allDamage += 0.28f; - modPlayer.AllCritBoost(21); + public override void UpdateArmorSet(Player player) + { + player.setBonus = "25% increased movement speed\n" + + "28% increased damage and 21% increased critical strike chance\n" + + "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + + "This effect has a 1 second cooldown before it can trigger again"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.astralStarRain = true; + player.moveSpeed += 0.25f; + player.allDamage += 0.28f; + modPlayer.AllCritBoost(21); player.Calamity().wearingRogueArmor = true; } - public override void UpdateEquip(Player player) - { - player.dangerSense = true; - } + public override void UpdateEquip(Player player) + { + player.dangerSense = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 8); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/AstralLeggings.cs b/Items/Armor/AstralLeggings.cs index d4fc92da0f..28773c194e 100644 --- a/Items/Armor/AstralLeggings.cs +++ b/Items/Armor/AstralLeggings.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 9; item.defense = 21; } diff --git a/Items/Armor/AstrumDeusMask.cs b/Items/Armor/AstrumDeusMask.cs index 537500cb6d..8bd4d3e991 100644 --- a/Items/Armor/AstrumDeusMask.cs +++ b/Items/Armor/AstrumDeusMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class AstrumDeusMask : ModItem - { + public class AstrumDeusMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Deus Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs index 89b0a3eaf0..76a44721cd 100644 --- a/Items/Armor/AtaxiaArmor.cs +++ b/Items/Armor/AtaxiaArmor.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,17 +18,17 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 8; item.defense = 20; } public override void UpdateEquip(Player player) { player.statLifeMax2 += 20; - player.allDamage += 0.08f; - player.Calamity().AllCritBoost(4); - } + player.allDamage += 0.08f; + player.Calamity().AllCritBoost(4); + } public override void AddRecipes() { diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs index b0c1e14442..138c50a14e 100644 --- a/Items/Armor/AtaxiaHeadgear.cs +++ b/Items/Armor/AtaxiaHeadgear.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; item.defense = 15; //53 } @@ -57,8 +57,8 @@ namespace CalamityMod.Items.Armor player.ammoCost75 = true; player.rangedDamage += 0.12f; player.rangedCrit += 10; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs index bb83aa71e5..e73aa359bb 100644 --- a/Items/Armor/AtaxiaHelm.cs +++ b/Items/Armor/AtaxiaHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Ataxia Helm"); Tooltip.SetDefault("12% increased melee damage and 10% increased melee critical strike chance\n" + - "12% increased melee and movement speed\n" + + "12% increased melee and movement speed\n" + "Melee attacks and melee projectiles inflict on fire\n" + "Temporary immunity to lava and immunity to fire damage"); } @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; item.defense = 25; //67 } @@ -52,12 +52,12 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaFire = true; - player.meleeSpeed += 0.12f; - player.moveSpeed += 0.12f; - player.meleeDamage += 0.12f; + player.meleeSpeed += 0.12f; + player.moveSpeed += 0.12f; + player.meleeDamage += 0.12f; player.meleeCrit += 10; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index 0d6026b5d8..dce417870d 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; item.defense = 6; //40 } @@ -63,8 +63,8 @@ namespace CalamityMod.Items.Armor player.minionDamage += 0.05f; player.minionKB += 1.5f; player.maxMinions += 2; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index 25fd1bbcf9..27382ccbd8 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -21,8 +20,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; item.defense = 12; //49 } @@ -42,13 +41,13 @@ namespace CalamityMod.Items.Armor "Inferno effect when below 50% life\n" + "Rogue weapons have a 10% chance to unleash a volley of chaos flames around the player that chase enemies when used\n" + "You have a 20% chance to emit a blazing explosion when you are hit\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 120\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 120\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaVolley = true; - modPlayer.rogueStealthMax = 1.2f; + modPlayer.rogueStealthMax = 1.2f; player.Calamity().throwingDamage += 0.05f; player.Calamity().wearingRogueArmor = true; } @@ -58,9 +57,9 @@ namespace CalamityMod.Items.Armor player.Calamity().throwingAmmoCost50 = true; player.Calamity().throwingDamage += 0.12f; player.Calamity().throwingCrit += 10; - player.moveSpeed += 0.15f; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; + player.moveSpeed += 0.15f; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index ab937a9a94..1ce91c9b4e 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Ataxia Mask"); Tooltip.SetDefault("12% increased magic damage, reduces mana usage by 15%, and 10% increased magic critical strike chance\n" + - "+100 max mana, temporary immunity to lava, and immunity to fire damage"); + "+100 max mana, temporary immunity to lava, and immunity to fire damage"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; item.defense = 9; //45 } @@ -52,8 +52,8 @@ namespace CalamityMod.Items.Armor player.statManaMax2 += 100; player.magicDamage += 0.12f; player.magicCrit += 10; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() diff --git a/Items/Armor/AtaxiaSubligar.cs b/Items/Armor/AtaxiaSubligar.cs index 13bf660ea4..07c4ef7872 100644 --- a/Items/Armor/AtaxiaSubligar.cs +++ b/Items/Armor/AtaxiaSubligar.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -19,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 18, 0, 0); + item.rare = 8; item.defense = 14; } diff --git a/Items/Armor/AureusMask.cs b/Items/Armor/AureusMask.cs index b4d2e1a37d..788aac1291 100644 --- a/Items/Armor/AureusMask.cs +++ b/Items/Armor/AureusMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class AureusMask : ModItem - { + public class AureusMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Aureus Mask"); } - public override void SetDefaults() - { - item.width = 30; - item.height = 28; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 30; + item.height = 28; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index 85b462681f..809ade1660 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(1, 44, 0, 0); - item.defense = 48; - item.Calamity().postMoonLordRarity = 20; - } + item.value = Item.buyPrice(1, 44, 0, 0); + item.defense = 48; + item.Calamity().postMoonLordRarity = 20; + } public override void UpdateEquip(Player player) { @@ -33,9 +33,9 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerReflect = true; player.statLifeMax2 += 100; player.moveSpeed += 0.25f; - player.allDamage += 0.08f; - modPlayer.AllCritBoost(5); - } + player.allDamage += 0.08f; + modPlayer.AllCritBoost(5); + } public override void AddRecipes() { diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index e28cf6491d..40e402cbbb 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,18 +19,18 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(1, 8, 0, 0); - item.defense = 44; - item.Calamity().postMoonLordRarity = 20; - } + item.value = Item.buyPrice(1, 8, 0, 0); + item.defense = 44; + item.Calamity().postMoonLordRarity = 20; + } public override void UpdateEquip(Player player) { player.moveSpeed += 0.5f; player.carpet = true; - player.allDamage += 0.12f; - player.Calamity().AllCritBoost(5); - } + player.allDamage += 0.12f; + player.Calamity().AllCritBoost(5); + } public override void AddRecipes() { diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index 797325a617..1941127ee5 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 54; //132 - item.Calamity().postMoonLordRarity = 20; - } + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 54; //132 + item.Calamity().postMoonLordRarity = 20; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -50,8 +50,8 @@ namespace CalamityMod.Items.Armor modPlayer.silvaMelee = true; modPlayer.auricSet = true; player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.crimsonRegen = true; player.aggro += 1200; if (player.lavaWet) diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index 0de269f60e..0a86744647 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 40; //132 - item.Calamity().postMoonLordRarity = 20; - } + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 40; //132 + item.Calamity().postMoonLordRarity = 20; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -49,8 +49,8 @@ namespace CalamityMod.Items.Armor modPlayer.silvaRanged = true; modPlayer.auricSet = true; player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.crimsonRegen = true; if (player.lavaWet) { diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index edc8a87ab7..10d816cc26 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -1,7 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,10 +18,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 34; //132 - item.Calamity().postMoonLordRarity = 20; - } + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 34; //132 + item.Calamity().postMoonLordRarity = 20; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -40,9 +39,9 @@ namespace CalamityMod.Items.Armor "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + "Rogue weapon critical strikes will do 1.25 times damage while you are above 50% HP\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 160\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 160\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; @@ -53,11 +52,11 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSet = true; modPlayer.silvaThrowing = true; modPlayer.auricSet = true; - modPlayer.rogueStealthMax = 1.6f; + modPlayer.rogueStealthMax = 1.6f; modPlayer.wearingRogueArmor = true; - player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; + player.thorns += 3f; + player.lavaMax += 240; + player.ignoreWater = true; player.crimsonRegen = true; if (player.lavaWet) { @@ -72,7 +71,7 @@ namespace CalamityMod.Items.Armor modPlayer.auricBoost = true; player.Calamity().throwingDamage += 0.2f; player.Calamity().throwingCrit += 20; - player.moveSpeed += 0.25f; + player.moveSpeed += 0.25f; } public override void AddRecipes() diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 5f34cad403..2bd5c9e435 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -1,8 +1,8 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 12; //132 - item.Calamity().postMoonLordRarity = 20; - } + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 12; //132 + item.Calamity().postMoonLordRarity = 20; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -52,11 +52,11 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSummon = true; modPlayer.auricSet = true; player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.crimsonRegen = true; player.minionDamage += 1.2f; - player.maxMinions++; + player.maxMinions++; if (player.lavaWet) { player.statDefense += 30; diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index 9f856f6075..f544ae51b8 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 24; //132 - item.Calamity().postMoonLordRarity = 20; - } + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 24; //132 + item.Calamity().postMoonLordRarity = 20; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -49,8 +49,8 @@ namespace CalamityMod.Items.Armor modPlayer.silvaMage = true; modPlayer.auricSet = true; player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.crimsonRegen = true; if (player.lavaWet) { @@ -63,11 +63,11 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; - player.manaCost *= 0.8f; - player.magicDamage += 0.2f; + player.manaCost *= 0.8f; + player.magicDamage += 0.2f; player.magicCrit += 20; - player.statManaMax2 += 100; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs index 7c66d96139..5cd0041d2e 100644 --- a/Items/Armor/BloodflareBodyArmor.cs +++ b/Items/Armor/BloodflareBodyArmor.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,17 +19,17 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 48, 0, 0); - item.defense = 35; - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 48, 0, 0); + item.defense = 35; + item.Calamity().postMoonLordRarity = 13; + } public override void UpdateEquip(Player player) { player.statLifeMax2 += 40; - player.allDamage += 0.12f; - player.Calamity().AllCritBoost(8); - if (player.lavaWet) + player.allDamage += 0.12f; + player.Calamity().AllCritBoost(8); + if (player.lavaWet) { player.statDefense += 30; player.lifeRegen += 10; diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs index 7c65d2f694..8b8ccb7b8f 100644 --- a/Items/Armor/BloodflareCuisses.cs +++ b/Items/Armor/BloodflareCuisses.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,17 +17,17 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 36, 0, 0); - item.defense = 29; - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 36, 0, 0); + item.defense = 29; + item.Calamity().postMoonLordRarity = 13; + } public override void UpdateEquip(Player player) { player.moveSpeed += 0.3f; - player.allDamage += 0.1f; - player.Calamity().AllCritBoost(7); - } + player.allDamage += 0.1f; + player.Calamity().AllCritBoost(7); + } public override void AddRecipes() { diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index df79a66b96..46e29cb785 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,10 +19,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 28; //85 - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 28; //85 + item.Calamity().postMoonLordRarity = 13; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -40,28 +39,28 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareThrowing = true; - modPlayer.rogueStealthMax = 1.35f; + modPlayer.rogueStealthMax = 1.35f; modPlayer.wearingRogueArmor = true; - player.setBonus = "Greatly increases life regen\n" + + player.setBonus = "Greatly increases life regen\n" + "Enemies below 50% life have a chance to drop hearts when struck\n" + "Enemies above 50% life have a chance to drop mana stars when struck\n" + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "Being over 80% life boosts your defense by 30 and rogue crit by 5%\n" + "Being below 80% life boosts your rogue damage by 10%\n" + "Rogue critical strikes have a 50% chance to heal you\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 135\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 135\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; player.crimsonRegen = true; } public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.Calamity().throwingDamage += 0.1f; player.Calamity().throwingCrit += 10; - player.moveSpeed += 0.15f; + player.moveSpeed += 0.15f; } public override void AddRecipes() diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index cc6abc858b..9c7e4af4f8 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 16; //85 - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 16; //85 + item.Calamity().postMoonLordRarity = 13; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -53,8 +53,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.maxMinions += 3; } diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs index 710e3f2275..69e1fe4ae9 100644 --- a/Items/Armor/BloodflareHornedHelm.cs +++ b/Items/Armor/BloodflareHornedHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 34; //85 - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 34; //85 + item.Calamity().postMoonLordRarity = 13; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.rangedDamage += 0.1f; player.rangedCrit += 10; } diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index e12c43b049..98d90dfa32 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 22; //85 - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 22; //85 + item.Calamity().postMoonLordRarity = 13; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -50,13 +50,13 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.manaCost *= 0.83f; - player.lavaMax += 240; - player.ignoreWater = true; + player.manaCost *= 0.83f; + player.lavaMax += 240; + player.ignoreWater = true; player.magicDamage += 0.1f; player.magicCrit += 10; - player.statManaMax2 += 100; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index 9ed8487f16..f90c1cadad 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 49; //85 - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 49; //85 + item.Calamity().postMoonLordRarity = 13; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.meleeDamage += 0.1f; player.meleeCrit += 10; } diff --git a/Items/Armor/CalamitasMask.cs b/Items/Armor/CalamitasMask.cs index e52d935e4e..84a178372e 100644 --- a/Items/Armor/CalamitasMask.cs +++ b/Items/Armor/CalamitasMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class CalamitasMask : ModItem - { + public class CalamitasMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Calamitas Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/CrabulonMask.cs b/Items/Armor/CrabulonMask.cs index bb459a317f..852ed33bd1 100644 --- a/Items/Armor/CrabulonMask.cs +++ b/Items/Armor/CrabulonMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class CrabulonMask : ModItem - { + public class CrabulonMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crabulon Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/CryogenMask.cs b/Items/Armor/CryogenMask.cs index 06f5e68fed..eed819f8c2 100644 --- a/Items/Armor/CryogenMask.cs +++ b/Items/Armor/CryogenMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class CryogenMask : ModItem - { + public class CryogenMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cryogen Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs index fa32682dfb..0415a99a51 100644 --- a/Items/Armor/DaedalusBreastplate.cs +++ b/Items/Armor/DaedalusBreastplate.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,16 +17,16 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 20, 0, 0); + item.rare = 5; item.defense = 17; //41 } public override void UpdateEquip(Player player) { - player.allDamage += 0.03f; - player.Calamity().AllCritBoost(3); - } + player.allDamage += 0.03f; + player.Calamity().AllCritBoost(3); + } public override void AddRecipes() { diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index 5594925252..4bd4c6384c 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Daedalus Hood"); Tooltip.SetDefault("13% increased magic damage and 7% increased magic critical strike chance\n" + - "10% decreased mana usage and +60 max mana"); + "10% decreased mana usage and +60 max mana"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; item.defense = 5; //35 } @@ -47,11 +47,11 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.manaCost *= 0.9f; - player.magicDamage += 0.13f; + player.manaCost *= 0.9f; + player.magicDamage += 0.13f; player.magicCrit += 7; - player.statManaMax2 += 60; - } + player.statManaMax2 += 60; + } public override void AddRecipes() { diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index 57c23ffb02..0303e8a5c6 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; item.defense = 3; //33 } diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs index 99c0d22603..12b3242b35 100644 --- a/Items/Armor/DaedalusHelm.cs +++ b/Items/Armor/DaedalusHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Daedalus Helm"); Tooltip.SetDefault("10% increased melee damage and critical strike chance\n" + - "10% increased melee and movement speed"); + "10% increased melee and movement speed"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; item.defense = 21; //51 } @@ -47,9 +47,9 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeSpeed += 0.1f; - player.moveSpeed += 0.1f; - player.meleeDamage += 0.1f; + player.meleeSpeed += 0.1f; + player.moveSpeed += 0.1f; + player.meleeDamage += 0.1f; player.meleeCrit += 10; } diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs index 846dec62db..981dd5a2cf 100644 --- a/Items/Armor/DaedalusHelmet.cs +++ b/Items/Armor/DaedalusHelmet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Daedalus Headgear"); Tooltip.SetDefault("13% increased ranged damage and 7% increased ranged critical strike chance\n" + - "Reduces ammo usage by 20%"); + "Reduces ammo usage by 20%"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; item.defense = 9; //39 } diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs index 560d9e0af8..00c43a3b37 100644 --- a/Items/Armor/DaedalusLeggings.cs +++ b/Items/Armor/DaedalusLeggings.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -19,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; item.defense = 13; //41 } diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index 6e259cb65a..31f5154c6e 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; item.defense = 7; //37 } @@ -46,13 +45,13 @@ namespace CalamityMod.Items.Armor { player.setBonus = "5% increased rogue damage\n" + "Rogue projectiles throw out crystal shards as they travel\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusSplit = true; - modPlayer.rogueStealthMax = 1.1f; - player.Calamity().throwingDamage += 0.05f; + modPlayer.rogueStealthMax = 1.1f; + player.Calamity().throwingDamage += 0.05f; player.Calamity().wearingRogueArmor = true; } @@ -61,7 +60,7 @@ namespace CalamityMod.Items.Armor player.Calamity().throwingVelocity += 0.15f; player.Calamity().throwingDamage += 0.13f; player.Calamity().throwingCrit += 7; - player.moveSpeed += 0.17f; + player.moveSpeed += 0.17f; } public override void AddRecipes() diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs index 256075a177..4fea71893a 100644 --- a/Items/Armor/DemonshadeBreastplate.cs +++ b/Items/Armor/DemonshadeBreastplate.cs @@ -1,12 +1,12 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Body)] - public class DemonshadeBreastplate : ModItem - { + public class DemonshadeBreastplate : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Demonshade Breastplate"); @@ -16,34 +16,34 @@ namespace CalamityMod.Items.Armor "Standing still lets you absorb the shadows and boost your life regen"); } - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(4, 0, 0, 0); - item.defense = 50; - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(4, 0, 0, 0); + item.defense = 50; + item.Calamity().postMoonLordRarity = 16; + } - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.shadeRegen = true; - player.thorns = 100f; - player.statLifeMax2 += 200; - player.statManaMax2 += 200; - player.allDamage += 0.15f; - modPlayer.AllCritBoost(15); - player.meleeSpeed += 0.2f; - } + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.shadeRegen = true; + player.thorns = 100f; + player.statLifeMax2 += 200; + player.statManaMax2 += 200; + player.allDamage += 0.15f; + modPlayer.AllCritBoost(15); + player.meleeSpeed += 0.2f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 15); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs index 60c4461e27..729ec0f73c 100644 --- a/Items/Armor/DemonshadeGreaves.cs +++ b/Items/Armor/DemonshadeGreaves.cs @@ -1,41 +1,41 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Legs)] - public class DemonshadeGreaves : ModItem - { + public class DemonshadeGreaves : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Demonshade Greaves"); Tooltip.SetDefault("Shadow speed"); } - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(3, 0, 0, 0); - item.defense = 50; //15 - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(3, 0, 0, 0); + item.defense = 50; //15 + item.Calamity().postMoonLordRarity = 16; + } - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.shadowSpeed = true; - player.moveSpeed += 1f; - } + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.shadowSpeed = true; + player.moveSpeed += 1f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 11); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 11); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 8e829b513d..658b433a9f 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -1,78 +1,78 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class DemonshadeHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demonshade Helm"); - Tooltip.SetDefault("30% increased damage and 15% increased critical strike chance, +10 max minions"); - } + public class DemonshadeHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonshade Helm"); + Tooltip.SetDefault("30% increased damage and 15% increased critical strike chance, +10 max minions"); + } - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(5, 0, 0, 0); - item.defense = 50; //15 - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(5, 0, 0, 0); + item.defense = 50; //15 + item.Calamity().postMoonLordRarity = 16; + } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("DemonshadeBreastplate") && legs.type == mod.ItemType("DemonshadeGreaves"); - } + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("DemonshadeBreastplate") && legs.type == mod.ItemType("DemonshadeGreaves"); + } - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + player.armorEffectDrawOutlines = true; + } - public override void UpdateArmorSet(Player player) - { - player.setBonus = "100% increased minion damage\n" + - "All attacks inflict the demon flame debuff\n" + - "Shadowbeams and demon scythes will fire down when you are hit\n" + - "A friendly red devil follows you around\n" + - "Press Y to enrage nearby enemies with a dark magic spell for 10 seconds\n" + - "This makes them do 25% more damage but they also take 125% more damage"; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dsSetBonus = true; + public override void UpdateArmorSet(Player player) + { + player.setBonus = "100% increased minion damage\n" + + "All attacks inflict the demon flame debuff\n" + + "Shadowbeams and demon scythes will fire down when you are hit\n" + + "A friendly red devil follows you around\n" + + "Press Y to enrage nearby enemies with a dark magic spell for 10 seconds\n" + + "This makes them do 25% more damage but they also take 125% more damage"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dsSetBonus = true; modPlayer.wearingRogueArmor = true; - if (player.whoAmI == Main.myPlayer && !modPlayer.chibii) - { - modPlayer.redDevil = true; - if (player.FindBuffIndex(mod.BuffType("RedDevil")) == -1) - { - player.AddBuff(mod.BuffType("RedDevil"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("RedDevil"), 10000, 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 1f; - } + if (player.whoAmI == Main.myPlayer && !modPlayer.chibii) + { + modPlayer.redDevil = true; + if (player.FindBuffIndex(mod.BuffType("RedDevil")) == -1) + { + player.AddBuff(mod.BuffType("RedDevil"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("RedDevil"), 10000, 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 1f; + } - public override void UpdateEquip(Player player) - { - player.maxMinions += 10; - player.allDamage += 0.3f; - player.Calamity().AllCritBoost(15); - } + public override void UpdateEquip(Player player) + { + player.maxMinions += 10; + player.allDamage += 0.3f; + player.Calamity().AllCritBoost(15); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 8); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 8); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/DesertScourgeMask.cs b/Items/Armor/DesertScourgeMask.cs index 4b602de335..1ed6631ccb 100644 --- a/Items/Armor/DesertScourgeMask.cs +++ b/Items/Armor/DesertScourgeMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class DesertScourgeMask : ModItem - { + public class DesertScourgeMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Desert Scourge Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/DevourerofGodsMask.cs b/Items/Armor/DevourerofGodsMask.cs index 11ac6bcf50..3df18acd3d 100644 --- a/Items/Armor/DevourerofGodsMask.cs +++ b/Items/Armor/DevourerofGodsMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class DevourerofGodsMask : ModItem - { + public class DevourerofGodsMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Devourer of Gods Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index c3bd6a5da9..fa2528744d 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 41; - item.Calamity().postMoonLordRarity = 14; - } + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 41; + item.Calamity().postMoonLordRarity = 14; + } public override void UpdateEquip(Player player) { @@ -33,9 +33,9 @@ namespace CalamityMod.Items.Armor player.thorns += 0.5f; player.statLifeMax2 += 60; player.moveSpeed += 0.15f; - player.allDamage += 0.11f; - modPlayer.AllCritBoost(6); - } + player.allDamage += 0.11f; + modPlayer.AllCritBoost(6); + } public override void AddRecipes() { diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index 96297475a1..98b421d60b 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 48; //96 - item.Calamity().postMoonLordRarity = 14; - } + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 48; //96 + item.Calamity().postMoonLordRarity = 14; + } public override bool IsArmorSet(Item head, Item body, Item legs) { diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 044b0f62ae..570f05d42c 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 35; //96 - item.Calamity().postMoonLordRarity = 14; - } + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 35; //96 + item.Calamity().postMoonLordRarity = 14; + } public override bool IsArmorSet(Item head, Item body, Item legs) { diff --git a/Items/Armor/GodSlayerHornedHelm.cs b/Items/Armor/GodSlayerHornedHelm.cs index a0919bfd5c..7ea14bae45 100644 --- a/Items/Armor/GodSlayerHornedHelm.cs +++ b/Items/Armor/GodSlayerHornedHelm.cs @@ -1,8 +1,8 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 12; //96 - item.Calamity().postMoonLordRarity = 14; - } + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 12; //96 + item.Calamity().postMoonLordRarity = 14; + } public override bool IsArmorSet(Item head, Item body, Item legs) { diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index c6764c86f5..0ec32134cc 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.cs @@ -1,6 +1,5 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,17 +17,17 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 45, 0, 0); - item.defense = 35; - item.Calamity().postMoonLordRarity = 14; - } + item.value = Item.buyPrice(0, 45, 0, 0); + item.defense = 35; + item.Calamity().postMoonLordRarity = 14; + } public override void UpdateEquip(Player player) { player.moveSpeed += 0.35f; - player.allDamage += 0.1f; - player.Calamity().AllCritBoost(6); - } + player.allDamage += 0.1f; + player.Calamity().AllCritBoost(6); + } public override void AddRecipes() { diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index b891071918..0aaf5f6e47 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -1,7 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,10 +17,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 29; //96 - item.Calamity().postMoonLordRarity = 14; - } + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 29; //96 + item.Calamity().postMoonLordRarity = 14; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -38,23 +37,23 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerThrowing = true; - modPlayer.rogueStealthMax = 1.4f; + modPlayer.rogueStealthMax = 1.4f; modPlayer.wearingRogueArmor = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + + player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + "This effect can only occur once every 45 seconds\n" + "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + "While at full HP all of your rogue stats are boosted by 10%\n" + "If you take over 80 damage in one hit you will be given extra immunity frames\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 140\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 140\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; } public override void UpdateEquip(Player player) { player.Calamity().throwingDamage += 0.14f; player.Calamity().throwingCrit += 14; - player.moveSpeed += 0.18f; + player.moveSpeed += 0.18f; } public override void AddRecipes() diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs index df40a0186f..57c2649cf7 100644 --- a/Items/Armor/GodSlayerVisage.cs +++ b/Items/Armor/GodSlayerVisage.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("God Slayer Visage"); Tooltip.SetDefault("14% increased magic damage and critical strike chance\n" + - "+100 max mana and 17% reduced mana usage"); + "+100 max mana and 17% reduced mana usage"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 21; //96 - item.Calamity().postMoonLordRarity = 14; - } + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 21; //96 + item.Calamity().postMoonLordRarity = 14; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -47,11 +47,11 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.manaCost *= 0.83f; - player.magicDamage += 0.14f; + player.manaCost *= 0.83f; + player.magicDamage += 0.14f; player.magicCrit += 14; - player.statManaMax2 += 100; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { diff --git a/Items/Armor/HiveMindMask.cs b/Items/Armor/HiveMindMask.cs index b2b8102004..a029fd0db3 100644 --- a/Items/Armor/HiveMindMask.cs +++ b/Items/Armor/HiveMindMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class HiveMindMask : ModItem - { + public class HiveMindMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Mind Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/LeviathanMask.cs b/Items/Armor/LeviathanMask.cs index 83d6eb2bc0..8394b3fc2f 100644 --- a/Items/Armor/LeviathanMask.cs +++ b/Items/Armor/LeviathanMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class LeviathanMask : ModItem - { + public class LeviathanMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Leviathan Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/MolluskShelleggings.cs b/Items/Armor/MolluskShelleggings.cs index d84605f579..68aba9601c 100644 --- a/Items/Armor/MolluskShelleggings.cs +++ b/Items/Armor/MolluskShelleggings.cs @@ -1,34 +1,33 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Legs)] public class MolluskShelleggings : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk Shelleggings"); + { + DisplayName.SetDefault("Mollusk Shelleggings"); Tooltip.SetDefault("12% increased damage and 4% increased critical strike chance\n" + - "7% decreased movement speed"); - } + "7% decreased movement speed"); + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 22; item.height = 18; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.defense = 15; - } + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.defense = 15; + } public override void UpdateEquip(Player player) { - player.allDamage += 0.12f; - player.Calamity().AllCritBoost(4); - player.moveSpeed -= 0.07f; + player.allDamage += 0.12f; + player.Calamity().AllCritBoost(4); + player.moveSpeed -= 0.07f; } public override void AddRecipes() @@ -40,5 +39,5 @@ namespace CalamityMod.Items.Armor recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index 01e5ed9a4e..e342cacb4b 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -1,72 +1,72 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class MolluskShellmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk Shellmet"); - Tooltip.SetDefault("5% increased damage and 4% increased critical strike chance\n" + - "You can move freely through liquids"); - } + public class MolluskShellmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk Shellmet"); + Tooltip.SetDefault("5% increased damage and 4% increased critical strike chance\n" + + "You can move freely through liquids"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 22; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - item.defense = 18; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 22; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.defense = 18; + } - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.allDamage += 0.05f; - player.Calamity().AllCritBoost(4); - } + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.allDamage += 0.05f; + player.Calamity().AllCritBoost(4); + } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("MolluskShellplate") && legs.type == mod.ItemType("MolluskShelleggings"); - } + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("MolluskShellplate") && legs.type == mod.ItemType("MolluskShelleggings"); + } - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Two shellfishes aid you in combat\n" + - "10% increased damage\n" + - "Your horizontal movement is slowed"; - CalamityPlayer modPlayer = player.Calamity(); - player.allDamage += 0.1f; - modPlayer.molluskSet = true; - player.maxMinions += 4; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("Shellfish")) == -1) - { - player.AddBuff(mod.BuffType("Shellfish"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("Shellfish")] < 2) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Shellfish"), (int)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Two shellfishes aid you in combat\n" + + "10% increased damage\n" + + "Your horizontal movement is slowed"; + CalamityPlayer modPlayer = player.Calamity(); + player.allDamage += 0.1f; + modPlayer.molluskSet = true; + player.maxMinions += 4; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("Shellfish")) == -1) + { + player.AddBuff(mod.BuffType("Shellfish"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("Shellfish")] < 2) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Shellfish"), (int)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } player.Calamity().wearingRogueArmor = true; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("SeaPrism"), 15); - recipe.AddIngredient(mod.ItemType("MolluskHusk"), 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("SeaPrism"), 15); + recipe.AddIngredient(mod.ItemType("MolluskHusk"), 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/MolluskShellplate.cs b/Items/Armor/MolluskShellplate.cs index f3e023da63..01cf675627 100644 --- a/Items/Armor/MolluskShellplate.cs +++ b/Items/Armor/MolluskShellplate.cs @@ -1,35 +1,34 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Body)] public class MolluskShellplate : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk Shellplate"); + { + DisplayName.SetDefault("Mollusk Shellplate"); Tooltip.SetDefault("10% increased damage and 6% increased critical strike chance\n" + - "15% decreased movement speed"); - } + "15% decreased movement speed"); + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 30; item.height = 22; - item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = 5; - item.defense = 22; - } + item.value = Item.buyPrice(0, 20, 0, 0); + item.rare = 5; + item.defense = 22; + } public override void UpdateEquip(Player player) { - player.allDamage += 0.1f; - player.Calamity().AllCritBoost(6); - player.moveSpeed -= 0.15f; - } + player.allDamage += 0.1f; + player.Calamity().AllCritBoost(6); + player.moveSpeed -= 0.15f; + } public override void AddRecipes() { diff --git a/Items/Armor/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlueChestplate.cs index 037f67f22d..4a038ae27e 100644 --- a/Items/Armor/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlueChestplate.cs @@ -1,38 +1,38 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Body)] public class OmegaBlueChestplate : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Blue Chestplate"); + { + DisplayName.SetDefault("Omega Blue Chestplate"); Tooltip.SetDefault(@"12% increased damage and 8% increased critical strike chance Your attacks inflict Crush Depth No positive life regen"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 18; item.height = 18; - item.value = Item.sellPrice(0, 38, 0, 0); - item.rare = 10; - item.defense = 28; - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.sellPrice(0, 38, 0, 0); + item.rare = 10; + item.defense = 28; + item.Calamity().postMoonLordRarity = 13; + } public override void UpdateEquip(Player player) { - CalamityPlayer modPlayer = player.Calamity(); - player.allDamage += 0.12f; - modPlayer.AllCritBoost(8); - modPlayer.omegaBlueChestplate = true; - } + CalamityPlayer modPlayer = player.Calamity(); + player.allDamage += 0.12f; + modPlayer.AllCritBoost(8); + modPlayer.omegaBlueChestplate = true; + } public override void AddRecipes() { diff --git a/Items/Armor/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlueHelmet.cs index 9e2a989143..de0c3cd69c 100644 --- a/Items/Armor/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlueHelmet.cs @@ -2,39 +2,38 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] public class OmegaBlueHelmet : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Blue Helmet"); + { + DisplayName.SetDefault("Omega Blue Helmet"); Tooltip.SetDefault(@"You can move freely through liquids 12% increased damage and 8% increased critical strike chance +2 max minions"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 18; item.height = 18; - item.value = Item.sellPrice(0, 35, 0, 0); - item.rare = 10; - item.defense = 19; - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.sellPrice(0, 35, 0, 0); + item.rare = 10; + item.defense = 19; + item.Calamity().postMoonLordRarity = 13; + } public override void UpdateEquip(Player player) { player.ignoreWater = true; - player.allDamage += 0.12f; - player.Calamity().AllCritBoost(8); + player.allDamage += 0.12f; + player.Calamity().AllCritBoost(8); - player.maxMinions += 2; + player.maxMinions += 2; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -91,15 +90,15 @@ This effect has a 30 second cooldown"; } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("ReaperTooth"), 11); recipe.AddIngredient(mod.ItemType("Lumenite"), 5); recipe.AddIngredient(mod.ItemType("Tenebris"), 5); recipe.AddIngredient(mod.ItemType("RuinousSoul"), 2); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/OmegaBlueLeggings.cs b/Items/Armor/OmegaBlueLeggings.cs index 1574c454e4..eaa8c2c5b6 100644 --- a/Items/Armor/OmegaBlueLeggings.cs +++ b/Items/Armor/OmegaBlueLeggings.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -22,15 +21,15 @@ namespace CalamityMod.Items.Armor item.value = Item.sellPrice(0, 35, 25, 0); item.rare = 10; item.defense = 22; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void UpdateEquip(Player player) { - player.allDamage += 0.12f; - player.Calamity().AllCritBoost(8); + player.allDamage += 0.12f; + player.Calamity().AllCritBoost(8); - player.moveSpeed += 0.3f; + player.moveSpeed += 0.3f; } public override void AddRecipes() diff --git a/Items/Armor/PerforatorMask.cs b/Items/Armor/PerforatorMask.cs index c7864cf9ed..4b01e79184 100644 --- a/Items/Armor/PerforatorMask.cs +++ b/Items/Armor/PerforatorMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class PerforatorMask : ModItem - { + public class PerforatorMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Perforator Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/PlaguebringerGoliathMask.cs b/Items/Armor/PlaguebringerGoliathMask.cs index f1903a7f91..d6b57b972f 100644 --- a/Items/Armor/PlaguebringerGoliathMask.cs +++ b/Items/Armor/PlaguebringerGoliathMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class PlaguebringerGoliathMask : ModItem - { + public class PlaguebringerGoliathMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Goliath Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/ProvidenceMask.cs b/Items/Armor/ProvidenceMask.cs index faf7352bbe..336acca04e 100644 --- a/Items/Armor/ProvidenceMask.cs +++ b/Items/Armor/ProvidenceMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class ProvidenceMask : ModItem - { + public class ProvidenceMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Providence Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs index cca0e8e74a..0a1c7bd11f 100644 --- a/Items/Armor/ReaverCap.cs +++ b/Items/Armor/ReaverCap.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 22; item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; item.defense = 10; //43 } @@ -40,12 +39,12 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.reaverSpore = true; - modPlayer.rogueStealthMax = 1.15f; - player.setBonus = "5% increased rogue damage\n" + + modPlayer.rogueStealthMax = 1.15f; + player.setBonus = "5% increased rogue damage\n" + "You emit a cloud of spores when you are hit\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 115\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 115\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; player.Calamity().throwingDamage += 0.05f; player.Calamity().wearingRogueArmor = true; } diff --git a/Items/Armor/ReaverCuisses.cs b/Items/Armor/ReaverCuisses.cs index cc08780c7b..afa27cd47a 100644 --- a/Items/Armor/ReaverCuisses.cs +++ b/Items/Armor/ReaverCuisses.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -19,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 22; item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 18, 0, 0); + item.rare = 7; item.defense = 14; } diff --git a/Items/Armor/ReaverHelm.cs b/Items/Armor/ReaverHelm.cs index ff91fccfe5..3209a5aa70 100644 --- a/Items/Armor/ReaverHelm.cs +++ b/Items/Armor/ReaverHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 28; item.height = 30; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; item.defense = 25; //58 } diff --git a/Items/Armor/ReaverHelmet.cs b/Items/Armor/ReaverHelmet.cs index 1faa1e3265..d72d6cd937 100644 --- a/Items/Armor/ReaverHelmet.cs +++ b/Items/Armor/ReaverHelmet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 22; item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; item.defense = 3; //36 } diff --git a/Items/Armor/ReaverMask.cs b/Items/Armor/ReaverMask.cs index 027b958446..a5cfdf580d 100644 --- a/Items/Armor/ReaverMask.cs +++ b/Items/Armor/ReaverMask.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; item.defense = 7; //40 } @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Armor player.magicCrit += 5; player.manaCost *= 0.88f; player.moveSpeed += 0.1f; - player.statManaMax2 += 80; - } + player.statManaMax2 += 80; + } public override void AddRecipes() { diff --git a/Items/Armor/ReaverScaleMail.cs b/Items/Armor/ReaverScaleMail.cs index 925cfe0a08..65b7134c2b 100644 --- a/Items/Armor/ReaverScaleMail.cs +++ b/Items/Armor/ReaverScaleMail.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,17 +18,17 @@ namespace CalamityMod.Items.Armor { item.width = 34; item.height = 22; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 7; item.defense = 19; } public override void UpdateEquip(Player player) { player.statLifeMax2 += 20; - player.allDamage += 0.09f; - player.Calamity().AllCritBoost(4); - } + player.allDamage += 0.09f; + player.Calamity().AllCritBoost(4); + } public override void AddRecipes() { diff --git a/Items/Armor/ReaverVisage.cs b/Items/Armor/ReaverVisage.cs index e85438d661..1c21837236 100644 --- a/Items/Armor/ReaverVisage.cs +++ b/Items/Armor/ReaverVisage.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 24; item.height = 28; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; item.defense = 13; //46 } diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs index 6cd474c42d..1763766305 100644 --- a/Items/Armor/ShroomiteVisage.cs +++ b/Items/Armor/ShroomiteVisage.cs @@ -1,53 +1,53 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class ShroomiteVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shroomite Visage"); - Tooltip.SetDefault("25% increased ranged damage for flamethrowers"); - } + public class ShroomiteVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shroomite Visage"); + Tooltip.SetDefault("25% increased ranged damage for flamethrowers"); + } - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 11; //62 - } + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; + item.defense = 11; //62 + } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ItemID.ShroomiteBreastplate && legs.type == ItemID.ShroomiteLeggings; - } + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ItemID.ShroomiteBreastplate && legs.type == ItemID.ShroomiteLeggings; + } - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - player.shroomiteStealth = true; - player.setBonus = "Ranged stealth while standing still"; - } + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + player.shroomiteStealth = true; + player.setBonus = "Ranged stealth while standing still"; + } - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.flamethrowerBoost = true; - } + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.flamethrowerBoost = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShroomiteBar, 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ShroomiteBar, 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 00f71a1542..70b82a96e0 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -1,6 +1,5 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,18 +18,18 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 72, 0, 0); - item.defense = 44; - item.Calamity().postMoonLordRarity = 15; - } + item.value = Item.buyPrice(0, 72, 0, 0); + item.defense = 44; + item.Calamity().postMoonLordRarity = 15; + } public override void UpdateEquip(Player player) { player.statLifeMax2 += 80; player.moveSpeed += 0.2f; - player.allDamage += 0.12f; - player.Calamity().AllCritBoost(8); - } + player.allDamage += 0.12f; + player.Calamity().AllCritBoost(8); + } public override void AddRecipes() { @@ -38,10 +37,10 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "DarksunFragment", 10); recipe.AddIngredient(null, "EffulgentFeather", 10); recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "Tenebris", 12); - recipe.AddIngredient(null, "NightmareFuel", 16); + recipe.AddIngredient(null, "Tenebris", 12); + recipe.AddIngredient(null, "NightmareFuel", 16); recipe.AddIngredient(null, "EndothermicEnergy", 16); - recipe.AddIngredient(null, "LeadCore"); + recipe.AddIngredient(null, "LeadCore"); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs index 4cf426b225..55f613fd61 100644 --- a/Items/Armor/SilvaHelm.cs +++ b/Items/Armor/SilvaHelm.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 52; //110 - item.Calamity().postMoonLordRarity = 15; - } + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 52; //110 + item.Calamity().postMoonLordRarity = 15; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "True melee strikes have a 25% chance to do five times damage\n" + "After the silva invincibility is over you will take 20% less contact damage\n" + @@ -61,8 +61,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "DarksunFragment", 5); recipe.AddIngredient(null, "EffulgentFeather", 5); recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); recipe.AddIngredient(null, "EndothermicEnergy", 14); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index f46c623a9b..7f467770ce 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 13; //110 - item.Calamity().postMoonLordRarity = 15; - } + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 13; //110 + item.Calamity().postMoonLordRarity = 15; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Summons an ancient leaf prism to blast your enemies with life energy\n" + "After the silva invulnerability time your minions will deal 10% more damage and you will gain +2 max minions"; @@ -72,8 +72,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "DarksunFragment", 5); recipe.AddIngredient(null, "EffulgentFeather", 5); recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); recipe.AddIngredient(null, "EndothermicEnergy", 14); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs index fe8ced1149..b598b58b8c 100644 --- a/Items/Armor/SilvaHornedHelm.cs +++ b/Items/Armor/SilvaHornedHelm.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 36; //110 - item.Calamity().postMoonLordRarity = 15; - } + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 36; //110 + item.Calamity().postMoonLordRarity = 15; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Increases your rate of fire with all ranged weapons\n" + "During the silva invulnerability time your ranged weapons will do 40% more damage"; @@ -60,8 +60,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "DarksunFragment", 5); recipe.AddIngredient(null, "EffulgentFeather", 5); recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); recipe.AddIngredient(null, "EndothermicEnergy", 14); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index a785698eaf..f968d2b660 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.cs @@ -1,6 +1,5 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,17 +17,17 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 54, 0, 0); - item.defense = 39; - item.Calamity().postMoonLordRarity = 15; - } + item.value = Item.buyPrice(0, 54, 0, 0); + item.defense = 39; + item.Calamity().postMoonLordRarity = 15; + } public override void UpdateEquip(Player player) { player.moveSpeed += 0.45f; - player.allDamage += 0.12f; - player.Calamity().AllCritBoost(7); - } + player.allDamage += 0.12f; + player.Calamity().AllCritBoost(7); + } public override void AddRecipes() { @@ -36,8 +35,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "DarksunFragment", 7); recipe.AddIngredient(null, "EffulgentFeather", 7); recipe.AddIngredient(null, "CosmiliteBar", 7); - recipe.AddIngredient(null, "Tenebris", 9); - recipe.AddIngredient(null, "NightmareFuel", 15); + recipe.AddIngredient(null, "Tenebris", 9); + recipe.AddIngredient(null, "NightmareFuel", 15); recipe.AddIngredient(null, "EndothermicEnergy", 15); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index e8f40f2548..adbbb8ff3d 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.cs @@ -1,7 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,10 +17,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 30; //110 - item.Calamity().postMoonLordRarity = 15; - } + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 30; //110 + item.Calamity().postMoonLordRarity = 15; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -38,27 +37,27 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaThrowing = true; - modPlayer.rogueStealthMax = 1.5f; + modPlayer.rogueStealthMax = 1.5f; modPlayer.wearingRogueArmor = true; - player.setBonus = "You are immune to almost all debuffs\n" + + player.setBonus = "You are immune to almost all debuffs\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Rogue weapons have a faster throwing rate while you are above 50% life\n" + "After the silva invulnerability time your rogue weapons will do 10% more damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 150\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 150\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; } public override void UpdateEquip(Player player) { player.Calamity().throwingDamage += 0.13f; player.Calamity().throwingCrit += 13; - player.moveSpeed += 0.2f; + player.moveSpeed += 0.2f; } public override void AddRecipes() @@ -67,8 +66,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "DarksunFragment", 5); recipe.AddIngredient(null, "EffulgentFeather", 5); recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); recipe.AddIngredient(null, "EndothermicEnergy", 14); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index 6f5ba9b842..d23cde639a 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Silva Masked Cap"); Tooltip.SetDefault("13% increased magic damage and critical strike chance\n" + - "+100 max mana and 19% reduced mana usage"); + "+100 max mana and 19% reduced mana usage"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 21; //110 - item.Calamity().postMoonLordRarity = 15; - } + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 21; //110 + item.Calamity().postMoonLordRarity = 15; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits\n" + "After the silva invulnerability time your magic weapons will do 10% more damage"; @@ -51,11 +51,11 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.manaCost *= 0.81f; - player.magicDamage += 0.13f; + player.manaCost *= 0.81f; + player.magicDamage += 0.13f; player.magicCrit += 13; - player.statManaMax2 += 100; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { @@ -63,8 +63,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(null, "DarksunFragment", 5); recipe.AddIngredient(null, "EffulgentFeather", 5); recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); recipe.AddIngredient(null, "EndothermicEnergy", 14); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); diff --git a/Items/Armor/SirensHeart.cs b/Items/Armor/SirensHeart.cs index b4191d95f9..8208ac1dbd 100644 --- a/Items/Armor/SirensHeart.cs +++ b/Items/Armor/SirensHeart.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { diff --git a/Items/Armor/SirensHeartAlt.cs b/Items/Armor/SirensHeartAlt.cs index d6d5c8d766..996323fe60 100644 --- a/Items/Armor/SirensHeartAlt.cs +++ b/Items/Armor/SirensHeartAlt.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { diff --git a/Items/Armor/SlimeGodMask.cs b/Items/Armor/SlimeGodMask.cs index b6d1c3e500..02812caeef 100644 --- a/Items/Armor/SlimeGodMask.cs +++ b/Items/Armor/SlimeGodMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class SlimeGodMask : ModItem - { + public class SlimeGodMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Slime God Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/SlimeGodMask2.cs b/Items/Armor/SlimeGodMask2.cs index db2326116e..49a49658ab 100644 --- a/Items/Armor/SlimeGodMask2.cs +++ b/Items/Armor/SlimeGodMask2.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class SlimeGodMask2 : ModItem - { + public class SlimeGodMask2 : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Slime God Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index f9a04ae922..794ab1ef08 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -18,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 4; item.defense = 10; } diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index fba1c1ec2d..277afbd16f 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; item.defense = 5; //22 } @@ -44,8 +44,8 @@ namespace CalamityMod.Items.Armor player.magicDamage += 0.1f; player.magicCrit += 7; player.manaCost *= 0.9f; - player.statManaMax2 += 30; - } + player.statManaMax2 += 30; + } public override void AddRecipes() { diff --git a/Items/Armor/StatigelGreaves.cs b/Items/Armor/StatigelGreaves.cs index 7842229e03..d397b442f2 100644 --- a/Items/Armor/StatigelGreaves.cs +++ b/Items/Armor/StatigelGreaves.cs @@ -17,15 +17,15 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 4; item.defense = 8; } public override void UpdateEquip(Player player) { - player.allDamage += 0.05f; - player.moveSpeed += 0.05f; + player.allDamage += 0.05f; + player.moveSpeed += 0.05f; } public override void AddRecipes() diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index 47985415d6..47952a7d05 100644 --- a/Items/Armor/StatigelHeadgear.cs +++ b/Items/Armor/StatigelHeadgear.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; item.defense = 7; //25 } diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index e9ef53008b..4896a84200 100644 --- a/Items/Armor/StatigelHelm.cs +++ b/Items/Armor/StatigelHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; item.defense = 9; //27 } diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index 66f88e7dda..a0fb0fa9c4 100644 --- a/Items/Armor/StatigelHood.cs +++ b/Items/Armor/StatigelHood.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; item.defense = 4; //20 } diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 6cb21af2a9..d0b19ebb0d 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; item.defense = 6; //23 } @@ -34,13 +33,13 @@ namespace CalamityMod.Items.Armor { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 105\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 105\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; - modPlayer.rogueStealthMax = 1.05f; - player.doubleJumpSail = true; + modPlayer.rogueStealthMax = 1.05f; + player.doubleJumpSail = true; player.jumpBoost = true; player.Calamity().wearingRogueArmor = true; } @@ -50,7 +49,7 @@ namespace CalamityMod.Items.Armor player.Calamity().throwingAmmoCost66 = true; player.Calamity().throwingDamage += 0.1f; player.Calamity().throwingCrit += 7; - player.moveSpeed += 0.12f; + player.moveSpeed += 0.12f; } public override void AddRecipes() diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 17c9bbda8c..980492ed14 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -21,17 +20,17 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.lifeRegen = 2; - item.value = Item.buyPrice(0, 40, 0, 0); - item.defense = 37; - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 40, 0, 0); + item.defense = 37; + item.Calamity().postMoonLordRarity = 12; + } public override void UpdateEquip(Player player) { player.statLifeMax2 += 40; - player.allDamage += 0.1f; - player.Calamity().AllCritBoost(5); - } + player.allDamage += 0.1f; + player.Calamity().AllCritBoost(5); + } public override void AddRecipes() { diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs index e9cbc2fd1a..09fdc2fd5f 100644 --- a/Items/Armor/TarragonHelm.cs +++ b/Items/Armor/TarragonHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 33; //98 - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 33; //98 + item.Calamity().postMoonLordRarity = 12; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Armor player.meleeDamage += 0.1f; player.meleeCrit += 10; player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Cursed] = true; diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index 9cd9c4da7a..d7eb599c6f 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -22,10 +21,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 15; //98 - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 15; //98 + item.Calamity().postMoonLordRarity = 12; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -43,7 +42,7 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; - modPlayer.rogueStealthMax = 1.3f; + modPlayer.rogueStealthMax = 1.3f; modPlayer.wearingRogueArmor = true; player.setBonus = "Reduces enemy spawn rates\n" + "Increased heart pickup range\n" + @@ -51,19 +50,19 @@ namespace CalamityMod.Items.Armor "After every 25 rogue critical hits you will gain 5 seconds of damage immunity\n" + "This effect can only occur once every 30 seconds\n" + "While under the effects of a debuff you gain 10% increased rogue damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 130\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 130\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; } public override void UpdateEquip(Player player) { player.Calamity().throwingDamage += 0.1f; player.Calamity().throwingCrit += 10; - player.moveSpeed += 0.12f; + player.moveSpeed += 0.12f; player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Cursed] = true; diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs index d911e06915..198f16003f 100644 --- a/Items/Armor/TarragonHornedHelm.cs +++ b/Items/Armor/TarragonHornedHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 3; //98 - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 3; //98 + item.Calamity().postMoonLordRarity = 12; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -47,15 +47,15 @@ namespace CalamityMod.Items.Armor "Enemies have a chance to drop extra hearts on death\n" + "Summons a life aura around you that damages nearby enemies"; player.minionDamage += 0.55f; - player.maxMinions++; - } + player.maxMinions++; + } public override void UpdateEquip(Player player) { player.maxMinions += 3; player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Cursed] = true; diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs index e447d8b905..2d272acfaf 100644 --- a/Items/Armor/TarragonLeggings.cs +++ b/Items/Armor/TarragonLeggings.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -20,10 +19,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.defense = 32; - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 30, 0, 0); + item.defense = 32; + item.Calamity().postMoonLordRarity = 12; + } public override void UpdateEquip(Player player) { @@ -32,9 +31,9 @@ namespace CalamityMod.Items.Armor { player.moveSpeed += 0.15f; } - player.allDamage += 0.06f; - player.Calamity().AllCritBoost(6); - } + player.allDamage += 0.06f; + player.Calamity().AllCritBoost(6); + } public override void AddRecipes() { diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index aa814236bd..300861e756 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 10; //98 - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 10; //98 + item.Calamity().postMoonLordRarity = 12; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -52,13 +52,13 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.manaCost *= 0.85f; - player.magicDamage += 0.1f; + player.manaCost *= 0.85f; + player.magicDamage += 0.1f; player.magicCrit += 10; player.endurance += 0.05f; - player.lavaMax += 240; - player.statManaMax2 += 100; - player.ignoreWater = true; + player.lavaMax += 240; + player.statManaMax2 += 100; + player.ignoreWater = true; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Cursed] = true; diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs index e1bbc4149c..942bdf6dff 100644 --- a/Items/Armor/TarragonVisage.cs +++ b/Items/Armor/TarragonVisage.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 21; //98 - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 21; //98 + item.Calamity().postMoonLordRarity = 12; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Armor player.rangedDamage += 0.1f; player.rangedCrit += 10; player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; + player.lavaMax += 240; + player.ignoreWater = true; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Cursed] = true; diff --git a/Items/Armor/VictideBreastplate.cs b/Items/Armor/VictideBreastplate.cs index fa6437eb9f..424162e184 100644 --- a/Items/Armor/VictideBreastplate.cs +++ b/Items/Armor/VictideBreastplate.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -19,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 2; item.defense = 5; //9 } diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index 31c0f6fcae..88d015bdd9 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; item.defense = 3; //10 } @@ -35,14 +34,14 @@ namespace CalamityMod.Items.Armor "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; - modPlayer.rogueStealthMax = 1f; + modPlayer.rogueStealthMax = 1f; modPlayer.wearingRogueArmor = true; - player.ignoreWater = true; + player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.Calamity().throwingDamage += 0.1f; diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 2bdf2db8ee..4d972665b6 100644 --- a/Items/Armor/VictideHelm.cs +++ b/Items/Armor/VictideHelm.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; item.defense = 4; //11 } diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index dfb67413a5..af752b906c 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; item.defense = 1; //8 } diff --git a/Items/Armor/VictideLeggings.cs b/Items/Armor/VictideLeggings.cs index ffce97d8f6..a1c4aae9f6 100644 --- a/Items/Armor/VictideLeggings.cs +++ b/Items/Armor/VictideLeggings.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 2; item.defense = 4; //9 } diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index 78b3cb1e86..a6ef864c01 100644 --- a/Items/Armor/VictideMask.cs +++ b/Items/Armor/VictideMask.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; item.defense = 2; //9 } diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index c22e4a1543..e7747eb870 100644 --- a/Items/Armor/VictideVisage.cs +++ b/Items/Armor/VictideVisage.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; item.defense = 3; //10 } diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs index 476d797602..a2b3b3b053 100644 --- a/Items/Armor/WulfrumArmor.cs +++ b/Items/Armor/WulfrumArmor.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -18,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 1; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 1; item.defense = 2; } diff --git a/Items/Armor/WulfrumHeadgear.cs b/Items/Armor/WulfrumHeadgear.cs index 6101eb42bb..1b6a9b2de4 100644 --- a/Items/Armor/WulfrumHeadgear.cs +++ b/Items/Armor/WulfrumHeadgear.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; item.defense = 2; //7 } diff --git a/Items/Armor/WulfrumHelm.cs b/Items/Armor/WulfrumHelm.cs index 12d2c10944..95a4bebd45 100644 --- a/Items/Armor/WulfrumHelm.cs +++ b/Items/Armor/WulfrumHelm.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; item.defense = 3; //8 } diff --git a/Items/Armor/WulfrumHelmet.cs b/Items/Armor/WulfrumHelmet.cs index 7bfa0d0f5a..02584f18c2 100644 --- a/Items/Armor/WulfrumHelmet.cs +++ b/Items/Armor/WulfrumHelmet.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/WulfrumHood.cs b/Items/Armor/WulfrumHood.cs index 2f3e097c10..74156c5b61 100644 --- a/Items/Armor/WulfrumHood.cs +++ b/Items/Armor/WulfrumHood.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; item.defense = 1; //6 } diff --git a/Items/Armor/WulfrumLeggings.cs b/Items/Armor/WulfrumLeggings.cs index b2d2dd4022..16b6e3d377 100644 --- a/Items/Armor/WulfrumLeggings.cs +++ b/Items/Armor/WulfrumLeggings.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 25, 0); - item.rare = 1; + item.value = Item.buyPrice(0, 0, 25, 0); + item.rare = 1; item.defense = 1; } diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index db75ff49e2..c0375d49fe 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -18,8 +17,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; item.defense = 1; //6 } diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index eb456ebb12..266135cac7 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -20,8 +19,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 9; item.defense = 24; } diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 9e848f76ab..6af132dec8 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -1,8 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Armor { @@ -21,8 +20,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = 9; + item.value = Item.buyPrice(0, 40, 0, 0); + item.rare = 9; item.defense = 20; //71 } @@ -41,13 +40,13 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.xerocSet = true; - modPlayer.rogueStealthMax = 1.25f; - player.setBonus = "9% increased rogue damage and velocity\n" + + modPlayer.rogueStealthMax = 1.25f; + player.setBonus = "9% increased rogue damage and velocity\n" + "All projectile types have special effects on enemy hits\n" + "Imbued with cosmic wrath and rage when you are damaged\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 125\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and not moving, up to a max of 125\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) { player.AddBuff(BuffID.Wrath, 2); @@ -62,9 +61,9 @@ namespace CalamityMod.Items.Armor { player.Calamity().throwingDamage += 0.11f; player.Calamity().throwingCrit += 11; - player.moveSpeed += 0.22f; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; + player.moveSpeed += 0.22f; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Chilled] = true; diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index f4a497afd7..989253b435 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { @@ -21,8 +20,8 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = 9; + item.value = Item.buyPrice(0, 32, 0, 0); + item.rare = 9; item.defense = 27; } diff --git a/Items/Armor/YharonMask.cs b/Items/Armor/YharonMask.cs index 5f2b5568a1..5ca894b73a 100644 --- a/Items/Armor/YharonMask.cs +++ b/Items/Armor/YharonMask.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { [AutoloadEquip(EquipType.Head)] - public class YharonMask : ModItem - { + public class YharonMask : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Yharon Mask"); } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } - public override bool DrawHead() - { - return false; - } - } + public override bool DrawHead() + { + return false; + } + } } diff --git a/Items/Astrageldon/AstrageldonBag.cs b/Items/Astrageldon/AstrageldonBag.cs index 93e43fc0be..3e850ccdc0 100644 --- a/Items/Astrageldon/AstrageldonBag.cs +++ b/Items/Astrageldon/AstrageldonBag.cs @@ -1,57 +1,57 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; using CalamityMod.Utilities; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Astrageldon { - public class AstrageldonBag : ModItem - { - public override int BossBagNPC => mod.NPCType("Astrageldon"); + public class AstrageldonBag : ModItem + { + public override int BossBagNPC => mod.NPCType("Astrageldon"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } public override void OpenBossBag(Player player) { - player.TryGettingDevArmor(); + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("AstralJelly"), 12, 16); - DropHelper.DropItem(player, mod.ItemType("Stardust"), 30, 40); - DropHelper.DropItem(player, ItemID.FallenStar, 30, 50); + // Materials + DropHelper.DropItem(player, mod.ItemType("AstralJelly"), 12, 16); + DropHelper.DropItem(player, mod.ItemType("Stardust"), 30, 40); + DropHelper.DropItem(player, ItemID.FallenStar, 30, 50); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("Nebulash"), 4); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("Nebulash"), 4); - // Equipment - DropHelper.DropItemCondition(player, mod.ItemType("SquishyBeanMount"), CalamityWorld.revenge && NPC.downedMoonlord); + // Equipment + DropHelper.DropItemCondition(player, mod.ItemType("SquishyBeanMount"), CalamityWorld.revenge && NPC.downedMoonlord); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("AureusMask"), 7); + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("AureusMask"), 7); - // Other - DropHelper.DropItemCondition(player, mod.ItemType("StarlightFuelCell"), CalamityWorld.revenge); - DropHelper.DropItemChance(player, ItemID.HallowedKey, 5); - } - } + // Other + DropHelper.DropItemCondition(player, mod.ItemType("StarlightFuelCell"), CalamityWorld.revenge); + DropHelper.DropItemChance(player, ItemID.HallowedKey, 5); + } + } } diff --git a/Items/Astrageldon/AstralChunk.cs b/Items/Astrageldon/AstralChunk.cs index 31b6d0268e..7679a4234b 100644 --- a/Items/Astrageldon/AstralChunk.cs +++ b/Items/Astrageldon/AstralChunk.cs @@ -4,49 +4,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Astrageldon { - public class AstralChunk : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Chunk"); + public class AstralChunk : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Chunk"); Tooltip.SetDefault("Summons Astrum Aureus"); } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 7; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 7; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Astrageldon")); - } + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Astrageldon")); + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { if (Main.netMode != NetmodeID.MultiplayerClient) { int num = NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 50))), (int)(player.position.Y - 150f), mod.NPCType("Astrageldon"), 0, 0f, 0f, 0f, 0f, 255); Main.PlaySound(SoundID.Roar, player.position, 0); } - return true; - } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 15); - recipe.AddIngredient(ItemID.FallenStar, 10); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 15); + recipe.AddIngredient(ItemID.FallenStar, 10); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Astrageldon/AstralJelly.cs b/Items/Astrageldon/AstralJelly.cs index e438817325..68b8663f29 100644 --- a/Items/Astrageldon/AstralJelly.cs +++ b/Items/Astrageldon/AstralJelly.cs @@ -5,36 +5,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Astrageldon { public class AstralJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aureus Cell"); - Tooltip.SetDefault("Gives mana regeneration and magic power for 6 minutes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aureus Cell"); + Tooltip.SetDefault("Gives mana regeneration and magic power for 6 minutes"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.rare = 7; - item.useStyle = 2; - item.healMana = 200; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 4, 50, 0); - item.buffType = BuffID.WellFed; - item.buffTime = 108000; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 7; + item.useStyle = 2; + item.healMana = 200; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = Item.buyPrice(0, 4, 50, 0); + item.buffType = BuffID.WellFed; + item.buffTime = 108000; + } - public override void OnConsumeItem(Player player) - { - player.AddBuff(BuffID.ManaRegeneration, 21600); - player.AddBuff(BuffID.MagicPower, 21600); - player.AddBuff(BuffID.WellFed, 108000); - } - } + public override void OnConsumeItem(Player player) + { + player.AddBuff(BuffID.ManaRegeneration, 21600); + player.AddBuff(BuffID.MagicPower, 21600); + player.AddBuff(BuffID.WellFed, 108000); + } + } } diff --git a/Items/AstrumDeus/AstrumDeusBag.cs b/Items/AstrumDeus/AstrumDeusBag.cs index 9e03ce3939..f158de2c0e 100644 --- a/Items/AstrumDeus/AstrumDeusBag.cs +++ b/Items/AstrumDeus/AstrumDeusBag.cs @@ -1,53 +1,53 @@ +using CalamityMod.Utilities; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Items.AstrumDeus { - public class AstrumDeusBag : ModItem - { - public override int BossBagNPC => mod.NPCType("AstrumDeusHeadSpectral"); + public class AstrumDeusBag : ModItem + { + public override int BossBagNPC => mod.NPCType("AstrumDeusHeadSpectral"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("Stardust"), 60, 90); + // Materials + DropHelper.DropItem(player, mod.ItemType("Stardust"), 60, 90); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("Starfall"), 4); - DropHelper.DropItemChance(player, mod.ItemType("Quasar"), DropHelper.RareVariantDropRateInt); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("Starfall"), 4); + DropHelper.DropItemChance(player, mod.ItemType("Quasar"), DropHelper.RareVariantDropRateInt); - // Equipment - float f = Main.rand.NextFloat(); - bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance of getting Hide of Astrum Deus - DropHelper.DropItemCondition(player, mod.ItemType("AstralBulwark"), !replaceWithRare); - DropHelper.DropItemCondition(player, mod.ItemType("HideofAstrumDeus"), replaceWithRare); + // Equipment + float f = Main.rand.NextFloat(); + bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance of getting Hide of Astrum Deus + DropHelper.DropItemCondition(player, mod.ItemType("AstralBulwark"), !replaceWithRare); + DropHelper.DropItemCondition(player, mod.ItemType("HideofAstrumDeus"), replaceWithRare); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("AstrumDeusMask"), 7); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("AstrumDeusMask"), 7); + } + } } diff --git a/Items/AstrumDeus/Starcore.cs b/Items/AstrumDeus/Starcore.cs index 5d90c82d46..2df60c3e28 100644 --- a/Items/AstrumDeus/Starcore.cs +++ b/Items/AstrumDeus/Starcore.cs @@ -4,31 +4,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.AstrumDeus { - public class Starcore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starcore"); - Tooltip.SetDefault("May the stars guide your way\n" + + public class Starcore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starcore"); + Tooltip.SetDefault("May the stars guide your way\n" + "Summons Astrum Deus\n" + - "Not consumable"); - } + "Not consumable"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.rare = 9; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.rare = 9; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")) && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHeadSpectral")); - } + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")) && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHeadSpectral")); + } public override bool UseItem(Player player) { @@ -38,18 +38,18 @@ namespace CalamityMod.Items.AstrumDeus } NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHeadSpectral")); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 25); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 25); recipe.AddIngredient(null, "AstralJelly", 8); - recipe.AddIngredient(null, "AstralBar", 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddIngredient(null, "AstralBar", 4); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/BrimstoneKey.cs b/Items/BrimstoneKey.cs index 12f426bfbc..97db86910f 100644 --- a/Items/BrimstoneKey.cs +++ b/Items/BrimstoneKey.cs @@ -1,22 +1,21 @@ -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items { - public class BrimstoneKey : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Opens locked ashen chests"); - } + public class BrimstoneKey : ModItem + { + public override void SetStaticDefaults() + { + Tooltip.SetDefault("Opens locked ashen chests"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 1; - item.value = 100; - item.rare = 1; - } - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 1; + item.value = 100; + item.rare = 1; + } + } } diff --git a/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs index 740d676363..c1b03fc07b 100644 --- a/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs +++ b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs @@ -1,57 +1,57 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; using CalamityMod.Utilities; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.BrimstoneWaifu { - public class BrimstoneWaifuBag : ModItem - { - public override int BossBagNPC => mod.NPCType("BrimstoneElemental"); + public class BrimstoneWaifuBag : ModItem + { + public override int BossBagNPC => mod.NPCType("BrimstoneElemental"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, ItemID.SoulofFright, 25, 40); - DropHelper.DropItem(player, mod.ItemType("EssenceofChaos"), 5, 9); - DropHelper.DropItemCondition(player, mod.ItemType("Bloodstone"), CalamityWorld.downedProvidence, 25, 35); + // Materials + DropHelper.DropItem(player, ItemID.SoulofFright, 25, 40); + DropHelper.DropItem(player, mod.ItemType("EssenceofChaos"), 5, 9); + DropHelper.DropItemCondition(player, mod.ItemType("Bloodstone"), CalamityWorld.downedProvidence, 25, 35); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("Brimlance"), 3); - DropHelper.DropItemChance(player, mod.ItemType("SeethingDischarge"), 3); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("Brimlance"), 3); + DropHelper.DropItemChance(player, mod.ItemType("SeethingDischarge"), 3); - // Equipment - DropHelper.DropItem(player, mod.ItemType("Abaddon")); - DropHelper.DropItem(player, mod.ItemType("Gehenna")); - DropHelper.DropItemChance(player, mod.ItemType("RoseStone"), 10); - DropHelper.DropItemCondition(player, mod.ItemType("Brimrose"), CalamityWorld.revenge && CalamityWorld.downedProvidence); + // Equipment + DropHelper.DropItem(player, mod.ItemType("Abaddon")); + DropHelper.DropItem(player, mod.ItemType("Gehenna")); + DropHelper.DropItemChance(player, mod.ItemType("RoseStone"), 10); + DropHelper.DropItemCondition(player, mod.ItemType("Brimrose"), CalamityWorld.revenge && CalamityWorld.downedProvidence); - // Vanity - DropHelper.DropItemCondition(player, mod.ItemType("CharredRelic"), CalamityWorld.revenge); - } - } + // Vanity + DropHelper.DropItemCondition(player, mod.ItemType("CharredRelic"), CalamityWorld.revenge); + } + } } diff --git a/Items/BrimstoneWaifu/CharredIdol.cs b/Items/BrimstoneWaifu/CharredIdol.cs index 947e523eb0..9ebc782b95 100644 --- a/Items/BrimstoneWaifu/CharredIdol.cs +++ b/Items/BrimstoneWaifu/CharredIdol.cs @@ -1,52 +1,52 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.BrimstoneWaifu { - public class CharredIdol : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charred Idol"); - Tooltip.SetDefault("Use in the Brimstone Crag at your own risk\n" + - "Summons the Brimstone Elemental"); - } + public class CharredIdol : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Charred Idol"); + Tooltip.SetDefault("Use in the Brimstone Crag at your own risk\n" + + "Summons the Brimstone Elemental"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 6; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 6; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - return modPlayer.ZoneCalamity && !NPC.AnyNPCs(mod.NPCType("BrimstoneElemental")); - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + return modPlayer.ZoneCalamity && !NPC.AnyNPCs(mod.NPCType("BrimstoneElemental")); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BrimstoneElemental")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BrimstoneElemental")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(null, "EssenceofChaos", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(null, "EssenceofChaos", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/BrimstoneWaifu/Gehenna.cs b/Items/BrimstoneWaifu/Gehenna.cs index 4cd9ffd131..25a006090a 100644 --- a/Items/BrimstoneWaifu/Gehenna.cs +++ b/Items/BrimstoneWaifu/Gehenna.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.BrimstoneWaifu item.height = 26; item.value = Item.buyPrice(0, 15, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/BrimstoneWaifu/RoseStone.cs b/Items/BrimstoneWaifu/RoseStone.cs index b4cc06c94f..4c02943cb1 100644 --- a/Items/BrimstoneWaifu/RoseStone.cs +++ b/Items/BrimstoneWaifu/RoseStone.cs @@ -1,18 +1,18 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.BrimstoneWaifu { public class RoseStone : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rose Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases max life by 20, life regen by 1, and all damage by 3%\n" + - "Summons a brimstone elemental to fight for you"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rose Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases max life by 20, life regen by 1, and all damage by 3%\n" + + "Summons a brimstone elemental to fight for you"); + } public override void SetDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.BrimstoneWaifu item.height = 20; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; - item.accessory = true; + item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) @@ -34,24 +34,24 @@ namespace CalamityMod.Items.BrimstoneWaifu } public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.6f, 0f, 0.25f); - player.lifeRegen += 1; - player.statLifeMax2 += 20; - player.allDamage += 0.03f; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimstoneWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("BrimstoneWaifu")) == -1) - { - player.AddBuff(mod.BuffType("BrimstoneWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("BigBustyRose"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.6f, 0f, 0.25f); + player.lifeRegen += 1; + player.statLifeMax2 += 20; + player.allDamage += 0.03f; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.brimstoneWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("BrimstoneWaifu")) == -1) + { + player.AddBuff(mod.BuffType("BrimstoneWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("BigBustyRose"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } } } diff --git a/Items/Bumblefuck/BirbPheromones.cs b/Items/Bumblefuck/BirbPheromones.cs index 1aec093f73..82ea4137d5 100644 --- a/Items/Bumblefuck/BirbPheromones.cs +++ b/Items/Bumblefuck/BirbPheromones.cs @@ -5,45 +5,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Bumblefuck { public class BirbPheromones : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Birb Pheromones"); - Tooltip.SetDefault("Attracts the bumbling birb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Birb Pheromones"); + Tooltip.SetDefault("Attracts the bumbling birb"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 10; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 10; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Bumblefuck")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Bumblefuck")); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Bumblefuck")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Bumblefuck")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 3); - recipe.AddIngredient(ItemID.FragmentSolar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarBar, 3); + recipe.AddIngredient(ItemID.FragmentSolar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Bumblefuck/BumblebirbBag.cs b/Items/Bumblefuck/BumblebirbBag.cs index be0bc8658b..92844d746e 100644 --- a/Items/Bumblefuck/BumblebirbBag.cs +++ b/Items/Bumblefuck/BumblebirbBag.cs @@ -1,48 +1,48 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Items.Bumblefuck { - public class BumblebirbBag : ModItem - { - public override int BossBagNPC => mod.NPCType("Bumblefuck"); + public class BumblebirbBag : ModItem + { + public override int BossBagNPC => mod.NPCType("Bumblefuck"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("EffulgentFeather"), 9, 14); + // Materials + DropHelper.DropItem(player, mod.ItemType("EffulgentFeather"), 9, 14); - // Weapons - DropHelper.DropItemFromSet(player, mod.ItemType("GildedProboscis"), mod.ItemType("GoldenEagle"), mod.ItemType("RougeSlash")); - DropHelper.DropItemChance(player, mod.ItemType("Swordsplosion"), DropHelper.RareVariantDropRateInt); + // Weapons + DropHelper.DropItemFromSet(player, mod.ItemType("GildedProboscis"), mod.ItemType("GoldenEagle"), mod.ItemType("RougeSlash")); + DropHelper.DropItemChance(player, mod.ItemType("Swordsplosion"), DropHelper.RareVariantDropRateInt); - // Equipment - DropHelper.DropItemCondition(player, mod.ItemType("RedLightningContainer"), CalamityWorld.revenge); - } - } + // Equipment + DropHelper.DropItemCondition(player, mod.ItemType("RedLightningContainer"), CalamityWorld.revenge); + } + } } diff --git a/Items/Bumblefuck/EffulgentFeather.cs b/Items/Bumblefuck/EffulgentFeather.cs index 00a96bb8f0..d45e3eb045 100644 --- a/Items/Bumblefuck/EffulgentFeather.cs +++ b/Items/Bumblefuck/EffulgentFeather.cs @@ -5,22 +5,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Bumblefuck { public class EffulgentFeather : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Effulgent Feather"); - Tooltip.SetDefault("It vibrates with fluffy golden energy"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 12)); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Effulgent Feather"); + Tooltip.SetDefault("It vibrates with fluffy golden energy"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 12)); + } - public override void SetDefaults() - { - item.width = 24; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 6, 50, 0); - item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - } - } + public override void SetDefaults() + { + item.width = 24; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 6, 50, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 12; + } + } } diff --git a/Items/Calamitas/BlightedEyeball.cs b/Items/Calamitas/BlightedEyeball.cs index 482ee7720e..e38fe179f6 100644 --- a/Items/Calamitas/BlightedEyeball.cs +++ b/Items/Calamitas/BlightedEyeball.cs @@ -4,49 +4,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Calamitas { - public class BlightedEyeball : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of Desolation"); - Tooltip.SetDefault("Tonight is going to be a horrific night...\n" + + public class BlightedEyeball : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Desolation"); + Tooltip.SetDefault("Tonight is going to be a horrific night...\n" + "Summons Calamitas\n" + - "Not consumable"); - } + "Not consumable"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.rare = 6; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.rare = 6; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Calamitas")) && !NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); - } + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Calamitas")) && !NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Calamitas")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Calamitas")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HellstoneBar, 10); recipe.AddIngredient(null, "EssenceofChaos", 7); recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddIngredient(null, "BlightedLens", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddIngredient(null, "BlightedLens", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Calamitas/CalamitasBag.cs b/Items/Calamitas/CalamitasBag.cs index 28ef970149..f3a854078c 100644 --- a/Items/Calamitas/CalamitasBag.cs +++ b/Items/Calamitas/CalamitasBag.cs @@ -1,57 +1,57 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Items.Calamitas { - public class CalamitasBag : ModItem - { - public override int BossBagNPC => mod.NPCType("CalamitasRun3"); + public class CalamitasBag : ModItem + { + public override int BossBagNPC => mod.NPCType("CalamitasRun3"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("CalamityDust"), 14, 18); - DropHelper.DropItem(player, mod.ItemType("BlightedLens"), 1, 3); - DropHelper.DropItem(player, mod.ItemType("EssenceofChaos"), 5, 9); - DropHelper.DropItemCondition(player, mod.ItemType("Bloodstone"), CalamityWorld.downedProvidence, 35, 45); + // Materials + DropHelper.DropItem(player, mod.ItemType("CalamityDust"), 14, 18); + DropHelper.DropItem(player, mod.ItemType("BlightedLens"), 1, 3); + DropHelper.DropItem(player, mod.ItemType("EssenceofChaos"), 5, 9); + DropHelper.DropItemCondition(player, mod.ItemType("Bloodstone"), CalamityWorld.downedProvidence, 35, 45); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("TheEyeofCalamitas"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Animosity"), 3); - DropHelper.DropItemChance(player, mod.ItemType("CalamitasInferno"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BlightedEyeStaff"), 3); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("TheEyeofCalamitas"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Animosity"), 3); + DropHelper.DropItemChance(player, mod.ItemType("CalamitasInferno"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BlightedEyeStaff"), 3); - // Equipment - DropHelper.DropItem(player, mod.ItemType("CalamityRing")); - DropHelper.DropItemChance(player, mod.ItemType("ChaosStone"), 10); + // Equipment + DropHelper.DropItem(player, mod.ItemType("CalamityRing")); + DropHelper.DropItemChance(player, mod.ItemType("ChaosStone"), 10); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("CalamitasMask"), 7); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("CalamitasMask"), 7); + } + } } diff --git a/Items/Calamitas/CalamityDust.cs b/Items/Calamitas/CalamityDust.cs index 562a3e695f..717e9dfe00 100644 --- a/Items/Calamitas/CalamityDust.cs +++ b/Items/Calamitas/CalamityDust.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Calamitas item.width = 26; item.height = 20; item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 4, 50, 0); + item.rare = 7; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Calamitas/CalamityRing.cs b/Items/Calamitas/CalamityRing.cs index 6af8404083..faadba1ba1 100644 --- a/Items/Calamitas/CalamityRing.cs +++ b/Items/Calamitas/CalamityRing.cs @@ -1,8 +1,8 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Calamitas { @@ -38,8 +38,8 @@ namespace CalamityMod.Items.Calamitas { CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; - player.allDamage += 0.15f; - player.endurance -= 0.3f; + player.allDamage += 0.15f; + player.endurance -= 0.3f; if (player.whoAmI == Main.myPlayer) { if (player.immune) diff --git a/Items/Calamitas/ChaosStone.cs b/Items/Calamitas/ChaosStone.cs index 1b39a50691..949defe670 100644 --- a/Items/Calamitas/ChaosStone.cs +++ b/Items/Calamitas/ChaosStone.cs @@ -6,13 +6,13 @@ namespace CalamityMod.Items.Calamitas { public class ChaosStone : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases max mana by 50, all damage by 3%, and reduces mana usage by 5%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases max mana by 50, all damage by 3%, and reduces mana usage by 5%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + } public override void SetDefaults() { @@ -20,15 +20,15 @@ namespace CalamityMod.Items.Calamitas item.height = 20; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; - item.accessory = true; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.85f, 0f, 0f); - player.statManaMax2 += 50; - player.manaCost *= 0.95f; - player.allDamage += 0.03f; - } + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.85f, 0f, 0f); + player.statManaMax2 += 50; + player.manaCost *= 0.95f; + player.allDamage += 0.03f; + } } } diff --git a/Items/CalamityCustomThrowingDamage/AccretionDisk.cs b/Items/CalamityCustomThrowingDamage/AccretionDisk.cs index be82ba8906..a3fa0ff41a 100644 --- a/Items/CalamityCustomThrowingDamage/AccretionDisk.cs +++ b/Items/CalamityCustomThrowingDamage/AccretionDisk.cs @@ -6,45 +6,45 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class AccretionDisk : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Disk"); - Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Disk"); + Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); + } - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = 157; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.height = 38; + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = 157; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.height = 38; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("AccretionDisk"); - item.shootSpeed = 13f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 13f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MangroveChakram"); - recipe.AddIngredient(null, "FlameScythe"); - recipe.AddIngredient(null, "SeashellBoomerang"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MangroveChakram"); + recipe.AddIngredient(null, "FlameScythe"); + recipe.AddIngredient(null, "SeashellBoomerang"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs index 52596d972c..ed16111d6b 100644 --- a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs +++ b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs @@ -5,40 +5,40 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class AdamantiteThrowingAxe : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Adamantite Throwing Axe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Adamantite Throwing Axe"); + } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 44; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 3.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1600; - item.rare = 4; - item.shoot = mod.ProjectileType("AdamantiteThrowingAxeProjectile"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 44; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 3.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = 1600; + item.rare = 4; + item.shoot = mod.ProjectileType("AdamantiteThrowingAxeProjectile"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 25); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 25); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs index d8783a00e9..e524ae75d5 100644 --- a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs +++ b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs @@ -6,31 +6,31 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class BallisticPoisonBomb : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ballistic Poison Bomb"); - Tooltip.SetDefault("Throws a sticky bomb that explodes into spikes and poison clouds"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ballistic Poison Bomb"); + Tooltip.SetDefault("Throws a sticky bomb that explodes into spikes and poison clouds"); + } - public override void SafeSetDefaults() - { - item.width = 30; - item.damage = 55; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; + public override void SafeSetDefaults() + { + item.width = 30; + item.damage = 55; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 38; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.shoot = mod.ProjectileType("BallisticPoisonBomb"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("BallisticPoisonBomb"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/BlastBarrel.cs b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs index 13d4da7a28..c19e36901a 100644 --- a/Items/CalamityCustomThrowingDamage/BlastBarrel.cs +++ b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs @@ -1,47 +1,45 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles.Rogue; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class BlastBarrel : CalamityDamageItem { public const int BaseDamage = 71; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast Barrel"); - Tooltip.SetDefault("Throws a rolling barrel that explodes on wall collision\n" + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast Barrel"); + Tooltip.SetDefault("Throws a rolling barrel that explodes on wall collision\n" + "Stealth Strike Effect: Bounces three times instead of dying. Various effects occur the more it bounces"); - } + } - public override void SafeSetDefaults() - { - item.width = 48; + public override void SafeSetDefaults() + { + item.width = 48; item.height = 48; item.damage = BaseDamage; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; item.useAnimation = 22; item.useTime = 22; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.value = Item.buyPrice(0, 25, 0, 0); //5 gold sellprice item.rare = 4; - item.shoot = mod.ProjectileType("BlastBarrelProjectile"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("BlastBarrelProjectile"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { speedY *= 0.7f; //since the barrel is heavy Vector2 initialVelocity = new Vector2(speedX, speedY); //unitY additive is do it doesn't exploe initially - int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type,damage,knockBack,player.whoAmI); + int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type, damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable()) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs b/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs index c22d2b6bab..06f80a9718 100644 --- a/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs +++ b/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs @@ -7,34 +7,34 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class BloodsoakedCrasher : CalamityDamageItem //This weapon has been coded by Achilles|Termi|Ben { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodsoaked Crasher"); - Tooltip.SetDefault("Slows down when hitting an enemy. Speeds up otherwise\n" + - "Heals on enemy hits\n" + - "Stealth strikes spawn homing blood on enemy hits"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodsoaked Crasher"); + Tooltip.SetDefault("Slows down when hitting an enemy. Speeds up otherwise\n" + + "Heals on enemy hits\n" + + "Stealth strikes spawn homing blood on enemy hits"); + } - public override void SafeSetDefaults() - { - item.width = 66; - item.damage = 400; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; + public override void SafeSetDefaults() + { + item.width = 66; + item.damage = 400; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 64; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 13; - item.shoot = mod.ProjectileType("BloodsoakedCrashax"); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - } + item.Calamity().postMoonLordRarity = 13; + item.shoot = mod.ProjectileType("BloodsoakedCrashax"); + item.shootSpeed = 15f; + item.Calamity().rogue = true; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -45,16 +45,16 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage return false; } return true; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); //post-Prov rogue weapon - recipe.AddIngredient(mod.ItemType("CrushsawCrasher"), 1); - recipe.AddIngredient(mod.ItemType("BloodstoneCore"), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); //post-Prov rogue weapon + recipe.AddIngredient(mod.ItemType("CrushsawCrasher"), 1); + recipe.AddIngredient(mod.ItemType("BloodstoneCore"), 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs index 2c3cd7a4c7..f65ee2a40c 100644 --- a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs +++ b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs @@ -1,39 +1,36 @@ -using CalamityMod; -using CalamityMod.Items; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { - public class BouncingEyeball : CalamityDamageItem + public class BouncingEyeball : CalamityDamageItem { public const int BaseDamage = 12; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bouncing Eyeball"); - Tooltip.SetDefault("Throws an eyeball that bounces off of surfaces.\n" + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bouncing Eyeball"); + Tooltip.SetDefault("Throws an eyeball that bounces off of surfaces.\n" + "Knockback is much stronger during a blood moon\n" + "Stealth Strike Effect: Eyeballs move much faster and bounce more energetically"); - } - public override void SafeSetDefaults() - { - item.damage = BaseDamage; + } + public override void SafeSetDefaults() + { + item.damage = BaseDamage; item.width = 26; - item.height = 26; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 3.5f; + item.height = 26; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = ItemUseStyleID.SwingThrow; + item.knockBack = 3.5f; item.rare = 1; item.Calamity().rogue = true; item.noUseGraphic = true; - item.UseSound = SoundID.Item1; + item.UseSound = SoundID.Item1; item.shoot = mod.ProjectileType("BouncingEyeballProjectile"); item.shootSpeed = 10f; item.autoReuse = true; - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { bool bloodMoon = Main.bloodMoon; @@ -45,7 +42,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage if (player.Calamity().StealthStrikeAvailable()) { initialVelocity *= 2f; - int p = Projectile.NewProjectile(position, initialVelocity, mod.ProjectileType("BouncingEyeballProjectileStealthStrike"),damage,knockBack,player.whoAmI); + int p = Projectile.NewProjectile(position, initialVelocity, mod.ProjectileType("BouncingEyeballProjectileStealthStrike"), damage, knockBack, player.whoAmI); Main.projectile[p].Calamity().stealthStrike = true; } else diff --git a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs index 20b4decf0b..504f031000 100644 --- a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs +++ b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("BrackishFlask"); item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/Brimblade.cs b/Items/CalamityCustomThrowingDamage/Brimblade.cs index c2fe486935..ce7375afa5 100644 --- a/Items/CalamityCustomThrowingDamage/Brimblade.cs +++ b/Items/CalamityCustomThrowingDamage/Brimblade.cs @@ -6,39 +6,39 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Brimblade : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimblade"); - Tooltip.SetDefault("Throws a blade that splits on enemy hits"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimblade"); + Tooltip.SetDefault("Throws a blade that splits on enemy hits"); + } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 32; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.height = 26; + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 32; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.height = 26; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; - item.shoot = mod.ProjectileType("Brimblade"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("Brimblade"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 4); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs index 83718b51de..116617c3d3 100644 --- a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs +++ b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs @@ -6,73 +6,73 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public abstract class CalamityDamageItem : ModItem - { - public virtual void SafeSetDefaults() - { - } + { + public virtual void SafeSetDefaults() + { + } - public sealed override void SetDefaults() - { - SafeSetDefaults(); - item.melee = false; - item.ranged = false; - item.magic = false; - item.thrown = true; - item.summon = false; - } + public sealed override void SetDefaults() + { + SafeSetDefaults(); + item.melee = false; + item.ranged = false; + item.magic = false; + item.thrown = true; + item.summon = false; + } - // 5E-06 to prevent downrounding is not needed anymore, added by TML itself - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - add += player.Calamity().throwingDamage - 1f; - } + // 5E-06 to prevent downrounding is not needed anymore, added by TML itself + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + add += player.Calamity().throwingDamage - 1f; + } - // Calculates a rogue weapon's crit chance using the player's rogue crit chance. - public override void GetWeaponCrit(Player player, ref int crit) - { - crit = (item.crit + player.Calamity().throwingCrit); - } + // Calculates a rogue weapon's crit chance using the player's rogue crit chance. + public override void GetWeaponCrit(Player player, ref int crit) + { + crit = (item.crit + player.Calamity().throwingCrit); + } - // Not needed because the weapon is now internally thrown instead of ranged - /* - public override void GetWeaponKnockback(Player player, ref float knockback) - { - if (player.shroomiteStealth) - { - knockback /= 1f + (1f - player.stealth) * 0.5f; - } - if (player.setVortex) - { - knockback /= 1f + (1f - player.stealth) * 0.5f; - } - } - */ + // Not needed because the weapon is now internally thrown instead of ranged + /* + public override void GetWeaponKnockback(Player player, ref float knockback) + { + if (player.shroomiteStealth) + { + knockback /= 1f + (1f - player.stealth) * 0.5f; + } + if (player.setVortex) + { + knockback /= 1f + (1f - player.stealth) * 0.5f; + } + } + */ - public override void ModifyTooltips(List tooltips) - { - TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); - if (tt != null) - { - string[] splitText = tt.text.Split(' '); - string damageValue = splitText.First(); - string damageWord = splitText.Last(); - tt.text = damageValue + " rogue " + damageWord; - } - } + public override void ModifyTooltips(List tooltips) + { + TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); + if (tt != null) + { + string[] splitText = tt.text.Split(' '); + string damageValue = splitText.First(); + string damageWord = splitText.Last(); + tt.text = damageValue + " rogue " + damageWord; + } + } - public override bool ConsumeItem(Player player) - { - if (player.Calamity().throwingAmmoCost50) - { - if (Main.rand.Next(1, 101) > 50) - return false; - } - if (player.Calamity().throwingAmmoCost66) - { - if (Main.rand.Next(1, 101) > 66) - return false; - } - return true; - } - } + public override bool ConsumeItem(Player player) + { + if (player.Calamity().throwingAmmoCost50) + { + if (Main.rand.Next(1, 101) > 50) + return false; + } + if (player.Calamity().throwingAmmoCost66) + { + if (Main.rand.Next(1, 101) > 66) + return false; + } + return true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs index 2353a80720..01e28501df 100644 --- a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs +++ b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { @@ -25,17 +24,17 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.useAnimation = 31; item.useTime = 31; item.noMelee = true; - item.noUseGraphic = true; + item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; + item.knockBack = 6f; item.rare = 10; item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.value = Item.buyPrice(platinum:2); //sell price of 40 gold - item.shoot = mod.ProjectileType("CelestialReaperProjectile"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - } + item.autoReuse = true; + item.value = Item.buyPrice(platinum: 2); //sell price of 40 gold + item.shoot = mod.ProjectileType("CelestialReaperProjectile"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 velocity = new Vector2(speedX, speedY); diff --git a/Items/CalamityCustomThrowingDamage/Celestus.cs b/Items/CalamityCustomThrowingDamage/Celestus.cs index b05f09e65c..924f6deaf9 100644 --- a/Items/CalamityCustomThrowingDamage/Celestus.cs +++ b/Items/CalamityCustomThrowingDamage/Celestus.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Celestus"); - Tooltip.SetDefault("Throws a scythe that splits into multiple scythes on enemy hits"); - } + Tooltip.SetDefault("Throws a scythe that splits into multiple scythes on enemy hits"); + } public override void SafeSetDefaults() { @@ -29,9 +29,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("Celestus"); item.shootSpeed = 25f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 15; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 15; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs index aace887e85..f546d71b91 100644 --- a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs +++ b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs @@ -5,40 +5,40 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class CobaltKunai : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cobalt Kunai"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cobalt Kunai"); + } - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 36; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; - item.maxStack = 999; - item.value = 900; - item.rare = 4; - item.shoot = mod.ProjectileType("CobaltKunaiProjectile"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 36; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 40; + item.maxStack = 999; + item.value = 900; + item.rare = 4; + item.shoot = mod.ProjectileType("CobaltKunaiProjectile"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CobaltBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 30); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CobaltBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 30); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs index cf3b635778..9b7900f63e 100644 --- a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs +++ b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs @@ -24,22 +24,22 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.useAnimation = 29; item.useTime = 29; item.noMelee = true; - item.noUseGraphic = true; + item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.5f; + item.knockBack = 4.5f; item.rare = 6; item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.value = Item.buyPrice(gold:50); //sell price of 10 gold - item.shoot = mod.ProjectileType("ConsecratedWaterProjectile"); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - } + item.autoReuse = true; + item.value = Item.buyPrice(gold: 50); //sell price of 10 gold + item.shoot = mod.ProjectileType("ConsecratedWaterProjectile"); + item.shootSpeed = 15f; + item.Calamity().rogue = true; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 velocity = new Vector2(speedX, speedY); float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true - int p = Projectile.NewProjectile(position, velocity, mod.ProjectileType("ConsecratedWaterProjectile"), damage, knockBack, player.whoAmI, ai1:strikeValue); + int p = Projectile.NewProjectile(position, velocity, mod.ProjectileType("ConsecratedWaterProjectile"), damage, knockBack, player.whoAmI, ai1: strikeValue); if (player.Calamity().StealthStrikeAvailable()) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/CalamityCustomThrowingDamage/CosmicKunai.cs b/Items/CalamityCustomThrowingDamage/CosmicKunai.cs index ea4a713c94..1998525cc8 100644 --- a/Items/CalamityCustomThrowingDamage/CosmicKunai.cs +++ b/Items/CalamityCustomThrowingDamage/CosmicKunai.cs @@ -3,40 +3,40 @@ using Terraria.ID; namespace CalamityMod.Items.CalamityCustomThrowingDamage { - public class CosmicKunai : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Kunai"); - Tooltip.SetDefault("Fires a stream of short-range kunai"); - } + public class CosmicKunai : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Kunai"); + Tooltip.SetDefault("Fires a stream of short-range kunai"); + } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 150; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 2; - item.useAnimation = 10; - item.useStyle = 1; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("CosmicKunai"); - item.shootSpeed = 28f; - item.rare = 9; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 13; - } + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 150; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 2; + item.useAnimation = 10; + item.useStyle = 1; + item.knockBack = 5f; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.height = 48; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("CosmicKunai"); + item.shootSpeed = 28f; + item.rare = 9; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs b/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs index 67499d85ea..ee5127fa5c 100644 --- a/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs +++ b/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs @@ -5,45 +5,45 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class CraniumSmasher : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cranium Smasher"); - Tooltip.SetDefault("Throws disks that roll on the ground, occasionally launches an explosive disk"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cranium Smasher"); + Tooltip.SetDefault("Throws disks that roll on the ground, occasionally launches an explosive disk"); + } - public override void SafeSetDefaults() - { - item.width = 50; - item.height = 50; - item.damage = 140; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; + public override void SafeSetDefaults() + { + item.width = 50; + item.height = 50; + item.damage = 140; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("CraniumSmasher"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("CraniumSmasher"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (Main.rand.Next(0, 5) == 0) - { - damage = (int)(damage * 1.25f); - type = mod.ProjectileType("CraniumSmasherExplosive"); - } - else - { - type = mod.ProjectileType("CraniumSmasher"); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (Main.rand.Next(0, 5) == 0) + { + damage = (int)(damage * 1.25f); + type = mod.ProjectileType("CraniumSmasherExplosive"); + } + else + { + type = mod.ProjectileType("CraniumSmasher"); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs index 25a6b0dd0a..4c6deb7bb1 100644 --- a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs +++ b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Crushsaw Crasher"); - Tooltip.SetDefault("Throws bouncing axes"); - } + Tooltip.SetDefault("Throws bouncing axes"); + } public override void SafeSetDefaults() { @@ -26,8 +26,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("Crushax"); item.shootSpeed = 11f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { diff --git a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs index a97371f27a..ffad24640a 100644 --- a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs +++ b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs @@ -5,40 +5,40 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class CrystalPiercer : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Piercer"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Piercer"); + } - public override void SafeSetDefaults() - { - item.width = 62; - item.damage = 52; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = 1; - item.useTime = 17; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.maxStack = 999; - item.value = 2500; - item.rare = 5; - item.shoot = mod.ProjectileType("CrystalPiercerProjectile"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 62; + item.damage = 52; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 17; + item.useStyle = 1; + item.useTime = 17; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.maxStack = 999; + item.value = 2500; + item.rare = 5; + item.shoot = mod.ProjectileType("CrystalPiercerProjectile"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 20); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 20); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Crystalline.cs b/Items/CalamityCustomThrowingDamage/Crystalline.cs index 14732561bd..c1eb3ae30c 100644 --- a/Items/CalamityCustomThrowingDamage/Crystalline.cs +++ b/Items/CalamityCustomThrowingDamage/Crystalline.cs @@ -6,42 +6,42 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Crystalline : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystalline"); - Tooltip.SetDefault("Splits into several projectiles as it travels"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystalline"); + Tooltip.SetDefault("Splits into several projectiles as it travels"); + } - public override void SafeSetDefaults() - { - item.width = 44; - item.damage = 18; - item.crit += 4; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 18; + item.crit += 4; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.shoot = mod.ProjectileType("Crystalline"); - item.shootSpeed = 10f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("Crystalline"); + item.shootSpeed = 10f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumKnife", 50); - recipe.AddIngredient(ItemID.Diamond, 3); - recipe.AddIngredient(ItemID.FallenStar, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumKnife", 50); + recipe.AddIngredient(ItemID.Diamond, 3); + recipe.AddIngredient(ItemID.FallenStar, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/CursedDagger.cs b/Items/CalamityCustomThrowingDamage/CursedDagger.cs index 0c3d055534..762b6810ab 100644 --- a/Items/CalamityCustomThrowingDamage/CursedDagger.cs +++ b/Items/CalamityCustomThrowingDamage/CursedDagger.cs @@ -5,30 +5,30 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class CursedDagger : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cursed Dagger"); - Tooltip.SetDefault("Throws bouncing daggers"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed Dagger"); + Tooltip.SetDefault("Throws bouncing daggers"); + } - public override void SafeSetDefaults() - { - item.width = 34; - item.damage = 34; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 16; - item.useStyle = 1; - item.useTime = 16; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 34; + public override void SafeSetDefaults() + { + item.width = 34; + item.damage = 34; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 16; + item.useStyle = 1; + item.useTime = 16; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 34; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("CursedDagger"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } - } + item.shoot = mod.ProjectileType("CursedDagger"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs b/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs index 4431561fd2..64bd3121c4 100644 --- a/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs +++ b/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("DuststormInABottle"); item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs index 4fc3409269..cb454e4753 100644 --- a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs +++ b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs @@ -1,69 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; -using CalamityMod; -using static CalamityMod.CalPlayer.CalamityPlayer; namespace CalamityMod.Items.CalamityCustomThrowingDamage { - public class EclipsesFall : CalamityDamageItem + public class EclipsesFall : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse's Fall"); - Tooltip.SetDefault("Summons spears from the sky on hit\n" + - "Stealth strikes impale enemies and summon a constant barrage of spears"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse's Fall"); + Tooltip.SetDefault("Summons spears from the sky on hit\n" + + "Stealth strikes impale enemies and summon a constant barrage of spears"); + } - public override void SafeSetDefaults() - { - item.width = 72; - item.damage = 1800; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; + public override void SafeSetDefaults() + { + item.width = 72; + item.damage = 1800; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 14; - item.shoot = mod.ProjectileType("EclipsesFallMain"); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - } + item.Calamity().postMoonLordRarity = 14; + item.shoot = mod.ProjectileType("EclipsesFallMain"); + item.shootSpeed = 15f; + item.Calamity().rogue = true; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.Calamity().StealthStrikeAvailable()) - { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("EclipsesStealth"), damage, knockBack, player.whoAmI, 0f, 0f); + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("EclipsesStealth"), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[p].Calamity().stealthStrike = true; } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DayBreak, 1); - recipe.AddIngredient(mod.ItemType("DarksunFragment"), 15); - recipe.AddIngredient(mod.ItemType("CoreofCinder"), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DayBreak, 1); + recipe.AddIngredient(mod.ItemType("DarksunFragment"), 15); + recipe.AddIngredient(mod.ItemType("CoreofCinder"), 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs index 01cb29b2d7..ed8c7ee3f3 100644 --- a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs +++ b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Empyrean Knives"); - Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); - } + Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); + } public override void SafeSetDefaults() { @@ -31,9 +31,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("EmpyreanKnives"); item.shootSpeed = 15f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/CalamityCustomThrowingDamage/Eradicator.cs b/Items/CalamityCustomThrowingDamage/Eradicator.cs index 27cdaf5511..10e60daf2a 100644 --- a/Items/CalamityCustomThrowingDamage/Eradicator.cs +++ b/Items/CalamityCustomThrowingDamage/Eradicator.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Eradicator"); - Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); - } + Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); + } public override void SafeSetDefaults() { @@ -30,14 +30,14 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("EradicatorProjectile"); item.shootSpeed = 12f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Items/CalamityCustomThrowingDamage/EradicatorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Items/CalamityCustomThrowingDamage/EradicatorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs b/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs index 0ba30879ff..6d861fa92a 100644 --- a/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs +++ b/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs @@ -1,60 +1,60 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class ExecutionersBlade : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Executioner's Blade"); - Tooltip.SetDefault("Throws a stream of homing blades"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Executioner's Blade"); + Tooltip.SetDefault("Throws a stream of homing blades"); + } - public override void SafeSetDefaults() - { - item.width = 64; - item.damage = 550; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 3; - item.useAnimation = 9; - item.useStyle = 1; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.height = 64; + public override void SafeSetDefaults() + { + item.width = 64; + item.damage = 550; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 3; + item.useAnimation = 9; + item.useStyle = 1; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item73; + item.autoReuse = true; + item.height = 64; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("ExecutionersBlade"); - item.shootSpeed = 26f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 14; - } + item.shootSpeed = 26f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(32f, 30f); - spriteBatch.Draw(mod.GetTexture("Items/CalamityCustomThrowingDamage/ExecutionersBladeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(32f, 30f); + spriteBatch.Draw(mod.GetTexture("Items/CalamityCustomThrowingDamage/ExecutionersBladeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 11); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 11); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 11); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 11); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs index 8e3440780e..f79314364a 100644 --- a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs +++ b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs @@ -5,40 +5,40 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class FeatherKnife : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather Knife"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather Knife"); + } - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 24; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = 1; - item.useTime = 11; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 32; - item.maxStack = 999; - item.value = 300; - item.rare = 3; - item.shoot = mod.ProjectileType("FeatherKnifeProjectile"); - item.shootSpeed = 14f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 24; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 11; + item.useStyle = 1; + item.useTime = 11; + item.knockBack = 2f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 32; + item.maxStack = 999; + item.value = 300; + item.rare = 3; + item.shoot = mod.ProjectileType("FeatherKnifeProjectile"); + item.shootSpeed = 14f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar"); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this, 30); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar"); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this, 30); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/FlameScythe.cs b/Items/CalamityCustomThrowingDamage/FlameScythe.cs index 60657dc6b0..1361e2f32c 100644 --- a/Items/CalamityCustomThrowingDamage/FlameScythe.cs +++ b/Items/CalamityCustomThrowingDamage/FlameScythe.cs @@ -6,39 +6,39 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class FlameScythe : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame Scythe"); - Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame Scythe"); + Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); + } - public override void SafeSetDefaults() - { - item.width = 50; - item.damage = 130; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.height = 48; + public override void SafeSetDefaults() + { + item.width = 50; + item.damage = 130; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.height = 48; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("FlameScytheProjectile"); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("FlameScytheProjectile"); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs index c09712950f..a2fb0a09a4 100644 --- a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs +++ b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs @@ -5,20 +5,20 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class FrostyFlare : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frosty Flare"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frosty Flare"); Tooltip.SetDefault("Sticks to enemies\n" + - "Generates a localized hailstorm\n'Do not insert in flare gun'"); + "Generates a localized hailstorm\n'Do not insert in flare gun'"); } - public override void SafeSetDefaults() - { - item.damage = 32; + public override void SafeSetDefaults() + { + item.damage = 32; item.noUseGraphic = true; item.noMelee = true; - item.width = 10; - item.height = 22; + item.width = 10; + item.height = 22; item.useTime = 16; item.useAnimation = 16; item.useStyle = 1; @@ -26,13 +26,13 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.UseSound = SoundID.Item1; item.autoReuse = true; item.knockBack = 2f; - item.value = Item.buyPrice(0, 0, 5, 0); + item.value = Item.buyPrice(0, 0, 5, 0); item.rare = 5; - item.shoot = mod.ProjectileType("FrostyFlare"); + item.shoot = mod.ProjectileType("FrostyFlare"); item.shootSpeed = 22f; item.maxStack = 999; item.consumable = true; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } } } diff --git a/Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs b/Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs index e6606216f6..8d1e325902 100644 --- a/Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs +++ b/Items/CalamityCustomThrowingDamage/GacruxianMollusk.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { DisplayName.SetDefault("Gacruxian Mollusk"); Tooltip.SetDefault("Releases homing sparks while traveling\n" + - "Stealth strikes release homing snails that create even more sparks"); + "Stealth strikes release homing snails that create even more sparks"); } public override void SafeSetDefaults() @@ -35,8 +35,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shootSpeed = Speed; item.value = Item.buyPrice(0, 0, 20, 0); item.Calamity().rogue = true; - //item.maxStack = 999; not consumable because imagine knowing how to fish up more than one of an item - //item.consumable = true; + //item.maxStack = 999; not consumable because imagine knowing how to fish up more than one of an item + //item.consumable = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs b/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs index f33b4fa42d..68220231b7 100644 --- a/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs +++ b/Items/CalamityCustomThrowingDamage/GalaxySmasherRogue.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.CalamityCustomThrowingDamage { @@ -36,16 +35,16 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.Calamity().postMoonLordRarity = 14; item.value = Item.buyPrice(1, 80, 0, 0); - item.Calamity().rogue = true; - item.shoot = mod.ProjectileType("GalaxySmasherHammer"); + item.Calamity().rogue = true; + item.shoot = mod.ProjectileType("GalaxySmasherHammer"); item.shootSpeed = Speed; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - return false; + Main.projectile[proj].Calamity().forceRogue = true; + return false; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/GelDart.cs b/Items/CalamityCustomThrowingDamage/GelDart.cs index b53c30a820..a6b96c568c 100644 --- a/Items/CalamityCustomThrowingDamage/GelDart.cs +++ b/Items/CalamityCustomThrowingDamage/GelDart.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Gel Dart"); - Tooltip.SetDefault("Throws bouncing darts"); - } + Tooltip.SetDefault("Throws bouncing darts"); + } public override void SafeSetDefaults() { @@ -30,8 +30,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("GelDartProjectile"); item.shootSpeed = 14f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs b/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs index a20f8d4375..b8a5315a0d 100644 --- a/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs +++ b/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs @@ -5,31 +5,31 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class GhoulishGouger : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghoulish Gouger"); - Tooltip.SetDefault("Throws a ghoulish scythe that ignores immunity frames"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghoulish Gouger"); + Tooltip.SetDefault("Throws a ghoulish scythe that ignores immunity frames"); + } - public override void SafeSetDefaults() - { - item.width = 68; - item.damage = 160; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useTime = 12; - item.useStyle = 1; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; + public override void SafeSetDefaults() + { + item.width = 68; + item.damage = 160; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useTime = 12; + item.useStyle = 1; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("GhoulishGouger"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 13; - } - } + item.shootSpeed = 20f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs b/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs index ab026fac95..8e6fa0a3a6 100644 --- a/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs +++ b/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs @@ -4,39 +4,39 @@ using Terraria.ID; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class HeavenfallenStardisk : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavenfallen Stardisk"); - Tooltip.SetDefault("Throws a stardisk upwards which then launches itself towards your mouse cursor,\n" + - "explodes into several astral energy bolts if the thrower is moving vertically when throwing it and during its impact"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heavenfallen Stardisk"); + Tooltip.SetDefault("Throws a stardisk upwards which then launches itself towards your mouse cursor,\n" + + "explodes into several astral energy bolts if the thrower is moving vertically when throwing it and during its impact"); + } - public override void SafeSetDefaults() - { - item.width = 38; - item.height = 34; - item.damage = 165; - item.crit += 20; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = 1; - item.useTime = 23; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("HeavenfallenStardisk"); - item.shootSpeed = 10f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 38; + item.height = 34; + item.damage = 165; + item.crit += 20; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 23; + item.useStyle = 1; + item.useTime = 23; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("HeavenfallenStardisk"); + item.shootSpeed = 10f; + item.Calamity().rogue = true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/IceStar.cs b/Items/CalamityCustomThrowingDamage/IceStar.cs index 56238e0ba4..4bf8fc317a 100644 --- a/Items/CalamityCustomThrowingDamage/IceStar.cs +++ b/Items/CalamityCustomThrowingDamage/IceStar.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { DisplayName.SetDefault("Ice Star"); Tooltip.SetDefault("Throws homing ice stars\n" + - "Ice Stars are too brittle to be recovered after being thrown"); + "Ice Stars are too brittle to be recovered after being thrown"); } public override void SafeSetDefaults() @@ -32,8 +32,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("IceStarProjectile"); item.shootSpeed = 14f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/Icebreaker.cs b/Items/CalamityCustomThrowingDamage/Icebreaker.cs index 0c70e363d9..98e23a8d22 100644 --- a/Items/CalamityCustomThrowingDamage/Icebreaker.cs +++ b/Items/CalamityCustomThrowingDamage/Icebreaker.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Icebreaker : CalamityDamageItem - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Icebreaker"); @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("Icebreaker"); item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/IchorSpear.cs b/Items/CalamityCustomThrowingDamage/IchorSpear.cs index ef0fa8ba07..87b7fcaafa 100644 --- a/Items/CalamityCustomThrowingDamage/IchorSpear.cs +++ b/Items/CalamityCustomThrowingDamage/IchorSpear.cs @@ -5,29 +5,29 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class IchorSpear : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ichor Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ichor Spear"); + } - public override void SafeSetDefaults() - { - item.width = 52; - item.damage = 40; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 52; + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 40; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 52; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("IchorSpear"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - } - } + item.shoot = mod.ProjectileType("IchorSpear"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Kylie.cs b/Items/CalamityCustomThrowingDamage/Kylie.cs index bf6645e76c..8cf6caeedc 100644 --- a/Items/CalamityCustomThrowingDamage/Kylie.cs +++ b/Items/CalamityCustomThrowingDamage/Kylie.cs @@ -38,13 +38,13 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { CalamityPlayer p = Main.player[Main.myPlayer].Calamity(); //If stealth is full, shoot a spread of 3 boomerangs with reduced range - if(p.StealthStrikeAvailable()) + if (p.StealthStrikeAvailable()) { int spread = 10; - for (int i = 0; i <3; i++) + for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType("Kylieproj"), item.damage, item.knockBack, player.whoAmI,0f,1f); + int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType("Kylieproj"), item.damage, item.knockBack, player.whoAmI, 0f, 1f); Main.projectile[proj].Calamity().stealthStrike = true; spread -= 10; } diff --git a/Items/CalamityCustomThrowingDamage/Lionfish.cs b/Items/CalamityCustomThrowingDamage/Lionfish.cs index c82757607a..d78989ae73 100644 --- a/Items/CalamityCustomThrowingDamage/Lionfish.cs +++ b/Items/CalamityCustomThrowingDamage/Lionfish.cs @@ -5,30 +5,30 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Lionfish : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lionfish"); - Tooltip.SetDefault("Sticks to enemies and injects a potent toxin"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lionfish"); + Tooltip.SetDefault("Sticks to enemies and injects a potent toxin"); + } - public override void SafeSetDefaults() - { - item.width = 40; - item.damage = 54; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; + public override void SafeSetDefaults() + { + item.width = 40; + item.damage = 54; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 40; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.shoot = mod.ProjectileType("Lionfish"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } - } + item.shoot = mod.ProjectileType("Lionfish"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Malachite.cs b/Items/CalamityCustomThrowingDamage/Malachite.cs index 7b4ecee5f0..425db81ac2 100644 --- a/Items/CalamityCustomThrowingDamage/Malachite.cs +++ b/Items/CalamityCustomThrowingDamage/Malachite.cs @@ -5,69 +5,69 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Malachite : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - Tooltip.SetDefault("Legendary Drop\n" + - "Throws a stream of kunai that stick to enemies and explode\n" + - "Right click to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit\n" + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + Tooltip.SetDefault("Legendary Drop\n" + + "Throws a stream of kunai that stick to enemies and explode\n" + + "Right click to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit\n" + "Revengeance drop"); - } + } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 62; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 1; - item.knockBack = 1.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 62; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 1; + item.knockBack = 1.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 58; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; item.shoot = mod.ProjectileType("Malachite"); - item.shootSpeed = 10f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 17; - } + item.shootSpeed = 10f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 17; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 10; - item.useAnimation = 10; - item.UseSound = SoundID.Item109; - } - else - { - item.useTime = 5; - item.useAnimation = 5; - item.UseSound = SoundID.Item1; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 10; + item.useAnimation = 10; + item.UseSound = SoundID.Item109; + } + else + { + item.useTime = 5; + item.useAnimation = 5; + item.UseSound = SoundID.Item1; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MalachiteBolt"), (int)((double)damage * 1.75), knockBack, player.whoAmI, 0f, 0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Malachite"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MalachiteBolt"), (int)((double)damage * 1.75), knockBack, player.whoAmI, 0f, 0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Malachite"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs index 3584911d83..ab03d60938 100644 --- a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs +++ b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs @@ -6,38 +6,38 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class MangroveChakram : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mangrove Chakram"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mangrove Chakram"); + } - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = 84; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.height = 38; + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = 84; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.height = 38; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.shoot = mod.ProjectileType("MangroveChakramProjectile"); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("MangroveChakramProjectile"); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/MeteorFist.cs b/Items/CalamityCustomThrowingDamage/MeteorFist.cs index 416a32cba4..3b8a2b5dc6 100644 --- a/Items/CalamityCustomThrowingDamage/MeteorFist.cs +++ b/Items/CalamityCustomThrowingDamage/MeteorFist.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class MeteorFist : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meteor Fist"); - Tooltip.SetDefault("Fires a fist that explodes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meteor Fist"); + Tooltip.SetDefault("Fires a fist that explodes"); + } - public override void SafeSetDefaults() - { - item.width = 22; - item.damage = 15; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 30; - item.useStyle = 5; - item.useTime = 30; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.height = 28; + public override void SafeSetDefaults() + { + item.width = 22; + item.damage = 15; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 30; + item.useStyle = 5; + item.useTime = 30; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.height = 28; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.shoot = mod.ProjectileType("MeteorFist"); - item.shootSpeed = 10f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("MeteorFist"); + item.shootSpeed = 10f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs b/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs index ceda6992ac..d4ff93760d 100644 --- a/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs +++ b/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Molten Amputator"); - Tooltip.SetDefault("Throws a scythe that emits molten globs on enemy hits"); - } + Tooltip.SetDefault("Throws a scythe that emits molten globs on enemy hits"); + } public override void SafeSetDefaults() { @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("MoltenAmputator"); item.shootSpeed = 12f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; + } } } diff --git a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs index dcd8c21408..c0c4b8b863 100644 --- a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs +++ b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX * 1.4f, speedY * 1.4f).RotatedBy(MathHelper.ToRadians(spread)); - int p = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), item.damage, item.knockBack, player.whoAmI,1); + int p = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), item.damage, item.knockBack, player.whoAmI, 1); Main.projectile[p].Calamity().stealthStrike = true; spread -= 7; } diff --git a/Items/CalamityCustomThrowingDamage/Mycoroot.cs b/Items/CalamityCustomThrowingDamage/Mycoroot.cs index bed7ffd799..777f93fa85 100644 --- a/Items/CalamityCustomThrowingDamage/Mycoroot.cs +++ b/Items/CalamityCustomThrowingDamage/Mycoroot.cs @@ -5,38 +5,38 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Mycoroot : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mycoroot"); - Tooltip.SetDefault("Fires a stream of short-range fungal roots"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mycoroot"); + Tooltip.SetDefault("Fires a stream of short-range fungal roots"); + } - public override void SafeSetDefaults() - { - item.width = 32; - item.damage = 10; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 1; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 32; - item.rare = 2; + public override void SafeSetDefaults() + { + item.width = 32; + item.damage = 10; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 1; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 32; + item.rare = 2; item.value = Item.buyPrice(0, 2, 0, 0); item.shoot = mod.ProjectileType("Mycoroot"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - } + item.shootSpeed = 20f; + item.Calamity().rogue = true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs index fc545b09ac..0d0a1d21d5 100644 --- a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs +++ b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs @@ -5,40 +5,40 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class MythrilKnife : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mythril Knife"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mythril Knife"); + } - public override void SafeSetDefaults() - { - item.width = 12; - item.damage = 40; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.knockBack = 1.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1100; - item.rare = 4; - item.shoot = mod.ProjectileType("MythrilKnifeProjectile"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 12; + item.damage = 40; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.knockBack = 1.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = 1100; + item.rare = 4; + item.shoot = mod.ProjectileType("MythrilKnifeProjectile"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MythrilBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 40); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MythrilBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 40); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs b/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs index dce9de3e60..a08b3b309d 100644 --- a/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs +++ b/Items/CalamityCustomThrowingDamage/NanoblackReaperRogue.cs @@ -2,66 +2,65 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.CalamityCustomThrowingDamage { - public class NanoblackReaperRogue : CalamityDamageItem - { - public static int BaseDamage = 800; - public static float Knockback = 9f; - public static float Speed = 16f; + public class NanoblackReaperRogue : CalamityDamageItem + { + public static int BaseDamage = 800; + public static float Knockback = 9f; + public static float Speed = 16f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Reaper"); - Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanoblack Reaper"); + Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'"); + } - public override void SafeSetDefaults() - { - item.width = 78; - item.height = 64; - item.damage = BaseDamage; - item.knockBack = Knockback; - item.useTime = 6; - item.useAnimation = 6; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; + public override void SafeSetDefaults() + { + item.width = 78; + item.height = 64; + item.damage = BaseDamage; + item.knockBack = Knockback; + item.useTime = 6; + item.useAnimation = 6; + item.autoReuse = true; + item.noMelee = true; + item.noUseGraphic = true; - item.useStyle = 1; - item.UseSound = SoundID.Item18; + item.useStyle = 1; + item.UseSound = SoundID.Item18; - item.rare = 10; - item.Calamity().postMoonLordRarity = 16; - item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 16; + item.value = Item.buyPrice(5, 0, 0, 0); - item.Calamity().rogue = true; - item.shoot = mod.ProjectileType("NanoblackMain"); - item.shootSpeed = Speed; - } + item.Calamity().rogue = true; + item.shoot = mod.ProjectileType("NanoblackMain"); + item.shootSpeed = Speed; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - return false; + Main.projectile[proj].Calamity().forceRogue = true; + return false; } public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(null, "DraedonsForge"); - r.AddIngredient(null, "GhoulishGouger"); - r.AddIngredient(null, "SoulHarvester"); - r.AddIngredient(null, "EssenceFlayer"); - r.AddIngredient(null, "ShadowspecBar", 5); - r.AddIngredient(null, "EndothermicEnergy", 40); - r.AddIngredient(null, "DarkPlasma", 10); - r.AddIngredient(ItemID.Nanites, 400); - r.AddRecipe(); - } - } + { + ModRecipe r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(null, "DraedonsForge"); + r.AddIngredient(null, "GhoulishGouger"); + r.AddIngredient(null, "SoulHarvester"); + r.AddIngredient(null, "EssenceFlayer"); + r.AddIngredient(null, "ShadowspecBar", 5); + r.AddIngredient(null, "EndothermicEnergy", 40); + r.AddIngredient(null, "DarkPlasma", 10); + r.AddIngredient(ItemID.Nanites, 400); + r.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs index e231ee6b98..57185e919f 100644 --- a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs +++ b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs @@ -5,41 +5,41 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class OrichalcumSpikedGemstone : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orichalcum Spiked Gemstone"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orichalcum Spiked Gemstone"); + } - public override void SafeSetDefaults() - { - item.width = 14; - item.damage = 37; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 24; - item.shoot = 330; - item.maxStack = 999; - item.value = 1200; - item.rare = 4; - item.shoot = mod.ProjectileType("OrichalcumSpikedGemstoneProjectile"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 14; + item.damage = 37; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 2f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 24; + item.shoot = 330; + item.maxStack = 999; + item.value = 1200; + item.rare = 4; + item.shoot = mod.ProjectileType("OrichalcumSpikedGemstoneProjectile"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.OrichalcumBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 50); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.OrichalcumBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 50); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs index 3f58d821e0..49ae52af36 100644 --- a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs +++ b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs @@ -5,41 +5,41 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class PalladiumJavelin : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Palladium Javelin"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Palladium Javelin"); + } - public override void SafeSetDefaults() - { - item.width = 44; - item.damage = 50; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.shoot = 330; - item.maxStack = 999; - item.value = 1200; - item.rare = 4; - item.shoot = mod.ProjectileType("PalladiumJavelinProjectile"); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 50; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; + item.shoot = 330; + item.maxStack = 999; + item.value = 1200; + item.rare = 4; + item.shoot = mod.ProjectileType("PalladiumJavelinProjectile"); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PalladiumBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 20); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PalladiumBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 20); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs b/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs index 9c48b05721..57480e4337 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/CorpusAvertor.cs @@ -4,45 +4,45 @@ using Terraria.ID; namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon { public class CorpusAvertor : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - Tooltip.SetDefault("Seems like it has worn down over time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + Tooltip.SetDefault("Seems like it has worn down over time"); + } - public override void SafeSetDefaults() - { - item.width = 18; - item.height = 32; - item.damage = 140; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().postMoonLordRarity = 21; - item.shoot = mod.ProjectileType("CorpusAvertor"); - item.shootSpeed = 5f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 18; + item.height = 32; + item.damage = 140; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.Calamity().postMoonLordRarity = 21; + item.shoot = mod.ProjectileType("CorpusAvertor"); + item.shootSpeed = 5f; + item.Calamity().rogue = true; + } - // Gains 20% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.2f * player.Calamity().throwingDamage; - } + // Gains 20% of missing health as base damage. + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + flat += lifeAmount * 0.2f * player.Calamity().throwingDamage; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs b/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs index 356d445407..875e1dafce 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/DeepSeaDumbbell.cs @@ -1,82 +1,80 @@ -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon { - public class DeepSeaDumbbell : CalamityDamageItem - { - private int BaseDamage = 900; + public class DeepSeaDumbbell : CalamityDamageItem + { + private int BaseDamage = 900; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deep Sea Dumbbell"); - Tooltip.SetDefault("Throws a dumbbell that bounces and flings weights with each bounce\n" + - "Right click to flex with it"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deep Sea Dumbbell"); + Tooltip.SetDefault("Throws a dumbbell that bounces and flings weights with each bounce\n" + + "Right click to flex with it"); + } - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = BaseDamage; - item.crit -= 2; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.knockBack = 16f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 24; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("DeepSeaDumbbell1"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 21; - } + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = BaseDamage; + item.crit -= 2; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.knockBack = 16f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 24; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("DeepSeaDumbbell1"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 21; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useStyle = 4; - item.useAnimation = 45; - item.useTime = 45; - item.noMelee = false; - item.noUseGraphic = false; - item.autoReuse = false; - item.damage = BaseDamage * 25; - item.UseSound = SoundID.Item1; - } - else - { - item.useStyle = 1; - item.useAnimation = 25; - item.useTime = 25; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.damage = BaseDamage; - item.UseSound = SoundID.Item1; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useStyle = 4; + item.useAnimation = 45; + item.useTime = 45; + item.noMelee = false; + item.noUseGraphic = false; + item.autoReuse = false; + item.damage = BaseDamage * 25; + item.UseSound = SoundID.Item1; + } + else + { + item.useStyle = 1; + item.useAnimation = 25; + item.useTime = 25; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.damage = BaseDamage; + item.UseSound = SoundID.Item1; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - return false; + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + return false; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * player.Calamity().throwingDamage), knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * player.Calamity().throwingDamage), knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs b/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs index 150fcc4f21..d01c5d651a 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/KelvinCatalyst.cs @@ -4,61 +4,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon { - public class KelvinCatalyst : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst"); - Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits"); - } + public class KelvinCatalyst : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kelvin Catalyst"); + Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits"); + } - public override void SafeSetDefaults() - { - item.width = 20; - item.damage = 100; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 30; - item.useStyle = 1; - item.useTime = 30; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.height = 20; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("KelvinCatalyst"); - item.shootSpeed = 8f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 21; - } + public override void SafeSetDefaults() + { + item.width = 20; + item.damage = 100; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.height = 20; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("KelvinCatalyst"); + item.shootSpeed = 8f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 21; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IceStar", 200); - recipe.AddIngredient(ItemID.SoulofMight, 30); - recipe.AddIngredient(null, "CryoBar", 20); - recipe.AddIngredient(null, "EssenceofEleum", 10); - recipe.AddIngredient(null, "Avalanche", 2); - recipe.AddIngredient(null, "BittercoldStaff", 2); - recipe.AddIngredient(null, "EffluviumBow", 2); - recipe.AddIngredient(null, "GlacialCrusher", 2); - recipe.AddIngredient(null, "Icebreaker", 2); - recipe.AddIngredient(null, "SnowstormStaff", 2); - recipe.AddIngredient(null, "SoulofCryogen", 2); - recipe.AddIngredient(null, "FrostFlare", 2); - recipe.AddIngredient(ItemID.FrostCore, 2); - recipe.AddIngredient(null, "CryoStone"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IceStar", 200); + recipe.AddIngredient(ItemID.SoulofMight, 30); + recipe.AddIngredient(null, "CryoBar", 20); + recipe.AddIngredient(null, "EssenceofEleum", 10); + recipe.AddIngredient(null, "Avalanche", 2); + recipe.AddIngredient(null, "BittercoldStaff", 2); + recipe.AddIngredient(null, "EffluviumBow", 2); + recipe.AddIngredient(null, "GlacialCrusher", 2); + recipe.AddIngredient(null, "Icebreaker", 2); + recipe.AddIngredient(null, "SnowstormStaff", 2); + recipe.AddIngredient(null, "SoulofCryogen", 2); + recipe.AddIngredient(null, "FrostFlare", 2); + recipe.AddIngredient(ItemID.FrostCore, 2); + recipe.AddIngredient(null, "CryoStone"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs index 69031fc4f4..fc7a92762d 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs @@ -6,42 +6,42 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon { public class Plaguenade : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plaguenade"); - Tooltip.SetDefault("Releases a swarm of angry plague bees"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguenade"); + Tooltip.SetDefault("Releases a swarm of angry plague bees"); + } - public override void SafeSetDefaults() - { - item.width = 20; - item.damage = 60; - item.noMelee = true; - item.noUseGraphic = true; - item.consumable = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 1.5f; - item.maxStack = 999; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 28; + public override void SafeSetDefaults() + { + item.width = 20; + item.damage = 60; + item.noMelee = true; + item.noUseGraphic = true; + item.consumable = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 1.5f; + item.maxStack = 999; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 28; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("Plaguenade"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 21; - } + item.shoot = mod.ProjectileType("Plaguenade"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 21; + } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Beenade, 15); recipe.AddIngredient(null, "PlagueCellCluster", 3); - recipe.AddIngredient(ItemID.Obsidian, 2); - recipe.AddIngredient(ItemID.Stinger); + recipe.AddIngredient(ItemID.Obsidian, 2); + recipe.AddIngredient(ItemID.Stinger); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this, 30); recipe.AddRecipe(); diff --git a/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs b/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs index bcc67e58a6..aad10463b3 100644 --- a/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs +++ b/Items/CalamityCustomThrowingDamage/Patreon/TimeBolt.cs @@ -5,50 +5,50 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon { public class TimeBolt : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Time Bolt"); - Tooltip.SetDefault("There should be no boundary to human endeavor."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Time Bolt"); + Tooltip.SetDefault("There should be no boundary to human endeavor."); + } - public override void SafeSetDefaults() - { - item.width = 24; - item.height = 46; - item.damage = 720; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - item.shoot = mod.ProjectileType("TimeBolt"); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 24; + item.height = 46; + item.damage = 720; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 2f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + item.shoot = mod.ProjectileType("TimeBolt"); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmicKunai"); - recipe.AddIngredient(ItemID.FastClock); - recipe.AddIngredient(null, "RuinousSoul", 5); - recipe.AddIngredient(null, "Phantoplasm", 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmicKunai"); + recipe.AddIngredient(ItemID.FastClock); + recipe.AddIngredient(null, "RuinousSoul", 5); + recipe.AddIngredient(null, "Phantoplasm", 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/Prismalline.cs b/Items/CalamityCustomThrowingDamage/Prismalline.cs index 4f2d254282..c844740190 100644 --- a/Items/CalamityCustomThrowingDamage/Prismalline.cs +++ b/Items/CalamityCustomThrowingDamage/Prismalline.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Prismalline : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - Tooltip.SetDefault("Throws daggers that split after a while"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + Tooltip.SetDefault("Throws daggers that split after a while"); + } - public override void SafeSetDefaults() - { - item.width = 46; - item.damage = 22; - item.crit += 4; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 46; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("Prismalline"); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 46; + item.damage = 22; + item.crit += 4; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 46; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("Prismalline"); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Crystalline"); - recipe.AddIngredient(null, "EssenceofEleum", 5); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Crystalline"); + recipe.AddIngredient(null, "EssenceofEleum", 5); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs b/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs index 4f457a28cb..3cd99084d8 100644 --- a/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs +++ b/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Infernal Spear"); - Tooltip.SetDefault("Throws a homing spear that explodes on enemy hits"); - } + Tooltip.SetDefault("Throws a homing spear that explodes on enemy hits"); + } public override void SafeSetDefaults() { @@ -28,8 +28,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("ProfanedTrident"); item.shootSpeed = 28f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; + } } } diff --git a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs index c5f843f4d5..531a8fe4d1 100644 --- a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs +++ b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs @@ -6,43 +6,43 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Pwnagehammer : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws an extremely fast hammer"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pwnagehammer"); + Tooltip.SetDefault("Throws an extremely fast hammer"); + } - public override void SafeSetDefaults() - { - item.width = 68; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.height = 68; + public override void SafeSetDefaults() + { + item.width = 68; + item.damage = 90; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 10f; + item.UseSound = SoundID.Item1; + item.height = 68; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; - item.shoot = mod.ProjectileType("Pwnagehammer"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("Pwnagehammer"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pwnhammer); - recipe.AddIngredient(ItemID.HallowedBar, 7); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pwnhammer); + recipe.AddIngredient(ItemID.HallowedBar, 7); recipe.AddIngredient(ItemID.SoulofMight, 3); recipe.AddIngredient(ItemID.SoulofSight, 3); recipe.AddIngredient(ItemID.SoulofFright, 3); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/RadiantStar.cs b/Items/CalamityCustomThrowingDamage/RadiantStar.cs index b3683133f9..3e75d18e99 100644 --- a/Items/CalamityCustomThrowingDamage/RadiantStar.cs +++ b/Items/CalamityCustomThrowingDamage/RadiantStar.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class RadiantStar : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Radiant Star"); - Tooltip.SetDefault("Throws daggers that explode and split after a while"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Radiant Star"); + Tooltip.SetDefault("Throws daggers that explode and split after a while"); + } - public override void SafeSetDefaults() - { - item.width = 52; - item.damage = 50; //33 - item.crit += 8; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("RadiantStar"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 50; //33 + item.crit += 8; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("RadiantStar"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Prismalline"); - recipe.AddIngredient(null, "AstralBar", 10); - recipe.AddIngredient(null, "Stardust", 15); - recipe.AddIngredient(ItemID.FallenStar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Prismalline"); + recipe.AddIngredient(null, "AstralBar", 10); + recipe.AddIngredient(null, "Stardust", 15); + recipe.AddIngredient(ItemID.FallenStar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs index 40f6d5bd62..92230b2e26 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs @@ -5,31 +5,31 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants { public class DuneHopper : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dune Hopper"); - Tooltip.SetDefault("Throws a spear that bounces a lot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dune Hopper"); + Tooltip.SetDefault("Throws a spear that bounces a lot"); + } - public override void SafeSetDefaults() - { - item.width = 44; - item.damage = 18; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 18; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.shoot = mod.ProjectileType("ScourgeoftheDesert2"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 22; - } - } + item.shoot = mod.ProjectileType("ScourgeoftheDesert2"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs index fb6635393a..4019f10402 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs @@ -4,39 +4,39 @@ using Terraria.ID; namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants { public class Quasar : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Quasar"); - Tooltip.SetDefault("Succ"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Quasar"); + Tooltip.SetDefault("Succ"); + } - public override void SafeSetDefaults() - { - item.width = 52; - item.damage = 80; //50 - item.crit += 12; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 0f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("Quasar"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 22; - } + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 80; //50 + item.crit += 12; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 0f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("Quasar"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, 0f); + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs index 9e32cad648..fb08305a54 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs @@ -6,43 +6,43 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants { public class SpearofDestiny : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear of Destiny"); - Tooltip.SetDefault("Throws three spears with the outer two having homing capabilities"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear of Destiny"); + Tooltip.SetDefault("Throws three spears with the outer two having homing capabilities"); + } - public override void SafeSetDefaults() - { - item.width = 52; - item.damage = 25; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 52; + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 25; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 2f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 52; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("IchorSpear"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 22; - } + item.shoot = mod.ProjectileType("IchorSpear"); + item.shootSpeed = 20f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, (i == 1 ? type : mod.ProjectileType("IchorSpear2")), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(3); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, (i == 1 ? type : mod.ProjectileType("IchorSpear2")), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs index 09b3bddb07..18b7354fb5 100644 --- a/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs +++ b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs @@ -5,31 +5,31 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants { public class TheReaper : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Reaper"); - Tooltip.SetDefault("Slice 'n dice"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Reaper"); + Tooltip.SetDefault("Slice 'n dice"); + } - public override void SafeSetDefaults() - { - item.width = 80; - item.damage = 325; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useTime = 22; - item.useStyle = 1; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; + public override void SafeSetDefaults() + { + item.width = 80; + item.damage = 325; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useTime = 22; + item.useStyle = 1; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 64; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("Valediction2"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 22; - } - } + item.shootSpeed = 20f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 22; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/RotBall.cs b/Items/CalamityCustomThrowingDamage/RotBall.cs index 0d53e27d07..397c8c0449 100644 --- a/Items/CalamityCustomThrowingDamage/RotBall.cs +++ b/Items/CalamityCustomThrowingDamage/RotBall.cs @@ -5,43 +5,43 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class RotBall : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rot Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rot Ball"); + } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 26; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.crit = 8; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 26; - item.maxStack = 999; - item.value = 1000; - item.rare = 3; - item.shoot = mod.ProjectileType("RotBallProjectile"); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 26; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.crit = 8; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 26; + item.maxStack = 999; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("RotBallProjectile"); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueShadowScale"); - recipe.AddIngredient(ItemID.RottenChunk); - recipe.AddIngredient(ItemID.DemoniteBar); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueShadowScale"); + recipe.AddIngredient(ItemID.RottenChunk); + recipe.AddIngredient(ItemID.DemoniteBar); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs index 41f1db996c..00388a052e 100644 --- a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs +++ b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Illustrious Knives"); - Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); - } + Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); + } public override void SafeSetDefaults() { @@ -31,9 +31,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("RoyalKnife"); item.shootSpeed = 9f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 16; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/CalamityCustomThrowingDamage/SandDollar.cs b/Items/CalamityCustomThrowingDamage/SandDollar.cs index 999c701db4..67c6b42ea7 100644 --- a/Items/CalamityCustomThrowingDamage/SandDollar.cs +++ b/Items/CalamityCustomThrowingDamage/SandDollar.cs @@ -4,44 +4,44 @@ using Terraria.ID; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class SandDollar : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Dollar"); - Tooltip.SetDefault("Stacks up to 2"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Dollar"); + Tooltip.SetDefault("Stacks up to 2"); + } - public override void SafeSetDefaults() - { - item.width = 30; - item.height = 28; - item.damage = 30; - item.thrown = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 1; - item.maxStack = 2; - item.knockBack = 3.5f; - item.autoReuse = true; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SandDollarProj"); - item.shootSpeed = 14f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 30; + item.height = 28; + item.damage = 30; + item.thrown = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 1; + item.maxStack = 2; + item.knockBack = 3.5f; + item.autoReuse = true; + item.UseSound = SoundID.Item1; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("SandDollarProj"); + item.shootSpeed = 14f; + item.Calamity().rogue = true; + } - public override bool CanUseItem(Player player) - { - int launched = 0; + public override bool CanUseItem(Player player) + { + int launched = 0; - foreach (Projectile projectile in Main.projectile) - if (projectile.type == item.shoot && projectile.owner == item.owner && projectile.active) - launched++; + foreach (Projectile projectile in Main.projectile) + if (projectile.type == item.shoot && projectile.owner == item.owner && projectile.active) + launched++; - return launched < item.stack; - } - } + return launched < item.stack; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/ScarletDevil.cs b/Items/CalamityCustomThrowingDamage/ScarletDevil.cs index 91255163c2..6787488bae 100644 --- a/Items/CalamityCustomThrowingDamage/ScarletDevil.cs +++ b/Items/CalamityCustomThrowingDamage/ScarletDevil.cs @@ -4,49 +4,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { - public class ScarletDevil : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scarlet Devil"); - Tooltip.SetDefault("Throws an ultra high velocity spear, which creates more projectiles that home in\n"+ - "The spear creates a Scarlet Blast upon hitting an enemy\n"+ - "Stealth strikes grant you lifesteal\n"+ - "'Divine Spear \"Spear the Gungnir\"'"); - } + public class ScarletDevil : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scarlet Devil"); + Tooltip.SetDefault("Throws an ultra high velocity spear, which creates more projectiles that home in\n" + + "The spear creates a Scarlet Blast upon hitting an enemy\n" + + "Stealth strikes grant you lifesteal\n" + + "'Divine Spear \"Spear the Gungnir\"'"); + } - public override void SafeSetDefaults() - { - item.width = 94; - item.height = 94; - item.damage = 40000; - item.crit += 20; - item.noMelee = true; + public override void SafeSetDefaults() + { + item.width = 94; + item.height = 94; + item.damage = 40000; + item.crit += 20; + item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 60; - item.useStyle = 1; - item.useTime = 60; - item.knockBack = 8f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; + item.useAnimation = 60; + item.useStyle = 1; + item.useTime = 60; + item.knockBack = 8f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("ScarletDevilProjectile"); - item.shootSpeed = 30f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 16; - } + item.shoot = mod.ProjectileType("ScarletDevilProjectile"); + item.shootSpeed = 30f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 16; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedTrident"); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedTrident"); recipe.AddIngredient(null, "BloodstoneCore", 15); recipe.AddIngredient(ItemID.SoulofNight, 15); recipe.AddIngredient(null, "ShadowspecBar", 5); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs index 6b689bf8c3..2b2c7daf2f 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs @@ -6,32 +6,32 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class ScourgeoftheCosmosThrown : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge of the Cosmos"); - Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge of the Cosmos"); + Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); + } - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 2200; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 20; + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 2200; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 5f; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.height = 20; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 14; - } + item.shootSpeed = 15f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 14; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs index 9af9d4637d..e41bf5f631 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs @@ -5,30 +5,30 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class ScourgeoftheDesert : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge of the Desert"); - Tooltip.SetDefault("Gains velocity over time"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge of the Desert"); + Tooltip.SetDefault("Gains velocity over time"); + } - public override void SafeSetDefaults() - { - item.width = 44; - item.damage = 16; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 16; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.shoot = mod.ProjectileType("ScourgeoftheDesert"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } - } + item.shoot = mod.ProjectileType("ScourgeoftheDesert"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs index 271d45f478..8d3ba72e20 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs @@ -1,57 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; -using CalamityMod; -using static CalamityMod.CalPlayer.CalamityPlayer; namespace CalamityMod.Items.CalamityCustomThrowingDamage { - public class ScourgeoftheSeas : CalamityDamageItem + public class ScourgeoftheSeas : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge of the Seas"); - Tooltip.SetDefault("Snaps apart into a venomous cloud upon striking an enemy\n" + - "Stealth strikes stick to enemies and apply a powerful venom"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge of the Seas"); + Tooltip.SetDefault("Snaps apart into a venomous cloud upon striking an enemy\n" + + "Stealth strikes stick to enemies and apply a powerful venom"); + } - public override void SafeSetDefaults() - { - item.width = 82; - item.damage = 45; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 82; + public override void SafeSetDefaults() + { + item.width = 82; + item.damage = 45; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 82; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("ScourgeoftheSeasProjectile"); - item.shootSpeed = 8f; - item.Calamity().rogue = true; - } + item.shoot = mod.ProjectileType("ScourgeoftheSeasProjectile"); + item.shootSpeed = 8f; + item.Calamity().rogue = true; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.Calamity().StealthStrikeAvailable()) - { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ScourgeoftheSeasStealth"), damage, knockBack, player.whoAmI, 0f, 0f); + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ScourgeoftheSeasStealth"), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[p].Calamity().stealthStrike = true; } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs index bf97dd57fb..043185f432 100644 --- a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs +++ b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class SeafoamBomb : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seafoam Bomb"); - Tooltip.SetDefault("Throws a bomb that explodes into a bubble which deals extra damage to enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seafoam Bomb"); + Tooltip.SetDefault("Throws a bomb that explodes into a bubble which deals extra damage to enemies"); + } - public override void SafeSetDefaults() - { - item.width = 26; - item.height = 44; - item.damage = 16; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SeafoamBomb"); - item.shootSpeed = 8f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 26; + item.height = 44; + item.damage = 16; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("SeafoamBomb"); + item.shootSpeed = 8f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bomb, 25); - recipe.AddIngredient(null, "SeaPrism", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bomb, 25); + recipe.AddIngredient(null, "SeaPrism", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs index dd9bc14356..d0e0962ce0 100644 --- a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs +++ b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SeashellBoomerangProjectile"); item.shootSpeed = 11.5f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/ShatteredSun.cs b/Items/CalamityCustomThrowingDamage/ShatteredSun.cs index 9bdf917983..c8a28f08ba 100644 --- a/Items/CalamityCustomThrowingDamage/ShatteredSun.cs +++ b/Items/CalamityCustomThrowingDamage/ShatteredSun.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class ShatteredSun : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattered Sun"); - Tooltip.SetDefault("Throws daggers that split twice and explode upon contact"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Sun"); + Tooltip.SetDefault("Throws daggers that split twice and explode upon contact"); + } - public override void SafeSetDefaults() - { - item.width = 56; - item.height = 56; - item.damage = 60; - item.crit += 10; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = 1; - item.useTime = 11; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("ShatteredSun"); - item.shootSpeed = 25f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 12; - } + public override void SafeSetDefaults() + { + item.width = 56; + item.height = 56; + item.damage = 60; + item.crit += 10; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 11; + item.useStyle = 1; + item.useTime = 11; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("ShatteredSun"); + item.shootSpeed = 25f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RadiantStar"); - recipe.AddIngredient(null, "DivineGeode", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RadiantStar"); + recipe.AddIngredient(null, "DivineGeode", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/SnapClam.cs b/Items/CalamityCustomThrowingDamage/SnapClam.cs index f9d401e8c3..edeef7c221 100644 --- a/Items/CalamityCustomThrowingDamage/SnapClam.cs +++ b/Items/CalamityCustomThrowingDamage/SnapClam.cs @@ -4,32 +4,32 @@ using Terraria.ID; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class SnapClam : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snap Clam"); - Tooltip.SetDefault("Can latch on enemies and deal damage over time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snap Clam"); + Tooltip.SetDefault("Can latch on enemies and deal damage over time"); + } - public override void SafeSetDefaults() - { - item.width = 26; - item.height = 16; - item.damage = 15; - item.thrown = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 1; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SnapClamProj"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } - } + public override void SafeSetDefaults() + { + item.width = 26; + item.height = 16; + item.damage = 15; + item.thrown = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 1; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("SnapClamProj"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs index d16e4aec66..97eda5983c 100644 --- a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs +++ b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { DisplayName.SetDefault("Spear of Paleolith"); Tooltip.SetDefault("Throws an ancient spear that shatters enemy armor\n" + - "Spears rain fossil shards as they travel"); + "Spears rain fossil shards as they travel"); } public override void SafeSetDefaults() @@ -30,8 +30,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("SpearofPaleolith"); item.shootSpeed = 35f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs b/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs index 96d1a03606..e902ed0be3 100644 --- a/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs +++ b/Items/CalamityCustomThrowingDamage/StellarContemptRogue.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.CalamityCustomThrowingDamage { @@ -14,13 +13,13 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Contempt"); - Tooltip.SetDefault("Lunar flares rain down on enemy hits"); + Tooltip.SetDefault("Lunar flares rain down on enemy hits"); } public override void SafeSetDefaults() { item.width = 66; - item.height = 64; + item.height = 64; item.damage = BaseDamage; item.knockBack = 9f; item.useTime = 13; @@ -36,16 +35,16 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.Calamity().postMoonLordRarity = 12; item.value = Item.buyPrice(1, 20, 0, 0); - item.Calamity().rogue = true; - item.shoot = mod.ProjectileType("StellarContemptHammer"); + item.Calamity().rogue = true; + item.shoot = mod.ProjectileType("StellarContemptHammer"); item.shootSpeed = Speed; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - return false; + Main.projectile[proj].Calamity().forceRogue = true; + return false; } public override void AddRecipes() @@ -56,8 +55,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage r.AddIngredient(ItemID.LunarBar, 10); r.AddIngredient(ItemID.FragmentSolar, 10); r.AddIngredient(ItemID.FragmentNebula, 10); - r.AddTile(TileID.LunarCraftingStation); - r.AddRecipe(); + r.AddTile(TileID.LunarCraftingStation); + r.AddRecipe(); } } } diff --git a/Items/CalamityCustomThrowingDamage/StellarKnife.cs b/Items/CalamityCustomThrowingDamage/StellarKnife.cs index 1a5cb094fb..7cc355a271 100644 --- a/Items/CalamityCustomThrowingDamage/StellarKnife.cs +++ b/Items/CalamityCustomThrowingDamage/StellarKnife.cs @@ -4,33 +4,33 @@ using Terraria.ID; namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class StellarKnife : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Knife"); - Tooltip.SetDefault("Throws knives that stop middair and then home into enemies\n" + - "Za Warudo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stellar Knife"); + Tooltip.SetDefault("Throws knives that stop middair and then home into enemies\n" + + "Za Warudo"); + } - public override void SafeSetDefaults() - { - item.width = 32; - item.height = 34; - item.damage = 60; - item.crit += 4; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 8; - item.useStyle = 1; - item.useTime = 8; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("StellarKnife"); - item.shootSpeed = 10f; - item.Calamity().rogue = true; - } - } + public override void SafeSetDefaults() + { + item.width = 32; + item.height = 34; + item.damage = 60; + item.crit += 4; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 8; + item.useStyle = 1; + item.useTime = 8; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("StellarKnife"); + item.shootSpeed = 10f; + item.Calamity().rogue = true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs b/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs index a1e084673f..15cb1ee757 100644 --- a/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs +++ b/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs b/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs index 66035dbddb..f5690d1d85 100644 --- a/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs +++ b/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs @@ -28,9 +28,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.value = 25000; item.shoot = mod.ProjectileType("TarragonThrowingDartProjectile"); item.shootSpeed = 24f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs index 3377cfd958..0da21575d1 100644 --- a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs +++ b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("TitaniumShurikenProjectile"); item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/ToothBall.cs b/Items/CalamityCustomThrowingDamage/ToothBall.cs index c930d7e6a3..3ece5ebd50 100644 --- a/Items/CalamityCustomThrowingDamage/ToothBall.cs +++ b/Items/CalamityCustomThrowingDamage/ToothBall.cs @@ -5,43 +5,43 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class ToothBall : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tooth Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tooth Ball"); + } - public override void SafeSetDefaults() - { - item.width = 30; - item.damage = 26; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.crit = 8; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1000; - item.rare = 3; - item.shoot = mod.ProjectileType("ToothBallProjectile"); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 30; + item.damage = 26; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.crit = 8; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("ToothBallProjectile"); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample"); - recipe.AddIngredient(ItemID.Vertebrae); - recipe.AddIngredient(ItemID.CrimtaneBar); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample"); + recipe.AddIngredient(ItemID.Vertebrae); + recipe.AddIngredient(ItemID.CrimtaneBar); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs b/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs index bea55ad1bd..5cfef69374 100644 --- a/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/CalamityCustomThrowingDamage/TriactisTruePaladinianMageHammerofMight.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); - Tooltip.SetDefault("Explodes on enemy hits"); - } + Tooltip.SetDefault("Explodes on enemy hits"); + } public override void SafeSetDefaults() { @@ -29,9 +29,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.shoot = mod.ProjectileType("TriactisOPHammer"); item.shootSpeed = 25f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 16; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs index b8c6688827..999e216835 100644 --- a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs +++ b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Fallen Paladin's Hammer"); - Tooltip.SetDefault("Explodes on enemy hits"); - } + Tooltip.SetDefault("Explodes on enemy hits"); + } public override void SafeSetDefaults() { @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("OPHammer"); item.shootSpeed = 14f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs index a18d86f963..565ea89eb1 100644 --- a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs +++ b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs @@ -4,31 +4,31 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class UrchinStinger : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin Stinger"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin Stinger"); + } - public override void SafeSetDefaults() - { - item.width = 10; - item.damage = 17; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 26; - item.maxStack = 999; - item.value = 200; - item.rare = 1; - item.shoot = mod.ProjectileType("UrchinStinger"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } - } + public override void SafeSetDefaults() + { + item.width = 10; + item.damage = 17; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 26; + item.maxStack = 999; + item.value = 200; + item.rare = 1; + item.shoot = mod.ProjectileType("UrchinStinger"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/UtensilPoker.cs b/Items/CalamityCustomThrowingDamage/UtensilPoker.cs index bb2bf57843..f5503e3200 100644 --- a/Items/CalamityCustomThrowingDamage/UtensilPoker.cs +++ b/Items/CalamityCustomThrowingDamage/UtensilPoker.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Items.CalamityCustomThrowingDamage { @@ -10,9 +9,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Utensil Poker"); - Tooltip.SetDefault("Fires random utensils in bursts of three\n" + - "Grants Well Fed on enemy hits\n" + - "Stealth strikes launch an additional butcher knife"); + Tooltip.SetDefault("Fires random utensils in bursts of three\n" + + "Grants Well Fed on enemy hits\n" + + "Stealth strikes launch an additional butcher knife"); } public override void SafeSetDefaults() @@ -20,55 +19,55 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.width = 44; item.height = 66; item.damage = 750; - item.Calamity().rogue = true; + item.Calamity().rogue = true; item.knockBack = 8f; item.noMelee = true; item.noUseGraphic = true; item.useStyle = 1; item.useTime = 15; - item.reuseDelay = 15; + item.reuseDelay = 15; item.useAnimation = 45; item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 12; + item.Calamity().postMoonLordRarity = 12; item.shoot = mod.ProjectileType("Fork"); item.shootSpeed = 16f; - } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.Calamity().StealthStrikeAvailable()) - { - int p = Projectile.NewProjectile(position.X, position.Y, (int) ((double)speedX * 1.2), (int) ((double)speedY * 1.2), mod.ProjectileType("ButcherKnife"), (int) ((double)damage * 3), knockBack, Main.myPlayer); + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position.X, position.Y, (int)((double)speedX * 1.2), (int)((double)speedY * 1.2), mod.ProjectileType("ButcherKnife"), (int)((double)damage * 3), knockBack, Main.myPlayer); Main.projectile[p].Calamity().stealthStrike = true; if (Main.rand.NextBool(3)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Fork"), (int) ((double)damage * 1.1), knockBack * 2f, Main.myPlayer); - } - else if (Main.rand.NextBool(2)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Knife"), (int)((double)damage * 1.2), knockBack, Main.myPlayer); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("CarvingFork"), damage, knockBack, Main.myPlayer); - } - } - else if (Main.rand.NextBool(3)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Fork"), (int) ((double)damage * 1.1), knockBack * 2f, Main.myPlayer); - } - else if (Main.rand.NextBool(2)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Knife"), (int)((double)damage * 1.2), knockBack, Main.myPlayer); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("CarvingFork"), damage, knockBack, Main.myPlayer); - } - return false; - } + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Fork"), (int)((double)damage * 1.1), knockBack * 2f, Main.myPlayer); + } + else if (Main.rand.NextBool(2)) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Knife"), (int)((double)damage * 1.2), knockBack, Main.myPlayer); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("CarvingFork"), damage, knockBack, Main.myPlayer); + } + } + else if (Main.rand.NextBool(3)) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Fork"), (int)((double)damage * 1.1), knockBack * 2f, Main.myPlayer); + } + else if (Main.rand.NextBool(2)) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Knife"), (int)((double)damage * 1.2), knockBack, Main.myPlayer); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("CarvingFork"), damage, knockBack, Main.myPlayer); + } + return false; + } } } diff --git a/Items/CalamityCustomThrowingDamage/Valediction.cs b/Items/CalamityCustomThrowingDamage/Valediction.cs index d6663734c8..57177464b4 100644 --- a/Items/CalamityCustomThrowingDamage/Valediction.cs +++ b/Items/CalamityCustomThrowingDamage/Valediction.cs @@ -5,31 +5,31 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Valediction : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Valediction"); - Tooltip.SetDefault("Throws a homing reaper scythe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Valediction"); + Tooltip.SetDefault("Throws a homing reaper scythe"); + } - public override void SafeSetDefaults() - { - item.width = 80; - item.damage = 405; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = 1; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; + public override void SafeSetDefaults() + { + item.width = 80; + item.damage = 405; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useTime = 15; + item.useStyle = 1; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 64; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("Valediction"); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - item.Calamity().postMoonLordRarity = 13; - } - } + item.shootSpeed = 20f; + item.Calamity().rogue = true; + item.Calamity().postMoonLordRarity = 13; + } + } } diff --git a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs index 06f7a7444d..81ecafddc4 100644 --- a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs +++ b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs @@ -5,40 +5,40 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class WulfrumKnife : CalamityDamageItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Knife"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Knife"); + } - public override void SafeSetDefaults() - { - item.width = 22; - item.damage = 8; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.maxStack = 999; - item.value = 100; - item.rare = 1; - item.shoot = mod.ProjectileType("WulfrumKnife"); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 22; + item.damage = 8; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 1f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 38; + item.maxStack = 999; + item.value = 100; + item.rare = 1; + item.shoot = mod.ProjectileType("WulfrumKnife"); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 50); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 50); + recipe.AddRecipe(); + } + } } diff --git a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs index c2fba3005f..496a48655d 100644 --- a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs +++ b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 9; item.shoot = mod.ProjectileType("XerocPitchforkProjectile"); item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + item.Calamity().rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index e92af1cc00..d4d00278e6 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,2372 +1,2371 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Utilities; +using CalamityMod.World; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; namespace CalamityMod.Items { - public class CalamityGlobalItem : GlobalItem - { - #region Instances - public override bool InstancePerEntity - { - get - { - return true; - } - } + public class CalamityGlobalItem : GlobalItem + { + #region Instances + public override bool InstancePerEntity + { + get + { + return true; + } + } - public override bool CloneNewInstances - { - get - { - return true; - } - } - #endregion + public override bool CloneNewInstances + { + get + { + return true; + } + } + #endregion - public bool rogue = false; + public bool rogue = false; - public int timesUsed = 0; + public int timesUsed = 0; - public int postMoonLordRarity = 0; + public int postMoonLordRarity = 0; - #region SetDefaults - public override void SetDefaults(Item item) - { - if (postMoonLordRarity != 0 && item.rare != 10) - item.rare = 10; + #region SetDefaults + public override void SetDefaults(Item item) + { + if (postMoonLordRarity != 0 && item.rare != 10) + item.rare = 10; - if (item.maxStack == 99 || item.type == ItemID.Dynamite || item.type == ItemID.StickyDynamite || - item.type == ItemID.BouncyDynamite || item.type == ItemID.StickyBomb || item.type == ItemID.BouncyBomb) - item.maxStack = 999; + if (item.maxStack == 99 || item.type == ItemID.Dynamite || item.type == ItemID.StickyDynamite || + item.type == ItemID.BouncyDynamite || item.type == ItemID.StickyBomb || item.type == ItemID.BouncyBomb) + item.maxStack = 999; - if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution) - item.value = Item.buyPrice(0, 0, 5, 0); + if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution) + item.value = Item.buyPrice(0, 0, 5, 0); - if (CalamityMod.weaponAutoreuseList.Contains(item.type)) - item.autoReuse = true; + if (CalamityMod.weaponAutoreuseList.Contains(item.type)) + item.autoReuse = true; - if (item.type == ItemID.PsychoKnife) - item.damage *= 4; - else if (item.type == ItemID.SpectreStaff) - item.damage *= 3; - else if (CalamityMod.doubleDamageBuffList.Contains(item.type)) - item.damage *= 2; - else if (item.type == ItemID.RainbowRod) - item.damage = (int)((double)item.damage * 1.75); - else if (CalamityMod.sixtySixDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.66); - else if (CalamityMod.fiftyDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.5); - else if (CalamityMod.thirtyThreeDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.33); - else if (CalamityMod.twentyFiveDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.25); - else if (CalamityMod.twentyDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.2); - else if (item.type == ItemID.Frostbrand || item.type == ItemID.MagnetSphere) - item.damage = (int)((double)item.damage * 1.1); - else if (item.type == ItemID.Razorpine) - item.damage = (int)((double)item.damage * 0.95); - else if (item.type == ItemID.LastPrism) - item.damage = (int)((double)item.damage * 0.85); - else if (CalamityMod.quarterDamageNerfList.Contains(item.type)) - item.damage = (int)((double)item.damage * 0.75); + if (item.type == ItemID.PsychoKnife) + item.damage *= 4; + else if (item.type == ItemID.SpectreStaff) + item.damage *= 3; + else if (CalamityMod.doubleDamageBuffList.Contains(item.type)) + item.damage *= 2; + else if (item.type == ItemID.RainbowRod) + item.damage = (int)((double)item.damage * 1.75); + else if (CalamityMod.sixtySixDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.66); + else if (CalamityMod.fiftyDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.5); + else if (CalamityMod.thirtyThreeDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.33); + else if (CalamityMod.twentyFiveDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.25); + else if (CalamityMod.twentyDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.2); + else if (item.type == ItemID.Frostbrand || item.type == ItemID.MagnetSphere) + item.damage = (int)((double)item.damage * 1.1); + else if (item.type == ItemID.Razorpine) + item.damage = (int)((double)item.damage * 0.95); + else if (item.type == ItemID.LastPrism) + item.damage = (int)((double)item.damage * 0.85); + else if (CalamityMod.quarterDamageNerfList.Contains(item.type)) + item.damage = (int)((double)item.damage * 0.75); - if (item.type == ItemID.BookStaff) - item.mana = 10; - else if (item.type == ItemID.UnholyTrident) - item.mana = 14; - else if (item.type == ItemID.FrostStaff) - item.mana = 9; - else if (item.type == ItemID.BookofSkulls) - item.mana = 12; - else if (item.type == ItemID.BlizzardStaff) - item.mana = 7; - else if (item.type == ItemID.SolarFlareHelmet) //total defense pre-buff = 78 post-buff = 94 - item.defense = 29; //5 more defense - else if (item.type == ItemID.SolarFlareBreastplate) - item.defense = 41; //7 more defense - else if (item.type == ItemID.SolarFlareLeggings) - item.defense = 24; //4 more defense - else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 21 - item.defense = 4; //2 more defense - else if (item.type == ItemID.GladiatorBreastplate) - item.defense = 7; //4 more defense - else if (item.type == ItemID.GladiatorLeggings) - item.defense = 5; //3 more defense - else if (item.type == ItemID.HallowedPlateMail) //total defense pre-buff = 31, 50, 35 post-buff = 36, 55, 40 - item.defense = 18; //3 more defense - else if (item.type == ItemID.HallowedGreaves) - item.defense = 13; //2 more defense - } - #endregion + if (item.type == ItemID.BookStaff) + item.mana = 10; + else if (item.type == ItemID.UnholyTrident) + item.mana = 14; + else if (item.type == ItemID.FrostStaff) + item.mana = 9; + else if (item.type == ItemID.BookofSkulls) + item.mana = 12; + else if (item.type == ItemID.BlizzardStaff) + item.mana = 7; + else if (item.type == ItemID.SolarFlareHelmet) //total defense pre-buff = 78 post-buff = 94 + item.defense = 29; //5 more defense + else if (item.type == ItemID.SolarFlareBreastplate) + item.defense = 41; //7 more defense + else if (item.type == ItemID.SolarFlareLeggings) + item.defense = 24; //4 more defense + else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 21 + item.defense = 4; //2 more defense + else if (item.type == ItemID.GladiatorBreastplate) + item.defense = 7; //4 more defense + else if (item.type == ItemID.GladiatorLeggings) + item.defense = 5; //3 more defense + else if (item.type == ItemID.HallowedPlateMail) //total defense pre-buff = 31, 50, 35 post-buff = 36, 55, 40 + item.defense = 18; //3 more defense + else if (item.type == ItemID.HallowedGreaves) + item.defense = 13; //2 more defense + } + #endregion - #region Shoot - public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (rogue) - { - speedX *= player.Calamity().throwingVelocity; - speedY *= player.Calamity().throwingVelocity; - } - if (player.Calamity().luxorsGift) - { - // useTime 9 = 0.9 useTime 2 = 0.2 - double damageMult = 1.0; - if (item.useTime < 10) - damageMult -= (double)(10 - item.useTime) / 10.0; + #region Shoot + public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (rogue) + { + speedX *= player.Calamity().throwingVelocity; + speedY *= player.Calamity().throwingVelocity; + } + if (player.Calamity().luxorsGift) + { + // useTime 9 = 0.9 useTime 2 = 0.2 + double damageMult = 1.0; + if (item.useTime < 10) + damageMult -= (double)(10 - item.useTime) / 10.0; - double newDamage = (double)damage * damageMult; + double newDamage = (double)damage * damageMult; - if (player.whoAmI == Main.myPlayer) - { - if (item.melee && item.type != mod.ItemType("Murasama")) - Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, mod.ProjectileType("LuxorsGiftMelee"), (int)(newDamage * 0.6), 0f, player.whoAmI, 0f, 0f); + if (player.whoAmI == Main.myPlayer) + { + if (item.melee && item.type != mod.ItemType("Murasama")) + Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, mod.ProjectileType("LuxorsGiftMelee"), (int)(newDamage * 0.6), 0f, player.whoAmI, 0f, 0f); - else if (rogue) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LuxorsGiftRogue"), (int)(newDamage * 0.5), 0f, player.whoAmI, 0f, 0f); + else if (rogue) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LuxorsGiftRogue"), (int)(newDamage * 0.5), 0f, player.whoAmI, 0f, 0f); - else if (item.ranged) - Projectile.NewProjectile(position.X, position.Y, speedX * 1.5f, speedY * 1.5f, mod.ProjectileType("LuxorsGiftRanged"), (int)(newDamage * 0.4), 0f, player.whoAmI, 0f, 0f); + else if (item.ranged) + Projectile.NewProjectile(position.X, position.Y, speedX * 1.5f, speedY * 1.5f, mod.ProjectileType("LuxorsGiftRanged"), (int)(newDamage * 0.4), 0f, player.whoAmI, 0f, 0f); - else if (item.magic) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LuxorsGiftMagic"), (int)(newDamage * 0.8), 0f, player.whoAmI, 0f, 0f); + else if (item.magic) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LuxorsGiftMagic"), (int)(newDamage * 0.8), 0f, player.whoAmI, 0f, 0f); - else if (item.summon && player.ownedProjectileCounts[mod.ProjectileType("LuxorsGiftSummon")] < 1) - Projectile.NewProjectile(position.X, position.Y, 0f, 0f, mod.ProjectileType("LuxorsGiftSummon"), damage, 0f, player.whoAmI, 0f, 0f); - } - } - if (player.Calamity().eArtifact && item.ranged && !rogue) - { - speedX *= 1.25f; - speedY *= 1.25f; - } - if (player.Calamity().bloodflareMage) //0 - 99 - { - if (item.magic && Main.rand.Next(0, 100) >= 95) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * (player.Calamity().auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); - } - } - } - if (player.Calamity().bloodflareRanged) //0 - 99 - { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 98) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * (player.Calamity().auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.Calamity().tarraMage) - { - if (player.Calamity().tarraCrits >= 5 && player.whoAmI == Main.myPlayer) - { - player.Calamity().tarraCrits = 0; - int num106 = 9 + Main.rand.Next(3); - for (int num107 = 0; num107 < num106; num107++) - { - float num110 = 0.025f * (float)num107; - float hardar = speedX + (float)Main.rand.Next(-25, 26) * num110; - float hordor = speedY + (float)Main.rand.Next(-25, 26) * num110; - float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - num84 = item.shootSpeed / num84; - hardar *= num84; - hordor *= num84; - Projectile.NewProjectile(position.X, position.Y, hardar, hordor, 206, (int)((double)damage * 0.2), knockBack, player.whoAmI, 0.0f, 0.0f); - } - } - } - if (player.Calamity().ataxiaBolt) - { - if (item.ranged && !rogue && Main.rand.NextBool(2)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("ChaosFlare"), (int)((double)damage * 0.25), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.Calamity().godSlayerRanged) //0 - 99 - { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 95) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * (player.Calamity().auricSet ? 3.2 : 2.1)), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.Calamity().ataxiaVolley) - { - if (rogue && Main.rand.NextBool(10)) - { - if (player.whoAmI == Main.myPlayer) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 20); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - Vector2 vector2 = new Vector2(player.Center.X, player.Center.Y); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); - } - } - } - } - if (player.Calamity().reaverDoubleTap) //0 - 99 - { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 90) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("MiniRocket"), (int)((double)damage * 1.3), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.Calamity().victideSet) - { - if ((item.ranged || item.melee || item.magic || - rogue || item.summon) && item.rare < 8 && Main.rand.NextBool(10)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("Seashell"), damage * 2, 1f, player.whoAmI, 0f, 0f); - } - } - } - return true; - } - #endregion + else if (item.summon && player.ownedProjectileCounts[mod.ProjectileType("LuxorsGiftSummon")] < 1) + Projectile.NewProjectile(position.X, position.Y, 0f, 0f, mod.ProjectileType("LuxorsGiftSummon"), damage, 0f, player.whoAmI, 0f, 0f); + } + } + if (player.Calamity().eArtifact && item.ranged && !rogue) + { + speedX *= 1.25f; + speedY *= 1.25f; + } + if (player.Calamity().bloodflareMage) //0 - 99 + { + if (item.magic && Main.rand.Next(0, 100) >= 95) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * (player.Calamity().auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); + } + } + } + if (player.Calamity().bloodflareRanged) //0 - 99 + { + if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 98) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * (player.Calamity().auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.Calamity().tarraMage) + { + if (player.Calamity().tarraCrits >= 5 && player.whoAmI == Main.myPlayer) + { + player.Calamity().tarraCrits = 0; + int num106 = 9 + Main.rand.Next(3); + for (int num107 = 0; num107 < num106; num107++) + { + float num110 = 0.025f * (float)num107; + float hardar = speedX + (float)Main.rand.Next(-25, 26) * num110; + float hordor = speedY + (float)Main.rand.Next(-25, 26) * num110; + float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + num84 = item.shootSpeed / num84; + hardar *= num84; + hordor *= num84; + Projectile.NewProjectile(position.X, position.Y, hardar, hordor, 206, (int)((double)damage * 0.2), knockBack, player.whoAmI, 0.0f, 0.0f); + } + } + } + if (player.Calamity().ataxiaBolt) + { + if (item.ranged && !rogue && Main.rand.NextBool(2)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("ChaosFlare"), (int)((double)damage * 0.25), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.Calamity().godSlayerRanged) //0 - 99 + { + if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 95) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * (player.Calamity().auricSet ? 3.2 : 2.1)), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.Calamity().ataxiaVolley) + { + if (rogue && Main.rand.NextBool(10)) + { + if (player.whoAmI == Main.myPlayer) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 20); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + Vector2 vector2 = new Vector2(player.Center.X, player.Center.Y); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); + } + } + } + } + if (player.Calamity().reaverDoubleTap) //0 - 99 + { + if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 90) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("MiniRocket"), (int)((double)damage * 1.3), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.Calamity().victideSet) + { + if ((item.ranged || item.melee || item.magic || + rogue || item.summon) && item.rare < 8 && Main.rand.NextBool(10)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("Seashell"), damage * 2, 1f, player.whoAmI, 0f, 0f); + } + } + } + return true; + } + #endregion - #region SavingAndLoading - public override bool NeedsSaving(Item item) - { - return true; - } + #region SavingAndLoading + public override bool NeedsSaving(Item item) + { + return true; + } - public override TagCompound Save(Item item) - { - return new TagCompound - { - { - "rogue", rogue - }, - { - "timesUsed", timesUsed - }, - { - "rarity", postMoonLordRarity - } - }; - } + public override TagCompound Save(Item item) + { + return new TagCompound + { + { + "rogue", rogue + }, + { + "timesUsed", timesUsed + }, + { + "rarity", postMoonLordRarity + } + }; + } - public override void Load(Item item, TagCompound tag) - { - rogue = tag.GetBool("rogue"); - timesUsed = tag.GetInt("timesUsed"); - postMoonLordRarity = tag.GetInt("rarity"); - } + public override void Load(Item item, TagCompound tag) + { + rogue = tag.GetBool("rogue"); + timesUsed = tag.GetInt("timesUsed"); + postMoonLordRarity = tag.GetInt("rarity"); + } - public override void LoadLegacy(Item item, BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - postMoonLordRarity = reader.ReadInt32(); - timesUsed = reader.ReadInt32(); + public override void LoadLegacy(Item item, BinaryReader reader) + { + int loadVersion = reader.ReadInt32(); + postMoonLordRarity = reader.ReadInt32(); + timesUsed = reader.ReadInt32(); - if (loadVersion == 0) - { - BitsByte flags = reader.ReadByte(); - rogue = flags[0]; - } - else - { - ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); - } - } + if (loadVersion == 0) + { + BitsByte flags = reader.ReadByte(); + rogue = flags[0]; + } + else + { + ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); + } + } - public override void NetSend(Item item, BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = rogue; + public override void NetSend(Item item, BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = rogue; - writer.Write(flags); - writer.Write(postMoonLordRarity); - writer.Write(timesUsed); - } + writer.Write(flags); + writer.Write(postMoonLordRarity); + writer.Write(timesUsed); + } - public override void NetReceive(Item item, BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - rogue = flags[0]; + public override void NetReceive(Item item, BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + rogue = flags[0]; - postMoonLordRarity = reader.ReadInt32(); - timesUsed = reader.ReadInt32(); - } - #endregion + postMoonLordRarity = reader.ReadInt32(); + timesUsed = reader.ReadInt32(); + } + #endregion - #region Pickup Item Changes - public override bool OnPickup(Item item, Player player) - { - if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) - { - bool boostedHeart = player.Calamity().photosynthesis; - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - player.statLife -= (boostedHeart ? 5 : 10); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect((boostedHeart ? -5 : -10), true); - } - } - else if (boostedHeart) - { - player.statLife += 5; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(5, true); - } - } - } - return true; - } - #endregion + #region Pickup Item Changes + public override bool OnPickup(Item item, Player player) + { + if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) + { + bool boostedHeart = player.Calamity().photosynthesis; + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + player.statLife -= (boostedHeart ? 5 : 10); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect((boostedHeart ? -5 : -10), true); + } + } + else if (boostedHeart) + { + player.statLife += 5; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(5, true); + } + } + } + return true; + } + #endregion - #region Use Item Changes - public override bool CanUseItem(Item item, Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.type == ItemID.MonkStaffT1) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - if (item.type == ItemID.SpaceGun && player.spaceGun) - { - if (player.statMana >= (int)((float)3 * player.manaCost)) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= (int)((float)3 * player.manaCost); - } - else if (player.manaFlower) - { - player.QuickMana(); - if (player.statMana >= (int)((float)3 * player.manaCost)) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= (int)((float)3 * player.manaCost); - } - else - { - return false; - } - } - else - { - return false; - } - return true; - } - if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(mod.BuffType("Cadence")) > -1) - { - return false; - } - if (item.type == mod.ItemType("CrumblingPotion") && player.FindBuffIndex(mod.BuffType("ArmorShattering")) > -1) - { - return false; - } - if (item.type == ItemID.WrathPotion && player.FindBuffIndex(mod.BuffType("HolyWrathBuff")) > -1) - { - return false; - } - if (item.type == ItemID.RagePotion && player.FindBuffIndex(mod.BuffType("ProfanedRageBuff")) > -1) - { - return false; - } - if ((item.type == ItemID.SuperAbsorbantSponge || item.type == ItemID.EmptyBucket) && modPlayer.ZoneAbyss) - { - return false; - } - if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) - { - return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); - } - if (item.type == ItemID.RodofDiscord) - { - if (modPlayer.scarfCooldown) - { - player.AddBuff(BuffID.ChaosState, 720); - } - } - return true; - } - #endregion + #region Use Item Changes + public override bool CanUseItem(Item item, Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (item.type == ItemID.MonkStaffT1) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + if (item.type == ItemID.SpaceGun && player.spaceGun) + { + if (player.statMana >= (int)((float)3 * player.manaCost)) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= (int)((float)3 * player.manaCost); + } + else if (player.manaFlower) + { + player.QuickMana(); + if (player.statMana >= (int)((float)3 * player.manaCost)) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= (int)((float)3 * player.manaCost); + } + else + { + return false; + } + } + else + { + return false; + } + return true; + } + if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(mod.BuffType("Cadence")) > -1) + { + return false; + } + if (item.type == mod.ItemType("CrumblingPotion") && player.FindBuffIndex(mod.BuffType("ArmorShattering")) > -1) + { + return false; + } + if (item.type == ItemID.WrathPotion && player.FindBuffIndex(mod.BuffType("HolyWrathBuff")) > -1) + { + return false; + } + if (item.type == ItemID.RagePotion && player.FindBuffIndex(mod.BuffType("ProfanedRageBuff")) > -1) + { + return false; + } + if ((item.type == ItemID.SuperAbsorbantSponge || item.type == ItemID.EmptyBucket) && modPlayer.ZoneAbyss) + { + return false; + } + if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) + { + return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + } + if (item.type == ItemID.RodofDiscord) + { + if (modPlayer.scarfCooldown) + { + player.AddBuff(BuffID.ChaosState, 720); + } + } + return true; + } + #endregion - #region Modify Tooltips - public override void ModifyTooltips(Item item, List tooltips) - { - TooltipLine tt2 = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); - if (tt2 != null) - { - switch (postMoonLordRarity) - { - case 12: - tt2.overrideColor = new Color(0, 255, 200); - break; - case 13: - tt2.overrideColor = new Color(0, 255, 0); - break; - case 14: - tt2.overrideColor = new Color(43, 96, 222); - break; - case 15: - tt2.overrideColor = new Color(108, 45, 199); - break; - case 16: - tt2.overrideColor = new Color(255, 0, 255); - break; - case 17: //Legendary Weapons - if (item.type == mod.ItemType("Malachite")) - tt2.overrideColor = new Color(Main.DiscoR, 203, 103); - if (item.type == mod.ItemType("AegisBlade") || item.type == mod.ItemType("YharimsCrystal")) - tt2.overrideColor = new Color(255, Main.DiscoG, 53); - if (item.type == mod.ItemType("BrinyBaron")) - tt2.overrideColor = new Color(53, Main.DiscoG, 255); - if (item.type == mod.ItemType("CosmicDischarge")) - tt2.overrideColor = new Color(150, Main.DiscoG, 255); - if (item.type == mod.ItemType("BlossomFlux")) - tt2.overrideColor = new Color(Main.DiscoR, 203, 103); - if (item.type == mod.ItemType("SHPC")) - tt2.overrideColor = new Color(255, Main.DiscoG, 155); - if (item.type == mod.ItemType("Vesuvius")) - tt2.overrideColor = new Color(255, Main.DiscoG, 0); - break; - case 18: //Fabstaff - tt2.overrideColor = new Color(Main.DiscoR, 100, 255); - break; - case 19: //Blushie Staff - tt2.overrideColor = new Color(0, 0, 255); - break; - case 20: //Non-Expert Rainbow - tt2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - break; - case 21: //Patreon - tt2.overrideColor = new Color(139, 0, 0); - break; - case 22: //Rare Variants - tt2.overrideColor = new Color(255, 140, 0); - break; - default: - break; - } - } + #region Modify Tooltips + public override void ModifyTooltips(Item item, List tooltips) + { + TooltipLine tt2 = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); + if (tt2 != null) + { + switch (postMoonLordRarity) + { + case 12: + tt2.overrideColor = new Color(0, 255, 200); + break; + case 13: + tt2.overrideColor = new Color(0, 255, 0); + break; + case 14: + tt2.overrideColor = new Color(43, 96, 222); + break; + case 15: + tt2.overrideColor = new Color(108, 45, 199); + break; + case 16: + tt2.overrideColor = new Color(255, 0, 255); + break; + case 17: //Legendary Weapons + if (item.type == mod.ItemType("Malachite")) + tt2.overrideColor = new Color(Main.DiscoR, 203, 103); + if (item.type == mod.ItemType("AegisBlade") || item.type == mod.ItemType("YharimsCrystal")) + tt2.overrideColor = new Color(255, Main.DiscoG, 53); + if (item.type == mod.ItemType("BrinyBaron")) + tt2.overrideColor = new Color(53, Main.DiscoG, 255); + if (item.type == mod.ItemType("CosmicDischarge")) + tt2.overrideColor = new Color(150, Main.DiscoG, 255); + if (item.type == mod.ItemType("BlossomFlux")) + tt2.overrideColor = new Color(Main.DiscoR, 203, 103); + if (item.type == mod.ItemType("SHPC")) + tt2.overrideColor = new Color(255, Main.DiscoG, 155); + if (item.type == mod.ItemType("Vesuvius")) + tt2.overrideColor = new Color(255, Main.DiscoG, 0); + break; + case 18: //Fabstaff + tt2.overrideColor = new Color(Main.DiscoR, 100, 255); + break; + case 19: //Blushie Staff + tt2.overrideColor = new Color(0, 0, 255); + break; + case 20: //Non-Expert Rainbow + tt2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + break; + case 21: //Patreon + tt2.overrideColor = new Color(139, 0, 0); + break; + case 22: //Rare Variants + tt2.overrideColor = new Color(255, 140, 0); + break; + default: + break; + } + } - /*if (item.ammo == 97) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria") - { - if (line2.Name == "Damage") - line2.text = ""; - } - } - }*/ + /*if (item.ammo == 97) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria") + { + if (line2.Name == "Damage") + line2.text = ""; + } + } + }*/ - if (item.type == ItemID.SuperAbsorbantSponge) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Capable of soaking up an endless amount of water\n" + - "Cannot be used in the Abyss"; - } - } - } - if (item.type == ItemID.EmptyBucket) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "1 defense\n" + - "Cannot be used in the Abyss"; - } - } - } - if (item.type == ItemID.CrimsonHeart) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a heart to provide light\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ShadowOrb) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Creates a magical shadow orb\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.MagicLantern) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a magic lantern that exposes nearby treasure\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ArcticDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Provides light under water and extra mobility on ice\n" + - "Provides a small amount of light in the abyss\n" + - "Moderately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishNecklace) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.FairyBell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a magical fairy\n" + - "Provides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.DD2PetGhost) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a pet flickerwick to provide light\n" + - "Provides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ShinePotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text = "5 minute duration\n" + - "Provides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.WispinaBottle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a Wisp to provide light\n" + - "Provides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.SuspiciousLookingTentacle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "'I know what you're thinking...'\n" + - "Provides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.GillsPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text = "2 minute duration\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.DivingHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Greatly extends underwater breathing\n" + - "Moderately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.NeptunesShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Transforms the holder into merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.MoonShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Turns the holder into a werewolf at night and a merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.CelestialShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Minor increases to all stats\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.WarmthPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduces damage from cold sources\n" + - "Makes you immune to the Chilled, Frozen, and Glacial State debuffs"; - } - } - } - if (item.type == ItemID.WormScarf) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduces damage taken by 10%"; - } - } - } - if (item.type == ItemID.FireGauntlet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed"; - } - } - } - if (item.type == ItemID.SpectreHood) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% decreased magic damage"; - } - } - } - if (item.type == ItemID.ApprenticeHat) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and reduces mana costs by 10%\n" + - "30% increased minion damage"; - } - } - } - if (item.type == ItemID.ApprenticeRobe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "10% increased magic damage"; - } - } - } - if (item.type == ItemID.ApprenticeTrousers) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.SquireGreatHelm) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and increases your life regeneration\n" + - "30% increased minion damage and 20% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.SquirePlating) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "15% increased melee damage"; - } - } - } - if (item.type == ItemID.SquireGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.HuntressWig) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and increases ranged critical strike chance by 10%\n" + - "30% increased minion damage"; - } - } - } - if (item.type == ItemID.HuntressJerkin) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased ranged damage"; - } - } - } - if (item.type == ItemID.HuntressPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.MonkBrows) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and increases melee attack speed by 20%\n" + - "30% increased minion damage and 10% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.MonkShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased melee damage"; - } - } - } - if (item.type == ItemID.MonkPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.ApprenticeAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "60% increased minion damage and 25% increased magic damage and critical strike chance"; - } - } - } - if (item.type == ItemID.ApprenticeAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.ApprenticeAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.MonkAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries\n" + - "Increases melee damage, speed, and critical strike chance by 20% and minion damage by 60%"; - } - } - } - if (item.type == ItemID.MonkAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.MonkAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.HuntressAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "60% increased minion damage and 10% increased ranged critical strike chance\n" + - "25% increased ranged damage"; - } - } - } - if (item.type == ItemID.HuntressAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.HuntressAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.SquireAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and grants you 60% minion damage\n" + - "20% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.SquireAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Massively increased life regeneration"; - } - } - } - if (item.type == ItemID.SquireAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "30% increased movement speed"; - } - } - } - if (item.type == ItemID.ObsidianSkinPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to direct damage from touching lava\n" + - "Provides temporary immunity to lava burn damage\n" + - "Reduces lava burn damage"; - } - } - } - if (item.type == ItemID.ObsidianRose) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduced direct damage from touching lava\n" + - "Greatly reduces lava burn damage"; - } - } - } - if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; - } - } - } - if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; - } - } - } - if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; - } - } - } - if (item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; - } - } - } - if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; - } - } - } - if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; - } - } - } - if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; - } - } - } - if (item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; - } - } - } - if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; - } - } - } - if (item.type == ItemID.GladiatorHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "5% increased rogue damage"; - } - } - } - if (item.type == ItemID.GladiatorBreastplate) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "7 defense\n" + - "5% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.GladiatorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "5% increased rogue velocity"; - } - } - } - if (item.type == ItemID.ObsidianHelm) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "5% increased rogue damage"; - } - } - } - if (item.type == ItemID.ObsidianShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "5% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.ObsidianPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "5% increased rogue velocity"; - } - } - } - if (item.type == ItemID.MagicQuiver) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; - } - } - } - if (item.type == ItemID.AngelWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "+20 max life, +15 defense and +3 life regen"; - } - } - } - if (item.type == ItemID.DemonWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "10% increased damage and critical strike chance"; - } - } - } - if (item.type == ItemID.Jetpack) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 115"; - } - } - } - if (item.type == ItemID.ButterflyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+50 max mana, 5% decreased mana usage,\n" + - "10% increased magic damage and 5% increased magic critical strike chance"; - } - } - } - if (item.type == ItemID.FairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+80 max life"; - } - } - } - if (item.type == ItemID.BeeWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "Honey buff at all times"; - } - } - } - if (item.type == ItemID.HarpyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "30% increased movement speed"; - } - } - } - if (item.type == ItemID.BoneWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "15% increased movement speed, 12% increased ranged damage,\n" + - "16% increased ranged critical strike chance\n" + - "and +30 defense while wearing the Necro Armor"; - } - } - } - if (item.type == ItemID.FlameWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "10% increased melee damage\n" + - "and 5% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.FrozenWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "7% increased melee and ranged damage\n" + - "and 3% increased melee and ranged critical strike chance\n" + - "while wearing the Frost Armor"; - } - } - } - if (item.type == ItemID.GhostWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense and 5% increased damage reduction while wearing the Spectre Armor and Hood\n" + - "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Spectre Armor and Mask"; - } - } - } - if (item.type == ItemID.BeetleWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+15 defense and 10% increased damage reduction while wearing the Beetle Armor and Shell\n" + - "10% increased melee damage and critical strike chance while wearing the Beetle Armor and Scale Mail"; - } - } - } - if (item.type == ItemID.FinWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "Gills effect and you can move freely through liquids\n" + - "You fall faster while submerged in liquid\n" + - "20% increased movement speed and 180% increased jump speed"; - } - } - } - if (item.type == ItemID.FishronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 8\n" + - "Acceleration multiplier: 2\n" + - "Good vertical speed\n" + - "Flight time: 180"; - } - } - } - if (item.type == ItemID.SteampunkWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "+10 defense, 10% increased movement speed,\n" + - "and 5% increased damage and critical strike chance"; - } - } - } - if (item.type == ItemID.LeafWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160"; - } - } - } - if (item.type == ItemID.BatWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "10% increased movement speed and 100% increased jump speed\n" + - "+20 defense, 15% increased damage, 7% increased critical strike chance\n" + - "and 10% increased movement speed at night"; - } - } - } - if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || - item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || - item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || - item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "'Great for impersonating devs!'\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.type == ItemID.TatteredFairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "5% increased damage and critical strike chance"; - } - } - } - if (item.type == ItemID.SpookyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "+1 max minion and 10% increased minion damage while wearing the Spooky Armor"; - } - } - } - if (item.type == ItemID.Hoverboard) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170"; - } - } - } - if (item.type == ItemID.FestiveWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170\n" + - "+50 max life"; - } - } - } - if (item.type == ItemID.MothronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense, 10% increased damage," + - "5% increased critical strike chance," + - "10% increased movement speed and 120% increased jump speed"; - } - } - } - if (item.type == ItemID.WingsSolar) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "7% increased melee damage and 3% increased melee critical strike chance\n" + - "while wearing the Solar Flare Armor"; - } - } - } - if (item.type == ItemID.WingsStardust) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"; - } - } - } - if (item.type == ItemID.WingsVortex) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "3% increased ranged damage and 7% increased ranged critical strike chance\n" + - "while wearing the Vortex Armor"; - } - } - } - if (item.type == ItemID.WingsNebula) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Nebula Armor"; - } - } - } - if (item.type == ItemID.BetsyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Allows flight and slow fall\n" + - "Horizontal speed: 6\n" + - "Acceleration multiplier: 2.5\n" + - "Good vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.accessory) - { - if (item.prefix == 67) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - { - line2.text = "+1% critical strike chance"; - } - } - } - if (item.prefix == 68) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - { - line2.text = "+3% critical strike chance"; - } - } - } - if (item.prefix == 62) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+1 defense\n" + - "+0.25% damage reduction"; - } - } - } - if (item.prefix == 63) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+2 defense\n" + - "+0.5% damage reduction"; - } - } - } - if (item.prefix == 64) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+3 defense\n" + - "+0.75% damage reduction"; - } - } - } - if (item.prefix == 65) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+4 defense\n" + - "+1% damage reduction"; - } - } - } - } - } - #endregion + if (item.type == ItemID.SuperAbsorbantSponge) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Capable of soaking up an endless amount of water\n" + + "Cannot be used in the Abyss"; + } + } + } + if (item.type == ItemID.EmptyBucket) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "1 defense\n" + + "Cannot be used in the Abyss"; + } + } + } + if (item.type == ItemID.CrimsonHeart) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a heart to provide light\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.ShadowOrb) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Creates a magical shadow orb\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.MagicLantern) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a magic lantern that exposes nearby treasure\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.ArcticDivingGear) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Provides light under water and extra mobility on ice\n" + + "Provides a small amount of light in the abyss\n" + + "Moderately reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.JellyfishNecklace) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides light under water\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.JellyfishDivingGear) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Provides light under water\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.FairyBell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a magical fairy\n" + + "Provides a moderate amount of light in the abyss"; + } + } + } + if (item.type == ItemID.DD2PetGhost) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a pet flickerwick to provide light\n" + + "Provides a moderate amount of light in the abyss"; + } + } + } + if (item.type == ItemID.ShinePotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "BuffTime") + { + line2.text = "5 minute duration\n" + + "Provides a moderate amount of light in the abyss"; + } + } + } + if (item.type == ItemID.WispinaBottle) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a Wisp to provide light\n" + + "Provides a large amount of light in the abyss"; + } + } + } + if (item.type == ItemID.SuspiciousLookingTentacle) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "'I know what you're thinking...'\n" + + "Provides a large amount of light in the abyss"; + } + } + } + if (item.type == ItemID.GillsPotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "BuffTime") + { + line2.text = "2 minute duration\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.DivingHelmet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Greatly extends underwater breathing\n" + + "Moderately reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.NeptunesShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Transforms the holder into merfolk when entering water\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.MoonShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Turns the holder into a werewolf at night and a merfolk when entering water\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.CelestialShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Minor increases to all stats\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.WarmthPotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduces damage from cold sources\n" + + "Makes you immune to the Chilled, Frozen, and Glacial State debuffs"; + } + } + } + if (item.type == ItemID.WormScarf) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduces damage taken by 10%"; + } + } + } + if (item.type == ItemID.FireGauntlet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "14% increased melee damage and speed"; + } + } + } + if (item.type == ItemID.SpectreHood) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% decreased magic damage"; + } + } + } + if (item.type == ItemID.ApprenticeHat) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and reduces mana costs by 10%\n" + + "30% increased minion damage"; + } + } + } + if (item.type == ItemID.ApprenticeRobe) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "10% increased magic damage"; + } + } + } + if (item.type == ItemID.ApprenticeTrousers) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.SquireGreatHelm) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and increases your life regeneration\n" + + "30% increased minion damage and 20% increased melee critical strike chance"; + } + } + } + if (item.type == ItemID.SquirePlating) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "15% increased melee damage"; + } + } + } + if (item.type == ItemID.SquireGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.HuntressWig) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and increases ranged critical strike chance by 10%\n" + + "30% increased minion damage"; + } + } + } + if (item.type == ItemID.HuntressJerkin) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased ranged damage"; + } + } + } + if (item.type == ItemID.HuntressPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.MonkBrows) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and increases melee attack speed by 20%\n" + + "30% increased minion damage and 10% increased melee critical strike chance"; + } + } + } + if (item.type == ItemID.MonkShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased melee damage"; + } + } + } + if (item.type == ItemID.MonkPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.ApprenticeAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "60% increased minion damage and 25% increased magic damage and critical strike chance"; + } + } + } + if (item.type == ItemID.ApprenticeAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.ApprenticeAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.MonkAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries\n" + + "Increases melee damage, speed, and critical strike chance by 20% and minion damage by 60%"; + } + } + } + if (item.type == ItemID.MonkAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.MonkAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.HuntressAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "60% increased minion damage and 10% increased ranged critical strike chance\n" + + "25% increased ranged damage"; + } + } + } + if (item.type == ItemID.HuntressAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.HuntressAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.SquireAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and grants you 60% minion damage\n" + + "20% increased melee critical strike chance"; + } + } + } + if (item.type == ItemID.SquireAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Massively increased life regeneration"; + } + } + } + if (item.type == ItemID.SquireAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "30% increased movement speed"; + } + } + } + if (item.type == ItemID.ObsidianSkinPotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides immunity to direct damage from touching lava\n" + + "Provides temporary immunity to lava burn damage\n" + + "Reduces lava burn damage"; + } + } + } + if (item.type == ItemID.ObsidianRose) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduced direct damage from touching lava\n" + + "Greatly reduces lava burn damage"; + } + } + } + if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; + } + } + } + if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; + } + } + } + if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; + } + } + } + if (item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; + } + } + } + if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; + } + } + } + if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; + } + } + } + if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; + } + } + } + if (item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; + } + } + } + if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; + } + } + } + if (item.type == ItemID.GladiatorHelmet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "5% increased rogue damage"; + } + } + } + if (item.type == ItemID.GladiatorBreastplate) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "7 defense\n" + + "5% increased rogue critical strike chance"; + } + } + } + if (item.type == ItemID.GladiatorLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "5 defense\n" + + "5% increased rogue velocity"; + } + } + } + if (item.type == ItemID.ObsidianHelm) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "5% increased rogue damage"; + } + } + } + if (item.type == ItemID.ObsidianShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "5 defense\n" + + "5% increased rogue critical strike chance"; + } + } + } + if (item.type == ItemID.ObsidianPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "5% increased rogue velocity"; + } + } + } + if (item.type == ItemID.MagicQuiver) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; + } + } + } + if (item.type == ItemID.AngelWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 100\n" + + "+20 max life, +15 defense and +3 life regen"; + } + } + } + if (item.type == ItemID.DemonWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 100\n" + + "10% increased damage and critical strike chance"; + } + } + } + if (item.type == ItemID.Jetpack) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 115"; + } + } + } + if (item.type == ItemID.ButterflyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 130\n" + + "+50 max mana, 5% decreased mana usage,\n" + + "10% increased magic damage and 5% increased magic critical strike chance"; + } + } + } + if (item.type == ItemID.FairyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 130\n" + + "+80 max life"; + } + } + } + if (item.type == ItemID.BeeWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 130\n" + + "Honey buff at all times"; + } + } + } + if (item.type == ItemID.HarpyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 140\n" + + "30% increased movement speed"; + } + } + } + if (item.type == ItemID.BoneWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 140\n" + + "15% increased movement speed, 12% increased ranged damage,\n" + + "16% increased ranged critical strike chance\n" + + "and +30 defense while wearing the Necro Armor"; + } + } + } + if (item.type == ItemID.FlameWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "10% increased melee damage\n" + + "and 5% increased melee critical strike chance"; + } + } + } + if (item.type == ItemID.FrozenWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "7% increased melee and ranged damage\n" + + "and 3% increased melee and ranged critical strike chance\n" + + "while wearing the Frost Armor"; + } + } + } + if (item.type == ItemID.GhostWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "+10 defense and 5% increased damage reduction while wearing the Spectre Armor and Hood\n" + + "+20 max mana, 5% increased magic damage and critical strike chance,\n" + + "and 5% decreased mana usage while wearing the Spectre Armor and Mask"; + } + } + } + if (item.type == ItemID.BeetleWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "+15 defense and 10% increased damage reduction while wearing the Beetle Armor and Shell\n" + + "10% increased melee damage and critical strike chance while wearing the Beetle Armor and Scale Mail"; + } + } + } + if (item.type == ItemID.FinWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 100\n" + + "Gills effect and you can move freely through liquids\n" + + "You fall faster while submerged in liquid\n" + + "20% increased movement speed and 180% increased jump speed"; + } + } + } + if (item.type == ItemID.FishronWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 8\n" + + "Acceleration multiplier: 2\n" + + "Good vertical speed\n" + + "Flight time: 180"; + } + } + } + if (item.type == ItemID.SteampunkWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180\n" + + "+10 defense, 10% increased movement speed,\n" + + "and 5% increased damage and critical strike chance"; + } + } + } + if (item.type == ItemID.LeafWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160"; + } + } + } + if (item.type == ItemID.BatWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 140\n" + + "10% increased movement speed and 100% increased jump speed\n" + + "+20 defense, 15% increased damage, 7% increased critical strike chance\n" + + "and 10% increased movement speed at night"; + } + } + } + if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || + item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || + item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || + item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "'Great for impersonating devs!'\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 150"; + } + } + } + if (item.type == ItemID.TatteredFairyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180\n" + + "5% increased damage and critical strike chance"; + } + } + } + if (item.type == ItemID.SpookyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180\n" + + "+1 max minion and 10% increased minion damage while wearing the Spooky Armor"; + } + } + } + if (item.type == ItemID.Hoverboard) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 170"; + } + } + } + if (item.type == ItemID.FestiveWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 170\n" + + "+50 max life"; + } + } + } + if (item.type == ItemID.MothronWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "+10 defense, 10% increased damage," + + "5% increased critical strike chance," + + "10% increased movement speed and 120% increased jump speed"; + } + } + } + if (item.type == ItemID.WingsSolar) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 9\n" + + "Acceleration multiplier: 2.5\n" + + "Great vertical speed\n" + + "Flight time: 180\n" + + "7% increased melee damage and 3% increased melee critical strike chance\n" + + "while wearing the Solar Flare Armor"; + } + } + } + if (item.type == ItemID.WingsStardust) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 9\n" + + "Acceleration multiplier: 2.5\n" + + "Great vertical speed\n" + + "Flight time: 180\n" + + "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"; + } + } + } + if (item.type == ItemID.WingsVortex) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1.5\n" + + "Good vertical speed\n" + + "Flight time: 160\n" + + "3% increased ranged damage and 7% increased ranged critical strike chance\n" + + "while wearing the Vortex Armor"; + } + } + } + if (item.type == ItemID.WingsNebula) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1.5\n" + + "Good vertical speed\n" + + "Flight time: 160\n" + + "+20 max mana, 5% increased magic damage and critical strike chance,\n" + + "and 5% decreased mana usage while wearing the Nebula Armor"; + } + } + } + if (item.type == ItemID.BetsyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Allows flight and slow fall\n" + + "Horizontal speed: 6\n" + + "Acceleration multiplier: 2.5\n" + + "Good vertical speed\n" + + "Flight time: 150"; + } + } + } + if (item.accessory) + { + if (item.prefix == 67) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") + { + line2.text = "+1% critical strike chance"; + } + } + } + if (item.prefix == 68) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") + { + line2.text = "+3% critical strike chance"; + } + } + } + if (item.prefix == 62) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+1 defense\n" + + "+0.25% damage reduction"; + } + } + } + if (item.prefix == 63) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+2 defense\n" + + "+0.5% damage reduction"; + } + } + } + if (item.prefix == 64) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+3 defense\n" + + "+0.75% damage reduction"; + } + } + } + if (item.prefix == 65) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+4 defense\n" + + "+1% damage reduction"; + } + } + } + } + } + #endregion - // NOTE: this function applies to all treasure bags, even modded ones (despite the name). - #region Boss Bag Changes - public override void OpenVanillaBag(string context, Player player, int arg) - { - if (context == "bossBag") - { - // Give a chance for Laudanum, Stress Pills and Heart of Darkness from every boss bag - DropHelper.DropRevBagAccessories(player); + // NOTE: this function applies to all treasure bags, even modded ones (despite the name). + #region Boss Bag Changes + public override void OpenVanillaBag(string context, Player player, int arg) + { + if (context == "bossBag") + { + // Give a chance for Laudanum, Stress Pills and Heart of Darkness from every boss bag + DropHelper.DropRevBagAccessories(player); - switch (arg) - { - // King Slime - case ItemID.KingSlimeBossBag: - DropHelper.DropItemCondition(player, mod.ItemType("CrownJewel"), CalamityWorld.revenge); - break; + switch (arg) + { + // King Slime + case ItemID.KingSlimeBossBag: + DropHelper.DropItemCondition(player, mod.ItemType("CrownJewel"), CalamityWorld.revenge); + break; - // Eye of Cthulhu - case ItemID.EyeOfCthulhuBossBag: - DropHelper.DropItem(player, mod.ItemType("VictoryShard"), 3, 5); - DropHelper.DropItemChance(player, mod.ItemType("TeardropCleaver"), 3); - DropHelper.DropItemCondition(player, mod.ItemType("CounterScarf"), CalamityWorld.revenge); - break; + // Eye of Cthulhu + case ItemID.EyeOfCthulhuBossBag: + DropHelper.DropItem(player, mod.ItemType("VictoryShard"), 3, 5); + DropHelper.DropItemChance(player, mod.ItemType("TeardropCleaver"), 3); + DropHelper.DropItemCondition(player, mod.ItemType("CounterScarf"), CalamityWorld.revenge); + break; - // Skeletron - case ItemID.SkeletronBossBag: - DropHelper.DropItemChance(player, mod.ItemType("ClothiersWrath"), DropHelper.RareVariantDropRateInt); - break; + // Skeletron + case ItemID.SkeletronBossBag: + DropHelper.DropItemChance(player, mod.ItemType("ClothiersWrath"), DropHelper.RareVariantDropRateInt); + break; - // Wall of Flesh - case ItemID.WallOfFleshBossBag: - DropHelper.DropItemChance(player, mod.ItemType("Meowthrower"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BlackHawkRemote"), 3); - DropHelper.DropItemChance(player, mod.ItemType("RogueEmblem"), 4); - DropHelper.DropItemFromSetChance(player, 5, ItemID.CorruptionKey, ItemID.CrimsonKey); - DropHelper.DropItem(player, mod.ItemType("MLGRune")); // Demon Trophy - break; + // Wall of Flesh + case ItemID.WallOfFleshBossBag: + DropHelper.DropItemChance(player, mod.ItemType("Meowthrower"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BlackHawkRemote"), 3); + DropHelper.DropItemChance(player, mod.ItemType("RogueEmblem"), 4); + DropHelper.DropItemFromSetChance(player, 5, ItemID.CorruptionKey, ItemID.CrimsonKey); + DropHelper.DropItem(player, mod.ItemType("MLGRune")); // Demon Trophy + break; - // Destroyer - case ItemID.DestroyerBossBag: - float shpcChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("SHPC"), CalamityWorld.revenge, shpcChance); - break; + // Destroyer + case ItemID.DestroyerBossBag: + float shpcChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("SHPC"), CalamityWorld.revenge, shpcChance); + break; - // Plantera - case ItemID.PlanteraBossBag: - DropHelper.DropItem(player, mod.ItemType("LivingShard"), 8, 11); - float bFluxChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("BlossomFlux"), CalamityWorld.revenge, bFluxChance); - DropHelper.DropItemChance(player, ItemID.JungleKey, 5); - break; + // Plantera + case ItemID.PlanteraBossBag: + DropHelper.DropItem(player, mod.ItemType("LivingShard"), 8, 11); + float bFluxChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("BlossomFlux"), CalamityWorld.revenge, bFluxChance); + DropHelper.DropItemChance(player, ItemID.JungleKey, 5); + break; - // Golem - case ItemID.GolemBossBag: - float aegisChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("AegisBlade"), CalamityWorld.revenge, aegisChance); - break; + // Golem + case ItemID.GolemBossBag: + float aegisChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("AegisBlade"), CalamityWorld.revenge, aegisChance); + break; - // Duke Fishron - case ItemID.FishronBossBag: - float baronChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("BrinyBaron"), CalamityWorld.revenge, baronChance); - break; + // Duke Fishron + case ItemID.FishronBossBag: + float baronChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("BrinyBaron"), CalamityWorld.revenge, baronChance); + break; - // Betsy - case ItemID.BossBagBetsy: - float vesuviusChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("Vesuvius"), CalamityWorld.revenge, vesuviusChance); - break; + // Betsy + case ItemID.BossBagBetsy: + float vesuviusChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("Vesuvius"), CalamityWorld.revenge, vesuviusChance); + break; - // Moon Lord - case ItemID.MoonLordBossBag: - DropHelper.DropItem(player, mod.ItemType("MLGRune2")); // Celestial Onion - DropHelper.DropItemChance(player, mod.ItemType("UtensilPoker"), 8); - DropHelper.DropItemChance(player, mod.ItemType("GrandDad"), DropHelper.RareVariantDropRateInt); - DropHelper.DropItemChance(player, mod.ItemType("Infinity"), DropHelper.RareVariantDropRateInt); - break; - } - } - } - #endregion + // Moon Lord + case ItemID.MoonLordBossBag: + DropHelper.DropItem(player, mod.ItemType("MLGRune2")); // Celestial Onion + DropHelper.DropItemChance(player, mod.ItemType("UtensilPoker"), 8); + DropHelper.DropItemChance(player, mod.ItemType("GrandDad"), DropHelper.RareVariantDropRateInt); + DropHelper.DropItemChance(player, mod.ItemType("Infinity"), DropHelper.RareVariantDropRateInt); + break; + } + } + } + #endregion - #region Armor Set Changes - public override string IsArmorSet(Item head, Item body, Item legs) - { - if (head.type == ItemID.CopperHelmet && body.type == ItemID.CopperChainmail && legs.type == ItemID.CopperGreaves) - return "Copper"; - if (head.type == ItemID.TinHelmet && body.type == ItemID.TinChainmail && legs.type == ItemID.TinGreaves) - return "Tin"; - if (head.type == ItemID.IronHelmet && body.type == ItemID.IronChainmail && legs.type == ItemID.IronGreaves) - return "Iron"; - if (head.type == ItemID.LeadHelmet && body.type == ItemID.LeadChainmail && legs.type == ItemID.LeadGreaves) - return "Lead"; - if (head.type == ItemID.SilverHelmet && body.type == ItemID.SilverChainmail && legs.type == ItemID.SilverGreaves) - return "Silver"; - if (head.type == ItemID.TungstenHelmet && body.type == ItemID.TungstenChainmail && legs.type == ItemID.TungstenGreaves) - return "Tungsten"; - if (head.type == ItemID.GoldHelmet && body.type == ItemID.GoldChainmail && legs.type == ItemID.GoldGreaves) - return "Gold"; - if (head.type == ItemID.PlatinumHelmet && body.type == ItemID.PlatinumChainmail && legs.type == ItemID.PlatinumGreaves) - return "Platinum"; - if (head.type == ItemID.GladiatorHelmet && body.type == ItemID.GladiatorBreastplate && legs.type == ItemID.GladiatorLeggings) - return "Gladiator"; - if (head.type == ItemID.ObsidianHelm && body.type == ItemID.ObsidianShirt && legs.type == ItemID.ObsidianPants) - return "Obsidian"; - return ""; - } + #region Armor Set Changes + public override string IsArmorSet(Item head, Item body, Item legs) + { + if (head.type == ItemID.CopperHelmet && body.type == ItemID.CopperChainmail && legs.type == ItemID.CopperGreaves) + return "Copper"; + if (head.type == ItemID.TinHelmet && body.type == ItemID.TinChainmail && legs.type == ItemID.TinGreaves) + return "Tin"; + if (head.type == ItemID.IronHelmet && body.type == ItemID.IronChainmail && legs.type == ItemID.IronGreaves) + return "Iron"; + if (head.type == ItemID.LeadHelmet && body.type == ItemID.LeadChainmail && legs.type == ItemID.LeadGreaves) + return "Lead"; + if (head.type == ItemID.SilverHelmet && body.type == ItemID.SilverChainmail && legs.type == ItemID.SilverGreaves) + return "Silver"; + if (head.type == ItemID.TungstenHelmet && body.type == ItemID.TungstenChainmail && legs.type == ItemID.TungstenGreaves) + return "Tungsten"; + if (head.type == ItemID.GoldHelmet && body.type == ItemID.GoldChainmail && legs.type == ItemID.GoldGreaves) + return "Gold"; + if (head.type == ItemID.PlatinumHelmet && body.type == ItemID.PlatinumChainmail && legs.type == ItemID.PlatinumGreaves) + return "Platinum"; + if (head.type == ItemID.GladiatorHelmet && body.type == ItemID.GladiatorBreastplate && legs.type == ItemID.GladiatorLeggings) + return "Gladiator"; + if (head.type == ItemID.ObsidianHelm && body.type == ItemID.ObsidianShirt && legs.type == ItemID.ObsidianPants) + return "Obsidian"; + return ""; + } - public override void UpdateArmorSet(Player player, string set) - { - if (set == "Copper") - player.pickSpeed -= 0.15f; - else if (set == "Tin") - player.pickSpeed -= 0.1f; - else if (set == "Iron") - player.pickSpeed -= 0.25f; - else if (set == "Lead") - player.pickSpeed -= 0.2f; - else if (set == "Silver") - player.pickSpeed -= 0.35f; - else if (set == "Tungsten") - player.pickSpeed -= 0.3f; - else if (set == "Gold") - player.pickSpeed -= 0.45f; - else if (set == "Platinum") - player.pickSpeed -= 0.4f; - else if (set == "Gladiator") - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rogueStealthMax = 1f; + public override void UpdateArmorSet(Player player, string set) + { + if (set == "Copper") + player.pickSpeed -= 0.15f; + else if (set == "Tin") + player.pickSpeed -= 0.1f; + else if (set == "Iron") + player.pickSpeed -= 0.25f; + else if (set == "Lead") + player.pickSpeed -= 0.2f; + else if (set == "Silver") + player.pickSpeed -= 0.35f; + else if (set == "Tungsten") + player.pickSpeed -= 0.3f; + else if (set == "Gold") + player.pickSpeed -= 0.45f; + else if (set == "Platinum") + player.pickSpeed -= 0.4f; + else if (set == "Gladiator") + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rogueStealthMax = 1f; modPlayer.wearingRogueArmor = true; - player.Calamity().throwingDamage += 0.1f; - player.Calamity().throwingVelocity += 0.1f; - player.statDefense += 5; - player.setBonus = "+5 defense\n" + - "10% increased rogue damage and velocity\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } - else if (set == "Obsidian") - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rogueStealthMax = 1f; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingVelocity += 0.1f; + player.statDefense += 5; + player.setBonus = "+5 defense\n" + + "10% increased rogue damage and velocity\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + } + else if (set == "Obsidian") + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rogueStealthMax = 1f; modPlayer.wearingRogueArmor = true; - player.Calamity().throwingDamage += 0.05f; - player.Calamity().throwingCrit += 5; - player.statDefense += 2; - player.fireWalk = true; - player.lavaMax += 180; - player.setBonus = "+2 defense\n" + - "5% increased rogue damage and critical strike chance\n" + - "Grants immunity to fire blocks and temporary immunity to lava\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } - } - #endregion + player.Calamity().throwingDamage += 0.05f; + player.Calamity().throwingCrit += 5; + player.statDefense += 2; + player.fireWalk = true; + player.lavaMax += 180; + player.setBonus = "+2 defense\n" + + "5% increased rogue damage and critical strike chance\n" + + "Grants immunity to fire blocks and temporary immunity to lava\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + } + } + #endregion - #region Equip Changes - public override void UpdateEquip(Item item, Player player) - { - if (item.type == ItemID.FireGauntlet) - { - player.meleeDamage += 0.04f; - player.meleeSpeed += 0.04f; - } + #region Equip Changes + public override void UpdateEquip(Item item, Player player) + { + if (item.type == ItemID.FireGauntlet) + { + player.meleeDamage += 0.04f; + player.meleeSpeed += 0.04f; + } - #region Head - if (item.type == ItemID.SpectreHood) - player.magicDamage += 0.2f; - else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) - player.Calamity().throwingDamage += 0.05f; - else if (item.type == ItemID.ApprenticeHat) - player.minionDamage += 0.3f; - else if (item.type == ItemID.SquireGreatHelm) - { - player.minionDamage += 0.3f; - player.meleeCrit += 20; - } - else if (item.type == ItemID.HuntressWig) - player.minionDamage += 0.3f; - else if (item.type == ItemID.MonkBrows) - { - player.minionDamage += 0.3f; - player.meleeCrit += 10; - } - else if (item.type == ItemID.ApprenticeAltHead) - { - player.minionDamage += 0.5f; - player.magicDamage += 0.15f; - player.magicCrit += 25; - } - else if (item.type == ItemID.MonkAltHead) - { - player.minionDamage += 0.4f; - player.meleeSpeed += 0.2f; - player.meleeCrit += 20; - } - else if (item.type == ItemID.HuntressAltHead) - { - player.minionDamage += 0.5f; - player.rangedDamage += 0.25f; - } - else if (item.type == ItemID.SquireAltHead) - { - player.minionDamage += 0.5f; - player.meleeCrit += 20; - } - #endregion + #region Head + if (item.type == ItemID.SpectreHood) + player.magicDamage += 0.2f; + else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) + player.Calamity().throwingDamage += 0.05f; + else if (item.type == ItemID.ApprenticeHat) + player.minionDamage += 0.3f; + else if (item.type == ItemID.SquireGreatHelm) + { + player.minionDamage += 0.3f; + player.meleeCrit += 20; + } + else if (item.type == ItemID.HuntressWig) + player.minionDamage += 0.3f; + else if (item.type == ItemID.MonkBrows) + { + player.minionDamage += 0.3f; + player.meleeCrit += 10; + } + else if (item.type == ItemID.ApprenticeAltHead) + { + player.minionDamage += 0.5f; + player.magicDamage += 0.15f; + player.magicCrit += 25; + } + else if (item.type == ItemID.MonkAltHead) + { + player.minionDamage += 0.4f; + player.meleeSpeed += 0.2f; + player.meleeCrit += 20; + } + else if (item.type == ItemID.HuntressAltHead) + { + player.minionDamage += 0.5f; + player.rangedDamage += 0.25f; + } + else if (item.type == ItemID.SquireAltHead) + { + player.minionDamage += 0.5f; + player.meleeCrit += 20; + } + #endregion - #region Body - if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) - player.Calamity().throwingCrit += 5; - else if (item.type == ItemID.PalladiumBreastplate) - player.Calamity().throwingCrit += 2; - else if (item.type == ItemID.CobaltBreastplate) - player.Calamity().throwingCrit += 3; - else if (item.type == ItemID.OrichalcumBreastplate) - player.Calamity().throwingCrit += 6; - else if (item.type == ItemID.TitaniumBreastplate) - player.Calamity().throwingCrit += 3; - else if (item.type == ItemID.HallowedPlateMail) - player.Calamity().throwingCrit += 7; - else if (item.type == ItemID.ChlorophytePlateMail) - player.Calamity().throwingCrit += 7; - else if (item.type == ItemID.Gi) - player.Calamity().throwingCrit += 5; - else if (item.type == ItemID.ApprenticeRobe) - player.minionDamage -= 0.2f; - else if (item.type == ItemID.SquirePlating) - player.minionDamage -= 0.15f; - else if (item.type == ItemID.HuntressJerkin) - player.minionDamage -= 0.2f; - else if (item.type == ItemID.MonkShirt) - player.minionDamage -= 0.2f; - else if (item.type == ItemID.ApprenticeAltShirt) - { - player.minionDamage -= 0.3f; - player.magicDamage -= 0.15f; - } - else if (item.type == ItemID.MonkAltShirt) - { - player.minionDamage -= 0.2f; - player.meleeSpeed -= 0.2f; - } - else if (item.type == ItemID.HuntressAltShirt) - { - player.minionDamage -= 0.25f; - player.meleeSpeed -= 0.2f; - } - else if (item.type == ItemID.SquireAltShirt) - player.minionDamage -= 0.3f; - #endregion + #region Body + if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) + player.Calamity().throwingCrit += 5; + else if (item.type == ItemID.PalladiumBreastplate) + player.Calamity().throwingCrit += 2; + else if (item.type == ItemID.CobaltBreastplate) + player.Calamity().throwingCrit += 3; + else if (item.type == ItemID.OrichalcumBreastplate) + player.Calamity().throwingCrit += 6; + else if (item.type == ItemID.TitaniumBreastplate) + player.Calamity().throwingCrit += 3; + else if (item.type == ItemID.HallowedPlateMail) + player.Calamity().throwingCrit += 7; + else if (item.type == ItemID.ChlorophytePlateMail) + player.Calamity().throwingCrit += 7; + else if (item.type == ItemID.Gi) + player.Calamity().throwingCrit += 5; + else if (item.type == ItemID.ApprenticeRobe) + player.minionDamage -= 0.2f; + else if (item.type == ItemID.SquirePlating) + player.minionDamage -= 0.15f; + else if (item.type == ItemID.HuntressJerkin) + player.minionDamage -= 0.2f; + else if (item.type == ItemID.MonkShirt) + player.minionDamage -= 0.2f; + else if (item.type == ItemID.ApprenticeAltShirt) + { + player.minionDamage -= 0.3f; + player.magicDamage -= 0.15f; + } + else if (item.type == ItemID.MonkAltShirt) + { + player.minionDamage -= 0.2f; + player.meleeSpeed -= 0.2f; + } + else if (item.type == ItemID.HuntressAltShirt) + { + player.minionDamage -= 0.25f; + player.meleeSpeed -= 0.2f; + } + else if (item.type == ItemID.SquireAltShirt) + player.minionDamage -= 0.3f; + #endregion - #region Legs - if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) - player.Calamity().throwingVelocity += 0.05f; - else if (item.type == ItemID.PalladiumLeggings) - player.Calamity().throwingCrit += 1; - else if (item.type == ItemID.MythrilGreaves) - player.Calamity().throwingCrit += 3; - else if (item.type == ItemID.AdamantiteLeggings) - player.Calamity().throwingCrit += 4; - else if (item.type == ItemID.TitaniumLeggings) - player.Calamity().throwingCrit += 3; - else if (item.type == ItemID.ChlorophyteGreaves) - player.Calamity().throwingCrit += 8; - else if (item.type == ItemID.ApprenticeTrousers) - { - player.magicCrit -= 20; - player.moveSpeed += 0.2f; - } - else if (item.type == ItemID.SquireGreaves) - { - player.minionDamage -= 0.15f; - player.meleeCrit -= 20; - } - else if (item.type == ItemID.HuntressPants) - player.minionDamage -= 0.1f; - else if (item.type == ItemID.MonkPants) - { - player.minionDamage -= 0.1f; - player.meleeCrit -= 10; - } - else if (item.type == ItemID.ApprenticeAltPants) - { - player.minionDamage -= 0.2f; - player.magicCrit -= 25; - } - else if (item.type == ItemID.MonkAltPants) - { - player.minionDamage -= 0.2f; - player.meleeCrit -= 20; - } - else if (item.type == ItemID.HuntressAltPants) - player.minionDamage -= 0.25f; - if (item.type == ItemID.SquireAltPants) - { - player.minionDamage -= 0.2f; - player.meleeCrit -= 20; - } - #endregion - } - #endregion + #region Legs + if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) + player.Calamity().throwingVelocity += 0.05f; + else if (item.type == ItemID.PalladiumLeggings) + player.Calamity().throwingCrit += 1; + else if (item.type == ItemID.MythrilGreaves) + player.Calamity().throwingCrit += 3; + else if (item.type == ItemID.AdamantiteLeggings) + player.Calamity().throwingCrit += 4; + else if (item.type == ItemID.TitaniumLeggings) + player.Calamity().throwingCrit += 3; + else if (item.type == ItemID.ChlorophyteGreaves) + player.Calamity().throwingCrit += 8; + else if (item.type == ItemID.ApprenticeTrousers) + { + player.magicCrit -= 20; + player.moveSpeed += 0.2f; + } + else if (item.type == ItemID.SquireGreaves) + { + player.minionDamage -= 0.15f; + player.meleeCrit -= 20; + } + else if (item.type == ItemID.HuntressPants) + player.minionDamage -= 0.1f; + else if (item.type == ItemID.MonkPants) + { + player.minionDamage -= 0.1f; + player.meleeCrit -= 10; + } + else if (item.type == ItemID.ApprenticeAltPants) + { + player.minionDamage -= 0.2f; + player.magicCrit -= 25; + } + else if (item.type == ItemID.MonkAltPants) + { + player.minionDamage -= 0.2f; + player.meleeCrit -= 20; + } + else if (item.type == ItemID.HuntressAltPants) + player.minionDamage -= 0.25f; + if (item.type == ItemID.SquireAltPants) + { + player.minionDamage -= 0.2f; + player.meleeCrit -= 20; + } + #endregion + } + #endregion - #region Accessory Changes - public override void UpdateAccessory(Item item, Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); + #region Accessory Changes + public override void UpdateAccessory(Item item, Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); - if (item.type == ItemID.AngelWings) // Boost to max life, defense, and life regen - { - player.statLifeMax2 += 20; - player.statDefense += 15; - player.lifeRegen += 3; - } - else if (item.type == ItemID.DemonWings) // Boost to all damage and crit - { - player.allDamage += 0.1f; - modPlayer.AllCritBoost(10); - } - else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water - { - player.moveSpeed += 0.2f; - player.jumpSpeedBoost += 1.8f; - player.gills = true; - player.ignoreWater = true; - if (!player.mount.Active) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - player.maxFallSpeed = 12f; - } - } - else if (item.type == ItemID.BeeWings) // Honey buff - { - player.AddBuff(BuffID.Honey, 2); - } - else if (item.type == ItemID.ButterflyWings) // Boost to magic stats - { - player.statManaMax2 += 50; - player.magicDamage += 0.1f; - player.manaCost *= 0.95f; - player.magicCrit += 5; - } - else if (item.type == ItemID.FairyWings) // Boost to max life - { - player.statLifeMax2 += 80; - } - else if (item.type == ItemID.BatWings) // Stronger at night - { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.0f; - if (!Main.dayTime) - { - player.statDefense += 20; - player.allDamage += 0.15f; - modPlayer.AllCritBoost(7); - player.moveSpeed += 0.1f; - } - } - else if (item.type == ItemID.HarpyWings) - { - player.moveSpeed += 0.3f; - } - else if (item.type == ItemID.BoneWings) // Bonus to ranged and defense stats while wearing necro armor - { - if ((player.head == ArmorIDs.Head.NecroHelmet || player.head == ArmorIDs.Head.AncientNecroHelmet) && - player.body == ArmorIDs.Body.NecroBreastplate && player.legs == ArmorIDs.Legs.NecroGreaves) - { - player.moveSpeed += 0.15f; - player.rangedDamage += 0.12f; - player.rangedCrit += 16; - player.statDefense += 30; - } - } - else if (item.type == ItemID.MothronWings) // Spawn baby mothrons over time to attack enemies, max of 3 - { - player.statDefense += 10; - player.allDamage += 0.1f; - modPlayer.AllCritBoost(5); - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.2f; - } - else if (item.type == ItemID.FrozenWings) // Bonus to melee and ranged stats while wearing frost armor - { - if (player.head == ArmorIDs.Head.FrostHelmet && player.body == ArmorIDs.Body.FrostBreastplate && player.legs == ArmorIDs.Legs.FrostLeggings) - { - player.meleeDamage += 0.07f; - player.rangedDamage += 0.07f; - player.meleeCrit += 3; - player.rangedCrit += 3; - } - } - else if (item.type == ItemID.FlameWings) // Bonus to melee stats - { - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - } - else if (item.type == ItemID.GhostWings) // Bonus to mage stats while wearing spectre armor - { - if (player.body == ArmorIDs.Body.SpectreRobe && player.legs == ArmorIDs.Legs.SpectrePants) - { - if (player.head == ArmorIDs.Head.SpectreHood) - { - player.statDefense += 10; - player.endurance += 0.05f; - } - else if (player.head == ArmorIDs.Head.SpectreMask) - { - player.statManaMax2 += 20; - player.magicDamage += 0.05f; - player.manaCost *= 0.95f; - player.magicCrit += 5; - } - } - } - else if (item.type == ItemID.BeetleWings) // Boosted defense and melee stats while wearing beetle armor - { - if (player.head == ArmorIDs.Head.BeetleHelmet && player.legs == ArmorIDs.Legs.BeetleLeggings) - { - if (player.body == ArmorIDs.Body.BeetleShell) - { - player.statDefense += 15; - player.endurance += 0.1f; - } - else if (player.body == ArmorIDs.Body.BeetleScaleMail) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - } - } - } - else if (item.type == ItemID.FestiveWings) // Drop powerful homing christmas tree bulbs while in flight - { - player.statLifeMax2 += 50; - } - else if (item.type == ItemID.SpookyWings) // Bonus to summon stats while wearing spooky armor - { - if (player.head == ArmorIDs.Head.SpookyHelmet && player.body == ArmorIDs.Body.SpookyBreastplate && player.legs == ArmorIDs.Legs.SpookyLeggings) - { - player.maxMinions++; - player.minionDamage += 0.1f; - } - } - else if (item.type == ItemID.TatteredFairyWings) - { - player.allDamage += 0.05f; - modPlayer.AllCritBoost(5); - } - else if (item.type == ItemID.SteampunkWings) - { - player.statDefense += 10; - player.allDamage += 0.05f; - modPlayer.AllCritBoost(5); - player.moveSpeed += 0.1f; - } - else if (item.type == ItemID.WingsSolar) // Bonus to melee stats while wearing solar flare armor - { - if (player.head == ArmorIDs.Head.SolarFlareHelmet && player.body == ArmorIDs.Body.SolarFlareBreastplate && player.legs == ArmorIDs.Legs.SolarFlareLeggings) - { - player.meleeDamage += 0.07f; - player.meleeCrit += 3; - } - } - else if (item.type == ItemID.WingsVortex) // Bonus to ranged stats while wearing vortex armor - { - if (player.head == ArmorIDs.Head.VortexHelmet && player.body == ArmorIDs.Body.VortexBreastplate && player.legs == ArmorIDs.Legs.VortexLeggings) - { - player.rangedDamage += 0.03f; - player.rangedCrit += 7; - } - } - else if (item.type == ItemID.WingsNebula) // Bonus to magic stats while wearing nebula armor - { - if (player.head == ArmorIDs.Head.NebulaHelmet && player.body == ArmorIDs.Body.NebulaBreastplate && player.legs == ArmorIDs.Legs.NebulaLeggings) - { - player.magicDamage += 0.05f; - player.magicCrit += 5; - player.statManaMax2 += 20; - player.manaCost *= 0.95f; - } - } - else if (item.type == ItemID.WingsStardust) // Bonus to summon stats while wearing stardust armor - { - if (player.head == ArmorIDs.Head.StardustHelmet && player.body == ArmorIDs.Body.StardustPlate && player.legs == ArmorIDs.Legs.StardustLeggings) - { - player.maxMinions++; - player.minionDamage += 0.05f; - } - } + if (item.type == ItemID.AngelWings) // Boost to max life, defense, and life regen + { + player.statLifeMax2 += 20; + player.statDefense += 15; + player.lifeRegen += 3; + } + else if (item.type == ItemID.DemonWings) // Boost to all damage and crit + { + player.allDamage += 0.1f; + modPlayer.AllCritBoost(10); + } + else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water + { + player.moveSpeed += 0.2f; + player.jumpSpeedBoost += 1.8f; + player.gills = true; + player.ignoreWater = true; + if (!player.mount.Active) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + player.maxFallSpeed = 12f; + } + } + else if (item.type == ItemID.BeeWings) // Honey buff + { + player.AddBuff(BuffID.Honey, 2); + } + else if (item.type == ItemID.ButterflyWings) // Boost to magic stats + { + player.statManaMax2 += 50; + player.magicDamage += 0.1f; + player.manaCost *= 0.95f; + player.magicCrit += 5; + } + else if (item.type == ItemID.FairyWings) // Boost to max life + { + player.statLifeMax2 += 80; + } + else if (item.type == ItemID.BatWings) // Stronger at night + { + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 1.0f; + if (!Main.dayTime) + { + player.statDefense += 20; + player.allDamage += 0.15f; + modPlayer.AllCritBoost(7); + player.moveSpeed += 0.1f; + } + } + else if (item.type == ItemID.HarpyWings) + { + player.moveSpeed += 0.3f; + } + else if (item.type == ItemID.BoneWings) // Bonus to ranged and defense stats while wearing necro armor + { + if ((player.head == ArmorIDs.Head.NecroHelmet || player.head == ArmorIDs.Head.AncientNecroHelmet) && + player.body == ArmorIDs.Body.NecroBreastplate && player.legs == ArmorIDs.Legs.NecroGreaves) + { + player.moveSpeed += 0.15f; + player.rangedDamage += 0.12f; + player.rangedCrit += 16; + player.statDefense += 30; + } + } + else if (item.type == ItemID.MothronWings) // Spawn baby mothrons over time to attack enemies, max of 3 + { + player.statDefense += 10; + player.allDamage += 0.1f; + modPlayer.AllCritBoost(5); + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 1.2f; + } + else if (item.type == ItemID.FrozenWings) // Bonus to melee and ranged stats while wearing frost armor + { + if (player.head == ArmorIDs.Head.FrostHelmet && player.body == ArmorIDs.Body.FrostBreastplate && player.legs == ArmorIDs.Legs.FrostLeggings) + { + player.meleeDamage += 0.07f; + player.rangedDamage += 0.07f; + player.meleeCrit += 3; + player.rangedCrit += 3; + } + } + else if (item.type == ItemID.FlameWings) // Bonus to melee stats + { + player.meleeDamage += 0.1f; + player.meleeCrit += 5; + } + else if (item.type == ItemID.GhostWings) // Bonus to mage stats while wearing spectre armor + { + if (player.body == ArmorIDs.Body.SpectreRobe && player.legs == ArmorIDs.Legs.SpectrePants) + { + if (player.head == ArmorIDs.Head.SpectreHood) + { + player.statDefense += 10; + player.endurance += 0.05f; + } + else if (player.head == ArmorIDs.Head.SpectreMask) + { + player.statManaMax2 += 20; + player.magicDamage += 0.05f; + player.manaCost *= 0.95f; + player.magicCrit += 5; + } + } + } + else if (item.type == ItemID.BeetleWings) // Boosted defense and melee stats while wearing beetle armor + { + if (player.head == ArmorIDs.Head.BeetleHelmet && player.legs == ArmorIDs.Legs.BeetleLeggings) + { + if (player.body == ArmorIDs.Body.BeetleShell) + { + player.statDefense += 15; + player.endurance += 0.1f; + } + else if (player.body == ArmorIDs.Body.BeetleScaleMail) + { + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + } + } + } + else if (item.type == ItemID.FestiveWings) // Drop powerful homing christmas tree bulbs while in flight + { + player.statLifeMax2 += 50; + } + else if (item.type == ItemID.SpookyWings) // Bonus to summon stats while wearing spooky armor + { + if (player.head == ArmorIDs.Head.SpookyHelmet && player.body == ArmorIDs.Body.SpookyBreastplate && player.legs == ArmorIDs.Legs.SpookyLeggings) + { + player.maxMinions++; + player.minionDamage += 0.1f; + } + } + else if (item.type == ItemID.TatteredFairyWings) + { + player.allDamage += 0.05f; + modPlayer.AllCritBoost(5); + } + else if (item.type == ItemID.SteampunkWings) + { + player.statDefense += 10; + player.allDamage += 0.05f; + modPlayer.AllCritBoost(5); + player.moveSpeed += 0.1f; + } + else if (item.type == ItemID.WingsSolar) // Bonus to melee stats while wearing solar flare armor + { + if (player.head == ArmorIDs.Head.SolarFlareHelmet && player.body == ArmorIDs.Body.SolarFlareBreastplate && player.legs == ArmorIDs.Legs.SolarFlareLeggings) + { + player.meleeDamage += 0.07f; + player.meleeCrit += 3; + } + } + else if (item.type == ItemID.WingsVortex) // Bonus to ranged stats while wearing vortex armor + { + if (player.head == ArmorIDs.Head.VortexHelmet && player.body == ArmorIDs.Body.VortexBreastplate && player.legs == ArmorIDs.Legs.VortexLeggings) + { + player.rangedDamage += 0.03f; + player.rangedCrit += 7; + } + } + else if (item.type == ItemID.WingsNebula) // Bonus to magic stats while wearing nebula armor + { + if (player.head == ArmorIDs.Head.NebulaHelmet && player.body == ArmorIDs.Body.NebulaBreastplate && player.legs == ArmorIDs.Legs.NebulaLeggings) + { + player.magicDamage += 0.05f; + player.magicCrit += 5; + player.statManaMax2 += 20; + player.manaCost *= 0.95f; + } + } + else if (item.type == ItemID.WingsStardust) // Bonus to summon stats while wearing stardust armor + { + if (player.head == ArmorIDs.Head.StardustHelmet && player.body == ArmorIDs.Body.StardustPlate && player.legs == ArmorIDs.Legs.StardustLeggings) + { + player.maxMinions++; + player.minionDamage += 0.05f; + } + } - if (item.type == ItemID.JellyfishNecklace || item.type == ItemID.JellyfishDivingGear || item.type == ItemID.ArcticDivingGear) - modPlayer.jellyfishNecklace = true; + if (item.type == ItemID.JellyfishNecklace || item.type == ItemID.JellyfishDivingGear || item.type == ItemID.ArcticDivingGear) + modPlayer.jellyfishNecklace = true; - if (item.type == ItemID.WormScarf) - player.endurance -= 0.07f; + if (item.type == ItemID.WormScarf) + player.endurance -= 0.07f; - if (item.type == ItemID.RoyalGel) - modPlayer.royalGel = true; + if (item.type == ItemID.RoyalGel) + modPlayer.royalGel = true; - if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell || (item.type == ItemID.MoonStone && !Main.dayTime) || - (item.type == ItemID.SunStone && Main.dayTime)) - { - player.Calamity().throwingCrit += 2; - } - if (item.type == ItemID.DestroyerEmblem) - player.Calamity().throwingCrit += 8; - if (item.type == ItemID.EyeoftheGolem) - player.Calamity().throwingCrit += 10; - if (item.type == ItemID.PutridScent) - player.Calamity().throwingCrit += 5; + if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell || (item.type == ItemID.MoonStone && !Main.dayTime) || + (item.type == ItemID.SunStone && Main.dayTime)) + { + player.Calamity().throwingCrit += 2; + } + if (item.type == ItemID.DestroyerEmblem) + player.Calamity().throwingCrit += 8; + if (item.type == ItemID.EyeoftheGolem) + player.Calamity().throwingCrit += 10; + if (item.type == ItemID.PutridScent) + player.Calamity().throwingCrit += 5; - // Hard / Guarding / Armored / Warding give 0.25% / 0.5% / 0.75% / 1% DR - if (item.prefix == 62) - player.endurance += 0.0025f; - if (item.prefix == 63) - player.endurance += 0.005f; - if (item.prefix == 64) - player.endurance += 0.0075f; - if (item.prefix == 65) - player.endurance += 0.01f; + // Hard / Guarding / Armored / Warding give 0.25% / 0.5% / 0.75% / 1% DR + if (item.prefix == 62) + player.endurance += 0.0025f; + if (item.prefix == 63) + player.endurance += 0.005f; + if (item.prefix == 64) + player.endurance += 0.0075f; + if (item.prefix == 65) + player.endurance += 0.01f; - // Precise only gives 1% crit and Lucky only gives 3% crit - if (item.prefix == 67 || item.prefix == 68) - { + // Precise only gives 1% crit and Lucky only gives 3% crit + if (item.prefix == 67 || item.prefix == 68) + { player.meleeCrit -= 1; - player.rangedCrit -= 1; - player.magicCrit -= 1; + player.rangedCrit -= 1; + player.magicCrit -= 1; player.thrownCrit -= 1; - player.Calamity().throwingCrit += (item.prefix == 68 ? 3 : 1); - } - } - #endregion + player.Calamity().throwingCrit += (item.prefix == 68 ? 3 : 1); + } + } + #endregion - #region WingChanges - public override void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) - { - CalamityPlayer modPlayer = player.Calamity(); - float flightSpeedMult = 1f + - (modPlayer.soaring ? 0.1f : 0f) + - (modPlayer.holyWrath ? 0.05f : 0f) + - (modPlayer.profanedRage ? 0.05f : 0f) + - (modPlayer.draconicSurge ? 0.15f : 0f); - if (flightSpeedMult > 1.2f) - flightSpeedMult = 1.2f; + #region WingChanges + public override void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) + { + CalamityPlayer modPlayer = player.Calamity(); + float flightSpeedMult = 1f + + (modPlayer.soaring ? 0.1f : 0f) + + (modPlayer.holyWrath ? 0.05f : 0f) + + (modPlayer.profanedRage ? 0.05f : 0f) + + (modPlayer.draconicSurge ? 0.15f : 0f); + if (flightSpeedMult > 1.2f) + flightSpeedMult = 1.2f; - speed *= flightSpeedMult; + speed *= flightSpeedMult; - float flightAccMult = 1f + - (modPlayer.draconicSurge ? 0.15f : 0f); - if (flightAccMult > 1.2f) - flightAccMult = 1.2f; + float flightAccMult = 1f + + (modPlayer.draconicSurge ? 0.15f : 0f); + if (flightAccMult > 1.2f) + flightAccMult = 1.2f; - acceleration *= flightAccMult; - } - #endregion + acceleration *= flightAccMult; + } + #endregion - #region GrabChanges - public override void GrabRange(Item item, Player player, ref int grabRange) - { - CalamityPlayer modPlayer = player.Calamity(); - int itemGrabRangeBoost = 0 + - (modPlayer.wallOfFleshLore ? 10 : 0) + - (modPlayer.planteraLore ? 20 : 0) + - (modPlayer.polterghastLore ? 30 : 0); + #region GrabChanges + public override void GrabRange(Item item, Player player, ref int grabRange) + { + CalamityPlayer modPlayer = player.Calamity(); + int itemGrabRangeBoost = 0 + + (modPlayer.wallOfFleshLore ? 10 : 0) + + (modPlayer.planteraLore ? 20 : 0) + + (modPlayer.polterghastLore ? 30 : 0); - grabRange += itemGrabRangeBoost; - } - #endregion + grabRange += itemGrabRangeBoost; + } + #endregion - #region The Horseman's Blade - public static void HorsemansBladeOnHit(Player player, int targetIdx, int damage, float knockback, bool hasExtraUpdates) - { - int x = Main.rand.Next(100, 300); - int y = Main.rand.Next(100, 300); + #region The Horseman's Blade + public static void HorsemansBladeOnHit(Player player, int targetIdx, int damage, float knockback, bool hasExtraUpdates) + { + int x = Main.rand.Next(100, 300); + int y = Main.rand.Next(100, 300); - // Pick a random side: left or right - if (Main.rand.NextBool(2)) - x -= Main.LogicCheckScreenWidth / 2 + x; - else - x += Main.LogicCheckScreenWidth / 2 - x; + // Pick a random side: left or right + if (Main.rand.NextBool(2)) + x -= Main.LogicCheckScreenWidth / 2 + x; + else + x += Main.LogicCheckScreenWidth / 2 - x; - // Pick a random side: top or bottom - if (Main.rand.NextBool(2)) - y -= Main.LogicCheckScreenHeight / 2 + y; - else - y += Main.LogicCheckScreenHeight / 2 - y; + // Pick a random side: top or bottom + if (Main.rand.NextBool(2)) + y -= Main.LogicCheckScreenHeight / 2 + y; + else + y += Main.LogicCheckScreenHeight / 2 - y; - x += (int)player.position.X; - y += (int)player.position.Y; - float speed = 8f; - Vector2 vector = new Vector2((float)x, (float)y); - float dx = Main.npc[targetIdx].position.X - vector.X; - float dy = Main.npc[targetIdx].position.Y - vector.Y; - float dist = (float)Math.Sqrt(dx * dx + dy * dy); - dist = speed / dist; - dx *= dist; - dy *= dist; - int projectile = Projectile.NewProjectile(x, y, dx, dy, ProjectileID.FlamingJack, damage, knockback, player.whoAmI, targetIdx, 0f); - if (hasExtraUpdates) - Main.projectile[projectile].extraUpdates += 1; - } - #endregion + x += (int)player.position.X; + y += (int)player.position.Y; + float speed = 8f; + Vector2 vector = new Vector2((float)x, (float)y); + float dx = Main.npc[targetIdx].position.X - vector.X; + float dy = Main.npc[targetIdx].position.Y - vector.Y; + float dist = (float)Math.Sqrt(dx * dx + dy * dy); + dist = speed / dist; + dx *= dist; + dy *= dist; + int projectile = Projectile.NewProjectile(x, y, dx, dy, ProjectileID.FlamingJack, damage, knockback, player.whoAmI, targetIdx, 0f); + if (hasExtraUpdates) + Main.projectile[projectile].extraUpdates += 1; + } + #endregion - #region Consume Additional Ammo - public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) - { - bool flag = false; - bool canShoot = false; + #region Consume Additional Ammo + public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) + { + bool flag = false; + bool canShoot = false; - for (int i = 54; i < 58; i++) - { - if (player.inventory[i].ammo == item.useAmmo && player.inventory[i].stack >= ammoConsumed) - { - canShoot = true; - flag = true; - break; - } - } + for (int i = 54; i < 58; i++) + { + if (player.inventory[i].ammo == item.useAmmo && player.inventory[i].stack >= ammoConsumed) + { + canShoot = true; + flag = true; + break; + } + } - if (!flag) - { - for (int j = 0; j < 54; j++) - { - if (player.inventory[j].ammo == item.useAmmo && player.inventory[j].stack >= ammoConsumed) - { - canShoot = true; - break; - } - } - } - return canShoot; - } + if (!flag) + { + for (int j = 0; j < 54; j++) + { + if (player.inventory[j].ammo == item.useAmmo && player.inventory[j].stack >= ammoConsumed) + { + canShoot = true; + break; + } + } + } + return canShoot; + } - public static void ConsumeAdditionalAmmo(Player player, Item item, int ammoConsumed) - { - Item itemAmmo = new Item(); - bool flag = false; - bool dontConsumeAmmo = false; + public static void ConsumeAdditionalAmmo(Player player, Item item, int ammoConsumed) + { + Item itemAmmo = new Item(); + bool flag = false; + bool dontConsumeAmmo = false; - for (int i = 54; i < 58; i++) - { - if (player.inventory[i].ammo == item.useAmmo && player.inventory[i].stack >= ammoConsumed) - { - itemAmmo = player.inventory[i]; - flag = true; - break; - } - } + for (int i = 54; i < 58; i++) + { + if (player.inventory[i].ammo == item.useAmmo && player.inventory[i].stack >= ammoConsumed) + { + itemAmmo = player.inventory[i]; + flag = true; + break; + } + } - if (!flag) - { - for (int j = 0; j < 54; j++) - { - if (player.inventory[j].ammo == item.useAmmo && player.inventory[j].stack >= ammoConsumed) - { - itemAmmo = player.inventory[j]; - break; - } - } - } + if (!flag) + { + for (int j = 0; j < 54; j++) + { + if (player.inventory[j].ammo == item.useAmmo && player.inventory[j].stack >= ammoConsumed) + { + itemAmmo = player.inventory[j]; + break; + } + } + } - if (player.ammoBox && Main.rand.NextBool(5)) - dontConsumeAmmo = true; - if (player.ammoPotion && Main.rand.NextBool(5)) - dontConsumeAmmo = true; - if (player.ammoCost80 && Main.rand.NextBool(5)) - dontConsumeAmmo = true; - if (player.ammoCost75 && Main.rand.NextBool(4)) - dontConsumeAmmo = true; + if (player.ammoBox && Main.rand.NextBool(5)) + dontConsumeAmmo = true; + if (player.ammoPotion && Main.rand.NextBool(5)) + dontConsumeAmmo = true; + if (player.ammoCost80 && Main.rand.NextBool(5)) + dontConsumeAmmo = true; + if (player.ammoCost75 && Main.rand.NextBool(4)) + dontConsumeAmmo = true; - if (!dontConsumeAmmo && itemAmmo.consumable) - { - itemAmmo.stack -= ammoConsumed; - if (itemAmmo.stack <= 0) - { - itemAmmo.active = false; - itemAmmo.TurnToAir(); - } - } - } + if (!dontConsumeAmmo && itemAmmo.consumable) + { + itemAmmo.stack -= ammoConsumed; + if (itemAmmo.stack <= 0) + { + itemAmmo.active = false; + itemAmmo.TurnToAir(); + } + } + } #endregion #region Goblin Money Theft (PostReforge) @@ -2398,25 +2397,25 @@ namespace CalamityMod.Items /// The minimum speed that the dust should travel /// The maximum speed that the dust should travel public static Dust MeleeDustHelper(Player player, int dustType, float chancePerFrame, float minDistance, float maxDistance, float minRandRot = -0.2f, float maxRandRot = 0.2f, float minSpeed = 0.9f, float maxSpeed = 1.1f) - { - if (Main.rand.NextFloat(1f) < chancePerFrame) - { - //Calculate values - //distance from player, - //the vector offset from the player center - //the vector between the pos and the player - float distance = Main.rand.NextFloat(minDistance, maxDistance); - Vector2 offset = (player.itemRotation - (MathHelper.PiOver4 * player.direction) + Main.rand.NextFloat(minRandRot, maxRandRot)).ToRotationVector2() * distance * player.direction; - Vector2 pos = player.Center + offset; - Vector2 vec = pos - player.Center; - //spawn the dust - Dust d = Dust.NewDustPerfect(pos, dustType); - //normalise vector and multiply by velocity magnitude - vec.Normalize(); - d.velocity = vec * Main.rand.NextFloat(minSpeed, maxSpeed); - return d; - } - return null; - } - } + { + if (Main.rand.NextFloat(1f) < chancePerFrame) + { + //Calculate values + //distance from player, + //the vector offset from the player center + //the vector between the pos and the player + float distance = Main.rand.NextFloat(minDistance, maxDistance); + Vector2 offset = (player.itemRotation - (MathHelper.PiOver4 * player.direction) + Main.rand.NextFloat(minRandRot, maxRandRot)).ToRotationVector2() * distance * player.direction; + Vector2 pos = player.Center + offset; + Vector2 vec = pos - player.Center; + //spawn the dust + Dust d = Dust.NewDustPerfect(pos, dustType); + //normalise vector and multiply by velocity magnitude + vec.Normalize(); + d.velocity = vec * Main.rand.NextFloat(minSpeed, maxSpeed); + return d; + } + return null; + } + } } diff --git a/Items/Crabulon/CrabulonBag.cs b/Items/Crabulon/CrabulonBag.cs index 2dc64b9925..1ef0d9fe56 100644 --- a/Items/Crabulon/CrabulonBag.cs +++ b/Items/Crabulon/CrabulonBag.cs @@ -1,54 +1,54 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; using CalamityMod.Utilities; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Crabulon { - public class CrabulonBag : ModItem - { - public override int BossBagNPC => mod.NPCType("CrabulonIdle"); + public class CrabulonBag : ModItem + { + public override int BossBagNPC => mod.NPCType("CrabulonIdle"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - // Materials - DropHelper.DropItem(player, ItemID.GlowingMushroom, 25, 35); - DropHelper.DropItem(player, ItemID.MushroomGrassSeeds, 5, 10); + public override void OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, ItemID.GlowingMushroom, 25, 35); + DropHelper.DropItem(player, ItemID.MushroomGrassSeeds, 5, 10); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("MycelialClaws"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Fungicide"), 3); - DropHelper.DropItemChance(player, mod.ItemType("HyphaeRod"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Mycoroot"), 3); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("MycelialClaws"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Fungicide"), 3); + DropHelper.DropItemChance(player, mod.ItemType("HyphaeRod"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Mycoroot"), 3); - // Equipment - DropHelper.DropItem(player, mod.ItemType("FungalClump")); - DropHelper.DropItemCondition(player, mod.ItemType("MushroomPlasmaRoot"), CalamityWorld.revenge); + // Equipment + DropHelper.DropItem(player, mod.ItemType("FungalClump")); + DropHelper.DropItemCondition(player, mod.ItemType("MushroomPlasmaRoot"), CalamityWorld.revenge); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("CrabulonMask"), 7); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("CrabulonMask"), 7); + } + } } diff --git a/Items/Crabulon/DecapoditaSprout.cs b/Items/Crabulon/DecapoditaSprout.cs index 08a38bcc8d..11b04db139 100644 --- a/Items/Crabulon/DecapoditaSprout.cs +++ b/Items/Crabulon/DecapoditaSprout.cs @@ -4,48 +4,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Crabulon { - public class DecapoditaSprout : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Decapodita Sprout"); - Tooltip.SetDefault("Summons Crabulon"); - } + public class DecapoditaSprout : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Decapodita Sprout"); + Tooltip.SetDefault("Summons Crabulon"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 2; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 2; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneGlowshroom && !NPC.AnyNPCs(mod.NPCType("CrabulonIdle")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneGlowshroom && !NPC.AnyNPCs(mod.NPCType("CrabulonIdle")); + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 51))), (int)(player.position.Y - 50f), mod.NPCType("CrabulonIdle"), 0, 0f, 0f, 0f, 0f, 255); Main.PlaySound(SoundID.Roar, player.position, 0); } - return true; - } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GlowingMushroom, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GlowingMushroom, 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Crabulon/FungalClump.cs b/Items/Crabulon/FungalClump.cs index 41a2ceca7e..35baa294c2 100644 --- a/Items/Crabulon/FungalClump.cs +++ b/Items/Crabulon/FungalClump.cs @@ -1,27 +1,27 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Crabulon { public class FungalClump : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungal Clump"); - Tooltip.SetDefault("Summons a fungal clump to fight for you\n" + - "The clump latches onto enemies and steals their life for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Clump"); + Tooltip.SetDefault("Summons a fungal clump to fight for you\n" + + "The clump latches onto enemies and steals their life for you"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 26; + public override void SetDefaults() + { + item.width = 20; + item.height = 26; item.value = Item.buyPrice(0, 9, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; - } + item.rare = 9; + item.accessory = true; + } public override bool CanEquipAccessory(Player player, int slot) { @@ -34,20 +34,20 @@ namespace CalamityMod.Items.Crabulon } public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fungalClump = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("FungalClump")) == -1) - { - player.AddBuff(mod.BuffType("FungalClump"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("FungalClump"), (int)(10f * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); - } - } - } - } + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.fungalClump = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("FungalClump")) == -1) + { + player.AddBuff(mod.BuffType("FungalClump"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("FungalClump"), (int)(10f * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Items/Cryogen/CryoBar.cs b/Items/Cryogen/CryoBar.cs index a657f08617..64b093b783 100644 --- a/Items/Cryogen/CryoBar.cs +++ b/Items/Cryogen/CryoBar.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Cryogen item.width = 30; item.height = 24; item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; } } } diff --git a/Items/Cryogen/CryoKey.cs b/Items/Cryogen/CryoKey.cs index dc4f051069..dea7bbe1d1 100644 --- a/Items/Cryogen/CryoKey.cs +++ b/Items/Cryogen/CryoKey.cs @@ -4,48 +4,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Cryogen { - public class CryoKey : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryo Key"); - Tooltip.SetDefault("Summons Cryogen"); - } + public class CryoKey : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryo Key"); + Tooltip.SetDefault("Summons Cryogen"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneSnow && !NPC.AnyNPCs(mod.NPCType("Cryogen")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneSnow && !NPC.AnyNPCs(mod.NPCType("Cryogen")); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Cryogen")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Cryogen")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IceBlock, 50); - recipe.AddIngredient(ItemID.SoulofNight, 3); - recipe.AddIngredient(ItemID.SoulofLight, 3); - recipe.AddIngredient(null, "EssenceofEleum", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IceBlock, 50); + recipe.AddIngredient(ItemID.SoulofNight, 3); + recipe.AddIngredient(ItemID.SoulofLight, 3); + recipe.AddIngredient(null, "EssenceofEleum", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Cryogen/CryoStone.cs b/Items/Cryogen/CryoStone.cs index 60e644c39a..0421a18cde 100644 --- a/Items/Cryogen/CryoStone.cs +++ b/Items/Cryogen/CryoStone.cs @@ -6,13 +6,13 @@ namespace CalamityMod.Items.Cryogen { public class CryoStone : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryo Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases damage reduction by 5% and all damage by 3%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryo Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases damage reduction by 5% and all damage by 3%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + } public override void SetDefaults() { @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Cryogen item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; item.defense = 6; - item.accessory = true; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.25f, 0.6f); - player.endurance += 0.05f; - player.allDamage += 0.03f; - } + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.25f, 0.6f); + player.endurance += 0.05f; + player.allDamage += 0.03f; + } } } diff --git a/Items/Cryogen/CryogenBag.cs b/Items/Cryogen/CryogenBag.cs index 2e0ad73e17..98ad432ba2 100644 --- a/Items/Cryogen/CryogenBag.cs +++ b/Items/Cryogen/CryogenBag.cs @@ -1,66 +1,66 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; using CalamityMod.Utilities; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Cryogen { - public class CryogenBag : ModItem - { - public override int BossBagNPC => mod.NPCType("Cryogen"); + public class CryogenBag : ModItem + { + public override int BossBagNPC => mod.NPCType("Cryogen"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, ItemID.SoulofMight, 25, 40); - DropHelper.DropItem(player, mod.ItemType("CryoBar"), 20, 40); - DropHelper.DropItem(player, mod.ItemType("EssenceofEleum"), 5, 9); - DropHelper.DropItem(player, ItemID.FrostCore); + // Materials + DropHelper.DropItem(player, ItemID.SoulofMight, 25, 40); + DropHelper.DropItem(player, mod.ItemType("CryoBar"), 20, 40); + DropHelper.DropItem(player, mod.ItemType("EssenceofEleum"), 5, 9); + DropHelper.DropItem(player, ItemID.FrostCore); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("Avalanche"), 3); - DropHelper.DropItemChance(player, mod.ItemType("GlacialCrusher"), 3); - DropHelper.DropItemChance(player, mod.ItemType("EffluviumBow"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BittercoldStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("SnowstormStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Icebreaker"), 3); - DropHelper.DropItemChance(player, mod.ItemType("IceStar"), 3, 150, 200); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("Avalanche"), 3); + DropHelper.DropItemChance(player, mod.ItemType("GlacialCrusher"), 3); + DropHelper.DropItemChance(player, mod.ItemType("EffluviumBow"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BittercoldStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("SnowstormStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Icebreaker"), 3); + DropHelper.DropItemChance(player, mod.ItemType("IceStar"), 3, 150, 200); - // Equipment - DropHelper.DropItem(player, mod.ItemType("SoulofCryogen")); - DropHelper.DropItemCondition(player, mod.ItemType("FrostFlare"), CalamityWorld.revenge); - DropHelper.DropItemChance(player, mod.ItemType("CryoStone"), 10); - DropHelper.DropItemChance(player, mod.ItemType("Regenator"), DropHelper.RareVariantDropRateInt); + // Equipment + DropHelper.DropItem(player, mod.ItemType("SoulofCryogen")); + DropHelper.DropItemCondition(player, mod.ItemType("FrostFlare"), CalamityWorld.revenge); + DropHelper.DropItemChance(player, mod.ItemType("CryoStone"), 10); + DropHelper.DropItemChance(player, mod.ItemType("Regenator"), DropHelper.RareVariantDropRateInt); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("CryogenMask"), 7); + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("CryogenMask"), 7); - // Other - DropHelper.DropItemChance(player, ItemID.FrozenKey, 5); - } - } + // Other + DropHelper.DropItemChance(player, ItemID.FrozenKey, 5); + } + } } diff --git a/Items/Cryogen/SoulofCryogen.cs b/Items/Cryogen/SoulofCryogen.cs index 0ccedec399..006c7c163c 100644 --- a/Items/Cryogen/SoulofCryogen.cs +++ b/Items/Cryogen/SoulofCryogen.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Cryogen { @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Cryogen "Average vertical speed\n" + "Flight time: 100\n" + "5% increase to all damage and pick speed\n" + - "All melee attacks and projectiles inflict frostburn"); + "All melee attacks and projectiles inflict frostburn"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); } @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Cryogen item.height = 26; item.value = Item.buyPrice(0, 39, 99, 99); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void Update(ref float gravity, ref float maxFallSpeed) @@ -59,8 +59,8 @@ namespace CalamityMod.Items.Cryogen CalamityPlayer modPlayer = player.Calamity(); modPlayer.cryogenSoul = true; player.pickSpeed -= 0.05f; - player.allDamage += 0.05f; - player.wingTimeMax = 100; + player.allDamage += 0.05f; + player.wingTimeMax = 100; } } } diff --git a/Items/DesertScourge/AeroStone.cs b/Items/DesertScourge/AeroStone.cs index ee1e77df24..81bf2222fe 100644 --- a/Items/DesertScourge/AeroStone.cs +++ b/Items/DesertScourge/AeroStone.cs @@ -1,35 +1,34 @@ using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.DesertScourge { public class AeroStone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aero Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases movement speed by 10%, jump speed by 100%, and all damage by 3%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aero Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases movement speed by 10%, jump speed by 100%, and all damage by 3%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.425f, 0.425f); - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += (player.autoJump ? 0.25f : 1.0f); - player.allDamage += 0.03f; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.425f, 0.425f); + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += (player.autoJump ? 0.25f : 1.0f); + player.allDamage += 0.03f; + } + } } diff --git a/Items/DesertScourge/DesertScourgeBag.cs b/Items/DesertScourge/DesertScourgeBag.cs index 2fe7dd1080..ab444770b6 100644 --- a/Items/DesertScourge/DesertScourgeBag.cs +++ b/Items/DesertScourge/DesertScourgeBag.cs @@ -1,79 +1,79 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.Utilities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.DesertScourge { - public class DesertScourgeBag : ModItem - { - public override int BossBagNPC => mod.NPCType("DesertScourgeHead"); + public class DesertScourgeBag : ModItem + { + public override int BossBagNPC => mod.NPCType("DesertScourgeHead"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - // Materials - DropHelper.DropItem(player, mod.ItemType("VictoryShard"), 10, 16); - DropHelper.DropItem(player, ItemID.Coral, 7, 11); - DropHelper.DropItem(player, ItemID.Seashell, 7, 11); - DropHelper.DropItem(player, ItemID.Starfish, 7, 11); + public override void OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, mod.ItemType("VictoryShard"), 10, 16); + DropHelper.DropItem(player, ItemID.Coral, 7, 11); + DropHelper.DropItem(player, ItemID.Seashell, 7, 11); + DropHelper.DropItem(player, ItemID.Starfish, 7, 11); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("AquaticDischarge"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Barinade"), 3); - DropHelper.DropItemChance(player, mod.ItemType("StormSpray"), 3); - DropHelper.DropItemChance(player, mod.ItemType("SeaboundStaff"), 3); - float f = Main.rand.NextFloat(); - bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance overall of getting Dune Hopper - if (f < 0.3333f) // 1/3 chance of getting Scourge of the Desert OR Dune Hopper replacing it - { - DropHelper.DropItemCondition(player, mod.ItemType("ScourgeoftheDesert"), !replaceWithRare); - DropHelper.DropItemCondition(player, mod.ItemType("DuneHopper"), replaceWithRare); - } + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("AquaticDischarge"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Barinade"), 3); + DropHelper.DropItemChance(player, mod.ItemType("StormSpray"), 3); + DropHelper.DropItemChance(player, mod.ItemType("SeaboundStaff"), 3); + float f = Main.rand.NextFloat(); + bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance overall of getting Dune Hopper + if (f < 0.3333f) // 1/3 chance of getting Scourge of the Desert OR Dune Hopper replacing it + { + DropHelper.DropItemCondition(player, mod.ItemType("ScourgeoftheDesert"), !replaceWithRare); + DropHelper.DropItemCondition(player, mod.ItemType("DuneHopper"), replaceWithRare); + } - // Equipment - DropHelper.DropItem(player, mod.ItemType("OceanCrest")); - DropHelper.DropItemChance(player, mod.ItemType("AeroStone"), 9); - DropHelper.DropItemChance(player, mod.ItemType("DeepDiver"), DropHelper.RareVariantDropRateInt); + // Equipment + DropHelper.DropItem(player, mod.ItemType("OceanCrest")); + DropHelper.DropItemChance(player, mod.ItemType("AeroStone"), 9); + DropHelper.DropItemChance(player, mod.ItemType("DeepDiver"), DropHelper.RareVariantDropRateInt); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("DesertScourgeMask"), 7); + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("DesertScourgeMask"), 7); - // Fishing - DropHelper.DropItemChance(player, ItemID.HighTestFishingLine, 12); - DropHelper.DropItemChance(player, ItemID.AnglerTackleBag, 12); - DropHelper.DropItemChance(player, ItemID.TackleBox, 12); - DropHelper.DropItemChance(player, ItemID.AnglerEarring, 9); - DropHelper.DropItemChance(player, ItemID.FishermansGuide, 9); - DropHelper.DropItemChance(player, ItemID.WeatherRadio, 9); - DropHelper.DropItemChance(player, ItemID.Sextant, 9); - DropHelper.DropItemChance(player, ItemID.AnglerHat, 4); - DropHelper.DropItemChance(player, ItemID.AnglerVest, 4); - DropHelper.DropItemChance(player, ItemID.AnglerPants, 4); - DropHelper.DropItemChance(player, ItemID.FishingPotion, 4, 2, 3); - DropHelper.DropItemChance(player, ItemID.SonarPotion, 4, 2, 3); - DropHelper.DropItemChance(player, ItemID.CratePotion, 4, 2, 3); - DropHelper.DropItemCondition(player, ItemID.GoldenBugNet, NPC.downedBoss3, 18, 1, 1); - } - } + // Fishing + DropHelper.DropItemChance(player, ItemID.HighTestFishingLine, 12); + DropHelper.DropItemChance(player, ItemID.AnglerTackleBag, 12); + DropHelper.DropItemChance(player, ItemID.TackleBox, 12); + DropHelper.DropItemChance(player, ItemID.AnglerEarring, 9); + DropHelper.DropItemChance(player, ItemID.FishermansGuide, 9); + DropHelper.DropItemChance(player, ItemID.WeatherRadio, 9); + DropHelper.DropItemChance(player, ItemID.Sextant, 9); + DropHelper.DropItemChance(player, ItemID.AnglerHat, 4); + DropHelper.DropItemChance(player, ItemID.AnglerVest, 4); + DropHelper.DropItemChance(player, ItemID.AnglerPants, 4); + DropHelper.DropItemChance(player, ItemID.FishingPotion, 4, 2, 3); + DropHelper.DropItemChance(player, ItemID.SonarPotion, 4, 2, 3); + DropHelper.DropItemChance(player, ItemID.CratePotion, 4, 2, 3); + DropHelper.DropItemCondition(player, ItemID.GoldenBugNet, NPC.downedBoss3, 18, 1, 1); + } + } } diff --git a/Items/DesertScourge/DriedSeafood.cs b/Items/DesertScourge/DriedSeafood.cs index 9182d00354..bd6065037f 100644 --- a/Items/DesertScourge/DriedSeafood.cs +++ b/Items/DesertScourge/DriedSeafood.cs @@ -1,58 +1,58 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.DesertScourge { - public class DriedSeafood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Medallion"); - Tooltip.SetDefault("The desert sand stirs...\n" + + public class DriedSeafood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Medallion"); + Tooltip.SetDefault("The desert sand stirs...\n" + "Summons the Desert Scourge"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 20; - item.rare = 2; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 20; + item.rare = 2; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("DesertScourgeHead")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("DesertScourgeHead")); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHead")); - if (CalamityWorld.revenge) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); - } - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHead")); + if (CalamityWorld.revenge) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); + } + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SandBlock, 15); - recipe.AddIngredient(ItemID.AntlionMandible, 3); - recipe.AddIngredient(ItemID.Cactus, 10); - recipe.AddIngredient(null, "StormlionMandible"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SandBlock, 15); + recipe.AddIngredient(ItemID.AntlionMandible, 3); + recipe.AddIngredient(ItemID.Cactus, 10); + recipe.AddIngredient(null, "StormlionMandible"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/DevourerMunsters/ArmoredShell.cs b/Items/DevourerMunsters/ArmoredShell.cs index 7df699d3c6..3c2b3ed7f6 100644 --- a/Items/DevourerMunsters/ArmoredShell.cs +++ b/Items/DevourerMunsters/ArmoredShell.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.DevourerMunsters { public class ArmoredShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Shell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Shell"); + } - public override void SetDefaults() - { - item.width = 24; - item.height = 30; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().postMoonLordRarity = 13; - } - } + public override void SetDefaults() + { + item.width = 24; + item.height = 30; + item.maxStack = 999; + item.value = Item.buyPrice(0, 7, 0, 0); + item.Calamity().postMoonLordRarity = 13; + } + } } diff --git a/Items/DevourerMunsters/DarkPlasma.cs b/Items/DevourerMunsters/DarkPlasma.cs index 00359615a7..07cd90794c 100644 --- a/Items/DevourerMunsters/DarkPlasma.cs +++ b/Items/DevourerMunsters/DarkPlasma.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.DevourerMunsters item.width = 15; item.height = 12; item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 7, 0, 0); + item.Calamity().postMoonLordRarity = 13; + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/DevourerMunsters/RuneofCos.cs b/Items/DevourerMunsters/RuneofCos.cs index a66f2638e1..c06060264c 100644 --- a/Items/DevourerMunsters/RuneofCos.cs +++ b/Items/DevourerMunsters/RuneofCos.cs @@ -5,57 +5,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items.DevourerMunsters { public class RuneofCos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rune of Kos"); - Tooltip.SetDefault("A relic of the profaned flame\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rune of Kos"); + Tooltip.SetDefault("A relic of the profaned flame\n" + "Contains the power hunted relentlessly by the sentinels of the cosmic devourer\n" + "When used in certain areas of the world it will unleash them\n" + "Not consumable"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.rare = 9; - item.UseSound = SoundID.Item44; - item.consumable = false; - item.shoot = mod.ProjectileType("VoidSpawn"); - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.rare = 9; + item.UseSound = SoundID.Item44; + item.consumable = false; + item.shoot = mod.ProjectileType("VoidSpawn"); + item.Calamity().postMoonLordRarity = 13; + } - public override bool CanUseItem(Player player) - { - return (player.ZoneSkyHeight || player.ZoneUnderworldHeight || player.ZoneDungeon) && - (!NPC.AnyNPCs(mod.NPCType("StormWeaverHead")) && !NPC.AnyNPCs(mod.NPCType("StormWeaverHeadNaked")) && !NPC.AnyNPCs(mod.NPCType("CeaselessVoid")) && !NPC.AnyNPCs(mod.NPCType("CosmicWraith"))); - } + public override bool CanUseItem(Player player) + { + return (player.ZoneSkyHeight || player.ZoneUnderworldHeight || player.ZoneDungeon) && + (!NPC.AnyNPCs(mod.NPCType("StormWeaverHead")) && !NPC.AnyNPCs(mod.NPCType("StormWeaverHeadNaked")) && !NPC.AnyNPCs(mod.NPCType("CeaselessVoid")) && !NPC.AnyNPCs(mod.NPCType("CosmicWraith"))); + } - public override bool UseItem(Player player) - { - if (player.ZoneDungeon) - { - for (int num662 = 0; num662 < 2; num662++) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - } - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CeaselessVoid")); - } - else if (player.ZoneUnderworldHeight) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CosmicWraith")); - } - else if (player.ZoneSkyHeight) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("StormWeaverHead")); - } - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + if (player.ZoneDungeon) + { + for (int num662 = 0; num662 < 2; num662++) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + } + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CeaselessVoid")); + } + else if (player.ZoneUnderworldHeight) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CosmicWraith")); + } + else if (player.ZoneSkyHeight) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("StormWeaverHead")); + } + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } public override void AddRecipes() { diff --git a/Items/DevourerMunsters/TwistingNether.cs b/Items/DevourerMunsters/TwistingNether.cs index fab14fe9c1..1a938fce82 100644 --- a/Items/DevourerMunsters/TwistingNether.cs +++ b/Items/DevourerMunsters/TwistingNether.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.DevourerMunsters { public class TwistingNether : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Twisting Nether"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Twisting Nether"); + } - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.rare = 10; - item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.rare = 10; + item.value = Item.buyPrice(0, 7, 0, 0); + item.Calamity().postMoonLordRarity = 13; + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.1f * num, 0.7f * num); - } - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.1f * num, 0.7f * num); + } + } } diff --git a/Items/DifficultyItems/Armageddon.cs b/Items/DifficultyItems/Armageddon.cs index c2cad181bb..ce34c5f296 100644 --- a/Items/DifficultyItems/Armageddon.cs +++ b/Items/DifficultyItems/Armageddon.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.DifficultyItems { public class Armageddon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armageddon"); - Tooltip.SetDefault("Makes any hit while a boss is alive instantly kill you\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armageddon"); + Tooltip.SetDefault("Makes any hit while a boss is alive instantly kill you\n" + "Effect can be toggled on and off\n" + "Using this while a boss is alive will instantly kill you and despawn the boss\n" + "If a boss is defeated with this effect active it will drop 6 treasure bags, 5 in normal mode\n" + "If any player dies while a boss is alive the boss will instantly despawn"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.rare = 11; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item123; - item.consumable = false; - } + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item123; + item.consumable = false; + } public override bool CanUseItem(Player player) { @@ -42,11 +42,11 @@ namespace CalamityMod.Items.DifficultyItems } public override bool UseItem(Player player) - { + { for (int doom = 0; doom < 200; doom++) { if (Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == mod.NPCType("SlimeGodRun") || - Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) + Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) { player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); Main.npc[doom].active = false; @@ -74,7 +74,7 @@ namespace CalamityMod.Items.DifficultyItems CalamityMod.UpdateServerBoolean(); return true; - } + } public override void AddRecipes() { diff --git a/Items/DifficultyItems/Death.cs b/Items/DifficultyItems/Death.cs index 825ef11984..c80940275f 100644 --- a/Items/DifficultyItems/Death.cs +++ b/Items/DifficultyItems/Death.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.DifficultyItems { public class Death : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death"); - Tooltip.SetDefault("Makes bosses even more EXTREME.\n" + - "Allows certain bosses to spawn naturally.\n" + - "Increases enemy damage by 15% and spawn rates by 25%.\n" + - "Nerfs the effectiveness of life steal.\n" + - "Greatly increases the effectiveness of Rage and Adrenaline.\n" + - "Effect can be toggled on and off.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death"); + Tooltip.SetDefault("Makes bosses even more EXTREME.\n" + + "Allows certain bosses to spawn naturally.\n" + + "Increases enemy damage by 15% and spawn rates by 25%.\n" + + "Nerfs the effectiveness of life steal.\n" + + "Greatly increases the effectiveness of Rage and Adrenaline.\n" + + "Effect can be toggled on and off.\n" + "Effect will only work if Revengeance Mode is active.\n" + "Using this while a boss is alive will instantly kill you and despawn the boss."); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.rare = 11; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = false; - } + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = false; + } public override bool CanUseItem(Player player) { @@ -45,11 +45,11 @@ namespace CalamityMod.Items.DifficultyItems } public override bool UseItem(Player player) - { + { for (int doom = 0; doom < 200; doom++) { if (Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == mod.NPCType("SlimeGodRun") || - Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) + Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) { player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); Main.npc[doom].active = false; @@ -87,7 +87,7 @@ namespace CalamityMod.Items.DifficultyItems CalamityMod.UpdateServerBoolean(); return true; - } + } public override void AddRecipes() { diff --git a/Items/DifficultyItems/DefiledRune.cs b/Items/DifficultyItems/DefiledRune.cs index 144677a958..cdcb2b641d 100644 --- a/Items/DifficultyItems/DefiledRune.cs +++ b/Items/DifficultyItems/DefiledRune.cs @@ -1,97 +1,97 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.DifficultyItems { public class DefiledRune : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Defiled Rune"); - Tooltip.SetDefault("Wings do nothing and enemies can critically hit you\n" + - "Increases most rare item drop chances and enemies drop 50% more cash\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss\n" + - "Can only be used in revengeance and death mode\n" + - "Can be toggled on and off"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Defiled Rune"); + Tooltip.SetDefault("Wings do nothing and enemies can critically hit you\n" + + "Increases most rare item drop chances and enemies drop 50% more cash\n" + + "Using this while a boss is alive will instantly kill you and despawn the boss\n" + + "Can only be used in revengeance and death mode\n" + + "Can be toggled on and off"); + } - public override void SetDefaults() - { - item.rare = 11; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item100; - item.consumable = false; - } + public override void SetDefaults() + { + item.rare = 11; + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item100; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - if (CalamityWorld.bossRushActive || !CalamityWorld.revenge) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + if (CalamityWorld.bossRushActive || !CalamityWorld.revenge) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == mod.NPCType("SlimeGodRun") || - Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) - { - player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.defiled) - { - CalamityWorld.defiled = true; - string key = "Mods.CalamityMod.DefiledText"; - Color messageColor = Color.DarkSeaGreen; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else - { - CalamityWorld.defiled = false; - string key = "Mods.CalamityMod.DefiledText2"; - Color messageColor = Color.DarkSeaGreen; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + public override bool UseItem(Player player) + { + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == mod.NPCType("SlimeGodRun") || + Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) + { + player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.defiled) + { + CalamityWorld.defiled = true; + string key = "Mods.CalamityMod.DefiledText"; + Color messageColor = Color.DarkSeaGreen; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else + { + CalamityWorld.defiled = false; + string key = "Mods.CalamityMod.DefiledText2"; + Color messageColor = Color.DarkSeaGreen; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } CalamityMod.UpdateServerBoolean(); return true; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/DifficultyItems/IronHeart.cs b/Items/DifficultyItems/IronHeart.cs index ec8ae8f596..2e7eb2649b 100644 --- a/Items/DifficultyItems/IronHeart.cs +++ b/Items/DifficultyItems/IronHeart.cs @@ -8,32 +8,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.DifficultyItems { public class IronHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Iron Heart"); - Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Iron Heart"); + Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + "Can be toggled on and off.\n" + "Using this while a boss is alive will permanently kill you.\n" + "Cannot be activated if any boss has been killed."); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.expert = true; - item.rare = 9; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.expert = true; + item.rare = 9; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = false; + } public override bool CanUseItem(Player player) { - if (CalamityWorld.downedBossAny) + if (CalamityWorld.downedBossAny) { return false; } @@ -41,46 +41,46 @@ namespace CalamityMod.Items.DifficultyItems } public override bool UseItem(Player player) - { - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && Main.npc[doom].boss) - { - player.KillMeForGood(); - Main.npc[doom].active = false; + { + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && Main.npc[doom].boss) + { + player.KillMeForGood(); + Main.npc[doom].active = false; Main.npc[doom].netUpdate = true; } - } - if (!CalamityWorld.ironHeart) - { - CalamityWorld.ironHeart = true; - string key = "Mods.CalamityMod.IronHeartText"; - Color messageColor = Color.LightSkyBlue; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else - { - CalamityWorld.ironHeart = false; - string key = "Mods.CalamityMod.IronHeartText2"; - Color messageColor = Color.LightSkyBlue; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + } + if (!CalamityWorld.ironHeart) + { + CalamityWorld.ironHeart = true; + string key = "Mods.CalamityMod.IronHeartText"; + Color messageColor = Color.LightSkyBlue; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else + { + CalamityWorld.ironHeart = false; + string key = "Mods.CalamityMod.IronHeartText2"; + Color messageColor = Color.LightSkyBlue; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } CalamityMod.UpdateServerBoolean(); return true; - } - } + } + } } diff --git a/Items/DifficultyItems/MLGRune.cs b/Items/DifficultyItems/MLGRune.cs index 158d0dd329..cdb8ef2931 100644 --- a/Items/DifficultyItems/MLGRune.cs +++ b/Items/DifficultyItems/MLGRune.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.DifficultyItems { public class MLGRune : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demon Trophy"); - Tooltip.SetDefault("Boosts spawn rate by 1.25 times\n" + - "Effects cannot be reversed"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demon Trophy"); + Tooltip.SetDefault("Boosts spawn rate by 1.25 times\n" + + "Effects cannot be reversed"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 99; - item.rare = 1; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 99; + item.rare = 1; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = true; + } - public override bool UseItem(Player player) - { - CalamityWorld.demonMode = true; - CalamityMod.UpdateServerBoolean(); - return true; - } - } + public override bool UseItem(Player player) + { + CalamityWorld.demonMode = true; + CalamityMod.UpdateServerBoolean(); + return true; + } + } } diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index 5beae5dad0..0b0b7bef15 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -1,137 +1,137 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.DifficultyItems { public class Revenge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Revengeance"); - Tooltip.SetDefault("Activates Revengeance Mode, can only be used in expert mode.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Revengeance"); + Tooltip.SetDefault("Activates Revengeance Mode, can only be used in expert mode.\n" + "Activates rage. When rage is maxed press V to activate rage mode.\n" + "You gain rage whenever you take damage or hit an enemy with a true melee weapon.\n" + "Activates adrenaline. When adrenaline is maxed press B to activate adrenaline mode.\n" + "You gain adrenaline whenever a boss is alive. Getting hit drops adrenaline back to 0.\n" + "If you hit max adrenaline and don't use it within 3 seconds your adrenaline damage will drop gradually.\n" + - "All enemies drop 50% more cash.\n" + - "All enemies gain a new damage reduction stat, which can be reduced by applying various debuffs to them.\n" + - "The amount of this damage reduction stat varies based on enemy type.\n" + - "Makes certain enemies immune to life steal and nerfs the effectiveness of life steal.\n" + - "Increases enemy damage by 25% and spawn rates by 15%.\n" + - "Nerfs the effectiveness of the Titanium Armor set bonus.\n" + - "Makes life regen scale with your current HP, the higher your HP the lower your life regen (this is not based on max HP).\n" + - "Reduces maximum asphalt run speed by 33%.\n" + - "Increases Nurse healing price.\n" + - "Allows certain enemies to inflict the Horror and Marked debuffs.\n" + - "Before you have killed your first boss you take 20% less damage from everything.\n" + + "All enemies drop 50% more cash.\n" + + "All enemies gain a new damage reduction stat, which can be reduced by applying various debuffs to them.\n" + + "The amount of this damage reduction stat varies based on enemy type.\n" + + "Makes certain enemies immune to life steal and nerfs the effectiveness of life steal.\n" + + "Increases enemy damage by 25% and spawn rates by 15%.\n" + + "Nerfs the effectiveness of the Titanium Armor set bonus.\n" + + "Makes life regen scale with your current HP, the higher your HP the lower your life regen (this is not based on max HP).\n" + + "Reduces maximum asphalt run speed by 33%.\n" + + "Increases Nurse healing price.\n" + + "Allows certain enemies to inflict the Horror and Marked debuffs.\n" + + "Before you have killed your first boss you take 20% less damage from everything.\n" + "Changes the Expert Mode 75% defense back to the Normal Mode 50% defense for the duration of prehardmode.\n" + "Changes ALL boss AIs and some enemy AIs in vanilla and the Calamity Mod.\n" + - "DO NOT USE IF A BOSS IS ALIVE!\n" + - "Can be toggled on and off."); - } + "DO NOT USE IF A BOSS IS ALIVE!\n" + + "Can be toggled on and off."); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; item.rare = 11; - item.UseSound = SoundID.Item119; - item.consumable = false; - } + item.UseSound = SoundID.Item119; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - if (!Main.expertMode || CalamityWorld.bossRushActive) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + if (!Main.expertMode || CalamityWorld.bossRushActive) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == mod.NPCType("SlimeGodRun") || - Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) - { - player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - Main.npc[doom].active = false; + public override bool UseItem(Player player) + { + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == mod.NPCType("SlimeGodRun") || + Main.npc[doom].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[doom].type == mod.NPCType("SlimeGod") || Main.npc[doom].type == mod.NPCType("SlimeGodSplit"))) + { + player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + Main.npc[doom].active = false; Main.npc[doom].netUpdate = true; } - } - if (!CalamityWorld.revenge) - { - CalamityWorld.revenge = true; - string key = "Mods.CalamityMod.RevengeText"; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + } + if (!CalamityWorld.revenge) + { + CalamityWorld.revenge = true; + string key = "Mods.CalamityMod.RevengeText"; + Color messageColor = Color.Crimson; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } CalamityMod.UpdateServerBoolean(); } - else - { - CalamityWorld.revenge = false; - string key = "Mods.CalamityMod.RevengeText2"; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + else + { + CalamityWorld.revenge = false; + string key = "Mods.CalamityMod.RevengeText2"; + Color messageColor = Color.Crimson; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } - if (CalamityWorld.death) - { - CalamityWorld.death = false; - key = "Mods.CalamityMod.DeathText2"; - messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (CalamityWorld.defiled) - { - CalamityWorld.defiled = false; - key = "Mods.CalamityMod.DefiledText2"; - messageColor = Color.DarkSeaGreen; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + if (CalamityWorld.death) + { + CalamityWorld.death = false; + key = "Mods.CalamityMod.DeathText2"; + messageColor = Color.Crimson; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (CalamityWorld.defiled) + { + CalamityWorld.defiled = false; + key = "Mods.CalamityMod.DefiledText2"; + messageColor = Color.DarkSeaGreen; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } CalamityMod.UpdateServerBoolean(); } - return true; - } + return true; + } public override void AddRecipes() { diff --git a/Items/FabsolStuff/BloodyMary.cs b/Items/FabsolStuff/BloodyMary.cs index 579d807d36..91e4269ef8 100644 --- a/Items/FabsolStuff/BloodyMary.cs +++ b/Items/FabsolStuff/BloodyMary.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class BloodyMary : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Mary"); - Tooltip.SetDefault(@"Boosts damage, movement speed, and melee speed by 15% and crit chance by 7% during a Blood Moon + { + DisplayName.SetDefault("Bloody Mary"); + Tooltip.SetDefault(@"Boosts damage, movement speed, and melee speed by 15% and crit chance by 7% during a Blood Moon Reduces life regen by 2 and defense by 6 Extra spicy and bloody!"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ Extra spicy and bloody!"); item.buffType = mod.BuffType("BloodyMary"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 10, 0, 0); - } + } } } diff --git a/Items/FabsolStuff/BlueCandle.cs b/Items/FabsolStuff/BlueCandle.cs index 6f6eed0bbf..d6a1d29105 100644 --- a/Items/FabsolStuff/BlueCandle.cs +++ b/Items/FabsolStuff/BlueCandle.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class BlueCandle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Weightless Candle"); - Tooltip.SetDefault("When placed, nearby players gain 15% movement speed, 10% wing time, and 5% acceleration\n" + - "'The floating flame seems to uplift your very spirit'"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Weightless Candle"); + Tooltip.SetDefault("When placed, nearby players gain 15% movement speed, 10% wing time, and 5% acceleration\n" + + "'The floating flame seems to uplift your very spirit'"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("BlueCandle"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("BlueCandle"); + } } } diff --git a/Items/FabsolStuff/CaribbeanRum.cs b/Items/FabsolStuff/CaribbeanRum.cs index 533f40dfb2..25654cae56 100644 --- a/Items/FabsolStuff/CaribbeanRum.cs +++ b/Items/FabsolStuff/CaribbeanRum.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class CaribbeanRum : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Caribbean Rum"); - Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed and wing flight time by 20% + { + DisplayName.SetDefault("Caribbean Rum"); + Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed and wing flight time by 20% Makes you floaty and reduces defense by 12 Why is the rum gone?"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ Why is the rum gone?"); item.buffType = mod.BuffType("CaribbeanRum"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 20, 0, 0); - } + } } } diff --git a/Items/FabsolStuff/CinnamonRoll.cs b/Items/FabsolStuff/CinnamonRoll.cs index 80828dbdf0..22d61c3b2f 100644 --- a/Items/FabsolStuff/CinnamonRoll.cs +++ b/Items/FabsolStuff/CinnamonRoll.cs @@ -5,19 +5,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class CinnamonRoll : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cinnamon Roll"); - Tooltip.SetDefault(@"Boosts mana regeneration rate and all fire-based weapon damage by 15% + { + DisplayName.SetDefault("Cinnamon Roll"); + Tooltip.SetDefault(@"Boosts mana regeneration rate and all fire-based weapon damage by 15% Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit The weapon must be more fire-related than anything else Reduces defense by 12 A great-tasting cinnamon whiskey with a touch of cream soda"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -31,6 +31,6 @@ A great-tasting cinnamon whiskey with a touch of cream soda"); item.buffType = mod.BuffType("CinnamonRoll"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 16, 60, 0); - } + } } } diff --git a/Items/FabsolStuff/Everclear.cs b/Items/FabsolStuff/Everclear.cs index d0a7817f3d..aa39f6b5b1 100644 --- a/Items/FabsolStuff/Everclear.cs +++ b/Items/FabsolStuff/Everclear.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Everclear : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Everclear"); - Tooltip.SetDefault(@"Boosts damage by 25% + { + DisplayName.SetDefault("Everclear"); + Tooltip.SetDefault(@"Boosts damage by 25% Reduces life regen by 10 and defense by 40 This is the most potent booze I have, be careful with it"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ This is the most potent booze I have, be careful with it"); item.buffType = mod.BuffType("Everclear"); item.buffTime = 900; //15 seconds item.value = Item.buyPrice(0, 6, 60, 0); - } + } } } diff --git a/Items/FabsolStuff/EvergreenGin.cs b/Items/FabsolStuff/EvergreenGin.cs index 74624ac151..38ddacad84 100644 --- a/Items/FabsolStuff/EvergreenGin.cs +++ b/Items/FabsolStuff/EvergreenGin.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class EvergreenGin : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Evergreen Gin"); - Tooltip.SetDefault(@"Boosts nature-based weapon damage by 15% and damage reduction by 5% + { + DisplayName.SetDefault("Evergreen Gin"); + Tooltip.SetDefault(@"Boosts nature-based weapon damage by 15% and damage reduction by 5% Reduces life regen by 1 It tastes like a Christmas tree if you can imagine that"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ It tastes like a Christmas tree if you can imagine that"); item.buffType = mod.BuffType("EvergreenGin"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 16, 60, 0); - } + } } } diff --git a/Items/FabsolStuff/FabsolsVodka.cs b/Items/FabsolStuff/FabsolsVodka.cs index 94cb019275..0eaa394434 100644 --- a/Items/FabsolStuff/FabsolsVodka.cs +++ b/Items/FabsolStuff/FabsolsVodka.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { - public class FabsolsVodka : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fabsol's Vodka"); - Tooltip.SetDefault("Boosts all damage stats by 8% but lowers defense by 20\n" + - "Increases immune time after being struck"); - } + public class FabsolsVodka : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fabsol's Vodka"); + Tooltip.SetDefault("Boosts all damage stats by 8% but lowers defense by 20\n" + + "Increases immune time after being struck"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("FabsolVodka"); - item.buffTime = 54000; + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("FabsolVodka"); + item.buffTime = 54000; item.value = Item.buyPrice(0, 10, 0, 0); } @@ -47,5 +47,5 @@ namespace CalamityMod.Items.FabsolStuff recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/FabsolStuff/Fireball.cs b/Items/FabsolStuff/Fireball.cs index 7bd469bfaf..180b9f98c8 100644 --- a/Items/FabsolStuff/Fireball.cs +++ b/Items/FabsolStuff/Fireball.cs @@ -5,19 +5,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Fireball : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - Tooltip.SetDefault(@"Boosts all fire-based weapon damage by 10% + { + DisplayName.SetDefault("Fireball"); + Tooltip.SetDefault(@"Boosts all fire-based weapon damage by 10% Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit The weapon must be more fire-related than anything else Reduces life regen by 1 A great-tasting cinnamon whiskey"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -31,6 +31,6 @@ A great-tasting cinnamon whiskey"); item.buffType = mod.BuffType("Fireball"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 6, 60, 0); - } + } } } diff --git a/Items/FabsolStuff/GrapeBeer.cs b/Items/FabsolStuff/GrapeBeer.cs index 820702c88c..4d7eba2e8c 100644 --- a/Items/FabsolStuff/GrapeBeer.cs +++ b/Items/FabsolStuff/GrapeBeer.cs @@ -5,69 +5,69 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { - public class GrapeBeer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grape Beer"); - Tooltip.SetDefault(@"Restores 100 mana + public class GrapeBeer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grape Beer"); + Tooltip.SetDefault(@"Restores 100 mana Reduces defense by 2 and movement speed by 5% This crap is abhorrent but you might like it"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 1; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.healLife = 100; - item.consumable = true; - item.potion = true; - item.value = Item.buyPrice(0, 0, 65, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 1; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.healLife = 100; + item.consumable = true; + item.potion = true; + item.value = Item.buyPrice(0, 0, 65, 0); + } - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } - public override void OnConsumeItem(Player player) - { - player.statLife += 100; - player.statMana += 100; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(100, true); - player.ManaEffect(100); - } - player.AddBuff(mod.BuffType("GrapeBeer"), 3600); - } + public override void OnConsumeItem(Player player) + { + player.statLife += 100; + player.statMana += 100; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(100, true); + player.ManaEffect(100); + } + player.AddBuff(mod.BuffType("GrapeBeer"), 3600); + } - // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. - public override void GetHealLife(Player player, bool quickHeal, ref int healValue) - { - healValue = 0; - } + // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. + public override void GetHealLife(Player player, bool quickHeal, ref int healValue) + { + healValue = 0; + } - // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). - public override void ModifyTooltips(List tooltips) - { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; - } - } + // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). + public override void ModifyTooltips(List tooltips) + { + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + } + } } diff --git a/Items/FabsolStuff/Margarita.cs b/Items/FabsolStuff/Margarita.cs index 2abef5eff8..156356e652 100644 --- a/Items/FabsolStuff/Margarita.cs +++ b/Items/FabsolStuff/Margarita.cs @@ -5,72 +5,72 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { - public class Margarita : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Margarita"); - Tooltip.SetDefault(@"Restores 200 mana + public class Margarita : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Margarita"); + Tooltip.SetDefault(@"Restores 200 mana Makes you immune to most debuffs Reduces defense by 6 and life regen by 1 One of the best drinks ever created, enjoy it while it lasts"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 5; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.healLife = 200; - item.buffType = mod.BuffType("Margarita"); - item.buffTime = 10800; - item.value = Item.buyPrice(0, 23, 30, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 5; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.healLife = 200; + item.buffType = mod.BuffType("Margarita"); + item.buffTime = 10800; + item.value = Item.buyPrice(0, 23, 30, 0); + } - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } - public override void OnConsumeItem(Player player) - { - player.statLife += 200; - player.statMana += 200; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(200, true); - player.ManaEffect(200); - } - player.AddBuff(mod.BuffType("Margarita"), 10800); - } + public override void OnConsumeItem(Player player) + { + player.statLife += 200; + player.statMana += 200; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(200, true); + player.ManaEffect(200); + } + player.AddBuff(mod.BuffType("Margarita"), 10800); + } - // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. - public override void GetHealLife(Player player, bool quickHeal, ref int healValue) - { - healValue = 0; - } + // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. + public override void GetHealLife(Player player, bool quickHeal, ref int healValue) + { + healValue = 0; + } - // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). - public override void ModifyTooltips(List tooltips) - { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; - } - } + // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). + public override void ModifyTooltips(List tooltips) + { + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + } + } } diff --git a/Items/FabsolStuff/Moonshine.cs b/Items/FabsolStuff/Moonshine.cs index c3e106624b..f278b14383 100644 --- a/Items/FabsolStuff/Moonshine.cs +++ b/Items/FabsolStuff/Moonshine.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Moonshine : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moonshine"); - Tooltip.SetDefault(@"Increases defense by 10 and damage reduction by 5% + { + DisplayName.SetDefault("Moonshine"); + Tooltip.SetDefault(@"Increases defense by 10 and damage reduction by 5% Reduces life regen by 1 This stuff is pretty strong but I'm sure you can handle it"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ This stuff is pretty strong but I'm sure you can handle it"); item.buffType = mod.BuffType("Moonshine"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 3, 30, 0); - } + } } } diff --git a/Items/FabsolStuff/MoscowMule.cs b/Items/FabsolStuff/MoscowMule.cs index 3365fd50c2..6e721849af 100644 --- a/Items/FabsolStuff/MoscowMule.cs +++ b/Items/FabsolStuff/MoscowMule.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class MoscowMule : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moscow Mule"); - Tooltip.SetDefault(@"Boosts damage and knockback by 9% and critical strike chance by 3% + { + DisplayName.SetDefault("Moscow Mule"); + Tooltip.SetDefault(@"Boosts damage and knockback by 9% and critical strike chance by 3% Reduces life regen by 2 I once heard the copper mug can be toxic and I told 'em 'listen dummy, I'm already poisoning myself'"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ I once heard the copper mug can be toxic and I told 'em 'listen dummy, I'm alrea item.buffType = mod.BuffType("MoscowMule"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 16, 60, 0); - } + } } } diff --git a/Items/FabsolStuff/OddMushroom.cs b/Items/FabsolStuff/OddMushroom.cs index b3c13ae76a..2d60aac377 100644 --- a/Items/FabsolStuff/OddMushroom.cs +++ b/Items/FabsolStuff/OddMushroom.cs @@ -5,28 +5,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class OddMushroom : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Odd Mushroom"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Odd Mushroom"); Tooltip.SetDefault("Trippy"); } - public override void SetDefaults() - { - item.width = 42; - item.height = 48; - item.useTurn = true; - item.maxStack = 30; + public override void SetDefaults() + { + item.width = 42; + item.height = 48; + item.useTurn = true; + item.maxStack = 30; item.useAnimation = 17; - item.useTime = 17; + item.useTime = 17; item.rare = 3; - item.useStyle = 2; - item.UseSound = SoundID.Item2; - item.consumable = true; + item.useStyle = 2; + item.UseSound = SoundID.Item2; + item.consumable = true; item.buffType = mod.BuffType("Trippy"); item.buffTime = 216000; - item.value = Item.buyPrice(1, 0, 0, 0); - } - } + item.value = Item.buyPrice(1, 0, 0, 0); + } + } } diff --git a/Items/FabsolStuff/PinkCandle.cs b/Items/FabsolStuff/PinkCandle.cs index 8dfc3c15ff..5d15cae332 100644 --- a/Items/FabsolStuff/PinkCandle.cs +++ b/Items/FabsolStuff/PinkCandle.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class PinkCandle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vigorous Candle"); - Tooltip.SetDefault("When placed, nearby players regenerate 0.4% of their maximum health per second\n" + - "This regeneration is at full power even while moving and bypasses Revengeance Mode caps\n" + - "'Its brilliant light suffuses those nearby with hope'"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vigorous Candle"); + Tooltip.SetDefault("When placed, nearby players regenerate 0.4% of their maximum health per second\n" + + "This regeneration is at full power even while moving and bypasses Revengeance Mode caps\n" + + "'Its brilliant light suffuses those nearby with hope'"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("PinkCandle"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("PinkCandle"); + } } } diff --git a/Items/FabsolStuff/PurpleCandle.cs b/Items/FabsolStuff/PurpleCandle.cs index 80573da6d3..91f72977e2 100644 --- a/Items/FabsolStuff/PurpleCandle.cs +++ b/Items/FabsolStuff/PurpleCandle.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class PurpleCandle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Resilient Candle"); - Tooltip.SetDefault("When placed, nearby players' defense blocks 5% more damage\n" + - "'Neither rain nor wind can snuff its undying flame'"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Resilient Candle"); + Tooltip.SetDefault("When placed, nearby players' defense blocks 5% more damage\n" + + "'Neither rain nor wind can snuff its undying flame'"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("PurpleCandle"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("PurpleCandle"); + } } } diff --git a/Items/FabsolStuff/RedWine.cs b/Items/FabsolStuff/RedWine.cs index ca4d19e4e4..3a52e6e810 100644 --- a/Items/FabsolStuff/RedWine.cs +++ b/Items/FabsolStuff/RedWine.cs @@ -5,40 +5,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class RedWine : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Wine"); - Tooltip.SetDefault(@"Reduces life regen by 1 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Wine"); + Tooltip.SetDefault(@"Reduces life regen by 1 Too dry for my taste"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 1; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.healLife = 200; - item.consumable = true; - item.potion = true; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 1; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.healLife = 200; + item.consumable = true; + item.potion = true; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } - public override bool UseItem(Player player) - { - player.AddBuff(mod.BuffType("RedWine"), 900); - return true; - } - } + public override bool UseItem(Player player) + { + player.AddBuff(mod.BuffType("RedWine"), 900); + return true; + } + } } diff --git a/Items/FabsolStuff/Rum.cs b/Items/FabsolStuff/Rum.cs index 1a4a905ccc..44af0d1a08 100644 --- a/Items/FabsolStuff/Rum.cs +++ b/Items/FabsolStuff/Rum.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Rum : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rum"); - Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed by 10% + { + DisplayName.SetDefault("Rum"); + Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed by 10% Reduces defense by 8 Sweet and potent, just how I like it"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ Sweet and potent, just how I like it"); item.buffType = mod.BuffType("Rum"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 5, 0, 0); - } + } } } diff --git a/Items/FabsolStuff/Screwdriver.cs b/Items/FabsolStuff/Screwdriver.cs index 3e9373b19e..4e3f1519e3 100644 --- a/Items/FabsolStuff/Screwdriver.cs +++ b/Items/FabsolStuff/Screwdriver.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Screwdriver : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Screwdriver"); - Tooltip.SetDefault(@"Boosts piercing projectile damage by 10% + { + DisplayName.SetDefault("Screwdriver"); + Tooltip.SetDefault(@"Boosts piercing projectile damage by 10% Reduces life regen by 1 Do you have a screw loose?"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ Do you have a screw loose?"); item.buffType = mod.BuffType("Screwdriver"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 16, 60, 0); - } + } } } diff --git a/Items/FabsolStuff/StarBeamRye.cs b/Items/FabsolStuff/StarBeamRye.cs index 935509193b..1c80d7cdea 100644 --- a/Items/FabsolStuff/StarBeamRye.cs +++ b/Items/FabsolStuff/StarBeamRye.cs @@ -5,18 +5,18 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class StarBeamRye : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star Beam Rye"); - Tooltip.SetDefault(@"Boosts max mana by 50, magic damage by 8%, + { + DisplayName.SetDefault("Star Beam Rye"); + Tooltip.SetDefault(@"Boosts max mana by 50, magic damage by 8%, and reduces mana usage by 10% Reduces defense by 6 and life regen by 1 Made from some stuff I found near the Astral Meteor crash site, don't worry it's safe, trust me"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -30,6 +30,6 @@ Made from some stuff I found near the Astral Meteor crash site, don't worry it's item.buffType = mod.BuffType("StarBeamRye"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 13, 30, 0); - } + } } } diff --git a/Items/FabsolStuff/Tequila.cs b/Items/FabsolStuff/Tequila.cs index 9f56981294..faf4166001 100644 --- a/Items/FabsolStuff/Tequila.cs +++ b/Items/FabsolStuff/Tequila.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Tequila : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tequila"); - Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 3%, crit chance by 2%, and defense by 5 during daytime + { + DisplayName.SetDefault("Tequila"); + Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 3%, crit chance by 2%, and defense by 5 during daytime Reduces life regen by 1 Great for mixing up daytime drinks"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ Great for mixing up daytime drinks"); item.buffType = mod.BuffType("Tequila"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 5, 0, 0); - } + } } } diff --git a/Items/FabsolStuff/TequilaSunrise.cs b/Items/FabsolStuff/TequilaSunrise.cs index ac05d58e91..ac8cfdea39 100644 --- a/Items/FabsolStuff/TequilaSunrise.cs +++ b/Items/FabsolStuff/TequilaSunrise.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class TequilaSunrise : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tequila Sunrise"); - Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 7%, crit chance by 3%, and defense by 15 during daytime + { + DisplayName.SetDefault("Tequila Sunrise"); + Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 7%, crit chance by 3%, and defense by 15 during daytime Reduces life regen by 1 The greatest daytime drink I've ever had"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ The greatest daytime drink I've ever had"); item.buffType = mod.BuffType("TequilaSunrise"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 20, 0, 0); - } + } } } diff --git a/Items/FabsolStuff/Vodka.cs b/Items/FabsolStuff/Vodka.cs index c106a21a35..993dec00c7 100644 --- a/Items/FabsolStuff/Vodka.cs +++ b/Items/FabsolStuff/Vodka.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Vodka : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vodka"); - Tooltip.SetDefault(@"Boosts damage by 6% and critical strike chance by 2% + { + DisplayName.SetDefault("Vodka"); + Tooltip.SetDefault(@"Boosts damage by 6% and critical strike chance by 2% Reduces life regen by 1 and defense by 4 The number one alcohol for creating great mixed drinks"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ The number one alcohol for creating great mixed drinks"); item.buffType = mod.BuffType("Vodka"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 3, 30, 0); - } + } } } diff --git a/Items/FabsolStuff/Whiskey.cs b/Items/FabsolStuff/Whiskey.cs index 9171abcba6..966b7fd7fc 100644 --- a/Items/FabsolStuff/Whiskey.cs +++ b/Items/FabsolStuff/Whiskey.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class Whiskey : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Whiskey"); - Tooltip.SetDefault(@"Boosts damage and knockback by 4% and critical strike chance by 2% + { + DisplayName.SetDefault("Whiskey"); + Tooltip.SetDefault(@"Boosts damage and knockback by 4% and critical strike chance by 2% Reduces defense by 8 The burning sensation makes it tastier"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -29,6 +29,6 @@ The burning sensation makes it tastier"); item.buffType = mod.BuffType("Whiskey"); item.buffTime = 18000; //5 minutes item.value = Item.buyPrice(0, 3, 30, 0); - } + } } } diff --git a/Items/FabsolStuff/WhiteWine.cs b/Items/FabsolStuff/WhiteWine.cs index f5f9cd843e..eed2ce44f7 100644 --- a/Items/FabsolStuff/WhiteWine.cs +++ b/Items/FabsolStuff/WhiteWine.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class WhiteWine : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("White Wine"); - Tooltip.SetDefault(@"Boosts magic damage by 10% + { + DisplayName.SetDefault("White Wine"); + Tooltip.SetDefault(@"Boosts magic damage by 10% Reduces defense by 6 and life regen by 1 I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.width = 28; item.height = 18; item.useTurn = true; @@ -30,11 +30,11 @@ I drank a full barrel of this stuff once in one night, I couldn't remember who I item.buffType = mod.BuffType("WhiteWine"); item.buffTime = 10800; //3 minutes item.value = Item.buyPrice(0, 16, 60, 0); - } + } - public override void OnConsumeItem(Player player) - { - player.AddBuff(mod.BuffType("WhiteWine"), 10800); - } - } + public override void OnConsumeItem(Player player) + { + player.AddBuff(mod.BuffType("WhiteWine"), 10800); + } + } } diff --git a/Items/FabsolStuff/YellowCandle.cs b/Items/FabsolStuff/YellowCandle.cs index 9f9ef979bd..5bc09346bf 100644 --- a/Items/FabsolStuff/YellowCandle.cs +++ b/Items/FabsolStuff/YellowCandle.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.FabsolStuff { public class YellowCandle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spiteful Candle"); - Tooltip.SetDefault("When placed, nearby enemies take 5% more damage.\n" + - "This extra damage bypasses enemy damage reduction\n" + - "'Its hateful glow flickers with ire'"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spiteful Candle"); + Tooltip.SetDefault("When placed, nearby enemies take 5% more damage.\n" + + "This extra damage bypasses enemy damage reduction\n" + + "'Its hateful glow flickers with ire'"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("YellowCandle"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("YellowCandle"); + } } } diff --git a/Items/Fishing/ArcturusAstroidean.cs b/Items/Fishing/ArcturusAstroidean.cs index 6371d59e2c..390240d8b4 100644 --- a/Items/Fishing/ArcturusAstroidean.cs +++ b/Items/Fishing/ArcturusAstroidean.cs @@ -1,6 +1,5 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Fishing { @@ -9,7 +8,7 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { DisplayName.SetDefault("Arcturus Astroidean"); - Tooltip.SetDefault("Increases fishing power if used in the Astral Infection or Sulphurous Sea"); + Tooltip.SetDefault("Increases fishing power if used in the Astral Infection or Sulphurous Sea"); } public override void SetDefaults() @@ -18,8 +17,8 @@ namespace CalamityMod.Items.Fishing item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 3; - item.bait = 40; + item.rare = 3; + item.bait = 40; } } } diff --git a/Items/Fishing/AstralCrate.cs b/Items/Fishing/AstralCrate.cs index d63c065d3b..d515c2a038 100644 --- a/Items/Fishing/AstralCrate.cs +++ b/Items/Fishing/AstralCrate.cs @@ -1,96 +1,96 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; using CalamityMod.Utilities; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing { public class AstralCrate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Crate"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Crate"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 32; - item.height = 32; - item.rare = 2; + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 32; + item.height = 32; + item.rare = 2; item.value = Item.sellPrice(gold: 1); - item.createTile = mod.TileType("AstralCrate"); - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - } + item.createTile = mod.TileType("AstralCrate"); + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void RightClick(Player player) - { - //Modded materials - DropHelper.DropItem(player, mod.ItemType("Stardust"), 10, 20); - DropHelper.DropItem(player, ItemID.FallenStar, 10, 20); - if (CalamityWorld.downedAstrageldon) - { - DropHelper.DropItemChance(player, mod.ItemType("AstralJelly"), 0.5f, 5, 10); - } - if (CalamityWorld.downedStarGod) - { - DropHelper.DropItemChance(player, mod.ItemType("AstralOre"), 0.5f, 10, 20); - DropHelper.DropItemChance(player, mod.ItemType("AstralBar"), 0.25f, 5, 10); - } + public override void RightClick(Player player) + { + //Modded materials + DropHelper.DropItem(player, mod.ItemType("Stardust"), 10, 20); + DropHelper.DropItem(player, ItemID.FallenStar, 10, 20); + if (CalamityWorld.downedAstrageldon) + { + DropHelper.DropItemChance(player, mod.ItemType("AstralJelly"), 0.5f, 5, 10); + } + if (CalamityWorld.downedStarGod) + { + DropHelper.DropItemChance(player, mod.ItemType("AstralOre"), 0.5f, 10, 20); + DropHelper.DropItemChance(player, mod.ItemType("AstralBar"), 0.25f, 5, 10); + } - // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f, - mod.ItemType("StellarKnife"), - mod.ItemType("AstralachneaStaff"), - mod.ItemType("TitanArm"), - mod.ItemType("HivePod"), - mod.ItemType("AstralScythe"), - mod.ItemType("StellarCannon")); + // Weapons + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f, + mod.ItemType("StellarKnife"), + mod.ItemType("AstralachneaStaff"), + mod.ItemType("TitanArm"), + mod.ItemType("HivePod"), + mod.ItemType("AstralScythe"), + mod.ItemType("StellarCannon")); - //Bait - DropHelper.DropItemChance(player, mod.ItemType("Twinkler"), 5, 1, 3); - DropHelper.DropItemChance(player, ItemID.EnchantedNightcrawler, 5, 1, 3); - DropHelper.DropItemChance(player, mod.ItemType("ArcturusAstroidean"), 5, 1, 3); - DropHelper.DropItemChance(player, ItemID.Firefly, 3, 1, 3); + //Bait + DropHelper.DropItemChance(player, mod.ItemType("Twinkler"), 5, 1, 3); + DropHelper.DropItemChance(player, ItemID.EnchantedNightcrawler, 5, 1, 3); + DropHelper.DropItemChance(player, mod.ItemType("ArcturusAstroidean"), 5, 1, 3); + DropHelper.DropItemChance(player, ItemID.Firefly, 3, 1, 3); - //Potions - DropHelper.DropItemChance(player, ItemID.ObsidianSkinPotion, 10, 1, 3); - DropHelper.DropItemChance(player, ItemID.SwiftnessPotion, 10, 1, 3); - DropHelper.DropItemChance(player, ItemID.IronskinPotion, 10, 1, 3); - DropHelper.DropItemChance(player, ItemID.NightOwlPotion, 10, 1, 3); - DropHelper.DropItemChance(player, ItemID.ShinePotion, 10, 1, 3); - DropHelper.DropItemChance(player, ItemID.MiningPotion, 10, 1, 3); - DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); - DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - if (CalamityWorld.downedStarGod) - { - DropHelper.DropItemChance(player, ItemID.SuperHealingPotion, 2, 5, 10); - } - else - { - DropHelper.DropItemChance(player, ItemID.GreaterHealingPotion, 2, 5, 10); - } - if (CalamityWorld.downedAstrageldon) - { - DropHelper.DropItemChance(player, mod.ItemType("AstralInjection"), 4, 1, 3); - DropHelper.DropItemChance(player, mod.ItemType("GravityNormalizerPotion"), 4, 1, 3); - } + //Potions + DropHelper.DropItemChance(player, ItemID.ObsidianSkinPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.SwiftnessPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.IronskinPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.NightOwlPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.ShinePotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.MiningPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); + DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion + if (CalamityWorld.downedStarGod) + { + DropHelper.DropItemChance(player, ItemID.SuperHealingPotion, 2, 5, 10); + } + else + { + DropHelper.DropItemChance(player, ItemID.GreaterHealingPotion, 2, 5, 10); + } + if (CalamityWorld.downedAstrageldon) + { + DropHelper.DropItemChance(player, mod.ItemType("AstralInjection"), 4, 1, 3); + DropHelper.DropItemChance(player, mod.ItemType("GravityNormalizerPotion"), 4, 1, 3); + } - //Money - DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); - DropHelper.DropItemChance(player, ItemID.GoldCoin, 0.5f, 1, 5); - } - } + //Money + DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); + DropHelper.DropItemChance(player, ItemID.GoldCoin, 0.5f, 1, 5); + } + } } diff --git a/Items/Fishing/ProcyonidPrawn.cs b/Items/Fishing/ProcyonidPrawn.cs index f4ee5e2a47..1b63156ff4 100644 --- a/Items/Fishing/ProcyonidPrawn.cs +++ b/Items/Fishing/ProcyonidPrawn.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Fishing item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 5); - item.rare = 1; + item.rare = 1; } } } diff --git a/Items/Fishing/TwinklingPollox.cs b/Items/Fishing/TwinklingPollox.cs index bd21d4d846..6c7c06ef2f 100644 --- a/Items/Fishing/TwinklingPollox.cs +++ b/Items/Fishing/TwinklingPollox.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Fishing item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 5); - item.rare = 1; + item.rare = 1; } } } diff --git a/Items/Fishing/UrsaSergeant.cs b/Items/Fishing/UrsaSergeant.cs index 9932757c7f..40695f2041 100644 --- a/Items/Fishing/UrsaSergeant.cs +++ b/Items/Fishing/UrsaSergeant.cs @@ -1,7 +1,6 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing { diff --git a/Items/GreatSandShark/GrandScale.cs b/Items/GreatSandShark/GrandScale.cs index 8bb09a2d0f..3d2e029caa 100644 --- a/Items/GreatSandShark/GrandScale.cs +++ b/Items/GreatSandShark/GrandScale.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.GreatSandShark item.width = 15; item.height = 12; item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; + item.value = Item.buyPrice(0, 4, 50, 0); + item.rare = 7; } } } diff --git a/Items/GreatSandShark/SandstormsCore.cs b/Items/GreatSandShark/SandstormsCore.cs index ce5560136f..1e6b38529b 100644 --- a/Items/GreatSandShark/SandstormsCore.cs +++ b/Items/GreatSandShark/SandstormsCore.cs @@ -4,47 +4,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.GreatSandShark { - public class SandstormsCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandstorm's Core"); + public class SandstormsCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandstorm's Core"); Tooltip.SetDefault("Summons the Great Sand Shark"); } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 7; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 7; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("GreatSandShark")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("GreatSandShark")); + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("GreatSandShark")); Main.PlaySound(SoundID.Roar, player.position, 0); return true; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.Ectoplasm, 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.Ectoplasm, 5); recipe.AddIngredient(ItemID.HallowedBar, 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/HiveMind/HiveMindBag.cs b/Items/HiveMind/HiveMindBag.cs index ca65bb3f2b..3edbbb8d1f 100644 --- a/Items/HiveMind/HiveMindBag.cs +++ b/Items/HiveMind/HiveMindBag.cs @@ -1,57 +1,57 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.Utilities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.HiveMind { - public class HiveMindBag : ModItem - { - public override int BossBagNPC => mod.NPCType("HiveMindP2"); + public class HiveMindBag : ModItem + { + public override int BossBagNPC => mod.NPCType("HiveMindP2"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - // Materials - DropHelper.DropItem(player, ItemID.RottenChunk, 10, 20); - DropHelper.DropItem(player, ItemID.DemoniteBar, 9, 14); - DropHelper.DropItem(player, mod.ItemType("TrueShadowScale"), 30, 40); - DropHelper.DropItemCondition(player, ItemID.CursedFlame, Main.hardMode, 15, 30); + public override void OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, ItemID.RottenChunk, 10, 20); + DropHelper.DropItem(player, ItemID.DemoniteBar, 9, 14); + DropHelper.DropItem(player, mod.ItemType("TrueShadowScale"), 30, 40); + DropHelper.DropItemCondition(player, ItemID.CursedFlame, Main.hardMode, 15, 30); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("PerfectDark"), 3); - DropHelper.DropItemChance(player, mod.ItemType("LeechingDagger"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Shadethrower"), 3); - DropHelper.DropItemChance(player, mod.ItemType("ShadowdropStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("ShaderainStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("DankStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("RotBall"), 3, 50, 75); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("PerfectDark"), 3); + DropHelper.DropItemChance(player, mod.ItemType("LeechingDagger"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Shadethrower"), 3); + DropHelper.DropItemChance(player, mod.ItemType("ShadowdropStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("ShaderainStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("DankStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("RotBall"), 3, 50, 75); - // Equipment - DropHelper.DropItem(player, mod.ItemType("RottenBrain")); + // Equipment + DropHelper.DropItem(player, mod.ItemType("RottenBrain")); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("HiveMindMask"), 7); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("HiveMindMask"), 7); + } + } } diff --git a/Items/HiveMind/RottenBrain.cs b/Items/HiveMind/RottenBrain.cs index 2c7fd1a4b0..dd13387d24 100644 --- a/Items/HiveMind/RottenBrain.cs +++ b/Items/HiveMind/RottenBrain.cs @@ -1,8 +1,8 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.HiveMind { @@ -20,8 +20,8 @@ namespace CalamityMod.Items.HiveMind item.height = 34; item.value = Item.buyPrice(0, 9, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -52,8 +52,8 @@ namespace CalamityMod.Items.HiveMind } } } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rBrain = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rBrain = true; } } } diff --git a/Items/HiveMind/Teratoma.cs b/Items/HiveMind/Teratoma.cs index b5d2362a7b..6f91fe4351 100644 --- a/Items/HiveMind/Teratoma.cs +++ b/Items/HiveMind/Teratoma.cs @@ -5,49 +5,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.HiveMind { public class Teratoma : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Teratoma"); - Tooltip.SetDefault("Summons the Hive Mind"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Teratoma"); + Tooltip.SetDefault("Summons the Hive Mind"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 3; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 3; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneCorrupt && !NPC.AnyNPCs(mod.NPCType("HiveMind")) && !NPC.AnyNPCs(mod.NPCType("HiveMindP2")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneCorrupt && !NPC.AnyNPCs(mod.NPCType("HiveMind")) && !NPC.AnyNPCs(mod.NPCType("HiveMindP2")); + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { if (Main.netMode != NetmodeID.MultiplayerClient) { int num = NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 100))), (int)(player.position.Y - 150f), mod.NPCType("HiveMind"), 0, 0f, 0f, 0f, 0f, 255); Main.PlaySound(SoundID.Roar, player.position, 0); } - return true; - } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 9); - recipe.AddIngredient(null, "TrueShadowScale", 5); - recipe.AddIngredient(ItemID.DemoniteBar, 2); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 9); + recipe.AddIngredient(null, "TrueShadowScale", 5); + recipe.AddIngredient(ItemID.DemoniteBar, 2); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/HiveMind/TrueShadowScale.cs b/Items/HiveMind/TrueShadowScale.cs index 8b13395417..1cbe0fd298 100644 --- a/Items/HiveMind/TrueShadowScale.cs +++ b/Items/HiveMind/TrueShadowScale.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.HiveMind { public class TrueShadowScale : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Shadow Scale"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Shadow Scale"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; - } - } + public override void SetDefaults() + { + item.width = 16; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 2; + } + } } diff --git a/Items/Leviathan/IOU.cs b/Items/Leviathan/IOU.cs index 03d15a1c68..d88de0363c 100644 --- a/Items/Leviathan/IOU.cs +++ b/Items/Leviathan/IOU.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Leviathan { public class IOU : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("IOU an item"); - Tooltip.SetDefault("Use to craft any Leviathan weapon you want\nCombine with Living Shards from Plantera to get your item!"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("IOU an item"); + Tooltip.SetDefault("Use to craft any Leviathan weapon you want\nCombine with Living Shards from Plantera to get your item!"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } } diff --git a/Items/Leviathan/LeviathanAmbergris.cs b/Items/Leviathan/LeviathanAmbergris.cs index b9fa064c34..fd353b8f3e 100644 --- a/Items/Leviathan/LeviathanAmbergris.cs +++ b/Items/Leviathan/LeviathanAmbergris.cs @@ -23,26 +23,26 @@ namespace CalamityMod.Items.Leviathan item.value = Item.buyPrice(0, 30, 0, 0); item.accessory = true; item.expert = true; - item.rare = 9; - } + item.rare = 9; + } public override void UpdateAccessory(Player player, bool hideVisual) { player.ignoreWater = true; - if (!player.lavaWet && !player.honeyWet) - { - if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.endurance += 0.05f; - player.allDamage += 0.05f; - } - else - { - player.allDamage += 0.1f; - player.statDefense += 20; - player.moveSpeed += 0.75f; - } - } + if (!player.lavaWet && !player.honeyWet) + { + if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.endurance += 0.05f; + player.allDamage += 0.05f; + } + else + { + player.allDamage += 0.1f; + player.statDefense += 20; + player.moveSpeed += 0.75f; + } + } if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) { if (player.whoAmI == Main.myPlayer) diff --git a/Items/Leviathan/LeviathanBag.cs b/Items/Leviathan/LeviathanBag.cs index 271db07c08..dd231699ed 100644 --- a/Items/Leviathan/LeviathanBag.cs +++ b/Items/Leviathan/LeviathanBag.cs @@ -1,69 +1,69 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; using CalamityMod.Utilities; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Leviathan { - public class LeviathanBag : ModItem - { - public override int BossBagNPC => mod.NPCType("Siren"); + public class LeviathanBag : ModItem + { + public override int BossBagNPC => mod.NPCType("Siren"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - // siren & levi are available PHM, so this check is necessary to keep vanilla consistency - if (Main.hardMode) - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + // siren & levi are available PHM, so this check is necessary to keep vanilla consistency + if (Main.hardMode) + player.TryGettingDevArmor(); - // Weapons - DropHelper.DropItemCondition(player, mod.ItemType("Greentide"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("Leviatitan"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("SirensSong"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("Atlantis"), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(player, mod.ItemType("BrackishFlask"), Main.hardMode, 3, 1, 1); + // Weapons + DropHelper.DropItemCondition(player, mod.ItemType("Greentide"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("Leviatitan"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("SirensSong"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("Atlantis"), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(player, mod.ItemType("BrackishFlask"), Main.hardMode, 3, 1, 1); - // Equipment - DropHelper.DropItemCondition(player, mod.ItemType("LeviathanAmbergris"), Main.hardMode); - DropHelper.DropItemCondition(player, mod.ItemType("LureofEnthrallment"), Main.hardMode, 3, 1, 1); - float communityChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("TheCommunity"), CalamityWorld.revenge, communityChance); + // Equipment + DropHelper.DropItemCondition(player, mod.ItemType("LeviathanAmbergris"), Main.hardMode); + DropHelper.DropItemCondition(player, mod.ItemType("LureofEnthrallment"), Main.hardMode, 3, 1, 1); + float communityChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("TheCommunity"), CalamityWorld.revenge, communityChance); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("LeviathanMask"), 7); + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("LeviathanMask"), 7); - // Fishing - DropHelper.DropItem(player, mod.ItemType("EnchantedPearl")); - DropHelper.DropItemChance(player, ItemID.HotlineFishingHook, 10); - DropHelper.DropItemChance(player, ItemID.BottomlessBucket, 10); - DropHelper.DropItemChance(player, ItemID.SuperAbsorbantSponge, 10); - DropHelper.DropItemChance(player, ItemID.FishingPotion, 5, 5, 8); - DropHelper.DropItemChance(player, ItemID.SonarPotion, 5, 5, 8); - DropHelper.DropItemChance(player, ItemID.CratePotion, 5, 5, 8); + // Fishing + DropHelper.DropItem(player, mod.ItemType("EnchantedPearl")); + DropHelper.DropItemChance(player, ItemID.HotlineFishingHook, 10); + DropHelper.DropItemChance(player, ItemID.BottomlessBucket, 10); + DropHelper.DropItemChance(player, ItemID.SuperAbsorbantSponge, 10); + DropHelper.DropItemChance(player, ItemID.FishingPotion, 5, 5, 8); + DropHelper.DropItemChance(player, ItemID.SonarPotion, 5, 5, 8); + DropHelper.DropItemChance(player, ItemID.CratePotion, 5, 5, 8); - // Other - DropHelper.DropItemCondition(player, mod.ItemType("IOU"), !Main.hardMode); - } - } + // Other + DropHelper.DropItemCondition(player, mod.ItemType("IOU"), !Main.hardMode); + } + } } diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index c181220180..e45c0a47d5 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeAquaticScourge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters.\n" + - "Place in your inventory to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff."); - } + "Place in your inventory to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aquaticScourgeLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.aquaticScourgeLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeAstralInfection.cs b/Items/LoreItems/KnowledgeAstralInfection.cs index ac4879d58d..5eaee112d1 100644 --- a/Items/LoreItems/KnowledgeAstralInfection.cs +++ b/Items/LoreItems/KnowledgeAstralInfection.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeAstralInfection : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Infection"); - Tooltip.SetDefault("This twisted dreamscape, surrounded by unnatural pillars under a dark and hazy sky.\n" + - "Natural law has been upturned. What will you make of it?"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Infection"); + Tooltip.SetDefault("This twisted dreamscape, surrounded by unnatural pillars under a dark and hazy sky.\n" + + "Natural law has been upturned. What will you make of it?"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index 01e19d6f54..cf8a3e79a6 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeAstrumAureus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus"); - Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus"); + Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + "The destruction of this creature will not prevent the spread of the disease.\n" + - "Place in your inventory to gain increased jump speed in space."); - } + "Place in your inventory to gain increased jump speed in space."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumAureusLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.astrumAureusLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index f1b3407f1a..6fefb097e3 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeAstrumDeus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + - "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + - "Place in your inventory to gain increased movement speed in space."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + + "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + + "Place in your inventory to gain increased movement speed in space."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumDeusLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.astrumDeusLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeBloodMoon.cs b/Items/LoreItems/KnowledgeBloodMoon.cs index fccb48555d..22ce1c12bc 100644 --- a/Items/LoreItems/KnowledgeBloodMoon.cs +++ b/Items/LoreItems/KnowledgeBloodMoon.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeBloodMoon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Red Moon"); - Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Red Moon"); + Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + "Many went mad, others died, but a scant few became blessed with a wealth of cosmic understanding."); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs index 07538f7459..49374458fc 100644 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ b/Items/LoreItems/KnowledgeBrainofCthulhu.cs @@ -1,83 +1,83 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeBrainofCthulhu : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Brain of Cthulhu"); - Tooltip.SetDefault("An eye and now a brain.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Brain of Cthulhu"); + Tooltip.SetDefault("An eye and now a brain.\n" + "Most likely another abomination spawned from this inchoate mass of flesh.\n" + - "Allows you to teleport similar to the Rod of Discord while in the crimson. Place in your hotbar to use it."); - } + "Allows you to teleport similar to the Rod of Discord while in the crimson. Place in your hotbar to use it."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.autoReuse = false; - item.useStyle = 1; - item.useAnimation = 20; - item.useTime = 20; - item.UseSound = SoundID.Item8; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.autoReuse = false; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.UseSound = SoundID.Item8; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return player.ZoneCrimson; - } + public override bool CanUseItem(Player player) + { + return player.ZoneCrimson; + } - public override bool UseItem(Player player) - { - if (Main.myPlayer == player.whoAmI && player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - Vector2 vector31; - vector31.X = (float)Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) - { - vector31.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; - } - else - { - vector31.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; - } - vector31.X -= (float)(player.width / 2); - if (vector31.X > 50f && vector31.X < (float)(Main.maxTilesX * 16 - 50) && vector31.Y > 50f && vector31.Y < (float)(Main.maxTilesY * 16 - 50)) - { - int num275 = (int)(vector31.X / 16f); - int num276 = (int)(vector31.Y / 16f); - if ((Main.tile[num275, num276].wall != 87 || (double)num276 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector31, player.width, player.height)) - { - player.Teleport(vector31, 1, 0); - NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, vector31.X, vector31.Y, 1, 0, 0); - if (player.chaosState) - { - player.statLife -= player.statLifeMax2 / 7; - PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13); - if (Main.rand.NextBool(2)) - { - damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); - } - if (player.statLife <= 0) - { - player.KillMe(damageSource, 1.0, 0, false); - } - player.lifeRegenCount = 0; - player.lifeRegenTime = 0; - } - player.AddBuff(BuffID.ChaosState, 480, true); - } - } - } - return true; - } - } + public override bool UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI && player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + Vector2 vector31; + vector31.X = (float)Main.mouseX + Main.screenPosition.X; + if (player.gravDir == 1f) + { + vector31.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; + } + else + { + vector31.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; + } + vector31.X -= (float)(player.width / 2); + if (vector31.X > 50f && vector31.X < (float)(Main.maxTilesX * 16 - 50) && vector31.Y > 50f && vector31.Y < (float)(Main.maxTilesY * 16 - 50)) + { + int num275 = (int)(vector31.X / 16f); + int num276 = (int)(vector31.Y / 16f); + if ((Main.tile[num275, num276].wall != 87 || (double)num276 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector31, player.width, player.height)) + { + player.Teleport(vector31, 1, 0); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, vector31.X, vector31.Y, 1, 0, 0); + if (player.chaosState) + { + player.statLife -= player.statLifeMax2 / 7; + PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13); + if (Main.rand.NextBool(2)) + { + damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); + } + if (player.statLife <= 0) + { + player.KillMe(damageSource, 1.0, 0, false); + } + player.lifeRegenCount = 0; + player.lifeRegenTime = 0; + } + player.AddBuff(BuffID.ChaosState, 480, true); + } + } + } + return true; + } + } } diff --git a/Items/LoreItems/KnowledgeBrimstoneCrag.cs b/Items/LoreItems/KnowledgeBrimstoneCrag.cs index eff6f87b0b..d11e610e99 100644 --- a/Items/LoreItems/KnowledgeBrimstoneCrag.cs +++ b/Items/LoreItems/KnowledgeBrimstoneCrag.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeBrimstoneCrag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Crag"); - Tooltip.SetDefault("Ah...this place.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Crag"); + Tooltip.SetDefault("Ah...this place.\n" + "The scent of broken promises, pain, and eventual death is heavy in the air..."); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index b9c3d7794b..a595f81907 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeBrimstoneElemental : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental"); + Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people.\n" + - "Place in your inventory to improve the inferno potion effect."); - } + "Place in your inventory to improve the inferno potion effect."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimstoneElementalLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.brimstoneElementalLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeBumblebirb.cs b/Items/LoreItems/KnowledgeBumblebirb.cs index c3d885cd4f..10fbe867f5 100644 --- a/Items/LoreItems/KnowledgeBumblebirb.cs +++ b/Items/LoreItems/KnowledgeBumblebirb.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeBumblebirb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Bumblebirbs"); - Tooltip.SetDefault("A failure of twisted scientific ambition; it appears our faulted arrogance over life has shown once more in the results.\n" + - "Originally intended to be a clone of the Jungle Dragon, these were left to roam about the jungle, attacking anything in their path."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Bumblebirbs"); + Tooltip.SetDefault("A failure of twisted scientific ambition; it appears our faulted arrogance over life has shown once more in the results.\n" + + "Originally intended to be a clone of the Jungle Dragon, these were left to roam about the jungle, attacking anything in their path."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 12; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index 0a45109fa7..75b5f5b71e 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -1,38 +1,38 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeCalamitas : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + - "Now that you have defeated her your destiny is clear.\n" + - "Come now, face me.\n" + - "Place in your inventory to die instantly from every hit."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas"); + Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + + "Now that you have defeated her your destiny is clear.\n" + + "Come now, face me.\n" + + "Place in your inventory to die instantly from every hit."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 15; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 15; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.SCalLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.SCalLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs index 53a674779d..fc43b17709 100644 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ b/Items/LoreItems/KnowledgeCalamitasClone.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeCalamitasClone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas Clone"); - Tooltip.SetDefault("You are indeed stronger than I thought.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Clone"); + Tooltip.SetDefault("You are indeed stronger than I thought.\n" + "Though the bloody inferno still lingers, observing your progress.\n" + - "Place in your inventory to gain a boost to your minion slots but at the cost of reduced max health."); - } + "Place in your inventory to gain a boost to your minion slots but at the cost of reduced max health."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.calamitasLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.calamitasLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeCorruption.cs b/Items/LoreItems/KnowledgeCorruption.cs index 7a06893ea1..eb56047040 100644 --- a/Items/LoreItems/KnowledgeCorruption.cs +++ b/Items/LoreItems/KnowledgeCorruption.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeCorruption : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Corruption"); - Tooltip.SetDefault("The rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + - "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Corruption"); + Tooltip.SetDefault("The rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + + "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index 0f44d46a80..6043363532 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeCrabulon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon"); - Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon"); + Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + "It's interesting how creatures can adapt given certain circumstances.\n" + - "Place in your inventory to gain the Mushy buff while underground or in the mushroom biome."); - } + "Place in your inventory to gain the Mushy buff while underground or in the mushroom biome."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (player.ZoneGlowshroom || player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) - { - if (Main.myPlayer == player.whoAmI) - { - player.AddBuff(mod.BuffType("Mushy"), 2); - } - } - } - } + public override void UpdateInventory(Player player) + { + if (player.ZoneGlowshroom || player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) + { + if (Main.myPlayer == player.whoAmI) + { + player.AddBuff(mod.BuffType("Mushy"), 2); + } + } + } + } } diff --git a/Items/LoreItems/KnowledgeCrimson.cs b/Items/LoreItems/KnowledgeCrimson.cs index d7af4cdc97..254cc9d79d 100644 --- a/Items/LoreItems/KnowledgeCrimson.cs +++ b/Items/LoreItems/KnowledgeCrimson.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeCrimson : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Crimson"); - Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Crimson"); + Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within."); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index 729591d34b..8aa9e40d34 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeCryogen : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen"); - Tooltip.SetDefault("The archmage's prison.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen"); + Tooltip.SetDefault("The archmage's prison.\n" + "I am unsure if it has grown weaker over the decades of imprisonment.\n" + - "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense."); - } + "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dashMod = 6; - player.statDefense -= 10; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dashMod = 6; + player.statDefense -= 10; + } + } } diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index c5be7ff32c..fbcf48a011 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -1,39 +1,38 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeDesertScourge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Desert Scourge"); - Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Desert Scourge"); + Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + "gluttonous husk, constantly on a voracious search for its next meal.\n" + - "Place in your inventory for an increase to defense while in the desert or sunken sea."); - } + "Place in your inventory for an increase to defense while in the desert or sunken sea."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 1; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 1; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (player.ZoneDesert || player.Calamity().ZoneSunkenSea) - { - player.Calamity().desertScourgeLore = true; - } - } - } + public override void UpdateInventory(Player player) + { + if (player.ZoneDesert || player.Calamity().ZoneSunkenSea) + { + player.Calamity().desertScourgeLore = true; + } + } + } } diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index a905af024a..5bbc3722d7 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeDestroyer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Destroyer"); - Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Destroyer"); + Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction.\n" + - "Place in your inventory to gain a boost to your pick speed."); - } + "Place in your inventory to gain a boost to your pick speed."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.destroyerLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.destroyerLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index 2611635260..18a9450582 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeDevourerofGods : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + - "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + - "Place in your inventory to boost your true melee damage by 50%."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + + "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + + "Place in your inventory to boost your true melee damage by 50%."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 13; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.DoGLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.DoGLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index f95a33522a..b7c7733953 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -1,39 +1,39 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeDukeFishron : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duke Fishron"); - Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duke Fishron"); + Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean.\n" + - "Place in your inventory for an increase to all damage, crit, and movement speed while submerged in liquid."); - } + "Place in your inventory for an increase to all damage, crit, and movement speed while submerged in liquid."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dukeFishronLore = true; - } - } - } + public override void UpdateInventory(Player player) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dukeFishronLore = true; + } + } + } } diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 87e74f0201..74312ef947 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeEaterofWorlds : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eater of Worlds"); - Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Eater of Worlds"); + Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + "Seems likely, given the origins of this place.\n" + - "Deadly microbes spawn around you while this is placed in your inventory."); - } + "Deadly microbes spawn around you while this is placed in your inventory."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eaterOfWorldsLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.eaterOfWorldsLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index 208484fbb7..6801620185 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -4,32 +4,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeEyeofCthulhu : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eye of Cthulhu"); - Tooltip.SetDefault("That eye...how peculiar.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Eye of Cthulhu"); + Tooltip.SetDefault("That eye...how peculiar.\n" + "I sensed it watching you more intensely as you grew stronger.\n" + - "Place in your inventory for night vision at night."); - } + "Place in your inventory for night vision at night."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 1; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 1; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (!Main.dayTime) - player.nightVision = true; - } - } + public override void UpdateInventory(Player player) + { + if (!Main.dayTime) + player.nightVision = true; + } + } } diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index e4c8ec5f12..09d9ab052b 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeGolem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golem"); - Tooltip.SetDefault("A primitive construct.\n" + - "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + - "Place in your inventory to gain increased defense while standing still."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Golem"); + Tooltip.SetDefault("A primitive construct.\n" + + "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + + "Place in your inventory to gain increased defense while standing still."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.golemLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.golemLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index 73b948fa79..09ffed6df9 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -1,39 +1,39 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeHiveMind : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Hive Mind"); + Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + "I do not believe killing it will lessen the corruption here.\n" + - "Place in your inventory for all of your projectiles to inflict cursed flames when in the corruption."); - } + "Place in your inventory for all of your projectiles to inflict cursed flames when in the corruption."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (player.ZoneCorrupt) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.hiveMindLore = true; - } - } - } + public override void UpdateInventory(Player player) + { + if (player.ZoneCorrupt) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.hiveMindLore = true; + } + } + } } diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index 84f6aa07c2..6730fa567a 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeLeviathanandSiren : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan and Siren"); - Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan and Siren"); + Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another.\n" + - "Place in your inventory to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb.\n" + - "Allows the young siren pet to move normally while outside of liquids."); - } + "Place in your inventory to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb.\n" + + "Allows the young siren pet to move normally while outside of liquids."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.leviathanAndSirenLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.leviathanAndSirenLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 6e1e6873d5..e3006a2d61 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -1,40 +1,40 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeLunaticCultist : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lunatic Cultist"); - Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lunatic Cultist"); + Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + "Your impending doom approaches...\n" + - "Place in your inventory for an increase to all stats during the lunar event."); - } + "Place in your inventory for an increase to all stats during the lunar event."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (NPC.LunarApocalypseIsUp) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.lunaticCultistLore = true; - } - } - } + public override void UpdateInventory(Player player) + { + if (NPC.LunarApocalypseIsUp) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.lunaticCultistLore = true; + } + } + } } diff --git a/Items/LoreItems/KnowledgeMechs.cs b/Items/LoreItems/KnowledgeMechs.cs index ea62b88c89..b561e362b7 100644 --- a/Items/LoreItems/KnowledgeMechs.cs +++ b/Items/LoreItems/KnowledgeMechs.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeMechs : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Mechanical Bosses"); - Tooltip.SetDefault("I see you have awakened Draedon's old toys.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Mechanical Bosses"); + Tooltip.SetDefault("I see you have awakened Draedon's old toys.\n" + "Once useful tools turned into savage beasts when their AIs went rogue, a mistake that Draedon failed to rectify in time."); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index 33c35b1db3..21e2a55dfd 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeMoonLord : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moon Lord"); - Tooltip.SetDefault("What a waste.\n" + - "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + - "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + - "Place in your inventory to gain an improved Gravity Globe that gives you an increase to all stats while upside down."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moon Lord"); + Tooltip.SetDefault("What a waste.\n" + + "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + + "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + + "Place in your inventory to gain an improved Gravity Globe that gives you an increase to all stats while upside down."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.moonLordLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.moonLordLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeOcean.cs b/Items/LoreItems/KnowledgeOcean.cs index cba7cf6970..dcd754f1fe 100644 --- a/Items/LoreItems/KnowledgeOcean.cs +++ b/Items/LoreItems/KnowledgeOcean.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeOcean : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Ocean"); - Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Ocean"); + Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + "You may awaken something more terrifying than death itself."); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index 3a558b115e..0bb9626c0b 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -1,39 +1,39 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgePerforators : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforators and their Hive"); - Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforators and their Hive"); + Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + "The chunks left over from the brain must have been absorbed by the crimson and reconstituted into it.\n" + - "Place in your inventory for all of your projectiles to inflict ichor when in the crimson."); - } + "Place in your inventory for all of your projectiles to inflict ichor when in the crimson."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (player.ZoneCrimson) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.perforatorLore = true; - } - } - } + public override void UpdateInventory(Player player) + { + if (player.ZoneCrimson) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.perforatorLore = true; + } + } + } } diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index e55e923644..4f643a914c 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgePlaguebringerGoliath : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Plaguebringer Goliath"); - Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + - "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + - "Place in your inventory to gain increased wing flight time but at the cost of reduced life regen."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Plaguebringer Goliath"); + Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + + "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + + "Place in your inventory to gain increased wing flight time but at the cost of reduced life regen."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.plaguebringerGoliathLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.plaguebringerGoliathLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index 574c564058..8440d64ae7 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgePlantera : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plantera"); - Tooltip.SetDefault("Well done, you killed a plant.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plantera"); + Tooltip.SetDefault("Well done, you killed a plant.\n" + "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + "I wish you luck in dealing with the fallout.\n" + - "Place in your inventory to gain a boost to your item grab range."); - } + "Place in your inventory to gain a boost to your item grab range."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 6; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 6; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.planteraLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.planteraLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index 78dbfd2c7f..d4c3f839d6 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgePolterghast : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast"); - Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + - "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + - "Place in your inventory to gain increased item grab range."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast"); + Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + + "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + + "Place in your inventory to gain increased item grab range."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 13; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.polterghastLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.polterghastLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeProfanedGuardians.cs b/Items/LoreItems/KnowledgeProfanedGuardians.cs index 27bbe91bce..10ed3d2c43 100644 --- a/Items/LoreItems/KnowledgeProfanedGuardians.cs +++ b/Items/LoreItems/KnowledgeProfanedGuardians.cs @@ -4,27 +4,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeProfanedGuardians : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Profaned Guardians"); - Tooltip.SetDefault("The ever-rejuvenating guardians of the profaned flame.\n" + - "Much like a phoenix from the ashes their deaths are simply a part of their life cycle.\n" + - "Many times my forces have had to destroy these beings in search of the Profaned Goddess."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Profaned Guardians"); + Tooltip.SetDefault("The ever-rejuvenating guardians of the profaned flame.\n" + + "Much like a phoenix from the ashes their deaths are simply a part of their life cycle.\n" + + "Many times my forces have had to destroy these beings in search of the Profaned Goddess."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 12; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 244993c56a..9dc04ae9ee 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeProvidence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence, the Profaned Goddess"); - Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + - "What would have become of us had she not been defeated is a frightening concept to consider.\n" + - "Place in your inventory to imbue all projectiles with profaned flames, causing them to inflict extra damage."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence, the Profaned Goddess"); + Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + + "What would have become of us had she not been defeated is a frightening concept to consider.\n" + + "Place in your inventory to imbue all projectiles with profaned flames, causing them to inflict extra damage."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 12; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.providenceLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.providenceLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index 11fa4f3295..023c7393f6 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -1,35 +1,35 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeQueenBee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Queen Bee"); - Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + - "Place in your inventory to make small bees and weak hornets friendly."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Queen Bee"); + Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + + "Place in your inventory to make small bees and weak hornets friendly."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.queenBeeLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.queenBeeLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index 1081c3ea05..2101321b24 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeRavager : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + - "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + - "Place in your inventory to gain an increase to all damage but reduced wing flight time."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + + "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + + "Place in your inventory to gain an increase to all damage but reduced wing flight time."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.ravagerLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.ravagerLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeSentinels.cs b/Items/LoreItems/KnowledgeSentinels.cs index 3490c851ab..1128bf0661 100644 --- a/Items/LoreItems/KnowledgeSentinels.cs +++ b/Items/LoreItems/KnowledgeSentinels.cs @@ -4,27 +4,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeSentinels : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Sentinels of the Devourer"); - Tooltip.SetDefault("Signus. The Void. The Weaver.\n" + - "Each represent one of the Devourer’s largest spheres of influence.\n" + - "Dispatching them has most likely invoked its anger and marked you as a target for destruction."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Sentinels of the Devourer"); + Tooltip.SetDefault("Signus. The Void. The Weaver.\n" + + "Each represent one of the Devourer’s largest spheres of influence.\n" + + "Dispatching them has most likely invoked its anger and marked you as a target for destruction."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 13; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index 395c115155..43e9dd86d3 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -1,39 +1,39 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeSkeletron : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron"); - Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skeletron"); + Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld.\n" + - "Place in your inventory to gain increased defense and damage while in the dungeon."); - } + "Place in your inventory to gain increased defense and damage while in the dungeon."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (player.ZoneDungeon) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.skeletronLore = true; - } - } - } + public override void UpdateInventory(Player player) + { + if (player.ZoneDungeon) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.skeletronLore = true; + } + } + } } diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index aaaeaf57aa..f54d487ee4 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -1,36 +1,36 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeSkeletronPrime : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron Prime"); - Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skeletron Prime"); + Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + "Draedon obviously took several liberties with its design...I am not impressed.\n" + - "Place in your inventory to gain a boost to your armor penetration."); - } + "Place in your inventory to gain a boost to your armor penetration."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.skeletronPrimeLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.skeletronPrimeLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index e1b51a5ee9..4b4345c78f 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeSlimeGod : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Slime God"); - Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Slime God"); + Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable.\n" + - "Place in your inventory to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + - "This effect makes dashing more difficult and does not work with mounts."); - } + "Place in your inventory to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + + "This effect makes dashing more difficult and does not work with mounts."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (player.mount.Active) - return; + public override void UpdateInventory(Player player) + { + if (player.mount.Active) + return; - if (player.dashDelay < 0) - player.velocity.X *= 0.9f; + if (player.dashDelay < 0) + player.velocity.X *= 0.9f; - player.slippy2 = true; + player.slippy2 = true; - if (Main.myPlayer == player.whoAmI) - player.AddBuff(BuffID.Slimed, 2); + if (Main.myPlayer == player.whoAmI) + player.AddBuff(BuffID.Slimed, 2); - player.statDefense -= 10; - } - } + player.statDefense -= 10; + } + } } diff --git a/Items/LoreItems/KnowledgeSulphurSea.cs b/Items/LoreItems/KnowledgeSulphurSea.cs index 987c9e3b7e..6d4fb7906d 100644 --- a/Items/LoreItems/KnowledgeSulphurSea.cs +++ b/Items/LoreItems/KnowledgeSulphurSea.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeSulphurSea : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sulphur Sea"); - Tooltip.SetDefault("I remember the serene waves and the clear breeze.\n" + - "The bitterness of my youth has long since subsided, but it is far too late. I must never repeat a mistake like this again."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphur Sea"); + Tooltip.SetDefault("I remember the serene waves and the clear breeze.\n" + + "The bitterness of my youth has long since subsided, but it is far too late. I must never repeat a mistake like this again."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index ee888bcdb7..aef608c9ef 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -4,34 +4,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeTwins : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Twins"); - Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Twins"); + Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + "These creatures did not belong in this world, it's best to be rid of them.\n" + - "Place in your inventory to gain invisibility at night."); - } + "Place in your inventory to gain invisibility at night."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - if (!Main.dayTime) - { - player.invis = true; - } - } - } + public override void UpdateInventory(Player player) + { + if (!Main.dayTime) + { + player.invis = true; + } + } + } } diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs index ae85a7efa2..cbd93f7dc3 100644 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ b/Items/LoreItems/KnowledgeUnderworld.cs @@ -4,25 +4,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { public class KnowledgeUnderworld : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Underworld"); - Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Underworld"); + Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + "Unfortunately for them, they were twisted by their inner demons until they were beyond saving."); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } - } + public override bool CanUseItem(Player player) + { + return false; + } + } } diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index 71468c9539..bd40e655af 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeWallofFlesh : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wall of Flesh"); - Tooltip.SetDefault("I see the deed is done.\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wall of Flesh"); + Tooltip.SetDefault("I see the deed is done.\n" + "The unholy amalgamation of flesh and hatred has been defeated.\n" + "Prepare to face the terrors that lurk in the light and dark parts of this world.\n" + - "Place in your inventory to gain increased item grab range."); - } + "Place in your inventory to gain increased item grab range."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.wallOfFleshLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.wallOfFleshLore = true; + } + } } diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index e1d91ef2b7..1464ff7657 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.LoreItems { public class KnowledgeYharon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jungle Dragon, Yharon"); - Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + - "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + - "Place in your inventory to gain nearly-infinite wing flight time but at the cost of a 25% decrease to all damage."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jungle Dragon, Yharon"); + Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + + "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + + "Place in your inventory to gain nearly-infinite wing flight time but at the cost of a 25% decrease to all damage."); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.consumable = false; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.Calamity().postMoonLordRarity = 14; + } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.yharonLore = true; - } - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.yharonLore = true; + } + } } diff --git a/Items/Materials/AerialiteBar.cs b/Items/Materials/AerialiteBar.cs index 365b558132..7cd4a245f6 100644 --- a/Items/Materials/AerialiteBar.cs +++ b/Items/Materials/AerialiteBar.cs @@ -5,28 +5,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class AerialiteBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerialite Bar"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerialite Bar"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; item.value = Item.sellPrice(silver: 30); - item.rare = 3; - } + item.rare = 3; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteOre", 4); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteOre", 4); + recipe.AddTile(TileID.Furnaces); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/AncientBoneDust.cs b/Items/Materials/AncientBoneDust.cs index 756ba2433f..25b75d6ca3 100644 --- a/Items/Materials/AncientBoneDust.cs +++ b/Items/Materials/AncientBoneDust.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 1); - item.rare = 1; + item.rare = 1; } } } diff --git a/Items/Materials/BarofLife.cs b/Items/Materials/BarofLife.cs index 84da96d71a..cc41c6b345 100644 --- a/Items/Materials/BarofLife.cs +++ b/Items/Materials/BarofLife.cs @@ -5,30 +5,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class BarofLife : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bar of Life"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bar of Life"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; item.value = Item.sellPrice(gold: 3); - item.rare = 8; - } + item.rare = 8; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar"); - recipe.AddIngredient(null, "DraedonBar"); - recipe.AddIngredient(null, "CruptixBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar"); + recipe.AddIngredient(null, "DraedonBar"); + recipe.AddIngredient(null, "CruptixBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/BeetleJuice.cs b/Items/Materials/BeetleJuice.cs index 64c76ed02c..8e66dd710a 100644 --- a/Items/Materials/BeetleJuice.cs +++ b/Items/Materials/BeetleJuice.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class BeetleJuice : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beetle Juice"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beetle Juice"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 16); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/BlightedLens.cs b/Items/Materials/BlightedLens.cs index 859b27f8e0..dd940f14b8 100644 --- a/Items/Materials/BlightedLens.cs +++ b/Items/Materials/BlightedLens.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class BlightedLens : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blighted Lens"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blighted Lens"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 22; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 16; + item.height = 22; + item.maxStack = 999; item.value = Item.sellPrice(silver: 56); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 3d8fa10e08..7bdcaee455 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Materials item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 1, copper: 20); - item.rare = 1; + item.rare = 1; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/BloodlettingEssence.cs b/Items/Materials/BloodlettingEssence.cs index 250ce84fe8..39efc7c864 100644 --- a/Items/Materials/BloodlettingEssence.cs +++ b/Items/Materials/BloodlettingEssence.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 1); - item.rare = 1; + item.rare = 1; } } } diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index 139d0ce17c..d8586e7e11 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 60); - item.rare = 10; - item.Calamity().postMoonLordRarity = 13; - } + item.rare = 10; + item.Calamity().postMoonLordRarity = 13; + } } } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index b280271bd6..e3461eb33a 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Materials item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; + item.rare = 10; item.value = Item.sellPrice(gold: 4); - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void AddRecipes() { diff --git a/Items/Materials/CalamitousEssence.cs b/Items/Materials/CalamitousEssence.cs index f5bad0a802..4c43d78363 100644 --- a/Items/Materials/CalamitousEssence.cs +++ b/Items/Materials/CalamitousEssence.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Items.Materials item.width = 10; item.height = 14; item.maxStack = 999; - item.rare = 10; + item.rare = 10; item.value = Item.sellPrice(gold: 24); - item.Calamity().postMoonLordRarity = 15; - } + item.Calamity().postMoonLordRarity = 15; + } } } diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index 12ca02301d..262518d64c 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -5,35 +5,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class CoreofCalamity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Calamity"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Calamity"); + } - public override void SetDefaults() - { - item.width = 40; - item.height = 40; - item.maxStack = 99; + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + item.maxStack = 99; item.value = Item.sellPrice(gold: 4); - item.rare = 8; - } + item.rare = 8; + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CoreofCinder", 3); - recipe.AddIngredient(null, "CoreofEleum", 3); - recipe.AddIngredient(null, "CoreofChaos", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CoreofCinder", 3); + recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.AddIngredient(null, "CoreofChaos", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/CoreofChaos.cs b/Items/Materials/CoreofChaos.cs index 911f431b80..2b9348c3ce 100644 --- a/Items/Materials/CoreofChaos.cs +++ b/Items/Materials/CoreofChaos.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class CoreofChaos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Chaos"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Chaos"); + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 8; - } + item.rare = 8; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos"); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/CoreofCinder.cs b/Items/Materials/CoreofCinder.cs index d174f179ec..e5dc7b72f3 100644 --- a/Items/Materials/CoreofCinder.cs +++ b/Items/Materials/CoreofCinder.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class CoreofCinder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Sunlight"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Sunlight"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 8; - } + item.rare = 8; + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/CoreofEleum.cs b/Items/Materials/CoreofEleum.cs index 6b2b18c741..d50eb6c17f 100644 --- a/Items/Materials/CoreofEleum.cs +++ b/Items/Materials/CoreofEleum.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class CoreofEleum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Eleum"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Eleum"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 8; - } + item.rare = 8; + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofEleum"); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofEleum"); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/CruptixBar.cs b/Items/Materials/CruptixBar.cs index c6d5125733..2313bd335e 100644 --- a/Items/Materials/CruptixBar.cs +++ b/Items/Materials/CruptixBar.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = 8; + item.rare = 8; } public override void AddRecipes() diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index 15d7f0b565..047f3a67d8 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class DarksunFragment : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Darksun Fragment"); - Tooltip.SetDefault("A shard of lunar and solar energy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Darksun Fragment"); + Tooltip.SetDefault("A shard of lunar and solar energy"); + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.5f * num, 0.5f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.5f * num, 0.5f * num); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.rare = 10; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.rare = 10; item.value = Item.sellPrice(gold: 12); - item.Calamity().postMoonLordRarity = 15; - } - } + item.Calamity().postMoonLordRarity = 15; + } + } } diff --git a/Items/Materials/DemonicBoneAsh.cs b/Items/Materials/DemonicBoneAsh.cs index 8be0eb6b9c..4cfc97b397 100644 --- a/Items/Materials/DemonicBoneAsh.cs +++ b/Items/Materials/DemonicBoneAsh.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class DemonicBoneAsh : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demonic Bone Ash"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonic Bone Ash"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 3; - } - } + item.rare = 3; + } + } } diff --git a/Items/Materials/DesertFeather.cs b/Items/Materials/DesertFeather.cs index b8d8b846b1..504cbcc9f4 100644 --- a/Items/Materials/DesertFeather.cs +++ b/Items/Materials/DesertFeather.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class DesertFeather : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Feather"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Feather"); + } - public override void SetDefaults() - { - item.width = 24; - item.height = 24; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 24; + item.height = 24; + item.maxStack = 999; item.value = Item.sellPrice(copper: 20); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/DraedonBar.cs b/Items/Materials/DraedonBar.cs index 38a5778068..165e49bdd0 100644 --- a/Items/Materials/DraedonBar.cs +++ b/Items/Materials/DraedonBar.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(gold: 1); - item.rare = 7; + item.rare = 7; } public override void AddRecipes() diff --git a/Items/Materials/EbonianGel.cs b/Items/Materials/EbonianGel.cs index 088720f92a..0c8676a2f5 100644 --- a/Items/Materials/EbonianGel.cs +++ b/Items/Materials/EbonianGel.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class EbonianGel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blighted Gel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blighted Gel"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 14; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 16; + item.height = 14; + item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/Ectoblood.cs b/Items/Materials/Ectoblood.cs index c4b40ba098..d4c7665ac7 100644 --- a/Items/Materials/Ectoblood.cs +++ b/Items/Materials/Ectoblood.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class Ectoblood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ectoblood"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ectoblood"); + } - public override void SetDefaults() - { - item.width = 24; - item.height = 32; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 24; + item.height = 32; + item.maxStack = 999; item.value = Item.sellPrice(silver: 16); - item.rare = 8; - } - } + item.rare = 8; + } + } } diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 6a8ef1147d..c38fed76c9 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class EndothermicEnergy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Endothermic Energy"); - Tooltip.SetDefault("Great for preventing heat stroke"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Endothermic Energy"); + Tooltip.SetDefault("Great for preventing heat stroke"); + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f, 0f, 1.2f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f, 0f, 1.2f * num); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.rare = 10; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.rare = 10; item.value = Item.sellPrice(gold: 2); - item.Calamity().postMoonLordRarity = 14; - } - } + item.Calamity().postMoonLordRarity = 14; + } + } } diff --git a/Items/Materials/EssenceofChaos.cs b/Items/Materials/EssenceofChaos.cs index cbf0dffaa5..f291c8d270 100644 --- a/Items/Materials/EssenceofChaos.cs +++ b/Items/Materials/EssenceofChaos.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class EssenceofChaos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Chaos"); - Tooltip.SetDefault("The essence of chaotic creatures"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Essence of Chaos"); + Tooltip.SetDefault("The essence of chaotic creatures"); + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/EssenceofCinder.cs b/Items/Materials/EssenceofCinder.cs index b7ea5725a4..10ca9fb959 100644 --- a/Items/Materials/EssenceofCinder.cs +++ b/Items/Materials/EssenceofCinder.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class EssenceofCinder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Sunlight"); - Tooltip.SetDefault("The essence of sky, light, and storm creatures"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Essence of Sunlight"); + Tooltip.SetDefault("The essence of sky, light, and storm creatures"); + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); + } - public override void SetDefaults() - { - item.width = 8; - item.height = 22; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 8; + item.height = 22; + item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/EssenceofEleum.cs b/Items/Materials/EssenceofEleum.cs index 70cbd8973c..55fcd2e1f2 100644 --- a/Items/Materials/EssenceofEleum.cs +++ b/Items/Materials/EssenceofEleum.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class EssenceofEleum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Eleum"); - Tooltip.SetDefault("The essence of cold creatures"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Essence of Eleum"); + Tooltip.SetDefault("The essence of cold creatures"); + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); + } - public override void SetDefaults() - { - item.width = 8; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 8; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/FetidEssence.cs b/Items/Materials/FetidEssence.cs index 4743b1253d..a589911a05 100644 --- a/Items/Materials/FetidEssence.cs +++ b/Items/Materials/FetidEssence.cs @@ -5,20 +5,20 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class FetidEssence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fetid Essence"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fetid Essence"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 1); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs index 4114beef10..a5440be669 100644 --- a/Items/Materials/GalacticaSingularity.cs +++ b/Items/Materials/GalacticaSingularity.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 96); - item.rare = 10; + item.rare = 10; } public override void AddRecipes() diff --git a/Items/Materials/GypsyPowder.cs b/Items/Materials/GypsyPowder.cs index 221fea5ce2..8163113127 100644 --- a/Items/Materials/GypsyPowder.cs +++ b/Items/Materials/GypsyPowder.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class GypsyPowder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gypsy Powder"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gypsy Powder"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 30); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/HadarianMembrane.cs b/Items/Materials/HadarianMembrane.cs index b4e29465a3..cda17a6504 100644 --- a/Items/Materials/HadarianMembrane.cs +++ b/Items/Materials/HadarianMembrane.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 22; item.maxStack = 999; item.value = Item.sellPrice(silver: 50); - item.rare = 7; + item.rare = 7; } } } diff --git a/Items/Materials/HellcasterFragment.cs b/Items/Materials/HellcasterFragment.cs index cb4ded03bd..40bf9019ec 100644 --- a/Items/Materials/HellcasterFragment.cs +++ b/Items/Materials/HellcasterFragment.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Materials item.height = 14; item.maxStack = 999; item.value = Item.sellPrice(gold: 16); - item.Calamity().postMoonLordRarity = 20; - } + item.Calamity().postMoonLordRarity = 20; + } } } diff --git a/Items/Materials/LivingShard.cs b/Items/Materials/LivingShard.cs index 5cea3704c6..cb951d8ed8 100644 --- a/Items/Materials/LivingShard.cs +++ b/Items/Materials/LivingShard.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class LivingShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Living Shard"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Living Shard"); + } - public override void SetDefaults() - { - item.width = 14; - item.height = 14; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 14; + item.height = 14; + item.maxStack = 999; item.value = Item.sellPrice(silver: 80); - item.rare = 7; - } - } + item.rare = 7; + } + } } diff --git a/Items/Materials/Lumenite.cs b/Items/Materials/Lumenite.cs index 83919e3289..e4e6987658 100644 --- a/Items/Materials/Lumenite.cs +++ b/Items/Materials/Lumenite.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Materials item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 36); - item.rare = 3; + item.rare = 3; } } } diff --git a/Items/Materials/ManeaterBulb.cs b/Items/Materials/ManeaterBulb.cs index 8b8cdc7483..eed1f7ade4 100644 --- a/Items/Materials/ManeaterBulb.cs +++ b/Items/Materials/ManeaterBulb.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class ManeaterBulb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Maneater Bulb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Maneater Bulb"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 2); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/MeldBlob.cs b/Items/Materials/MeldBlob.cs index 89ec3a0962..678c68f4bd 100644 --- a/Items/Materials/MeldBlob.cs +++ b/Items/Materials/MeldBlob.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class MeldBlob : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meld Blob"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meld Blob"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 14; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 16; + item.height = 14; + item.maxStack = 999; item.value = Item.sellPrice(silver: 20); - item.rare = 9; - } - } + item.rare = 9; + } + } } diff --git a/Items/Materials/MeldiateBar.cs b/Items/Materials/MeldiateBar.cs index 38d5240937..742af80dbf 100644 --- a/Items/Materials/MeldiateBar.cs +++ b/Items/Materials/MeldiateBar.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 12; item.maxStack = 999; item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = 9; + item.rare = 9; } public override void AddRecipes() diff --git a/Items/Materials/MurkyPaste.cs b/Items/Materials/MurkyPaste.cs index 511942a1a2..314eba74eb 100644 --- a/Items/Materials/MurkyPaste.cs +++ b/Items/Materials/MurkyPaste.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class MurkyPaste : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Murky Paste"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murky Paste"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 2); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/MurkySludge.cs b/Items/Materials/MurkySludge.cs index 35057731e4..e9a67e2ce7 100644 --- a/Items/Materials/MurkySludge.cs +++ b/Items/Materials/MurkySludge.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class MurkySludge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Murky Sludge"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murky Sludge"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 1); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 6979da451e..6e8f2fb1f3 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class NightmareFuel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nightmare Fuel"); - Tooltip.SetDefault("May drain your sanity"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nightmare Fuel"); + Tooltip.SetDefault("May drain your sanity"); + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.7f * num, 0.7f * num, 0f); - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.7f * num, 0.7f * num, 0f); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.rare = 10; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.rare = 10; item.value = Item.sellPrice(gold: 2); - item.Calamity().postMoonLordRarity = 14; - } - } + item.Calamity().postMoonLordRarity = 14; + } + } } diff --git a/Items/Materials/Phantoplasm.cs b/Items/Materials/Phantoplasm.cs index 2d8ca85228..578c39fe7a 100644 --- a/Items/Materials/Phantoplasm.cs +++ b/Items/Materials/Phantoplasm.cs @@ -6,26 +6,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class Phantoplasm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantoplasm"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantoplasm"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.rare = 10; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.rare = 10; item.value = Item.sellPrice(gold: 1); - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 0); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 0); + } + } } diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 28e55c4df4..3067f97c5e 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Materials item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; + item.rare = 10; item.value = Item.sellPrice(gold: 27, silver: 50); - item.Calamity().postMoonLordRarity = 15; - } + item.Calamity().postMoonLordRarity = 15; + } public override void AddRecipes() { diff --git a/Items/Materials/Stardust.cs b/Items/Materials/Stardust.cs index c4b36d6483..88b9a1cec7 100644 --- a/Items/Materials/Stardust.cs +++ b/Items/Materials/Stardust.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class Stardust : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stardust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stardust"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 18; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 26; + item.height = 18; + item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/StormlionMandible.cs b/Items/Materials/StormlionMandible.cs index e7d32c73a7..f310a98d56 100644 --- a/Items/Materials/StormlionMandible.cs +++ b/Items/Materials/StormlionMandible.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class StormlionMandible : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stormlion Mandible"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stormlion Mandible"); + } - public override void SetDefaults() - { - item.width = 12; - item.height = 24; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 12; + item.height = 24; + item.maxStack = 999; item.value = Item.sellPrice(silver: 1, copper: 40); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/TrapperBulb.cs b/Items/Materials/TrapperBulb.cs index 289b5eeef9..9cb6a69b38 100644 --- a/Items/Materials/TrapperBulb.cs +++ b/Items/Materials/TrapperBulb.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class TrapperBulb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trapper Bulb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trapper Bulb"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; item.value = Item.sellPrice(silver: 16); - item.rare = 5; - } - } + item.rare = 5; + } + } } diff --git a/Items/Materials/UeliaceBar.cs b/Items/Materials/UeliaceBar.cs index cd59823024..fee38fab57 100644 --- a/Items/Materials/UeliaceBar.cs +++ b/Items/Materials/UeliaceBar.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Materials item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; + item.rare = 10; item.value = Item.sellPrice(gold: 3); - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index 875853ebf6..57ca02056d 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 12; item.maxStack = 999; item.value = Item.sellPrice(silver: 80); - item.rare = 6; + item.rare = 6; } public override void AddRecipes() diff --git a/Items/Materials/VerstaltiteBar.cs b/Items/Materials/VerstaltiteBar.cs index 54f400200f..1ad90631d9 100644 --- a/Items/Materials/VerstaltiteBar.cs +++ b/Items/Materials/VerstaltiteBar.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(silver: 60); - item.rare = 5; + item.rare = 5; } public override void AddRecipes() diff --git a/Items/Materials/VictideBar.cs b/Items/Materials/VictideBar.cs index 748fe30cbc..8091626c7a 100644 --- a/Items/Materials/VictideBar.cs +++ b/Items/Materials/VictideBar.cs @@ -5,31 +5,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class VictideBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Bar"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Bar"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 2; - } + item.rare = 2; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictoryShard"); - recipe.AddIngredient(ItemID.Coral); - recipe.AddIngredient(ItemID.Starfish); - recipe.AddIngredient(ItemID.Seashell); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictoryShard"); + recipe.AddIngredient(ItemID.Coral); + recipe.AddIngredient(ItemID.Starfish); + recipe.AddIngredient(ItemID.Seashell); + recipe.AddTile(TileID.Furnaces); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/VictoryShard.cs b/Items/Materials/VictoryShard.cs index 5c02f27b41..9ed0b2932d 100644 --- a/Items/Materials/VictoryShard.cs +++ b/Items/Materials/VictoryShard.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class VictoryShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victory Shard"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victory Shard"); + } - public override void SetDefaults() - { - item.width = 14; - item.height = 14; - item.maxStack = 999; + public override void SetDefaults() + { + item.width = 14; + item.height = 14; + item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 1; - } - } + item.rare = 1; + } + } } diff --git a/Items/Materials/WulfrumShard.cs b/Items/Materials/WulfrumShard.cs index 1038a56e3b..112239b7d8 100644 --- a/Items/Materials/WulfrumShard.cs +++ b/Items/Materials/WulfrumShard.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Materials item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(copper: 80); - item.rare = 1; + item.rare = 1; } } } diff --git a/Items/Mounts/AngryDog.cs b/Items/Mounts/AngryDog.cs index 386bc8890c..b4476d713c 100644 --- a/Items/Mounts/AngryDog.cs +++ b/Items/Mounts/AngryDog.cs @@ -1,125 +1,125 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; +using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { class AngryDog : ModMountData - { - public override void SetDefaults() - { - mountData.spawnDust = 192; - mountData.spawnDustNoGravity = true; - mountData.buff = mod.BuffType("TundraLeashBuff"); - mountData.heightBoost = 36; //8 - mountData.fallDamage = 0.3f; - mountData.runSpeed = 6.5f; - mountData.flightTimeMax = 0; - mountData.jumpHeight = 16; - mountData.acceleration = 0.21f; - mountData.jumpSpeed = 7f; - mountData.swimSpeed = 3f; - mountData.totalFrames = 13; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - array[l] = 28; - } - array[1] = 26; - array[4] = 26; - array[7] = 26; - array[10] = 26; - mountData.playerYOffsets = array; - mountData.xOffset = -6; - mountData.bodyFrame = 3; - mountData.yOffset = 15; //done - mountData.playerHeadOffset = 38; - mountData.standingFrameCount = 6; - mountData.standingFrameDelay = 12; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = mountData.standingFrameCount; - mountData.runningFrameDelay = 36; //36 - mountData.runningFrameStart = mountData.standingFrameCount; - mountData.inAirFrameCount = 1; - mountData.inAirFrameDelay = mountData.standingFrameDelay; - mountData.inAirFrameStart = mountData.standingFrameDelay; - mountData.idleFrameCount = mountData.standingFrameCount; //done - mountData.idleFrameDelay = mountData.standingFrameDelay; //done - mountData.idleFrameStart = mountData.standingFrameStart; - mountData.idleFrameLoop = true; - mountData.swimFrameCount = mountData.inAirFrameCount; - mountData.swimFrameDelay = mountData.inAirFrameDelay; - mountData.swimFrameStart = mountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) - { - mountData.textureWidth = mountData.backTexture.Width; - mountData.textureHeight = mountData.backTexture.Height; - } - } + { + public override void SetDefaults() + { + mountData.spawnDust = 192; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("TundraLeashBuff"); + mountData.heightBoost = 36; //8 + mountData.fallDamage = 0.3f; + mountData.runSpeed = 6.5f; + mountData.flightTimeMax = 0; + mountData.jumpHeight = 16; + mountData.acceleration = 0.21f; + mountData.jumpSpeed = 7f; + mountData.swimSpeed = 3f; + mountData.totalFrames = 13; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 28; + } + array[1] = 26; + array[4] = 26; + array[7] = 26; + array[10] = 26; + mountData.playerYOffsets = array; + mountData.xOffset = -6; + mountData.bodyFrame = 3; + mountData.yOffset = 15; //done + mountData.playerHeadOffset = 38; + mountData.standingFrameCount = 6; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = mountData.standingFrameCount; + mountData.runningFrameDelay = 36; //36 + mountData.runningFrameStart = mountData.standingFrameCount; + mountData.inAirFrameCount = 1; + mountData.inAirFrameDelay = mountData.standingFrameDelay; + mountData.inAirFrameStart = mountData.standingFrameDelay; + mountData.idleFrameCount = mountData.standingFrameCount; //done + mountData.idleFrameDelay = mountData.standingFrameDelay; //done + mountData.idleFrameStart = mountData.standingFrameStart; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != NetmodeID.Server) + { + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } - public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) - { - bool speed = Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed / 2f; - float num10 = (float)Math.Sign(mountedPlayer.velocity.X); - float num11 = 12f; - float num12 = 40f; - if (!speed) - { - mountedPlayer.basiliskCharge = 0f; - } - else - { - mountedPlayer.basiliskCharge = Utils.Clamp(mountedPlayer.basiliskCharge + 0.00555555569f, 0f, 1f); - } - if ((double)mountedPlayer.position.Y > Main.worldSurface * 16.0 + 160.0) - { - Lighting.AddLight(mountedPlayer.Center, 0.2f, 0.25f, 0.25f); - } - if (speed && velocity.Y == 0f) - { - for (int i = 0; i < 2; i++) - { - Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default, 1f)]; - expr_631.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); - expr_631.noLight = true; - expr_631.scale = 0.2f + Main.rand.NextFloat() * 0.8f; - expr_631.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; - expr_631.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); - } - if (mountedPlayer.cMount == 0) - { - mountedPlayer.position += new Vector2(num10 * 24f, 0f); - mountedPlayer.FloorVisuals(true); - mountedPlayer.position -= new Vector2(num10 * 24f, 0f); - } - } - if (num10 == (float)mountedPlayer.direction) - { - for (int j = 0; j < (int)(3f * mountedPlayer.basiliskCharge); j++) - { - Dust dust = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 67, 0f, 0f, 0, default, 1f)]; - Vector2 value2 = mountedPlayer.Center + new Vector2(num10 * num12, num11); - dust.position = mountedPlayer.Center + new Vector2(num10 * (num12 - 2f), num11 - 6f + Main.rand.NextFloat() * 12f); - dust.velocity = (dust.position - value2).SafeNormalize(Vector2.Zero) * (3.5f + Main.rand.NextFloat() * 0.5f); - if (dust.velocity.Y < 0f) - { - Dust expr_808_cp_0_cp_0 = dust; - expr_808_cp_0_cp_0.velocity.Y *= (1f + 2f * Main.rand.NextFloat()); - } - dust.velocity += mountedPlayer.velocity * 0.55f; - dust.velocity *= mountedPlayer.velocity.Length() / mountedPlayer.mount.RunSpeed; - dust.velocity *= mountedPlayer.basiliskCharge; - dust.noGravity = true; - dust.noLight = true; - dust.scale = 0.2f + Main.rand.NextFloat() * 0.8f; - dust.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; - dust.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); - } - } - return true; - } - } + public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) + { + bool speed = Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed / 2f; + float num10 = (float)Math.Sign(mountedPlayer.velocity.X); + float num11 = 12f; + float num12 = 40f; + if (!speed) + { + mountedPlayer.basiliskCharge = 0f; + } + else + { + mountedPlayer.basiliskCharge = Utils.Clamp(mountedPlayer.basiliskCharge + 0.00555555569f, 0f, 1f); + } + if ((double)mountedPlayer.position.Y > Main.worldSurface * 16.0 + 160.0) + { + Lighting.AddLight(mountedPlayer.Center, 0.2f, 0.25f, 0.25f); + } + if (speed && velocity.Y == 0f) + { + for (int i = 0; i < 2; i++) + { + Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default, 1f)]; + expr_631.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); + expr_631.noLight = true; + expr_631.scale = 0.2f + Main.rand.NextFloat() * 0.8f; + expr_631.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; + expr_631.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + if (mountedPlayer.cMount == 0) + { + mountedPlayer.position += new Vector2(num10 * 24f, 0f); + mountedPlayer.FloorVisuals(true); + mountedPlayer.position -= new Vector2(num10 * 24f, 0f); + } + } + if (num10 == (float)mountedPlayer.direction) + { + for (int j = 0; j < (int)(3f * mountedPlayer.basiliskCharge); j++) + { + Dust dust = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 67, 0f, 0f, 0, default, 1f)]; + Vector2 value2 = mountedPlayer.Center + new Vector2(num10 * num12, num11); + dust.position = mountedPlayer.Center + new Vector2(num10 * (num12 - 2f), num11 - 6f + Main.rand.NextFloat() * 12f); + dust.velocity = (dust.position - value2).SafeNormalize(Vector2.Zero) * (3.5f + Main.rand.NextFloat() * 0.5f); + if (dust.velocity.Y < 0f) + { + Dust expr_808_cp_0_cp_0 = dust; + expr_808_cp_0_cp_0.velocity.Y *= (1f + 2f * Main.rand.NextFloat()); + } + dust.velocity += mountedPlayer.velocity * 0.55f; + dust.velocity *= mountedPlayer.velocity.Length() / mountedPlayer.mount.RunSpeed; + dust.velocity *= mountedPlayer.basiliskCharge; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 0.2f + Main.rand.NextFloat() * 0.8f; + dust.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; + dust.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + } + return true; + } + } } diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index 115c2b54eb..ef8ee4127d 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = 1; - item.value = Item.buyPrice(1, 50, 0, 0); - item.rare = 9; - item.expert = true; + item.value = Item.buyPrice(1, 50, 0, 0); + item.rare = 9; + item.expert = true; item.UseSound = SoundID.Item3; item.noMelee = true; item.mountType = mod.MountType("PhuppersChair"); diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index 0480075b2a..92eb7ce861 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -1,119 +1,119 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { class Crysthamyr : ModMountData - { - public override void SetDefaults() - { - mountData.spawnDust = 173; - mountData.spawnDustNoGravity = true; - mountData.buff = mod.BuffType("GazeOfCrysthamyrBuff"); - mountData.heightBoost = 36; - mountData.fallDamage = 0f; - mountData.runSpeed = 5f; - mountData.dashSpeed = 15f; - mountData.flightTimeMax = 750; - mountData.fatigueMax = 0; - mountData.jumpHeight = 12; - mountData.acceleration = 0.6f; - mountData.jumpSpeed = 9f; - mountData.swimSpeed = 6f; - mountData.blockExtraJumps = true; - mountData.totalFrames = 16; - mountData.constantJump = false; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - array[l] = 30; - } - array[1] = 28; - array[5] = 40; - array[6] = 40; - array[7] = 40; - array[8] = 38; //wing flap sound - array[9] = 40; - array[10] = 40; - array[12] = 28; - array[14] = 28; - mountData.playerYOffsets = array; - mountData.xOffset = -56; - mountData.bodyFrame = 3; - mountData.yOffset = -20; //done - mountData.playerHeadOffset = 38; //30 - mountData.standingFrameCount = 5; - mountData.standingFrameDelay = 12; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = mountData.standingFrameCount; - mountData.runningFrameDelay = 48; //36 - mountData.runningFrameStart = 11; - mountData.flyingFrameCount = 6; - mountData.flyingFrameDelay = mountData.flyingFrameCount; - mountData.flyingFrameStart = mountData.standingFrameCount; - mountData.inAirFrameCount = mountData.flyingFrameCount; - mountData.inAirFrameDelay = mountData.standingFrameDelay; - mountData.inAirFrameStart = mountData.standingFrameCount; - mountData.idleFrameCount = mountData.standingFrameCount; //done - mountData.idleFrameDelay = mountData.standingFrameDelay; //done - mountData.idleFrameStart = mountData.standingFrameStart; - mountData.idleFrameLoop = true; - mountData.swimFrameCount = mountData.inAirFrameCount; - mountData.swimFrameDelay = mountData.runningFrameDelay; - mountData.swimFrameStart = mountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) - { - mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/CrysthamyrExtra"); - mountData.textureWidth = mountData.backTexture.Width; - mountData.textureHeight = mountData.backTexture.Height; - } - } + { + public override void SetDefaults() + { + mountData.spawnDust = 173; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("GazeOfCrysthamyrBuff"); + mountData.heightBoost = 36; + mountData.fallDamage = 0f; + mountData.runSpeed = 5f; + mountData.dashSpeed = 15f; + mountData.flightTimeMax = 750; + mountData.fatigueMax = 0; + mountData.jumpHeight = 12; + mountData.acceleration = 0.6f; + mountData.jumpSpeed = 9f; + mountData.swimSpeed = 6f; + mountData.blockExtraJumps = true; + mountData.totalFrames = 16; + mountData.constantJump = false; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 30; + } + array[1] = 28; + array[5] = 40; + array[6] = 40; + array[7] = 40; + array[8] = 38; //wing flap sound + array[9] = 40; + array[10] = 40; + array[12] = 28; + array[14] = 28; + mountData.playerYOffsets = array; + mountData.xOffset = -56; + mountData.bodyFrame = 3; + mountData.yOffset = -20; //done + mountData.playerHeadOffset = 38; //30 + mountData.standingFrameCount = 5; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = mountData.standingFrameCount; + mountData.runningFrameDelay = 48; //36 + mountData.runningFrameStart = 11; + mountData.flyingFrameCount = 6; + mountData.flyingFrameDelay = mountData.flyingFrameCount; + mountData.flyingFrameStart = mountData.standingFrameCount; + mountData.inAirFrameCount = mountData.flyingFrameCount; + mountData.inAirFrameDelay = mountData.standingFrameDelay; + mountData.inAirFrameStart = mountData.standingFrameCount; + mountData.idleFrameCount = mountData.standingFrameCount; //done + mountData.idleFrameDelay = mountData.standingFrameDelay; //done + mountData.idleFrameStart = mountData.standingFrameStart; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.runningFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != NetmodeID.Server) + { + mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/CrysthamyrExtra"); + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } - public override void UpdateEffects(Player player) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 0f, 1f); - if (Math.Abs(player.velocity.X) > 6f || Math.Abs(player.velocity.Y) > 6f) - { - int rand = Main.rand.Next(3); - switch (rand) - { - case 0: - rand = 173; - break; - case 1: - rand = 109; - break; - case 2: - rand = 70; - break; - } - Rectangle rect = player.getRect(); - rect.Inflate(50, 20); - if (Math.Abs(player.velocity.X) > 14f || Math.Abs(player.velocity.Y) > 14f) - { - for (int i = 0; i < 2; i++) - { - int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, rand, 0, 0, 0, default); - Main.dust[dust].noGravity = true; - } - } - int dust2 = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, rand, 0, 0, 0, default); - Main.dust[dust2].noGravity = true; - } - if (player.velocity.Y != 0f) - { - if (player.mount.PlayerOffset == 38) - { - if (!player.flapSound) - Main.PlaySound(SoundID.Item32, player.position); - player.flapSound = true; - } - else - player.flapSound = false; - } - } - } + public override void UpdateEffects(Player player) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 0f, 1f); + if (Math.Abs(player.velocity.X) > 6f || Math.Abs(player.velocity.Y) > 6f) + { + int rand = Main.rand.Next(3); + switch (rand) + { + case 0: + rand = 173; + break; + case 1: + rand = 109; + break; + case 2: + rand = 70; + break; + } + Rectangle rect = player.getRect(); + rect.Inflate(50, 20); + if (Math.Abs(player.velocity.X) > 14f || Math.Abs(player.velocity.Y) > 14f) + { + for (int i = 0; i < 2; i++) + { + int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, rand, 0, 0, 0, default); + Main.dust[dust].noGravity = true; + } + } + int dust2 = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, rand, 0, 0, 0, default); + Main.dust[dust2].noGravity = true; + } + if (player.velocity.Y != 0f) + { + if (player.mount.PlayerOffset == 38) + { + if (!player.flapSound) + Main.PlaySound(SoundID.Item32, player.position); + player.flapSound = true; + } + else + player.flapSound = false; + } + } + } } diff --git a/Items/Mounts/Fab.cs b/Items/Mounts/Fab.cs index 95b8b53c18..dac95caedd 100644 --- a/Items/Mounts/Fab.cs +++ b/Items/Mounts/Fab.cs @@ -1,113 +1,113 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using System; -using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { class Fab : ModMountData - { - public override void SetDefaults() - { - mountData.spawnDust = 234; - mountData.spawnDustNoGravity = true; - mountData.buff = mod.BuffType("Fab"); - mountData.heightBoost = 34; - mountData.fallDamage = 0f; //0.5 - mountData.runSpeed = 7f; //12 - mountData.dashSpeed = 21f; //8 - mountData.flightTimeMax = 500; - mountData.fatigueMax = 0; - mountData.jumpHeight = 12; - mountData.acceleration = 0.45f; - mountData.jumpSpeed = 8f; //10 - mountData.swimSpeed = 4f; - mountData.blockExtraJumps = false; - mountData.totalFrames = 15; - mountData.constantJump = false; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - array[l] = 30; - } - array[1] = 28; - array[3] = 28; - array[5] = 28; - array[7] = 28; - array[12] = 28; - mountData.playerYOffsets = array; - mountData.xOffset = 0; - mountData.bodyFrame = 3; - mountData.yOffset = 7; //-8 - mountData.playerHeadOffset = 36; //30 - mountData.standingFrameCount = 1; - mountData.standingFrameDelay = 12; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = 8; //7 - mountData.runningFrameDelay = 36; //36 - mountData.runningFrameStart = 1; //9 - mountData.flyingFrameCount = 6; //0 - mountData.flyingFrameDelay = 4; //0 - mountData.flyingFrameStart = 9; //0 - mountData.inAirFrameCount = 1; //1 - mountData.inAirFrameDelay = 12; //12 - mountData.inAirFrameStart = 10; //10 - mountData.idleFrameCount = 5; //4 - mountData.idleFrameDelay = 12; //12 - mountData.idleFrameStart = 0; - mountData.idleFrameLoop = true; - mountData.swimFrameCount = mountData.inAirFrameCount; - mountData.swimFrameDelay = mountData.inAirFrameDelay; - mountData.swimFrameStart = mountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) - { - mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/FabExtra"); - mountData.textureWidth = mountData.backTexture.Width; - mountData.textureHeight = mountData.backTexture.Height; - } - } + { + public override void SetDefaults() + { + mountData.spawnDust = 234; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("Fab"); + mountData.heightBoost = 34; + mountData.fallDamage = 0f; //0.5 + mountData.runSpeed = 7f; //12 + mountData.dashSpeed = 21f; //8 + mountData.flightTimeMax = 500; + mountData.fatigueMax = 0; + mountData.jumpHeight = 12; + mountData.acceleration = 0.45f; + mountData.jumpSpeed = 8f; //10 + mountData.swimSpeed = 4f; + mountData.blockExtraJumps = false; + mountData.totalFrames = 15; + mountData.constantJump = false; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 30; + } + array[1] = 28; + array[3] = 28; + array[5] = 28; + array[7] = 28; + array[12] = 28; + mountData.playerYOffsets = array; + mountData.xOffset = 0; + mountData.bodyFrame = 3; + mountData.yOffset = 7; //-8 + mountData.playerHeadOffset = 36; //30 + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 8; //7 + mountData.runningFrameDelay = 36; //36 + mountData.runningFrameStart = 1; //9 + mountData.flyingFrameCount = 6; //0 + mountData.flyingFrameDelay = 4; //0 + mountData.flyingFrameStart = 9; //0 + mountData.inAirFrameCount = 1; //1 + mountData.inAirFrameDelay = 12; //12 + mountData.inAirFrameStart = 10; //10 + mountData.idleFrameCount = 5; //4 + mountData.idleFrameDelay = 12; //12 + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != NetmodeID.Server) + { + mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/FabExtra"); + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } - public override void UpdateEffects(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.fabsolVodka) - { - player.allDamage += 0.1f; - } - if (Math.Abs(player.velocity.X) > 12f || Math.Abs(player.velocity.Y) > 12f) - { - int rand = Main.rand.Next(2); - bool momo = false; - if (rand == 1) - { - momo = true; - } - Color meme; - if (momo) - { - meme = new Color(255, 68, 242); - } - else - { - meme = new Color(25, 105, 255); - } - Rectangle rect = player.getRect(); - int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); - Main.dust[dust].noGravity = true; - } - if (player.velocity.Y != 0f) - { - if (player.mount.PlayerOffset == 28) - { - if (!player.flapSound) - Main.PlaySound(SoundID.Item32, player.position); - player.flapSound = true; - } - else - player.flapSound = false; - } - } - } + public override void UpdateEffects(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.fabsolVodka) + { + player.allDamage += 0.1f; + } + if (Math.Abs(player.velocity.X) > 12f || Math.Abs(player.velocity.Y) > 12f) + { + int rand = Main.rand.Next(2); + bool momo = false; + if (rand == 1) + { + momo = true; + } + Color meme; + if (momo) + { + meme = new Color(255, 68, 242); + } + else + { + meme = new Color(25, 105, 255); + } + Rectangle rect = player.getRect(); + int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); + Main.dust[dust].noGravity = true; + } + if (player.velocity.Y != 0f) + { + if (player.mount.PlayerOffset == 28) + { + if (!player.flapSound) + Main.PlaySound(SoundID.Item32, player.position); + player.flapSound = true; + } + else + player.flapSound = false; + } + } + } } diff --git a/Items/Mounts/Fabsol.cs b/Items/Mounts/Fabsol.cs index 206ea9b170..b96a07982f 100644 --- a/Items/Mounts/Fabsol.cs +++ b/Items/Mounts/Fabsol.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { @@ -20,9 +20,9 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = 1; - item.rare = 9; - item.value = Item.buyPrice(3, 0, 0, 0); - item.expert = true; + item.rare = 9; + item.value = Item.buyPrice(3, 0, 0, 0); + item.expert = true; item.UseSound = SoundID.Item3; item.noMelee = true; item.mountType = mod.MountType("Fab"); diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 91672a8ace..26e98d279e 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -1,164 +1,163 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.Graphics.Shaders; -using Terraria.GameContent.Achievements; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; -using CalamityMod.World; -using CalamityMod.CalPlayer; +using Terraria; +using Terraria.GameContent.Achievements; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { class OnyxExcavator : ModMountData - { - public override void SetDefaults() - { - mountData.spawnDust = 109; - mountData.spawnDustNoGravity = true; - mountData.buff = mod.BuffType("OnyxExcavatorBuff"); - mountData.heightBoost = 10; - mountData.fallDamage = 0f; - mountData.runSpeed = 8f; - mountData.flightTimeMax = 0; - mountData.jumpHeight = 5; - mountData.acceleration = 0.2f; - mountData.jumpSpeed = 3f; - mountData.swimSpeed = 0.5f; - mountData.totalFrames = 8; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - array[l] = 2; - } - array[1] = 0; - array[5] = 0; - mountData.playerYOffsets = array; - mountData.xOffset = 0; //-6 - mountData.bodyFrame = 3; - mountData.yOffset = -1; //done - mountData.playerHeadOffset = 10; - mountData.standingFrameCount = 1; - mountData.standingFrameDelay = 12; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = 8; - mountData.runningFrameDelay = 36; //36 - mountData.runningFrameStart = mountData.standingFrameStart; - mountData.inAirFrameCount = mountData.standingFrameCount; - mountData.inAirFrameDelay = mountData.standingFrameDelay; - mountData.inAirFrameStart = mountData.standingFrameStart; - mountData.idleFrameCount = mountData.standingFrameCount; - mountData.idleFrameDelay = mountData.standingFrameDelay; - mountData.idleFrameStart = mountData.standingFrameStart; - mountData.idleFrameLoop = false; - mountData.swimFrameCount = mountData.inAirFrameCount; - mountData.swimFrameDelay = mountData.inAirFrameDelay; - mountData.swimFrameStart = mountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) - { - mountData.backTextureExtra = mod.GetTexture("Items/Mounts/OnyxExcavatorExtra"); - mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/OnyxExcavatorExtra2"); - mountData.textureWidth = mountData.backTexture.Width; - mountData.textureHeight = mountData.backTexture.Height; - } - } + { + public override void SetDefaults() + { + mountData.spawnDust = 109; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("OnyxExcavatorBuff"); + mountData.heightBoost = 10; + mountData.fallDamage = 0f; + mountData.runSpeed = 8f; + mountData.flightTimeMax = 0; + mountData.jumpHeight = 5; + mountData.acceleration = 0.2f; + mountData.jumpSpeed = 3f; + mountData.swimSpeed = 0.5f; + mountData.totalFrames = 8; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 2; + } + array[1] = 0; + array[5] = 0; + mountData.playerYOffsets = array; + mountData.xOffset = 0; //-6 + mountData.bodyFrame = 3; + mountData.yOffset = -1; //done + mountData.playerHeadOffset = 10; + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 8; + mountData.runningFrameDelay = 36; //36 + mountData.runningFrameStart = mountData.standingFrameStart; + mountData.inAirFrameCount = mountData.standingFrameCount; + mountData.inAirFrameDelay = mountData.standingFrameDelay; + mountData.inAirFrameStart = mountData.standingFrameStart; + mountData.idleFrameCount = mountData.standingFrameCount; + mountData.idleFrameDelay = mountData.standingFrameDelay; + mountData.idleFrameStart = mountData.standingFrameStart; + mountData.idleFrameLoop = false; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != NetmodeID.Server) + { + mountData.backTextureExtra = mod.GetTexture("Items/Mounts/OnyxExcavatorExtra"); + mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/OnyxExcavatorExtra2"); + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } - public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) - { - bool speed = Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed / 2f; - float num10 = (float)Math.Sign(mountedPlayer.velocity.X); - Lighting.AddLight(mountedPlayer.Center, 0.5f, 0.5f, 0.4f); - if (speed && velocity.Y == 0f) - { - for (int i = 0; i < 2; i++) - { - Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default, 1f)]; - expr_631.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); - expr_631.noLight = true; - expr_631.scale = 0.2f + Main.rand.NextFloat() * 0.8f; - expr_631.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; - expr_631.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); - } - if (mountedPlayer.cMount == 0) - { - mountedPlayer.position += new Vector2(num10 * 24f, 0f); - mountedPlayer.FloorVisuals(true); - mountedPlayer.position -= new Vector2(num10 * 24f, 0f); - } - } - return true; - } + public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) + { + bool speed = Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed / 2f; + float num10 = (float)Math.Sign(mountedPlayer.velocity.X); + Lighting.AddLight(mountedPlayer.Center, 0.5f, 0.5f, 0.4f); + if (speed && velocity.Y == 0f) + { + for (int i = 0; i < 2; i++) + { + Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default, 1f)]; + expr_631.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); + expr_631.noLight = true; + expr_631.scale = 0.2f + Main.rand.NextFloat() * 0.8f; + expr_631.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; + expr_631.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + if (mountedPlayer.cMount == 0) + { + mountedPlayer.position += new Vector2(num10 * 24f, 0f); + mountedPlayer.FloorVisuals(true); + mountedPlayer.position -= new Vector2(num10 * 24f, 0f); + } + } + return true; + } - public override void UseAbility(Player player, Vector2 mousePosition, bool toggleOn) - { - if (Main.mouseLeft && !player.mouseInterface && !Main.blockMouse) - { - if (Main.myPlayer == player.whoAmI) - { - float num10 = (float)Math.Sign(player.velocity.X); - if ((double)Math.Abs(num10) < 0.1f) - num10 = (player.direction == 1 ? 0.1f : -0.1f); - float num11 = 12f; - float num12 = 40f; - Vector2 value2 = player.Center + new Vector2(num10 * num12, num11); - int num814 = 3; - int num815 = (int)(value2.X / 16f - (float)num814); - int num816 = (int)(value2.X / 16f + (float)num814); - int num817 = (int)(value2.Y / 16f - (float)num814); - int num818 = (int)(value2.Y / 16f + (float)num814); - if (num815 < 0) - { - num815 = 0; - } - if (num816 > Main.maxTilesX) - { - num816 = Main.maxTilesX; - } - if (num817 < 0) - { - num817 = 0; - } - if (num818 > Main.maxTilesY) - { - num818 = Main.maxTilesY; - } - int tileValueLimit = 600 + - (NPC.downedMechBossAny ? 100 : 0) + - (NPC.downedPlantBoss ? 100 : 0); - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - value2.Y -= 2f; - float num826 = Math.Abs((float)num824 - value2.X / 16f); - float num827 = Math.Abs((float)num825 - value2.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - Tile tile = Framing.GetTileSafely(num824, num825); - if (num828 < (double)num814) - { - if (tile != null && tile.active() && tile.type != (ushort)mod.TileType("AbyssGravel") && - tile.type != (ushort)mod.TileType("Voidstone") && (tile.type != TileID.Hellstone || Main.hardMode) && - (tile.type != TileID.LihzahrdBrick || NPC.downedGolemBoss) && tile.type != TileID.BlueDungeonBrick && - tile.type != TileID.GreenDungeonBrick && tile.type != TileID.PinkDungeonBrick && tile.type != TileID.DemonAltar && - (tile.type != (ushort)mod.TileType("AstralOre") || CalamityWorld.downedStarGod) && - ((tile.type != (ushort)mod.TileType("Tenebris") && tile.type != (ushort)mod.TileType("PlantyMush")) || NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && - (!player.Calamity().ZoneSunkenSea || CalamityWorld.downedDesertScourge) && - (Main.tileValue[tile.type] < tileValueLimit || tile.type == TileID.Heart || tile.type == TileID.LifeFruit) && - !player.noBuilding && tile.type != TileID.ElderCrystalStand && tile.type != TileID.Containers) - { - WorldGen.KillTile(num824, num825, false, false, false); - if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - } - } - } - } + public override void UseAbility(Player player, Vector2 mousePosition, bool toggleOn) + { + if (Main.mouseLeft && !player.mouseInterface && !Main.blockMouse) + { + if (Main.myPlayer == player.whoAmI) + { + float num10 = (float)Math.Sign(player.velocity.X); + if ((double)Math.Abs(num10) < 0.1f) + num10 = (player.direction == 1 ? 0.1f : -0.1f); + float num11 = 12f; + float num12 = 40f; + Vector2 value2 = player.Center + new Vector2(num10 * num12, num11); + int num814 = 3; + int num815 = (int)(value2.X / 16f - (float)num814); + int num816 = (int)(value2.X / 16f + (float)num814); + int num817 = (int)(value2.Y / 16f - (float)num814); + int num818 = (int)(value2.Y / 16f + (float)num814); + if (num815 < 0) + { + num815 = 0; + } + if (num816 > Main.maxTilesX) + { + num816 = Main.maxTilesX; + } + if (num817 < 0) + { + num817 = 0; + } + if (num818 > Main.maxTilesY) + { + num818 = Main.maxTilesY; + } + int tileValueLimit = 600 + + (NPC.downedMechBossAny ? 100 : 0) + + (NPC.downedPlantBoss ? 100 : 0); + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + value2.Y -= 2f; + float num826 = Math.Abs((float)num824 - value2.X / 16f); + float num827 = Math.Abs((float)num825 - value2.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + Tile tile = Framing.GetTileSafely(num824, num825); + if (num828 < (double)num814) + { + if (tile != null && tile.active() && tile.type != (ushort)mod.TileType("AbyssGravel") && + tile.type != (ushort)mod.TileType("Voidstone") && (tile.type != TileID.Hellstone || Main.hardMode) && + (tile.type != TileID.LihzahrdBrick || NPC.downedGolemBoss) && tile.type != TileID.BlueDungeonBrick && + tile.type != TileID.GreenDungeonBrick && tile.type != TileID.PinkDungeonBrick && tile.type != TileID.DemonAltar && + (tile.type != (ushort)mod.TileType("AstralOre") || CalamityWorld.downedStarGod) && + ((tile.type != (ushort)mod.TileType("Tenebris") && tile.type != (ushort)mod.TileType("PlantyMush")) || NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && + (!player.Calamity().ZoneSunkenSea || CalamityWorld.downedDesertScourge) && + (Main.tileValue[tile.type] < tileValueLimit || tile.type == TileID.Heart || tile.type == TileID.LifeFruit) && + !player.noBuilding && tile.type != TileID.ElderCrystalStand && tile.type != TileID.Containers) + { + WorldGen.KillTile(num824, num825, false, false, false); + if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + } + } + } + } } diff --git a/Items/Mounts/SquishyBeanMount.cs b/Items/Mounts/SquishyBeanMount.cs index b7c5c713c5..e0ee556c0e 100644 --- a/Items/Mounts/SquishyBeanMount.cs +++ b/Items/Mounts/SquishyBeanMount.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = 1; - item.rare = 9; - item.value = Item.buyPrice(1, 0, 0, 0); - item.expert = true; + item.rare = 9; + item.value = Item.buyPrice(1, 0, 0, 0); + item.expert = true; item.UseSound = SoundID.Item3; item.noMelee = true; item.mountType = mod.MountType("SquishyBean"); diff --git a/Items/Patreon/AngelicShotgun.cs b/Items/Patreon/AngelicShotgun.cs index 60be188e3e..8a304fc45e 100644 --- a/Items/Patreon/AngelicShotgun.cs +++ b/Items/Patreon/AngelicShotgun.cs @@ -1,8 +1,8 @@ +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Patreon { @@ -35,7 +35,7 @@ Fighting 'til the war's won"); item.UseSound = SoundID.Item38; item.useStyle = 5; - item.rare = 10; + item.rare = 10; item.value = Item.buyPrice(1, 40, 0, 0); item.Calamity().postMoonLordRarity = 21; diff --git a/Items/Patreon/ApronOfAffection.cs b/Items/Patreon/ApronOfAffection.cs index 5ed39240ca..4800415e06 100644 --- a/Items/Patreon/ApronOfAffection.cs +++ b/Items/Patreon/ApronOfAffection.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Patreon { item.width = 18; item.height = 18; - item.rare = 5; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(0, 15, 0, 0); - item.vanity = true; - } + item.rare = 5; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(0, 15, 0, 0); + item.vanity = true; + } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Robe); + recipe.AddIngredient(ItemID.Robe); recipe.AddIngredient(ItemID.LovePotion, 10); recipe.AddIngredient(ItemID.LifeCrystal); recipe.AddTile(TileID.Loom); diff --git a/Items/Patreon/Ataraxia.cs b/Items/Patreon/Ataraxia.cs index 2f39aba1e0..9d6385fca6 100644 --- a/Items/Patreon/Ataraxia.cs +++ b/Items/Patreon/Ataraxia.cs @@ -6,130 +6,136 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class Ataraxia : ModItem - { - public static int BaseDamage = 5600; + { + public static int BaseDamage = 5600; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataraxia"); - Tooltip.SetDefault("Equanimity"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataraxia"); + Tooltip.SetDefault("Equanimity"); + } - public override void SetDefaults() - { - item.width = 94; - item.height = 92; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = 2.5f; - item.useAnimation = 18; - item.useTime = 18; - item.autoReuse = true; - item.useTurn = true; + public override void SetDefaults() + { + item.width = 94; + item.height = 92; + item.melee = true; + item.damage = BaseDamage; + item.knockBack = 2.5f; + item.useAnimation = 18; + item.useTime = 18; + item.autoReuse = true; + item.useTurn = true; - item.useStyle = 1; - item.UseSound = SoundID.Item1; + item.useStyle = 1; + item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(2, 50, 0, 0); - item.shoot = mod.ProjectileType("AtaraxiaMain"); - item.shootSpeed = 9f; - } + item.shoot = mod.ProjectileType("AtaraxiaMain"); + item.shootSpeed = 9f; + } - // Fires one large and two small projectiles which stay together in formation. - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - // Play the Terra Blade sound upon firing - Main.PlaySound(SoundID.Item60, position); + // Fires one large and two small projectiles which stay together in formation. + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + // Play the Terra Blade sound upon firing + Main.PlaySound(SoundID.Item60, position); - // Center projectile - int centerID = mod.ProjectileType("AtaraxiaMain"); - int centerDamage = damage; - Vector2 centerVec = new Vector2(speedX, speedY); - int center = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, centerID, centerDamage, knockBack, player.whoAmI, 0.0f, 0.0f); + // Center projectile + int centerID = mod.ProjectileType("AtaraxiaMain"); + int centerDamage = damage; + Vector2 centerVec = new Vector2(speedX, speedY); + int center = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, centerID, centerDamage, knockBack, player.whoAmI, 0.0f, 0.0f); - // Side projectiles (these deal 75% damage) - int sideID = mod.ProjectileType("AtaraxiaSide"); - int sideDamage = (int)(0.75f * centerDamage); - Vector2 speed = new Vector2(speedX, speedY); - speed.Normalize(); - speed *= 22f; - Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 leftOffset = speed.RotatedBy((double)(MathHelper.PiOver4), default); - Vector2 rightOffset = speed.RotatedBy((double)(-MathHelper.PiOver4), default); - leftOffset -= 1.4f * speed; - rightOffset -= 1.4f * speed; - Projectile.NewProjectile(rrp.X + leftOffset.X, rrp.Y + leftOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(rrp.X + rightOffset.X, rrp.Y + rightOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + // Side projectiles (these deal 75% damage) + int sideID = mod.ProjectileType("AtaraxiaSide"); + int sideDamage = (int)(0.75f * centerDamage); + Vector2 speed = new Vector2(speedX, speedY); + speed.Normalize(); + speed *= 22f; + Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 leftOffset = speed.RotatedBy((double)(MathHelper.PiOver4), default); + Vector2 rightOffset = speed.RotatedBy((double)(-MathHelper.PiOver4), default); + leftOffset -= 1.4f * speed; + rightOffset -= 1.4f * speed; + Projectile.NewProjectile(rrp.X + leftOffset.X, rrp.Y + leftOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(rrp.X + rightOffset.X, rrp.Y + rightOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - // On-hit, tosses out five homing projectiles. This is not like Holy Collider. - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 480); - target.AddBuff(BuffID.Ichor, 480); + // On-hit, tosses out five homing projectiles. This is not like Holy Collider. + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 480); + target.AddBuff(BuffID.Ichor, 480); - // Does not summon extra projectiles versus dummies. - if (target.type == NPCID.TargetDummy) - return; + // Does not summon extra projectiles versus dummies. + if (target.type == NPCID.TargetDummy) + return; - // Individual true melee homing missiles deal 10% of the weapon's base damage. - int numSplits = 5; - int trueMeleeID = mod.ProjectileType("AtaraxiaHoming"); - int trueMeleeDamage = (int)(0.1f * damage); - float angleVariance = MathHelper.TwoPi / (float)numSplits; - float spinOffsetAngle = MathHelper.Pi / (2f * numSplits); - Vector2 posVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); + // Individual true melee homing missiles deal 10% of the weapon's base damage. + int numSplits = 5; + int trueMeleeID = mod.ProjectileType("AtaraxiaHoming"); + int trueMeleeDamage = (int)(0.1f * damage); + float angleVariance = MathHelper.TwoPi / (float)numSplits; + float spinOffsetAngle = MathHelper.Pi / (2f * numSplits); + Vector2 posVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); - for (int i = 0; i < numSplits; ++i) - { - posVec = posVec.RotatedBy(angleVariance); - Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); - velocity.Normalize(); - velocity *= 8f; - Projectile.NewProjectile(target.Center + posVec, velocity, trueMeleeID, trueMeleeDamage, knockback, player.whoAmI, 0.0f, 0.0f); - } - } + for (int i = 0; i < numSplits; ++i) + { + posVec = posVec.RotatedBy(angleVariance); + Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); + velocity.Normalize(); + velocity *= 8f; + Projectile.NewProjectile(target.Center + posVec, velocity, trueMeleeID, trueMeleeDamage, knockback, player.whoAmI, 0.0f, 0.0f); + } + } - // Spawn some fancy dust while swinging - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustCount = Main.rand.Next(3, 6); - Vector2 corner = new Vector2(hitbox.X + hitbox.Width / 4, hitbox.Y + hitbox.Height / 4); - for (int i = 0; i < dustCount; ++i) - { - // Pick a random dust to spawn - int dustID = -1; - switch (Main.rand.Next(5)) - { - case 0: - case 1: dustID = 70; break; - case 2: dustID = 71; break; - default: dustID = 86; break; - } - int idx = Dust.NewDust(corner, hitbox.Width / 2, hitbox.Height / 2, dustID); - Main.dust[idx].noGravity = true; - } - } + // Spawn some fancy dust while swinging + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int dustCount = Main.rand.Next(3, 6); + Vector2 corner = new Vector2(hitbox.X + hitbox.Width / 4, hitbox.Y + hitbox.Height / 4); + for (int i = 0; i < dustCount; ++i) + { + // Pick a random dust to spawn + int dustID = -1; + switch (Main.rand.Next(5)) + { + case 0: + case 1: + dustID = 70; + break; + case 2: + dustID = 71; + break; + default: + dustID = 86; + break; + } + int idx = Dust.NewDust(corner, hitbox.Width / 2, hitbox.Height / 2, dustID); + Main.dust[idx].noGravity = true; + } + } - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.BrokenHeroSword); - r.AddIngredient(null, "CosmiliteBar", 25); - r.AddIngredient(null, "Phantoplasm", 35); - r.AddIngredient(null, "NightmareFuel", 90); - r.AddIngredient(null, "EndothermicEnergy", 90); - r.AddIngredient(null, "DarksunFragment", 65); - r.AddIngredient(null, "BarofLife", 15); - r.AddIngredient(null, "CoreofCalamity", 5); - r.AddIngredient(null, "HellcasterFragment", 10); - r.AddTile(null, "DraedonsForge"); - r.SetResult(this); - r.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(ItemID.BrokenHeroSword); + r.AddIngredient(null, "CosmiliteBar", 25); + r.AddIngredient(null, "Phantoplasm", 35); + r.AddIngredient(null, "NightmareFuel", 90); + r.AddIngredient(null, "EndothermicEnergy", 90); + r.AddIngredient(null, "DarksunFragment", 65); + r.AddIngredient(null, "BarofLife", 15); + r.AddIngredient(null, "CoreofCalamity", 5); + r.AddIngredient(null, "HellcasterFragment", 10); + r.AddTile(null, "DraedonsForge"); + r.SetResult(this); + r.AddRecipe(); + } + } } diff --git a/Items/Patreon/BloodyVein.cs b/Items/Patreon/BloodyVein.cs index ae3e77d394..f16f10ffc4 100644 --- a/Items/Patreon/BloodyVein.cs +++ b/Items/Patreon/BloodyVein.cs @@ -1,41 +1,40 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Patreon { - public class BloodyVein : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Vein"); - Tooltip.SetDefault("Summons an amalgamated pile of flesh"); - } + public class BloodyVein : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Vein"); + Tooltip.SetDefault("Summons an amalgamated pile of flesh"); + } - public override void SetDefaults() - { - item.damage = 0; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 1; - item.noMelee = true; - item.width = 24; - item.height = 48; - item.value = Item.buyPrice(0, 4, 0, 0); - item.UseSound = SoundID.NPCHit9; - item.shoot = mod.ProjectileType("PerforaMini"); - item.buffType = mod.BuffType("BloodBound"); - item.rare = 3; - item.Calamity().postMoonLordRarity = 21; - } + public override void SetDefaults() + { + item.damage = 0; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.noMelee = true; + item.width = 24; + item.height = 48; + item.value = Item.buyPrice(0, 4, 0, 0); + item.UseSound = SoundID.NPCHit9; + item.shoot = mod.ProjectileType("PerforaMini"); + item.buffType = mod.BuffType("BloodBound"); + item.rare = 3; + item.Calamity().postMoonLordRarity = 21; + } - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 3600, true); - } - } - } + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } } diff --git a/Items/Patreon/CorpusAvertorMelee.cs b/Items/Patreon/CorpusAvertorMelee.cs index c6aa89e0c4..531a6c662e 100644 --- a/Items/Patreon/CorpusAvertorMelee.cs +++ b/Items/Patreon/CorpusAvertorMelee.cs @@ -5,45 +5,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class CorpusAvertorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - Tooltip.SetDefault("Seems like it has worn down over time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + Tooltip.SetDefault("Seems like it has worn down over time"); + } - public override void SetDefaults() - { - item.width = 18; - item.height = 32; - item.damage = 140; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().postMoonLordRarity = 21; - item.shoot = mod.ProjectileType("CorpusAvertor"); - item.shootSpeed = 5f; - item.melee = true; - } + public override void SetDefaults() + { + item.width = 18; + item.height = 32; + item.damage = 140; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.Calamity().postMoonLordRarity = 21; + item.shoot = mod.ProjectileType("CorpusAvertor"); + item.shootSpeed = 5f; + item.melee = true; + } - // Gains 20% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.2f * player.meleeDamage; - } + // Gains 20% of missing health as base damage. + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + flat += lifeAmount * 0.2f * player.meleeDamage; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Patreon/DarkSpark.cs b/Items/Patreon/DarkSpark.cs index c7c5c44029..b0da40a80d 100644 --- a/Items/Patreon/DarkSpark.cs +++ b/Items/Patreon/DarkSpark.cs @@ -6,43 +6,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class DarkSpark : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Spark"); - Tooltip.SetDefault("And everything under the sun is in tune,\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Spark"); + Tooltip.SetDefault("And everything under the sun is in tune,\n" + "But the sun is eclipsed by the moon."); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); } - public override void SetDefaults() - { - item.damage = 100; - item.magic = true; - item.mana = 10; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = 4; - item.UseSound = SoundID.Item13; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; + public override void SetDefaults() + { + item.damage = 100; + item.magic = true; + item.mana = 10; + item.width = 16; + item.height = 16; + item.useTime = 10; + item.useAnimation = 10; + item.reuseDelay = 5; + item.useStyle = 4; + item.UseSound = SoundID.Item13; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 0f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("DarkSpark"); - item.shootSpeed = 30f; - item.Calamity().postMoonLordRarity = 21; - } + item.shootSpeed = 30f; + item.Calamity().postMoonLordRarity = 21; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DarkSpark"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; - } + } public override void AddRecipes() { diff --git a/Items/Patreon/DevilsSunrise.cs b/Items/Patreon/DevilsSunrise.cs index e2cae03fbe..ba984b5861 100644 --- a/Items/Patreon/DevilsSunrise.cs +++ b/Items/Patreon/DevilsSunrise.cs @@ -1,4 +1,3 @@ -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -6,55 +5,55 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class DevilsSunrise : ModItem - { - public static int BaseDamage = 360; + { + public static int BaseDamage = 360; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devil's Sunrise"); - Tooltip.SetDefault("Balls? Smalls."); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devil's Sunrise"); + Tooltip.SetDefault("Balls? Smalls."); + } - public override void SetDefaults() - { - item.width = 66; - item.height = 66; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.damage = BaseDamage; - item.crit += 10; - item.knockBack = 4f; - item.useAnimation = 25; - item.useTime = 5; - item.autoReuse = false; - item.useStyle = 5; + public override void SetDefaults() + { + item.width = 66; + item.height = 66; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.damage = BaseDamage; + item.crit += 10; + item.knockBack = 4f; + item.useAnimation = 25; + item.useTime = 5; + item.autoReuse = false; + item.useStyle = 5; - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 40, 0, 0); - item.shoot = mod.ProjectileType("DevilsSunrise"); - item.shootSpeed = 24f; - } + item.shoot = mod.ProjectileType("DevilsSunrise"); + item.shootSpeed = 24f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DevilsSunrise"), damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DevilsSunriseCyclone"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DevilsSunrise"), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DevilsSunriseCyclone"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.Arkhalis); - r.AddIngredient(null, "DemonicBoneAsh", 10); - r.AddIngredient(null, "BloodstoneCore", 25); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(ItemID.Arkhalis); + r.AddIngredient(null, "DemonicBoneAsh", 10); + r.AddIngredient(null, "BloodstoneCore", 25); + r.AddTile(TileID.LunarCraftingStation); + r.SetResult(this); + r.AddRecipe(); + } + } } diff --git a/Items/Patreon/DivineRetribution.cs b/Items/Patreon/DivineRetribution.cs index 7c6687a1b4..728332f2c9 100644 --- a/Items/Patreon/DivineRetribution.cs +++ b/Items/Patreon/DivineRetribution.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,37 +7,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class DivineRetribution : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Divine Retribution"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Divine Retribution"); Tooltip.SetDefault("Mage is superior to rogue; look, we got a donor weapon to prove it!"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 60; - item.magic = true; - item.mana = 15; - item.width = 66; - item.height = 88; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 15; + item.width = 66; + item.height = 88; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shootSpeed = 19f; - item.shoot = mod.ProjectileType("DivineRetribution"); - item.Calamity().postMoonLordRarity = 21; - } + item.autoReuse = true; + item.shootSpeed = 19f; + item.shoot = mod.ProjectileType("DivineRetribution"); + item.Calamity().postMoonLordRarity = 21; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + { float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; diff --git a/Items/Patreon/DodusHandcannon.cs b/Items/Patreon/DodusHandcannon.cs index d508a3a0c7..b35d14f64f 100644 --- a/Items/Patreon/DodusHandcannon.cs +++ b/Items/Patreon/DodusHandcannon.cs @@ -1,82 +1,78 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Patreon { public class DodusHandcannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dodu's Handcannon"); - Tooltip.SetDefault("The power of the nut rests in your hands"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dodu's Handcannon"); + Tooltip.SetDefault("The power of the nut rests in your hands"); + } - public override void SetDefaults() - { - item.width = 70; - item.height = 42; - item.damage = 450; - item.crit += 16; - item.ranged = true; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 10f; + public override void SetDefaults() + { + item.width = 70; + item.height = 42; + item.damage = 450; + item.crit += 16; + item.ranged = true; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 10f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 21; + item.Calamity().postMoonLordRarity = 21; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); - item.shootSpeed = 24f; - item.shoot = ProjectileID.BulletHighVelocity; - item.useAmmo = 97; - } + item.shootSpeed = 24f; + item.shoot = ProjectileID.BulletHighVelocity; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 5); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 5); + } - public override bool CanUseItem(Player player) - { - return CalamityGlobalItem.HasEnoughAmmo(player, item, 5); - } + public override bool CanUseItem(Player player) + { + return CalamityGlobalItem.HasEnoughAmmo(player, item, 5); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 5; i++) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0f, 0f); + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 5; i++) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0f, 0f); - // Consume 5 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 5); + // Consume 5 ammo per shot + CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 5); - return false; - } + return false; + } - // Disable vanilla ammo consumption - public override bool ConsumeAmmo(Player player) - { - return false; - } + // Disable vanilla ammo consumption + public override bool ConsumeAmmo(Player player) + { + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Aeries"); - recipe.AddIngredient(null, "RuinousSoul", 5); - recipe.AddIngredient(ItemID.LunarBar, 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Aeries"); + recipe.AddIngredient(null, "RuinousSoul", 5); + recipe.AddIngredient(ItemID.LunarBar, 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Patreon/FaceMelter.cs b/Items/Patreon/FaceMelter.cs index 26f5d35ecf..1d7e5581f1 100644 --- a/Items/Patreon/FaceMelter.cs +++ b/Items/Patreon/FaceMelter.cs @@ -6,94 +6,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class FaceMelter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Face Melter"); - Tooltip.SetDefault("Fires music notes\n" + - "Right click summons an amplifier that shoots towards your mouse\n" + - "WOOO!! FAAAAAAANTASYY WORLDDDDD!"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Face Melter"); + Tooltip.SetDefault("Fires music notes\n" + + "Right click summons an amplifier that shoots towards your mouse\n" + + "WOOO!! FAAAAAAANTASYY WORLDDDDD!"); + } - public override void SetDefaults() - { - item.damage = 250; - item.magic = true; - item.mana = 10; - item.width = 56; - item.height = 50; - item.useTime = 5; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(1, 80, 0, 0); - item.shoot = mod.ProjectileType("MelterNote1"); - item.UseSound = SoundID.Item47; - item.autoReuse = true; - item.shootSpeed = 20f; - } + public override void SetDefaults() + { + item.damage = 250; + item.magic = true; + item.mana = 10; + item.width = 56; + item.height = 50; + item.useTime = 5; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 80, 0, 0); + item.shoot = mod.ProjectileType("MelterNote1"); + item.UseSound = SoundID.Item47; + item.autoReuse = true; + item.shootSpeed = 20f; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TheAxe); - recipe.AddIngredient(ItemID.MagicalHarp); - recipe.AddIngredient(null, "SirensSong"); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TheAxe); + recipe.AddIngredient(ItemID.MagicalHarp); + recipe.AddIngredient(null, "SirensSong"); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - item.useTime = 20; - item.useAnimation = 20; - item.reuseDelay = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MelterAmp"), damage, knockBack, player.whoAmI); - return false; - } - else - { - item.useTime = 5; - item.useAnimation = 10; - float SpeedX = speedX; - float SpeedY = speedY; - int note = Main.rand.Next(0, 2); - if (note == 0) - { - damage = (int)(damage * 1.5f); - type = mod.ProjectileType("MelterNote1"); - } - else - { - SpeedX *= 1.5f; - SpeedY *= 1.5f; - type = mod.ProjectileType("MelterNote2"); - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + item.useTime = 20; + item.useAnimation = 20; + item.reuseDelay = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MelterAmp"), damage, knockBack, player.whoAmI); + return false; + } + else + { + item.useTime = 5; + item.useAnimation = 10; + float SpeedX = speedX; + float SpeedY = speedY; + int note = Main.rand.Next(0, 2); + if (note == 0) + { + damage = (int)(damage * 1.5f); + type = mod.ProjectileType("MelterNote1"); + } + else + { + SpeedX *= 1.5f; + SpeedY *= 1.5f; + type = mod.ProjectileType("MelterNote2"); + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } + } } diff --git a/Items/Patreon/ForgottenDragonEgg.cs b/Items/Patreon/ForgottenDragonEgg.cs index 0268e3741e..26940d0326 100644 --- a/Items/Patreon/ForgottenDragonEgg.cs +++ b/Items/Patreon/ForgottenDragonEgg.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Patreon item.CloneDefaults(ItemID.ZephyrFish); item.shoot = mod.ProjectileType("Akato"); item.buffType = mod.BuffType("AkatoYharonBuff"); - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - } + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + } public override void UseStyle(Player player) { diff --git a/Items/Patreon/GazeOfCrysthamyr.cs b/Items/Patreon/GazeOfCrysthamyr.cs index e2bc6a1d7b..e9dc0e3de1 100644 --- a/Items/Patreon/GazeOfCrysthamyr.cs +++ b/Items/Patreon/GazeOfCrysthamyr.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { @@ -19,24 +19,24 @@ namespace CalamityMod.Items.Patreon item.useTime = 20; item.useAnimation = 20; item.useStyle = 4; - item.rare = 10; - item.value = Item.buyPrice(3, 0, 0, 0); + item.rare = 10; + item.value = Item.buyPrice(3, 0, 0, 0); item.UseSound = SoundID.NPCHit56; item.noMelee = true; item.mountType = mod.MountType("Crysthamyr"); - item.Calamity().postMoonLordRarity = 21; - } + item.Calamity().postMoonLordRarity = 21; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DD2PetDragon); - recipe.AddIngredient(ItemID.SoulofNight, 100); - recipe.AddIngredient(null, "DarksunFragment", 50); - recipe.AddIngredient(null, "ExodiumClusterOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DD2PetDragon); + recipe.AddIngredient(ItemID.SoulofNight, 100); + recipe.AddIngredient(null, "DarksunFragment", 50); + recipe.AddIngredient(null, "ExodiumClusterOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Patreon/HandheldTank.cs b/Items/Patreon/HandheldTank.cs index 33bb4ad629..87cbdf37c3 100644 --- a/Items/Patreon/HandheldTank.cs +++ b/Items/Patreon/HandheldTank.cs @@ -6,59 +6,59 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class HandheldTank : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Handheld Tank"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Handheld Tank"); + } - public override void SetDefaults() - { - item.width = 110; - item.height = 46; - item.ranged = true; - item.damage = 1850; - item.crit += 15; - item.knockBack = 16f; - item.useTime = 71; - item.useAnimation = 71; - item.autoReuse = true; + public override void SetDefaults() + { + item.width = 110; + item.height = 46; + item.ranged = true; + item.damage = 1850; + item.crit += 15; + item.knockBack = 16f; + item.useTime = 71; + item.useAnimation = 71; + item.autoReuse = true; - item.useStyle = 5; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TankCannon"); - item.noMelee = true; + item.useStyle = 5; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TankCannon"); + item.noMelee = true; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; - item.shoot = mod.ProjectileType("HandheldTankShell"); - item.shootSpeed = 6f; - item.useAmmo = AmmoID.Rocket; - } + item.shoot = mod.ProjectileType("HandheldTankShell"); + item.shootSpeed = 6f; + item.useAmmo = AmmoID.Rocket; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("HandheldTankShell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("HandheldTankShell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-33, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-33, 0); + } - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "Shroomer"); - r.AddIngredient(ItemID.IronBar, 50); - r.anyIronBar = true; - r.AddIngredient(null, "DivineGeode", 5); - r.AddIngredient(ItemID.TigerSkin); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(null, "Shroomer"); + r.AddIngredient(ItemID.IronBar, 50); + r.anyIronBar = true; + r.AddIngredient(null, "DivineGeode", 5); + r.AddIngredient(ItemID.TigerSkin); + r.AddTile(TileID.LunarCraftingStation); + r.SetResult(this); + r.AddRecipe(); + } + } } diff --git a/Items/Patreon/Karasawa.cs b/Items/Patreon/Karasawa.cs index 3b162fe528..b4eecfc25d 100644 --- a/Items/Patreon/Karasawa.cs +++ b/Items/Patreon/Karasawa.cs @@ -6,79 +6,79 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class Karasawa : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Karasawa"); - Tooltip.SetDefault("...This is heavy...too heavy."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Karasawa"); + Tooltip.SetDefault("...This is heavy...too heavy."); + } - public override void SetDefaults() - { - item.width = 94; - item.height = 44; - item.ranged = true; - item.damage = 1400; - item.knockBack = 12f; - item.useTime = 52; - item.useAnimation = 52; - item.autoReuse = true; + public override void SetDefaults() + { + item.width = 94; + item.height = 44; + item.ranged = true; + item.damage = 1400; + item.knockBack = 12f; + item.useTime = 52; + item.useAnimation = 52; + item.autoReuse = true; - item.useStyle = 5; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"); - item.noMelee = true; + item.useStyle = 5; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"); + item.noMelee = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; - item.shoot = mod.ProjectileType("KarasawaShot"); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; - } + item.shoot = mod.ProjectileType("KarasawaShot"); + item.shootSpeed = 1f; + item.useAmmo = AmmoID.Bullet; + } - public override bool CanUseItem(Player player) - { - return CalamityGlobalItem.HasEnoughAmmo(player, item, 5); - } + public override bool CanUseItem(Player player) + { + return CalamityGlobalItem.HasEnoughAmmo(player, item, 5); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 velocity = new Vector2(speedX, speedY); - if (velocity.Length() > 5f) - { - velocity.Normalize(); - velocity *= 5f; - } - Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, mod.ProjectileType("KarasawaShot"), damage, knockBack, player.whoAmI, 0f, 0f); + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 velocity = new Vector2(speedX, speedY); + if (velocity.Length() > 5f) + { + velocity.Normalize(); + velocity *= 5f; + } + Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, mod.ProjectileType("KarasawaShot"), damage, knockBack, player.whoAmI, 0f, 0f); - // Consume 5 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 5); + // Consume 5 ammo per shot + CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 5); - return false; - } + return false; + } - // Disable vanilla ammo consumption - public override bool ConsumeAmmo(Player player) - { - return false; - } + // Disable vanilla ammo consumption + public override bool ConsumeAmmo(Player player) + { + return false; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-20, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-20, 0); + } - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "CrownJewel"); - r.AddIngredient(null, "GalacticaSingularity", 5); - r.AddIngredient(null, "BarofLife", 10); - r.AddIngredient(null, "CosmiliteBar", 15); - r.AddTile(null, "DraedonsForge"); - r.SetResult(this); - r.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(null, "CrownJewel"); + r.AddIngredient(null, "GalacticaSingularity", 5); + r.AddIngredient(null, "BarofLife", 10); + r.AddIngredient(null, "CosmiliteBar", 15); + r.AddTile(null, "DraedonsForge"); + r.SetResult(this); + r.AddRecipe(); + } + } } diff --git a/Items/Patreon/Keelhaul.cs b/Items/Patreon/Keelhaul.cs index 1ff2c2cf36..640e0bfe0e 100644 --- a/Items/Patreon/Keelhaul.cs +++ b/Items/Patreon/Keelhaul.cs @@ -5,34 +5,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class Keelhaul : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Keelhaul"); - Tooltip.SetDefault("Summons a geyser upon hitting an enemy\n"+ - "Crumple 'em like paper"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Keelhaul"); + Tooltip.SetDefault("Summons a geyser upon hitting an enemy\n" + + "Crumple 'em like paper"); + } - public override void SetDefaults() - { - item.width = 42; - item.height = 42; - item.damage = 55; - item.mana = 50; - item.magic = true; - item.noMelee = true; - item.useTime = 30; + public override void SetDefaults() + { + item.width = 42; + item.height = 42; + item.damage = 55; + item.mana = 50; + item.magic = true; + item.noMelee = true; + item.useTime = 30; item.useAnimation = 30; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 2f; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.rare = 8; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(0, 80, 0, 0); - item.shoot = mod.ProjectileType("KeelhaulBubble"); - item.shootSpeed = 15f; - } - } + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 2f; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.rare = 8; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(0, 80, 0, 0); + item.shoot = mod.ProjectileType("KeelhaulBubble"); + item.shootSpeed = 15f; + } + } } diff --git a/Items/Patreon/KelvinCatalystMelee.cs b/Items/Patreon/KelvinCatalystMelee.cs index 17c436f956..0b8ea05f17 100644 --- a/Items/Patreon/KelvinCatalystMelee.cs +++ b/Items/Patreon/KelvinCatalystMelee.cs @@ -4,61 +4,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { - public class KelvinCatalystMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst"); - Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits"); - } + public class KelvinCatalystMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kelvin Catalyst"); + Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits"); + } - public override void SetDefaults() - { - item.width = 20; - item.damage = 100; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 30; - item.useStyle = 1; - item.useTime = 30; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.height = 20; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("KelvinCatalyst"); - item.shootSpeed = 8f; - item.melee = true; - item.Calamity().postMoonLordRarity = 21; - } + public override void SetDefaults() + { + item.width = 20; + item.damage = 100; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.height = 20; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("KelvinCatalyst"); + item.shootSpeed = 8f; + item.melee = true; + item.Calamity().postMoonLordRarity = 21; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IceStar", 200); - recipe.AddIngredient(ItemID.SoulofMight, 30); - recipe.AddIngredient(null, "CryoBar", 20); - recipe.AddIngredient(null, "EssenceofEleum", 10); - recipe.AddIngredient(null, "Avalanche", 2); - recipe.AddIngredient(null, "BittercoldStaff", 2); - recipe.AddIngredient(null, "EffluviumBow", 2); - recipe.AddIngredient(null, "GlacialCrusher", 2); - recipe.AddIngredient(null, "Icebreaker", 2); - recipe.AddIngredient(null, "SnowstormStaff", 2); - recipe.AddIngredient(null, "SoulofCryogen", 2); - recipe.AddIngredient(null, "FrostFlare", 2); - recipe.AddIngredient(ItemID.FrostCore, 2); - recipe.AddIngredient(null, "CryoStone"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IceStar", 200); + recipe.AddIngredient(ItemID.SoulofMight, 30); + recipe.AddIngredient(null, "CryoBar", 20); + recipe.AddIngredient(null, "EssenceofEleum", 10); + recipe.AddIngredient(null, "Avalanche", 2); + recipe.AddIngredient(null, "BittercoldStaff", 2); + recipe.AddIngredient(null, "EffluviumBow", 2); + recipe.AddIngredient(null, "GlacialCrusher", 2); + recipe.AddIngredient(null, "Icebreaker", 2); + recipe.AddIngredient(null, "SnowstormStaff", 2); + recipe.AddIngredient(null, "SoulofCryogen", 2); + recipe.AddIngredient(null, "FrostFlare", 2); + recipe.AddIngredient(ItemID.FrostCore, 2); + recipe.AddIngredient(null, "CryoStone"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Patreon/LightGodsBrilliance.cs b/Items/Patreon/LightGodsBrilliance.cs index 9eff64bcc8..cfe10d1489 100644 --- a/Items/Patreon/LightGodsBrilliance.cs +++ b/Items/Patreon/LightGodsBrilliance.cs @@ -30,41 +30,41 @@ namespace CalamityMod.Items.Patreon item.autoReuse = true; item.shoot = mod.ProjectileType("LightBead"); item.shootSpeed = 25f; - item.Calamity().postMoonLordRarity = 21; - } + item.Calamity().postMoonLordRarity = 21; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(2, 5); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - } - if (Main.rand.NextBool(3)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LightBall"), (int)((double)damage * 2.0), knockBack, player.whoAmI, 0.0f, 0.0f); - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(2, 5); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + if (Main.rand.NextBool(3)) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LightBall"), (int)((double)damage * 2.0), knockBack, player.whoAmI, 0.0f, 0.0f); + } - return false; - } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadecrystalTome"); - recipe.AddIngredient(null, "AbyssalTome"); - recipe.AddIngredient(ItemID.HolyWater, 10); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(ItemID.SoulofLight, 30); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadecrystalTome"); + recipe.AddIngredient(null, "AbyssalTome"); + recipe.AddIngredient(ItemID.HolyWater, 10); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(ItemID.SoulofLight, 30); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Patreon/MadAlchemistsCocktailGlove.cs b/Items/Patreon/MadAlchemistsCocktailGlove.cs index c1411dbb76..5ccaa00998 100644 --- a/Items/Patreon/MadAlchemistsCocktailGlove.cs +++ b/Items/Patreon/MadAlchemistsCocktailGlove.cs @@ -6,21 +6,21 @@ namespace CalamityMod.Items.Patreon { public class MadAlchemistsCocktailGlove : ModItem { - private int FlaskType = 0; - private int BaseDamage = 200; + private int FlaskType = 0; + private int BaseDamage = 200; public override void SetStaticDefaults() { DisplayName.SetDefault("Mad Alchemist's Cocktail Glove"); Tooltip.SetDefault("Fires a variety of high-velocity flasks that have various effects\n" + - "Right click to throw a flask that inflicts a variety of debuffs"); + "Right click to throw a flask that inflicts a variety of debuffs"); } public override void SetDefaults() { item.damage = BaseDamage; item.magic = true; - item.noUseGraphic = true; + item.noUseGraphic = true; item.mana = 12; item.width = 26; item.height = 36; @@ -35,75 +35,75 @@ namespace CalamityMod.Items.Patreon item.autoReuse = true; item.shoot = mod.ProjectileType("MadAlchemistsCocktailRed"); item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 21; - } + item.Calamity().postMoonLordRarity = 21; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - item.damage = (int)((double)BaseDamage * 1.5); - else - item.damage = BaseDamage; + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + item.damage = (int)((double)BaseDamage * 1.5); + else + item.damage = BaseDamage; - return base.CanUseItem(player); - } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - type = mod.ProjectileType("MadAlchemistsCocktailAlt"); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * 1.5f * player.magicDamage), knockBack, player.whoAmI, 0f, 0f); - } - else - { - switch (FlaskType) - { - case 0: - type = mod.ProjectileType("MadAlchemistsCocktailRed"); - break; - case 1: - type = mod.ProjectileType("MadAlchemistsCocktailBlue"); - break; - case 2: - type = mod.ProjectileType("MadAlchemistsCocktailGreen"); - break; - case 3: - type = mod.ProjectileType("MadAlchemistsCocktailPurple"); - break; - default: - break; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + type = mod.ProjectileType("MadAlchemistsCocktailAlt"); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * 1.5f * player.magicDamage), knockBack, player.whoAmI, 0f, 0f); + } + else + { + switch (FlaskType) + { + case 0: + type = mod.ProjectileType("MadAlchemistsCocktailRed"); + break; + case 1: + type = mod.ProjectileType("MadAlchemistsCocktailBlue"); + break; + case 2: + type = mod.ProjectileType("MadAlchemistsCocktailGreen"); + break; + case 3: + type = mod.ProjectileType("MadAlchemistsCocktailPurple"); + break; + default: + break; + } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * player.magicDamage), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * player.magicDamage), knockBack, player.whoAmI, 0f, 0f); - FlaskType++; - if (FlaskType > 3) - FlaskType = 0; - } + FlaskType++; + if (FlaskType > 3) + FlaskType = 0; + } - return false; - } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddIngredient(ItemID.BottledWater, 15); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddIngredient(null, "CoreofEleum", 5); - recipe.AddIngredient(null, "CoreofCinder", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ToxicFlask); + recipe.AddIngredient(ItemID.BottledWater, 15); + recipe.AddIngredient(ItemID.Leather, 5); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddIngredient(null, "CoreofEleum", 5); + recipe.AddIngredient(null, "CoreofCinder", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Patreon/Nadir.cs b/Items/Patreon/Nadir.cs index 0e470ce195..1c4f1b49e3 100644 --- a/Items/Patreon/Nadir.cs +++ b/Items/Patreon/Nadir.cs @@ -4,61 +4,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { - public class Nadir : ModItem - { - public static int BaseDamage = 1100; - public static float ShootSpeed = 12f; + public class Nadir : ModItem + { + public static int BaseDamage = 1100; + public static float ShootSpeed = 12f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nadir"); - Tooltip.SetDefault("Fires void essences which flay nearby enemies with tentacles\n" + "Ignores immunity frames\n" + - "'The abyss has stared back at you long enough. It now speaks, and it does not speak softly.'"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nadir"); + Tooltip.SetDefault("Fires void essences which flay nearby enemies with tentacles\n" + "Ignores immunity frames\n" + + "'The abyss has stared back at you long enough. It now speaks, and it does not speak softly.'"); + } - public override void SetDefaults() - { - item.width = 144; - item.height = 144; - item.noUseGraphic = true; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = 8f; - item.useAnimation = 18; - item.useTime = 18; - item.autoReuse = true; - item.noMelee = true; + public override void SetDefaults() + { + item.width = 144; + item.height = 144; + item.noUseGraphic = true; + item.melee = true; + item.damage = BaseDamage; + item.knockBack = 8f; + item.useAnimation = 18; + item.useTime = 18; + item.autoReuse = true; + item.noMelee = true; - item.useStyle = 5; - item.UseSound = SoundID.Item1; + item.useStyle = 5; + item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 80, 0, 0); - item.shoot = mod.ProjectileType("NadirSpear"); - item.shootSpeed = ShootSpeed; - } + item.shoot = mod.ProjectileType("NadirSpear"); + item.shootSpeed = ShootSpeed; + } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; ++i) - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - return false; - return true; - } + public override bool CanUseItem(Player player) + { + for (int i = 0; i < Main.projectile.Length; ++i) + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SpatialLance"); - recipe.AddIngredient(null, "TwistingNether", 5); - recipe.AddIngredient(null, "DarksunFragment", 15); - recipe.AddIngredient(null, "Phantoplasm", 15); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SpatialLance"); + recipe.AddIngredient(null, "TwistingNether", 5); + recipe.AddIngredient(null, "DarksunFragment", 15); + recipe.AddIngredient(null, "Phantoplasm", 15); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Patreon/NormalityRelocator.cs b/Items/Patreon/NormalityRelocator.cs index 63a92e7528..c0f62cb64e 100644 --- a/Items/Patreon/NormalityRelocator.cs +++ b/Items/Patreon/NormalityRelocator.cs @@ -1,48 +1,48 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Patreon { public class NormalityRelocator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Normality Relocator"); - Tooltip.SetDefault("I'll be there in the blink of an eye\n" + - "Press Z to teleport to the position of the mouse\n" + - "Boosts movement and fall speed by 10%\n" + - "Works while in the inventory"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Normality Relocator"); + Tooltip.SetDefault("I'll be there in the blink of an eye\n" + + "Press Z to teleport to the position of the mouse\n" + + "Boosts movement and fall speed by 10%\n" + + "Works while in the inventory"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); + } - public override void SetDefaults() - { - item.width = 38; - item.height = 38; + public override void SetDefaults() + { + item.width = 38; + item.height = 38; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - } + item.Calamity().postMoonLordRarity = 21; + } - public override void UpdateInventory(Player player) - { + public override void UpdateInventory(Player player) + { CalamityPlayer modPlayer = player.Calamity(); modPlayer.normalityRelocator = true; } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RodofDiscord); + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RodofDiscord); recipe.AddIngredient(ItemID.FragmentStardust, 30); recipe.AddIngredient(null, "ExodiumClusterOre", 10); - recipe.AddIngredient(null, "Cinderplate", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddIngredient(null, "Cinderplate", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); } - } + } } diff --git a/Items/Patreon/ProfanedSoulArtifact.cs b/Items/Patreon/ProfanedSoulArtifact.cs index 7ac3e89360..8b6733ddb6 100644 --- a/Items/Patreon/ProfanedSoulArtifact.cs +++ b/Items/Patreon/ProfanedSoulArtifact.cs @@ -1,33 +1,33 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Patreon { public class ProfanedSoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Soul Artifact"); - Tooltip.SetDefault("Purity\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Soul Artifact"); + Tooltip.SetDefault("Purity\n" + "Summons a healer guardian which heals for a certain amount of health every few seconds\n" + - "Summons a defensive guardian if you have at least 8 minion slots, which boosts your movement speed and your damage resistance\n" + - "Summons an offensive guardian if you are wearing the tarragon summon set (or stronger), which boosts your summon damage and your minion slots\n" + - "If you get hit their effects will disappear for 5 seconds"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } + "Summons a defensive guardian if you have at least 8 minion slots, which boosts your movement speed and your damage resistance\n" + + "Summons an offensive guardian if you are wearing the tarragon summon set (or stronger), which boosts your summon damage and your minion slots\n" + + "If you get hit their effects will disappear for 5 seconds"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } - public override void SetDefaults() - { - item.width = 32; - item.height = 40; + public override void SetDefaults() + { + item.width = 32; + item.height = 40; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.accessory = true; - item.Calamity().postMoonLordRarity = 21; - } + item.Calamity().postMoonLordRarity = 21; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -36,15 +36,15 @@ namespace CalamityMod.Items.Patreon } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); recipe.AddIngredient(null, "CoreofCinder"); recipe.AddIngredient(null, "DivineGeode", 5); recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); } - } + } } diff --git a/Items/Patreon/ResurrectionButterfly.cs b/Items/Patreon/ResurrectionButterfly.cs index 92bf9d6809..3566e90cc4 100644 --- a/Items/Patreon/ResurrectionButterfly.cs +++ b/Items/Patreon/ResurrectionButterfly.cs @@ -1,91 +1,91 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { - public class ResurrectionButterfly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Resurrection Butterfly"); - Tooltip.SetDefault("Remembering the melancholy of human existence\n" + - "Even ghosts stray from the path of righteousness"); - } + public class ResurrectionButterfly : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Resurrection Butterfly"); + Tooltip.SetDefault("Remembering the melancholy of human existence\n" + + "Even ghosts stray from the path of righteousness"); + } - public override void SetDefaults() - { - item.damage = 40; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().postMoonLordRarity = 21; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PinkButterfly"); - item.shootSpeed = 10f; - item.summon = true; - } + public override void SetDefaults() + { + item.damage = 40; + item.mana = 10; + item.width = 46; + item.height = 46; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.Calamity().postMoonLordRarity = 21; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PinkButterfly"); + item.shootSpeed = 10f; + item.summon = true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(num78, num79); - spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("PinkButterfly"), damage, num74, i, 0f, 0f); - spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("PurpleButterfly"), damage, num74, i, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Vector2 spinningpoint = new Vector2(num78, num79); + spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); + Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("PinkButterfly"), damage, num74, i, 0f, 0f); + spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default); + Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("PurpleButterfly"), damage, num74, i, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.Silk, 40); - r.AddIngredient(ItemID.Ectoplasm, 20); - r.AddIngredient(null, "BarofLife", 5); - r.AddIngredient(ItemID.ButterflyDust, 2); - r.AddIngredient(null, "GypsyPowder"); - r.AddIngredient(null, "SpiritGenerator"); - r.AddTile(TileID.Loom); - r.SetResult(this); - r.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(ItemID.Silk, 40); + r.AddIngredient(ItemID.Ectoplasm, 20); + r.AddIngredient(null, "BarofLife", 5); + r.AddIngredient(ItemID.ButterflyDust, 2); + r.AddIngredient(null, "GypsyPowder"); + r.AddIngredient(null, "SpiritGenerator"); + r.AddTile(TileID.Loom); + r.SetResult(this); + r.AddRecipe(); + } + } } diff --git a/Items/Patreon/Roxcalibur.cs b/Items/Patreon/Roxcalibur.cs index 9071276132..8b04f191aa 100644 --- a/Items/Patreon/Roxcalibur.cs +++ b/Items/Patreon/Roxcalibur.cs @@ -1,275 +1,273 @@ -using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; -using CalamityMod; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Patreon { - public class Roxcalibur : ModItem - { - private int Roxcooldown = 901; - private int RoxCanUse = 0; - private int RoxCanAlt = 0; - private bool RoxAlt = false; - private bool Didrefresh = false; + public class Roxcalibur : ModItem + { + private int Roxcooldown = 901; + private int RoxCanUse = 0; + private int RoxCanAlt = 0; + private bool RoxAlt = false; + private bool Didrefresh = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Roxcalibur"); - Tooltip.SetDefault("You couldn’t get it out of the rock, so you just brought the rock instead\n" + - "A hellish entity of flesh holds the key to this weapon’s power\n" + - "Left click to shoot several rock shards\n" + - "Right click to dive downwards and bounce off enemies\n" + - "Diving into blocks creates a shockwave"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Roxcalibur"); + Tooltip.SetDefault("You couldn’t get it out of the rock, so you just brought the rock instead\n" + + "A hellish entity of flesh holds the key to this weapon’s power\n" + + "Left click to shoot several rock shards\n" + + "Right click to dive downwards and bounce off enemies\n" + + "Diving into blocks creates a shockwave"); + } - public override void SetDefaults() - { - item.damage = 200; - item.knockBack = 13; - item.crit += 8; - item.melee = true; - item.useStyle = 1; - item.UseSound = SoundID.NPCHit42; - item.width = 80; - item.height = 80; - item.autoReuse = true; - item.useAnimation = 45; - item.useTime = 45; + public override void SetDefaults() + { + item.damage = 200; + item.knockBack = 13; + item.crit += 8; + item.melee = true; + item.useStyle = 1; + item.UseSound = SoundID.NPCHit42; + item.width = 80; + item.height = 80; + item.autoReuse = true; + item.useAnimation = 45; + item.useTime = 45; - item.shoot = mod.ProjectileType("Rox1"); - item.shootSpeed = 10f; + item.shoot = mod.ProjectileType("Rox1"); + item.shootSpeed = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.Calamity().postMoonLordRarity = 21; - } + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.Calamity().postMoonLordRarity = 21; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 25); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(null, "EssenceofChaos", 5); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddIngredient(ItemID.StoneBlock, 100); - recipe.AddIngredient(ItemID.Amethyst, 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 25); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddIngredient(null, "EssenceofChaos", 5); + recipe.AddIngredient(ItemID.Obsidian, 10); + recipe.AddIngredient(ItemID.StoneBlock, 100); + recipe.AddIngredient(ItemID.Amethyst, 2); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void UpdateInventory(Player player) - { - //Timers for the cooldown and usage of the weapon - Roxcooldown++; - RoxCanUse++; - RoxCanAlt++; - if (Roxcooldown == 600) - { - for (int i = 0; i < 50; i++) - { - int d = Dust.NewDust(player.Center, player.width, player.height, 191, Main.rand.Next(-8, 9), Main.rand.Next(-8, 9), 100, default, 1); - Main.dust[d].noGravity = true; - Main.dust[d].position = player.Center; - } - Main.PlaySound(2, player.position, 70); - } - // Resets the weapon usage if the alt fire collides with the ground - if (RoxAlt && player.ownedProjectileCounts[mod.ProjectileType("RoxSlam")] <= 0) - { - player.itemAnimation = 0; - player.itemTime = 0; - RoxCanUse = 0; - RoxAlt = false; - Didrefresh = false; - } - // Controls what happens when the alt fire is active - if (RoxAlt && player.ownedProjectileCounts[mod.ProjectileType("RoxSlam")] > 0) - { - if (player.mount.Active) - { - player.mount.Dismount(player); - } - player.maxFallSpeed = 22f; - player.controlJump = false; - player.controlUp = false; - player.dashDelay = 60; - } - } + public override void UpdateInventory(Player player) + { + //Timers for the cooldown and usage of the weapon + Roxcooldown++; + RoxCanUse++; + RoxCanAlt++; + if (Roxcooldown == 600) + { + for (int i = 0; i < 50; i++) + { + int d = Dust.NewDust(player.Center, player.width, player.height, 191, Main.rand.Next(-8, 9), Main.rand.Next(-8, 9), 100, default, 1); + Main.dust[d].noGravity = true; + Main.dust[d].position = player.Center; + } + Main.PlaySound(2, player.position, 70); + } + // Resets the weapon usage if the alt fire collides with the ground + if (RoxAlt && player.ownedProjectileCounts[mod.ProjectileType("RoxSlam")] <= 0) + { + player.itemAnimation = 0; + player.itemTime = 0; + RoxCanUse = 0; + RoxAlt = false; + Didrefresh = false; + } + // Controls what happens when the alt fire is active + if (RoxAlt && player.ownedProjectileCounts[mod.ProjectileType("RoxSlam")] > 0) + { + if (player.mount.Active) + { + player.mount.Dismount(player); + } + player.maxFallSpeed = 22f; + player.controlJump = false; + player.controlUp = false; + player.dashDelay = 60; + } + } - public override bool CanUseItem(Player player) - { - //Only useable in hardmode and if a second has passed after the alt fire ended - return Main.hardMode && RoxCanUse >= 60; - } + public override bool CanUseItem(Player player) + { + //Only useable in hardmode and if a second has passed after the alt fire ended + return Main.hardMode && RoxCanUse >= 60; + } - public override bool AltFunctionUse(Player player) - { - return RoxCanAlt >= item.useAnimation + 5 && player.position.Y != player.oldPosition.Y && !player.mount.Active && player.gravDir != -1; - } + public override bool AltFunctionUse(Player player) + { + return RoxCanAlt >= item.useAnimation + 5 && player.position.Y != player.oldPosition.Y && !player.mount.Active && player.gravDir != -1; + } - public override void UseStyle(Player player) - { - //Modifies the altfire use style and the location of the sprite of the weapon - if (player.altFunctionUse == 2) - { - player.itemLocation.X -= 32f * player.direction; - player.itemLocation.Y -= 60f; - item.useStyle = 4; - RoxAlt = true; - } - //Modifies to use style and hold out of the main fire mode - else - { - player.itemLocation += new Vector2(-7.5f * player.direction, 8.5f * player.gravDir).RotatedBy(player.itemRotation); - item.useStyle = 1; - RoxAlt = false; - } - } + public override void UseStyle(Player player) + { + //Modifies the altfire use style and the location of the sprite of the weapon + if (player.altFunctionUse == 2) + { + player.itemLocation.X -= 32f * player.direction; + player.itemLocation.Y -= 60f; + item.useStyle = 4; + RoxAlt = true; + } + //Modifies to use style and hold out of the main fire mode + else + { + player.itemLocation += new Vector2(-7.5f * player.direction, 8.5f * player.gravDir).RotatedBy(player.itemRotation); + item.useStyle = 1; + RoxAlt = false; + } + } - //Makes the alt fire only spawn the projectile once - public override bool OnlyShootOnSwing => RoxAlt; + //Makes the alt fire only spawn the projectile once + public override bool OnlyShootOnSwing => RoxAlt; - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - //Changes the hitbox of the alt fire to fit the sprite - if (player.altFunctionUse == 2) - { - if (player.direction == 1) - { - hitbox.X = (int)player.position.X - 9; - } - else - { - hitbox.X = (int)player.position.X - 22; - } - hitbox.Y = (int)player.position.Y + 20; - hitbox.Width = 52; - } - //Why did i need to fix this hitbox i have no clue - else - { - if (player.direction == -1) - { - hitbox.X += 16; - } - hitbox.Width -= 15; - } - } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + //Changes the hitbox of the alt fire to fit the sprite + if (player.altFunctionUse == 2) + { + if (player.direction == 1) + { + hitbox.X = (int)player.position.X - 9; + } + else + { + hitbox.X = (int)player.position.X - 22; + } + hitbox.Y = (int)player.position.Y + 20; + hitbox.Width = 52; + } + //Why did i need to fix this hitbox i have no clue + else + { + if (player.direction == -1) + { + hitbox.X += 16; + } + hitbox.Width -= 15; + } + } - public override float MeleeSpeedMultiplier(Player player) - { - //If you use alt fire it can hold the sword for way longer - if (player.altFunctionUse == 2) - { - //Use animation 40/0.1 = 400 - return 0.1f; - } - else - { - return 1f; - } - } + public override float MeleeSpeedMultiplier(Player player) + { + //If you use alt fire it can hold the sword for way longer + if (player.altFunctionUse == 2) + { + //Use animation 40/0.1 = 400 + return 0.1f; + } + else + { + return 1f; + } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (player.altFunctionUse == 2) - { - //Prevents the player from getting stuck on tiles like platforms - if (player.position.Y == player.oldPosition.Y) - { - player.itemAnimation = 0; - player.itemTime = 0; - RoxAlt = false; - RoxCanUse = 0; - if (Didrefresh) - { - Roxcooldown = 600; - Didrefresh = false; - } - } - // Makes the player forcefully dive down - player.velocity.Y = player.maxFallSpeed; - //Rotates the sprite of the item on alt fire to have it point downwards - player.itemRotation = player.direction * MathHelper.ToRadians(135f); - //Dust trail - int dusty = hitbox.Y + (hitbox.Height / 2); - Dust.NewDust(new Vector2(hitbox.X, dusty), hitbox.Width, hitbox.Height / 2, 191, player.velocity.X * 0.25f, player.velocity.Y * 0.25f, 160, default, 0.7f); - } - else - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 191, 0f, 0f, 160, default, 0.7f); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (player.altFunctionUse == 2) + { + //Prevents the player from getting stuck on tiles like platforms + if (player.position.Y == player.oldPosition.Y) + { + player.itemAnimation = 0; + player.itemTime = 0; + RoxAlt = false; + RoxCanUse = 0; + if (Didrefresh) + { + Roxcooldown = 600; + Didrefresh = false; + } + } + // Makes the player forcefully dive down + player.velocity.Y = player.maxFallSpeed; + //Rotates the sprite of the item on alt fire to have it point downwards + player.itemRotation = player.direction * MathHelper.ToRadians(135f); + //Dust trail + int dusty = hitbox.Y + (hitbox.Height / 2); + Dust.NewDust(new Vector2(hitbox.X, dusty), hitbox.Width, hitbox.Height / 2, 191, player.velocity.X * 0.25f, player.velocity.Y * 0.25f, 160, default, 0.7f); + } + else + { + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 191, 0f, 0f, 160, default, 0.7f); + } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (item.useStyle == 4) - { - //Spawns a projectile on the tip of the sword in the alt fire - float positionx; - float positiony = position.Y + (item.height / 2) + 23; ; - int cooldown = 0; - //Check if the entire cooldown has passed - if (Roxcooldown >= 600) - { - cooldown = 1; - } - // Makes the projectile spawn in the proper position on the X axis - if (player.direction == 1) - { - positionx = position.X + 6; - } - else - { - positionx = position.X - 8; - } - Projectile.NewProjectile(positionx, positiony, player.velocity.X, player.velocity.Y, mod.ProjectileType("RoxSlam"), 0, 0, player.whoAmI, cooldown); - //Resets the cooldown after shooting - if (Roxcooldown >= 600) - { - Roxcooldown = 0; - //"Why yes i did refresh the cooldown whatcha gonna do about it?" -cpntinues on OnHitNPC - Didrefresh = true; - } - return false; - } - else - { - for (int i = 0; i < 3; i++) - { - //Else shoot the spread of rock shards - int rotation = Main.rand.Next(-10, 11); - Vector2 pertubedspeed = new Vector2(speedX / 2, -10f * player.gravDir).RotatedBy(MathHelper.ToRadians(rotation)); - Projectile.NewProjectile(position.X, position.Y, pertubedspeed.X, pertubedspeed.Y, mod.ProjectileType("Rox1"), (int)((double)damage * 0.5), 1f, player.whoAmI, Main.rand.Next(3)); - } - RoxCanAlt = 0; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (item.useStyle == 4) + { + //Spawns a projectile on the tip of the sword in the alt fire + float positionx; + float positiony = position.Y + (item.height / 2) + 23; + ; + int cooldown = 0; + //Check if the entire cooldown has passed + if (Roxcooldown >= 600) + { + cooldown = 1; + } + // Makes the projectile spawn in the proper position on the X axis + if (player.direction == 1) + { + positionx = position.X + 6; + } + else + { + positionx = position.X - 8; + } + Projectile.NewProjectile(positionx, positiony, player.velocity.X, player.velocity.Y, mod.ProjectileType("RoxSlam"), 0, 0, player.whoAmI, cooldown); + //Resets the cooldown after shooting + if (Roxcooldown >= 600) + { + Roxcooldown = 0; + //"Why yes i did refresh the cooldown whatcha gonna do about it?" -cpntinues on OnHitNPC + Didrefresh = true; + } + return false; + } + else + { + for (int i = 0; i < 3; i++) + { + //Else shoot the spread of rock shards + int rotation = Main.rand.Next(-10, 11); + Vector2 pertubedspeed = new Vector2(speedX / 2, -10f * player.gravDir).RotatedBy(MathHelper.ToRadians(rotation)); + Projectile.NewProjectile(position.X, position.Y, pertubedspeed.X, pertubedspeed.Y, mod.ProjectileType("Rox1"), (int)((double)damage * 0.5), 1f, player.whoAmI, Main.rand.Next(3)); + } + RoxCanAlt = 0; - return false; - } - } + return false; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - if (item.useStyle == 4) - { - //"Well you did refresh the cooldown but like i dont want it to be wasted on an enemy hit so imma ask you for a refund" - if (Didrefresh) - { - Roxcooldown = 600; - Didrefresh = false; - } - //End the alt attack - player.itemAnimation = 0; - player.itemTime = 0; - RoxAlt = false; - RoxCanUse = 0; - player.velocity.Y = -16f; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + if (item.useStyle == 4) + { + //"Well you did refresh the cooldown but like i dont want it to be wasted on an enemy hit so imma ask you for a refund" + if (Didrefresh) + { + Roxcooldown = 600; + Didrefresh = false; + } + //End the alt attack + player.itemAnimation = 0; + player.itemTime = 0; + RoxAlt = false; + RoxCanUse = 0; + player.velocity.Y = -16f; + } + } + } } diff --git a/Items/Patreon/TheLastMourning.cs b/Items/Patreon/TheLastMourning.cs index 06bd1faf29..f38a736d47 100644 --- a/Items/Patreon/TheLastMourning.cs +++ b/Items/Patreon/TheLastMourning.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,106 +7,106 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class TheLastMourning : ModItem - { - public static int BaseDamage = 480; + { + public static int BaseDamage = 480; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Last Mourning"); - Tooltip.SetDefault("Summons flaming pumpkins and mourning skulls that split into fire orbs on enemy hits"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Last Mourning"); + Tooltip.SetDefault("Summons flaming pumpkins and mourning skulls that split into fire orbs on enemy hits"); + } - public override void SetDefaults() - { - item.width = 94; - item.height = 94; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = 8.5f; - item.useAnimation = 24; - item.useTime = 24; - item.autoReuse = true; - item.useTurn = true; + public override void SetDefaults() + { + item.width = 94; + item.height = 94; + item.melee = true; + item.damage = BaseDamage; + item.knockBack = 8.5f; + item.useAnimation = 24; + item.useTime = 24; + item.autoReuse = true; + item.useTurn = true; - item.useStyle = 1; - item.UseSound = SoundID.Item1; + item.useStyle = 1; + item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(1, 40, 0, 0); - } + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 40, 0, 0); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - int logicCheckScreenHeight = Main.LogicCheckScreenHeight; - int logicCheckScreenWidth = Main.LogicCheckScreenWidth; - int num = Main.rand.Next(100, 300); - int num2 = Main.rand.Next(100, 300); - switch (Main.rand.Next(4)) - { - case 0: - num -= logicCheckScreenWidth / 2 + num; - break; - case 1: - num += logicCheckScreenWidth / 2 - num; - break; - case 2: - num2 -= logicCheckScreenHeight / 2 + num2; - break; - case 3: - num2 += logicCheckScreenHeight / 2 - num2; - break; - default: - break; - } - num += (int)player.position.X; - num2 += (int)player.position.Y; - float speed = 8f; - Vector2 vector = new Vector2((float)num, (float)num2); - float num3 = target.position.X - vector.X; - float num4 = target.position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - num5 = speed / num5; - num3 *= num5; - num4 *= num5; - Projectile.NewProjectile((float)num, (float)num2, num3, num4, mod.ProjectileType("MourningSkull"), (int)((float)item.damage * player.meleeDamage * 1.5f), knockback, player.whoAmI, (float)target.whoAmI, 0f); - CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * player.meleeDamage * 1.5f), knockback, true); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int logicCheckScreenHeight = Main.LogicCheckScreenHeight; + int logicCheckScreenWidth = Main.LogicCheckScreenWidth; + int num = Main.rand.Next(100, 300); + int num2 = Main.rand.Next(100, 300); + switch (Main.rand.Next(4)) + { + case 0: + num -= logicCheckScreenWidth / 2 + num; + break; + case 1: + num += logicCheckScreenWidth / 2 - num; + break; + case 2: + num2 -= logicCheckScreenHeight / 2 + num2; + break; + case 3: + num2 += logicCheckScreenHeight / 2 - num2; + break; + default: + break; + } + num += (int)player.position.X; + num2 += (int)player.position.Y; + float speed = 8f; + Vector2 vector = new Vector2((float)num, (float)num2); + float num3 = target.position.X - vector.X; + float num4 = target.position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + num5 = speed / num5; + num3 *= num5; + num4 *= num5; + Projectile.NewProjectile((float)num, (float)num2, num3, num4, mod.ProjectileType("MourningSkull"), (int)((float)item.damage * player.meleeDamage * 1.5f), knockback, player.whoAmI, (float)target.whoAmI, 0f); + CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * player.meleeDamage * 1.5f), knockback, true); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dustType = 5; - switch (Main.rand.Next(3)) - { - case 0: - dustType = 5; - break; - case 1: - dustType = 6; - break; - case 2: - dustType = 174; - break; - default: - break; - } - int dust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, dustType, (float)(player.direction * 2), 0f, 150, default, 1.3f); - Main.dust[dust].velocity *= 0.2f; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dustType = 5; + switch (Main.rand.Next(3)) + { + case 0: + dustType = 5; + break; + case 1: + dustType = 6; + break; + case 2: + dustType = 174; + break; + default: + break; + } + int dust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, dustType, (float)(player.direction * 2), 0f, 150, default, 1.3f); + Main.dust[dust].velocity *= 0.2f; + } + } - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "BalefulHarvester"); - r.AddIngredient(ItemID.SoulofNight, 30); - r.AddIngredient(null, "ReaperTooth", 5); - r.AddIngredient(null, "RuinousSoul", 3); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(null, "BalefulHarvester"); + r.AddIngredient(ItemID.SoulofNight, 30); + r.AddIngredient(null, "ReaperTooth", 5); + r.AddIngredient(null, "RuinousSoul", 3); + r.AddTile(TileID.LunarCraftingStation); + r.SetResult(this); + r.AddRecipe(); + } + } } diff --git a/Items/Patreon/ThePack.cs b/Items/Patreon/ThePack.cs index 7bf38c37d0..a73156a551 100644 --- a/Items/Patreon/ThePack.cs +++ b/Items/Patreon/ThePack.cs @@ -6,56 +6,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { public class ThePack : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Pack"); - Tooltip.SetDefault("Fires large homing rockets that explode into more homing mini rockets when in proximity to an enemy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Pack"); + Tooltip.SetDefault("Fires large homing rockets that explode into more homing mini rockets when in proximity to an enemy"); + } - public override void SetDefaults() - { - item.damage = 3000; - item.crit += 10; - item.ranged = true; - item.width = 96; - item.height = 40; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().postMoonLordRarity = 21; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("ThePackMissile"); - item.useAmmo = 771; - } + public override void SetDefaults() + { + item.damage = 3000; + item.crit += 10; + item.ranged = true; + item.width = 96; + item.height = 40; + item.useTime = 50; + item.useAnimation = 50; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 21; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("ThePackMissile"); + item.useAmmo = 771; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-40, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-40, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ThePackMissile"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ThePackMissile"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Scorpion"); - recipe.AddIngredient(ItemID.MarbleBlock, 50); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "ArmoredShell", 4); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Scorpion"); + recipe.AddIngredient(ItemID.MarbleBlock, 50); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "ArmoredShell", 4); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Patreon/YateveoBloom.cs b/Items/Patreon/YateveoBloom.cs index 03312e72e7..9e67094e74 100644 --- a/Items/Patreon/YateveoBloom.cs +++ b/Items/Patreon/YateveoBloom.cs @@ -4,92 +4,92 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Patreon { - public class YateveoBloom : ModItem - { - public static int BaseDamage = 30; - public static float ShootSpeed = 12f; + public class YateveoBloom : ModItem + { + public static int BaseDamage = 30; + public static float ShootSpeed = 12f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yateveo Bloom"); - Tooltip.SetDefault("A synthesis of jungle flora\n" + - "Throws a powerful rose flail\n" + - "Right click to stab with a flower spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yateveo Bloom"); + Tooltip.SetDefault("A synthesis of jungle flora\n" + + "Throws a powerful rose flail\n" + + "Right click to stab with a flower spear"); + } - public override void SetDefaults() - { - item.width = 42; - item.height = 62; - item.damage = BaseDamage; - item.knockBack = 5f; - item.useAnimation = 22; - item.useTime = 22; + public override void SetDefaults() + { + item.width = 42; + item.height = 62; + item.damage = BaseDamage; + item.knockBack = 5f; + item.useAnimation = 22; + item.useTime = 22; - item.noUseGraphic = true; - item.melee = true; - item.noMelee = true; - item.channel = true; - item.autoReuse = false; - item.useTurn = true; + item.noUseGraphic = true; + item.melee = true; + item.noMelee = true; + item.channel = true; + item.autoReuse = false; + item.useTurn = true; - item.useStyle = 5; - item.UseSound = SoundID.Item1; + item.useStyle = 5; + item.UseSound = SoundID.Item1; - item.rare = 2; - item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.Calamity().postMoonLordRarity = 21; + item.value = Item.buyPrice(0, 2, 0, 0); - item.shoot = mod.ProjectileType("YateveoBloom"); - item.shootSpeed = ShootSpeed; - } + item.shoot = mod.ProjectileType("YateveoBloom"); + item.shootSpeed = ShootSpeed; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.damage = 20; - item.channel = false; - item.useAnimation = 33; - item.useTime = 33; - item.shootSpeed = 4.5f; - } - else - { - item.damage = BaseDamage; - item.channel = true; - item.useAnimation = 22; - item.useTime = 22; - item.shootSpeed = ShootSpeed; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.damage = 20; + item.channel = false; + item.useAnimation = 33; + item.useTime = 33; + item.shootSpeed = 4.5f; + } + else + { + item.damage = BaseDamage; + item.channel = true; + item.useAnimation = 22; + item.useTime = 22; + item.shootSpeed = ShootSpeed; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YateveoBloomSpear"), damage, knockBack, player.whoAmI, 0f, 0f); - else - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YateveoBloom"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YateveoBloomSpear"), damage, knockBack, player.whoAmI, 0f, 0f); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YateveoBloom"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RichMahogany, 15); - recipe.AddIngredient(ItemID.JungleSpores, 12); - recipe.AddIngredient(ItemID.Stinger, 4); - recipe.AddIngredient(ItemID.Vine, 2); - recipe.AddIngredient(ItemID.JungleRose); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RichMahogany, 15); + recipe.AddIngredient(ItemID.JungleSpores, 12); + recipe.AddIngredient(ItemID.Stinger, 4); + recipe.AddIngredient(ItemID.Vine, 2); + recipe.AddIngredient(ItemID.JungleRose); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Perforator/BloodSample.cs b/Items/Perforator/BloodSample.cs index 4d38558df6..1ca5eedd1e 100644 --- a/Items/Perforator/BloodSample.cs +++ b/Items/Perforator/BloodSample.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Perforator { public class BloodSample : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Sample"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Sample"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; - } - } + public override void SetDefaults() + { + item.width = 16; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 2; + } + } } diff --git a/Items/Perforator/BloodyWormFood.cs b/Items/Perforator/BloodyWormFood.cs index a96ab14bfb..930041143a 100644 --- a/Items/Perforator/BloodyWormFood.cs +++ b/Items/Perforator/BloodyWormFood.cs @@ -5,46 +5,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Perforator { public class BloodyWormFood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Worm Food"); - Tooltip.SetDefault("Summons the Perforator Hive"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Worm Food"); + Tooltip.SetDefault("Summons the Perforator Hive"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 3; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 3; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneCrimson && !NPC.AnyNPCs(mod.NPCType("PerforatorHive")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneCrimson && !NPC.AnyNPCs(mod.NPCType("PerforatorHive")); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PerforatorHive")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PerforatorHive")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 9); - recipe.AddIngredient(null, "BloodSample", 5); - recipe.AddIngredient(ItemID.CrimtaneBar, 2); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Vertebrae, 9); + recipe.AddIngredient(null, "BloodSample", 5); + recipe.AddIngredient(ItemID.CrimtaneBar, 2); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Perforator/BloodyWormTooth.cs b/Items/Perforator/BloodyWormTooth.cs index 123d81161a..0280675cc3 100644 --- a/Items/Perforator/BloodyWormTooth.cs +++ b/Items/Perforator/BloodyWormTooth.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Perforator { @@ -19,14 +19,14 @@ namespace CalamityMod.Items.Perforator item.height = 15; item.value = Item.buyPrice(0, 9, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.bloodyWormTooth = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.bloodyWormTooth = true; } } } diff --git a/Items/Perforator/PerforatorBag.cs b/Items/Perforator/PerforatorBag.cs index 9deccbe29f..d8c307c656 100644 --- a/Items/Perforator/PerforatorBag.cs +++ b/Items/Perforator/PerforatorBag.cs @@ -1,59 +1,59 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.Utilities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Perforator { - public class PerforatorBag : ModItem - { - public override int BossBagNPC => mod.NPCType("PerforatorHive"); + public class PerforatorBag : ModItem + { + public override int BossBagNPC => mod.NPCType("PerforatorHive"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - // Materials - DropHelper.DropItem(player, ItemID.Vertebrae, 10, 20); - DropHelper.DropItem(player, ItemID.CrimtaneBar, 9, 14); - DropHelper.DropItem(player, mod.ItemType("BloodSample"), 30, 40); - DropHelper.DropItemCondition(player, ItemID.Ichor, Main.hardMode, 15, 30); + public override void OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, ItemID.Vertebrae, 10, 20); + DropHelper.DropItem(player, ItemID.CrimtaneBar, 9, 14); + DropHelper.DropItem(player, mod.ItemType("BloodSample"), 30, 40); + DropHelper.DropItemCondition(player, ItemID.Ichor, Main.hardMode, 15, 30); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("VeinBurster"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BloodyRupture"), 3); - DropHelper.DropItemChance(player, mod.ItemType("SausageMaker"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Aorta"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Eviscerator"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BloodBath"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BloodClotStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("ToothBall"), 3, 50, 75); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("VeinBurster"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BloodyRupture"), 3); + DropHelper.DropItemChance(player, mod.ItemType("SausageMaker"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Aorta"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Eviscerator"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BloodBath"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BloodClotStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("ToothBall"), 3, 50, 75); - // Equipment - DropHelper.DropItem(player, mod.ItemType("BloodyWormTooth")); + // Equipment + DropHelper.DropItem(player, mod.ItemType("BloodyWormTooth")); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("PerforatorMask"), 7); - DropHelper.DropItemChance(player, mod.ItemType("BloodyVein"), 10); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("PerforatorMask"), 7); + DropHelper.DropItemChance(player, mod.ItemType("BloodyVein"), 10); + } + } } diff --git a/Items/Permafrost/AbsoluteZero.cs b/Items/Permafrost/AbsoluteZero.cs index 8095ba0c32..5cff4c479b 100644 --- a/Items/Permafrost/AbsoluteZero.cs +++ b/Items/Permafrost/AbsoluteZero.cs @@ -6,30 +6,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class AbsoluteZero : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Absolute Zero"); - Tooltip.SetDefault("Ancient blade imbued with the Archmage of Ice's magic\nShoots dark ice crystals\nThe blade creates frost explosions on direct hits"); - } - public override void SetDefaults() - { - item.damage = 42; - item.melee = true; - item.width = 58; - item.height = 58; - item.useTime = 20; + { + DisplayName.SetDefault("Absolute Zero"); + Tooltip.SetDefault("Ancient blade imbued with the Archmage of Ice's magic\nShoots dark ice crystals\nThe blade creates frost explosions on direct hits"); + } + public override void SetDefaults() + { + item.damage = 42; + item.melee = true; + item.width = 58; + item.height = 58; + item.useTime = 20; item.useAnimation = 20; - item.useStyle = 1; - item.useTurn = false; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); + item.useStyle = 1; + item.useTurn = false; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DarkIceZero"); + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DarkIceZero"); item.shootSpeed = 3f; - } + } public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { target.AddBuff(BuffID.Frostburn, 600); diff --git a/Items/Permafrost/ArcticBearPaw.cs b/Items/Permafrost/ArcticBearPaw.cs index 49da24f197..2c6eaf87c7 100644 --- a/Items/Permafrost/ArcticBearPaw.cs +++ b/Items/Permafrost/ArcticBearPaw.cs @@ -5,32 +5,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class ArcticBearPaw : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arctic Bear Paw"); - Tooltip.SetDefault(@"Fires spiritual claws that ignore walls and confuse enemies + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Bear Paw"); + Tooltip.SetDefault(@"Fires spiritual claws that ignore walls and confuse enemies 'The savage mauling that fits in your pocket'"); - } - public override void SetDefaults() - { - item.damage = 70; - item.magic = true; + } + public override void SetDefaults() + { + item.damage = 70; + item.magic = true; item.mana = 18; - item.width = 34; - item.height = 22; - item.useTime = 28; + item.width = 34; + item.height = 22; + item.useTime = 28; item.useAnimation = 28; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 10f; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 10f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ArcticBearPaw"); + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ArcticBearPaw"); item.shootSpeed = 27f; - } + } } } diff --git a/Items/Permafrost/ColdheartIcicle.cs b/Items/Permafrost/ColdheartIcicle.cs index 6d700f7058..2456b3bfa1 100644 --- a/Items/Permafrost/ColdheartIcicle.cs +++ b/Items/Permafrost/ColdheartIcicle.cs @@ -5,28 +5,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class ColdheartIcicle : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Coldheart Icicle"); - Tooltip.SetDefault("Drains a percentage of enemy health on hit\nCannot inflict critical hits"); - } - public override void SetDefaults() - { - item.damage = 1; - item.melee = true; - item.width = 26; - item.height = 26; + { + DisplayName.SetDefault("Coldheart Icicle"); + Tooltip.SetDefault("Drains a percentage of enemy health on hit\nCannot inflict critical hits"); + } + public override void SetDefaults() + { + item.damage = 1; + item.melee = true; + item.width = 26; + item.height = 26; item.useTime = 27; item.useAnimation = 27; item.autoReuse = true; item.useStyle = 3; item.UseSound = SoundID.Item1; item.useTurn = true; - item.knockBack = 3f; + item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - } + } public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) { damage = target.statLifeMax2 * 2 / 100; diff --git a/Items/Permafrost/CryogenicStaff.cs b/Items/Permafrost/CryogenicStaff.cs index cc72a60556..6d56344819 100644 --- a/Items/Permafrost/CryogenicStaff.cs +++ b/Items/Permafrost/CryogenicStaff.cs @@ -6,32 +6,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class CryogenicStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogenic Staff"); - Tooltip.SetDefault(@"Summons an animated ice construct to protect you + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogenic Staff"); + Tooltip.SetDefault(@"Summons an animated ice construct to protect you Fire rate and range increase the longer it targets an enemy"); - } + } - public override void SetDefaults() - { - item.damage = 56; + public override void SetDefaults() + { + item.damage = 56; item.mana = 10; - item.summon = true; + item.summon = true; item.sentry = true; - item.width = 40; - item.height = 40; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 4f; + item.width = 40; + item.height = 40; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item78; - item.shoot = mod.ProjectileType("IceSentry"); - } + item.UseSound = SoundID.Item78; + item.shoot = mod.ProjectileType("IceSentry"); + } public override bool AltFunctionUse(Player player) { @@ -49,7 +49,7 @@ Fire rate and range increase the longer it targets an enemy"); player.UpdateMaxTurrets(); } return false; - } + } public override bool UseItem(Player player) { diff --git a/Items/Permafrost/DeliciousMeat.cs b/Items/Permafrost/DeliciousMeat.cs index 9da1f59067..095c8ba1cb 100644 --- a/Items/Permafrost/DeliciousMeat.cs +++ b/Items/Permafrost/DeliciousMeat.cs @@ -5,17 +5,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class DeliciousMeat : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Delicious Meat"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Delicious Meat"); Tooltip.SetDefault("Minor improvements to all stats\n'So very delicious'"); } - public override void SetDefaults() - { - item.width = 32; - item.height = 30; - item.value = Item.buyPrice(0, 0, 50, 0); + public override void SetDefaults() + { + item.width = 32; + item.height = 30; + item.value = Item.buyPrice(0, 0, 50, 0); item.rare = 5; item.maxStack = 30; item.consumable = true; diff --git a/Items/Permafrost/EnchantedMetal.cs b/Items/Permafrost/EnchantedMetal.cs index b82fc13ea6..7c2fc5643e 100644 --- a/Items/Permafrost/EnchantedMetal.cs +++ b/Items/Permafrost/EnchantedMetal.cs @@ -5,19 +5,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class EnchantedMetal : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Enchanted Metal"); - } - public override void SetDefaults() - { - item.width = 26; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enchanted Metal"); + } + public override void SetDefaults() + { + item.width = 26; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; item.maxStack = 99; - } + } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Permafrost/EternalBlizzard.cs b/Items/Permafrost/EternalBlizzard.cs index aa39d71d15..7a071a61e3 100644 --- a/Items/Permafrost/EternalBlizzard.cs +++ b/Items/Permafrost/EternalBlizzard.cs @@ -6,32 +6,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class EternalBlizzard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eternal Blizzard"); - Tooltip.SetDefault("Wooden arrows turn into icicle arrows that shatter on impact"); - } - public override void SetDefaults() - { - item.damage = 48; - item.ranged = true; - item.width = 42; - item.height = 62; - item.useTime = 19; + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eternal Blizzard"); + Tooltip.SetDefault("Wooden arrows turn into icicle arrows that shatter on impact"); + } + public override void SetDefaults() + { + item.damage = 48; + item.ranged = true; + item.width = 42; + item.height = 62; + item.useTime = 19; item.useAnimation = 19; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 3f; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.useAmmo = AmmoID.Arrow; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("IcicleArrow"); + item.useAmmo = AmmoID.Arrow; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("IcicleArrow"); item.shootSpeed = 11f; - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (type == ProjectileID.WoodenArrowFriendly) diff --git a/Items/Permafrost/FrostbiteBlaster.cs b/Items/Permafrost/FrostbiteBlaster.cs index 1168dfd0eb..80be5fc7af 100644 --- a/Items/Permafrost/FrostbiteBlaster.cs +++ b/Items/Permafrost/FrostbiteBlaster.cs @@ -6,33 +6,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class FrostbiteBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frostbite Blaster"); - Tooltip.SetDefault("Fires a spread of icicles"); - } - public override void SetDefaults() - { - item.damage = 31; - item.ranged = true; - item.width = 54; - item.height = 30; - item.useTime = 7; + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frostbite Blaster"); + Tooltip.SetDefault("Fires a spread of icicles"); + } + public override void SetDefaults() + { + item.damage = 31; + item.ranged = true; + item.width = 54; + item.height = 30; + item.useTime = 7; item.useAnimation = 21; item.reuseDelay = 54; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 5f; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.useAmmo = AmmoID.Bullet; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = ProjectileID.Blizzard; + item.useAmmo = AmmoID.Bullet; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = ProjectileID.Blizzard; item.shootSpeed = 9f; - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Main.PlaySound(SoundID.Item36, position); diff --git a/Items/Permafrost/IcicleArrow.cs b/Items/Permafrost/IcicleArrow.cs index fc18ddaf45..681fd6f6a5 100644 --- a/Items/Permafrost/IcicleArrow.cs +++ b/Items/Permafrost/IcicleArrow.cs @@ -5,27 +5,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class IcicleArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Arrow"); - Tooltip.SetDefault("Shatters into shards on impact"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle Arrow"); + Tooltip.SetDefault("Shatters into shards on impact"); + } - public override void SetDefaults() - { - item.damage = 14; - item.ranged = true; + public override void SetDefaults() + { + item.damage = 14; + item.ranged = true; item.consumable = true; item.width = 14; - item.height = 50; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 0, 0, 15); + item.height = 50; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 0, 0, 15); item.rare = 3; - item.shoot = mod.ProjectileType("IcicleArrow"); + item.shoot = mod.ProjectileType("IcicleArrow"); item.shootSpeed = 1.0f; - item.ammo = AmmoID.Arrow; + item.ammo = AmmoID.Arrow; item.maxStack = 999; - } + } } } diff --git a/Items/Permafrost/IcicleTrident.cs b/Items/Permafrost/IcicleTrident.cs index 184a520471..a4e796fec3 100644 --- a/Items/Permafrost/IcicleTrident.cs +++ b/Items/Permafrost/IcicleTrident.cs @@ -6,33 +6,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class IcicleTrident : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Trident"); - Tooltip.SetDefault("Shoots piercing icicles"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle Trident"); + Tooltip.SetDefault("Shoots piercing icicles"); Item.staff[item.type] = true; - } - public override void SetDefaults() - { - item.damage = 69; - item.magic = true; + } + public override void SetDefaults() + { + item.damage = 69; + item.magic = true; item.mana = 21; - item.width = 64; - item.height = 64; - item.useTime = 25; + item.width = 64; + item.height = 64; + item.useTime = 25; item.useAnimation = 25; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 7f; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TridentIcicle"); + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TridentIcicle"); item.shootSpeed = 12f; - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 speed = new Vector2(speedX, speedY); diff --git a/Items/Permafrost/IcyBullet.cs b/Items/Permafrost/IcyBullet.cs index 3aeb409dcf..08314aac22 100644 --- a/Items/Permafrost/IcyBullet.cs +++ b/Items/Permafrost/IcyBullet.cs @@ -5,26 +5,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { public class IcyBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icy Bullet"); - Tooltip.SetDefault("Can hit up to three times\nBreaks into ice shards on last impact"); - } - public override void SetDefaults() - { - item.damage = 10; - item.ranged = true; + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icy Bullet"); + Tooltip.SetDefault("Can hit up to three times\nBreaks into ice shards on last impact"); + } + public override void SetDefaults() + { + item.damage = 10; + item.ranged = true; item.consumable = true; - item.width = 18; - item.height = 16; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 0, 0, 15); + item.width = 18; + item.height = 16; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 0, 0, 15); item.rare = 3; - item.shoot = mod.ProjectileType("IcyBullet"); + item.shoot = mod.ProjectileType("IcyBullet"); item.shootSpeed = 5f; item.ammo = AmmoID.Bullet; item.maxStack = 999; - } + } } } diff --git a/Items/Permafrost/PermafrostsConcoction.cs b/Items/Permafrost/PermafrostsConcoction.cs index c771fd906e..3871cac048 100644 --- a/Items/Permafrost/PermafrostsConcoction.cs +++ b/Items/Permafrost/PermafrostsConcoction.cs @@ -1,29 +1,28 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Permafrost { public class PermafrostsConcoction : ModItem - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Permafrost's Concoction"); - Tooltip.SetDefault(@"Increases maximum mana by 50 + { + DisplayName.SetDefault("Permafrost's Concoction"); + Tooltip.SetDefault(@"Increases maximum mana by 50 Increases life regen as life decreases Increases life regen when afflicted with Poison, On Fire, or Brimstone Flames You will survive fatal damage and revive with 30% life on a 3 minute cooldown You are encased in an ice barrier for 5 seconds when revived"); - } + } - public override void SetDefaults() - { - item.accessory = true; - item.width = 36; - item.height = 34; - item.value = Item.buyPrice(0, 45, 0, 0); + public override void SetDefaults() + { + item.accessory = true; + item.width = 36; + item.height = 34; + item.value = Item.buyPrice(0, 45, 0, 0); item.rare = 5; - } + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Permafrost/Popo.cs b/Items/Permafrost/Popo.cs index dba2e12327..37c13d9a32 100644 --- a/Items/Permafrost/Popo.cs +++ b/Items/Permafrost/Popo.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Permafrost { @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Permafrost } } - public class PopoNoselessHead : EquipTexture + public class PopoNoselessHead : EquipTexture { public override bool DrawHead() { diff --git a/Items/Permafrost/WintersFury.cs b/Items/Permafrost/WintersFury.cs index 956ff8134c..17ed4f1b6c 100644 --- a/Items/Permafrost/WintersFury.cs +++ b/Items/Permafrost/WintersFury.cs @@ -1,39 +1,39 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Permafrost { - public class WintersFury : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Winter's Fury"); - Tooltip.SetDefault("The pages are freezing to the touch"); - } - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; + public class WintersFury : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Winter's Fury"); + Tooltip.SetDefault("The pages are freezing to the touch"); + } + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; item.mana = 7; - item.width = 28; - item.height = 30; - item.useTime = 9; + item.width = 28; + item.height = 30; + item.useTime = 9; item.useAnimation = 9; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 5f; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item9; + item.UseSound = SoundID.Item9; item.scale = 0.9f; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Icicle"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("Icicle"); item.shootSpeed = 12f; - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (Main.rand.Next(3) != 0) diff --git a/Items/PermanentBoosters/BloodOrange.cs b/Items/PermanentBoosters/BloodOrange.cs index 31907e4873..79dfab5ada 100644 --- a/Items/PermanentBoosters/BloodOrange.cs +++ b/Items/PermanentBoosters/BloodOrange.cs @@ -1,68 +1,68 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class BloodOrange : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Orange"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Orange"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 5; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 5; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.bOrange || player.statLifeMax < 500) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.bOrange || player.statLifeMax < 500) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.bOrange = true; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.bOrange = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "EssenceofChaos", 5); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddIngredient(null, "EssenceofEleum", 5); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ItemID.SoulofLight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "EssenceofChaos", 5); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddIngredient(null, "EssenceofEleum", 5); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddIngredient(ItemID.SoulofLight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index 78720e27bd..07e71ae26e 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -1,64 +1,64 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class CometShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet Shard"); - Tooltip.SetDefault("Permanently increases maximum mana by 50"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet Shard"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 5; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item29; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 5; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.cShard) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.cShard) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(50); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.cShard = true; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.cShard = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddIngredient(ItemID.FallenStar, 50); - recipe.AddIngredient(null, "Stardust", 150); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddIngredient(ItemID.FallenStar, 50); + recipe.AddIngredient(null, "Stardust", 150); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index 810452e53f..806b43271c 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -1,70 +1,70 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class Dragonfruit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragonfruit"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragonfruit"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 14; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.dFruit || player.statLifeMax < 500) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.dFruit || player.statLifeMax < 500) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dFruit = true; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dFruit = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(ItemID.FragmentSolar, 15); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(ItemID.FragmentSolar, 15); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index 206c401ac2..b09f95bfd6 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -1,53 +1,53 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class Ectoheart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ectoheart"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ectoheart"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + "Revengeance drop"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 13; + } public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.adrenalineBoostThree) - { - return false; - } - return true; - } + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.adrenalineBoostThree) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.adrenalineBoostThree = true; - } - return true; - } - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.adrenalineBoostThree = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/Elderberry.cs b/Items/PermanentBoosters/Elderberry.cs index 42a35b52b3..175c402538 100644 --- a/Items/PermanentBoosters/Elderberry.cs +++ b/Items/PermanentBoosters/Elderberry.cs @@ -1,66 +1,66 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class Elderberry : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elderberry"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elderberry"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 10; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 10; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.eBerry || player.statLifeMax < 500) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.eBerry || player.statLifeMax < 500) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eBerry = true; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.eBerry = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "UeliaceBar", 10); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddIngredient(null, "UnholyEssence", 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "UeliaceBar", 10); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(null, "UnholyEssence", 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PermanentBoosters/ElectrolyteGelPack.cs b/Items/PermanentBoosters/ElectrolyteGelPack.cs index a04eda5d77..dd0ca7caa1 100644 --- a/Items/PermanentBoosters/ElectrolyteGelPack.cs +++ b/Items/PermanentBoosters/ElectrolyteGelPack.cs @@ -1,50 +1,50 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class ElectrolyteGelPack : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Electrolyte Gel Pack"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Electrolyte Gel Pack"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 4; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 4; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.adrenalineBoostOne) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.adrenalineBoostOne) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.adrenalineBoostOne = true; - } - return true; - } - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.adrenalineBoostOne = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index 6e46b60369..72d77e8a11 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -1,65 +1,65 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class EtherealCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ethereal Core"); - Tooltip.SetDefault("Permanently increases maximum mana by 50"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ethereal Core"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 10; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item29; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 10; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.eCore) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.eCore) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(50); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eCore = true; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.eCore = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddIngredient(null, "AstralBar", 25); - recipe.AddIngredient(ItemID.FragmentNebula, 20); - recipe.AddIngredient(ItemID.FallenStar, 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 25); + recipe.AddIngredient(null, "AstralBar", 25); + recipe.AddIngredient(ItemID.FragmentNebula, 20); + recipe.AddIngredient(ItemID.FallenStar, 50); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PermanentBoosters/InfernalBlood.cs b/Items/PermanentBoosters/InfernalBlood.cs index 5489c49cb0..8b9e98d074 100644 --- a/Items/PermanentBoosters/InfernalBlood.cs +++ b/Items/PermanentBoosters/InfernalBlood.cs @@ -1,50 +1,50 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class InfernalBlood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernal Blood"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% (50% in Death Mode) more damage\n" + - "Revengeance drop"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernal Blood"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% (50% in Death Mode) more damage\n" + + "Revengeance drop"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 8; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 8; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rageBoostTwo) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.rageBoostTwo) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rageBoostTwo = true; - } - return true; - } - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rageBoostTwo = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/MLGRune2.cs b/Items/PermanentBoosters/MLGRune2.cs index dc8b86f181..3a6e1c39e7 100644 --- a/Items/PermanentBoosters/MLGRune2.cs +++ b/Items/PermanentBoosters/MLGRune2.cs @@ -1,56 +1,56 @@ -using Terraria; +using CalamityMod.CalPlayer; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { - public class MLGRune2 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestial Onion"); - Tooltip.SetDefault(@"Alien power pulses inside its layers + public class MLGRune2 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestial Onion"); + Tooltip.SetDefault(@"Alien power pulses inside its layers Consuming it does something that cannot be reversed"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.rare = 10; - item.maxStack = 99; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.rare = 10; + item.maxStack = 99; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.extraAccessoryML) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.extraAccessoryML) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) - { - player.itemTime = item.useTime; - modPlayer.extraAccessoryML = true; - if (!CalamityWorld.onionMode) - { - CalamityWorld.onionMode = true; - } - } - return true; - } - } + public override bool UseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) + { + player.itemTime = item.useTime; + modPlayer.extraAccessoryML = true; + if (!CalamityWorld.onionMode) + { + CalamityWorld.onionMode = true; + } + } + return true; + } + } } diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 705ca65fbc..f2063d72fe 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -1,66 +1,66 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class MiracleFruit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Miracle Fruit"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Miracle Fruit"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 7; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 7; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.mFruit || player.statLifeMax < 500) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.mFruit || player.statLifeMax < 500) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.mFruit = true; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.mFruit = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "AstralJelly", 5); - recipe.AddIngredient(null, "LivingShard", 10); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "AstralJelly", 5); + recipe.AddIngredient(null, "LivingShard", 10); + recipe.AddIngredient(null, "Stardust", 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PermanentBoosters/MushroomPlasmaRoot.cs b/Items/PermanentBoosters/MushroomPlasmaRoot.cs index f76c3d3587..9779a9a3f7 100644 --- a/Items/PermanentBoosters/MushroomPlasmaRoot.cs +++ b/Items/PermanentBoosters/MushroomPlasmaRoot.cs @@ -1,50 +1,50 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class MushroomPlasmaRoot : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mushroom Plasma Root"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% (50% in Death Mode) more damage\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mushroom Plasma Root"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% (50% in Death Mode) more damage\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 2; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 2; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rageBoostOne) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.rageBoostOne) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rageBoostOne = true; - } - return true; - } - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rageBoostOne = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index a18cf43966..ccef446bac 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -1,64 +1,64 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class PhantomHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Heart"); - Tooltip.SetDefault("Permanently increases maximum mana by 50"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Heart"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item29; - item.consumable = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 13; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.pHeart) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.pHeart) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(50); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.pHeart = true; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.pHeart = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RuinousSoul", 10); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RuinousSoul", 10); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index 31ffbc8e17..2563d35e6f 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -1,53 +1,53 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class RedLightningContainer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Lightning Container"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% (50% in Death Mode) more damage\n" + - "Revengeance drop"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Lightning Container"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% (50% in Death Mode) more damage\n" + + "Revengeance drop"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 6)); } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 12; + } public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rageBoostThree) - { - return false; - } - return true; - } + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.rageBoostThree) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rageBoostThree = true; - } - return true; - } - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rageBoostThree = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/StarlightFuelCell.cs b/Items/PermanentBoosters/StarlightFuelCell.cs index fa56ddb981..db4149db7c 100644 --- a/Items/PermanentBoosters/StarlightFuelCell.cs +++ b/Items/PermanentBoosters/StarlightFuelCell.cs @@ -1,50 +1,50 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PermanentBoosters { public class StarlightFuelCell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starlight Fuel Cell"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starlight Fuel Cell"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 7; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 7; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.adrenalineBoostTwo) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.adrenalineBoostTwo) + { + return false; + } + return true; + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.adrenalineBoostTwo = true; - } - return true; - } - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.adrenalineBoostTwo = true; + } + return true; + } + } } diff --git a/Items/Pets/BearEye.cs b/Items/Pets/BearEye.cs index 174b6f11f7..33765597f7 100644 --- a/Items/Pets/BearEye.cs +++ b/Items/Pets/BearEye.cs @@ -5,27 +5,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Pets { public class BearEye : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bear's Eye"); - Tooltip.SetDefault("Summons a pet guardian angel"); - } - public override void SetDefaults() - { + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bear's Eye"); + Tooltip.SetDefault("Summons a pet guardian angel"); + } + public override void SetDefaults() + { item.damage = 0; - item.useStyle = 1; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.width = 30; item.height = 30; item.value = Item.sellPrice(1, 0, 0, 0); item.shoot = mod.ProjectileType("Bear"); item.buffType = mod.BuffType("BearBuff"); - item.rare = 5; - item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); - } + item.rare = 5; + item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); + } public override void UseStyle(Player player) { @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Pets player.AddBuff(item.buffType, 15, true); } } - } + } } diff --git a/Items/Pets/CharredRelic.cs b/Items/Pets/CharredRelic.cs index f0c3318ffe..573842520f 100644 --- a/Items/Pets/CharredRelic.cs +++ b/Items/Pets/CharredRelic.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Pets { item.shoot = mod.ProjectileType("Brimgling"); item.buffType = mod.BuffType("BrimlingBuff"); - item.rare = 4; - item.UseSound = SoundID.NPCHit51; + item.rare = 4; + item.UseSound = SoundID.NPCHit51; } public override void UseStyle(Player player) diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index 7b7c74e18d..1efe6e2a1e 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -5,29 +5,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Pets { public class CosmicPlushie : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Plushie"); - Tooltip.SetDefault("Summons the devourer of the cosmos...?\nSharp objects possibly included\nSuppresses friendly red devils"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Plushie"); + Tooltip.SetDefault("Summons the devourer of the cosmos...?\nSharp objects possibly included\nSuppresses friendly red devils"); + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.damage = 0; - item.useStyle = 1; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 28; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.width = 28; item.height = 36; item.value = Item.sellPrice(0, 7, 0, 0); item.shoot = mod.ProjectileType("ChibiiDoggo"); item.buffType = mod.BuffType("ChibiiBuff"); - item.rare = 10; - item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); - item.Calamity().postMoonLordRarity = 14; - } + item.rare = 10; + item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); + item.Calamity().postMoonLordRarity = 14; + } public override void UseStyle(Player player) { @@ -36,5 +36,5 @@ namespace CalamityMod.Items.Pets player.AddBuff(item.buffType, 15, true); } } - } + } } diff --git a/Items/Pets/FoxDrive.cs b/Items/Pets/FoxDrive.cs index 54a376d588..aa326eb2b7 100644 --- a/Items/Pets/FoxDrive.cs +++ b/Items/Pets/FoxDrive.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = mod.ProjectileType("Fox"); item.buffType = mod.BuffType("Fox"); - item.rare = 9; - item.expert = true; + item.rare = 9; + item.expert = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/IbarakiBox.cs b/Items/Pets/IbarakiBox.cs index d7734df5d3..32325fec86 100644 --- a/Items/Pets/IbarakiBox.cs +++ b/Items/Pets/IbarakiBox.cs @@ -1,48 +1,43 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Pets { - public class IbarakiBox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hermit's Box of One Hundred Medicines"); - Tooltip.SetDefault("As the ice melts in the springs\n" + - "And waves wash the old moss’ hair…\n" + - "Thank you, Goodbye.\n" + - "While equipped, the player will spawn with full health rather than half.\n" + - "Summons the Third Sage"); - } + public class IbarakiBox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hermit's Box of One Hundred Medicines"); + Tooltip.SetDefault("As the ice melts in the springs\n" + + "And waves wash the old moss’ hair…\n" + + "Thank you, Goodbye.\n" + + "While equipped, the player will spawn with full health rather than half.\n" + + "Summons the Third Sage"); + } - public override void SetDefaults() - { - item.damage = 0; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 1; - item.noMelee = true; - item.width = 36; - item.height = 30; - item.UseSound = SoundID.Item3; - item.value = Item.buyPrice(0, 5, 0, 0); - item.shoot = mod.ProjectileType("ThirdSage"); - item.buffType = mod.BuffType("ThirdSageBuff"); - item.rare = 5; - } + public override void SetDefaults() + { + item.damage = 0; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.noMelee = true; + item.width = 36; + item.height = 30; + item.UseSound = SoundID.Item3; + item.value = Item.buyPrice(0, 5, 0, 0); + item.shoot = mod.ProjectileType("ThirdSage"); + item.buffType = mod.BuffType("ThirdSageBuff"); + item.rare = 5; + } - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 3600, true); - } - } - } + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } } diff --git a/Items/Pets/Levi.cs b/Items/Pets/Levi.cs index e174145ec3..7f4562cbfc 100644 --- a/Items/Pets/Levi.cs +++ b/Items/Pets/Levi.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = mod.ProjectileType("Levi"); item.buffType = mod.BuffType("Levi"); - item.rare = 10; - } + item.rare = 10; + } public override void UseStyle(Player player) { diff --git a/Items/Pets/RomajedaOrchid.cs b/Items/Pets/RomajedaOrchid.cs index 7db7aaae8c..b74535827a 100644 --- a/Items/Pets/RomajedaOrchid.cs +++ b/Items/Pets/RomajedaOrchid.cs @@ -5,28 +5,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Pets { public class RomajedaOrchid : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Romajeda Orchid"); - Tooltip.SetDefault("Summons a never forgotten friend"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Romajeda Orchid"); + Tooltip.SetDefault("Summons a never forgotten friend"); + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.damage = 0; - item.useStyle = 1; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.width = 30; item.height = 30; item.value = Item.sellPrice(1, 0, 0, 0); item.shoot = mod.ProjectileType("Kendra"); item.buffType = mod.BuffType("Kendra"); - item.rare = 5; - item.UseSound = SoundID.Item44; - } + item.rare = 5; + item.UseSound = SoundID.Item44; + } public override void UseStyle(Player player) { @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Pets player.AddBuff(item.buffType, 15, true); } } - } + } } diff --git a/Items/Pets/TrashmanTrashcan.cs b/Items/Pets/TrashmanTrashcan.cs index 9953e15ca0..9560bca032 100644 --- a/Items/Pets/TrashmanTrashcan.cs +++ b/Items/Pets/TrashmanTrashcan.cs @@ -5,27 +5,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Pets { public class TrashmanTrashcan : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trash Can"); - Tooltip.SetDefault("Summons the trash man"); - } - public override void SetDefaults() - { + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trash Can"); + Tooltip.SetDefault("Summons the trash man"); + } + public override void SetDefaults() + { item.damage = 0; - item.useStyle = 1; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.width = 30; item.height = 30; item.value = Item.sellPrice(0, 1, 0, 0); item.shoot = mod.ProjectileType("DannyDevito"); item.buffType = mod.BuffType("DannyDevito"); - item.rare = 5; - item.UseSound = SoundID.NPCDeath13; - } + item.rare = 5; + item.UseSound = SoundID.NPCDeath13; + } public override void UseStyle(Player player) { @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Pets player.AddBuff(item.buffType, 15, true); } } - } + } } diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs index 2c5770874f..abdd37f2f2 100644 --- a/Items/Placeables/AerialiteBrick.cs +++ b/Items/Placeables/AerialiteBrick.cs @@ -4,23 +4,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class AerialiteBrick : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("AerialiteBrick"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("AerialiteBrick"); } public override void AddRecipes() diff --git a/Items/Placeables/AerialiteBrickWall.cs b/Items/Placeables/AerialiteBrickWall.cs index a3d0afeaab..86e6705852 100644 --- a/Items/Placeables/AerialiteBrickWall.cs +++ b/Items/Placeables/AerialiteBrickWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class AerialiteBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class AerialiteBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("AerialiteBrickWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("AerialiteBrickWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("AerialiteBrick")); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/AerialiteOre.cs b/Items/Placeables/AerialiteOre.cs index cf58204eee..45623fc739 100644 --- a/Items/Placeables/AerialiteOre.cs +++ b/Items/Placeables/AerialiteOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 3; + item.rare = 3; } } } diff --git a/Items/Placeables/AstrageldonTrophy.cs b/Items/Placeables/AstrageldonTrophy.cs index 7ac911e68e..7015e9c0b1 100644 --- a/Items/Placeables/AstrageldonTrophy.cs +++ b/Items/Placeables/AstrageldonTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class AstrageldonTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus Trophy"); - } + public class AstrageldonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 19; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 19; + } + } } diff --git a/Items/Placeables/AstralBar.cs b/Items/Placeables/AstralBar.cs index 9ac9e3aba7..238e421d76 100644 --- a/Items/Placeables/AstralBar.cs +++ b/Items/Placeables/AstralBar.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Placeables item.maxStack = 99; item.rare = 9; item.value = Item.sellPrice(gold: 1, silver: 20); - } + } public override void AddRecipes() { diff --git a/Items/Placeables/AstralBrick.cs b/Items/Placeables/AstralBrick.cs index 8cb59ad6bf..05a1a42b0e 100644 --- a/Items/Placeables/AstralBrick.cs +++ b/Items/Placeables/AstralBrick.cs @@ -5,23 +5,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class AstralBrick : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("AstralBrick"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("AstralBrick"); } public override void AddRecipes() diff --git a/Items/Placeables/AstralBrickWall.cs b/Items/Placeables/AstralBrickWall.cs index c00fb0f16b..5607d92739 100644 --- a/Items/Placeables/AstralBrickWall.cs +++ b/Items/Placeables/AstralBrickWall.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class AstralBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class AstralBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("AstralBrickWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("AstralBrickWall"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("AstralBrick")); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/AstralChest.cs b/Items/Placeables/AstralChest.cs index cbce73a7b7..b35e4993d9 100644 --- a/Items/Placeables/AstralChest.cs +++ b/Items/Placeables/AstralChest.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class AstralChest : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 500; - item.createTile = mod.TileType("AstralChestLocked"); + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 500; + item.createTile = mod.TileType("AstralChestLocked"); } } } diff --git a/Items/Placeables/AstralMonolith.cs b/Items/Placeables/AstralMonolith.cs index a6f0103a7a..9ce2fa1192 100644 --- a/Items/Placeables/AstralMonolith.cs +++ b/Items/Placeables/AstralMonolith.cs @@ -5,23 +5,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class AstralMonolith : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("AstralMonolith"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("AstralMonolith"); } public override void AddRecipes() diff --git a/Items/Placeables/AstralMonolithWall.cs b/Items/Placeables/AstralMonolithWall.cs index d9312b4986..f3964477ce 100644 --- a/Items/Placeables/AstralMonolithWall.cs +++ b/Items/Placeables/AstralMonolithWall.cs @@ -5,23 +5,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class AstralMonolithWall : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("AstralMonolithWall"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("AstralMonolithWall"); } public override void AddRecipes() diff --git a/Items/Placeables/AstralOre.cs b/Items/Placeables/AstralOre.cs index 16ee410a99..04dffac6d2 100644 --- a/Items/Placeables/AstralOre.cs +++ b/Items/Placeables/AstralOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 36); - item.rare = 9; + item.rare = 9; } } } diff --git a/Items/Placeables/AstrumDeusTrophy.cs b/Items/Placeables/AstrumDeusTrophy.cs index 599816166b..1350af098a 100644 --- a/Items/Placeables/AstrumDeusTrophy.cs +++ b/Items/Placeables/AstrumDeusTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class AstrumDeusTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Trophy"); - } + public class AstrumDeusTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 20; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 20; + } + } } diff --git a/Items/Placeables/AuricOre.cs b/Items/Placeables/AuricOre.cs index 476f69f99a..ec01f181f9 100644 --- a/Items/Placeables/AuricOre.cs +++ b/Items/Placeables/AuricOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(gold: 2); - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } } } diff --git a/Items/Placeables/Banners/AeroSlimeBanner.cs b/Items/Placeables/Banners/AeroSlimeBanner.cs index 788eb96d72..fcd5138a78 100644 --- a/Items/Placeables/Banners/AeroSlimeBanner.cs +++ b/Items/Placeables/Banners/AeroSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AeroSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 90; - } - } + public class AeroSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 90; + } + } } diff --git a/Items/Placeables/Banners/AmberCrawlerBanner.cs b/Items/Placeables/Banners/AmberCrawlerBanner.cs index a7b58a3d19..f480d9a34f 100644 --- a/Items/Placeables/Banners/AmberCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmberCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AmberCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 72; - } - } + public class AmberCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 72; + } + } } diff --git a/Items/Placeables/Banners/AmethystCrawlerBanner.cs b/Items/Placeables/Banners/AmethystCrawlerBanner.cs index e79aba6dcd..3e34603c24 100644 --- a/Items/Placeables/Banners/AmethystCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmethystCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AmethystCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 66; - } - } + public class AmethystCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 66; + } + } } diff --git a/Items/Placeables/Banners/AngryDogBanner.cs b/Items/Placeables/Banners/AngryDogBanner.cs index 5e4d0d6054..b274256c85 100644 --- a/Items/Placeables/Banners/AngryDogBanner.cs +++ b/Items/Placeables/Banners/AngryDogBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AngryDogBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 59; - } - } + public class AngryDogBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 59; + } + } } diff --git a/Items/Placeables/Banners/AquaticAberrationBanner.cs b/Items/Placeables/Banners/AquaticAberrationBanner.cs index 694ad2a834..07e916374a 100644 --- a/Items/Placeables/Banners/AquaticAberrationBanner.cs +++ b/Items/Placeables/Banners/AquaticAberrationBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AquaticAberrationBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 10; - } - } + public class AquaticAberrationBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 10; + } + } } diff --git a/Items/Placeables/Banners/AquaticParasiteBanner.cs b/Items/Placeables/Banners/AquaticParasiteBanner.cs index a48bf2d9fc..bc2c54ac34 100644 --- a/Items/Placeables/Banners/AquaticParasiteBanner.cs +++ b/Items/Placeables/Banners/AquaticParasiteBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AquaticParasiteBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 0; - } - } + public class AquaticParasiteBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 0; + } + } } diff --git a/Items/Placeables/Banners/AquaticSeekerBanner.cs b/Items/Placeables/Banners/AquaticSeekerBanner.cs index e66e0fc252..3f0f21ee11 100644 --- a/Items/Placeables/Banners/AquaticSeekerBanner.cs +++ b/Items/Placeables/Banners/AquaticSeekerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AquaticSeekerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 6; - } - } + public class AquaticSeekerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 6; + } + } } diff --git a/Items/Placeables/Banners/AquaticUrchinBanner.cs b/Items/Placeables/Banners/AquaticUrchinBanner.cs index f67d5d1a03..418ab1d281 100644 --- a/Items/Placeables/Banners/AquaticUrchinBanner.cs +++ b/Items/Placeables/Banners/AquaticUrchinBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AquaticUrchinBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 7; - } - } + public class AquaticUrchinBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 7; + } + } } diff --git a/Items/Placeables/Banners/AriesBanner.cs b/Items/Placeables/Banners/AriesBanner.cs index 28f03d055b..7ba199a968 100644 --- a/Items/Placeables/Banners/AriesBanner.cs +++ b/Items/Placeables/Banners/AriesBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AriesBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 34; - } - } + public class AriesBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 34; + } + } } diff --git a/Items/Placeables/Banners/ArmoredDiggerBanner.cs b/Items/Placeables/Banners/ArmoredDiggerBanner.cs index c5e3e12d07..8814619b24 100644 --- a/Items/Placeables/Banners/ArmoredDiggerBanner.cs +++ b/Items/Placeables/Banners/ArmoredDiggerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ArmoredDiggerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 77; - } - } + public class ArmoredDiggerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 77; + } + } } diff --git a/Items/Placeables/Banners/AstralProbeBanner.cs b/Items/Placeables/Banners/AstralProbeBanner.cs index 0abc5e4282..2c08dc7c1a 100644 --- a/Items/Placeables/Banners/AstralProbeBanner.cs +++ b/Items/Placeables/Banners/AstralProbeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AstralProbeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 31; - } - } + public class AstralProbeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 31; + } + } } diff --git a/Items/Placeables/Banners/AstralSlimeBanner.cs b/Items/Placeables/Banners/AstralSlimeBanner.cs index 2b5b8e01f0..83ba3bcf57 100644 --- a/Items/Placeables/Banners/AstralSlimeBanner.cs +++ b/Items/Placeables/Banners/AstralSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AstralSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 35; - } - } + public class AstralSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 35; + } + } } diff --git a/Items/Placeables/Banners/AstralachneaBanner.cs b/Items/Placeables/Banners/AstralachneaBanner.cs index eeaba9c514..1ac1f28343 100644 --- a/Items/Placeables/Banners/AstralachneaBanner.cs +++ b/Items/Placeables/Banners/AstralachneaBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AstralachneaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 39; - } - } + public class AstralachneaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 39; + } + } } diff --git a/Items/Placeables/Banners/AtlasBanner.cs b/Items/Placeables/Banners/AtlasBanner.cs index 390dbd44fc..474ef69221 100644 --- a/Items/Placeables/Banners/AtlasBanner.cs +++ b/Items/Placeables/Banners/AtlasBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class AtlasBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 36; - } - } + public class AtlasBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 36; + } + } } diff --git a/Items/Placeables/Banners/BOHLDOHRBanner.cs b/Items/Placeables/Banners/BOHLDOHRBanner.cs index 9b1b43ba0c..18b242ec80 100644 --- a/Items/Placeables/Banners/BOHLDOHRBanner.cs +++ b/Items/Placeables/Banners/BOHLDOHRBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BOHLDOHRBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 87; - } - } + public class BOHLDOHRBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 87; + } + } } diff --git a/Items/Placeables/Banners/BigSightseerBanner.cs b/Items/Placeables/Banners/BigSightseerBanner.cs index 806b50b1aa..6772d5db30 100644 --- a/Items/Placeables/Banners/BigSightseerBanner.cs +++ b/Items/Placeables/Banners/BigSightseerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BigSightseerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 33; - } - } + public class BigSightseerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 33; + } + } } diff --git a/Items/Placeables/Banners/BlightedEyeBanner.cs b/Items/Placeables/Banners/BlightedEyeBanner.cs index 3ecba81329..b1a49d5599 100644 --- a/Items/Placeables/Banners/BlightedEyeBanner.cs +++ b/Items/Placeables/Banners/BlightedEyeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BlightedEyeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 54; - } - } + public class BlightedEyeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 54; + } + } } diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs index 6ff5435e79..8f3ad2509c 100644 --- a/Items/Placeables/Banners/BlindedAnglerBanner.cs +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BlindedAnglerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 104; - } - } + public class BlindedAnglerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 104; + } + } } diff --git a/Items/Placeables/Banners/BloatfishBanner.cs b/Items/Placeables/Banners/BloatfishBanner.cs index 9084ccaa60..8d279b1dde 100644 --- a/Items/Placeables/Banners/BloatfishBanner.cs +++ b/Items/Placeables/Banners/BloatfishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BloatfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 28; - } - } + public class BloatfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 28; + } + } } diff --git a/Items/Placeables/Banners/BloomSlimeBanner.cs b/Items/Placeables/Banners/BloomSlimeBanner.cs index 212a27bc7b..07862dcbfa 100644 --- a/Items/Placeables/Banners/BloomSlimeBanner.cs +++ b/Items/Placeables/Banners/BloomSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BloomSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 94; - } - } + public class BloomSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 94; + } + } } diff --git a/Items/Placeables/Banners/BobbitWormBanner.cs b/Items/Placeables/Banners/BobbitWormBanner.cs index 386cafc726..1c6ac28144 100644 --- a/Items/Placeables/Banners/BobbitWormBanner.cs +++ b/Items/Placeables/Banners/BobbitWormBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BobbitWormBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 29; - } - } + public class BobbitWormBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 29; + } + } } diff --git a/Items/Placeables/Banners/BoxJellyfishBanner.cs b/Items/Placeables/Banners/BoxJellyfishBanner.cs index d4ce488575..d8b9de83fc 100644 --- a/Items/Placeables/Banners/BoxJellyfishBanner.cs +++ b/Items/Placeables/Banners/BoxJellyfishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class BoxJellyfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 13; - } - } + public class BoxJellyfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 13; + } + } } diff --git a/Items/Placeables/Banners/CalamityEyeBanner.cs b/Items/Placeables/Banners/CalamityEyeBanner.cs index bd6f7ffbb3..ed64e612f1 100644 --- a/Items/Placeables/Banners/CalamityEyeBanner.cs +++ b/Items/Placeables/Banners/CalamityEyeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CalamityEyeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 55; - } - } + public class CalamityEyeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 55; + } + } } diff --git a/Items/Placeables/Banners/CatfishBanner.cs b/Items/Placeables/Banners/CatfishBanner.cs index 52729cbbf6..aa8bfef0e2 100644 --- a/Items/Placeables/Banners/CatfishBanner.cs +++ b/Items/Placeables/Banners/CatfishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CatfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 4; - } - } + public class CatfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 4; + } + } } diff --git a/Items/Placeables/Banners/ChaoticPufferBanner.cs b/Items/Placeables/Banners/ChaoticPufferBanner.cs index a7524c90bd..c37d73c200 100644 --- a/Items/Placeables/Banners/ChaoticPufferBanner.cs +++ b/Items/Placeables/Banners/ChaoticPufferBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ChaoticPufferBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 30; - } - } + public class ChaoticPufferBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 30; + } + } } diff --git a/Items/Placeables/Banners/CharredSlimeBanner.cs b/Items/Placeables/Banners/CharredSlimeBanner.cs index 126cd5dddd..710ac986cd 100644 --- a/Items/Placeables/Banners/CharredSlimeBanner.cs +++ b/Items/Placeables/Banners/CharredSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CharredSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 93; - } - } + public class CharredSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 93; + } + } } diff --git a/Items/Placeables/Banners/ClamBanner.cs b/Items/Placeables/Banners/ClamBanner.cs index 9b17bf5d10..6157938db1 100644 --- a/Items/Placeables/Banners/ClamBanner.cs +++ b/Items/Placeables/Banners/ClamBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ClamBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 99; - } - } + public class ClamBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 99; + } + } } diff --git a/Items/Placeables/Banners/CloudElementalBanner.cs b/Items/Placeables/Banners/CloudElementalBanner.cs index e706e15f55..630e56be04 100644 --- a/Items/Placeables/Banners/CloudElementalBanner.cs +++ b/Items/Placeables/Banners/CloudElementalBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CloudElementalBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 58; - } - } + public class CloudElementalBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 58; + } + } } diff --git a/Items/Placeables/Banners/CnidrionBanner.cs b/Items/Placeables/Banners/CnidrionBanner.cs index 0fc677b83e..521116317d 100644 --- a/Items/Placeables/Banners/CnidrionBanner.cs +++ b/Items/Placeables/Banners/CnidrionBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CnidrionBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 63; - } - } + public class CnidrionBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 63; + } + } } diff --git a/Items/Placeables/Banners/ColossalSquidBanner.cs b/Items/Placeables/Banners/ColossalSquidBanner.cs index 90f794fefb..697c87395a 100644 --- a/Items/Placeables/Banners/ColossalSquidBanner.cs +++ b/Items/Placeables/Banners/ColossalSquidBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ColossalSquidBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 23; - } - } + public class ColossalSquidBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 23; + } + } } diff --git a/Items/Placeables/Banners/CosmicElementalBanner.cs b/Items/Placeables/Banners/CosmicElementalBanner.cs index bca429f3ec..007181251a 100644 --- a/Items/Placeables/Banners/CosmicElementalBanner.cs +++ b/Items/Placeables/Banners/CosmicElementalBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CosmicElementalBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 75; - } - } + public class CosmicElementalBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 75; + } + } } diff --git a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs index 9bc369cfb4..6c7c8fa1ec 100644 --- a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CrimulanBlightSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 89; - } - } + public class CrimulanBlightSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 89; + } + } } diff --git a/Items/Placeables/Banners/CryoSlimeBanner.cs b/Items/Placeables/Banners/CryoSlimeBanner.cs index 336718c196..7be46a3336 100644 --- a/Items/Placeables/Banners/CryoSlimeBanner.cs +++ b/Items/Placeables/Banners/CryoSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CryoSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 91; - } - } + public class CryoSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 91; + } + } } diff --git a/Items/Placeables/Banners/CryonBanner.cs b/Items/Placeables/Banners/CryonBanner.cs index 40f537ce2f..b1cc439525 100644 --- a/Items/Placeables/Banners/CryonBanner.cs +++ b/Items/Placeables/Banners/CryonBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CryonBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 60; - } - } + public class CryonBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 60; + } + } } diff --git a/Items/Placeables/Banners/CrystalCrawlerBanner.cs b/Items/Placeables/Banners/CrystalCrawlerBanner.cs index 0eaf270edf..a860768392 100644 --- a/Items/Placeables/Banners/CrystalCrawlerBanner.cs +++ b/Items/Placeables/Banners/CrystalCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CrystalCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 73; - } - } + public class CrystalCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 73; + } + } } diff --git a/Items/Placeables/Banners/CultistAssassinBanner.cs b/Items/Placeables/Banners/CultistAssassinBanner.cs index d3b180c4d4..cc06208a9f 100644 --- a/Items/Placeables/Banners/CultistAssassinBanner.cs +++ b/Items/Placeables/Banners/CultistAssassinBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CultistAssassinBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 95; - } - } + public class CultistAssassinBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 95; + } + } } diff --git a/Items/Placeables/Banners/CuttlefishBanner.cs b/Items/Placeables/Banners/CuttlefishBanner.cs index e44a85bf30..a093e6881e 100644 --- a/Items/Placeables/Banners/CuttlefishBanner.cs +++ b/Items/Placeables/Banners/CuttlefishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class CuttlefishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 16; - } - } + public class CuttlefishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 16; + } + } } diff --git a/Items/Placeables/Banners/DespairStoneBanner.cs b/Items/Placeables/Banners/DespairStoneBanner.cs index 8bff1f7371..7c0cfaa1e1 100644 --- a/Items/Placeables/Banners/DespairStoneBanner.cs +++ b/Items/Placeables/Banners/DespairStoneBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class DespairStoneBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 46; - } - } + public class DespairStoneBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 46; + } + } } diff --git a/Items/Placeables/Banners/DevilFishBanner.cs b/Items/Placeables/Banners/DevilFishBanner.cs index f15507e5b4..7fcb71627d 100644 --- a/Items/Placeables/Banners/DevilFishBanner.cs +++ b/Items/Placeables/Banners/DevilFishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class DevilFishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 15; - } - } + public class DevilFishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 15; + } + } } diff --git a/Items/Placeables/Banners/DiamondCrawlerBanner.cs b/Items/Placeables/Banners/DiamondCrawlerBanner.cs index 2a6003d633..e4950c1f78 100644 --- a/Items/Placeables/Banners/DiamondCrawlerBanner.cs +++ b/Items/Placeables/Banners/DiamondCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class DiamondCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 71; - } - } + public class DiamondCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 71; + } + } } diff --git a/Items/Placeables/Banners/EarthElementalBanner.cs b/Items/Placeables/Banners/EarthElementalBanner.cs index 7449be0e50..b73f48d787 100644 --- a/Items/Placeables/Banners/EarthElementalBanner.cs +++ b/Items/Placeables/Banners/EarthElementalBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class EarthElementalBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 76; - } - } + public class EarthElementalBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 76; + } + } } diff --git a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs index aa43e4096b..7cc931c7be 100644 --- a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class EbonianBlightSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 88; - } - } + public class EbonianBlightSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 88; + } + } } diff --git a/Items/Placeables/Banners/EidolistBanner.cs b/Items/Placeables/Banners/EidolistBanner.cs index 4c251463cd..832a960638 100644 --- a/Items/Placeables/Banners/EidolistBanner.cs +++ b/Items/Placeables/Banners/EidolistBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class EidolistBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 25; - } - } + public class EidolistBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 25; + } + } } diff --git a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs index c53804c937..f191383942 100644 --- a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs +++ b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class EidolonWyrmJuvenileBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 27; - } - } + public class EidolonWyrmJuvenileBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 27; + } + } } diff --git a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs index 018a291adf..aa25ac50fa 100644 --- a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs +++ b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class EmeraldCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 69; - } - } + public class EmeraldCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 69; + } + } } diff --git a/Items/Placeables/Banners/EutrophicRayBanner.cs b/Items/Placeables/Banners/EutrophicRayBanner.cs index 9313ef3ea2..ca9c1c8256 100644 --- a/Items/Placeables/Banners/EutrophicRayBanner.cs +++ b/Items/Placeables/Banners/EutrophicRayBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class EutrophicRayBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 100; - } - } + public class EutrophicRayBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 100; + } + } } diff --git a/Items/Placeables/Banners/FlounderBanner.cs b/Items/Placeables/Banners/FlounderBanner.cs index f045c54883..95f6070962 100644 --- a/Items/Placeables/Banners/FlounderBanner.cs +++ b/Items/Placeables/Banners/FlounderBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class FlounderBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 1; - } - } + public class FlounderBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 1; + } + } } diff --git a/Items/Placeables/Banners/FrogfishBanner.cs b/Items/Placeables/Banners/FrogfishBanner.cs index 9190524e54..3ff7c470af 100644 --- a/Items/Placeables/Banners/FrogfishBanner.cs +++ b/Items/Placeables/Banners/FrogfishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class FrogfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 8; - } - } + public class FrogfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 8; + } + } } diff --git a/Items/Placeables/Banners/FusionFeederBanner.cs b/Items/Placeables/Banners/FusionFeederBanner.cs index 1941ade897..e400761378 100644 --- a/Items/Placeables/Banners/FusionFeederBanner.cs +++ b/Items/Placeables/Banners/FusionFeederBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class FusionFeederBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 42; - } - } + public class FusionFeederBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 42; + } + } } diff --git a/Items/Placeables/Banners/GhostBellBanner.cs b/Items/Placeables/Banners/GhostBellBanner.cs index 3ce53ad658..4576c29971 100644 --- a/Items/Placeables/Banners/GhostBellBanner.cs +++ b/Items/Placeables/Banners/GhostBellBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class GhostBellBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 101; - } - } + public class GhostBellBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 101; + } + } } diff --git a/Items/Placeables/Banners/GhostBellSmallBanner.cs b/Items/Placeables/Banners/GhostBellSmallBanner.cs index 327bb062c1..0dd4c6fbd7 100644 --- a/Items/Placeables/Banners/GhostBellSmallBanner.cs +++ b/Items/Placeables/Banners/GhostBellSmallBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class GhostBellSmallBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 102; - } - } + public class GhostBellSmallBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 102; + } + } } diff --git a/Items/Placeables/Banners/GiantClamBanner.cs b/Items/Placeables/Banners/GiantClamBanner.cs index 253af98643..72056aecb4 100644 --- a/Items/Placeables/Banners/GiantClamBanner.cs +++ b/Items/Placeables/Banners/GiantClamBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class GiantClamBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 107; - } - } + public class GiantClamBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 107; + } + } } diff --git a/Items/Placeables/Banners/GiantSquidBanner.cs b/Items/Placeables/Banners/GiantSquidBanner.cs index a32c3f6e78..4aea6eff2c 100644 --- a/Items/Placeables/Banners/GiantSquidBanner.cs +++ b/Items/Placeables/Banners/GiantSquidBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class GiantSquidBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 20; - } - } + public class GiantSquidBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 20; + } + } } diff --git a/Items/Placeables/Banners/GnasherBanner.cs b/Items/Placeables/Banners/GnasherBanner.cs index 1bc34d3efc..1d3793987d 100644 --- a/Items/Placeables/Banners/GnasherBanner.cs +++ b/Items/Placeables/Banners/GnasherBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class GnasherBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 2; - } - } + public class GnasherBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 2; + } + } } diff --git a/Items/Placeables/Banners/GreatSandSharkBanner.cs b/Items/Placeables/Banners/GreatSandSharkBanner.cs index 6091a4f2d4..21393a045a 100644 --- a/Items/Placeables/Banners/GreatSandSharkBanner.cs +++ b/Items/Placeables/Banners/GreatSandSharkBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class GreatSandSharkBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 65; - } - } + public class GreatSandSharkBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 65; + } + } } diff --git a/Items/Placeables/Banners/GulperEelBanner.cs b/Items/Placeables/Banners/GulperEelBanner.cs index 14d7e95935..bd94d36436 100644 --- a/Items/Placeables/Banners/GulperEelBanner.cs +++ b/Items/Placeables/Banners/GulperEelBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class GulperEelBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 26; - } - } + public class GulperEelBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 26; + } + } } diff --git a/Items/Placeables/Banners/HadarianBanner.cs b/Items/Placeables/Banners/HadarianBanner.cs index 2bb7928d6f..ce02c15cb9 100644 --- a/Items/Placeables/Banners/HadarianBanner.cs +++ b/Items/Placeables/Banners/HadarianBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class HadarianBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 43; - } - } + public class HadarianBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 43; + } + } } diff --git a/Items/Placeables/Banners/HeatSpiritBanner.cs b/Items/Placeables/Banners/HeatSpiritBanner.cs index 01920c10e1..a564c7d0df 100644 --- a/Items/Placeables/Banners/HeatSpiritBanner.cs +++ b/Items/Placeables/Banners/HeatSpiritBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class HeatSpiritBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 44; - } - } + public class HeatSpiritBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 44; + } + } } diff --git a/Items/Placeables/Banners/HiveBanner.cs b/Items/Placeables/Banners/HiveBanner.cs index fd64b338cb..74e4871556 100644 --- a/Items/Placeables/Banners/HiveBanner.cs +++ b/Items/Placeables/Banners/HiveBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class HiveBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 40; - } - } + public class HiveBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 40; + } + } } diff --git a/Items/Placeables/Banners/IceClasperBanner.cs b/Items/Placeables/Banners/IceClasperBanner.cs index 6329c7cc01..30deeab751 100644 --- a/Items/Placeables/Banners/IceClasperBanner.cs +++ b/Items/Placeables/Banners/IceClasperBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class IceClasperBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 61; - } - } + public class IceClasperBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 61; + } + } } diff --git a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs index b08aa4c7e4..5a1257dfc4 100644 --- a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs +++ b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ImpiousImmolatorBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 48; - } - } + public class ImpiousImmolatorBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 48; + } + } } diff --git a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs index 7dd1c6c6f3..742e7f907a 100644 --- a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs +++ b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class IrradiatedSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 97; - } - } + public class IrradiatedSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 97; + } + } } diff --git a/Items/Placeables/Banners/LaserfishBanner.cs b/Items/Placeables/Banners/LaserfishBanner.cs index 708bd65cd7..af2cb34ef4 100644 --- a/Items/Placeables/Banners/LaserfishBanner.cs +++ b/Items/Placeables/Banners/LaserfishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class LaserfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 21; - } - } + public class LaserfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 21; + } + } } diff --git a/Items/Placeables/Banners/LuminousCorvinaBanner.cs b/Items/Placeables/Banners/LuminousCorvinaBanner.cs index c7c34a05e0..e48d4b7efa 100644 --- a/Items/Placeables/Banners/LuminousCorvinaBanner.cs +++ b/Items/Placeables/Banners/LuminousCorvinaBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class LuminousCorvinaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 19; - } - } + public class LuminousCorvinaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 19; + } + } } diff --git a/Items/Placeables/Banners/MantisBanner.cs b/Items/Placeables/Banners/MantisBanner.cs index 6b45326d96..5df060d36b 100644 --- a/Items/Placeables/Banners/MantisBanner.cs +++ b/Items/Placeables/Banners/MantisBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class MantisBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 37; - } - } + public class MantisBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 37; + } + } } diff --git a/Items/Placeables/Banners/MantisShrimpBanner.cs b/Items/Placeables/Banners/MantisShrimpBanner.cs index a35ccab3b2..31c39137af 100644 --- a/Items/Placeables/Banners/MantisShrimpBanner.cs +++ b/Items/Placeables/Banners/MantisShrimpBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class MantisShrimpBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 9; - } - } + public class MantisShrimpBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 9; + } + } } diff --git a/Items/Placeables/Banners/MaulerBanner.cs b/Items/Placeables/Banners/MaulerBanner.cs index ed076423a0..1ce65f60f1 100644 --- a/Items/Placeables/Banners/MaulerBanner.cs +++ b/Items/Placeables/Banners/MaulerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class MaulerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 5; - } - } + public class MaulerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 5; + } + } } diff --git a/Items/Placeables/Banners/MelterBanner.cs b/Items/Placeables/Banners/MelterBanner.cs index a1f2a559d9..6b646f1a40 100644 --- a/Items/Placeables/Banners/MelterBanner.cs +++ b/Items/Placeables/Banners/MelterBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class MelterBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 78; - } - } + public class MelterBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 78; + } + } } diff --git a/Items/Placeables/Banners/MirageJellyBanner.cs b/Items/Placeables/Banners/MirageJellyBanner.cs index 2226bcaf8d..024ac0abd2 100644 --- a/Items/Placeables/Banners/MirageJellyBanner.cs +++ b/Items/Placeables/Banners/MirageJellyBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class MirageJellyBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 24; - } - } + public class MirageJellyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 24; + } + } } diff --git a/Items/Placeables/Banners/MorayEelBanner.cs b/Items/Placeables/Banners/MorayEelBanner.cs index 48e9618f96..695760d107 100644 --- a/Items/Placeables/Banners/MorayEelBanner.cs +++ b/Items/Placeables/Banners/MorayEelBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class MorayEelBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 14; - } - } + public class MorayEelBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 14; + } + } } diff --git a/Items/Placeables/Banners/NovaBanner.cs b/Items/Placeables/Banners/NovaBanner.cs index e5e9773023..b07bdff51e 100644 --- a/Items/Placeables/Banners/NovaBanner.cs +++ b/Items/Placeables/Banners/NovaBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class NovaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 38; - } - } + public class NovaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 38; + } + } } diff --git a/Items/Placeables/Banners/OarfishBanner.cs b/Items/Placeables/Banners/OarfishBanner.cs index bd470e9428..e5c1df706b 100644 --- a/Items/Placeables/Banners/OarfishBanner.cs +++ b/Items/Placeables/Banners/OarfishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class OarfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 22; - } - } + public class OarfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 22; + } + } } diff --git a/Items/Placeables/Banners/OverloadedSoldierBanner.cs b/Items/Placeables/Banners/OverloadedSoldierBanner.cs index 1a82c17cf7..8c25c17779 100644 --- a/Items/Placeables/Banners/OverloadedSoldierBanner.cs +++ b/Items/Placeables/Banners/OverloadedSoldierBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class OverloadedSoldierBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 85; - } - } + public class OverloadedSoldierBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 85; + } + } } diff --git a/Items/Placeables/Banners/ParaseaBanner.cs b/Items/Placeables/Banners/ParaseaBanner.cs index 4c2f36425b..d8bb1536f3 100644 --- a/Items/Placeables/Banners/ParaseaBanner.cs +++ b/Items/Placeables/Banners/ParaseaBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ParaseaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 11; - } - } + public class ParaseaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 11; + } + } } diff --git a/Items/Placeables/Banners/PerennialSlimeBanner.cs b/Items/Placeables/Banners/PerennialSlimeBanner.cs index 4889833ef2..edd05a00e4 100644 --- a/Items/Placeables/Banners/PerennialSlimeBanner.cs +++ b/Items/Placeables/Banners/PerennialSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PerennialSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 92; - } - } + public class PerennialSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 92; + } + } } diff --git a/Items/Placeables/Banners/PestilentSlimeBanner.cs b/Items/Placeables/Banners/PestilentSlimeBanner.cs index 193d93ba31..a37a03f283 100644 --- a/Items/Placeables/Banners/PestilentSlimeBanner.cs +++ b/Items/Placeables/Banners/PestilentSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PestilentSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 79; - } - } + public class PestilentSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 79; + } + } } diff --git a/Items/Placeables/Banners/PhantomDebrisBanner.cs b/Items/Placeables/Banners/PhantomDebrisBanner.cs index 8fd2f1afc0..59de71dd58 100644 --- a/Items/Placeables/Banners/PhantomDebrisBanner.cs +++ b/Items/Placeables/Banners/PhantomDebrisBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PhantomDebrisBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 86; - } - } + public class PhantomDebrisBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 86; + } + } } diff --git a/Items/Placeables/Banners/PhantomSpiritBanner.cs b/Items/Placeables/Banners/PhantomSpiritBanner.cs index 790708ed93..8c4eb5abaf 100644 --- a/Items/Placeables/Banners/PhantomSpiritBanner.cs +++ b/Items/Placeables/Banners/PhantomSpiritBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PhantomSpiritBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 84; - } - } + public class PhantomSpiritBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 84; + } + } } diff --git a/Items/Placeables/Banners/PiggyBanner.cs b/Items/Placeables/Banners/PiggyBanner.cs index fc2f90a0e0..316c34aa2a 100644 --- a/Items/Placeables/Banners/PiggyBanner.cs +++ b/Items/Placeables/Banners/PiggyBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PiggyBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 108; - } - } + public class PiggyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 108; + } + } } diff --git a/Items/Placeables/Banners/PitbullBanner.cs b/Items/Placeables/Banners/PitbullBanner.cs index c81af0d5da..50e1497ada 100644 --- a/Items/Placeables/Banners/PitbullBanner.cs +++ b/Items/Placeables/Banners/PitbullBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PitbullBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 53; - } - } + public class PitbullBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 53; + } + } } diff --git a/Items/Placeables/Banners/PlagueChargerBanner.cs b/Items/Placeables/Banners/PlagueChargerBanner.cs index 64e45048f6..e02fabd0b0 100644 --- a/Items/Placeables/Banners/PlagueChargerBanner.cs +++ b/Items/Placeables/Banners/PlagueChargerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PlagueChargerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 81; - } - } + public class PlagueChargerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 81; + } + } } diff --git a/Items/Placeables/Banners/PlaguebringerBanner.cs b/Items/Placeables/Banners/PlaguebringerBanner.cs index a22330db84..c26de4c873 100644 --- a/Items/Placeables/Banners/PlaguebringerBanner.cs +++ b/Items/Placeables/Banners/PlaguebringerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PlaguebringerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 83; - } - } + public class PlaguebringerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 83; + } + } } diff --git a/Items/Placeables/Banners/PlagueshellBanner.cs b/Items/Placeables/Banners/PlagueshellBanner.cs index ec1f12dc2e..10e30c892a 100644 --- a/Items/Placeables/Banners/PlagueshellBanner.cs +++ b/Items/Placeables/Banners/PlagueshellBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PlagueshellBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 80; - } - } + public class PlagueshellBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 80; + } + } } diff --git a/Items/Placeables/Banners/PrismTurtleBanner.cs b/Items/Placeables/Banners/PrismTurtleBanner.cs index a3e709f5be..812804f73f 100644 --- a/Items/Placeables/Banners/PrismTurtleBanner.cs +++ b/Items/Placeables/Banners/PrismTurtleBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class PrismTurtleBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 98; - } - } + public class PrismTurtleBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 98; + } + } } diff --git a/Items/Placeables/Banners/ProfanedEnergyBanner.cs b/Items/Placeables/Banners/ProfanedEnergyBanner.cs index b16002bc35..54990cc594 100644 --- a/Items/Placeables/Banners/ProfanedEnergyBanner.cs +++ b/Items/Placeables/Banners/ProfanedEnergyBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ProfanedEnergyBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 50; - } - } + public class ProfanedEnergyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 50; + } + } } diff --git a/Items/Placeables/Banners/ReaperSharkBanner.cs b/Items/Placeables/Banners/ReaperSharkBanner.cs index 85c3942184..94966ffd21 100644 --- a/Items/Placeables/Banners/ReaperSharkBanner.cs +++ b/Items/Placeables/Banners/ReaperSharkBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ReaperSharkBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 96; - } - } + public class ReaperSharkBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 96; + } + } } diff --git a/Items/Placeables/Banners/RubyCrawlerBanner.cs b/Items/Placeables/Banners/RubyCrawlerBanner.cs index 4160bf0063..19b1c228b7 100644 --- a/Items/Placeables/Banners/RubyCrawlerBanner.cs +++ b/Items/Placeables/Banners/RubyCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class RubyCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 70; - } - } + public class RubyCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 70; + } + } } diff --git a/Items/Placeables/Banners/SandTortoiseBanner.cs b/Items/Placeables/Banners/SandTortoiseBanner.cs index dba895cee9..e6603e3713 100644 --- a/Items/Placeables/Banners/SandTortoiseBanner.cs +++ b/Items/Placeables/Banners/SandTortoiseBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SandTortoiseBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 64; - } - } + public class SandTortoiseBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 64; + } + } } diff --git a/Items/Placeables/Banners/SapphireCrawlerBanner.cs b/Items/Placeables/Banners/SapphireCrawlerBanner.cs index cf1e9d2825..d52f21ec56 100644 --- a/Items/Placeables/Banners/SapphireCrawlerBanner.cs +++ b/Items/Placeables/Banners/SapphireCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SapphireCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 68; - } - } + public class SapphireCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 68; + } + } } diff --git a/Items/Placeables/Banners/ScornEaterBanner.cs b/Items/Placeables/Banners/ScornEaterBanner.cs index b3c5a0a060..b87c9c0f73 100644 --- a/Items/Placeables/Banners/ScornEaterBanner.cs +++ b/Items/Placeables/Banners/ScornEaterBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ScornEaterBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 49; - } - } + public class ScornEaterBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 49; + } + } } diff --git a/Items/Placeables/Banners/ScryllarBanner.cs b/Items/Placeables/Banners/ScryllarBanner.cs index d217342ae9..5c9ec3ede0 100644 --- a/Items/Placeables/Banners/ScryllarBanner.cs +++ b/Items/Placeables/Banners/ScryllarBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ScryllarBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 45; - } - } + public class ScryllarBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 45; + } + } } diff --git a/Items/Placeables/Banners/SeaFloatyBanner.cs b/Items/Placeables/Banners/SeaFloatyBanner.cs index 7a0031f080..b61dd04947 100644 --- a/Items/Placeables/Banners/SeaFloatyBanner.cs +++ b/Items/Placeables/Banners/SeaFloatyBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SeaFloatyBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 103; - } - } + public class SeaFloatyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 103; + } + } } diff --git a/Items/Placeables/Banners/SeaMinnowBanner.cs b/Items/Placeables/Banners/SeaMinnowBanner.cs index 202e899f48..f1953c6233 100644 --- a/Items/Placeables/Banners/SeaMinnowBanner.cs +++ b/Items/Placeables/Banners/SeaMinnowBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SeaMinnowBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 105; - } - } + public class SeaMinnowBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 105; + } + } } diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs index 6eeacc915d..7a4d9d163d 100644 --- a/Items/Placeables/Banners/SeaSerpentBanner.cs +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SeaSerpentBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 106; - } - } + public class SeaSerpentBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 106; + } + } } diff --git a/Items/Placeables/Banners/SeaUrchinBanner.cs b/Items/Placeables/Banners/SeaUrchinBanner.cs index 3edb68ee5f..5a71ef1ef2 100644 --- a/Items/Placeables/Banners/SeaUrchinBanner.cs +++ b/Items/Placeables/Banners/SeaUrchinBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SeaUrchinBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 12; - } - } + public class SeaUrchinBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 12; + } + } } diff --git a/Items/Placeables/Banners/ShockstormShuttleBanner.cs b/Items/Placeables/Banners/ShockstormShuttleBanner.cs index 189c720aff..199cdccd48 100644 --- a/Items/Placeables/Banners/ShockstormShuttleBanner.cs +++ b/Items/Placeables/Banners/ShockstormShuttleBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ShockstormShuttleBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 57; - } - } + public class ShockstormShuttleBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 57; + } + } } diff --git a/Items/Placeables/Banners/SmallSightseerBanner.cs b/Items/Placeables/Banners/SmallSightseerBanner.cs index e4f4772e05..e26e903071 100644 --- a/Items/Placeables/Banners/SmallSightseerBanner.cs +++ b/Items/Placeables/Banners/SmallSightseerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SmallSightseerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 32; - } - } + public class SmallSightseerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 32; + } + } } diff --git a/Items/Placeables/Banners/SoulSluperBanner.cs b/Items/Placeables/Banners/SoulSluperBanner.cs index ea956dc03b..5bca028407 100644 --- a/Items/Placeables/Banners/SoulSluperBanner.cs +++ b/Items/Placeables/Banners/SoulSluperBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SoulSlurperBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 47; - } - } + public class SoulSlurperBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 47; + } + } } diff --git a/Items/Placeables/Banners/StellarCulexBanner.cs b/Items/Placeables/Banners/StellarCulexBanner.cs index db173d7044..438e7f3204 100644 --- a/Items/Placeables/Banners/StellarCulexBanner.cs +++ b/Items/Placeables/Banners/StellarCulexBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class StellarCulexBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 41; - } - } + public class StellarCulexBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 41; + } + } } diff --git a/Items/Placeables/Banners/StormlionBanner.cs b/Items/Placeables/Banners/StormlionBanner.cs index 83f396cf44..878a8ff5aa 100644 --- a/Items/Placeables/Banners/StormlionBanner.cs +++ b/Items/Placeables/Banners/StormlionBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class StormlionBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 62; - } - } + public class StormlionBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 62; + } + } } diff --git a/Items/Placeables/Banners/SunBatBanner.cs b/Items/Placeables/Banners/SunBatBanner.cs index 707a0b0ed3..a4c6cd8ce1 100644 --- a/Items/Placeables/Banners/SunBatBanner.cs +++ b/Items/Placeables/Banners/SunBatBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SunBatBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 74; - } - } + public class SunBatBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 74; + } + } } diff --git a/Items/Placeables/Banners/SunskaterBanner.cs b/Items/Placeables/Banners/SunskaterBanner.cs index 95ce0a0409..6f31f9a06a 100644 --- a/Items/Placeables/Banners/SunskaterBanner.cs +++ b/Items/Placeables/Banners/SunskaterBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class SunskaterBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 56; - } - } + public class SunskaterBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 56; + } + } } diff --git a/Items/Placeables/Banners/TopazCrawlerBanner.cs b/Items/Placeables/Banners/TopazCrawlerBanner.cs index 1cb1c5a71c..5a01e90abd 100644 --- a/Items/Placeables/Banners/TopazCrawlerBanner.cs +++ b/Items/Placeables/Banners/TopazCrawlerBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class TopazCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 67; - } - } + public class TopazCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 67; + } + } } diff --git a/Items/Placeables/Banners/ToxicMinnowBanner.cs b/Items/Placeables/Banners/ToxicMinnowBanner.cs index 268c4e00cc..952aac97cb 100644 --- a/Items/Placeables/Banners/ToxicMinnowBanner.cs +++ b/Items/Placeables/Banners/ToxicMinnowBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ToxicMinnowBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 17; - } - } + public class ToxicMinnowBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 17; + } + } } diff --git a/Items/Placeables/Banners/TrasherBanner.cs b/Items/Placeables/Banners/TrasherBanner.cs index 26ff62c516..1d1c3a5898 100644 --- a/Items/Placeables/Banners/TrasherBanner.cs +++ b/Items/Placeables/Banners/TrasherBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class TrasherBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 3; - } - } + public class TrasherBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 3; + } + } } diff --git a/Items/Placeables/Banners/ViperfishBanner.cs b/Items/Placeables/Banners/ViperfishBanner.cs index d36e64fa69..9035a5e72e 100644 --- a/Items/Placeables/Banners/ViperfishBanner.cs +++ b/Items/Placeables/Banners/ViperfishBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class ViperfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 18; - } - } + public class ViperfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 18; + } + } } diff --git a/Items/Placeables/Banners/VirulingBanner.cs b/Items/Placeables/Banners/VirulingBanner.cs index d5739cde1f..13a546e875 100644 --- a/Items/Placeables/Banners/VirulingBanner.cs +++ b/Items/Placeables/Banners/VirulingBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class VirulingBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 82; - } - } + public class VirulingBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 82; + } + } } diff --git a/Items/Placeables/Banners/WulfrumDroneBanner.cs b/Items/Placeables/Banners/WulfrumDroneBanner.cs index 40d829af9f..f0f1ce682d 100644 --- a/Items/Placeables/Banners/WulfrumDroneBanner.cs +++ b/Items/Placeables/Banners/WulfrumDroneBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class WulfrumDroneBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 52; - } - } + public class WulfrumDroneBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 52; + } + } } diff --git a/Items/Placeables/Banners/WulfrumSlimeBanner.cs b/Items/Placeables/Banners/WulfrumSlimeBanner.cs index 2d4f082cba..0609e604ef 100644 --- a/Items/Placeables/Banners/WulfrumSlimeBanner.cs +++ b/Items/Placeables/Banners/WulfrumSlimeBanner.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class WulfrumSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 51; - } - } + public class WulfrumSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 51; + } + } } diff --git a/Items/Placeables/BlueBrickWallUnsafe.cs b/Items/Placeables/BlueBrickWallUnsafe.cs index 5c5d8ddcb7..3ddf6c7f3e 100644 --- a/Items/Placeables/BlueBrickWallUnsafe.cs +++ b/Items/Placeables/BlueBrickWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/BlueSlabWallUnsafe.cs b/Items/Placeables/BlueSlabWallUnsafe.cs index 8902199425..4be95f47f8 100644 --- a/Items/Placeables/BlueSlabWallUnsafe.cs +++ b/Items/Placeables/BlueSlabWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/BlueTiledWallUnsafe.cs b/Items/Placeables/BlueTiledWallUnsafe.cs index 0f5f4ae968..6f9b53caa5 100644 --- a/Items/Placeables/BlueTiledWallUnsafe.cs +++ b/Items/Placeables/BlueTiledWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/BrimstoneElementalTrophy.cs b/Items/Placeables/BrimstoneElementalTrophy.cs index 9bc367ec18..545246e8e7 100644 --- a/Items/Placeables/BrimstoneElementalTrophy.cs +++ b/Items/Placeables/BrimstoneElementalTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class BrimstoneElementalTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental Trophy"); - } + public class BrimstoneElementalTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 21; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 21; + } + } } diff --git a/Items/Placeables/BumblebirbTrophy.cs b/Items/Placeables/BumblebirbTrophy.cs index faaa77ee82..ab790db5ab 100644 --- a/Items/Placeables/BumblebirbTrophy.cs +++ b/Items/Placeables/BumblebirbTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class BumblebirbTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bumblebirb Trophy"); - } + public class BumblebirbTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bumblebirb Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 18; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 18; + } + } } diff --git a/Items/Placeables/CalamitasTrophy.cs b/Items/Placeables/CalamitasTrophy.cs index a421c149db..16e6639b2f 100644 --- a/Items/Placeables/CalamitasTrophy.cs +++ b/Items/Placeables/CalamitasTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CalamitasTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas Trophy"); - } + public class CalamitasTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 7; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 7; + } + } } diff --git a/Items/Placeables/CataclysmTrophy.cs b/Items/Placeables/CataclysmTrophy.cs index 98d5bac9de..d92957dd20 100644 --- a/Items/Placeables/CataclysmTrophy.cs +++ b/Items/Placeables/CataclysmTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CataclysmTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm Trophy"); - } + public class CataclysmTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 16; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 16; + } + } } diff --git a/Items/Placeables/CatastropheTrophy.cs b/Items/Placeables/CatastropheTrophy.cs index 2f9c90f7af..82e714c177 100644 --- a/Items/Placeables/CatastropheTrophy.cs +++ b/Items/Placeables/CatastropheTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CatastropheTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe Trophy"); - } + public class CatastropheTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 15; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 15; + } + } } diff --git a/Items/Placeables/CeaselessVoidTrophy.cs b/Items/Placeables/CeaselessVoidTrophy.cs index b5c0ef0080..7e2c7304c7 100644 --- a/Items/Placeables/CeaselessVoidTrophy.cs +++ b/Items/Placeables/CeaselessVoidTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CeaselessVoidTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ceaseless Void Trophy"); - } + public class CeaselessVoidTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Void Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 13; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 13; + } + } } diff --git a/Items/Placeables/ChaosCandle.cs b/Items/Placeables/ChaosCandle.cs index b9d229ef39..24d2feecf2 100644 --- a/Items/Placeables/ChaosCandle.cs +++ b/Items/Placeables/ChaosCandle.cs @@ -1,39 +1,38 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Placeables { - public class ChaosCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Candle"); - Tooltip.SetDefault("The mere presence of this candle enrages surrounding enemies drastically"); - } + public class ChaosCandle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Candle"); + Tooltip.SetDefault("The mere presence of this candle enrages surrounding enemies drastically"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 500; - item.createTile = mod.TileType("ChaosCandle"); - } + public override void SetDefaults() + { + item.width = 16; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 500; + item.createTile = mod.TileType("ChaosCandle"); + } - public override void HoldItem(Player player) - { - player.Calamity().chaosCandle = true; - } + public override void HoldItem(Player player) + { + player.Calamity().chaosCandle = true; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.WaterCandle, 3); diff --git a/Items/Placeables/ChaoticOre.cs b/Items/Placeables/ChaoticOre.cs index b8574bb4ee..ffde86ab6c 100644 --- a/Items/Placeables/ChaoticOre.cs +++ b/Items/Placeables/ChaoticOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 24); - item.rare = 8; + item.rare = 8; } } } diff --git a/Items/Placeables/CharredOre.cs b/Items/Placeables/CharredOre.cs index b2930d9454..d4f619aea7 100644 --- a/Items/Placeables/CharredOre.cs +++ b/Items/Placeables/CharredOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; item.value = Item.sellPrice(silver: 15); - item.rare = 6; + item.rare = 6; } } } diff --git a/Items/Placeables/Cinderplate.cs b/Items/Placeables/Cinderplate.cs index f3da4da984..07b966b07d 100644 --- a/Items/Placeables/Cinderplate.cs +++ b/Items/Placeables/Cinderplate.cs @@ -25,22 +25,22 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 3; + item.rare = 3; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Hellstone, 6); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CinderplateWall", 4); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Hellstone, 6); + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.SetResult(this); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CinderplateWall", 4); + recipe.SetResult(this); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/CinderplateWall.cs b/Items/Placeables/CinderplateWall.cs index 97e94b19d2..332ef535a9 100644 --- a/Items/Placeables/CinderplateWall.cs +++ b/Items/Placeables/CinderplateWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CinderplateWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class CinderplateWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("CinderplateWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("CinderplateWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "Cinderplate"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/CrabulonTrophy.cs b/Items/Placeables/CrabulonTrophy.cs index 5a4719ca85..e8543a7f64 100644 --- a/Items/Placeables/CrabulonTrophy.cs +++ b/Items/Placeables/CrabulonTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CrabulonTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon Trophy"); - } + public class CrabulonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 9; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 9; + } + } } diff --git a/Items/Placeables/CryogenTrophy.cs b/Items/Placeables/CryogenTrophy.cs index 006a57ba44..02a2957ba7 100644 --- a/Items/Placeables/CryogenTrophy.cs +++ b/Items/Placeables/CryogenTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CryogenTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen Trophy"); - } + public class CryogenTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 3; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 3; + } + } } diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs index 41d825e947..b7fea5479f 100644 --- a/Items/Placeables/CryonicBrick.cs +++ b/Items/Placeables/CryonicBrick.cs @@ -4,23 +4,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class CryonicBrick : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CryonicBrick"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CryonicBrick"); } public override void AddRecipes() diff --git a/Items/Placeables/CryonicBrickWall.cs b/Items/Placeables/CryonicBrickWall.cs index 5122b80ca2..3792fc869d 100644 --- a/Items/Placeables/CryonicBrickWall.cs +++ b/Items/Placeables/CryonicBrickWall.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class CryonicBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class CryonicBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("CryonicBrickWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("CryonicBrickWall"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("CryonicBrick")); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/CryonicOre.cs b/Items/Placeables/CryonicOre.cs index 94cb6a69a2..654bf9b27d 100644 --- a/Items/Placeables/CryonicOre.cs +++ b/Items/Placeables/CryonicOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 12); - item.rare = 5; + item.rare = 5; } } } diff --git a/Items/Placeables/DesertScourgeTrophy.cs b/Items/Placeables/DesertScourgeTrophy.cs index 3a57ea6c25..a50f78d2f7 100644 --- a/Items/Placeables/DesertScourgeTrophy.cs +++ b/Items/Placeables/DesertScourgeTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class DesertScourgeTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge Trophy"); - } + public class DesertScourgeTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 0; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 0; + } + } } diff --git a/Items/Placeables/DevourerofGodsTrophy.cs b/Items/Placeables/DevourerofGodsTrophy.cs index 1d3cd82c8b..c545640f9d 100644 --- a/Items/Placeables/DevourerofGodsTrophy.cs +++ b/Items/Placeables/DevourerofGodsTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class DevourerofGodsTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devourer of Gods Trophy"); - } + public class DevourerofGodsTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Gods Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 14; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 14; + } + } } diff --git a/Items/Placeables/DraedonsForge.cs b/Items/Placeables/DraedonsForge.cs index 1febd4982b..ff1a3d7730 100644 --- a/Items/Placeables/DraedonsForge.cs +++ b/Items/Placeables/DraedonsForge.cs @@ -4,72 +4,72 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class DraedonsForge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draedon's Forge"); - Tooltip.SetDefault("Used to craft uber-tier items"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Forge"); + Tooltip.SetDefault("Used to craft uber-tier items"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 5000000; - item.rare = 10; - item.createTile = mod.TileType("DraedonsForge"); - item.Calamity().postMoonLordRarity = 20; - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 5000000; + item.rare = 10; + item.createTile = mod.TileType("DraedonsForge"); + item.Calamity().postMoonLordRarity = 20; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteForge); - recipe.AddIngredient(ItemID.MythrilAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumForge); - recipe.AddIngredient(ItemID.MythrilAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumForge); - recipe.AddIngredient(ItemID.OrichalcumAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteForge); - recipe.AddIngredient(ItemID.OrichalcumAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteForge); + recipe.AddIngredient(ItemID.MythrilAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumForge); + recipe.AddIngredient(ItemID.MythrilAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumForge); + recipe.AddIngredient(ItemID.OrichalcumAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteForge); + recipe.AddIngredient(ItemID.OrichalcumAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/EutrophicSand.cs b/Items/Placeables/EutrophicSand.cs index 3964916f98..ec43f76e4a 100644 --- a/Items/Placeables/EutrophicSand.cs +++ b/Items/Placeables/EutrophicSand.cs @@ -23,13 +23,13 @@ namespace CalamityMod.Items.Placeables item.maxStack = 999; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EutrophicSandWallSafe", 4); - recipe.AddTile(18); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EutrophicSandWallSafe", 4); + recipe.AddTile(18); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/ExodiumClusterOre.cs b/Items/Placeables/ExodiumClusterOre.cs index 27d73c5440..9810491ea0 100644 --- a/Items/Placeables/ExodiumClusterOre.cs +++ b/Items/Placeables/ExodiumClusterOre.cs @@ -25,20 +25,20 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(gold: 1, silver: 60); - item.rare = 10; + item.rare = 10; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarOre, 3); - recipe.AddIngredient(ItemID.FragmentStardust); - recipe.AddIngredient(ItemID.FragmentSolar); - recipe.AddIngredient(ItemID.FragmentVortex); - recipe.AddIngredient(ItemID.FragmentNebula); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarOre, 3); + recipe.AddIngredient(ItemID.FragmentStardust); + recipe.AddIngredient(ItemID.FragmentSolar); + recipe.AddIngredient(ItemID.FragmentVortex); + recipe.AddIngredient(ItemID.FragmentNebula); + recipe.SetResult(this); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssBath.cs b/Items/Placeables/FurnitureAbyss/AbyssBath.cs index c2176e1f3d..adf21923ae 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBath.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBath.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssBath : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Abyss Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; - item.consumable = true; - item.createTile = mod.TileType("AbyssBath"); - } + item.consumable = true; + item.createTile = mod.TileType("AbyssBath"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 14); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssBed.cs b/Items/Placeables/FurnitureAbyss/AbyssBed.cs index f0ac71e8e2..f9ffc4e422 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBed.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBed.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssBed : ModItem - { - public override void SetStaticDefaults() - { - } + public class AbyssBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssBed"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 15); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs index 0be09955e2..7b00f04698 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssBookcase : ModItem - { - public override void SetStaticDefaults() + public class AbyssBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssBookcase"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 20); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs index eea98dfce8..34912e7c1b 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssCandelabra : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssCandelabra"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs index d36899566b..ff4828f682 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssCandle : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssCandle"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 4); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssChair.cs b/Items/Placeables/FurnitureAbyss/AbyssChair.cs index b8fc62e851..d7d801648b 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChair.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChair.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } - public override void SetDefaults() - { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssChair"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 4); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs index 3852c8f78c..181ea79933 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssChandelier : ModItem - { - public override void SetStaticDefaults() - { - } + public class AbyssChandelier : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssChandelier"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 4); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssChest.cs b/Items/Placeables/FurnitureAbyss/AbyssChest.cs index 719678c5a2..55c1084918 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChest.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChest.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssChest : ModItem - { - public override void SetStaticDefaults() - { - } + public class AbyssChest : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssChest"); } diff --git a/Items/Placeables/FurnitureAbyss/AbyssClock.cs b/Items/Placeables/FurnitureAbyss/AbyssClock.cs index dac02ef974..8653d2947a 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssClock.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssClock.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssClock : ModItem - { - public override void SetStaticDefaults() - { - } + public class AbyssClock : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssClock"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 3); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs index fcebbe7424..2aafd90f6e 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssDoorClosed"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 6); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs index f429cdfbf0..d26dbc33d9 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssDresser : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssDresser"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 16); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs index e79864bf1a..873487143f 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssLamp : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssLamp"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel"); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs index bbbdd88c01..c5ac85c14e 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssLantern : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssLantern"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 6); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssPiano.cs b/Items/Placeables/FurnitureAbyss/AbyssPiano.cs index 3f62addbd1..5b0bd433d8 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssPiano.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssPiano.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssPiano : ModItem - { - public override void SetStaticDefaults() - { - } + public class AbyssPiano : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.SetNameOverride("Abyss Synth"); - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssPiano"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bone, 4); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssSink.cs b/Items/Placeables/FurnitureAbyss/AbyssSink.cs index bd273f5d56..68268ccf80 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSink.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSink.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssSink : ModItem - { - public override void SetStaticDefaults() + public class AbyssSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssSink"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 6); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs index f765fa58d5..e45934a622 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssSofa : ModItem - { - public override void SetStaticDefaults() - { - } + public class AbyssSofa : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssSofa"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssTable.cs b/Items/Placeables/FurnitureAbyss/AbyssTable.cs index ba4cf970a3..5f04b9ccd3 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTable.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTable.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssTable : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssTable"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 8); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs index 760d33ecf8..4e29363e3f 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs @@ -5,56 +5,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class AbyssTorch : ModItem - { - public override void SetStaticDefaults() + public class AbyssTorch : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Can be placed in water"); } - public override void SetDefaults() - { - item.width = 10; - item.height = 12; - item.maxStack = 99; - item.holdStyle = 1; - item.noWet = false; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("AbyssTorch"); - item.flame = false; - item.value = 500; - } + public override void SetDefaults() + { + item.width = 10; + item.height = 12; + item.maxStack = 99; + item.holdStyle = 1; + item.noWet = false; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("AbyssTorch"); + item.flame = false; + item.value = 500; + } - public override void HoldItem(Player player) - { - if (Main.rand.Next(player.itemAnimation > 0 ? 40 : 80) == 0) - { - Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, mod.DustType("Sparkle")); - } - Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); - Lighting.AddLight(position, 1f, 1f, 1f); - } + public override void HoldItem(Player player) + { + if (Main.rand.Next(player.itemAnimation > 0 ? 40 : 80) == 0) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, mod.DustType("Sparkle")); + } + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + Lighting.AddLight(position, 1f, 1f, 1f); + } - public override void PostUpdate() - { - if (!item.wet) - { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 1f, 1f); - } - } + public override void PostUpdate() + { + if (!item.wet) + { + Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 1f, 1f); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.AddIngredient(mod.GetItem("Lumenite")); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Torch, 3); + recipe.AddIngredient(mod.GetItem("Lumenite")); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs index a20e83bacc..4e1b235b83 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class AbyssWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Abyss Work Bench"); item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AbyssWorkbench"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel", 10); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs index c664670702..b4b594ad4a 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs @@ -3,27 +3,27 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss { public class SmoothAbyssGravel : ModItem - { - public override void SetStaticDefaults() - { + { + public override void SetStaticDefaults() + { } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SmoothAbyssGravel"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SmoothAbyssGravel"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "AbyssGravel", 1); recipe.SetResult(this); @@ -40,5 +40,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index ecd83a862c..a4e937402b 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class SmoothAbyssGravelPlatform : ModItem - { - public override void SetStaticDefaults() - { - } + public class SmoothAbyssGravelPlatform : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SmoothAbyssGravelPlatform"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SmoothAbyssGravelPlatform"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel"); recipe.SetResult(this, 2); recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs index cbab695f87..5cecf94118 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { - public class SmoothAbyssGravelWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class SmoothAbyssGravelWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("SmoothAbyssGravelWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("SmoothAbyssGravelWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothAbyssGravel"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientAltar.cs b/Items/Placeables/FurnitureAncient/AncientAltar.cs index 1f6701f553..39100a67a3 100644 --- a/Items/Placeables/FurnitureAncient/AncientAltar.cs +++ b/Items/Placeables/FurnitureAncient/AncientAltar.cs @@ -4,30 +4,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { public class AncientAltar : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientAltar"); - } + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 10); recipe.AddIngredient(null, "CharredOre", 10); diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index dab5cabd20..ed7d21979c 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { public class AncientBasin : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientBasin"); - } + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 10); recipe.AddIngredient(null, "CharredOre", 5); diff --git a/Items/Placeables/FurnitureAncient/AncientBath.cs b/Items/Placeables/FurnitureAncient/AncientBath.cs index b4d127a504..5c3a641b61 100644 --- a/Items/Placeables/FurnitureAncient/AncientBath.cs +++ b/Items/Placeables/FurnitureAncient/AncientBath.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { public class AncientBath : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Ancient Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientBath"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 14); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientBed.cs b/Items/Placeables/FurnitureAncient/AncientBed.cs index 54d15fdaf7..eeeabc849e 100644 --- a/Items/Placeables/FurnitureAncient/AncientBed.cs +++ b/Items/Placeables/FurnitureAncient/AncientBed.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientBed : ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientBed"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 15); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.cs b/Items/Placeables/FurnitureAncient/AncientBookcase.cs index 2f42f9505d..ebf3f39448 100644 --- a/Items/Placeables/FurnitureAncient/AncientBookcase.cs +++ b/Items/Placeables/FurnitureAncient/AncientBookcase.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientBookcase : ModItem - { - public override void SetStaticDefaults() + public class AncientBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("AncientBookcase"); - } + item.createTile = mod.TileType("AncientBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 20); diff --git a/Items/Placeables/FurnitureAncient/AncientChair.cs b/Items/Placeables/FurnitureAncient/AncientChair.cs index c661d8f91a..8ac4348b3b 100644 --- a/Items/Placeables/FurnitureAncient/AncientChair.cs +++ b/Items/Placeables/FurnitureAncient/AncientChair.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { public class AncientChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } - public override void SetDefaults() - { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientChair"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 4); diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.cs b/Items/Placeables/FurnitureAncient/AncientChandelier.cs index cef8672738..b13895218c 100644 --- a/Items/Placeables/FurnitureAncient/AncientChandelier.cs +++ b/Items/Placeables/FurnitureAncient/AncientChandelier.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientChandelier: ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientChandelier : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientChandelier"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 4); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.cs b/Items/Placeables/FurnitureAncient/AncientDoor.cs index b74168a2e9..915f78de1a 100644 --- a/Items/Placeables/FurnitureAncient/AncientDoor.cs +++ b/Items/Placeables/FurnitureAncient/AncientDoor.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { public class AncientDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientDoorClosed"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 6); diff --git a/Items/Placeables/FurnitureAncient/AncientDresser.cs b/Items/Placeables/FurnitureAncient/AncientDresser.cs index 3e6cff6db4..56184b216a 100644 --- a/Items/Placeables/FurnitureAncient/AncientDresser.cs +++ b/Items/Placeables/FurnitureAncient/AncientDresser.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientDresser: ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientDresser : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientDresser"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 16); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.cs b/Items/Placeables/FurnitureAncient/AncientLamp.cs index e0b154b57b..afd3aeed6f 100644 --- a/Items/Placeables/FurnitureAncient/AncientLamp.cs +++ b/Items/Placeables/FurnitureAncient/AncientLamp.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientLamp: ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientLamp : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientLamp"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UnholyCore", 1); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.cs b/Items/Placeables/FurnitureAncient/AncientLantern.cs index 30dcce36a2..0f3c381584 100644 --- a/Items/Placeables/FurnitureAncient/AncientLantern.cs +++ b/Items/Placeables/FurnitureAncient/AncientLantern.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientLantern: ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientLantern : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientLantern"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 6); diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index 48ac34e366..95f3f70d42 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientMonolith: ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientMonolith : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientMonolith"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 10); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientPiano.cs b/Items/Placeables/FurnitureAncient/AncientPiano.cs index 7370a99f82..cbfaa5589b 100644 --- a/Items/Placeables/FurnitureAncient/AncientPiano.cs +++ b/Items/Placeables/FurnitureAncient/AncientPiano.cs @@ -3,30 +3,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientPiano: ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientPiano : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.SetNameOverride("Ancient Pipe Organ"); - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientPiano"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bone, 4); @@ -36,5 +36,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientSink.cs b/Items/Placeables/FurnitureAncient/AncientSink.cs index 9c7e72e769..529a928e71 100644 --- a/Items/Placeables/FurnitureAncient/AncientSink.cs +++ b/Items/Placeables/FurnitureAncient/AncientSink.cs @@ -3,30 +3,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientSink: ModItem - { - public override void SetStaticDefaults() + public class AncientSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a lava source"); } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientSink"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 6); diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.cs b/Items/Placeables/FurnitureAncient/AncientSofa.cs index 487466a0b2..c3300c559f 100644 --- a/Items/Placeables/FurnitureAncient/AncientSofa.cs +++ b/Items/Placeables/FurnitureAncient/AncientSofa.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientSofa: ModItem - { - public override void SetStaticDefaults() - { - } + public class AncientSofa : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientSofa"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 5); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientTable.cs b/Items/Placeables/FurnitureAncient/AncientTable.cs index fd86ca3b0e..e3d88be76c 100644 --- a/Items/Placeables/FurnitureAncient/AncientTable.cs +++ b/Items/Placeables/FurnitureAncient/AncientTable.cs @@ -2,30 +2,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { - public class AncientTable: ModItem - { - public override void SetStaticDefaults() - { + public class AncientTable : ModItem + { + public override void SetStaticDefaults() + { - } + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientTable"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 8); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs index 22ae1f8cc3..9c4231781b 100644 --- a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs +++ b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { public class AncientWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Ancient Work Bench"); item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AncientWorkbench"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BrimstoneSlag", 10); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddTile(null, "AncientAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenAltar.cs b/Items/Placeables/FurnitureAshen/AshenAltar.cs index 2d70a03e89..61fa7d7f1a 100644 --- a/Items/Placeables/FurnitureAshen/AshenAltar.cs +++ b/Items/Placeables/FurnitureAshen/AshenAltar.cs @@ -4,30 +4,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenAltar : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { - Tooltip.SetDefault("Used for special crafting") ; + Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("AshenAltar"); - } + item.createTile = mod.TileType("AshenAltar"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); recipe.AddIngredient(null, "UnholyCore", 10); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index c43bd31371..4438881f69 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenBasin : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("AshenBasin"); - } + item.createTile = mod.TileType("AshenBasin"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); recipe.AddIngredient(null, "UnholyCore", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenBath.cs b/Items/Placeables/FurnitureAshen/AshenBath.cs index d6ff806e6d..5f6708159f 100644 --- a/Items/Placeables/FurnitureAshen/AshenBath.cs +++ b/Items/Placeables/FurnitureAshen/AshenBath.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenBath : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Ashen Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("AshenBath"); - } + item.createTile = mod.TileType("AshenBath"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 14); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenBed.cs b/Items/Placeables/FurnitureAshen/AshenBed.cs index b9233ade76..ee0fab2c22 100644 --- a/Items/Placeables/FurnitureAshen/AshenBed.cs +++ b/Items/Placeables/FurnitureAshen/AshenBed.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenBed : ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenBed"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 15); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenBookcase.cs b/Items/Placeables/FurnitureAshen/AshenBookcase.cs index 5ba0dff076..0212db75fd 100644 --- a/Items/Placeables/FurnitureAshen/AshenBookcase.cs +++ b/Items/Placeables/FurnitureAshen/AshenBookcase.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenBookcase : ModItem - { - public override void SetStaticDefaults() + public class AshenBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenBookcase"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 20); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs index b7d2717b1c..757e3698d7 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenCandelabra : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenCandelabra"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.cs b/Items/Placeables/FurnitureAshen/AshenCandle.cs index 8df90f920d..f0be6b9855 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandle.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandle.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenCandle: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenCandle : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; - item.value = 0; - item.createTile = mod.TileType("AshenCandle"); - } + item.value = 0; + item.createTile = mod.TileType("AshenCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); diff --git a/Items/Placeables/FurnitureAshen/AshenChair.cs b/Items/Placeables/FurnitureAshen/AshenChair.cs index c6bcc214e0..f3a8f0d539 100644 --- a/Items/Placeables/FurnitureAshen/AshenChair.cs +++ b/Items/Placeables/FurnitureAshen/AshenChair.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } - public override void SetDefaults() - { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; item.rare = 3; item.useStyle = 1; - item.consumable = true; + item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenChair"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenChandelier.cs b/Items/Placeables/FurnitureAshen/AshenChandelier.cs index ad9a9789a6..d8bc1ba617 100644 --- a/Items/Placeables/FurnitureAshen/AshenChandelier.cs +++ b/Items/Placeables/FurnitureAshen/AshenChandelier.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenChandelier: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenChandelier : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenChandelier"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenChest.cs b/Items/Placeables/FurnitureAshen/AshenChest.cs index 0bef3ff2ea..62c8639298 100644 --- a/Items/Placeables/FurnitureAshen/AshenChest.cs +++ b/Items/Placeables/FurnitureAshen/AshenChest.cs @@ -3,22 +3,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenChest : ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenChest : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; diff --git a/Items/Placeables/FurnitureAshen/AshenDoor.cs b/Items/Placeables/FurnitureAshen/AshenDoor.cs index 93f1baa6af..70adcdb834 100644 --- a/Items/Placeables/FurnitureAshen/AshenDoor.cs +++ b/Items/Placeables/FurnitureAshen/AshenDoor.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenDoorClosed"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenDresser.cs b/Items/Placeables/FurnitureAshen/AshenDresser.cs index 381ef0dab3..7f3856e53e 100644 --- a/Items/Placeables/FurnitureAshen/AshenDresser.cs +++ b/Items/Placeables/FurnitureAshen/AshenDresser.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenDresser: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenDresser : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenDresser"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 16); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenLamp.cs b/Items/Placeables/FurnitureAshen/AshenLamp.cs index 9425055c8c..7f4311f893 100644 --- a/Items/Placeables/FurnitureAshen/AshenLamp.cs +++ b/Items/Placeables/FurnitureAshen/AshenLamp.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenLamp: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenLamp : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenLamp"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 3); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenLantern.cs b/Items/Placeables/FurnitureAshen/AshenLantern.cs index d711275f8c..d21ddda450 100644 --- a/Items/Placeables/FurnitureAshen/AshenLantern.cs +++ b/Items/Placeables/FurnitureAshen/AshenLantern.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenLantern: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenLantern : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenLantern"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenMonolith.cs b/Items/Placeables/FurnitureAshen/AshenMonolith.cs index 60291844ea..e8ff64e257 100644 --- a/Items/Placeables/FurnitureAshen/AshenMonolith.cs +++ b/Items/Placeables/FurnitureAshen/AshenMonolith.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenMonolith: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenMonolith : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenMonolith"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenPiano.cs b/Items/Placeables/FurnitureAshen/AshenPiano.cs index 5200204e3d..1cbacc0e52 100644 --- a/Items/Placeables/FurnitureAshen/AshenPiano.cs +++ b/Items/Placeables/FurnitureAshen/AshenPiano.cs @@ -3,30 +3,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenPiano: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenPiano : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.SetNameOverride("Ashen Pipe Organ"); - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenPiano"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bone, 4); @@ -36,5 +36,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenPlatform.cs b/Items/Placeables/FurnitureAshen/AshenPlatform.cs index 312958756c..81fc598f3f 100644 --- a/Items/Placeables/FurnitureAshen/AshenPlatform.cs +++ b/Items/Placeables/FurnitureAshen/AshenPlatform.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenPlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; - item.createTile = mod.TileType("AshenPlatform"); - } + item.createTile = mod.TileType("AshenPlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag"); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenSink.cs b/Items/Placeables/FurnitureAshen/AshenSink.cs index 7ada569af1..4bb1a77572 100644 --- a/Items/Placeables/FurnitureAshen/AshenSink.cs +++ b/Items/Placeables/FurnitureAshen/AshenSink.cs @@ -3,30 +3,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenSink: ModItem - { - public override void SetStaticDefaults() + public class AshenSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a lava source"); } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenSink"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenSlab.cs b/Items/Placeables/FurnitureAshen/AshenSlab.cs index 9f2b6bb731..840dcfac0a 100644 --- a/Items/Placeables/FurnitureAshen/AshenSlab.cs +++ b/Items/Placeables/FurnitureAshen/AshenSlab.cs @@ -4,24 +4,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenSlab : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; - item.createTile = mod.TileType("AshenSlab"); + item.createTile = mod.TileType("AshenSlab"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAshen/AshenSlabWall.cs b/Items/Placeables/FurnitureAshen/AshenSlabWall.cs index 24c503679f..a322becd98 100644 --- a/Items/Placeables/FurnitureAshen/AshenSlabWall.cs +++ b/Items/Placeables/FurnitureAshen/AshenSlabWall.cs @@ -2,34 +2,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenSlabWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenSlabWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; item.rare = 3; item.consumable = true; - item.createWall = mod.WallType("AshenSlabWall"); - } + item.createWall = mod.WallType("AshenSlabWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "AshenSlab"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenSofa.cs b/Items/Placeables/FurnitureAshen/AshenSofa.cs index 7c3d5e25ba..559ddddc7e 100644 --- a/Items/Placeables/FurnitureAshen/AshenSofa.cs +++ b/Items/Placeables/FurnitureAshen/AshenSofa.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenSofa: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenSofa : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenSofa"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 5); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenTable.cs b/Items/Placeables/FurnitureAshen/AshenTable.cs index d59fa04205..1d0c3d4253 100644 --- a/Items/Placeables/FurnitureAshen/AshenTable.cs +++ b/Items/Placeables/FurnitureAshen/AshenTable.cs @@ -2,29 +2,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class AshenTable: ModItem - { - public override void SetStaticDefaults() - { - } + public class AshenTable : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenTable"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs index 9187a70d69..af3c7ad667 100644 --- a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs +++ b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { public class AshenWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Ashen Work Bench"); item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.rare = 3; item.consumable = true; item.value = 0; item.createTile = mod.TileType("AshenWorkbench"); - } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs index 5c9dae1e3c..a05143b4a9 100644 --- a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs +++ b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs @@ -2,34 +2,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { - public class SmoothBrimstoneSlagWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class SmoothBrimstoneSlagWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; item.rare = 3; item.consumable = true; - item.createWall = mod.WallType("SmoothBrimstoneSlagWall"); - } + item.createWall = mod.WallType("SmoothBrimstoneSlagWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothBrimstoneSlag"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs index 25f5fac0ca..5cb32b92e6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicBathtub : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicBathtub"); - } + item.createTile = mod.TileType("BotanicBathtub"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 14); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBed.cs b/Items/Placeables/FurnitureBotanic/BotanicBed.cs index 0e8f969f65..be1a1e67ac 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBed.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBed.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicBed : ModItem - { - public override void SetStaticDefaults() + public class BotanicBed : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicBed"); - } + item.createTile = mod.TileType("BotanicBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 15); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBench.cs b/Items/Placeables/FurnitureBotanic/BotanicBench.cs index 3589362896..452097b1e2 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBench.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicBench : ModItem - { - public override void SetStaticDefaults() + public class BotanicBench : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicBench"); - } + item.createTile = mod.TileType("BotanicBench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs index 48249d6130..44b0b69d02 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicBookcase : ModItem - { - public override void SetStaticDefaults() + public class BotanicBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicBookcase"); - } + item.createTile = mod.TileType("BotanicBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 20); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs index 6da3949eac..bda9065ff3 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicCandelabra : ModItem - { - public override void SetStaticDefaults() + public class BotanicCandelabra : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicCandelabra"); - } + item.createTile = mod.TileType("BotanicCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs index 86a1c14851..c6d4025cb5 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicCandle : ModItem - { - public override void SetStaticDefaults() + public class BotanicCandle : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicCandle"); - } + item.createTile = mod.TileType("BotanicCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChair.cs b/Items/Placeables/FurnitureBotanic/BotanicChair.cs index 4148cf8f3b..2e27a5bed4 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChair.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChair.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicChair : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicChair"); - } + item.createTile = mod.TileType("BotanicChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 4); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs index 71d8c417bb..8368953432 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicChandelier : ModItem - { - public override void SetStaticDefaults() + public class BotanicChandelier : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicChandelier"); - } + item.createTile = mod.TileType("BotanicChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChest.cs b/Items/Placeables/FurnitureBotanic/BotanicChest.cs index 22a9a71a56..c298f46fed 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChest.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChest.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicChest : ModItem - { - public override void SetStaticDefaults() + public class BotanicChest : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicChest"); - } + item.createTile = mod.TileType("BotanicChest"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 8); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicClock.cs b/Items/Placeables/FurnitureBotanic/BotanicClock.cs index 188d45159e..3f6cdc66ac 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicClock.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicClock.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicClock : ModItem - { - public override void SetStaticDefaults() + public class BotanicClock : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicClock"); - } + item.createTile = mod.TileType("BotanicClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 10); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs index d8c8e88d0e..cde3ad9646 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicDoor : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicDoorClosed"); - } + item.createTile = mod.TileType("BotanicDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 6); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs index 5889a241e8..3f1e7e69a1 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicDresser : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicDresser"); - } + item.createTile = mod.TileType("BotanicDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 16); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs index c65374ae87..af83e1c3a7 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicLamp : ModItem - { - public override void SetStaticDefaults() + public class BotanicLamp : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicLamp"); - } + item.createTile = mod.TileType("BotanicLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 3); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs index 7fc464fab1..2b88f3959d 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicLantern : ModItem - { - public override void SetStaticDefaults() + public class BotanicLantern : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicLantern"); - } + item.createTile = mod.TileType("BotanicLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs index 600734cc07..1a7b063dec 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicPiano : ModItem - { - public override void SetStaticDefaults() + public class BotanicPiano : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicPiano"); - } + item.createTile = mod.TileType("BotanicPiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 15); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs b/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs index 0c808f7b5f..3d6c464beb 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicPlanter : ModItem - { - public override void SetStaticDefaults() + public class BotanicPlanter : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicPlanter"); - } + item.createTile = mod.TileType("BotanicPlanter"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 20); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs index ceeb6aa6e2..61a11cfa61 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicPlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("BotanicPlatform"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("BotanicPlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick"); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicSink.cs b/Items/Placeables/FurnitureBotanic/BotanicSink.cs index 0bcd73b147..a49f7f46df 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicSink.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicSink.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { - public class BotanicSink : ModItem - { - public override void SetStaticDefaults() + public class BotanicSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a honey source"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicSink"); - } + item.createTile = mod.TileType("BotanicSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 6); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicTable.cs b/Items/Placeables/FurnitureBotanic/BotanicTable.cs index b39d0177dd..ada9ddcbf1 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicTable.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicTable.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicTable : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicTable"); - } + item.createTile = mod.TileType("BotanicTable"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 8); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs index 3443503fae..81ff325f4d 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicWorkBench : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.value = 0; item.consumable = true; - item.createTile = mod.TileType("BotanicWorkBench"); - } + item.createTile = mod.TileType("BotanicWorkBench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UelibloomBrick", 10); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddTile(null, "BotanicPlanter"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs index e63b277057..f72ba26d71 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { public class CosmiliteBath : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Cosmilite Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteBath"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteBath"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 14); diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs index 23440906aa..cef6a34a46 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteBed : ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteBed"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 15); diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs index 35f8b1741a..cb9064881d 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteBookcase : ModItem - { - public override void SetStaticDefaults() + public class CosmiliteBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteBookcase"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 20); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs index fed0eb39bb..4bed0bd9fb 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("CosmiliteBrickWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("CosmiliteBrickWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs index ce6c9df010..e22dd32fd6 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteCandelabra : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteCandelabra"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs index 7f8bb2a2e8..f8c92dcb3c 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteCandle: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteCandle : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteCandle"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 4); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs index 12e53775bb..95f9274b8d 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { public class CosmiliteChair : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteChair"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 4); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs index d705beb5c5..cdd9976cc7 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteChandelier: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteChandelier : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteChandelier"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs index fff9d6335f..cc41db0ed8 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteChest : ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteChest : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteChest"); + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteChest"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs index cad57bd108..0ce5428ccc 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteClock: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteClock : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteClock"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 3); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs index dc3774a6f3..53e4d4b3a1 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { public class CosmiliteDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteDoorClosed"); - } + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 6); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs index 01e7e9afdd..d92539ac5a 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteDresser: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteDresser : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteDresser"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 16); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs index 7713871ae0..9fee299432 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteLamp: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteLamp : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteLamp"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Torch); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs index 1a40cc6e70..c62515abb2 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteLantern: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteLantern : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteLantern"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 6); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs index 21c6f16c78..ea21beaa70 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmilitePiano: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmilitePiano : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmilitePiano"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmilitePiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bone, 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs index 4a07a8ceae..2e3772d459 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { public class CosmilitePlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmilitePlatform"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmilitePlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick"); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs index 696e69f5e5..52a75c278c 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { public class CosmiliteSconce : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteSconce"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteSconce"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 3); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs index de862b5673..7cc2724347 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteSink: ModItem - { - public override void SetStaticDefaults() + public class CosmiliteSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteSink"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs index 685f1acd30..7829d4d8b4 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteSofa: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteSofa : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteSofa"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteSofa"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs index cc69249ee6..f6fc96ab85 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { - public class CosmiliteTable: ModItem - { - public override void SetStaticDefaults() - { - } + public class CosmiliteTable : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.createTile = mod.TileType("CosmiliteTable"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 8); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs index a39bf6f791..42ce1e021d 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { public class CosmiliteWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Cosmilite Work Bench"); item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CosmiliteWorkbench"); - } + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CosmiliteWorkbench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBrick", 10); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs index 0e175acf43..ed43ebe38a 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicBathtub : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicBathtub"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicBathtub"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs index bb1820a618..3faa2c89d9 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs @@ -3,25 +3,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { - public class EutrophicBed : ModItem - { - public override void SetStaticDefaults() + public class EutrophicBed : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicBed"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicBed"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs index 69eefee047..b7165ec1d4 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicBench : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicBench"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicBench"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs index d4467af200..1e5d68bb5e 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs @@ -3,25 +3,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { - public class EutrophicBookcase : ModItem - { - public override void SetStaticDefaults() + public class EutrophicBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicBookcase"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicBookcase"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs index 305fc03b85..ee82040dc6 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicCandelabra : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicCandelabra"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicCandelabra"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs index 8192cef0c1..91485a1ad0 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicCandle : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicCandle"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicCandle"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs index 7f6f707d18..5bc2e2333c 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicChair : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicChair"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicChair"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs index d7bd1f5176..6753864361 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicChandelier : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicChandelier"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicChandelier"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs index daf8ef7253..08d35257b2 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicChest : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicChest"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicChest"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs index f1cccabceb..f627266d9d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicClock : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicClock"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicClock"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs index 2cd3812492..4bf1386f68 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { - public class EutrophicCrafting : ModItem - { - public override void SetStaticDefaults() + public class EutrophicCrafting : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Eutrophic Shelf"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicCrafting"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicCrafting"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs index 47088a4b92..312ae9816a 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicDoor : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicDoorClosed"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicDoorClosed"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs index 800fab5dd9..f16d2c498d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicDresser : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicDresser"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicDresser"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs index 844ef3b32e..3f28fc6659 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicLamp : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicLamp"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicLamp"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs index c4bb285ad9..d160767a65 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicLantern : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicLantern"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicLantern"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs index 370df05b75..92dc446832 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs @@ -3,25 +3,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { - public class EutrophicPiano : ModItem - { - public override void SetStaticDefaults() + public class EutrophicPiano : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicPiano"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicPiano"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs index f2043f6ce1..f16ba0c167 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicPlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicPlatform"); - } + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicPlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("Navystone")); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddTile(null, "EutrophicCrafting"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs index b20001aca4..4c3a7c5a43 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { - public class EutrophicSink : ModItem - { - public override void SetStaticDefaults() + public class EutrophicSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicSink"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicSink"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs index 9647105165..1317e209d2 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicTable : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicTable"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicTable"); + } public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs index 3b9aafd085..616c49c489 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class EutrophicWorkBench : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("EutrophicWorkBench"); + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("EutrophicWorkBench"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs index 648d708b85..311cfa4c5f 100644 --- a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs +++ b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs @@ -5,23 +5,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { public class SmoothNavystone : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SmoothNavystone"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SmoothNavystone"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs b/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs index c7e3c226a0..405b50d9a0 100644 --- a/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs +++ b/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { - public class SmoothNavystoneWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class SmoothNavystoneWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("SmoothNavystoneWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("SmoothNavystoneWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("SmoothNavystone")); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultBathtub.cs b/Items/Placeables/FurnitureOccult/OccultBathtub.cs index 0a988b06a9..939506fd1b 100644 --- a/Items/Placeables/FurnitureOccult/OccultBathtub.cs +++ b/Items/Placeables/FurnitureOccult/OccultBathtub.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultBathtub : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultBathtub"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultBathtub"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 14); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultBed.cs b/Items/Placeables/FurnitureOccult/OccultBed.cs index d00756bb64..5a8c5813cd 100644 --- a/Items/Placeables/FurnitureOccult/OccultBed.cs +++ b/Items/Placeables/FurnitureOccult/OccultBed.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { - public class OccultBed : ModItem - { - public override void SetStaticDefaults() + public class OccultBed : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Bed"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultBed"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 15); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultBookcase.cs b/Items/Placeables/FurnitureOccult/OccultBookcase.cs index 3a665034b7..3e7b598f9e 100644 --- a/Items/Placeables/FurnitureOccult/OccultBookcase.cs +++ b/Items/Placeables/FurnitureOccult/OccultBookcase.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { - public class OccultBookcase : ModItem - { - public override void SetStaticDefaults() + public class OccultBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Bookcase"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultBookcase"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 20); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs index 93bf4f8f9f..04c56dacb7 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultCandelabra : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Candelabra"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultCandelabra"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 15); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultCandle.cs b/Items/Placeables/FurnitureOccult/OccultCandle.cs index 5e202b4d1c..c5d211bd16 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandle.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandle.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultCandle : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Candle"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultCandle"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 12); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultChair.cs b/Items/Placeables/FurnitureOccult/OccultChair.cs index 92eea26c8f..5c44a1aee4 100644 --- a/Items/Placeables/FurnitureOccult/OccultChair.cs +++ b/Items/Placeables/FurnitureOccult/OccultChair.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultChair : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Chair"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultChair"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 4); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultChandelier.cs b/Items/Placeables/FurnitureOccult/OccultChandelier.cs index 13ebd58331..c1b5a470a3 100644 --- a/Items/Placeables/FurnitureOccult/OccultChandelier.cs +++ b/Items/Placeables/FurnitureOccult/OccultChandelier.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultChandelier : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Chandelier"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultChandelier"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 12); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultChest.cs b/Items/Placeables/FurnitureOccult/OccultChest.cs index 4555239342..ba3512885b 100644 --- a/Items/Placeables/FurnitureOccult/OccultChest.cs +++ b/Items/Placeables/FurnitureOccult/OccultChest.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultChest : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Chest"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultChest"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultChest"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 8); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultClock.cs b/Items/Placeables/FurnitureOccult/OccultClock.cs index 6f49b9c9c2..db6d6e4baf 100644 --- a/Items/Placeables/FurnitureOccult/OccultClock.cs +++ b/Items/Placeables/FurnitureOccult/OccultClock.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { - public class OccultClock : ModItem - { - public override void SetStaticDefaults() + public class OccultClock : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Clock"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultClock"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 10); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultDoor.cs b/Items/Placeables/FurnitureOccult/OccultDoor.cs index 65d91a704d..2093bc0c93 100644 --- a/Items/Placeables/FurnitureOccult/OccultDoor.cs +++ b/Items/Placeables/FurnitureOccult/OccultDoor.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultDoor : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Door"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultDoorClosed"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 6); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultDresser.cs b/Items/Placeables/FurnitureOccult/OccultDresser.cs index 1be23e5fd1..dae0870917 100644 --- a/Items/Placeables/FurnitureOccult/OccultDresser.cs +++ b/Items/Placeables/FurnitureOccult/OccultDresser.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultDresser : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Dresser"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultDresser"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 16); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultLamp.cs b/Items/Placeables/FurnitureOccult/OccultLamp.cs index 899d0ca238..88b5648ecb 100644 --- a/Items/Placeables/FurnitureOccult/OccultLamp.cs +++ b/Items/Placeables/FurnitureOccult/OccultLamp.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultLamp : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Lamp"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultLamp"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 9); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultLantern.cs b/Items/Placeables/FurnitureOccult/OccultLantern.cs index 2690cbbd03..34709816c0 100644 --- a/Items/Placeables/FurnitureOccult/OccultLantern.cs +++ b/Items/Placeables/FurnitureOccult/OccultLantern.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultLantern : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Lantern"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultLantern"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 18); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultPiano.cs b/Items/Placeables/FurnitureOccult/OccultPiano.cs index 7497d82d35..5de31f2738 100644 --- a/Items/Placeables/FurnitureOccult/OccultPiano.cs +++ b/Items/Placeables/FurnitureOccult/OccultPiano.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { - public class OccultPiano : ModItem - { - public override void SetStaticDefaults() + public class OccultPiano : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Piano"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultPiano"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultPiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 15); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultPlatform.cs b/Items/Placeables/FurnitureOccult/OccultPlatform.cs index 29170e736a..f8e8e5421d 100644 --- a/Items/Placeables/FurnitureOccult/OccultPlatform.cs +++ b/Items/Placeables/FurnitureOccult/OccultPlatform.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultPlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Platform"); item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultPlatform"); - } + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultPlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone"); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultSink.cs b/Items/Placeables/FurnitureOccult/OccultSink.cs index 75a4cd01bc..15fa760dbe 100644 --- a/Items/Placeables/FurnitureOccult/OccultSink.cs +++ b/Items/Placeables/FurnitureOccult/OccultSink.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { - public class OccultSink : ModItem - { - public override void SetStaticDefaults() + public class OccultSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Sink"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultSink"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 6); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultSofa.cs b/Items/Placeables/FurnitureOccult/OccultSofa.cs index df19f38a50..f5e57f9efc 100644 --- a/Items/Placeables/FurnitureOccult/OccultSofa.cs +++ b/Items/Placeables/FurnitureOccult/OccultSofa.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { - public class OccultSofa : ModItem - { - public override void SetStaticDefaults() + public class OccultSofa : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Sofa"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultSofa"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultSofa"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultStone.cs b/Items/Placeables/FurnitureOccult/OccultStone.cs index a25044eff0..bf6cc794f5 100644 --- a/Items/Placeables/FurnitureOccult/OccultStone.cs +++ b/Items/Placeables/FurnitureOccult/OccultStone.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.StoneBlock, 150); - recipe.AddIngredient(mod.ItemType("DarkPlasma")); - recipe.AddIngredient(mod.ItemType("ArmoredShell")); - recipe.AddIngredient(mod.ItemType("TwistingNether")); - recipe.AddIngredient(ItemID.Silk, 15); + recipe.AddIngredient(mod.ItemType("DarkPlasma")); + recipe.AddIngredient(mod.ItemType("ArmoredShell")); + recipe.AddIngredient(mod.ItemType("TwistingNether")); + recipe.AddIngredient(ItemID.Silk, 15); recipe.SetResult(this, 150); recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); diff --git a/Items/Placeables/FurnitureOccult/OccultStoneWall.cs b/Items/Placeables/FurnitureOccult/OccultStoneWall.cs index bcbd498082..97ae1226db 100644 --- a/Items/Placeables/FurnitureOccult/OccultStoneWall.cs +++ b/Items/Placeables/FurnitureOccult/OccultStoneWall.cs @@ -2,34 +2,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { - public class OccultStoneWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class OccultStoneWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Stone Wall"); item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("OccultStoneWall"); - } + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("OccultStoneWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultTable.cs b/Items/Placeables/FurnitureOccult/OccultTable.cs index 42e70f4f1c..ecdacdda69 100644 --- a/Items/Placeables/FurnitureOccult/OccultTable.cs +++ b/Items/Placeables/FurnitureOccult/OccultTable.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultTable : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Table"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultTable"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultTable"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 8); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs index c4463c6601..aeb48671a5 100644 --- a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs +++ b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultWorkBench : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Otherworldly Work Bench"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("OccultWorkBench"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("OccultWorkBench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OccultStone", 10); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs b/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs index 6bd935c5e1..6329560721 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs @@ -4,27 +4,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlagueInfuser : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlagueInfuser"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlagueInfuser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 10); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs index 10fe65b48d..f5f83bd276 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateBasin : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateBasin"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateBasin"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 10); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 96a983f569..c20fe2709a 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateBathtub : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateBathtub"); - } + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateBathtub"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 14); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs index ee34033060..f2425e194d 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { - public class PlaguedPlateBed: ModItem - { - public override void SetStaticDefaults() - { - } + public class PlaguedPlateBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.createTile = mod.TileType("PlaguedPlateBed"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 15); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index 57513818f5..8c15e4f5d6 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateBookcase : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateBookcase"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 20); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 5b360493ac..8fde21176f 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateCandelabra : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateCandelabra"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs index bf1d8f7b4a..92d668c900 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateCandle : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateCandle"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs index 596a6b3131..2b93f1a317 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateChair : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateChair"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 4); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index b71df2b4cb..4e1d3b7e5a 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateChandelier : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateChandelier"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 4); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs index 09d46330d1..3d7563d1bd 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateChest : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateChest"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateChest"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 8); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs index 07b54f538c..6e3e9d4adc 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateClock : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateClock"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 10); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs index 658131abfa..a5377a503d 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateDoorClosed"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 6); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 36632e9a64..3f28c4cf61 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateDresser : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateDresser"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 16); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs index a4f5b5de3e..b4e63e02b9 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateLamp : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateLamp"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 3); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs index c81ceb8be5..5bfeddbdf0 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateLantern : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateLantern"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs index d0b1a1605a..eb92298cf9 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlatePiano : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlatePiano"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlatePiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 15); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index 461e829ef6..1c30473daa 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlatePlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlatePlatform"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlatePlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate"); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs index 8105d27226..7c32b3b8e1 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -4,27 +4,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateSink : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateSink"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 6); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs index 45dc81f36d..14bdc3e8ad 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateSofa : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateSofa"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateSofa"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 5); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs index ea59c77abc..db3b0096d0 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateTable : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateTable"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateTable"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 8); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs index ed42d08300..7bf1335a33 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { - public class PlaguedPlateWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class PlaguedPlateWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("PlaguedPlateWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("PlaguedPlateWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index a6c3ffee34..a1dfceedd0 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public class PlaguedPlateWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Plagued Plate Work Bench"); item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PlaguedPlateWorkbench"); - } + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PlaguedPlateWorkbench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlaguedPlate", 10); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddTile(null, "PlagueInfuser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs b/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs index 80343caa99..f45a396897 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedBasin : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Profaned Crucible"); item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedBasin"); - } + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedBasin"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 10); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBath.cs b/Items/Placeables/FurnitureProfaned/ProfanedBath.cs index 1a1921ca49..ed512239dd 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBath.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBath.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedBath : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Profaned Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedBath"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedBath"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 14); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs index acbc1a1043..b48b5f0a83 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedBed : ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedBed"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 15); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs index cfb93b2213..091a34ca08 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedBench: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedBench : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedBench"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedBench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs index bb14c8e055..facdd2612b 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedBookcase : ModItem - { - public override void SetStaticDefaults() + public class ProfanedBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedBookcase"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 20); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs index b1172b7da2..5e4b6a7a60 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedCandelabra : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedCandelabra"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs index abf374f309..1902a583a7 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedCandle: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedCandle : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedCandle"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 4); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs index 70b47656a7..f15a8977a2 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedChair : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedChair"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 4); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs index c13da5796f..5d75606cb8 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedChandelier: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedChandelier : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedChandelier"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs index 46d4366767..0a178b7b45 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedChest : ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedChest : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedChest"); + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedChest"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs index 9b15910381..30f4e9d9aa 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedClock: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedClock : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedClock"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 3); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs index 7f0e4d179e..86af77c60d 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedCrystal : ModItem - { - public override void SetStaticDefaults() - { + { + public override void SetStaticDefaults() + { } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedCrystal"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedCrystal"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.GetItem("UnholyEssence")); diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs b/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs index 8a7df13e8f..f97223c1b2 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedCrystalWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedCrystalWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("ProfanedCrystalWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("ProfanedCrystalWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedCrystal"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs index 04c98c5c4f..752d542b9f 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedDoorClosed"); - } + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 6); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs index cfa6c19350..5350250e8b 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedDresser: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedDresser : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedDresser"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 16); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs index 79c450e343..5ded573805 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedLamp: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedLamp : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedLamp"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Torch); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs index 1de6fe5878..63f44cb650 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedLantern: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedLantern : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedLantern"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 6); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs index 2756dbeba2..7a5e3b55d2 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedPiano: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedPiano : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedPiano"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedPiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bone, 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs index 1b6a5d6741..b5ad5cd6df 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedPlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedPlatform"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedPlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock"); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs index 8c4bc93152..8b1f25bd09 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedRock : ModItem - { - public override void SetStaticDefaults() - { + { + public override void SetStaticDefaults() + { } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedRock"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedRock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRockWall", 4); @@ -42,5 +42,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs b/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs index af9b49f782..156f2534ef 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedRockWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedRockWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("ProfanedRockWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("ProfanedRockWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs index 211862f13f..7e256d3c84 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedSink: ModItem - { - public override void SetStaticDefaults() + public class ProfanedSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a lava source"); } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedSink"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs b/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs index 8782e3796c..6aa29bca2e 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedSlabWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedSlabWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("ProfanedSlabWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("ProfanedSlabWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedSlab"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs index b0ffeb6076..bb7f425ccf 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class ProfanedTable: ModItem - { - public override void SetStaticDefaults() - { - } + public class ProfanedTable : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.createTile = mod.TileType("ProfanedTable"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 8); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs index 2b92c78078..4efaff3960 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { public class ProfanedWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Profaned Work Bench"); item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ProfanedWorkbench"); - } + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ProfanedWorkbench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ProfanedRock", 10); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddTile(null, "ProfanedBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs b/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs index f7bae60dd0..901f8a3930 100644 --- a/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs +++ b/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned { - public class RunicProfanedBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class RunicProfanedBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("RunicProfanedBrickWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("RunicProfanedBrickWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "RunicProfanedBrick"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBasin.cs b/Items/Placeables/FurnitureSilva/SilvaBasin.cs index 3622d30fb5..6e3f35c2c6 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBasin.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBasin.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaBasin : ModItem - { - public override void SetStaticDefaults() + public class SilvaBasin : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Effulgent Manipulator"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaBasin"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaBasin"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 10); @@ -33,12 +33,12 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.SetResult(this); recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaCrystal", 10); - recipe.AddIngredient(ItemID.PlatinumBar, 5); - recipe.SetResult(this); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaCrystal", 10); + recipe.AddIngredient(ItemID.PlatinumBar, 5); + recipe.SetResult(this); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs index 1831e635d6..366d33d494 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaBathtub : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaBathtub"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaBathtub"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 14); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBed.cs b/Items/Placeables/FurnitureSilva/SilvaBed.cs index 548d7df4dd..05ab1babf2 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBed.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBed.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaBed : ModItem - { - public override void SetStaticDefaults() + public class SilvaBed : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaBed"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 15); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBench.cs b/Items/Placeables/FurnitureSilva/SilvaBench.cs index 00dabfb561..75388293e2 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBench.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaBench : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaBench"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaBench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 10); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs index 1599d2272a..6a397271c4 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaBookcase : ModItem - { - public override void SetStaticDefaults() + public class SilvaBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaBookcase"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 20); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs index 100fd97a8f..8984f02183 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaCandelabra : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaCandelabra"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 5); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCandle.cs b/Items/Placeables/FurnitureSilva/SilvaCandle.cs index b346f651d7..dbf9dab5a7 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandle.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandle.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaCandle : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaCandle"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 4); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChair.cs b/Items/Placeables/FurnitureSilva/SilvaChair.cs index 7a8cad6590..5245705d9e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChair.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChair.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaChair : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaChair"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 4); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs index 7ab9f14c39..091fa2fab2 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaChandelier : ModItem - { - public override void SetStaticDefaults() + public class SilvaChandelier : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaChandelier"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 4); @@ -32,13 +32,13 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.SetResult(this); recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaCrystal", 4); - recipe.AddIngredient(null, "EffulgentFeather", 4); - recipe.AddIngredient(ItemID.PlatinumBar); - recipe.SetResult(this); - recipe.AddTile(null, "SilvaBasin"); - recipe.AddRecipe(); - } - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaCrystal", 4); + recipe.AddIngredient(null, "EffulgentFeather", 4); + recipe.AddIngredient(ItemID.PlatinumBar); + recipe.SetResult(this); + recipe.AddTile(null, "SilvaBasin"); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChest.cs b/Items/Placeables/FurnitureSilva/SilvaChest.cs index 21c2bd496b..6cfa73a077 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChest.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChest.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaChest : ModItem - { - public override void SetStaticDefaults() + public class SilvaChest : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaChest"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaChest"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 8); @@ -32,13 +32,13 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.SetResult(this); recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaCrystal", 8); - recipe.AddIngredient(ItemID.PlatinumBar); - recipe.anyIronBar = true; - recipe.SetResult(this); - recipe.AddTile(null, "SilvaBasin"); - recipe.AddRecipe(); - } - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaCrystal", 8); + recipe.AddIngredient(ItemID.PlatinumBar); + recipe.anyIronBar = true; + recipe.SetResult(this); + recipe.AddTile(null, "SilvaBasin"); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaClock.cs b/Items/Placeables/FurnitureSilva/SilvaClock.cs index 2cf93d8f11..8d12a86988 100644 --- a/Items/Placeables/FurnitureSilva/SilvaClock.cs +++ b/Items/Placeables/FurnitureSilva/SilvaClock.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaClock : ModItem - { - public override void SetStaticDefaults() + public class SilvaClock : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaClock"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 10); @@ -33,14 +33,14 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.SetResult(this); recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaCrystal", 10); - recipe.AddIngredient(ItemID.PlatinumBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.SetResult(this); - recipe.AddTile(null, "SilvaBasin"); - recipe.AddRecipe(); - } - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaCrystal", 10); + recipe.AddIngredient(ItemID.PlatinumBar, 3); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Glass, 6); + recipe.SetResult(this); + recipe.AddTile(null, "SilvaBasin"); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs index 3730846c6b..c252df85b2 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs @@ -36,18 +36,18 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.SetResult(this, 400); recipe.AddTile(null, "DraedonsForge"); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalBlock, 200); - recipe.AddIngredient(ItemID.PlatinumBar, 25); - recipe.AddIngredient(mod.ItemType("DarksunFragment")); - recipe.AddIngredient(mod.ItemType("EffulgentFeather"), 5); - recipe.AddIngredient(mod.ItemType("CosmiliteBar"), 5); - recipe.AddIngredient(mod.ItemType("NightmareFuel")); - recipe.AddIngredient(mod.ItemType("EndothermicEnergy")); - recipe.SetResult(this, 400); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalBlock, 200); + recipe.AddIngredient(ItemID.PlatinumBar, 25); + recipe.AddIngredient(mod.ItemType("DarksunFragment")); + recipe.AddIngredient(mod.ItemType("EffulgentFeather"), 5); + recipe.AddIngredient(mod.ItemType("CosmiliteBar"), 5); + recipe.AddIngredient(mod.ItemType("NightmareFuel")); + recipe.AddIngredient(mod.ItemType("EndothermicEnergy")); + recipe.SetResult(this, 400); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaWall", 4); recipe.SetResult(this); recipe.AddTile(18); diff --git a/Items/Placeables/FurnitureSilva/SilvaDoor.cs b/Items/Placeables/FurnitureSilva/SilvaDoor.cs index b1f14f6bcf..c7d1a1e068 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDoor.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDoor.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaDoor : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaDoorClosed"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 6); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaDresser.cs b/Items/Placeables/FurnitureSilva/SilvaDresser.cs index 2f0c8eb8ab..ff8b06f83e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDresser.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDresser.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaDresser : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaDresser"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 16); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaLamp.cs b/Items/Placeables/FurnitureSilva/SilvaLamp.cs index e8dc4c1ef3..0e03a3bb37 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLamp.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLamp.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaLamp : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaLamp"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 3); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaLantern.cs b/Items/Placeables/FurnitureSilva/SilvaLantern.cs index dc029fe3d7..d8069c4eda 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLantern.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLantern.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaLantern : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaLantern"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 6); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaPiano.cs b/Items/Placeables/FurnitureSilva/SilvaPiano.cs index 59c00f0ced..45d78005a9 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPiano.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPiano.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaPiano : ModItem - { - public override void SetStaticDefaults() + public class SilvaPiano : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaPiano"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaPiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 15); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs index 977acefec6..66d0e4fc2d 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaPlatform : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaPlatform"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaPlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal"); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaSink.cs b/Items/Placeables/FurnitureSilva/SilvaSink.cs index 78f20953a2..f828204d8a 100644 --- a/Items/Placeables/FurnitureSilva/SilvaSink.cs +++ b/Items/Placeables/FurnitureSilva/SilvaSink.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaSink : ModItem - { - public override void SetStaticDefaults() + public class SilvaSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaSink"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaTable.cs b/Items/Placeables/FurnitureSilva/SilvaTable.cs index 002979c43b..10baea9406 100644 --- a/Items/Placeables/FurnitureSilva/SilvaTable.cs +++ b/Items/Placeables/FurnitureSilva/SilvaTable.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaTable : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaTable"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaTable"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 8); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaWall.cs b/Items/Placeables/FurnitureSilva/SilvaWall.cs index c632a8e438..6997d1ff3e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWall.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { - public class SilvaWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class SilvaWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("SilvaWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("SilvaWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs index 0caf735af6..880e8c8161 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva { public class SilvaWorkBench : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SilvaWorkBench"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SilvaWorkBench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SilvaCrystal", 10); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddTile(null, "SilvaBasin"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StaticRefiner.cs b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs index 77a1010d3a..4df8a7ca69 100644 --- a/Items/Placeables/FurnitureStatigel/StaticRefiner.cs +++ b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StaticRefiner : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StaticRefiner"); - } - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StaticRefiner"); + } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBath.cs b/Items/Placeables/FurnitureStatigel/StatigelBath.cs index 577cc98707..06006a3e0e 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBath.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBath.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StatigelBath : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Statigel Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelBath"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelBath"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 14); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBed.cs b/Items/Placeables/FurnitureStatigel/StatigelBed.cs index 1ac6014f8f..7cfc2ab96b 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBed.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBed.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelBed : ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelBed"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 15); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs index 852086f90c..a1fee32e4b 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StatigelBlock : ModItem - { - public override void SetStaticDefaults() - { + { + public override void SetStaticDefaults() + { } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.consumable = true; - item.createTile = mod.TileType("StatigelBlock"); - } + item.createTile = mod.TileType("StatigelBlock"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel"); + recipe.AddIngredient(null, "PurifiedGel"); recipe.SetResult(this, 10); recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); @@ -34,14 +34,14 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelPlatform", 2); recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelWall", 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelWall", 4); + recipe.SetResult(this); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs index 02c50a6731..72ad63b290 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelBookcase : ModItem - { - public override void SetStaticDefaults() + public class StatigelBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelBookcase"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 20); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs index 2bb9c3bf8f..f6338a24c0 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelCandelabra : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelCandelabra"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs index 3614c89196..4325a4058d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelCandle: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelCandle : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelCandle"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 4); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChair.cs b/Items/Placeables/FurnitureStatigel/StatigelChair.cs index dfa4980b6a..430897fa69 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChair.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChair.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StatigelChair : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelChair"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 4); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs index bf74ea1809..174d6d1339 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelChandelier: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelChandelier : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelChandelier"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChest.cs b/Items/Placeables/FurnitureStatigel/StatigelChest.cs index df0e4467e8..2edbce97ec 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChest.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChest.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelChest : ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelChest : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelChest"); + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelChest"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStatigel/StatigelClock.cs b/Items/Placeables/FurnitureStatigel/StatigelClock.cs index 726eb83657..5fae7cca11 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelClock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelClock.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelClock: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelClock : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelClock"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 3); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs index 5ad4cd9ecf..e43b84b6af 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StatigelDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelDoorClosed"); - } + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 6); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs index 6585e85cb4..6d4c395700 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelDresser: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelDresser : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelDresser"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 16); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs index 43eb98ec77..d4b43c1ac2 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelLamp: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelLamp : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelLamp"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Torch); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs index d5c9cbe58d..ae8ea44090 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelLantern: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelLantern : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelLantern"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 6); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs index 5a200c0e45..b7e589559d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelPiano: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelPiano : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelPiano"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelPiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bone, 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs index 3ae526321a..156519595a 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StatigelPlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelPlatform"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelPlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock"); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelSink.cs b/Items/Placeables/FurnitureStatigel/StatigelSink.cs index c52a8a53e2..8325a27fa2 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSink.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSink.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelSink: ModItem - { - public override void SetStaticDefaults() + public class StatigelSink : ModItem + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelSink"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs index 1faf25b9ad..cadaa2922f 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelSofa: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelSofa : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelSofa"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelSofa"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelTable.cs b/Items/Placeables/FurnitureStatigel/StatigelTable.cs index 0af2d29e8f..4ea67e34c4 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelTable.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelTable.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelTable: ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelTable : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.createTile = mod.TileType("StatigelTable"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 8); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelWall.cs b/Items/Placeables/FurnitureStatigel/StatigelWall.cs index 0266f28ca8..5daff14bca 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelWall.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelWall.cs @@ -2,33 +2,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { - public class StatigelWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class StatigelWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; item.consumable = true; - item.createWall = mod.WallType("StatigelWall"); - } + item.createWall = mod.WallType("StatigelWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock"); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs b/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs index a20f2acc17..4c16841ba9 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StatigelWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Statigel Work Bench"); item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StatigelWorkbench"); - } + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StatigelWorkbench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StatigelBlock", 10); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.cs b/Items/Placeables/FurnitureStratus/StratusBathtub.cs index b13f56969f..d682e7c9db 100644 --- a/Items/Placeables/FurnitureStratus/StratusBathtub.cs +++ b/Items/Placeables/FurnitureStratus/StratusBathtub.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusBathtub : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusBathtub"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusBathtub"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 14); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusBed.cs b/Items/Placeables/FurnitureStratus/StratusBed.cs index 13508166ea..2cd7ff1d14 100644 --- a/Items/Placeables/FurnitureStratus/StratusBed.cs +++ b/Items/Placeables/FurnitureStratus/StratusBed.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusBed : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusBed"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 15); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.cs b/Items/Placeables/FurnitureStratus/StratusBookcase.cs index 1ea1fb1c28..4a92d1da49 100644 --- a/Items/Placeables/FurnitureStratus/StratusBookcase.cs +++ b/Items/Placeables/FurnitureStratus/StratusBookcase.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusBookcase : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusBookcase"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 20); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs index 1af51857e4..6670462bf7 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusCandelabra : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusCandelabra"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 5); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.cs b/Items/Placeables/FurnitureStratus/StratusCandle.cs index 18b9a84374..fe0d4340a7 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandle.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandle.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusCandle : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusCandle"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 4); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusChair.cs b/Items/Placeables/FurnitureStratus/StratusChair.cs index 6d598932a8..5f1f75309e 100644 --- a/Items/Placeables/FurnitureStratus/StratusChair.cs +++ b/Items/Placeables/FurnitureStratus/StratusChair.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusChair : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusChair"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 4); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.cs b/Items/Placeables/FurnitureStratus/StratusChandelier.cs index 504ad58da5..57511f1e49 100644 --- a/Items/Placeables/FurnitureStratus/StratusChandelier.cs +++ b/Items/Placeables/FurnitureStratus/StratusChandelier.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusChandelier : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusChandelier"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusChest.cs b/Items/Placeables/FurnitureStratus/StratusChest.cs index 78c04c5841..afe7da57c7 100644 --- a/Items/Placeables/FurnitureStratus/StratusChest.cs +++ b/Items/Placeables/FurnitureStratus/StratusChest.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusChest : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusChest"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusChest"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 8); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusClock.cs b/Items/Placeables/FurnitureStratus/StratusClock.cs index 8db3cb7a14..040b0072a3 100644 --- a/Items/Placeables/FurnitureStratus/StratusClock.cs +++ b/Items/Placeables/FurnitureStratus/StratusClock.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusClock : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusClock"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 10); @@ -34,5 +34,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.cs b/Items/Placeables/FurnitureStratus/StratusDoor.cs index b464f900ee..7d80e4df14 100644 --- a/Items/Placeables/FurnitureStratus/StratusDoor.cs +++ b/Items/Placeables/FurnitureStratus/StratusDoor.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusDoor : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusDoorClosed"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 6); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.cs b/Items/Placeables/FurnitureStratus/StratusDresser.cs index ca4ae365fd..9c5f8c2ae5 100644 --- a/Items/Placeables/FurnitureStratus/StratusDresser.cs +++ b/Items/Placeables/FurnitureStratus/StratusDresser.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusDresser : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusDresser"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 16); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.cs b/Items/Placeables/FurnitureStratus/StratusLamp.cs index cc11b30679..186d8d4b20 100644 --- a/Items/Placeables/FurnitureStratus/StratusLamp.cs +++ b/Items/Placeables/FurnitureStratus/StratusLamp.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusLamp : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusLamp"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 3); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.cs b/Items/Placeables/FurnitureStratus/StratusLantern.cs index 05071bc7fc..edaa6fee47 100644 --- a/Items/Placeables/FurnitureStratus/StratusLantern.cs +++ b/Items/Placeables/FurnitureStratus/StratusLantern.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusLantern : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusLantern"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 6); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.cs b/Items/Placeables/FurnitureStratus/StratusPiano.cs index 611f64466c..831d854038 100644 --- a/Items/Placeables/FurnitureStratus/StratusPiano.cs +++ b/Items/Placeables/FurnitureStratus/StratusPiano.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusPiano : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusPiano"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusPiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 15); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusPlatform.cs b/Items/Placeables/FurnitureStratus/StratusPlatform.cs index d3141830c9..c1aae5843a 100644 --- a/Items/Placeables/FurnitureStratus/StratusPlatform.cs +++ b/Items/Placeables/FurnitureStratus/StratusPlatform.cs @@ -3,32 +3,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusPlatform : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusPlatform"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusPlatform"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 1); recipe.SetResult(this, 2); recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusSink.cs b/Items/Placeables/FurnitureStratus/StratusSink.cs index b114fd9ee6..c543b6a20b 100644 --- a/Items/Placeables/FurnitureStratus/StratusSink.cs +++ b/Items/Placeables/FurnitureStratus/StratusSink.cs @@ -4,27 +4,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusSink : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Counts as a water source"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusSink"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.cs b/Items/Placeables/FurnitureStratus/StratusSofa.cs index 2ad95d60a1..8463518b42 100644 --- a/Items/Placeables/FurnitureStratus/StratusSofa.cs +++ b/Items/Placeables/FurnitureStratus/StratusSofa.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusSofa : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusSofa"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusSofa"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusTable.cs b/Items/Placeables/FurnitureStratus/StratusTable.cs index 813e9dbe64..c92b666ad3 100644 --- a/Items/Placeables/FurnitureStratus/StratusTable.cs +++ b/Items/Placeables/FurnitureStratus/StratusTable.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusTable : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusTable"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusTable"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 8); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureStratus/StratusWall.cs b/Items/Placeables/FurnitureStratus/StratusWall.cs index 3279d54caf..d84f6897d9 100644 --- a/Items/Placeables/FurnitureStratus/StratusWall.cs +++ b/Items/Placeables/FurnitureStratus/StratusWall.cs @@ -2,24 +2,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { - public class StratusWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class StratusWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("StratusWall"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("StratusWall"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureStratus/StratusWorkbench.cs b/Items/Placeables/FurnitureStratus/StratusWorkbench.cs index 4aa5d7be59..02062bc311 100644 --- a/Items/Placeables/FurnitureStratus/StratusWorkbench.cs +++ b/Items/Placeables/FurnitureStratus/StratusWorkbench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { public class StratusWorkbench : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Stratus Work Bench"); item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("StratusWorkbench"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("StratusWorkbench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StratusBricks", 10); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddTile(412); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs index 159c5d5b1e..aa590509fa 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs @@ -5,26 +5,26 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid { public class SmoothVoidstone : ModItem { - public override void SetStaticDefaults() - { + public override void SetStaticDefaults() + { } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; item.consumable = true; - item.createTile = mod.TileType("SmoothVoidstone"); - } + item.createTile = mod.TileType("SmoothVoidstone"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "Voidstone", 1); recipe.SetResult(this); @@ -41,5 +41,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs index 1a25a11a9b..d12ea32868 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class SmoothVoidstonePlatform : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("SmoothVoidstonePlatform"); - } + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("SmoothVoidstonePlatform"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone"); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs index 2127f42071..3dd3b2d083 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class SmoothVoidstoneWall : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; item.consumable = true; - item.createWall = mod.WallType("SmoothVoidstoneWall"); - } + item.createWall = mod.WallType("SmoothVoidstoneWall"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone"); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidBath.cs b/Items/Placeables/FurnitureVoid/VoidBath.cs index 065bffc15e..2a3fc3c64c 100644 --- a/Items/Placeables/FurnitureVoid/VoidBath.cs +++ b/Items/Placeables/FurnitureVoid/VoidBath.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class VoidBath : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Void Bathtub"); item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidBath"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidBath"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 14); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidBed.cs b/Items/Placeables/FurnitureVoid/VoidBed.cs index 2f48ab4911..22bd431841 100644 --- a/Items/Placeables/FurnitureVoid/VoidBed.cs +++ b/Items/Placeables/FurnitureVoid/VoidBed.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidBed : ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidBed : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidBed"); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidBed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 15); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidBookcase.cs b/Items/Placeables/FurnitureVoid/VoidBookcase.cs index 8f17b1ab33..5993ed9ee8 100644 --- a/Items/Placeables/FurnitureVoid/VoidBookcase.cs +++ b/Items/Placeables/FurnitureVoid/VoidBookcase.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidBookcase : ModItem - { - public override void SetStaticDefaults() + public class VoidBookcase : ModItem + { + public override void SetStaticDefaults() { } - public override void SetDefaults() + public override void SetDefaults() { item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidBookcase"); - } + item.height = 20; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidBookcase"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 20); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs index def534c913..67dfffb85c 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidCandelabra : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidCandelabra"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidCandelabra"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 5); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidCandle.cs b/Items/Placeables/FurnitureVoid/VoidCandle.cs index 22032fe50c..4acaa47529 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandle.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandle.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidCandle: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidCandle : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidCandle"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidCandle"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 4); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidChair.cs b/Items/Placeables/FurnitureVoid/VoidChair.cs index 00c0e06c90..3fd6f029ef 100644 --- a/Items/Placeables/FurnitureVoid/VoidChair.cs +++ b/Items/Placeables/FurnitureVoid/VoidChair.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class VoidChair : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidChair"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidChair"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 4); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidChandelier.cs b/Items/Placeables/FurnitureVoid/VoidChandelier.cs index 39e3767c0e..a24e0a9932 100644 --- a/Items/Placeables/FurnitureVoid/VoidChandelier.cs +++ b/Items/Placeables/FurnitureVoid/VoidChandelier.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidChandelier: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidChandelier : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidChandelier"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidChandelier"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidChest.cs b/Items/Placeables/FurnitureVoid/VoidChest.cs index 87b107f5d7..830ab36214 100644 --- a/Items/Placeables/FurnitureVoid/VoidChest.cs +++ b/Items/Placeables/FurnitureVoid/VoidChest.cs @@ -3,24 +3,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidChest : ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidChest : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidChest"); + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidChest"); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureVoid/VoidClock.cs b/Items/Placeables/FurnitureVoid/VoidClock.cs index 7c3e15f1bc..6fab8690c4 100644 --- a/Items/Placeables/FurnitureVoid/VoidClock.cs +++ b/Items/Placeables/FurnitureVoid/VoidClock.cs @@ -3,28 +3,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidClock : ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidClock : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.SetNameOverride("Void Obelisk"); - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidClock"); - } + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidClock"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 3); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidCondenser.cs b/Items/Placeables/FurnitureVoid/VoidCondenser.cs index 6cfdb9b5ef..d95d7fc069 100644 --- a/Items/Placeables/FurnitureVoid/VoidCondenser.cs +++ b/Items/Placeables/FurnitureVoid/VoidCondenser.cs @@ -4,33 +4,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class VoidCondenser : ModItem - { - public override void SetStaticDefaults() + { + public override void SetStaticDefaults() { Tooltip.SetDefault("Used for special crafting"); } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidCondenser"); - } + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidCondenser"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 25); recipe.SetResult(this, 1); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidDoor.cs b/Items/Placeables/FurnitureVoid/VoidDoor.cs index 91df991e2b..16679eac92 100644 --- a/Items/Placeables/FurnitureVoid/VoidDoor.cs +++ b/Items/Placeables/FurnitureVoid/VoidDoor.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class VoidDoor : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidDoorClosed"); - } + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidDoorClosed"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 6); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidDresser.cs b/Items/Placeables/FurnitureVoid/VoidDresser.cs index 1f66ced132..5f128c9bdd 100644 --- a/Items/Placeables/FurnitureVoid/VoidDresser.cs +++ b/Items/Placeables/FurnitureVoid/VoidDresser.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidDresser: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidDresser : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidDresser"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidDresser"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 16); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidLamp.cs b/Items/Placeables/FurnitureVoid/VoidLamp.cs index c04b17857f..941d2ba57d 100644 --- a/Items/Placeables/FurnitureVoid/VoidLamp.cs +++ b/Items/Placeables/FurnitureVoid/VoidLamp.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidLamp: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidLamp : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidLamp"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidLamp"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "Lumenite"); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidLantern.cs b/Items/Placeables/FurnitureVoid/VoidLantern.cs index 8c90594832..4df3756c06 100644 --- a/Items/Placeables/FurnitureVoid/VoidLantern.cs +++ b/Items/Placeables/FurnitureVoid/VoidLantern.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidLantern: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidLantern : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidLantern"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidLantern"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 6); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidPiano.cs b/Items/Placeables/FurnitureVoid/VoidPiano.cs index de09dbf2d8..9c7d6a62ac 100644 --- a/Items/Placeables/FurnitureVoid/VoidPiano.cs +++ b/Items/Placeables/FurnitureVoid/VoidPiano.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidPiano: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidPiano : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidPiano"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidPiano"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bone, 4); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidSink.cs b/Items/Placeables/FurnitureVoid/VoidSink.cs index dc534e9972..76c9d8aef9 100644 --- a/Items/Placeables/FurnitureVoid/VoidSink.cs +++ b/Items/Placeables/FurnitureVoid/VoidSink.cs @@ -3,7 +3,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidSink: ModItem + public class VoidSink : ModItem { public override void SetStaticDefaults() { @@ -11,20 +11,20 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid } public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidSink"); - } + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidSink"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 6); @@ -33,5 +33,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidSofa.cs b/Items/Placeables/FurnitureVoid/VoidSofa.cs index 22e828c7f2..9c6449268d 100644 --- a/Items/Placeables/FurnitureVoid/VoidSofa.cs +++ b/Items/Placeables/FurnitureVoid/VoidSofa.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidSofa : ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidSofa : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidSofa"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidSofa"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 5); @@ -32,5 +32,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidTable.cs b/Items/Placeables/FurnitureVoid/VoidTable.cs index b4c10d7186..327ba863f3 100644 --- a/Items/Placeables/FurnitureVoid/VoidTable.cs +++ b/Items/Placeables/FurnitureVoid/VoidTable.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { - public class VoidTable: ModItem - { - public override void SetStaticDefaults() - { - } + public class VoidTable : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; item.createTile = mod.TileType("VoidTable"); } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 8); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidWorkbench.cs b/Items/Placeables/FurnitureVoid/VoidWorkbench.cs index 35ecb81955..a9066cf471 100644 --- a/Items/Placeables/FurnitureVoid/VoidWorkbench.cs +++ b/Items/Placeables/FurnitureVoid/VoidWorkbench.cs @@ -3,27 +3,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class VoidWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() + public override void SetDefaults() { item.SetNameOverride("Void Work Bench"); item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidWorkbench"); - } + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidWorkbench"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone", 10); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(null, "VoidCondenser"); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs b/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs index 439f650a0a..4e26a70c78 100644 --- a/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs +++ b/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs @@ -4,27 +4,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class VoidstoneSlab : ModItem - { - public override void SetStaticDefaults() - { + { + public override void SetStaticDefaults() + { } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("VoidstoneSlab"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("VoidstoneSlab"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SmoothVoidstone"); recipe.SetResult(this); @@ -36,5 +36,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs b/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs index b9bea292c6..ed37be0007 100644 --- a/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs +++ b/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs @@ -4,26 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid { public class VoidstoneSlabWall : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; item.consumable = true; - item.createWall = mod.WallType("VoidstoneSlabWall"); - } + item.createWall = mod.WallType("VoidstoneSlabWall"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "VoidstoneSlab"); @@ -31,5 +31,5 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/GreenBrickWallUnsafe.cs b/Items/Placeables/GreenBrickWallUnsafe.cs index baf708ec42..b224b11e3a 100644 --- a/Items/Placeables/GreenBrickWallUnsafe.cs +++ b/Items/Placeables/GreenBrickWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/GreenSlabWallUnsafe.cs b/Items/Placeables/GreenSlabWallUnsafe.cs index 74659f9854..a5452213c8 100644 --- a/Items/Placeables/GreenSlabWallUnsafe.cs +++ b/Items/Placeables/GreenSlabWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/GreenTiledWallUnsafe.cs b/Items/Placeables/GreenTiledWallUnsafe.cs index 9c5de0a502..bea0a803e9 100644 --- a/Items/Placeables/GreenTiledWallUnsafe.cs +++ b/Items/Placeables/GreenTiledWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/HiveMindTrophy.cs b/Items/Placeables/HiveMindTrophy.cs index 033aa1f46c..bdcc1492b4 100644 --- a/Items/Placeables/HiveMindTrophy.cs +++ b/Items/Placeables/HiveMindTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class HiveMindTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Mind Trophy"); - } + public class HiveMindTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Mind Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 8; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 8; + } + } } diff --git a/Items/Placeables/LeviathanTrophy.cs b/Items/Placeables/LeviathanTrophy.cs index 58370f3273..a9bfdb486f 100644 --- a/Items/Placeables/LeviathanTrophy.cs +++ b/Items/Placeables/LeviathanTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class LeviathanTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan Trophy"); - } + public class LeviathanTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 5; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 5; + } + } } diff --git a/Items/Placeables/Navystone.cs b/Items/Placeables/Navystone.cs index 1bc20b70f1..64a398286e 100644 --- a/Items/Placeables/Navystone.cs +++ b/Items/Placeables/Navystone.cs @@ -23,18 +23,18 @@ namespace CalamityMod.Items.Placeables item.maxStack = 999; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "NavystoneWallSafe", 4); - recipe.AddTile(18); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("EutrophicPlatform"), 2); - recipe.SetResult(this); - recipe.AddTile(null, "EutrophicCrafting"); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "NavystoneWallSafe", 4); + recipe.AddTile(18); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("EutrophicPlatform"), 2); + recipe.SetResult(this); + recipe.AddTile(null, "EutrophicCrafting"); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index bf444c17ba..a74c9317e5 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -4,23 +4,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class PerennialBrick : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PerennialBrick"); + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PerennialBrick"); } public override void AddRecipes() diff --git a/Items/Placeables/PerennialBrickWall.cs b/Items/Placeables/PerennialBrickWall.cs index e153195285..70c1faf51b 100644 --- a/Items/Placeables/PerennialBrickWall.cs +++ b/Items/Placeables/PerennialBrickWall.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class PerennialBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class PerennialBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("PerennialBrickWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("PerennialBrickWall"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("PerennialBrick")); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/PerennialOre.cs b/Items/Placeables/PerennialOre.cs index cfcd27ce10..3b172532dc 100644 --- a/Items/Placeables/PerennialOre.cs +++ b/Items/Placeables/PerennialOre.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 18); - item.rare = 7; + item.rare = 7; } } } diff --git a/Items/Placeables/PerforatorTrophy.cs b/Items/Placeables/PerforatorTrophy.cs index 4dcba8784d..0f47114585 100644 --- a/Items/Placeables/PerforatorTrophy.cs +++ b/Items/Placeables/PerforatorTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class PerforatorTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perforator Trophy"); - } + public class PerforatorTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforator Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 1; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 1; + } + } } diff --git a/Items/Placeables/PinkBrickWallUnsafe.cs b/Items/Placeables/PinkBrickWallUnsafe.cs index 8acc2a6d40..465a50bd0f 100644 --- a/Items/Placeables/PinkBrickWallUnsafe.cs +++ b/Items/Placeables/PinkBrickWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/PinkSlabWallUnsafe.cs b/Items/Placeables/PinkSlabWallUnsafe.cs index b663c4c8d0..27dbf59c2c 100644 --- a/Items/Placeables/PinkSlabWallUnsafe.cs +++ b/Items/Placeables/PinkSlabWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/PinkTiledWallUnsafe.cs b/Items/Placeables/PinkTiledWallUnsafe.cs index d0bd279704..0d1ff8e283 100644 --- a/Items/Placeables/PinkTiledWallUnsafe.cs +++ b/Items/Placeables/PinkTiledWallUnsafe.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { diff --git a/Items/Placeables/PlaguebringerGoliathTrophy.cs b/Items/Placeables/PlaguebringerGoliathTrophy.cs index 1f2a73c73a..5e400e836e 100644 --- a/Items/Placeables/PlaguebringerGoliathTrophy.cs +++ b/Items/Placeables/PlaguebringerGoliathTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class PlaguebringerGoliathTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plaguebringer Goliath Trophy"); - } + public class PlaguebringerGoliathTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Goliath Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 4; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 4; + } + } } diff --git a/Items/Placeables/PolterghastTrophy.cs b/Items/Placeables/PolterghastTrophy.cs index 0ef182c3ee..c20f9f8357 100644 --- a/Items/Placeables/PolterghastTrophy.cs +++ b/Items/Placeables/PolterghastTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class PolterghastTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast Trophy"); - } + public class PolterghastTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 17; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 17; + } + } } diff --git a/Items/Placeables/PrismShard.cs b/Items/Placeables/PrismShard.cs index 7c07d2da93..9af4704ee7 100644 --- a/Items/Placeables/PrismShard.cs +++ b/Items/Placeables/PrismShard.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 2; + item.rare = 2; } } } diff --git a/Items/Placeables/ProvidenceTrophy.cs b/Items/Placeables/ProvidenceTrophy.cs index 12d33fbf66..7e61ce891a 100644 --- a/Items/Placeables/ProvidenceTrophy.cs +++ b/Items/Placeables/ProvidenceTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class ProvidenceTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence Trophy"); - } + public class ProvidenceTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 6; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 6; + } + } } diff --git a/Items/Placeables/RavagerTrophy.cs b/Items/Placeables/RavagerTrophy.cs index b272d177e6..cc3922cf54 100644 --- a/Items/Placeables/RavagerTrophy.cs +++ b/Items/Placeables/RavagerTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class RavagerTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager Trophy"); - } + public class RavagerTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 22; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 22; + } + } } diff --git a/Items/Placeables/SeaPrism.cs b/Items/Placeables/SeaPrism.cs index 90f0e9f5b4..970140690f 100644 --- a/Items/Placeables/SeaPrism.cs +++ b/Items/Placeables/SeaPrism.cs @@ -24,16 +24,16 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 2; + item.rare = 2; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PrismShard", 5); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PrismShard", 5); + recipe.SetResult(this); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + } + } } diff --git a/Items/Placeables/SignusTrophy.cs b/Items/Placeables/SignusTrophy.cs index fce8f75744..3cfa902755 100644 --- a/Items/Placeables/SignusTrophy.cs +++ b/Items/Placeables/SignusTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class SignusTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Signus Trophy"); - } + public class SignusTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Signus Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 11; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 11; + } + } } diff --git a/Items/Placeables/SlimeGodTrophy.cs b/Items/Placeables/SlimeGodTrophy.cs index ab7292be44..ae23b0f8b1 100644 --- a/Items/Placeables/SlimeGodTrophy.cs +++ b/Items/Placeables/SlimeGodTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class SlimeGodTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God Trophy"); - } + public class SlimeGodTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 2; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 2; + } + } } diff --git a/Items/Placeables/Tenebris.cs b/Items/Placeables/Tenebris.cs index 86401b5f48..3c83bff3ff 100644 --- a/Items/Placeables/Tenebris.cs +++ b/Items/Placeables/Tenebris.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 8); - item.rare = 7; + item.rare = 7; } } } diff --git a/Items/Placeables/TranquilityCandle.cs b/Items/Placeables/TranquilityCandle.cs index 4f1bfd81c2..619e93db90 100644 --- a/Items/Placeables/TranquilityCandle.cs +++ b/Items/Placeables/TranquilityCandle.cs @@ -1,39 +1,38 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Placeables { - public class TranquilityCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tranquility Candle"); - Tooltip.SetDefault("The mere presence of this candle calms surrounding enemies drastically"); - } + public class TranquilityCandle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tranquility Candle"); + Tooltip.SetDefault("The mere presence of this candle calms surrounding enemies drastically"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 500; - item.createTile = mod.TileType("TranquilityCandle"); - } + public override void SetDefaults() + { + item.width = 16; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 500; + item.createTile = mod.TileType("TranquilityCandle"); + } - public override void HoldItem(Player player) - { - player.Calamity().tranquilityCandle = true; - } + public override void HoldItem(Player player) + { + player.Calamity().tranquilityCandle = true; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.PeaceCandle, 3); diff --git a/Items/Placeables/UelibloomBrickWall.cs b/Items/Placeables/UelibloomBrickWall.cs index 622952d782..e5e6980539 100644 --- a/Items/Placeables/UelibloomBrickWall.cs +++ b/Items/Placeables/UelibloomBrickWall.cs @@ -2,27 +2,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class UelibloomBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } + public class UelibloomBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("UelibloomBrickWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("UelibloomBrickWall"); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(mod.ItemType("UelibloomBrick")); @@ -30,5 +30,5 @@ namespace CalamityMod.Items.Placeables recipe.AddTile(18); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/UelibloomOre.cs b/Items/Placeables/UelibloomOre.cs index 002eeef804..710c304e8f 100644 --- a/Items/Placeables/UelibloomOre.cs +++ b/Items/Placeables/UelibloomOre.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Placeables item.width = 10; item.height = 10; item.maxStack = 999; - item.rare = 10; + item.rare = 10; item.value = Item.sellPrice(silver: 50); - } + } public override void ModifyTooltips(List list) { diff --git a/Items/Placeables/Voidstone.cs b/Items/Placeables/Voidstone.cs index 546e7fcf20..c760e35514 100644 --- a/Items/Placeables/Voidstone.cs +++ b/Items/Placeables/Voidstone.cs @@ -5,32 +5,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class Voidstone : ModItem - { - public override void SetStaticDefaults() - { + { + public override void SetStaticDefaults() + { } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("Voidstone"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("Voidstone"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "VoidstoneWall", 4); recipe.SetResult(this); recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/VoidstoneWall.cs b/Items/Placeables/VoidstoneWall.cs index 3bce2e32ad..af3f8fea2a 100644 --- a/Items/Placeables/VoidstoneWall.cs +++ b/Items/Placeables/VoidstoneWall.cs @@ -4,32 +4,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { public class VoidstoneWall : ModItem - { - public override void SetStaticDefaults() - { - } + { + public override void SetStaticDefaults() + { + } - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("VoidstoneWall"); - } + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("VoidstoneWall"); + } - public override void AddRecipes() - { + public override void AddRecipes() + { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "Voidstone"); recipe.SetResult(this, 4); recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } - } + } } diff --git a/Items/Placeables/WeaverTrophy.cs b/Items/Placeables/WeaverTrophy.cs index 00eca36411..b86cd43a0a 100644 --- a/Items/Placeables/WeaverTrophy.cs +++ b/Items/Placeables/WeaverTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class WeaverTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Weaver Trophy"); - } + public class WeaverTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Weaver Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 12; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 12; + } + } } diff --git a/Items/Placeables/YharonTrophy.cs b/Items/Placeables/YharonTrophy.cs index 542981cab9..25cc2cb510 100644 --- a/Items/Placeables/YharonTrophy.cs +++ b/Items/Placeables/YharonTrophy.cs @@ -2,28 +2,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class YharonTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharon Trophy"); - } + public class YharonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharon Trophy"); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 10; - } - } + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 10; + } + } } diff --git a/Items/PlaguebringerGoliath/Abomination.cs b/Items/PlaguebringerGoliath/Abomination.cs index f180dc52a0..3f9bed5496 100644 --- a/Items/PlaguebringerGoliath/Abomination.cs +++ b/Items/PlaguebringerGoliath/Abomination.cs @@ -5,49 +5,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.PlaguebringerGoliath { public class Abomination : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abombination"); - Tooltip.SetDefault("Calls in the airborne jungle abomination\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abombination"); + Tooltip.SetDefault("Calls in the airborne jungle abomination\n" + "Summons the Plaguebringer Goliath"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 8; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 8; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); - } + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PlaguebringerGoliath")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PlaguebringerGoliath")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PlagueCellCluster", 10); - recipe.AddIngredient(ItemID.IronBar, 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PlagueCellCluster", 10); + recipe.AddIngredient(ItemID.IronBar, 5); recipe.anyIronBar = true; recipe.AddIngredient(ItemID.Stinger, 2); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PlaguebringerGoliath/BloomStone.cs b/Items/PlaguebringerGoliath/BloomStone.cs index d620b2b507..3c7312b16d 100644 --- a/Items/PlaguebringerGoliath/BloomStone.cs +++ b/Items/PlaguebringerGoliath/BloomStone.cs @@ -1,23 +1,22 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.PlaguebringerGoliath { public class BloomStone : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloom Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Enemies that get near you take damage and all damage is increased by 3%\n" + - "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 7)); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloom Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Enemies that get near you take damage and all damage is increased by 3%\n" + + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 7)); + } public override void SetDefaults() { @@ -25,146 +24,146 @@ namespace CalamityMod.Items.PlaguebringerGoliath item.height = 20; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; - item.accessory = true; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) - { + { CalamityPlayer modPlayer = player.Calamity(); Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.25f, 0.4f, 0.2f); - player.allDamage += 0.03f; - int bloomCounter = 0; - int num = 186; - float num2 = 150f; - bool flag = bloomCounter % 60 == 0; - int num3 = 10; - int random = Main.rand.Next(10); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 120, false); - } - if (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - bloomCounter++; - if (bloomCounter >= 180) - { - bloomCounter = 0; - } - if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) - { - int num4 = (int)player.Center.X / 16; - int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; - if (Main.tile[num4, num5] == null) - { - Main.tile[num4, num5] = new Tile(); - } - if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) - { - Main.tile[num4, num5].frameY = 0; - Main.tile[num4, num5].slope(0); - Main.tile[num4, num5].halfBrick(false); - if (Main.tile[num4, num5 + 1].type == 0) - { - if (Main.rand.NextBool(1000)) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 227; - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - if (Main.tile[num4, num5 + 1].type == 2) - { - if (Main.rand.NextBool(2)) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 3; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 73; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 109) - { - if (Main.rand.NextBool(2)) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 110; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 113; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 60) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 74; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - } - } - } + player.allDamage += 0.03f; + int bloomCounter = 0; + int num = 186; + float num2 = 150f; + bool flag = bloomCounter % 60 == 0; + int num3 = 10; + int random = Main.rand.Next(10); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 120, false); + } + if (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + bloomCounter++; + if (bloomCounter >= 180) + { + bloomCounter = 0; + } + if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) + { + int num4 = (int)player.Center.X / 16; + int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; + if (Main.tile[num4, num5] == null) + { + Main.tile[num4, num5] = new Tile(); + } + if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) + { + Main.tile[num4, num5].frameY = 0; + Main.tile[num4, num5].slope(0); + Main.tile[num4, num5].halfBrick(false); + if (Main.tile[num4, num5 + 1].type == 0) + { + if (Main.rand.NextBool(1000)) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 227; + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + if (Main.tile[num4, num5 + 1].type == 2) + { + if (Main.rand.NextBool(2)) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 3; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 73; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 109) + { + if (Main.rand.NextBool(2)) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 110; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 113; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 60) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 74; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + } + } + } } } diff --git a/Items/PlaguebringerGoliath/PlagueCellCluster.cs b/Items/PlaguebringerGoliath/PlagueCellCluster.cs index 8212662958..e19acb3b75 100644 --- a/Items/PlaguebringerGoliath/PlagueCellCluster.cs +++ b/Items/PlaguebringerGoliath/PlagueCellCluster.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.PlaguebringerGoliath { public class PlagueCellCluster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Cell Canister"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Cell Canister"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + } } diff --git a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs index 55fa42f485..002252435e 100644 --- a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs +++ b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs @@ -1,60 +1,60 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Items.PlaguebringerGoliath { - public class PlaguebringerGoliathBag : ModItem - { - public override int BossBagNPC => mod.NPCType("PlaguebringerGoliath"); + public class PlaguebringerGoliathBag : ModItem + { + public override int BossBagNPC => mod.NPCType("PlaguebringerGoliath"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("PlagueCellCluster"), 13, 17); + // Materials + DropHelper.DropItem(player, mod.ItemType("PlagueCellCluster"), 13, 17); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("VirulentKatana"), 3); // Virulence - DropHelper.DropItemChance(player, mod.ItemType("DiseasedPike"), 3); - DropHelper.DropItemChance(player, mod.ItemType("ThePlaguebringer"), 3); // Pandemic - DropHelper.DropItemChance(player, mod.ItemType("Malevolence"), 3); - DropHelper.DropItemChance(player, mod.ItemType("PestilentDefiler"), 3); - DropHelper.DropItemChance(player, mod.ItemType("TheHive"), 3); - DropHelper.DropItemChance(player, mod.ItemType("MepheticSprayer"), 3); // Blight Spewer - DropHelper.DropItemChance(player, mod.ItemType("PlagueStaff"), 3); - float malachiteChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("Malachite"), CalamityWorld.revenge, malachiteChance); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("VirulentKatana"), 3); // Virulence + DropHelper.DropItemChance(player, mod.ItemType("DiseasedPike"), 3); + DropHelper.DropItemChance(player, mod.ItemType("ThePlaguebringer"), 3); // Pandemic + DropHelper.DropItemChance(player, mod.ItemType("Malevolence"), 3); + DropHelper.DropItemChance(player, mod.ItemType("PestilentDefiler"), 3); + DropHelper.DropItemChance(player, mod.ItemType("TheHive"), 3); + DropHelper.DropItemChance(player, mod.ItemType("MepheticSprayer"), 3); // Blight Spewer + DropHelper.DropItemChance(player, mod.ItemType("PlagueStaff"), 3); + float malachiteChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("Malachite"), CalamityWorld.revenge, malachiteChance); - // Equipment - DropHelper.DropItem(player, mod.ItemType("ToxicHeart")); - DropHelper.DropItemChance(player, mod.ItemType("BloomStone"), 10); + // Equipment + DropHelper.DropItem(player, mod.ItemType("ToxicHeart")); + DropHelper.DropItemChance(player, mod.ItemType("BloomStone"), 10); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("PlaguebringerGoliathMask"), 7); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("PlaguebringerGoliathMask"), 7); + } + } } diff --git a/Items/PlaguebringerGoliath/ToxicHeart.cs b/Items/PlaguebringerGoliath/ToxicHeart.cs index e5e4ba4dc4..5b11720fe9 100644 --- a/Items/PlaguebringerGoliath/ToxicHeart.cs +++ b/Items/PlaguebringerGoliath/ToxicHeart.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.PlaguebringerGoliath item.height = 32; item.value = Item.buyPrice(0, 30, 0, 0); item.expert = true; - item.rare = 9; - item.accessory = true; + item.rare = 9; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Polterghast/Affliction.cs b/Items/Polterghast/Affliction.cs index e1a14a4a70..c65ad727ff 100644 --- a/Items/Polterghast/Affliction.cs +++ b/Items/Polterghast/Affliction.cs @@ -1,40 +1,40 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Polterghast { public class Affliction : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Affliction"); - Tooltip.SetDefault("Gives you and all other players on your team +1 life regen,\n" + - "+10% max life, 7% damage reduction, 20 defense, and 12% increased damage"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Affliction"); + Tooltip.SetDefault("Gives you and all other players on your team +1 life regen,\n" + + "+10% max life, 7% damage reduction, 20 defense, and 12% increased damage"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.accessory = true; - item.expert = true; - item.rare = 9; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.expert = true; + item.rare = 9; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.affliction = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) - { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) - { - Main.player[myPlayer].AddBuff(mod.BuffType("Afflicted"), 20, true); - } - } - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.affliction = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + int myPlayer = Main.myPlayer; + if (Main.player[myPlayer].team == player.team && player.team != 0) + { + Main.player[myPlayer].AddBuff(mod.BuffType("Afflicted"), 20, true); + } + } + } + } } diff --git a/Items/Polterghast/NecroplasmicBeacon.cs b/Items/Polterghast/NecroplasmicBeacon.cs index f76659fd54..652ba675dd 100644 --- a/Items/Polterghast/NecroplasmicBeacon.cs +++ b/Items/Polterghast/NecroplasmicBeacon.cs @@ -1,50 +1,50 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.Polterghast { public class NecroplasmicBeacon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Necroplasmic Beacon"); - Tooltip.SetDefault("It's spooky\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Necroplasmic Beacon"); + Tooltip.SetDefault("It's spooky\n" + "Summons Polterghast\n" + "Not consumable"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.Calamity().postMoonLordRarity = 13; + } - public override bool CanUseItem(Player player) - { - return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && CalamityWorld.downedBossAny; - } + public override bool CanUseItem(Player player) + { + return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && CalamityWorld.downedBossAny; + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Polterghast")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Polterghast")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Polterghast/PolterghastBag.cs b/Items/Polterghast/PolterghastBag.cs index e7cc85da65..e26abd2493 100644 --- a/Items/Polterghast/PolterghastBag.cs +++ b/Items/Polterghast/PolterghastBag.cs @@ -1,57 +1,57 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Items.Polterghast { - public class PolterghastBag : ModItem - { - public override int BossBagNPC => mod.NPCType("Polterghast"); + public class PolterghastBag : ModItem + { + public override int BossBagNPC => mod.NPCType("Polterghast"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("RuinousSoul"), 6, 10); + // Materials + DropHelper.DropItem(player, mod.ItemType("RuinousSoul"), 6, 10); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("TerrorBlade"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BansheeHook"), 3); - DropHelper.DropItemChance(player, mod.ItemType("DaemonsFlame"), 3); - DropHelper.DropItemChance(player, mod.ItemType("FatesReveal"), 3); - DropHelper.DropItemChance(player, mod.ItemType("GhastlyVisage"), 3); - DropHelper.DropItemChance(player, mod.ItemType("EtherealSubjugator"), 3); - DropHelper.DropItemChance(player, mod.ItemType("GhoulishGouger"), 3); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("TerrorBlade"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BansheeHook"), 3); + DropHelper.DropItemChance(player, mod.ItemType("DaemonsFlame"), 3); + DropHelper.DropItemChance(player, mod.ItemType("FatesReveal"), 3); + DropHelper.DropItemChance(player, mod.ItemType("GhastlyVisage"), 3); + DropHelper.DropItemChance(player, mod.ItemType("EtherealSubjugator"), 3); + DropHelper.DropItemChance(player, mod.ItemType("GhoulishGouger"), 3); - // Equipment - DropHelper.DropItem(player, mod.ItemType("Affliction")); - DropHelper.DropItemCondition(player, mod.ItemType("Ectoheart"), CalamityWorld.revenge); + // Equipment + DropHelper.DropItem(player, mod.ItemType("Affliction")); + DropHelper.DropItemCondition(player, mod.ItemType("Ectoheart"), CalamityWorld.revenge); - // Vanity - // there is no Polterghast mask yet - } - } + // Vanity + // there is no Polterghast mask yet + } + } } diff --git a/Items/Polterghast/RuinousSoul.cs b/Items/Polterghast/RuinousSoul.cs index 8a211e87d0..14f38a97b2 100644 --- a/Items/Polterghast/RuinousSoul.cs +++ b/Items/Polterghast/RuinousSoul.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Polterghast item.width = 20; item.height = 20; item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().postMoonLordRarity = 13; - } + item.value = Item.buyPrice(0, 7, 0, 0); + item.Calamity().postMoonLordRarity = 13; + } } } diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index f129fe0684..f9208fc760 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -1,65 +1,65 @@ using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; namespace CalamityMod.Items.Potions { - public class AstralInjection : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Injection"); - Tooltip.SetDefault("Gives mana sickness and hurts you when used, but you regenerate mana extremely quickly even while moving or casting spells"); - } + public class AstralInjection : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Injection"); + Tooltip.SetDefault("Gives mana sickness and hurts you when used, but you regenerate mana extremely quickly even while moving or casting spells"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("AstralInjectionBuff"); - item.buffTime = 180; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("AstralInjectionBuff"); + item.buffTime = 180; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void OnConsumeItem(Player player) - { - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime / 2, true); - player.statLife -= 5; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-5, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - } + public override void OnConsumeItem(Player player) + { + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime / 2, true); + player.statLife -= 5; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-5, true); + } + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(null, "Stardust", 4); - recipe.AddIngredient(null, "AstralJelly"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(null, "BloodOrb", 5); - recipe.AddIngredient(null, "AstralJelly"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "Stardust", 4); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "BloodOrb", 5); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index abca533195..59b8f795ce 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -4,46 +4,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class BoundingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bounding Potion"); - Tooltip.SetDefault("Increases jump height, jump speed, and fall damage resistance"); - } + public class BoundingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bounding Potion"); + Tooltip.SetDefault("Increases jump height, jump speed, and fall damage resistance"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("BoundingBuff"); - item.buffTime = 10800; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("BoundingBuff"); + item.buffTime = 10800; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.Frog); - recipe.AddIngredient(null, "ManeaterBulb"); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.Frog); + recipe.AddIngredient(null, "ManeaterBulb"); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/CadencePotion.cs b/Items/Potions/CadencePotion.cs index 25be16dbe1..6d4d025318 100644 --- a/Items/Potions/CadencePotion.cs +++ b/Items/Potions/CadencePotion.cs @@ -4,51 +4,51 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class CadencePotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cadance Potion"); - Tooltip.SetDefault("Gives the cadence buff which reduces shop prices and enemy aggro\n" + - "Increases life regen and increases max life by 25%\n" + - "Increases heart pickup range\n" + - "While this potion's buff is active, Regeneration Potion and Lifeforce Potion buffs are disabled"); - } + public class CadencePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cadance Potion"); + Tooltip.SetDefault("Gives the cadence buff which reduces shop prices and enemy aggro\n" + + "Increases life regen and increases max life by 25%\n" + + "Increases heart pickup range\n" + + "While this potion's buff is active, Regeneration Potion and Lifeforce Potion buffs are disabled"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Cadence"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Cadence"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LovePotion); - recipe.AddIngredient(ItemID.HeartreachPotion); - recipe.AddIngredient(ItemID.LifeforcePotion); - recipe.AddIngredient(ItemID.RegenerationPotion); - recipe.AddIngredient(ItemID.CalmingPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 40); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LovePotion); + recipe.AddIngredient(ItemID.HeartreachPotion); + recipe.AddIngredient(ItemID.LifeforcePotion); + recipe.AddIngredient(ItemID.RegenerationPotion); + recipe.AddIngredient(ItemID.CalmingPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs index 55d104af7f..ffdef135e4 100644 --- a/Items/Potions/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -4,46 +4,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class CalamitasBrew : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas' Brew"); - Tooltip.SetDefault("Adds abyssal flames to your melee projectiles and melee attacks\n" + - "Increases your movement speed by 15%"); - } + public class CalamitasBrew : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas' Brew"); + Tooltip.SetDefault("Adds abyssal flames to your melee projectiles and melee attacks\n" + + "Increases your movement speed by 15%"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("AbyssalWeapon"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("AbyssalWeapon"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "CalamityDust"); - recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "CalamityDust"); + recipe.AddTile(TileID.ImbuingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.ImbuingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/CalciumPotion.cs b/Items/Potions/CalciumPotion.cs index 03b8443fab..40a9a68433 100644 --- a/Items/Potions/CalciumPotion.cs +++ b/Items/Potions/CalciumPotion.cs @@ -4,45 +4,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class CalciumPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calcium Potion"); - Tooltip.SetDefault("Grants immunity to fall damage"); - } + public class CalciumPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calcium Potion"); + Tooltip.SetDefault("Grants immunity to fall damage"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("CalciumBuff"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("CalciumBuff"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "AncientBoneDust"); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "AncientBoneDust"); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index 065375eb7a..ddad5cc491 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -4,47 +4,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class CeaselessHungerPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ceaseless Hunger Potion"); - Tooltip.SetDefault("Causes you to suck up all items in the world"); - } + public class CeaselessHungerPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Hunger Potion"); + Tooltip.SetDefault("Causes you to suck up all items in the world"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("CeaselessHunger"); - item.buffTime = 600; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("CeaselessHunger"); + item.buffTime = 600; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/CrumblingPotion.cs b/Items/Potions/CrumblingPotion.cs index ddb21eff95..8c8bd44e98 100644 --- a/Items/Potions/CrumblingPotion.cs +++ b/Items/Potions/CrumblingPotion.cs @@ -4,48 +4,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class CrumblingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crumbling Potion"); - Tooltip.SetDefault("Increases melee and rogue critical strike chance by 5%\n" + - "Melee and rogue attacks break enemy armor"); - } + public class CrumblingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crumbling Potion"); + Tooltip.SetDefault("Increases melee and rogue critical strike chance by 5%\n" + + "Melee and rogue attacks break enemy armor"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("ArmorCrumbling"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("ArmorCrumbling"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 5); - recipe.AddIngredient(null, "AncientBoneDust"); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 5); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 5); + recipe.AddIngredient(null, "AncientBoneDust"); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 5); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index feb9aab53f..0418433541 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -1,61 +1,60 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Potions { - public class DraconicElixir : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draconic Elixir"); - Tooltip.SetDefault("Greatly increases wing flight time and speed and increases defense by 16\n" + - "God slayer revival heals you to full HP instead of 150 HP when triggered\n" + - "Silva invincibility heals you to full HP when triggered\n" + - "If you trigger the above heals you cannot drink this potion again for 30 seconds"); - } + public class DraconicElixir : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draconic Elixir"); + Tooltip.SetDefault("Greatly increases wing flight time and speed and increases defense by 16\n" + + "God slayer revival heals you to full HP instead of 150 HP when triggered\n" + + "Silva invincibility heals you to full HP when triggered\n" + + "If you trigger the above heals you cannot drink this potion again for 30 seconds"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("DraconicSurgeBuff"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("DraconicSurgeBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override bool CanUseItem(Player player) - { - return player.Calamity().draconicSurgeCooldown == 0; - } + public override bool CanUseItem(Player player) + { + return player.Calamity().draconicSurgeCooldown == 0; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "HellcasterFragment"); - recipe.AddIngredient(ItemID.Daybloom); - recipe.AddIngredient(ItemID.Moonglow); - recipe.AddIngredient(ItemID.Fireblossom); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 50); - recipe.AddIngredient(null, "HellcasterFragment"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "HellcasterFragment"); + recipe.AddIngredient(ItemID.Daybloom); + recipe.AddIngredient(ItemID.Moonglow); + recipe.AddIngredient(ItemID.Fireblossom); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 50); + recipe.AddIngredient(null, "HellcasterFragment"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index 2f6b380400..2333119d15 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -4,46 +4,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class GravityNormalizerPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gravity Normalizer Potion"); - Tooltip.SetDefault("Disables the low gravity of space and grants immunity to the distorted debuff"); - } + public class GravityNormalizerPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gravity Normalizer Potion"); + Tooltip.SetDefault("Disables the low gravity of space and grants immunity to the distorted debuff"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("GravityNormalizerBuff"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("GravityNormalizerBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GravitationPotion); - recipe.AddIngredient(null, "AstralJelly"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(null, "AstralJelly"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GravitationPotion); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/HolyWrathPotion.cs b/Items/Potions/HolyWrathPotion.cs index bc870dac13..18848afe79 100644 --- a/Items/Potions/HolyWrathPotion.cs +++ b/Items/Potions/HolyWrathPotion.cs @@ -4,49 +4,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class HolyWrathPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Wrath Potion"); - Tooltip.SetDefault("Increases damage by 12% and increases movement and horizontal flight speed by 5%\n" + - "Attacks inflict holy fire\n" + - "While this potion's buff is active the Wrath Potion's buff is disabled"); - } + public class HolyWrathPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Wrath Potion"); + Tooltip.SetDefault("Increases damage by 12% and increases movement and horizontal flight speed by 5%\n" + + "Attacks inflict holy fire\n" + + "While this potion's buff is active the Wrath Potion's buff is disabled"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("HolyWrathBuff"); - item.buffTime = 10800; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("HolyWrathBuff"); + item.buffTime = 10800; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WrathPotion); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 40); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WrathPotion); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index 55afb6b8f2..0686b7d9f0 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { public class OmegaHealingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Healing Potion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Healing Potion"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.healLife = 300; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.rare = 10; - item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.healLife = 300; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.rare = 10; + item.value = Item.buyPrice(0, 7, 0, 0); + item.Calamity().postMoonLordRarity = 13; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SupremeHealingPotion"); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SupremeHealingPotion"); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/PenumbraPotion.cs b/Items/Potions/PenumbraPotion.cs index d3c40e3f75..0f99ef43d6 100644 --- a/Items/Potions/PenumbraPotion.cs +++ b/Items/Potions/PenumbraPotion.cs @@ -4,48 +4,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class PenumbraPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Penumbra Potion"); - Tooltip.SetDefault("Rogue stealth regenerates 10% faster, 20% faster at night and 30% faster during an eclipse"); - } + public class PenumbraPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Penumbra Potion"); + Tooltip.SetDefault("Rogue stealth regenerates 10% faster, 20% faster at night and 30% faster during an eclipse"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("PenumbraBuff"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("PenumbraBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "CalamityDust", 3); - recipe.AddIngredient(ItemID.LunarTabletFragment, 2); - recipe.AddIngredient(null, "EssenceofChaos"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 30); - recipe.AddIngredient(ItemID.LunarTabletFragment); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "CalamityDust", 3); + recipe.AddIngredient(ItemID.LunarTabletFragment, 2); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddIngredient(ItemID.LunarTabletFragment); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index 009987c5ed..049f4761c7 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -4,49 +4,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class PhotosynthesisPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Photosynthesis Potion"); - Tooltip.SetDefault("You regen life quickly while not moving, this effect is five times as strong during daytime\n" + - "Dropped hearts heal more HP"); - } + public class PhotosynthesisPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Photosynthesis Potion"); + Tooltip.SetDefault("You regen life quickly while not moving, this effect is five times as strong during daytime\n" + + "Dropped hearts heal more HP"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("PhotosynthesisBuff"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("PhotosynthesisBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BeetleJuice", 2); - recipe.AddIngredient(null, "ManeaterBulb"); - recipe.AddIngredient(null, "TrapperBulb"); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 40); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BeetleJuice", 2); + recipe.AddIngredient(null, "ManeaterBulb"); + recipe.AddIngredient(null, "TrapperBulb"); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/PotionofOmniscience.cs b/Items/Potions/PotionofOmniscience.cs index 3a227e2cf8..0b741b8139 100644 --- a/Items/Potions/PotionofOmniscience.cs +++ b/Items/Potions/PotionofOmniscience.cs @@ -4,46 +4,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class PotionofOmniscience : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potion of Omniscience"); - Tooltip.SetDefault("Gives creature, danger, and treasure detection"); - } + public class PotionofOmniscience : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potion of Omniscience"); + Tooltip.SetDefault("Gives creature, danger, and treasure detection"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Omniscience"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Omniscience"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HunterPotion); - recipe.AddIngredient(ItemID.SpelunkerPotion); - recipe.AddIngredient(ItemID.TrapsightPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HunterPotion); + recipe.AddIngredient(ItemID.SpelunkerPotion); + recipe.AddIngredient(ItemID.TrapsightPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/ProfanedRagePotion.cs b/Items/Potions/ProfanedRagePotion.cs index 11a0ddce45..3f51d871de 100644 --- a/Items/Potions/ProfanedRagePotion.cs +++ b/Items/Potions/ProfanedRagePotion.cs @@ -4,49 +4,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class ProfanedRagePotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Rage Potion"); - Tooltip.SetDefault("Increases critical strike chance by 12% and increases movement and horizontal flight speed by 5%\n" + - "In Revengeance Mode you gain more rage when damaged\n" + - "While this potion's buff is active the Rage Potion's buff is disabled"); - } + public class ProfanedRagePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Rage Potion"); + Tooltip.SetDefault("Increases critical strike chance by 12% and increases movement and horizontal flight speed by 5%\n" + + "In Revengeance Mode you gain more rage when damaged\n" + + "While this potion's buff is active the Rage Potion's buff is disabled"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("ProfanedRageBuff"); - item.buffTime = 10800; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("ProfanedRageBuff"); + item.buffTime = 10800; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RagePotion); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 40); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RagePotion); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/PurifiedJam.cs b/Items/Potions/PurifiedJam.cs index 24e6f891b5..7cf367e59a 100644 --- a/Items/Potions/PurifiedJam.cs +++ b/Items/Potions/PurifiedJam.cs @@ -1,46 +1,46 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.Potions { - public class PurifiedJam : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purified Jam"); - Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds (5 seconds in Death Mode)\n" + - "Causes potion sickness when consumed\n" + - "Cannot be consumed while potion sickness is active\n" + - "Revengeance drop"); - } + public class PurifiedJam : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purified Jam"); + Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds (5 seconds in Death Mode)\n" + + "Causes potion sickness when consumed\n" + + "Cannot be consumed while potion sickness is active\n" + + "Revengeance drop"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } - public override bool UseItem(Player player) - { - player.AddBuff(mod.BuffType("Invincible"), (CalamityWorld.death ? 300 : 600)); - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 1500 : 1800)); - return true; - } - } + public override bool UseItem(Player player) + { + player.AddBuff(mod.BuffType("Invincible"), (CalamityWorld.death ? 300 : 600)); + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 1500 : 1800)); + return true; + } + } } diff --git a/Items/Potions/RevivifyPotion.cs b/Items/Potions/RevivifyPotion.cs index 0623a1e66e..da9c7980dc 100644 --- a/Items/Potions/RevivifyPotion.cs +++ b/Items/Potions/RevivifyPotion.cs @@ -1,60 +1,60 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Potions { - public class RevivifyPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Revivify Potion"); - Tooltip.SetDefault("Causes enemy attacks to heal you for a fraction of their damage for 15 seconds"); - } + public class RevivifyPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Revivify Potion"); + Tooltip.SetDefault("Causes enemy attacks to heal you for a fraction of their damage for 15 seconds"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.revivifyTimer = 900; - } - return true; - } + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.revivifyTimer = 900; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddIngredient(ItemID.CrystalShard, 5); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddIngredient(null, "BloodOrb", 50); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HolyWater, 5); + recipe.AddIngredient(null, "Stardust", 20); + recipe.AddIngredient(ItemID.CrystalShard, 5); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HolyWater, 5); + recipe.AddIngredient(null, "BloodOrb", 50); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/ShatteringPotion.cs b/Items/Potions/ShatteringPotion.cs index a952bf6aca..f07813fb23 100644 --- a/Items/Potions/ShatteringPotion.cs +++ b/Items/Potions/ShatteringPotion.cs @@ -4,48 +4,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class ShatteringPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattering Potion"); - Tooltip.SetDefault("Increases melee and rogue damage and critical strike chance by 8%\n" + - "Melee and rogue attacks break enemy armor\n" + - "While this potion's buff is active the Crumbling Potion's buff is disabled"); - } + public class ShatteringPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattering Potion"); + Tooltip.SetDefault("Increases melee and rogue damage and critical strike chance by 8%\n" + + "Melee and rogue attacks break enemy armor\n" + + "While this potion's buff is active the Crumbling Potion's buff is disabled"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("ArmorShattering"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("ArmorShattering"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CrumblingPotion", 2); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 30); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CrumblingPotion", 2); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index c8004a468d..b44862c98d 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -4,47 +4,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class SoaringPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soaring Potion"); - Tooltip.SetDefault("Increases flight time and horizontal flight speed by 10%"); - } + public class SoaringPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soaring Potion"); + Tooltip.SetDefault("Increases flight time and horizontal flight speed by 10%"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Soaring"); - item.buffTime = 14400; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Soaring"); + item.buffTime = 14400; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.Feather); - recipe.AddIngredient(ItemID.SoulofFlight); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 30); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.Feather); + recipe.AddIngredient(ItemID.SoulofFlight); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index 695a544437..6cdc72734d 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { public class SupremeHealingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Healing Potion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Healing Potion"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.healLife = 250; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.rare = 10; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.healLife = 250; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.rare = 10; + item.value = Item.buyPrice(0, 6, 50, 0); + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SuperHealingPotion); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SuperHealingPotion); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index a3f2d4bab7..63e0f1fa73 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { public class SupremeManaPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Mana Potion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Mana Potion"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.healMana = 400; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.rare = 10; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.healMana = 400; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.rare = 10; + item.value = Item.buyPrice(0, 6, 50, 0); + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SuperManaPotion); - recipe.AddIngredient(null, "Phantoplasm"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SuperManaPotion); + recipe.AddIngredient(null, "Phantoplasm"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/TitanScalePotion.cs b/Items/Potions/TitanScalePotion.cs index e45db28861..4d14e49a8d 100644 --- a/Items/Potions/TitanScalePotion.cs +++ b/Items/Potions/TitanScalePotion.cs @@ -4,46 +4,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class TitanScalePotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titan Scale Potion"); - Tooltip.SetDefault("Increases knockback, defense by 5, and damage reduction by 5%"); - } + public class TitanScalePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Scale Potion"); + Tooltip.SetDefault("Increases knockback, defense by 5, and damage reduction by 5%"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("TitanScale"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("TitanScale"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitanPotion); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitanPotion); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/TriumphPotion.cs b/Items/Potions/TriumphPotion.cs index 7dc3f47cae..1e3098adda 100644 --- a/Items/Potions/TriumphPotion.cs +++ b/Items/Potions/TriumphPotion.cs @@ -4,46 +4,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class TriumphPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triumph Potion"); - Tooltip.SetDefault("Enemy contact damage is reduced, the lower their health the more it is reduced"); - } + public class TriumphPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triumph Potion"); + Tooltip.SetDefault("Enemy contact damage is reduced, the lower their health the more it is reduced"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("TriumphBuff"); - item.buffTime = 7200; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("TriumphBuff"); + item.buffTime = 7200; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "StormlionMandible"); - recipe.AddIngredient(null, "VictoryShard", 3); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "BloodOrb", 30); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "StormlionMandible"); + recipe.AddIngredient(null, "VictoryShard", 3); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Potions/YharimsStimulants.cs b/Items/Potions/YharimsStimulants.cs index 3b4a8816a3..b1b834199e 100644 --- a/Items/Potions/YharimsStimulants.cs +++ b/Items/Potions/YharimsStimulants.cs @@ -4,43 +4,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class YharimsStimulants : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharim's Stimulants"); - Tooltip.SetDefault("Gives decent buffs to ALL offensive and defensive stats"); - } + public class YharimsStimulants : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharim's Stimulants"); + Tooltip.SetDefault("Gives decent buffs to ALL offensive and defensive stats"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("YharimPower"); - item.buffTime = 108000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("YharimPower"); + item.buffTime = 108000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.EndurancePotion); - recipe.AddIngredient(ItemID.IronskinPotion); - recipe.AddIngredient(ItemID.SwiftnessPotion); - recipe.AddIngredient(ItemID.ArcheryPotion); - recipe.AddIngredient(ItemID.MagicPowerPotion); - recipe.AddIngredient(ItemID.TitanPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.EndurancePotion); + recipe.AddIngredient(ItemID.IronskinPotion); + recipe.AddIngredient(ItemID.SwiftnessPotion); + recipe.AddIngredient(ItemID.ArcheryPotion); + recipe.AddIngredient(ItemID.MagicPowerPotion); + recipe.AddIngredient(ItemID.TitanPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BloodOrb", 50); recipe.AddIngredient(ItemID.BottledWater); @@ -48,5 +48,5 @@ namespace CalamityMod.Items.Potions recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index a906d7452d..cf7103ea2f 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class ZenPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Zen Potion"); - Tooltip.SetDefault("Reduces spawn rates...a lot..."); - } + public class ZenPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Zen Potion"); + Tooltip.SetDefault("Reduces spawn rates...a lot..."); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Zen"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Zen"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "EssenceofEleum", 3); recipe.AddIngredient(null, "EbonianGel", 2); recipe.AddIngredient(ItemID.PinkGel); recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BloodOrb", 20); recipe.AddIngredient(ItemID.BottledWater); @@ -46,5 +46,5 @@ namespace CalamityMod.Items.Potions recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index d721c3a6d9..119a8a45e0 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class ZergPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Zerg Potion"); - Tooltip.SetDefault("Boosts spawn rates...a lot..."); - } + public class ZergPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Zerg Potion"); + Tooltip.SetDefault("Boosts spawn rates...a lot..."); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Zerg"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Zerg"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddIngredient(null, "MurkySludge", 2); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddIngredient(null, "MurkySludge", 2); recipe.AddIngredient(null, "DemonicBoneAsh"); recipe.AddIngredient(ItemID.BottledWater); recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.SetResult(this); + recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(null, "BloodOrb", 20); recipe.AddIngredient(ItemID.BottledWater); @@ -46,5 +46,5 @@ namespace CalamityMod.Items.Potions recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/ProfanedGuardian/ProfanedShard.cs b/Items/ProfanedGuardian/ProfanedShard.cs index 4313eac320..d32c36d9b3 100644 --- a/Items/ProfanedGuardian/ProfanedShard.cs +++ b/Items/ProfanedGuardian/ProfanedShard.cs @@ -5,47 +5,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.ProfanedGuardian { public class ProfanedShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Shard"); - Tooltip.SetDefault("A shard of the unholy flame\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Shard"); + Tooltip.SetDefault("A shard of the unholy flame\n" + "Summons the Profaned Guardians\n" + "Can only be used during daytime"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + item.Calamity().postMoonLordRarity = 12; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("ProfanedGuardianBoss")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); - } + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("ProfanedGuardianBoss")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyEssence", 15); - recipe.AddIngredient(ItemID.LunarBar, 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyEssence", 15); + recipe.AddIngredient(ItemID.LunarBar, 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Providence/DivineGeode.cs b/Items/Providence/DivineGeode.cs index be1a60268d..2af8483a57 100644 --- a/Items/Providence/DivineGeode.cs +++ b/Items/Providence/DivineGeode.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Providence item.height = 12; item.maxStack = 999; item.rare = 10; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 6, 50, 0); + item.Calamity().postMoonLordRarity = 12; + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Providence/ElysianAegis.cs b/Items/Providence/ElysianAegis.cs index 3ef79c8bf1..37a8a22474 100644 --- a/Items/Providence/ElysianAegis.cs +++ b/Items/Providence/ElysianAegis.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Providence { @@ -25,15 +25,16 @@ namespace CalamityMod.Items.Providence item.height = 42; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - item.defense = 8; + item.Calamity().postMoonLordRarity = 12; + item.defense = 8; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - if (!hideVisual) { modPlayer.dashMod = 3; } + if (!hideVisual) + { modPlayer.dashMod = 3; } modPlayer.elysianAegis = true; player.noKnockback = true; player.fireWalk = true; diff --git a/Items/Providence/ElysianWings.cs b/Items/Providence/ElysianWings.cs index d5009757a3..756aa42c88 100644 --- a/Items/Providence/ElysianWings.cs +++ b/Items/Providence/ElysianWings.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Providence { @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Providence item.width = 36; item.height = 32; item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - item.accessory = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 12; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Providence/ProfanedCore.cs b/Items/Providence/ProfanedCore.cs index 82283e68aa..94e613b118 100644 --- a/Items/Providence/ProfanedCore.cs +++ b/Items/Providence/ProfanedCore.cs @@ -1,43 +1,43 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.Providence { public class ProfanedCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Core"); - Tooltip.SetDefault("The core of the unholy flame\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Core"); + Tooltip.SetDefault("The core of the unholy flame\n" + "Summons Providence\n" + "Can only be used during daytime"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + item.rare = 10; + item.Calamity().postMoonLordRarity = 12; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; - } + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + } } diff --git a/Items/Providence/ProfanedCoreUnlimited.cs b/Items/Providence/ProfanedCoreUnlimited.cs index b38f61fdee..9ba24eef05 100644 --- a/Items/Providence/ProfanedCoreUnlimited.cs +++ b/Items/Providence/ProfanedCoreUnlimited.cs @@ -1,44 +1,44 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.Providence { public class ProfanedCoreUnlimited : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Core"); - Tooltip.SetDefault("The core of the unholy flame\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Core"); + Tooltip.SetDefault("The core of the unholy flame\n" + "Summons Providence\n" + "Can only be used during daytime\n" + "Not consumable"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.rare = 10; + item.Calamity().postMoonLordRarity = 12; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; - } + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } public override void AddRecipes() { diff --git a/Items/Providence/ProvidenceBag.cs b/Items/Providence/ProvidenceBag.cs index ac8bf80b77..1db6090087 100644 --- a/Items/Providence/ProvidenceBag.cs +++ b/Items/Providence/ProvidenceBag.cs @@ -1,58 +1,58 @@ +using CalamityMod.Utilities; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Items.Providence { - public class ProvidenceBag : ModItem - { - public override int BossBagNPC => mod.NPCType("Providence"); + public class ProvidenceBag : ModItem + { + public override int BossBagNPC => mod.NPCType("Providence"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("UnholyEssence"), 25, 35); - DropHelper.DropItem(player, mod.ItemType("DivineGeode"), 15, 25); + // Materials + DropHelper.DropItem(player, mod.ItemType("UnholyEssence"), 25, 35); + DropHelper.DropItem(player, mod.ItemType("DivineGeode"), 15, 25); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("HolyCollider"), 3); - DropHelper.DropItemChance(player, mod.ItemType("SolarFlare"), 3); - DropHelper.DropItemChance(player, mod.ItemType("TelluricGlare"), 3); - DropHelper.DropItemChance(player, mod.ItemType("BlissfulBombardier"), 3); - DropHelper.DropItemChance(player, mod.ItemType("PurgeGuzzler"), 3); - DropHelper.DropItemChance(player, mod.ItemType("MoltenAmputator"), 3); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("HolyCollider"), 3); + DropHelper.DropItemChance(player, mod.ItemType("SolarFlare"), 3); + DropHelper.DropItemChance(player, mod.ItemType("TelluricGlare"), 3); + DropHelper.DropItemChance(player, mod.ItemType("BlissfulBombardier"), 3); + DropHelper.DropItemChance(player, mod.ItemType("PurgeGuzzler"), 3); + DropHelper.DropItemChance(player, mod.ItemType("MoltenAmputator"), 3); - // Equipment - DropHelper.DropItemChance(player, mod.ItemType("SamuraiBadge"), DropHelper.RareVariantDropRateInt); + // Equipment + DropHelper.DropItemChance(player, mod.ItemType("SamuraiBadge"), DropHelper.RareVariantDropRateInt); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("ProvidenceMask"), 7); + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("ProvidenceMask"), 7); - // Other - DropHelper.DropItem(player, mod.ItemType("RuneofCos")); - } - } + // Other + DropHelper.DropItem(player, mod.ItemType("RuneofCos")); + } + } } diff --git a/Items/Providence/UnholyEssence.cs b/Items/Providence/UnholyEssence.cs index 710bd1f40a..73f47a5017 100644 --- a/Items/Providence/UnholyEssence.cs +++ b/Items/Providence/UnholyEssence.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Providence item.height = 12; item.maxStack = 999; item.rare = 10; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().postMoonLordRarity = 12; - } + item.value = Item.buyPrice(0, 6, 50, 0); + item.Calamity().postMoonLordRarity = 12; + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Rock.cs b/Items/Rock.cs index 0de3fef9d1..7c3b07954f 100644 --- a/Items/Rock.cs +++ b/Items/Rock.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 0, 0, 1); - } + item.value = Item.buyPrice(0, 0, 0, 1); + } } } diff --git a/Items/Scavenger/AncientMedallion.cs b/Items/Scavenger/AncientMedallion.cs index 08b46e91ed..05bc3ccd72 100644 --- a/Items/Scavenger/AncientMedallion.cs +++ b/Items/Scavenger/AncientMedallion.cs @@ -4,50 +4,50 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Scavenger { - public class AncientMedallion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Medallion"); - Tooltip.SetDefault("A very old temple medallion\n" + + public class AncientMedallion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Medallion"); + Tooltip.SetDefault("A very old temple medallion\n" + "Summons the Ravager"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 8; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 8; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("ScavengerBody")) && player.ZoneOverworldHeight; - } + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("ScavengerBody")) && player.ZoneOverworldHeight; + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 101))), (int)(player.position.Y - 250f), mod.NPCType("ScavengerBody"), 0, 0f, 0f, 0f, 0f, 255); Main.PlaySound(SoundID.Roar, player.position, 0); } - return true; - } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarTabletFragment, 5); - recipe.AddIngredient(ItemID.LihzahrdBrick, 10); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarTabletFragment, 5); + recipe.AddIngredient(ItemID.LihzahrdBrick, 10); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Scavenger/BloodPact.cs b/Items/Scavenger/BloodPact.cs index ab8ba21898..c69fee5ca9 100644 --- a/Items/Scavenger/BloodPact.cs +++ b/Items/Scavenger/BloodPact.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Scavenger { diff --git a/Items/Scavenger/FleshTotem.cs b/Items/Scavenger/FleshTotem.cs index 5831edd8bb..c0f4761509 100644 --- a/Items/Scavenger/FleshTotem.cs +++ b/Items/Scavenger/FleshTotem.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Scavenger { diff --git a/Items/Scavenger/RavagerBag.cs b/Items/Scavenger/RavagerBag.cs index 9cdbf0d897..c118badfc6 100644 --- a/Items/Scavenger/RavagerBag.cs +++ b/Items/Scavenger/RavagerBag.cs @@ -1,71 +1,71 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Items.Scavenger { public class RavagerBag : ModItem - { - public override int BossBagNPC => mod.NPCType("ScavengerBody"); + { + public override int BossBagNPC => mod.NPCType("ScavengerBody"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - int barMin = CalamityWorld.downedProvidence ? 7 : 2; - int barMax = CalamityWorld.downedProvidence ? 12 : 3; - int coreMin = CalamityWorld.downedProvidence ? 2 : 1; - int coreMax = CalamityWorld.downedProvidence ? 4 : 3; - DropHelper.DropItemCondition(player, mod.ItemType("Bloodstone"), CalamityWorld.downedProvidence, 60, 70); - DropHelper.DropItem(player, mod.ItemType("VerstaltiteBar"), barMin, barMax); - DropHelper.DropItem(player, mod.ItemType("DraedonBar"), barMin, barMax); - DropHelper.DropItem(player, mod.ItemType("CruptixBar"), barMin, barMax); - DropHelper.DropItem(player, mod.ItemType("CoreofCinder"), coreMin, coreMax); - DropHelper.DropItem(player, mod.ItemType("CoreofEleum"), coreMin, coreMax); - DropHelper.DropItem(player, mod.ItemType("CoreofChaos"), coreMin, coreMax); - DropHelper.DropItemCondition(player, mod.ItemType("BarofLife"), CalamityWorld.downedProvidence); - DropHelper.DropItemCondition(player, mod.ItemType("CoreofCalamity"), CalamityWorld.downedProvidence, 0.5f); + // Materials + int barMin = CalamityWorld.downedProvidence ? 7 : 2; + int barMax = CalamityWorld.downedProvidence ? 12 : 3; + int coreMin = CalamityWorld.downedProvidence ? 2 : 1; + int coreMax = CalamityWorld.downedProvidence ? 4 : 3; + DropHelper.DropItemCondition(player, mod.ItemType("Bloodstone"), CalamityWorld.downedProvidence, 60, 70); + DropHelper.DropItem(player, mod.ItemType("VerstaltiteBar"), barMin, barMax); + DropHelper.DropItem(player, mod.ItemType("DraedonBar"), barMin, barMax); + DropHelper.DropItem(player, mod.ItemType("CruptixBar"), barMin, barMax); + DropHelper.DropItem(player, mod.ItemType("CoreofCinder"), coreMin, coreMax); + DropHelper.DropItem(player, mod.ItemType("CoreofEleum"), coreMin, coreMax); + DropHelper.DropItem(player, mod.ItemType("CoreofChaos"), coreMin, coreMax); + DropHelper.DropItemCondition(player, mod.ItemType("BarofLife"), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(player, mod.ItemType("CoreofCalamity"), CalamityWorld.downedProvidence, 0.5f); - // Weapons - DropHelper.DropItemFromSet(player, - mod.ItemType("UltimusCleaver"), - mod.ItemType("RealmRavager"), - mod.ItemType("Hematemesis"), - mod.ItemType("SpikecragStaff"), - mod.ItemType("CraniumSmasher")); - DropHelper.DropItemFromSetChance(player, 0.05f, mod.ItemType("CorpusAvertorMelee"), mod.ItemType("CorpusAvertor")); + // Weapons + DropHelper.DropItemFromSet(player, + mod.ItemType("UltimusCleaver"), + mod.ItemType("RealmRavager"), + mod.ItemType("Hematemesis"), + mod.ItemType("SpikecragStaff"), + mod.ItemType("CraniumSmasher")); + DropHelper.DropItemFromSetChance(player, 0.05f, mod.ItemType("CorpusAvertorMelee"), mod.ItemType("CorpusAvertor")); - // Equipment - DropHelper.DropItemChance(player, mod.ItemType("BloodPact"), 0.5f); - DropHelper.DropItemChance(player, mod.ItemType("FleshTotem"), 0.5f); - DropHelper.DropItemCondition(player, mod.ItemType("BloodflareCore"), CalamityWorld.downedProvidence); - DropHelper.DropItemCondition(player, mod.ItemType("InfernalBlood"), CalamityWorld.revenge); + // Equipment + DropHelper.DropItemChance(player, mod.ItemType("BloodPact"), 0.5f); + DropHelper.DropItemChance(player, mod.ItemType("FleshTotem"), 0.5f); + DropHelper.DropItemCondition(player, mod.ItemType("BloodflareCore"), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(player, mod.ItemType("InfernalBlood"), CalamityWorld.revenge); - // Vanity - // there is no Ravager mask yet - } - } + // Vanity + // there is no Ravager mask yet + } + } } diff --git a/Items/ShrineItems/CorruptionEffigy.cs b/Items/ShrineItems/CorruptionEffigy.cs index 6c952356cc..23a1ea17c5 100644 --- a/Items/ShrineItems/CorruptionEffigy.cs +++ b/Items/ShrineItems/CorruptionEffigy.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.ShrineItems { - public class CorruptionEffigy: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corruption Effigy"); - Tooltip.SetDefault("When placed down nearby players have their movement speed increased by 15% and crit chance by 10%\n" + - "Nearby players also suffer a 20% decrease to their damage reduction"); - } + public class CorruptionEffigy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corruption Effigy"); + Tooltip.SetDefault("When placed down nearby players have their movement speed increased by 15% and crit chance by 10%\n" + + "Nearby players also suffer a 20% decrease to their damage reduction"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.createTile = mod.TileType("CorruptionEffigy"); - } + public override void SetDefaults() + { + item.width = 26; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.createTile = mod.TileType("CorruptionEffigy"); + } } } diff --git a/Items/ShrineItems/CrimsonEffigy.cs b/Items/ShrineItems/CrimsonEffigy.cs index 4a739e4b70..830780c4c0 100644 --- a/Items/ShrineItems/CrimsonEffigy.cs +++ b/Items/ShrineItems/CrimsonEffigy.cs @@ -3,29 +3,29 @@ using Terraria.ModLoader; namespace CalamityMod.Items.ShrineItems { - public class CrimsonEffigy: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimson Effigy"); - Tooltip.SetDefault("When placed down nearby players have their damage increased by 15% and defense by 10\n" + - "Nearby players also suffer a 20% decrease to their maximum health"); - } + public class CrimsonEffigy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Effigy"); + Tooltip.SetDefault("When placed down nearby players have their damage increased by 15% and defense by 10\n" + + "Nearby players also suffer a 20% decrease to their maximum health"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.createTile = mod.TileType("CrimsonEffigy"); - } + public override void SetDefaults() + { + item.width = 22; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.createTile = mod.TileType("CrimsonEffigy"); + } } } diff --git a/Items/ShrineItems/FungalSymbiote.cs b/Items/ShrineItems/FungalSymbiote.cs index 7ee066bd3f..31c22b023d 100644 --- a/Items/ShrineItems/FungalSymbiote.cs +++ b/Items/ShrineItems/FungalSymbiote.cs @@ -1,31 +1,31 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.ShrineItems { public class FungalSymbiote : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungal Symbiote"); - Tooltip.SetDefault("True melee weapons emit mushrooms when swung\n" + - "Boosts true melee damage by 25%"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Symbiote"); + Tooltip.SetDefault("True melee weapons emit mushrooms when swung\n" + + "Boosts true melee damage by 25%"); + } - public override void SetDefaults() - { - item.width = 38; - item.height = 36; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 38; + item.height = 36; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fungalSymbiote = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.fungalSymbiote = true; + } + } } diff --git a/Items/ShrineItems/GladiatorsLocket.cs b/Items/ShrineItems/GladiatorsLocket.cs index 5da751112f..ff9b9f6a23 100644 --- a/Items/ShrineItems/GladiatorsLocket.cs +++ b/Items/ShrineItems/GladiatorsLocket.cs @@ -1,31 +1,31 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.ShrineItems { public class GladiatorsLocket : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gladiator's Locket"); - Tooltip.SetDefault("Summons two spirit swords to protect you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gladiator's Locket"); + Tooltip.SetDefault("Summons two spirit swords to protect you"); + } - public override void SetDefaults() - { - item.width = 42; - item.height = 36; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.defense = 5; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 42; + item.height = 36; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.defense = 5; + item.accessory = true; + } public override bool CanEquipAccessory(Player player, int slot) { CalamityPlayer modPlayer = player.Calamity(); //there might be an upgrade sometime later? - if (modPlayer.gladiatorSword) + if (modPlayer.gladiatorSword) { return false; } @@ -33,21 +33,21 @@ namespace CalamityMod.Items.ShrineItems } public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.gladiatorSword = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("GladiatorSwords")) == -1) - { - player.AddBuff(mod.BuffType("GladiatorSwords"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("GladiatorSword")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GladiatorSword"), (int)(20f * player.minionDamage), 6f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GladiatorSword2"), (int)(20f * player.minionDamage), 6f, Main.myPlayer, 0f, 0f); - } - } - } - } + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.gladiatorSword = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("GladiatorSwords")) == -1) + { + player.AddBuff(mod.BuffType("GladiatorSwords"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("GladiatorSword")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GladiatorSword"), (int)(20f * player.minionDamage), 6f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GladiatorSword2"), (int)(20f * player.minionDamage), 6f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Items/ShrineItems/LuxorsGift.cs b/Items/ShrineItems/LuxorsGift.cs index 25948eca9d..e4066ee4fc 100644 --- a/Items/ShrineItems/LuxorsGift.cs +++ b/Items/ShrineItems/LuxorsGift.cs @@ -1,31 +1,31 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.ShrineItems { public class LuxorsGift : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Luxor's Gift"); - Tooltip.SetDefault("Weapons fire unique projectiles based on the damage type they have\n" + - "Some weapons are unable to receive this bonus"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Luxor's Gift"); + Tooltip.SetDefault("Weapons fire unique projectiles based on the damage type they have\n" + + "Some weapons are unable to receive this bonus"); + } - public override void SetDefaults() - { - item.width = 58; - item.height = 48; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 58; + item.height = 48; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.luxorsGift = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.luxorsGift = true; + } + } } diff --git a/Items/ShrineItems/OnyxExcavatorKey.cs b/Items/ShrineItems/OnyxExcavatorKey.cs index f2accec800..ad827d7ba8 100644 --- a/Items/ShrineItems/OnyxExcavatorKey.cs +++ b/Items/ShrineItems/OnyxExcavatorKey.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.ShrineItems { @@ -10,8 +10,8 @@ namespace CalamityMod.Items.ShrineItems { DisplayName.SetDefault("Onyx Excavator Key"); Tooltip.SetDefault("Summons a drill to drill through the world so you can destroy all the neat world generation\n" + - "with complete disregard for all the creatures that inhabit these lands. I am sure the EPA and PETA would like\n" + - "to have a word with you afterwards."); + "with complete disregard for all the creatures that inhabit these lands. I am sure the EPA and PETA would like\n" + + "to have a word with you afterwards."); } public override void SetDefaults() @@ -21,11 +21,11 @@ namespace CalamityMod.Items.ShrineItems item.useTime = 20; item.useAnimation = 20; item.useStyle = 4; - item.rare = 3; - item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.value = Item.buyPrice(0, 9, 0, 0); item.UseSound = SoundID.Item23; item.noMelee = true; item.mountType = mod.MountType("OnyxExcavator"); - } - } + } + } } diff --git a/Items/ShrineItems/TrinketofChi.cs b/Items/ShrineItems/TrinketofChi.cs index 3d5519b0a1..dd49a4e7cb 100644 --- a/Items/ShrineItems/TrinketofChi.cs +++ b/Items/ShrineItems/TrinketofChi.cs @@ -1,32 +1,32 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.ShrineItems { public class TrinketofChi : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trinket of Chi"); - Tooltip.SetDefault("After 2 seconds of standing still and not attacking you gain a buff\n" + - "This buff boosts your damage by 50% and decreases damage taken by 15%\n" + - "The buff deactivates after you move or attack once"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trinket of Chi"); + Tooltip.SetDefault("After 2 seconds of standing still and not attacking you gain a buff\n" + + "This buff boosts your damage by 50% and decreases damage taken by 15%\n" + + "The buff deactivates after you move or attack once"); + } - public override void SetDefaults() - { - item.width = 34; - item.height = 32; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 34; + item.height = 32; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.trinketOfChi = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.trinketOfChi = true; + } + } } diff --git a/Items/ShrineItems/TundraLeash.cs b/Items/ShrineItems/TundraLeash.cs index 644c44a791..048f186953 100644 --- a/Items/ShrineItems/TundraLeash.cs +++ b/Items/ShrineItems/TundraLeash.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.ShrineItems { @@ -19,11 +19,11 @@ namespace CalamityMod.Items.ShrineItems item.useTime = 20; item.useAnimation = 20; item.useStyle = 4; - item.rare = 3; - item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.value = Item.buyPrice(0, 9, 0, 0); item.UseSound = SoundID.NPCHit56; item.noMelee = true; item.mountType = mod.MountType("AngryDog"); - } - } + } + } } diff --git a/Items/ShrineItems/UnstablePrism.cs b/Items/ShrineItems/UnstablePrism.cs index 0c8ca5dd17..a9c899a5ca 100644 --- a/Items/ShrineItems/UnstablePrism.cs +++ b/Items/ShrineItems/UnstablePrism.cs @@ -1,30 +1,30 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.ShrineItems { public class UnstablePrism : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Unstable Prism"); - Tooltip.SetDefault("Three sparks are released on critical hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Unstable Prism"); + Tooltip.SetDefault("Three sparks are released on critical hits"); + } - public override void SetDefaults() - { - item.width = 22; - item.height = 38; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 22; + item.height = 38; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.unstablePrism = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.unstablePrism = true; + } + } } diff --git a/Items/SlimeGod/ManaOverloader.cs b/Items/SlimeGod/ManaOverloader.cs index 99511ab5da..873ac02dd6 100644 --- a/Items/SlimeGod/ManaOverloader.cs +++ b/Items/SlimeGod/ManaOverloader.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.SlimeGod { @@ -26,9 +26,9 @@ namespace CalamityMod.Items.SlimeGod public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.manaOverloader = true; - player.statManaMax2 += 50; - } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.manaOverloader = true; + player.statManaMax2 += 50; + } } } diff --git a/Items/SlimeGod/OverloadedSludge.cs b/Items/SlimeGod/OverloadedSludge.cs index efe2d339c3..7fd4878aba 100644 --- a/Items/SlimeGod/OverloadedSludge.cs +++ b/Items/SlimeGod/OverloadedSludge.cs @@ -4,61 +4,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.SlimeGod { - public class OverloadedSludge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Overloaded Sludge"); - Tooltip.SetDefault("It looks corrupted\n" + + public class OverloadedSludge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Overloaded Sludge"); + Tooltip.SetDefault("It looks corrupted\n" + "Summons the Slime God"); - } + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 4; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 4; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); - } + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGod")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodRun")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodCore")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGod")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodRun")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodCore")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 25); - recipe.AddIngredient(ItemID.EbonstoneBlock, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 25); - recipe.AddIngredient(ItemID.CrimstoneBlock, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 25); + recipe.AddIngredient(ItemID.EbonstoneBlock, 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 25); + recipe.AddIngredient(ItemID.CrimstoneBlock, 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/SlimeGod/PurifiedGel.cs b/Items/SlimeGod/PurifiedGel.cs index 6d27fc5776..d6361ee343 100644 --- a/Items/SlimeGod/PurifiedGel.cs +++ b/Items/SlimeGod/PurifiedGel.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.SlimeGod item.width = 16; item.height = 14; item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 50, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 2, 50, 0); + item.rare = 4; } } } diff --git a/Items/SlimeGod/SlimeGodBag.cs b/Items/SlimeGod/SlimeGodBag.cs index 07380c845e..06b4db7c08 100644 --- a/Items/SlimeGod/SlimeGodBag.cs +++ b/Items/SlimeGod/SlimeGodBag.cs @@ -1,59 +1,59 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Items.SlimeGod { - public class SlimeGodBag : ModItem - { - public override int BossBagNPC => mod.NPCType("SlimeGodRun"); + public class SlimeGodBag : ModItem + { + public override int BossBagNPC => mod.NPCType("SlimeGodRun"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - // Materials - DropHelper.DropItem(player, ItemID.Gel, 30, 60); - DropHelper.DropItem(player, mod.ItemType("PurifiedGel"), 30, 50); + public override void OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, ItemID.Gel, 30, 60); + DropHelper.DropItem(player, mod.ItemType("PurifiedGel"), 30, 50); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("OverloadedBlaster"), 3); - DropHelper.DropItemChance(player, mod.ItemType("AbyssalTome"), 3); - DropHelper.DropItemChance(player, mod.ItemType("EldritchTome"), 3); - DropHelper.DropItemChance(player, mod.ItemType("CorroslimeStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("CrimslimeStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("GelDart"), 3, 100, 125); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("OverloadedBlaster"), 3); + DropHelper.DropItemChance(player, mod.ItemType("AbyssalTome"), 3); + DropHelper.DropItemChance(player, mod.ItemType("EldritchTome"), 3); + DropHelper.DropItemChance(player, mod.ItemType("CorroslimeStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("CrimslimeStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("GelDart"), 3, 100, 125); - // Equipment - DropHelper.DropItem(player, mod.ItemType("ManaOverloader")); - DropHelper.DropItemCondition(player, mod.ItemType("ElectrolyteGelPack"), CalamityWorld.revenge); + // Equipment + DropHelper.DropItem(player, mod.ItemType("ManaOverloader")); + DropHelper.DropItemCondition(player, mod.ItemType("ElectrolyteGelPack"), CalamityWorld.revenge); - // Vanity - DropHelper.DropItemFromSetChance(player, 7, mod.ItemType("SlimeGodMask"), mod.ItemType("SlimeGodMask2")); + // Vanity + DropHelper.DropItemFromSetChance(player, 7, mod.ItemType("SlimeGodMask"), mod.ItemType("SlimeGodMask2")); - // Other - DropHelper.DropItem(player, mod.ItemType("StaticRefiner")); - } - } + // Other + DropHelper.DropItem(player, mod.ItemType("StaticRefiner")); + } + } } diff --git a/Items/StarterBag.cs b/Items/StarterBag.cs index 937b63cea3..7c8013b2a3 100644 --- a/Items/StarterBag.cs +++ b/Items/StarterBag.cs @@ -1,66 +1,66 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.Utilities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items { - public class StarterBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starter Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public class StarterBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starter Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 1; - } + public override void SetDefaults() + { + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 1; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void RightClick(Player player) - { - // Weapons - DropHelper.DropItem(player, ItemID.CopperBroadsword); - DropHelper.DropItem(player, ItemID.CopperBow); - DropHelper.DropItem(player, ItemID.WoodenArrow, 100); - DropHelper.DropItem(player, ItemID.AmethystStaff); - DropHelper.DropItem(player, ItemID.ManaCrystal); - DropHelper.DropItem(player, ItemID.SlimeStaff); - DropHelper.DropItem(player, mod.ItemType("WulfrumKnife"), 150); + public override void RightClick(Player player) + { + // Weapons + DropHelper.DropItem(player, ItemID.CopperBroadsword); + DropHelper.DropItem(player, ItemID.CopperBow); + DropHelper.DropItem(player, ItemID.WoodenArrow, 100); + DropHelper.DropItem(player, ItemID.AmethystStaff); + DropHelper.DropItem(player, ItemID.ManaCrystal); + DropHelper.DropItem(player, ItemID.SlimeStaff); + DropHelper.DropItem(player, mod.ItemType("WulfrumKnife"), 150); - // Tools / Utility - DropHelper.DropItem(player, ItemID.CopperHammer); - DropHelper.DropItem(player, ItemID.Bomb, 10); - DropHelper.DropItem(player, ItemID.MiningPotion); - DropHelper.DropItem(player, ItemID.SpelunkerPotion, 2); - DropHelper.DropItem(player, ItemID.SwiftnessPotion, 3); - DropHelper.DropItem(player, ItemID.GillsPotion, 2); - DropHelper.DropItem(player, ItemID.ShinePotion); + // Tools / Utility + DropHelper.DropItem(player, ItemID.CopperHammer); + DropHelper.DropItem(player, ItemID.Bomb, 10); + DropHelper.DropItem(player, ItemID.MiningPotion); + DropHelper.DropItem(player, ItemID.SpelunkerPotion, 2); + DropHelper.DropItem(player, ItemID.SwiftnessPotion, 3); + DropHelper.DropItem(player, ItemID.GillsPotion, 2); + DropHelper.DropItem(player, ItemID.ShinePotion); - // Tiles / Placeables - DropHelper.DropItem(player, ItemID.Torch, 25); - DropHelper.DropItem(player, ItemID.Chest, 3); + // Tiles / Placeables + DropHelper.DropItem(player, ItemID.Torch, 25); + DropHelper.DropItem(player, ItemID.Chest, 3); - // Difficulty items - DropHelper.DropItem(player, mod.ItemType("Death")); - DropHelper.DropItem(player, mod.ItemType("DefiledRune")); + // Difficulty items + DropHelper.DropItem(player, mod.ItemType("Death")); + DropHelper.DropItem(player, mod.ItemType("DefiledRune")); - // Speedrun King Slime - DropHelper.DropItem(player, ItemID.SlimeCrown); + // Speedrun King Slime + DropHelper.DropItem(player, ItemID.SlimeCrown); - // Music box (if music mod installed) - Mod musicMod = ModLoader.GetMod("CalamityModMusic"); - if (musicMod != null) - DropHelper.DropItem(player, musicMod.ItemType("CalamityMusicbox")); - } - } + // Music box (if music mod installed) + Mod musicMod = ModLoader.GetMod("CalamityModMusic"); + if (musicMod != null) + DropHelper.DropItem(player, musicMod.ItemType("CalamityMusicbox")); + } + } } diff --git a/Items/SummonsAndClimateChange/AridArtifact.cs b/Items/SummonsAndClimateChange/AridArtifact.cs index f50bb2b153..2e5c841623 100644 --- a/Items/SummonsAndClimateChange/AridArtifact.cs +++ b/Items/SummonsAndClimateChange/AridArtifact.cs @@ -1,58 +1,58 @@ using System.Reflection; using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent.Events; namespace CalamityMod.Items.SummonsAndClimateChange { public class AridArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arid Artifact"); - Tooltip.SetDefault("Summons a sandstorm\n" + - "The sandstorm will happen shortly after the item is used"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arid Artifact"); + Tooltip.SetDefault("Summons a sandstorm\n" + + "The sandstorm will happen shortly after the item is used"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item66; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return !Sandstorm.Happening; - } + public override bool CanUseItem(Player player) + { + return !Sandstorm.Happening; + } - public override bool UseItem(Player player) - { - typeof(Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); - return true; - } + public override bool UseItem(Player player) + { + typeof(Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.AdamantiteBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.TitaniumBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(ItemID.AdamantiteBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(ItemID.TitaniumBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/SummonsAndClimateChange/BloodIdol.cs b/Items/SummonsAndClimateChange/BloodIdol.cs index 078790fba2..4775dde1ec 100644 --- a/Items/SummonsAndClimateChange/BloodIdol.cs +++ b/Items/SummonsAndClimateChange/BloodIdol.cs @@ -5,45 +5,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.SummonsAndClimateChange { public class BloodIdol : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Relic"); - Tooltip.SetDefault("Summons a blood moon"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Relic"); + Tooltip.SetDefault("Summons a blood moon"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item66; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return !Main.bloodMoon && !Main.dayTime; - } + public override bool CanUseItem(Player player) + { + return !Main.bloodMoon && !Main.dayTime; + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { Main.bloodMoon = true; CalamityMod.UpdateServerBoolean(); - return true; - } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodlettingEssence", 2); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodlettingEssence", 2); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(null, "FetidEssence", 2); @@ -52,5 +52,5 @@ namespace CalamityMod.Items.SummonsAndClimateChange recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/SummonsAndClimateChange/BossRush.cs b/Items/SummonsAndClimateChange/BossRush.cs index f67d0ac745..24203650ba 100644 --- a/Items/SummonsAndClimateChange/BossRush.cs +++ b/Items/SummonsAndClimateChange/BossRush.cs @@ -1,37 +1,37 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.SummonsAndClimateChange { public class BossRush : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terminus"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terminus"); Tooltip.SetDefault("A ritualistic artifact, thought to have brought upon The End many millennia ago\n" + "Sealed away in the abyss, far from those that would seek to misuse it\n" + - "Activates Boss Rush Mode, using it again will deactivate Boss Rush Mode\n" + - "During the Boss Rush, all wires and wired devices will be disabled"); + "Activates Boss Rush Mode, using it again will deactivate Boss Rush Mode\n" + + "During the Boss Rush, all wires and wired devices will be disabled"); } - public override void SetDefaults() - { + public override void SetDefaults() + { item.rare = 1; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item123; - item.consumable = false; - } + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item123; + item.consumable = false; + } public override bool UseItem(Player player) - { + { for (int doom = 0; doom < 200; doom++) { if (Main.npc[doom].active && Main.npc[doom].boss) @@ -70,6 +70,6 @@ namespace CalamityMod.Items.SummonsAndClimateChange netMessage.Send(); } return true; - } + } } } diff --git a/Items/SummonsAndClimateChange/BulbofDoom.cs b/Items/SummonsAndClimateChange/BulbofDoom.cs index faeeb6a291..8121166643 100644 --- a/Items/SummonsAndClimateChange/BulbofDoom.cs +++ b/Items/SummonsAndClimateChange/BulbofDoom.cs @@ -5,49 +5,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.SummonsAndClimateChange { public class BulbofDoom : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Portabulb"); - Tooltip.SetDefault("Summons Plantera"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Portabulb"); + Tooltip.SetDefault("Summons Plantera"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.rare = 7; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.rare = 7; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera); - } + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera); + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.JungleSpores, 15); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ItemID.SoulofLight, 10); - recipe.AddIngredient(null, "MurkyPaste", 3); - recipe.AddIngredient(null, "ManeaterBulb"); - recipe.AddIngredient(null, "TrapperBulb"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.JungleSpores, 15); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddIngredient(ItemID.SoulofLight, 10); + recipe.AddIngredient(null, "MurkyPaste", 3); + recipe.AddIngredient(null, "ManeaterBulb"); + recipe.AddIngredient(null, "TrapperBulb"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/SummonsAndClimateChange/Cosmolight.cs b/Items/SummonsAndClimateChange/Cosmolight.cs index 63586671d4..0779a99704 100644 --- a/Items/SummonsAndClimateChange/Cosmolight.cs +++ b/Items/SummonsAndClimateChange/Cosmolight.cs @@ -1,29 +1,29 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Items.SummonsAndClimateChange { public class Cosmolight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmolight"); - Tooltip.SetDefault("Changes night to day and vice versa"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmolight"); + Tooltip.SetDefault("Changes night to day and vice versa"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item60; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } public override bool CanUseItem(Player player) { @@ -31,28 +31,28 @@ namespace CalamityMod.Items.SummonsAndClimateChange } public override bool UseItem(Player player) - { - Main.time = 0.0; - Main.dayTime = !Main.dayTime; - if (Main.dayTime) - { - if (++Main.moonPhase >= 8) - { - Main.moonPhase = 0; - } - } + { + Main.time = 0.0; + Main.dayTime = !Main.dayTime; + if (Main.dayTime) + { + if (++Main.moonPhase >= 8) + { + Main.moonPhase = 0; + } + } CalamityMod.UpdateServerBoolean(); return true; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Daylight"); - recipe.AddIngredient(null, "Moonlight"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Daylight"); + recipe.AddIngredient(null, "Moonlight"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/SummonsAndClimateChange/Daylight.cs b/Items/SummonsAndClimateChange/Daylight.cs index 679b195a8b..790bfd7320 100644 --- a/Items/SummonsAndClimateChange/Daylight.cs +++ b/Items/SummonsAndClimateChange/Daylight.cs @@ -1,50 +1,50 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Items.SummonsAndClimateChange { public class Daylight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daylight"); - Tooltip.SetDefault("Summons the sun"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daylight"); + Tooltip.SetDefault("Summons the sun"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item60; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); - } + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + } - public override bool UseItem(Player player) - { - Main.dayTime = true; + public override bool UseItem(Player player) + { + Main.dayTime = true; CalamityMod.UpdateServerBoolean(); return true; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofLight, 7); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofLight, 7); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/SummonsAndClimateChange/DraedonsRemote.cs b/Items/SummonsAndClimateChange/DraedonsRemote.cs index 20675bdd88..d2829b5ff7 100644 --- a/Items/SummonsAndClimateChange/DraedonsRemote.cs +++ b/Items/SummonsAndClimateChange/DraedonsRemote.cs @@ -1,37 +1,37 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Items.SummonsAndClimateChange { - public class DraedonsRemote : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draedon's Remote"); - Tooltip.SetDefault("Mayhem..."); - } + public class DraedonsRemote : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Remote"); + Tooltip.SetDefault("Mayhem..."); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 20; - item.rare = 8; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 20; + item.rare = 8; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(NPCID.SkeletronPrime) && !NPC.AnyNPCs(NPCID.Spazmatism) && !NPC.AnyNPCs(NPCID.Retinazer); - } + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(NPCID.SkeletronPrime) && !NPC.AnyNPCs(NPCID.Spazmatism) && !NPC.AnyNPCs(NPCID.Retinazer); + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { CalamityGlobalNPC.DraedonMayhem = true; CalamityMod.UpdateServerBoolean(); NPC.SpawnOnPlayer(player.whoAmI, NPCID.TheDestroyer); @@ -39,7 +39,7 @@ namespace CalamityMod.Items.SummonsAndClimateChange NPC.SpawnOnPlayer(player.whoAmI, NPCID.Spazmatism); NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - } + return true; + } + } } diff --git a/Items/SummonsAndClimateChange/EidolonTablet.cs b/Items/SummonsAndClimateChange/EidolonTablet.cs index 8b2b0bd63c..7164d8ad6d 100644 --- a/Items/SummonsAndClimateChange/EidolonTablet.cs +++ b/Items/SummonsAndClimateChange/EidolonTablet.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.SummonsAndClimateChange { - public class EidolonTablet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Tablet"); - } + public class EidolonTablet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Tablet"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 9; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 9; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet); - } + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet); + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { if (Main.netMode != NetmodeID.MultiplayerClient) { int num1302 = NPC.NewNPC((int)player.Center.X + 30, (int)player.Center.Y - 90, NPCID.CultistBoss, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1302].direction = (Main.npc[num1302].spriteDirection = Math.Sign(player.Center.X - (float)player.Center.X - 30f)); } - return true; - } - } + return true; + } + } } diff --git a/Items/SummonsAndClimateChange/Moonlight.cs b/Items/SummonsAndClimateChange/Moonlight.cs index 5e9290d685..d100179d71 100644 --- a/Items/SummonsAndClimateChange/Moonlight.cs +++ b/Items/SummonsAndClimateChange/Moonlight.cs @@ -1,50 +1,50 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Items.SummonsAndClimateChange { public class Moonlight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moonlight"); - Tooltip.SetDefault("Summons the moon"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moonlight"); + Tooltip.SetDefault("Summons the moon"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item60; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } - public override bool CanUseItem(Player player) - { - return Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); - } + public override bool CanUseItem(Player player) + { + return Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + } - public override bool UseItem(Player player) - { - Main.dayTime = false; + public override bool UseItem(Player player) + { + Main.dayTime = false; CalamityMod.UpdateServerBoolean(); return true; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofNight, 7); - recipe.AddIngredient(null, "CryoBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofNight, 7); + recipe.AddIngredient(null, "CryoBar", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/SummonsAndClimateChange/OldPowerCell.cs b/Items/SummonsAndClimateChange/OldPowerCell.cs index 5b6f91e234..586edbfe47 100644 --- a/Items/SummonsAndClimateChange/OldPowerCell.cs +++ b/Items/SummonsAndClimateChange/OldPowerCell.cs @@ -4,28 +4,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.SummonsAndClimateChange { - public class OldPowerCell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Old Power Cell"); - Tooltip.SetDefault("Summons the ancient golem when used in the Temple"); - } + public class OldPowerCell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Old Power Cell"); + Tooltip.SetDefault("Summons the ancient golem when used in the Temple"); + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 7; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 7; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } - public override bool CanUseItem(Player player) - { + public override bool CanUseItem(Player player) + { bool canSummon = false; if ((double)player.Center.Y > Main.worldSurface * 16.0) { @@ -38,23 +38,23 @@ namespace CalamityMod.Items.SummonsAndClimateChange } } return canSummon && !NPC.AnyNPCs(NPCID.Golem); - } + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarTabletFragment, 10); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarTabletFragment, 10); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/SunkenSea/AmidiasPendant.cs b/Items/SunkenSea/AmidiasPendant.cs index 75ebc2aaef..c24a3ec721 100644 --- a/Items/SunkenSea/AmidiasPendant.cs +++ b/Items/SunkenSea/AmidiasPendant.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Items.SunkenSea { public class AmidiasPendant : ModItem { - public const int ShardProjectiles = 2; + public const int ShardProjectiles = 2; public const float ShardAngleSpread = 120; public int ShardCountdown = 0; @@ -20,8 +20,8 @@ namespace CalamityMod.Items.SunkenSea { item.width = 26; item.height = 46; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 2; item.accessory = true; } @@ -52,17 +52,23 @@ namespace CalamityMod.Items.SunkenSea Vector2 velocity = baseVelocity; velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-ShardAngleSpread / 2 + (ShardAngleSpread * i / (float)ShardProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int type = 0; - int damage = 0; - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("PendantProjectile1"); - damage = 15; break; - case 1: type = mod.ProjectileType("PendantProjectile2"); - damage = 15; break; - case 2: type = mod.ProjectileType("PendantProjectile3"); - damage = 30; break; - } + int type = 0; + int damage = 0; + switch (Main.rand.Next(3)) + { + case 0: + type = mod.ProjectileType("PendantProjectile1"); + damage = 15; + break; + case 1: + type = mod.ProjectileType("PendantProjectile2"); + damage = 15; + break; + case 2: + type = mod.ProjectileType("PendantProjectile3"); + damage = 30; + break; + } int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, damage, 5f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].tileCollide = false; Main.projectile[projectile].timeLeft = 220; @@ -70,6 +76,6 @@ namespace CalamityMod.Items.SunkenSea } } } - } + } } } diff --git a/Items/SunkenSea/GiantPearl.cs b/Items/SunkenSea/GiantPearl.cs index fa4d8c8093..985610eefa 100644 --- a/Items/SunkenSea/GiantPearl.cs +++ b/Items/SunkenSea/GiantPearl.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.SunkenSea { @@ -11,15 +11,15 @@ namespace CalamityMod.Items.SunkenSea DisplayName.SetDefault("Giant Pearl"); Tooltip.SetDefault("You have a light aura around you\n" + "Enemies within the aura are slowed down\n" + - "Does not work on bosses"); + "Does not work on bosses"); } public override void SetDefaults() { item.width = 42; item.height = 32; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 2; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 2; item.accessory = true; } @@ -27,7 +27,7 @@ namespace CalamityMod.Items.SunkenSea { CalamityPlayer modPlayer = player.Calamity(); modPlayer.giantPearl = true; - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.45f, 0.8f, 0.8f); + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.45f, 0.8f, 0.8f); } } } diff --git a/Items/SunkenSea/MolluskHusk.cs b/Items/SunkenSea/MolluskHusk.cs index 822568c01f..df64bd17fe 100644 --- a/Items/SunkenSea/MolluskHusk.cs +++ b/Items/SunkenSea/MolluskHusk.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.SunkenSea item.width = 30; item.height = 28; item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; } } } diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 8f75b7b8af..67a23fedaf 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -5,57 +5,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items { public class SuperDummy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - Tooltip.SetDefault("Creates a super dummy\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + Tooltip.SetDefault("Creates a super dummy\n" + "Regenerates 1 million life per second\n" + "Will not die when taking damage over time from debuffs\n" + "Right click to kill all super dummies"); - } + } - public override void SetDefaults() - { - item.damage = 0; - item.width = 20; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 1; - item.useTurn = true; + public override void SetDefaults() + { + item.damage = 0; + item.width = 20; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 1; + item.useTurn = true; item.value = 0; - item.rare = 1; - item.autoReuse = true; - } + item.rare = 1; + item.autoReuse = true; + } - public override bool AltFunctionUse (Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } public override bool UseItem(Player player) - { + { if (player.altFunctionUse == 2) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].type == mod.NPCType("SuperDummy")) - { - Main.npc[i].life = 0; - Main.npc[i].lifeRegen = 0; - Main.npc[i].checkDead(); - } - } - } - else if (player.whoAmI == Main.myPlayer) - { - int x = (int) Main.MouseWorld.X - 9; - int y = (int) Main.MouseWorld.Y - 20; - NPC.NewNPC(x, y, mod.NPCType("SuperDummy")); - } + { + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].type == mod.NPCType("SuperDummy")) + { + Main.npc[i].life = 0; + Main.npc[i].lifeRegen = 0; + Main.npc[i].checkDead(); + } + } + } + else if (player.whoAmI == Main.myPlayer) + { + int x = (int)Main.MouseWorld.X - 9; + int y = (int)Main.MouseWorld.Y - 20; + NPC.NewNPC(x, y, mod.NPCType("SuperDummy")); + } return true; - } + } public override void AddRecipes() { @@ -65,5 +65,5 @@ namespace CalamityMod.Items recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/SupremeCalamitas/EyeofExtinction.cs b/Items/SupremeCalamitas/EyeofExtinction.cs index 76da29d737..b2b6dbc6ea 100644 --- a/Items/SupremeCalamitas/EyeofExtinction.cs +++ b/Items/SupremeCalamitas/EyeofExtinction.cs @@ -1,82 +1,82 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.SupremeCalamitas { public class EyeofExtinction : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of Extinction"); - Tooltip.SetDefault("Death\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Extinction"); + Tooltip.SetDefault("Death\n" + "Summons Supreme Calamitas\n" + "Creates a large square arena of blocks around your player\n" + "Your player is the CENTER of the arena so be sure to use this item in a good location\n" + - "During the battle, heart pickups will heal half as much HP\n" + + "During the battle, heart pickups will heal half as much HP\n" + "Not consumable"); - } + } - public override void SetDefaults() - { - item.width = 40; - item.height = 40; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.Calamity().postMoonLordRarity = 15; - } + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.Calamity().postMoonLordRarity = 15; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) && CalamityWorld.downedBossAny; - } + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) && CalamityWorld.downedBossAny; + } - public override bool UseItem(Player player) - { - int surface = (int)Main.worldSurface; - for (int i = 0; i < Main.maxTilesX; i++) - { - for (int j = 0; j < surface; j++) - { - if (Main.tile[i, j] != null) - { - if (Main.tile[i, j].type == mod.TileType("ArenaTile")) - { - WorldGen.KillTile(i, j, false, false, false); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - else - { - WorldGen.SquareTileFrame(i, j, true); - } - } - } - } - } - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SupremeCalamitas")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + int surface = (int)Main.worldSurface; + for (int i = 0; i < Main.maxTilesX; i++) + { + for (int j = 0; j < surface; j++) + { + if (Main.tile[i, j] != null) + { + if (Main.tile[i, j].type == mod.TileType("ArenaTile")) + { + WorldGen.KillTile(i, j, false, false, false); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + else + { + WorldGen.SquareTileFrame(i, j, true); + } + } + } + } + } + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SupremeCalamitas")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "AuricOre", 50); recipe.AddIngredient(null, "NightmareFuel", 30); - recipe.AddIngredient(null, "EndothermicEnergy", 30); - recipe.AddIngredient(null, "DarksunFragment", 25); - recipe.AddIngredient(null, "CosmiliteBar", 15); - recipe.AddIngredient(null, "Phantoplasm", 15); + recipe.AddIngredient(null, "EndothermicEnergy", 30); + recipe.AddIngredient(null, "DarksunFragment", 25); + recipe.AddIngredient(null, "CosmiliteBar", 15); + recipe.AddIngredient(null, "Phantoplasm", 15); recipe.AddIngredient(null, "HellcasterFragment", 5); recipe.AddIngredient(null, "BlightedEyeball"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/TheDevourerofGods/CosmicWorm.cs b/Items/TheDevourerofGods/CosmicWorm.cs index 07fa3f18ce..fb89d855a6 100644 --- a/Items/TheDevourerofGods/CosmicWorm.cs +++ b/Items/TheDevourerofGods/CosmicWorm.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.TheDevourerofGods { public class CosmicWorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Worm"); - Tooltip.SetDefault("Summons the Devourer of Gods\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Worm"); + Tooltip.SetDefault("Summons the Devourer of Gods\n" + "Not consumable"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.Calamity().postMoonLordRarity = 13; + } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityWorld.DoGSecondStageCountdown <= 0 && CalamityWorld.downedBossAny; - } + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityWorld.DoGSecondStageCountdown <= 0 && CalamityWorld.downedBossAny; + } - public override bool UseItem(Player player) - { + public override bool UseItem(Player player) + { string key = "Mods.CalamityMod.EdgyBossText12"; Color messageColor = Color.Cyan; if (Main.netMode == NetmodeID.SinglePlayer) @@ -45,19 +45,19 @@ namespace CalamityMod.Items.TheDevourerofGods NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DevourerofGodsHead")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ArmoredShell", 3); - recipe.AddIngredient(null, "TwistingNether"); - recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ArmoredShell", 3); + recipe.AddIngredient(null, "TwistingNether"); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/TheDevourerofGods/CosmiliteBar.cs b/Items/TheDevourerofGods/CosmiliteBar.cs index 63c3b24d2d..c48968c70d 100644 --- a/Items/TheDevourerofGods/CosmiliteBar.cs +++ b/Items/TheDevourerofGods/CosmiliteBar.cs @@ -5,28 +5,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.TheDevourerofGods { public class CosmiliteBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmilite Bar"); - Tooltip.SetDefault("A chunk of highly-resistant cosmic steel"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmilite Bar"); + Tooltip.SetDefault("A chunk of highly-resistant cosmic steel"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 7, 0, 0); + item.Calamity().postMoonLordRarity = 13; + } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0f * num, 0.5f * num); - } - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0f * num, 0.5f * num); + } + } } diff --git a/Items/TheDevourerofGods/DevourerofGodsBag.cs b/Items/TheDevourerofGods/DevourerofGodsBag.cs index d2af0d2fd8..93aa5da6dc 100644 --- a/Items/TheDevourerofGods/DevourerofGodsBag.cs +++ b/Items/TheDevourerofGods/DevourerofGodsBag.cs @@ -1,73 +1,72 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Items.TheDevourerofGods { - public class DevourerofGodsBag : ModItem - { - public override int BossBagNPC => mod.NPCType("DevourerofGodsHeadS"); + public class DevourerofGodsBag : ModItem + { + public override int BossBagNPC => mod.NPCType("DevourerofGodsHeadS"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(18f, 20f); //18, 17 - spriteBatch.Draw(mod.GetTexture("Items/TheDevourerofGods/DevourerofGodsBagGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(18f, 20f); //18, 17 + spriteBatch.Draw(mod.GetTexture("Items/TheDevourerofGods/DevourerofGodsBagGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, mod.ItemType("CosmiliteBar"), 30, 39); + // Materials + DropHelper.DropItem(player, mod.ItemType("CosmiliteBar"), 30, 39); DropHelper.DropItem(player, mod.ItemType("CosmiliteBrick"), 200, 320); - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("Excelsus"), 3); - DropHelper.DropItemChance(player, mod.ItemType("EradicatorMelee"), 3); - float dischargeChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, mod.ItemType("CosmicDischarge"), CalamityWorld.revenge, dischargeChance); - DropHelper.DropItemChance(player, mod.ItemType("TheObliterator"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Deathwind"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Skullmasher"), DropHelper.RareVariantDropRateInt); - DropHelper.DropItemChance(player, mod.ItemType("Norfleet"), DropHelper.RareVariantDropRateInt); - DropHelper.DropItemChance(player, mod.ItemType("DeathhailStaff"), 3); - DropHelper.DropItemChance(player, mod.ItemType("StaffoftheMechworm"), 3); - DropHelper.DropItemChance(player, mod.ItemType("Eradicator"), 3); + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("Excelsus"), 3); + DropHelper.DropItemChance(player, mod.ItemType("EradicatorMelee"), 3); + float dischargeChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : DropHelper.LegendaryDropRateFloat; + DropHelper.DropItemCondition(player, mod.ItemType("CosmicDischarge"), CalamityWorld.revenge, dischargeChance); + DropHelper.DropItemChance(player, mod.ItemType("TheObliterator"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Deathwind"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Skullmasher"), DropHelper.RareVariantDropRateInt); + DropHelper.DropItemChance(player, mod.ItemType("Norfleet"), DropHelper.RareVariantDropRateInt); + DropHelper.DropItemChance(player, mod.ItemType("DeathhailStaff"), 3); + DropHelper.DropItemChance(player, mod.ItemType("StaffoftheMechworm"), 3); + DropHelper.DropItemChance(player, mod.ItemType("Eradicator"), 3); - // Equipment - DropHelper.DropItem(player, mod.ItemType("NebulousCore")); - bool vodka = player.Calamity().fabsolVodka; - DropHelper.DropItemCondition(player, mod.ItemType("Fabsol"), CalamityWorld.revenge && vodka); + // Equipment + DropHelper.DropItem(player, mod.ItemType("NebulousCore")); + bool vodka = player.Calamity().fabsolVodka; + DropHelper.DropItemCondition(player, mod.ItemType("Fabsol"), CalamityWorld.revenge && vodka); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("DevourerofGodsMask"), 7); - DropHelper.DropItemCondition(player, mod.ItemType("CosmicPlushie"), CalamityWorld.death && player.difficulty == 2); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("DevourerofGodsMask"), 7); + DropHelper.DropItemCondition(player, mod.ItemType("CosmicPlushie"), CalamityWorld.death && player.difficulty == 2); + } + } } diff --git a/Items/TheDevourerofGods/NebulousCore.cs b/Items/TheDevourerofGods/NebulousCore.cs index 77a8c6010b..a9ace09d29 100644 --- a/Items/TheDevourerofGods/NebulousCore.cs +++ b/Items/TheDevourerofGods/NebulousCore.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.TheDevourerofGods { @@ -23,8 +23,8 @@ namespace CalamityMod.Items.TheDevourerofGods item.value = Item.buyPrice(0, 60, 0, 0); item.accessory = true; item.expert = true; - item.rare = 9; - } + item.rare = 9; + } public override void Update(ref float gravity, ref float maxFallSpeed) { @@ -37,8 +37,8 @@ namespace CalamityMod.Items.TheDevourerofGods { CalamityPlayer modPlayer = player.Calamity(); modPlayer.nCore = true; - player.allDamage += 0.12f; - int damage = 1500; + player.allDamage += 0.12f; + int damage = 1500; float knockBack = 3f; if (Main.rand.NextBool(15)) { diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index a345eaf119..a801053244 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -6,47 +6,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class AerialHamaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerial Hamaxe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerial Hamaxe"); + } - public override void SetDefaults() - { - item.damage = 20; - item.melee = true; - item.width = 44; - item.height = 46; - item.useTime = 26; - item.useAnimation = 26; - item.useTurn = true; - item.axe = 25; - item.hammer = 65; - item.useStyle = 1; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 20; + item.melee = true; + item.width = 44; + item.height = 46; + item.useTime = 26; + item.useAnimation = 26; + item.useTurn = true; + item.axe = 25; + item.hammer = 65; + item.useStyle = 1; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 6); - recipe.AddIngredient(ItemID.SunplateBlock, 5); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 6); + recipe.AddIngredient(ItemID.SunplateBlock, 5); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); + } + } + } } diff --git a/Items/Tools/AstralHamaxe.cs b/Items/Tools/AstralHamaxe.cs index 876252362e..eb41c44b2a 100644 --- a/Items/Tools/AstralHamaxe.cs +++ b/Items/Tools/AstralHamaxe.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Items.Tools { public class AstralHamaxe : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Hamaxe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Hamaxe"); + } public override void SetDefaults() { @@ -42,12 +42,12 @@ namespace CalamityMod.Items.Tools } } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "AstralBar", 8); diff --git a/Items/Tools/AstralPickaxe.cs b/Items/Tools/AstralPickaxe.cs index 8e3b10bd5d..b7c3795422 100644 --- a/Items/Tools/AstralPickaxe.cs +++ b/Items/Tools/AstralPickaxe.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Items.Tools { public class AstralPickaxe : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Pickaxe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Pickaxe"); + } public override void SetDefaults() { @@ -41,12 +41,12 @@ namespace CalamityMod.Items.Tools recipe.AddRecipe(); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override void MeleeEffects(Player player, Rectangle hitbox) { Dust d = CalamityGlobalItem.MeleeDustHelper(player, Main.rand.NextBool(2) ? mod.DustType("AstralOrange") : mod.DustType("AstralBlue"), 0.56f, 40, 65, -0.13f, 0.13f); if (d != null) diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 8500ac212a..112d2a03b7 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Tools item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 6; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 0753d4bdfa..96f02799bc 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -7,21 +7,21 @@ namespace CalamityMod.Items.Tools { public class CrystylCrusher : ModItem { - private static int PickPower = 5000; - private static float PowderSpeed = 9f; + private static int PickPower = 5000; + private static float PowderSpeed = 9f; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystyl Crusher"); Tooltip.SetDefault("Gotta dig faster, gotta go deeper\n" + - "Right click to destroy a lot of blocks"); + "Right click to destroy a lot of blocks"); } public override void SetDefaults() { item.damage = 500; item.melee = true; - item.crit += 25; + item.crit += 25; item.width = 70; item.height = 70; item.useTime = 2; @@ -34,41 +34,41 @@ namespace CalamityMod.Items.Tools item.rare = 10; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, 0f); - Main.projectile[proj].extraUpdates = 1; - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, 0f); + Main.projectile[proj].extraUpdates = 1; + return false; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.pick = 0; - item.shoot = mod.ProjectileType("CrystalDust"); - item.shootSpeed = PowderSpeed; - item.tileBoost = 0; - } - else - { - item.pick = PickPower; - item.shoot = 0; - item.shootSpeed = 0f; - item.tileBoost += 50; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.pick = 0; + item.shoot = mod.ProjectileType("CrystalDust"); + item.shootSpeed = PowderSpeed; + item.tileBoost = 0; + } + else + { + item.pick = PickPower; + item.shoot = 0; + item.shootSpeed = 0f; + item.tileBoost += 50; + } + return base.CanUseItem(player); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "GallantPickaxe"); diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index b8f8e92c1e..63f21fc1ac 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -5,48 +5,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class FellerofEvergreens : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feller of Evergreens"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feller of Evergreens"); + } - public override void SetDefaults() - { - item.damage = 15; - item.melee = true; - item.width = 36; - item.height = 36; - item.useTime = 25; - item.useAnimation = 25; - item.useTurn = true; - item.axe = 15; - item.useStyle = 1; - item.knockBack = 5; + public override void SetDefaults() + { + item.damage = 15; + item.melee = true; + item.width = 36; + item.height = 36; + item.useTime = 25; + item.useAnimation = 25; + item.useTurn = true; + item.axe = 15; + item.useStyle = 1; + item.knockBack = 5; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood, 15); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Wood, 15); recipe.anyWood = true; recipe.AddIngredient(ItemID.TungstenBar, 10); - recipe.AddIngredient(ItemID.TungstenAxe); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood, 15); + recipe.AddIngredient(ItemID.TungstenAxe); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Wood, 15); recipe.anyWood = true; recipe.AddIngredient(ItemID.SilverBar, 10); - recipe.AddIngredient(ItemID.SilverAxe); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddIngredient(ItemID.SilverAxe); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Tools/GallantPickaxe.cs b/Items/Tools/GallantPickaxe.cs index 92e60c1d87..64153f87c7 100644 --- a/Items/Tools/GallantPickaxe.cs +++ b/Items/Tools/GallantPickaxe.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Tools item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 5; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index 0a187ce1cd..b1178d6d86 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -6,51 +6,51 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class Gelpick : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gelpick"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gelpick"); + } - public override void SetDefaults() - { - item.damage = 12; - item.melee = true; - item.width = 46; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.pick = 100; - item.useStyle = 1; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 12; + item.melee = true; + item.width = 46; + item.height = 46; + item.useTime = 20; + item.useAnimation = 20; + item.pick = 100; + item.useStyle = 1; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 15); - recipe.AddIngredient(ItemID.Gel, 30); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 15); + recipe.AddIngredient(ItemID.Gel, 30); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 20); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 20); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 180); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slimed, 180); + } + } } diff --git a/Items/Tools/GreatbayPickaxe.cs b/Items/Tools/GreatbayPickaxe.cs index 3c2fb2a35f..9a26e073c9 100644 --- a/Items/Tools/GreatbayPickaxe.cs +++ b/Items/Tools/GreatbayPickaxe.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class GreatbayPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Greatbay Pickaxe"); - Tooltip.SetDefault("Can mine Meteorite"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greatbay Pickaxe"); + Tooltip.SetDefault("Can mine Meteorite"); + } - public override void SetDefaults() - { - item.damage = 9; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.pick = 60; - item.useStyle = 1; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 9; + item.melee = true; + item.width = 44; + item.height = 44; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.pick = 60; + item.useStyle = 1; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 63fa646bc9..935af6b582 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -4,53 +4,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { - public class MarniteObliterator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Marnite Obliterator"); - } + public class MarniteObliterator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marnite Obliterator"); + } - public override void SetDefaults() - { - item.damage = 13; - item.melee = true; - item.width = 36; - item.height = 18; - item.useTime = 7; - item.useAnimation = 25; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; - item.pick = 57; - item.axe = 10; - item.tileBoost++; - item.useStyle = 5; - item.knockBack = 3; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item23; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MarniteObliterator"); - item.shootSpeed = 40f; - } + public override void SetDefaults() + { + item.damage = 13; + item.melee = true; + item.width = 36; + item.height = 18; + item.useTime = 7; + item.useAnimation = 25; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.pick = 57; + item.axe = 10; + item.tileBoost++; + item.useStyle = 5; + item.knockBack = 3; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item23; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MarniteObliterator"); + item.shootSpeed = 40f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 3); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 3); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 3); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldBar, 3); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Tools/ReefclawHamaxe.cs b/Items/Tools/ReefclawHamaxe.cs index 759b8ea329..84792f596d 100644 --- a/Items/Tools/ReefclawHamaxe.cs +++ b/Items/Tools/ReefclawHamaxe.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class ReefclawHamaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reefclaw Hamaxe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reefclaw Hamaxe"); + } - public override void SetDefaults() - { - item.damage = 15; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTime = 29; - item.useAnimation = 29; - item.useTurn = true; - item.axe = 13; - item.hammer = 50; - item.useStyle = 1; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 15; + item.melee = true; + item.width = 44; + item.height = 44; + item.useTime = 29; + item.useAnimation = 29; + item.useTurn = true; + item.axe = 13; + item.hammer = 50; + item.useStyle = 1; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index e062a4939b..2750080bfc 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -6,47 +6,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class SkyfringePickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skyfringe Pickaxe"); - Tooltip.SetDefault("Able to mine Hellstone"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skyfringe Pickaxe"); + Tooltip.SetDefault("Able to mine Hellstone"); + } - public override void SetDefaults() - { - item.damage = 12; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.pick = 95; - item.useStyle = 1; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 12; + item.melee = true; + item.width = 44; + item.height = 44; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.pick = 95; + item.useStyle = 1; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 7); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 7); + recipe.AddIngredient(ItemID.SunplateBlock, 3); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); + } + } + } } diff --git a/Items/Tools/WulfrumAxe.cs b/Items/Tools/WulfrumAxe.cs index 0fb3b0fcf6..c0900bc40f 100644 --- a/Items/Tools/WulfrumAxe.cs +++ b/Items/Tools/WulfrumAxe.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class WulfrumAxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Axe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Axe"); + } - public override void SetDefaults() - { - item.damage = 5; - item.melee = true; - item.width = 62; - item.height = 58; - item.useTime = 26; - item.useAnimation = 26; - item.useTurn = true; - item.axe = 7; - item.useStyle = 1; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 5; + item.melee = true; + item.width = 62; + item.height = 58; + item.useTime = 26; + item.useAnimation = 26; + item.useTurn = true; + item.axe = 7; + item.useStyle = 1; + item.knockBack = 4.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 14); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 14); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Tools/WulfrumHammer.cs b/Items/Tools/WulfrumHammer.cs index c1c2961dea..f3432f468c 100644 --- a/Items/Tools/WulfrumHammer.cs +++ b/Items/Tools/WulfrumHammer.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class WulfrumHammer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Hammer"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Hammer"); + } - public override void SetDefaults() - { - item.damage = 7; - item.melee = true; - item.width = 56; - item.height = 56; - item.useTime = 29; - item.useAnimation = 29; - item.useTurn = true; - item.hammer = 35; - item.useStyle = 1; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 7; + item.melee = true; + item.width = 56; + item.height = 56; + item.useTime = 29; + item.useAnimation = 29; + item.useTurn = true; + item.hammer = 35; + item.useStyle = 1; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 16); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 16); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Tools/WulfrumPickaxe.cs b/Items/Tools/WulfrumPickaxe.cs index f62cf83ac4..961cfb0101 100644 --- a/Items/Tools/WulfrumPickaxe.cs +++ b/Items/Tools/WulfrumPickaxe.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Tools { public class WulfrumPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Pickaxe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Pickaxe"); + } - public override void SetDefaults() - { - item.damage = 5; - item.melee = true; - item.width = 48; - item.height = 48; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.pick = 35; - item.useStyle = 1; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 5; + item.melee = true; + item.width = 48; + item.height = 48; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.pick = 35; + item.useStyle = 1; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AMR.cs b/Items/Weapons/AMR.cs index 6eb7271a81..ea3e1a98dc 100644 --- a/Items/Weapons/AMR.cs +++ b/Items/Weapons/AMR.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override Vector2? HoldoutOffset() { @@ -52,8 +52,8 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0f, 0f); return false; } - } + } } diff --git a/Items/Weapons/AbyssBlade.cs b/Items/Weapons/AbyssBlade.cs index 2c939ad121..037279bdc8 100644 --- a/Items/Weapons/AbyssBlade.cs +++ b/Items/Weapons/AbyssBlade.cs @@ -6,58 +6,58 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AbyssBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Blade"); - Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + - "The lower the enemies' defense the more damage they take from this debuff\n" + - "Fires short-range tridents"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Blade"); + Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + + "The lower the enemies' defense the more damage they take from this debuff\n" + + "Fires short-range tridents"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 110; - item.melee = true; - item.useAnimation = 26; - item.useTime = 26; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; + public override void SetDefaults() + { + item.width = 60; + item.damage = 110; + item.melee = true; + item.useAnimation = 26; + item.useTime = 26; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.shoot = mod.ProjectileType("DepthOrb"); - item.shootSpeed = 9f; - } + item.shoot = mod.ProjectileType("DepthOrb"); + item.shootSpeed = 9f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthBlade"); - recipe.AddIngredient(ItemID.BrokenHeroSword); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthBlade"); + recipe.AddIngredient(ItemID.BrokenHeroSword); recipe.AddIngredient(null, "DepthCells", 15); recipe.AddIngredient(null, "Lumenite", 10); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 300); + } + } } diff --git a/Items/Weapons/AbyssWeapons/Archerfish.cs b/Items/Weapons/AbyssWeapons/Archerfish.cs index a965a8119c..32953ca991 100644 --- a/Items/Weapons/AbyssWeapons/Archerfish.cs +++ b/Items/Weapons/AbyssWeapons/Archerfish.cs @@ -1,41 +1,37 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class Archerfish : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Archerfish"); - Tooltip.SetDefault("Fires a stream of water"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Archerfish"); + Tooltip.SetDefault("Fires a stream of water"); + } - public override void SetDefaults() - { - item.damage = 23; - item.ranged = true; - item.width = 78; - item.height = 36; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 23; + item.ranged = true; + item.width = 78; + item.height = 36; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Archerfish"); - item.shootSpeed = 11f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Archerfish"); + item.shootSpeed = 11f; + item.useAmmo = 97; + } public override Vector2? HoldoutOffset() { @@ -44,8 +40,8 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Archerfish"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Archerfish"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/AbyssWeapons/BallOFugu.cs b/Items/Weapons/AbyssWeapons/BallOFugu.cs index 105e171178..bc1b532d46 100644 --- a/Items/Weapons/AbyssWeapons/BallOFugu.cs +++ b/Items/Weapons/AbyssWeapons/BallOFugu.cs @@ -5,32 +5,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class BallOFugu : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball O' Fugu"); - Tooltip.SetDefault("Throws a fish that spews homing spikes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball O' Fugu"); + Tooltip.SetDefault("Throws a fish that spews homing spikes"); + } - public override void SetDefaults() - { - item.damage = 40; - item.melee = true; - item.width = 30; - item.height = 10; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; + public override void SetDefaults() + { + item.damage = 40; + item.melee = true; + item.width = 30; + item.height = 10; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; item.noUseGraphic = true; - item.knockBack = 8f; + item.knockBack = 8f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.channel = true; - item.shoot = mod.ProjectileType("BallOFugu"); - item.shootSpeed = 12f; - } - } + item.shoot = mod.ProjectileType("BallOFugu"); + item.shootSpeed = 12f; + } + } } diff --git a/Items/Weapons/AbyssWeapons/BlackAnurian.cs b/Items/Weapons/AbyssWeapons/BlackAnurian.cs index 5d5f674e2f..2680ac617b 100644 --- a/Items/Weapons/AbyssWeapons/BlackAnurian.cs +++ b/Items/Weapons/AbyssWeapons/BlackAnurian.cs @@ -6,32 +6,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class BlackAnurian : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Black Anurian"); - Tooltip.SetDefault("Spews bubbles and homing plankton"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Black Anurian"); + Tooltip.SetDefault("Spews bubbles and homing plankton"); + } - public override void SetDefaults() - { - item.damage = 36; - item.magic = true; - item.mana = 10; - item.width = 58; - item.height = 38; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; + public override void SetDefaults() + { + item.damage = 36; + item.magic = true; + item.mana = 10; + item.width = 58; + item.height = 38; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item111; - item.autoReuse = true; - item.shootSpeed = 8f; - item.shoot = mod.ProjectileType("BlackAnurian"); - } + item.UseSound = SoundID.Item111; + item.autoReuse = true; + item.shootSpeed = 8f; + item.shoot = mod.ProjectileType("BlackAnurian"); + } public override Vector2? HoldoutOffset() { @@ -39,16 +39,16 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = 2; - for (int index = 0; index < num6; ++index) - { + { + int num6 = 2; + for (int index = 0; index < num6; ++index) + { float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("BlackAnurianPlankton"), (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); - } + } Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); return false; - } - } + } + } } diff --git a/Items/Weapons/AbyssWeapons/CalamarisLament.cs b/Items/Weapons/AbyssWeapons/CalamarisLament.cs index 08fd79669f..2ec0058010 100644 --- a/Items/Weapons/AbyssWeapons/CalamarisLament.cs +++ b/Items/Weapons/AbyssWeapons/CalamarisLament.cs @@ -31,33 +31,33 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.shoot = mod.ProjectileType("Calamari"); item.shootSpeed = 10f; item.summon = true; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/AbyssWeapons/EidolicWail.cs b/Items/Weapons/AbyssWeapons/EidolicWail.cs index 794085844d..6525910438 100644 --- a/Items/Weapons/AbyssWeapons/EidolicWail.cs +++ b/Items/Weapons/AbyssWeapons/EidolicWail.cs @@ -5,39 +5,39 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class EidolicWail : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolic Wail"); - Tooltip.SetDefault("Earrape\n" + - "Fires a string of bouncing sound waves that become stronger as they travel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolic Wail"); + Tooltip.SetDefault("Earrape\n" + + "Fires a string of bouncing sound waves that become stronger as they travel"); + } - public override void SetDefaults() - { - item.damage = 210; - item.magic = true; - item.mana = 10; - item.width = 60; - item.height = 60; + public override void SetDefaults() + { + item.damage = 210; + item.magic = true; + item.mana = 10; + item.width = 60; + item.height = 60; item.useTime = 12; item.reuseDelay = 30; item.useAnimation = 36; item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1f; + item.noMelee = true; + item.knockBack = 1f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"); - item.autoReuse = true; - item.shootSpeed = 5f; - item.shoot = mod.ProjectileType("EidolicWail"); - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shootSpeed = 5f; + item.shoot = mod.ProjectileType("EidolicWail"); + item.Calamity().postMoonLordRarity = 13; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - } + } } diff --git a/Items/Weapons/AbyssWeapons/FlakKraken.cs b/Items/Weapons/AbyssWeapons/FlakKraken.cs index bd5f2f65ee..0a3a376076 100644 --- a/Items/Weapons/AbyssWeapons/FlakKraken.cs +++ b/Items/Weapons/AbyssWeapons/FlakKraken.cs @@ -5,39 +5,39 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class FlakKraken : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flak Kraken"); - Tooltip.SetDefault("Fires an energy reticle that becomes more powerful over time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flak Kraken"); + Tooltip.SetDefault("Fires an energy reticle that becomes more powerful over time"); + } - public override void SetDefaults() - { - item.damage = 54; - item.ranged = true; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; + public override void SetDefaults() + { + item.damage = 54; + item.ranged = true; + item.width = 16; + item.height = 16; + item.useTime = 10; + item.useAnimation = 10; item.reuseDelay = 5; item.useStyle = 5; - item.noMelee = true; + item.noMelee = true; item.noUseGraphic = true; item.channel = true; item.knockBack = 0f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.shoot = mod.ProjectileType("FlakKrakenGun"); - item.shootSpeed = 30f; //30 - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.shoot = mod.ProjectileType("FlakKrakenGun"); + item.shootSpeed = 30f; //30 + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("FlakKrakenGun"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("FlakKrakenGun"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } public override void AddRecipes() { diff --git a/Items/Weapons/AbyssWeapons/HalibutCannon.cs b/Items/Weapons/AbyssWeapons/HalibutCannon.cs index 703325c72e..a783b5dcc7 100644 --- a/Items/Weapons/AbyssWeapons/HalibutCannon.cs +++ b/Items/Weapons/AbyssWeapons/HalibutCannon.cs @@ -6,43 +6,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class HalibutCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Halibut Cannon"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Halibut Cannon"); Tooltip.SetDefault("This weapon is overpowered, use at the risk of ruining your playthrough\n" + - "Revengeance drop"); + "Revengeance drop"); } - public override void SetDefaults() - { - item.damage = 6; - item.ranged = true; - item.width = 108; - item.height = 54; - item.useTime = 10; - item.useAnimation = 20; - item.useStyle = 5; + public override void SetDefaults() + { + item.damage = 6; + item.ranged = true; + item.width = 108; + item.height = 54; + item.useTime = 10; + item.useAnimation = 20; + item.useStyle = 5; item.rare = 10; - item.noMelee = true; - item.knockBack = 1f; + item.noMelee = true; + item.knockBack = 1f; item.value = Item.buyPrice(1, 0, 0, 0); item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (Main.hardMode) { item.damage = 12; } - if (NPC.downedMoonlord) { item.damage = 24; } + if (Main.hardMode) + { item.damage = 12; } + if (NPC.downedMoonlord) + { item.damage = 24; } int num6 = Main.rand.Next(25, 36); for (int index = 0; index < num6; ++index) { @@ -55,5 +57,5 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons } return false; } - } + } } diff --git a/Items/Weapons/AbyssWeapons/HerringStaff.cs b/Items/Weapons/AbyssWeapons/HerringStaff.cs index 9ea3088435..b0daecbf32 100644 --- a/Items/Weapons/AbyssWeapons/HerringStaff.cs +++ b/Items/Weapons/AbyssWeapons/HerringStaff.cs @@ -33,30 +33,30 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.summon = true; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/AbyssWeapons/SoulEdge.cs b/Items/Weapons/AbyssWeapons/SoulEdge.cs index 462221dcca..397fe7db29 100644 --- a/Items/Weapons/AbyssWeapons/SoulEdge.cs +++ b/Items/Weapons/AbyssWeapons/SoulEdge.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.rare = 10; item.shoot = mod.ProjectileType("GhastlySoulLarge"); item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs index 26d819c04d..da57000bb0 100644 --- a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs +++ b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs @@ -6,32 +6,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class SulphuricAcidCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sulphuric Acid Cannon"); - Tooltip.SetDefault("Fires an acidic bubble that sticks to enemies and emits sulphuric gas"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphuric Acid Cannon"); + Tooltip.SetDefault("Fires an acidic bubble that sticks to enemies and emits sulphuric gas"); + } - public override void SetDefaults() - { - item.damage = 220; - item.ranged = true; - item.width = 90; - item.height = 30; - item.useTime = 18; - item.useAnimation = 18; + public override void SetDefaults() + { + item.damage = 220; + item.ranged = true; + item.width = 90; + item.height = 30; + item.useTime = 18; + item.useAnimation = 18; item.useStyle = 5; - item.noMelee = true; + item.noMelee = true; item.knockBack = 6f; item.autoReuse = true; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item95; - item.shoot = mod.ProjectileType("SulphuricAcidCannon2"); - item.shootSpeed = 16f; - item.Calamity().postMoonLordRarity = 13; - } + item.shoot = mod.ProjectileType("SulphuricAcidCannon2"); + item.shootSpeed = 16f; + item.Calamity().postMoonLordRarity = 13; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/AbyssWeapons/TyphonsGreed.cs b/Items/Weapons/AbyssWeapons/TyphonsGreed.cs index 8d74fcdb38..9da2d1902d 100644 --- a/Items/Weapons/AbyssWeapons/TyphonsGreed.cs +++ b/Items/Weapons/AbyssWeapons/TyphonsGreed.cs @@ -5,33 +5,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class TyphonsGreed : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Typhon's Greed"); - Tooltip.SetDefault("Summons water spirits while in use"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Typhon's Greed"); + Tooltip.SetDefault("Summons water spirits while in use"); + } - public override void SetDefaults() - { - item.damage = 75; - item.melee = true; - item.width = 16; - item.height = 16; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; + public override void SetDefaults() + { + item.damage = 75; + item.melee = true; + item.width = 16; + item.height = 16; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; item.noUseGraphic = true; - item.knockBack = 5f; + item.knockBack = 5f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.DD2_SkyDragonsFurySwing; - item.autoReuse = true; + item.UseSound = SoundID.DD2_SkyDragonsFurySwing; + item.autoReuse = true; item.channel = true; - item.shoot = mod.ProjectileType("TyphonsGreedStaff"); - item.shootSpeed = 24f; - } + item.shoot = mod.ProjectileType("TyphonsGreedStaff"); + item.shootSpeed = 24f; + } public override void AddRecipes() { diff --git a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs index df587c8b69..8951162bff 100644 --- a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs +++ b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,36 +7,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AbyssWeapons { public class UndinesRetribution : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Undine's Retribution"); - Tooltip.SetDefault("Casts a swarm of homing spears"); - Item.staff[item.type] = true; + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Undine's Retribution"); + Tooltip.SetDefault("Casts a swarm of homing spears"); + Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 30; - item.magic = true; - item.mana = 15; - item.width = 64; - item.height = 64; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 30; + item.magic = true; + item.mana = 15; + item.width = 64; + item.height = 64; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.Item66; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("UndinesRetribution"); - } + item.UseSound = SoundID.Item66; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("UndinesRetribution"); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; diff --git a/Items/Weapons/AccelerationBullet.cs b/Items/Weapons/AccelerationBullet.cs index 13041fcd37..a6f5ab716d 100644 --- a/Items/Weapons/AccelerationBullet.cs +++ b/Items/Weapons/AccelerationBullet.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AccelerationBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acceleration Round"); - Tooltip.SetDefault("Gains speed over time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acceleration Round"); + Tooltip.SetDefault("Gains speed over time"); + } - public override void SetDefaults() - { - item.damage = 11; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 250; - item.rare = 1; - item.shoot = mod.ProjectileType("AccelerationBullet"); - item.shootSpeed = 1f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 11; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("AccelerationBullet"); + item.shootSpeed = 1f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(null, "VictoryShard"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 150); + recipe.AddIngredient(null, "VictoryShard"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AccretionDiskMelee.cs b/Items/Weapons/AccretionDiskMelee.cs index 6a590e9d4b..62605c1ba7 100644 --- a/Items/Weapons/AccretionDiskMelee.cs +++ b/Items/Weapons/AccretionDiskMelee.cs @@ -5,46 +5,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AccretionDiskMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Disk"); - Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Disk"); + Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); + } - public override void SetDefaults() - { - item.width = 38; - item.damage = 157; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 38; + public override void SetDefaults() + { + item.width = 38; + item.damage = 157; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 38; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("AccretionDiskMelee"); - item.shootSpeed = 13f; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 13f; + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MangroveChakramMelee"); - recipe.AddIngredient(null, "FlameScytheMelee"); - recipe.AddIngredient(null, "SeashellBoomerangMelee"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MangroveChakramMelee"); + recipe.AddIngredient(null, "FlameScytheMelee"); + recipe.AddIngredient(null, "SeashellBoomerangMelee"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AcidBullet.cs b/Items/Weapons/AcidBullet.cs index e7932224cc..a6c3739e72 100644 --- a/Items/Weapons/AcidBullet.cs +++ b/Items/Weapons/AcidBullet.cs @@ -4,38 +4,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AcidBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Round"); - Tooltip.SetDefault("Explodes into acid that inflicts the plague\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Round"); + Tooltip.SetDefault("Explodes into acid that inflicts the plague\n" + "Does more damage the higher the target's defense"); - } + } - public override void SetDefaults() - { - item.damage = 28; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 1250; - item.rare = 8; - item.shoot = mod.ProjectileType("AcidBullet"); - item.shootSpeed = 10f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 28; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 1250; + item.rare = 8; + item.shoot = mod.ProjectileType("AcidBullet"); + item.shootSpeed = 10f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(null, "PlagueCellCluster"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 150); + recipe.AddIngredient(null, "PlagueCellCluster"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AegisBlade.cs b/Items/Weapons/AegisBlade.cs index 71bb7fe818..ee61f22262 100644 --- a/Items/Weapons/AegisBlade.cs +++ b/Items/Weapons/AegisBlade.cs @@ -6,78 +6,78 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AegisBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Blade"); - Tooltip.SetDefault("Legendary Drop\n" + - "Striking an enemy with the blade causes an earthen eruption\n" + - "Right click to fire an aegis bolt\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Blade"); + Tooltip.SetDefault("Legendary Drop\n" + + "Striking an enemy with the blade causes an earthen eruption\n" + + "Right click to fire an aegis bolt\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.width = 44; - item.damage = 68; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; + public override void SetDefaults() + { + item.width = 44; + item.damage = 68; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; item.rare = 7; item.value = Item.buyPrice(0, 60, 0, 0); item.shootSpeed = 14f; - item.Calamity().postMoonLordRarity = 17; - } + item.Calamity().postMoonLordRarity = 17; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.noMelee = true; - item.useTime = 20; - item.useAnimation = 20; + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noMelee = true; + item.useTime = 20; + item.useAnimation = 20; item.UseSound = SoundID.Item73; item.shoot = mod.ProjectileType("AegisBeam"); - } - else - { - item.noMelee = false; - item.useTime = 15; - item.useAnimation = 15; + } + else + { + item.noMelee = false; + item.useTime = 15; + item.useAnimation = 15; item.UseSound = SoundID.Item1; item.shoot = 0; - } - return base.CanUseItem(player); - } + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AegisBeam"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AegisBeam"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("AegisBlast"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("AegisBlast"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } } diff --git a/Items/Weapons/Aeries.cs b/Items/Weapons/Aeries.cs index ab9b01ac07..cc0c92ee17 100644 --- a/Items/Weapons/Aeries.cs +++ b/Items/Weapons/Aeries.cs @@ -6,53 +6,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Aeries : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aeries"); - Tooltip.SetDefault("Fires shockblast rounds that can steal enemy life"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aeries"); + Tooltip.SetDefault("Fires shockblast rounds that can steal enemy life"); + } - public override void SetDefaults() - { - item.damage = 35; - item.ranged = true; - item.width = 50; - item.height = 32; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 35; + item.ranged = true; + item.width = 50; + item.height = 32; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("ShockblastRound"); - item.useAmmo = 97; - } + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("ShockblastRound"); + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreBar, 5); - recipe.AddIngredient(null, "CursedCapper"); - recipe.AddIngredient(ItemID.ShroomiteBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpectreBar, 5); + recipe.AddIngredient(null, "CursedCapper"); + recipe.AddIngredient(ItemID.ShroomiteBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AethersWhisper.cs b/Items/Weapons/AethersWhisper.cs index 600ee3cdd2..61c17ccd8f 100644 --- a/Items/Weapons/AethersWhisper.cs +++ b/Items/Weapons/AethersWhisper.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Aether's Whisper"); Tooltip.SetDefault("Inflicts several long-lasting debuffs and splits on tile hits\n" + - "Projectiles gain damage as they travel\n" + + "Projectiles gain damage as they travel\n" + "Right click to change from magic to ranged damage"); } @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shootSpeed = 12f; item.shoot = mod.ProjectileType("AetherBeam"); - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override Vector2? HoldoutOffset() { @@ -63,14 +63,14 @@ namespace CalamityMod.Items.Weapons return base.CanUseItem(player); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float ai0 = (player.altFunctionUse == 2 ? 1f : 0f); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, ai0, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float ai0 = (player.altFunctionUse == 2 ? 1f : 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, ai0, 0f); + return false; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlasmaRod"); diff --git a/Items/Weapons/Aftershock.cs b/Items/Weapons/Aftershock.cs index 8f02f10c65..9a64cc2902 100644 --- a/Items/Weapons/Aftershock.cs +++ b/Items/Weapons/Aftershock.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Items.Weapons { public class Aftershock : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aftershock"); - Tooltip.SetDefault("Summons boulders from the sky on enemy hits"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aftershock"); + Tooltip.SetDefault("Summons boulders from the sky on enemy hits"); + } public override void SetDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons item.height = 58; item.useTime = 28; item.useAnimation = 28; - item.useTurn = true; + item.useTurn = true; item.useStyle = 1; item.knockBack = 7.5f; item.value = Item.buyPrice(0, 36, 0, 0); @@ -34,49 +34,49 @@ namespace CalamityMod.Items.Weapons public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120); - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78; - float speedY5 = num79 + (float)Main.rand.Next(-10, 11) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Aftershock"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + target.AddBuff(mod.BuffType("ArmorCrunch"), 120); + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78; + float speedY5 = num79 + (float)Main.rand.Next(-10, 11) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Aftershock"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/AirSpinner.cs b/Items/Weapons/AirSpinner.cs index 555b8fd58d..c9b7c64a99 100644 --- a/Items/Weapons/AirSpinner.cs +++ b/Items/Weapons/AirSpinner.cs @@ -5,36 +5,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AirSpinner : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Air Spinner"); - Tooltip.SetDefault("Fires feathers when enemies are near"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Air Spinner"); + Tooltip.SetDefault("Fires feathers when enemies are near"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Valor); - item.damage = 20; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4; + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Valor); + item.damage = 20; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.autoReuse = false; - item.shoot = mod.ProjectileType("AirSpinnerProjectile"); - } + item.autoReuse = false; + item.shoot = mod.ProjectileType("AirSpinnerProjectile"); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 6); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 6); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Alluvion.cs b/Items/Weapons/Alluvion.cs index ad1ef08eed..7521bafdcf 100644 --- a/Items/Weapons/Alluvion.cs +++ b/Items/Weapons/Alluvion.cs @@ -2,97 +2,96 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class Alluvion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Alluvion"); - Tooltip.SetDefault("Moderate chance to convert wooden arrows to sharks\n" + - "Low chance to convert wooden arrows to typhoon arrows\n" + - "Fires a torrent of ten arrows at once"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alluvion"); + Tooltip.SetDefault("Moderate chance to convert wooden arrows to sharks\n" + + "Low chance to convert wooden arrows to typhoon arrows\n" + + "Fires a torrent of ten arrows at once"); + } - public override void SetDefaults() - { - item.damage = 90; - item.ranged = true; - item.width = 60; - item.height = 90; - item.useTime = 9; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 17f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.damage = 90; + item.ranged = true; + item.width = 60; + item.height = 90; + item.useTime = 9; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 17f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 14; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 10; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 20f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - if (type == ProjectileID.WoodenArrowFriendly) - { - if (Main.rand.NextBool(12)) - { - type = mod.ProjectileType("TorrentialArrow"); - } - if (Main.rand.NextBool(25)) - { - type = 408; - } - if (Main.rand.NextBool(100)) - { - type = mod.ProjectileType("TyphoonArrow"); - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].Calamity().forceRanged = true; - Main.projectile[num121].noDropItem = true; - } - else - { - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 10; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 20f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + if (type == ProjectileID.WoodenArrowFriendly) + { + if (Main.rand.NextBool(12)) + { + type = mod.ProjectileType("TorrentialArrow"); + } + if (Main.rand.NextBool(25)) + { + type = 408; + } + if (Main.rand.NextBool(100)) + { + type = mod.ProjectileType("TyphoonArrow"); + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].Calamity().forceRanged = true; + Main.projectile[num121].noDropItem = true; + } + else + { + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Monsoon"); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 20); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Monsoon"); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 20); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AlphaRay.cs b/Items/Weapons/AlphaRay.cs index e9b4735499..1fb87d1d63 100644 --- a/Items/Weapons/AlphaRay.cs +++ b/Items/Weapons/AlphaRay.cs @@ -6,88 +6,88 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AlphaRay : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Alpha Ray"); - Tooltip.SetDefault("Disintegrates everything with a tri-beam of energy and lasers\n" + - "Right click to fire a Y-shaped beam of destructive energy and a spread of lasers"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alpha Ray"); + Tooltip.SetDefault("Disintegrates everything with a tri-beam of energy and lasers\n" + + "Right click to fire a Y-shaped beam of destructive energy and a spread of lasers"); + } - public override void SetDefaults() - { - item.damage = 280; - item.magic = true; - item.mana = 5; - item.width = 84; - item.height = 74; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; + public override void SetDefaults() + { + item.damage = 280; + item.magic = true; + item.mana = 5; + item.width = 84; + item.height = 74; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("ParticleBeamofDoom"); - item.Calamity().postMoonLordRarity = 14; - } + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("ParticleBeamofDoom"); + item.Calamity().postMoonLordRarity = 14; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigBeamofDeath"), (int)((double)damage * 2.1), knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 80f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); - int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, 440, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[laser].timeLeft = 120; - Main.projectile[laser].tileCollide = false; - } - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigBeamofDeath"), (int)((double)damage * 2.1), knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 80f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); + int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, 440, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[laser].timeLeft = 120; + Main.projectile[laser].tileCollide = false; + } + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); recipe.AddIngredient(null, "DarksunFragment", 15); recipe.AddIngredient(null, "Wingman", 2); - recipe.AddIngredient(null, "Genisis"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddIngredient(null, "Genisis"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AnarchyBlade.cs b/Items/Weapons/AnarchyBlade.cs index 60dd7ff932..929eb5ac10 100644 --- a/Items/Weapons/AnarchyBlade.cs +++ b/Items/Weapons/AnarchyBlade.cs @@ -1,82 +1,82 @@ +using CalamityMod.CalPlayer; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons { public class AnarchyBlade : ModItem - { - private static int BaseDamage = 110; + { + private static int BaseDamage = 110; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Anarchy Blade"); - Tooltip.SetDefault("The lower your life the more damage this blade does\n" + - "Your hits will generate a large explosion\n" + - "If you're below 50% life your hits have a chance to instantly kill regular enemies"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anarchy Blade"); + Tooltip.SetDefault("The lower your life the more damage this blade does\n" + + "Your hits will generate a large explosion\n" + + "If you're below 50% life your hits have a chance to instantly kill regular enemies"); + } - public override void SetDefaults() - { - item.width = 98; - item.damage = BaseDamage; - item.melee = true; - item.useAnimation = 19; - item.useTime = 19; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 98; + public override void SetDefaults() + { + item.width = 98; + item.damage = BaseDamage; + item.melee = true; + item.useAnimation = 19; + item.useTime = 19; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 98; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddIngredient(null, "CoreofChaos", 3); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddIngredient(null, "CoreofChaos", 3); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); + } + } - // Gains 10% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.1f * player.meleeDamage; - } + // Gains 10% of missing health as base damage. + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + flat += lifeAmount * 0.1f * player.meleeDamage; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimstoneBoom"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimstoneBoom"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.NextBool(5)) - { - if (!CalamityPlayer.areThereAnyDamnBosses && CalamityGlobalNPC.ShouldAffectNPC(target)) - { - target.life = 0; - target.HitEffect(0, 10.0); - target.active = false; - target.NPCLoot(); - } - } - } - } + if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.NextBool(5)) + { + if (!CalamityPlayer.areThereAnyDamnBosses && CalamityGlobalNPC.ShouldAffectNPC(target)) + { + target.life = 0; + target.HitEffect(0, 10.0); + target.active = false; + target.NPCLoot(); + } + } + } + } } diff --git a/Items/Weapons/AncientCrusher.cs b/Items/Weapons/AncientCrusher.cs index 6d50a7de2b..2de7970252 100644 --- a/Items/Weapons/AncientCrusher.cs +++ b/Items/Weapons/AncientCrusher.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AncientCrusher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Crusher"); - Tooltip.SetDefault("Summons fossil spikes on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Crusher"); + Tooltip.SetDefault("Summons fossil spikes on enemy hits"); + } - public override void SetDefaults() - { - item.width = 62; - item.damage = 55; - item.melee = true; - item.useAnimation = 30; - item.useStyle = 1; - item.useTime = 30; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; + public override void SetDefaults() + { + item.width = 62; + item.damage = 55; + item.melee = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Amber, 8); - recipe.AddIngredient(ItemID.FossilOre, 35); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Amber, 8); + recipe.AddIngredient(ItemID.FossilOre, 35); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FossilSpike"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FossilSpike"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } } diff --git a/Items/Weapons/AncientIceChunk.cs b/Items/Weapons/AncientIceChunk.cs index 66a53001fa..7cea7a9a88 100644 --- a/Items/Weapons/AncientIceChunk.cs +++ b/Items/Weapons/AncientIceChunk.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/AncientShiv.cs b/Items/Weapons/AncientShiv.cs index f9a72e8043..f5564c8408 100644 --- a/Items/Weapons/AncientShiv.cs +++ b/Items/Weapons/AncientShiv.cs @@ -6,45 +6,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AncientShiv : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Shiv"); - Tooltip.SetDefault("Enemies release a blue aura cloud on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Shiv"); + Tooltip.SetDefault("Enemies release a blue aura cloud on death"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 30; - item.height = 30; - item.damage = 35; - item.melee = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 12; + item.useTime = 12; + item.width = 30; + item.height = 30; + item.damage = 35; + item.melee = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 15); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 15); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BlueAura"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BlueAura"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } } diff --git a/Items/Weapons/Animosity.cs b/Items/Weapons/Animosity.cs index 629ef5b0e9..de8d2b4257 100644 --- a/Items/Weapons/Animosity.cs +++ b/Items/Weapons/Animosity.cs @@ -5,89 +5,89 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class Animosity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Animosity"); - Tooltip.SetDefault(@"50% chance to not consume ammo + public class Animosity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Animosity"); + Tooltip.SetDefault(@"50% chance to not consume ammo Fires a powerful sniper round Right click to fire a burst of bullets"); - } + } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 70; - item.height = 18; - item.useTime = 4; - item.reuseDelay = 15; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 70; + item.height = 18; + item.useTime = 4; + item.reuseDelay = 15; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 11f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 11f; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 4; - item.reuseDelay = 13; - item.useAnimation = 12; - item.UseSound = SoundID.Item31; - item.shootSpeed = 10f; - } - else - { - item.useTime = 35; - item.reuseDelay = 0; - item.useAnimation = 35; - item.UseSound = SoundID.Item40; - item.shootSpeed = 15f; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 4; + item.reuseDelay = 13; + item.useAnimation = 12; + item.UseSound = SoundID.Item31; + item.shootSpeed = 10f; + } + else + { + item.useTime = 35; + item.reuseDelay = 0; + item.useAnimation = 35; + item.UseSound = SoundID.Item40; + item.shootSpeed = 15f; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - float SpeedX = speedX + (float) Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockBack, player.whoAmI, 0f, 0f); + return false; + } + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + } } diff --git a/Items/Weapons/Animus.cs b/Items/Weapons/Animus.cs index b72936035b..bea6186009 100644 --- a/Items/Weapons/Animus.cs +++ b/Items/Weapons/Animus.cs @@ -5,69 +5,69 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Animus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Animus"); - Tooltip.SetDefault("Randomizes its damage on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Animus"); + Tooltip.SetDefault("Randomizes its damage on enemy hits"); + } - public override void SetDefaults() - { - item.width = 84; - item.damage = 4000; - item.melee = true; - item.useAnimation = 11; - item.useStyle = 1; - item.useTime = 11; - item.useTurn = true; - item.knockBack = 20f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 90; + public override void SetDefaults() + { + item.width = 84; + item.damage = 4000; + item.melee = true; + item.useAnimation = 11; + item.useStyle = 1; + item.useTime = 11; + item.useTurn = true; + item.knockBack = 20f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 90; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BladeofEnmity"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BladeofEnmity"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 6000); - int damageRan = Main.rand.Next(195); //0 to 195 - if (damageRan >= 50 && damageRan <= 99) //25% - { - item.damage = 6000; - } - else if (damageRan >= 100 && damageRan <= 139) //20% - { - item.damage = 9000; - } - else if (damageRan >= 140 && damageRan <= 169) //15% - { - item.damage = 15000; - } - else if (damageRan >= 170 && damageRan <= 189) //10% - { - item.damage = 30000; - } - else if (damageRan >= 190 && damageRan <= 194) //5% - { - item.damage = 50000; - } - else - { - item.damage = 4000; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 6000); + int damageRan = Main.rand.Next(195); //0 to 195 + if (damageRan >= 50 && damageRan <= 99) //25% + { + item.damage = 6000; + } + else if (damageRan >= 100 && damageRan <= 139) //20% + { + item.damage = 9000; + } + else if (damageRan >= 140 && damageRan <= 169) //15% + { + item.damage = 15000; + } + else if (damageRan >= 170 && damageRan <= 189) //10% + { + item.damage = 30000; + } + else if (damageRan >= 190 && damageRan <= 194) //5% + { + item.damage = 50000; + } + else + { + item.damage = 4000; + } + } + } } diff --git a/Items/Weapons/ApoctosisArray.cs b/Items/Weapons/ApoctosisArray.cs index 17be2d8edf..f53064508d 100644 --- a/Items/Weapons/ApoctosisArray.cs +++ b/Items/Weapons/ApoctosisArray.cs @@ -6,57 +6,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ApoctosisArray : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Apoctosis Array"); - Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + - "The higher your mana the more damage they will do"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apoctosis Array"); + Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + + "The higher your mana the more damage they will do"); + } - public override void SetDefaults() - { - item.width = 98; - item.damage = 58; - item.magic = true; - item.mana = 12; - item.useAnimation = 7; - item.useTime = 7; - item.useStyle = 5; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.height = 34; + public override void SetDefaults() + { + item.width = 98; + item.damage = 58; + item.magic = true; + item.mana = 12; + item.useAnimation = 7; + item.useTime = 7; + item.useStyle = 5; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item91; + item.autoReuse = true; + item.noMelee = true; + item.height = 34; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("IonBlast"); - item.shootSpeed = 8f; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 8f; + item.Calamity().postMoonLordRarity = 12; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float manaAmount = ((float)player.statMana * 0.01f); - float damageMult = manaAmount; - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].scale = (manaAmount * 0.375f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float manaAmount = ((float)player.statMana * 0.01f); + float damageMult = manaAmount; + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].scale = (manaAmount * 0.375f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IonBlaster"); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IonBlaster"); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Apotheosis.cs b/Items/Weapons/Apotheosis.cs index aaf60f5c47..de6b1a01d3 100644 --- a/Items/Weapons/Apotheosis.cs +++ b/Items/Weapons/Apotheosis.cs @@ -1,49 +1,49 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons { public class Apotheosis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Apotheosis"); - Tooltip.SetDefault("Unleashes interdimensional projection magic\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apotheosis"); + Tooltip.SetDefault("Unleashes interdimensional projection magic\n" + "Eat worms"); - } + } - public override void SetDefaults() - { - item.damage = 366; - item.magic = true; - item.mana = 42; - item.width = 30; - item.height = 34; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 366; + item.magic = true; + item.mana = 42; + item.width = 30; + item.height = 34; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ApothMark"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("ApothMark"); item.shootSpeed = 15; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(15f, 15f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/ApotheosisGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(15f, 15f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/ApotheosisGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SubsumingVortex"); @@ -60,5 +60,5 @@ namespace CalamityMod.Items.Weapons recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Weapons/AquaticDissolution.cs b/Items/Weapons/AquaticDissolution.cs index fd04db1ea4..73c30e7ca4 100644 --- a/Items/Weapons/AquaticDissolution.cs +++ b/Items/Weapons/AquaticDissolution.cs @@ -6,64 +6,64 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AquaticDissolution : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Dissolution"); - Tooltip.SetDefault("Fires aquatic jets from the sky that bounce off tiles"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Dissolution"); + Tooltip.SetDefault("Fires aquatic jets from the sky that bounce off tiles"); + } - public override void SetDefaults() - { - item.width = 50; - item.damage = 200; - item.melee = true; - item.useAnimation = 16; - item.useTime = 16; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 72; + public override void SetDefaults() + { + item.width = 50; + item.damage = 200; + item.melee = true; + item.useAnimation = 16; + item.useTime = 16; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 72; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("OceanBeam"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - position = Main.MouseWorld; - for (int x = 0; x < 3; x++) + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + position = Main.MouseWorld; + for (int x = 0; x < 3; x++) { Projectile.NewProjectile(position.X + (float)Main.rand.Next(-30, 31), position.Y - 600f, 0f, 8f, type, damage, knockBack, Main.myPlayer, 0f, 0f); } return false; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Mariana"); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "BarofLife", 2); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Mariana"); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "BarofLife", 2); recipe.AddIngredient(null, "Lumenite", 20); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 33, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 33, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } + } } diff --git a/Items/Weapons/AquaticScourge/Barinautical.cs b/Items/Weapons/AquaticScourge/Barinautical.cs index be66270cdb..3fa2add429 100644 --- a/Items/Weapons/AquaticScourge/Barinautical.cs +++ b/Items/Weapons/AquaticScourge/Barinautical.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AquaticScourge { public class Barinautical : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Barinautical"); - Tooltip.SetDefault("Shoots a string of electric bolt arrows that explode"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Barinautical"); + Tooltip.SetDefault("Shoots a string of electric bolt arrows that explode"); + } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 30; - item.height = 42; - item.useTime = 2; - item.reuseDelay = 15; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 15f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 30; + item.height = 42; + item.useTime = 2; + item.reuseDelay = 15; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 15f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/AquaticScourge/DeepseaStaff.cs b/Items/Weapons/AquaticScourge/DeepseaStaff.cs index 21d84f894e..45d6e1fede 100644 --- a/Items/Weapons/AquaticScourge/DeepseaStaff.cs +++ b/Items/Weapons/AquaticScourge/DeepseaStaff.cs @@ -6,57 +6,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AquaticScourge { public class DeepseaStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deepsea Staff"); - Tooltip.SetDefault("Summons an aquatic star to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deepsea Staff"); + Tooltip.SetDefault("Summons an aquatic star to fight for you"); + } - public override void SetDefaults() - { - item.damage = 48; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 48; + item.mana = 10; + item.width = 46; + item.height = 46; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AquaticStar"); - item.shootSpeed = 10f; - item.summon = true; - } + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AquaticStar"); + item.shootSpeed = 10f; + item.summon = true; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/AquaticScourge/Downpour.cs b/Items/Weapons/AquaticScourge/Downpour.cs index d8442166a3..9bcd55d953 100644 --- a/Items/Weapons/AquaticScourge/Downpour.cs +++ b/Items/Weapons/AquaticScourge/Downpour.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AquaticScourge { public class Downpour : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Downpour"); - Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Downpour"); + Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 43; - item.magic = true; - item.mana = 10; - item.width = 42; - item.height = 42; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; + public override void SetDefaults() + { + item.damage = 43; + item.magic = true; + item.mana = 10; + item.width = 42; + item.height = 42; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WaterStream"); - item.shootSpeed = 14f; - } + item.UseSound = SoundID.Item13; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WaterStream"); + item.shootSpeed = 14f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/AquaticScourge/SubmarineShocker.cs b/Items/Weapons/AquaticScourge/SubmarineShocker.cs index cfb8b4a039..29a7441770 100644 --- a/Items/Weapons/AquaticScourge/SubmarineShocker.cs +++ b/Items/Weapons/AquaticScourge/SubmarineShocker.cs @@ -6,42 +6,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AquaticScourge { public class SubmarineShocker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Submarine Shocker"); - Tooltip.SetDefault("Enemies release electric sparks on hit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Submarine Shocker"); + Tooltip.SetDefault("Enemies release electric sparks on hit"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 32; - item.height = 32; - item.damage = 70; - item.melee = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 32; + item.height = 32; + item.damage = 70; + item.melee = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } } diff --git a/Items/Weapons/ArchAmaryllis.cs b/Items/Weapons/ArchAmaryllis.cs index a66376caa9..6f81bfd0c0 100644 --- a/Items/Weapons/ArchAmaryllis.cs +++ b/Items/Weapons/ArchAmaryllis.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ArchAmaryllis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arch Amaryllis"); - Tooltip.SetDefault("Casts a beaming bolt that explodes into smaller homing bolts"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arch Amaryllis"); + Tooltip.SetDefault("Casts a beaming bolt that explodes into smaller homing bolts"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 75; - item.magic = true; - item.mana = 10; - item.width = 66; - item.height = 68; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; + public override void SetDefaults() + { + item.damage = 75; + item.magic = true; + item.mana = 10; + item.width = 66; + item.height = 68; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BeamingBolt"); - item.shootSpeed = 20f; - } + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BeamingBolt"); + item.shootSpeed = 20f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GleamingMagnolia"); - recipe.AddIngredient(ItemID.FragmentNebula, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GleamingMagnolia"); + recipe.AddIngredient(ItemID.FragmentNebula, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ArcticArrow.cs b/Items/Weapons/ArcticArrow.cs index 6074a5df5a..d9b4a9236f 100644 --- a/Items/Weapons/ArcticArrow.cs +++ b/Items/Weapons/ArcticArrow.cs @@ -4,36 +4,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ArcticArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arctic Arrow"); - Tooltip.SetDefault("Freezes enemies for a short time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Arrow"); + Tooltip.SetDefault("Freezes enemies for a short time"); + } - public override void SetDefaults() - { - item.damage = 16; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 1200; - item.rare = 3; - item.shoot = mod.ProjectileType("ArcticArrow"); - item.shootSpeed = 13f; - item.ammo = 40; - } + public override void SetDefaults() + { + item.damage = 16; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 1200; + item.rare = 3; + item.shoot = mod.ProjectileType("ArcticArrow"); + item.shootSpeed = 13f; + item.ammo = 40; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar"); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar"); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ArkoftheAncients.cs b/Items/Weapons/ArkoftheAncients.cs index 874b41e64b..6fbb6fe8db 100644 --- a/Items/Weapons/ArkoftheAncients.cs +++ b/Items/Weapons/ArkoftheAncients.cs @@ -1,150 +1,153 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class ArkoftheAncients : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ark of the Ancients"); - Tooltip.SetDefault("A heavenly blade forged to vanquish all evil"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ark of the Ancients"); + Tooltip.SetDefault("A heavenly blade forged to vanquish all evil"); + } - public override void SetDefaults() - { - item.width = 50; - item.damage = 92; - item.melee = true; - item.useAnimation = 22; - item.useTime = 22; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 12f; - } + public override void SetDefaults() + { + item.width = 50; + item.damage = 92; + item.melee = true; + item.useAnimation = 22; + item.useTime = 22; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 12f; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(2)) - { - case 0: type = mod.ProjectileType("EonBeam"); break; - case 1: type = 173; break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - float num72 = Main.rand.Next(18, 25); - damage = Main.rand.Next(40, 60); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 2; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage / 2, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Main.projectile[proj].Calamity().forceMelee = true; - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(2)) + { + case 0: + type = mod.ProjectileType("EonBeam"); + break; + case 1: + type = 173; + break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + float num72 = Main.rand.Next(18, 25); + damage = Main.rand.Next(40, 60); + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 2; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage / 2, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Main.projectile[proj].Calamity().forceMelee = true; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddIngredient(null, "EssenceofEleum", 3); - recipe.AddIngredient(ItemID.Starfury); - recipe.AddIngredient(ItemID.EnchantedSword); - recipe.AddIngredient(ItemID.Excalibur); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddIngredient(null, "EssenceofEleum", 3); - recipe.AddIngredient(ItemID.Starfury); - recipe.AddIngredient(ItemID.Arkhalis); - recipe.AddIngredient(ItemID.Excalibur); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddIngredient(null, "EssenceofEleum", 3); + recipe.AddIngredient(ItemID.Starfury); + recipe.AddIngredient(ItemID.EnchantedSword); + recipe.AddIngredient(ItemID.Excalibur); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddIngredient(null, "EssenceofEleum", 3); + recipe.AddIngredient(ItemID.Starfury); + recipe.AddIngredient(ItemID.Arkhalis); + recipe.AddIngredient(ItemID.Excalibur); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dustType = 15; - switch (Main.rand.Next(3)) - { - case 0: - dustType = 15; - break; - case 1: - dustType = 57; - break; - case 2: - dustType = 58; - break; - default: - break; - } - int dust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, dustType, (float)(player.direction * 2), 0f, 150, default, 1.3f); - Main.dust[dust].velocity *= 0.2f; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dustType = 15; + switch (Main.rand.Next(3)) + { + case 0: + dustType = 15; + break; + case 1: + dustType = 57; + break; + case 2: + dustType = 58; + break; + default: + break; + } + int dust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, dustType, (float)(player.direction * 2), 0f, 150, default, 1.3f); + Main.dust[dust].velocity *= 0.2f; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } + } } diff --git a/Items/Weapons/ArkoftheCosmos.cs b/Items/Weapons/ArkoftheCosmos.cs index 2c20c615c9..d0a58a2648 100644 --- a/Items/Weapons/ArkoftheCosmos.cs +++ b/Items/Weapons/ArkoftheCosmos.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,206 +7,214 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ArkoftheCosmos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ark of the Cosmos"); - Tooltip.SetDefault("Fires different homing projectiles based on what biome you're in\n" + - "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + - "Projectiles also change based on moon events"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ark of the Cosmos"); + Tooltip.SetDefault("Fires different homing projectiles based on what biome you're in\n" + + "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + + "Projectiles also change based on moon events"); + } - public override void SetDefaults() - { - item.width = 102; - item.damage = 680; - item.melee = true; - item.useAnimation = 15; - item.useTime = 15; - item.useTurn = true; - item.useStyle = 1; - item.crit += 15; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 102; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 28f; - item.Calamity().postMoonLordRarity = 15; - } + public override void SetDefaults() + { + item.width = 102; + item.damage = 680; + item.melee = true; + item.useAnimation = 15; + item.useTime = 15; + item.useTurn = true; + item.useStyle = 1; + item.crit += 15; + item.knockBack = 9.5f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 102; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 28f; + item.Calamity().postMoonLordRarity = 15; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(4)) - { - case 0: type = mod.ProjectileType("EonBeam"); break; - case 1: type = mod.ProjectileType("EonBeamV2"); break; - case 2: type = mod.ProjectileType("EonBeamV3"); break; - case 3: type = mod.ProjectileType("EonBeamV4"); break; - } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - Main.projectile[projectile].timeLeft = 160; - Main.projectile[projectile].tileCollide = false; - float num72 = Main.rand.Next(22, 30); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 4; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f; - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; - int projectileFire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Galaxia2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Main.projectile[projectileFire].timeLeft = 80; - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(4)) + { + case 0: + type = mod.ProjectileType("EonBeam"); + break; + case 1: + type = mod.ProjectileType("EonBeamV2"); + break; + case 2: + type = mod.ProjectileType("EonBeamV3"); + break; + case 3: + type = mod.ProjectileType("EonBeamV4"); + break; + } + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + Main.projectile[projectile].timeLeft = 160; + Main.projectile[projectile].tileCollide = false; + float num72 = Main.rand.Next(22, 30); + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 4; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f; + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; + int projectileFire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Galaxia2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Main.projectile[projectileFire].timeLeft = 80; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FourSeasonsGalaxia"); - recipe.AddIngredient(null, "ArkoftheElements"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FourSeasonsGalaxia"); + recipe.AddIngredient(null, "ArkoftheElements"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - player.AddBuff(BuffID.Thorns, 600); - } - else if (snow) - { - player.AddBuff(BuffID.Warmth, 600); - } - else if (beach) - { - player.AddBuff(BuffID.Wet, 600); - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - } - else if (dungeon) - { - player.AddBuff(BuffID.Dangersense, 600); - } - else if (desert) - { - player.AddBuff(BuffID.Endurance, 600); - } - else if (glow) - { - player.AddBuff(BuffID.Spelunker, 600); - } - else if (hell) - { - player.AddBuff(BuffID.Inferno, 600); - } - else if (holy) - { - player.AddBuff(BuffID.Heartreach, 600); - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - } - else - { - player.AddBuff(BuffID.DryadsWard, 600); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + player.AddBuff(BuffID.Thorns, 600); + } + else if (snow) + { + player.AddBuff(BuffID.Warmth, 600); + } + else if (beach) + { + player.AddBuff(BuffID.Wet, 600); + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + } + else if (dungeon) + { + player.AddBuff(BuffID.Dangersense, 600); + } + else if (desert) + { + player.AddBuff(BuffID.Endurance, 600); + } + else if (glow) + { + player.AddBuff(BuffID.Spelunker, 600); + } + else if (hell) + { + player.AddBuff(BuffID.Inferno, 600); + } + else if (holy) + { + player.AddBuff(BuffID.Heartreach, 600); + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + } + else + { + player.AddBuff(BuffID.DryadsWard, 600); + } + } + } } diff --git a/Items/Weapons/ArkoftheElements.cs b/Items/Weapons/ArkoftheElements.cs index ccd8e2f686..7b577253eb 100644 --- a/Items/Weapons/ArkoftheElements.cs +++ b/Items/Weapons/ArkoftheElements.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,116 +7,124 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ArkoftheElements : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ark of the Elements"); - Tooltip.SetDefault("A heavenly blade infused with the essence of Terraria"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ark of the Elements"); + Tooltip.SetDefault("A heavenly blade infused with the essence of Terraria"); + } - public override void SetDefaults() - { - item.width = 84; - item.damage = 126; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.crit += 10; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 84; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 16f; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 84; + item.damage = 126; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.crit += 10; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 84; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 16f; + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(4)) - { - case 0: type = mod.ProjectileType("EonBeam"); break; - case 1: type = mod.ProjectileType("EonBeamV2"); break; - case 2: type = mod.ProjectileType("EonBeamV3"); break; - case 3: type = mod.ProjectileType("EonBeamV4"); break; - } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - Main.projectile[projectile].timeLeft = 160; - Main.projectile[projectile].tileCollide = false; - float num72 = Main.rand.Next(22, 30); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 4; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f; - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("ElementBall"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(4)) + { + case 0: + type = mod.ProjectileType("EonBeam"); + break; + case 1: + type = mod.ProjectileType("EonBeamV2"); + break; + case 2: + type = mod.ProjectileType("EonBeamV3"); + break; + case 3: + type = mod.ProjectileType("EonBeamV4"); + break; + } + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + Main.projectile[projectile].timeLeft = 160; + Main.projectile[projectile].tileCollide = false; + float num72 = Main.rand.Next(22, 30); + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 4; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f; + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("ElementBall"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueArkoftheAncients"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "CoreofCalamity", 5); - recipe.AddIngredient(null, "BarofLife", 10); - recipe.AddIngredient(ItemID.LunarBar, 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueArkoftheAncients"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "CoreofCalamity", 5); + recipe.AddIngredient(null, "BarofLife", 10); + recipe.AddIngredient(ItemID.LunarBar, 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } } diff --git a/Items/Weapons/ArterialAssault.cs b/Items/Weapons/ArterialAssault.cs index 061bd257f0..8ddc9cb225 100644 --- a/Items/Weapons/ArterialAssault.cs +++ b/Items/Weapons/ArterialAssault.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Arterial Assault"); Tooltip.SetDefault("Fires a chain of arrows from the sky\n" + - "Wooden arrows are converted to bloodfire arrows"); + "Wooden arrows are converted to bloodfire arrows"); } public override void SetDefaults() @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("BloodfireArrow"); item.shootSpeed = 30f; item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void AddRecipes() { diff --git a/Items/Weapons/AsteroidStaff.cs b/Items/Weapons/AsteroidStaff.cs index 3bf2141bd5..e2c87cf76c 100644 --- a/Items/Weapons/AsteroidStaff.cs +++ b/Items/Weapons/AsteroidStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,94 +7,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AsteroidStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Asteroid Staff"); - Tooltip.SetDefault("Summons asteroids from the sky"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Asteroid Staff"); + Tooltip.SetDefault("Summons asteroids from the sky"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 180; - item.magic = true; - item.mana = 20; - item.width = 50; - item.height = 50; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.75f; + public override void SetDefaults() + { + item.damage = 180; + item.magic = true; + item.mana = 20; + item.width = 50; + item.height = 50; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.75f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Asteroid"); - item.shootSpeed = 20f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("Asteroid"); + item.shootSpeed = 20f; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteorStaff); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteorStaff); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num112 = 3; - for (int num113 = 0; num113 < num112; num113++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float num114 = num78; - float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, type, damage, knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num112 = 3; + for (int num113 = 0; num113 < num112; num113++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float num114 = num78; + float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, type, damage, knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + } + return false; + } + } } diff --git a/Items/Weapons/Astrageldon/Nebulash.cs b/Items/Weapons/Astrageldon/Nebulash.cs index 04568a16c1..027629ebfb 100644 --- a/Items/Weapons/Astrageldon/Nebulash.cs +++ b/Items/Weapons/Astrageldon/Nebulash.cs @@ -5,39 +5,39 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Astrageldon { public class Nebulash : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nebulash"); - Tooltip.SetDefault("Fires a whip sword that emits particle explosions on hit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebulash"); + Tooltip.SetDefault("Fires a whip sword that emits particle explosions on hit"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.damage = 54; + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 54; item.rare = 7; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useStyle = 5; - item.knockBack = 2f; - item.UseSound = SoundID.Item117; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.autoReuse = true; + item.melee = true; + item.useAnimation = 18; + item.useTime = 18; + item.useStyle = 5; + item.knockBack = 2f; + item.UseSound = SoundID.Item117; item.value = Item.buyPrice(0, 60, 0, 0); item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("Nebulash"); - } + item.shoot = mod.ProjectileType("Nebulash"); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; //0.5 - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; //0.5 + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); + return false; + } + } } diff --git a/Items/Weapons/Astral/AstralBlade.cs b/Items/Weapons/Astral/AstralBlade.cs index 11acf59a21..bece9214d6 100644 --- a/Items/Weapons/Astral/AstralBlade.cs +++ b/Items/Weapons/Astral/AstralBlade.cs @@ -39,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Astral recipe.AddRecipe(); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override void MeleeEffects(Player player, Rectangle hitbox) { for (int i = 0; i < 3; i++) { diff --git a/Items/Weapons/Astral/AstralBlaster.cs b/Items/Weapons/Astral/AstralBlaster.cs index 9ec2d6e27c..4d84050d73 100644 --- a/Items/Weapons/Astral/AstralBlaster.cs +++ b/Items/Weapons/Astral/AstralBlaster.cs @@ -1,61 +1,57 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Astral { public class AstralBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Blaster"); - Tooltip.SetDefault("Fires a homing astral round"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Blaster"); + Tooltip.SetDefault("Fires a homing astral round"); + } - public override void SetDefaults() - { - item.damage = 150; - item.crit += 25; - item.ranged = true; - item.width = 40; - item.height = 24; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; + public override void SetDefaults() + { + item.damage = 150; + item.crit += 25; + item.ranged = true; + item.width = 40; + item.height = 24; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = mod.ProjectileType("AstralRound"); - item.useAmmo = 97; - } + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 14f; + item.shoot = mod.ProjectileType("AstralRound"); + item.useAmmo = 97; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AstralRound"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AstralRound"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Astral/AstralPike.cs b/Items/Weapons/Astral/AstralPike.cs index bd618ab9c1..122603330c 100644 --- a/Items/Weapons/Astral/AstralPike.cs +++ b/Items/Weapons/Astral/AstralPike.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Pike"); - Tooltip.SetDefault("Summons astral star swarms on critical hits"); - } + Tooltip.SetDefault("Summons astral star swarms on critical hits"); + } public override void SetDefaults() { diff --git a/Items/Weapons/Astral/AstralRepeater.cs b/Items/Weapons/Astral/AstralRepeater.cs index 06347b0d32..12b0e860de 100644 --- a/Items/Weapons/Astral/AstralRepeater.cs +++ b/Items/Weapons/Astral/AstralRepeater.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Astral { public class AstralRepeater : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Bow"); - Tooltip.SetDefault("Fires a burst of three arrows"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Bow"); + Tooltip.SetDefault("Fires a burst of three arrows"); + } - public override void SetDefaults() - { - item.damage = 110; - item.crit += 25; - item.ranged = true; - item.width = 38; - item.height = 78; - item.useTime = 4; - item.reuseDelay = 15; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 110; + item.crit += 25; + item.ranged = true; + item.width = 38; + item.height = 78; + item.useTime = 4; + item.reuseDelay = 15; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 7); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Astral/AstralScythe.cs b/Items/Weapons/Astral/AstralScythe.cs index 519405d38f..b49e23dc32 100644 --- a/Items/Weapons/Astral/AstralScythe.cs +++ b/Items/Weapons/Astral/AstralScythe.cs @@ -5,35 +5,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Astral { public class AstralScythe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Scythe"); - Tooltip.SetDefault("Shoots a scythe ring that accelerates over time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Scythe"); + Tooltip.SetDefault("Shoots a scythe ring that accelerates over time"); + } - public override void SetDefaults() - { - item.width = 56; - item.height = 60; - item.damage = 95; - item.melee = true; - item.useTurn = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 6f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; + public override void SetDefaults() + { + item.width = 56; + item.height = 60; + item.damage = 95; + item.melee = true; + item.useTurn = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 6f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.shoot = mod.ProjectileType("AstralScytheProjectile"); - item.shootSpeed = 5f; - } + item.shootSpeed = 5f; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } + } } diff --git a/Items/Weapons/Astral/AstralStaff.cs b/Items/Weapons/Astral/AstralStaff.cs index 1731ba2d11..b2daa92943 100644 --- a/Items/Weapons/Astral/AstralStaff.cs +++ b/Items/Weapons/Astral/AstralStaff.cs @@ -6,43 +6,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Astral { public class AstralStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Staff"); - Tooltip.SetDefault("Summons a large crystal from the sky that has a large area of effect on impact."); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Staff"); + Tooltip.SetDefault("Summons a large crystal from the sky that has a large area of effect on impact."); Item.staff[item.type] = true; - } + } - public override void SetDefaults() - { - item.damage = 270; - item.crit += 15; - item.magic = true; - item.mana = 26; - item.width = 86; - item.height = 72; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 270; + item.crit += 15; + item.magic = true; + item.mana = 26; + item.width = 86; + item.height = 72; + item.useTime = 35; + item.useAnimation = 35; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstralCrystal"); - item.shootSpeed = 15f; - } + item.UseSound = SoundID.Item105; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstralCrystal"); + item.shootSpeed = 15f; + } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -56,6 +56,6 @@ namespace CalamityMod.Items.Weapons.Astral Main.projectile[p].ai[0] = targetPos.Y - 120; return false; - } - } + } + } } diff --git a/Items/Weapons/Astral/AstralachneaStaff.cs b/Items/Weapons/Astral/AstralachneaStaff.cs index c9fe021c8c..82bfa08f71 100644 --- a/Items/Weapons/Astral/AstralachneaStaff.cs +++ b/Items/Weapons/Astral/AstralachneaStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Astral/HivePod.cs b/Items/Weapons/Astral/HivePod.cs index 15ccb5700a..d2fdd4aa5b 100644 --- a/Items/Weapons/Astral/HivePod.cs +++ b/Items/Weapons/Astral/HivePod.cs @@ -6,31 +6,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Astral { public class HivePod : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Pod"); - Tooltip.SetDefault("Summons an astral hive to protect you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Pod"); + Tooltip.SetDefault("Summons an astral hive to protect you"); + } - public override void SetDefaults() - { - item.damage = 90; + public override void SetDefaults() + { + item.damage = 90; item.mana = 10; - item.summon = true; + item.summon = true; item.sentry = true; - item.width = 46; - item.height = 50; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 4f; + item.width = 46; + item.height = 50; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.UseSound = SoundID.Item78; - item.shoot = mod.ProjectileType("Hive"); - } + item.shoot = mod.ProjectileType("Hive"); + } public override bool AltFunctionUse(Player player) { @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Astral player.UpdateMaxTurrets(); } return false; - } + } public override bool UseItem(Player player) { diff --git a/Items/Weapons/Astral/StellarCannon.cs b/Items/Weapons/Astral/StellarCannon.cs index 221c8ca6df..e7b3409076 100644 --- a/Items/Weapons/Astral/StellarCannon.cs +++ b/Items/Weapons/Astral/StellarCannon.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Cannon"); - Tooltip.SetDefault("Launches an explosive astral crystal"); + Tooltip.SetDefault("Launches an explosive astral crystal"); } public override void SetDefaults() diff --git a/Items/Weapons/Astral/TitanArm.cs b/Items/Weapons/Astral/TitanArm.cs index 95d0ef1831..142ff9be2e 100644 --- a/Items/Weapons/Astral/TitanArm.cs +++ b/Items/Weapons/Astral/TitanArm.cs @@ -5,34 +5,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Astral { public class TitanArm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titan Arm"); - Tooltip.SetDefault("Slap Hand but better"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Arm"); + Tooltip.SetDefault("Slap Hand but better"); + } - public override void SetDefaults() - { - item.width = 46; - item.height = 58; - item.damage = 60; - item.crit += 96; //more knockback huehue - item.melee = true; - item.useTurn = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 9001f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + public override void SetDefaults() + { + item.width = 46; + item.height = 58; + item.damage = 60; + item.crit += 96; //more knockback huehue + item.melee = true; + item.useTurn = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 9001f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } + } } diff --git a/Items/Weapons/AstrealDefeat.cs b/Items/Weapons/AstrealDefeat.cs index 2dd3b0654b..85b482424e 100644 --- a/Items/Weapons/AstrealDefeat.cs +++ b/Items/Weapons/AstrealDefeat.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,66 +7,66 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AstrealDefeat : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astreal Defeat"); - Tooltip.SetDefault("Fires Astreal Arrows that emit flames as they travel\n" + - "Ethereal bow of the tyrant king's mother\n" + - "The mother strongly discouraged acts of violence throughout her life\n" + - "Though she kept this bow close to protect her family in times of great disaster"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astreal Defeat"); + Tooltip.SetDefault("Fires Astreal Arrows that emit flames as they travel\n" + + "Ethereal bow of the tyrant king's mother\n" + + "The mother strongly discouraged acts of violence throughout her life\n" + + "Though she kept this bow close to protect her family in times of great disaster"); + } - public override void SetDefaults() - { - item.damage = 160; - item.ranged = true; - item.width = 44; - item.height = 54; - item.useTime = 3; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 160; + item.ranged = true; + item.width = 44; + item.height = 54; + item.useTime = 3; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstrealArrow"); - item.shootSpeed = 1f; - item.useAmmo = 40; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstrealArrow"); + item.shootSpeed = 1f; + item.useAmmo = 40; + } public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 200); - } - } - } + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 200); + } + } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AstrealArrow"), (int)((double)damage), knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AstrealArrow"), (int)((double)damage), knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpiritFlame); - recipe.AddIngredient(ItemID.ShadowFlameBow); - recipe.AddIngredient(null, "GreatbowofTurmoil"); - recipe.AddIngredient(null, "BladedgeGreatbow"); - recipe.AddIngredient(null, "DarkechoGreatbow"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpiritFlame); + recipe.AddIngredient(ItemID.ShadowFlameBow); + recipe.AddIngredient(null, "GreatbowofTurmoil"); + recipe.AddIngredient(null, "BladedgeGreatbow"); + recipe.AddIngredient(null, "DarkechoGreatbow"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/AstrumDeus/Starfall.cs b/Items/Weapons/AstrumDeus/Starfall.cs index e5eb9f46b3..290e3e8535 100644 --- a/Items/Weapons/AstrumDeus/Starfall.cs +++ b/Items/Weapons/AstrumDeus/Starfall.cs @@ -6,36 +6,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.AstrumDeus { public class Starfall : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starfall"); - Tooltip.SetDefault("Casts a spread of astral stars at the mouse cursor"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starfall"); + Tooltip.SetDefault("Casts a spread of astral stars at the mouse cursor"); + } - public override void SetDefaults() - { - item.damage = 59; + public override void SetDefaults() + { + item.damage = 59; item.crit += 25; item.magic = true; - item.mana = 15; + item.mana = 15; item.rare = 9; - item.width = 28; - item.height = 30; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; + item.width = 28; + item.height = 30; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; item.value = Item.buyPrice(0, 95, 0, 0); item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstralStarMagic"); - item.shootSpeed = 12f; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstralStarMagic"); + item.shootSpeed = 12f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; @@ -61,6 +61,6 @@ namespace CalamityMod.Items.Weapons.AstrumDeus int star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; - } - } + } + } } diff --git a/Items/Weapons/AuguroftheElements.cs b/Items/Weapons/AuguroftheElements.cs index 401444dc63..616fe2b4f8 100644 --- a/Items/Weapons/AuguroftheElements.cs +++ b/Items/Weapons/AuguroftheElements.cs @@ -6,73 +6,73 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class AuguroftheElements : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Augur of the Elements"); - Tooltip.SetDefault("Casts a burst of elemental tentacles to spear your enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Augur of the Elements"); + Tooltip.SetDefault("Casts a burst of elemental tentacles to spear your enemies"); + } - public override void SetDefaults() - { - item.damage = 180; - item.magic = true; - item.mana = 6; - item.width = 28; - item.crit = 3; - item.height = 30; - item.useTime = 2; - item.reuseDelay = 5; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 180; + item.magic = true; + item.mana = 6; + item.width = 28; + item.crit = 3; + item.height = 30; + item.useTime = 2; + item.reuseDelay = 5; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementTentacle"); - item.shootSpeed = 30f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementTentacle"); + item.shootSpeed = 30f; + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EldritchTome"); - recipe.AddIngredient(null, "TomeofFates"); - recipe.AddIngredient(ItemID.ShadowFlameHexDoll); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EldritchTome"); + recipe.AddIngredient(null, "TomeofFates"); + recipe.AddIngredient(ItemID.ShadowFlameHexDoll); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - Vector2 value2 = new Vector2(num78, num79); - value2.Normalize(); - Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value3.Normalize(); - value2 = value2 * 6f + value3; - value2.Normalize(); - value2 *= item.shootSpeed; - float num91 = (float)Main.rand.Next(10, 50) * 0.001f; - if (Main.rand.NextBool(2)) - { - num91 *= -1f; - } - float num92 = (float)Main.rand.Next(10, 50) * 0.001f; - if (Main.rand.NextBool(2)) - { - num92 *= -1f; - } - Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, type, damage, knockBack, player.whoAmI, num92, num91); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + Vector2 value2 = new Vector2(num78, num79); + value2.Normalize(); + Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value3.Normalize(); + value2 = value2 * 6f + value3; + value2.Normalize(); + value2 *= item.shootSpeed; + float num91 = (float)Main.rand.Next(10, 50) * 0.001f; + if (Main.rand.NextBool(2)) + { + num91 *= -1f; + } + float num92 = (float)Main.rand.Next(10, 50) * 0.001f; + if (Main.rand.NextBool(2)) + { + num92 *= -1f; + } + Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, type, damage, knockBack, player.whoAmI, num92, num91); + return false; + } + } } diff --git a/Items/Weapons/Azathoth.cs b/Items/Weapons/Azathoth.cs index d96b5080a2..6ae10091c8 100644 --- a/Items/Weapons/Azathoth.cs +++ b/Items/Weapons/Azathoth.cs @@ -5,40 +5,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Azathoth : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Azathoth"); - Tooltip.SetDefault("Destroy the universe in the blink of an eye\n" + - "Fires cosmic orbs that blast nearby enemies with lasers"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Azathoth"); + Tooltip.SetDefault("Destroy the universe in the blink of an eye\n" + + "Fires cosmic orbs that blast nearby enemies with lasers"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Kraken); - item.damage = 200; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AzathothProjectile"); - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Kraken); + item.damage = 200; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AzathothProjectile"); + item.Calamity().postMoonLordRarity = 16; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Terrarian); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Terrarian); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/BalefulHarvester.cs b/Items/Weapons/BalefulHarvester.cs index ab96ed7236..5f052dba9e 100644 --- a/Items/Weapons/BalefulHarvester.cs +++ b/Items/Weapons/BalefulHarvester.cs @@ -1,54 +1,52 @@ -using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class BalefulHarvester : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Baleful Harvester"); - Tooltip.SetDefault("Shoots skulls that split into homing fire orbs on enemy hits\n" + - "Summons flaming pumpkins on enemy hits"); - } + public class BalefulHarvester : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baleful Harvester"); + Tooltip.SetDefault("Shoots skulls that split into homing fire orbs on enemy hits\n" + + "Summons flaming pumpkins on enemy hits"); + } - public override void SetDefaults() - { - item.damage = 160; - item.width = 66; - item.height = 66; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("BalefulHarvesterProjectile"); - item.shootSpeed = 6f; - } + public override void SetDefaults() + { + item.damage = 160; + item.width = 66; + item.height = 66; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("BalefulHarvesterProjectile"); + item.shootSpeed = 6f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TheHorsemansBlade); - recipe.AddIngredient(ItemID.BookofSkulls); - recipe.AddIngredient(ItemID.FragmentSolar, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TheHorsemansBlade); + recipe.AddIngredient(ItemID.BookofSkulls); + recipe.AddIngredient(ItemID.FragmentSolar, 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * player.meleeDamage * 1.5f), knockback, false); - target.AddBuff(BuffID.OnFire, 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * player.meleeDamage * 1.5f), knockback, false); + target.AddBuff(BuffID.OnFire, 300); + } + } } diff --git a/Items/Weapons/BarracudaGun.cs b/Items/Weapons/BarracudaGun.cs index 6d7565b43d..562b3f91ec 100644 --- a/Items/Weapons/BarracudaGun.cs +++ b/Items/Weapons/BarracudaGun.cs @@ -6,64 +6,64 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BarracudaGun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Barracuda Gun"); - Tooltip.SetDefault("Fires two barracudas that latch onto enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Barracuda Gun"); + Tooltip.SetDefault("Fires two barracudas that latch onto enemies"); + } - public override void SetDefaults() - { - item.damage = 76; - item.channel = true; - item.ranged = true; - item.width = 54; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1f; + public override void SetDefaults() + { + item.damage = 76; + item.channel = true; + item.ranged = true; + item.width = 54; + item.height = 28; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 15f; - item.shoot = mod.ProjectileType("MechanicalBarracuda"); - } + item.UseSound = SoundID.Item10; + item.autoReuse = true; + item.shootSpeed = 15f; + item.shoot = mod.ProjectileType("MechanicalBarracuda"); + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(2, 3); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedA = speedX; + float SpeedB = speedY; + int num6 = Main.rand.Next(2, 3); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PiranhaGun); - recipe.AddIngredient(null, "CoreofCalamity", 2); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PiranhaGun); + recipe.AddIngredient(null, "CoreofCalamity", 2); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/BiomeBlade.cs b/Items/Weapons/BiomeBlade.cs index f8e6bb04ea..ff5f02a1ab 100644 --- a/Items/Weapons/BiomeBlade.cs +++ b/Items/Weapons/BiomeBlade.cs @@ -6,72 +6,72 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BiomeBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Biome Blade"); - Tooltip.SetDefault("Fires different projectiles based on what biome you're in"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Biome Blade"); + Tooltip.SetDefault("Fires different projectiles based on what biome you're in"); + } - public override void SetDefaults() - { - item.width = 42; - item.damage = 70; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 42; + public override void SetDefaults() + { + item.width = 42; + item.damage = 70; + item.melee = true; + item.useAnimation = 24; + item.useTime = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 42; item.value = Item.buyPrice(0, 12, 0, 0); item.rare = 4; - item.shoot = mod.ProjectileType("BiomeOrb"); - item.shootSpeed = 12f; - } + item.shoot = mod.ProjectileType("BiomeOrb"); + item.shootSpeed = 12f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WoodenSword); - recipe.AddIngredient(ItemID.DirtBlock, 10); - recipe.AddIngredient(ItemID.SandBlock, 10); - recipe.AddIngredient(ItemID.IceBlock, 10); - recipe.AddIngredient(ItemID.EbonstoneBlock, 10); - recipe.AddIngredient(ItemID.GlowingMushroom, 10); - recipe.AddIngredient(ItemID.Marble, 10); - recipe.AddIngredient(ItemID.Granite, 10); - recipe.AddIngredient(ItemID.Hellstone, 10); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddIngredient(ItemID.PearlstoneBlock, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WoodenSword); - recipe.AddIngredient(ItemID.DirtBlock, 10); - recipe.AddIngredient(ItemID.SandBlock, 10); - recipe.AddIngredient(ItemID.IceBlock, 10); - recipe.AddIngredient(ItemID.CrimstoneBlock, 10); - recipe.AddIngredient(ItemID.GlowingMushroom, 10); - recipe.AddIngredient(ItemID.Marble, 10); - recipe.AddIngredient(ItemID.Granite, 10); - recipe.AddIngredient(ItemID.Hellstone, 10); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddIngredient(ItemID.PearlstoneBlock, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WoodenSword); + recipe.AddIngredient(ItemID.DirtBlock, 10); + recipe.AddIngredient(ItemID.SandBlock, 10); + recipe.AddIngredient(ItemID.IceBlock, 10); + recipe.AddIngredient(ItemID.EbonstoneBlock, 10); + recipe.AddIngredient(ItemID.GlowingMushroom, 10); + recipe.AddIngredient(ItemID.Marble, 10); + recipe.AddIngredient(ItemID.Granite, 10); + recipe.AddIngredient(ItemID.Hellstone, 10); + recipe.AddIngredient(ItemID.Coral, 5); + recipe.AddIngredient(ItemID.PearlstoneBlock, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WoodenSword); + recipe.AddIngredient(ItemID.DirtBlock, 10); + recipe.AddIngredient(ItemID.SandBlock, 10); + recipe.AddIngredient(ItemID.IceBlock, 10); + recipe.AddIngredient(ItemID.CrimstoneBlock, 10); + recipe.AddIngredient(ItemID.GlowingMushroom, 10); + recipe.AddIngredient(ItemID.Marble, 10); + recipe.AddIngredient(ItemID.Granite, 10); + recipe.AddIngredient(ItemID.Hellstone, 10); + recipe.AddIngredient(ItemID.Coral, 5); + recipe.AddIngredient(ItemID.PearlstoneBlock, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 0); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 0); + } + } + } } diff --git a/Items/Weapons/BlackHawkRemote.cs b/Items/Weapons/BlackHawkRemote.cs index 7710aff092..b7afba66ea 100644 --- a/Items/Weapons/BlackHawkRemote.cs +++ b/Items/Weapons/BlackHawkRemote.cs @@ -30,33 +30,33 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("BlackHawkSummon"); item.shootSpeed = 10f; item.summon = true; - item.rare = 5; - } + item.rare = 5; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/BladecrestOathsword.cs b/Items/Weapons/BladecrestOathsword.cs index 6d9e008e06..a77398ac9c 100644 --- a/Items/Weapons/BladecrestOathsword.cs +++ b/Items/Weapons/BladecrestOathsword.cs @@ -5,35 +5,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BladecrestOathsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bladecrest Oathsword"); - Tooltip.SetDefault("Sword of an ancient demon lord\n" + - "Fires a blood scythe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bladecrest Oathsword"); + Tooltip.SetDefault("Sword of an ancient demon lord\n" + + "Fires a blood scythe"); + } - public override void SetDefaults() - { - item.width = 58; - item.damage = 25; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 58; + public override void SetDefaults() + { + item.width = 58; + item.damage = 25; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 58; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.shoot = mod.ProjectileType("BloodScythe"); - item.shootSpeed = 6f; - } + item.shoot = mod.ProjectileType("BloodScythe"); + item.shootSpeed = 6f; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 240); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 240); + } + } } diff --git a/Items/Weapons/BladedgeGreatbow.cs b/Items/Weapons/BladedgeGreatbow.cs index 172aefe7a0..14f9846da7 100644 --- a/Items/Weapons/BladedgeGreatbow.cs +++ b/Items/Weapons/BladedgeGreatbow.cs @@ -2,81 +2,80 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class BladedgeGreatbow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bladedge Railbow"); - Tooltip.SetDefault("Fires 4 arrows at once\n" + - "Fires 2 additional leafs"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bladedge Railbow"); + Tooltip.SetDefault("Fires 4 arrows at once\n" + + "Fires 2 additional leafs"); + } - public override void SetDefaults() - { - item.damage = 26; - item.ranged = true; - item.width = 74; - item.height = 24; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 26; + item.ranged = true; + item.width = 74; + item.height = 24; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 14f; - item.useAmmo = 40; - } + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 14f; + item.useAmmo = 40; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 4; i++) - { - float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 4; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[index].noDropItem = true; } - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 10f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage, 0f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].Calamity().forceRanged = true; - } - return false; - } + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 2; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 10f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage, 0f, player.whoAmI, 0f, 0f); + Main.projectile[projectile].Calamity().forceRanged = true; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/BladeofEnmity.cs b/Items/Weapons/BladeofEnmity.cs index a1cb11a8d3..cfc7236a8f 100644 --- a/Items/Weapons/BladeofEnmity.cs +++ b/Items/Weapons/BladeofEnmity.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BladeofEnmity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade of Enmity"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade of Enmity"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 158; - item.melee = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 68; + public override void SetDefaults() + { + item.width = 60; + item.damage = 158; + item.melee = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 68; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } } diff --git a/Items/Weapons/BloodfireArrow.cs b/Items/Weapons/BloodfireArrow.cs index 554e3f2893..3b29ead4e2 100644 --- a/Items/Weapons/BloodfireArrow.cs +++ b/Items/Weapons/BloodfireArrow.cs @@ -4,36 +4,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BloodfireArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodfire Arrow"); - Tooltip.SetDefault("Heals you a small amount on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodfire Arrow"); + Tooltip.SetDefault("Heals you a small amount on enemy hits"); + } - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.width = 14; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3.5f; - item.value = 2000; - item.shoot = mod.ProjectileType("BloodfireArrow"); - item.shootSpeed = 10f; - item.ammo = 40; - item.Calamity().postMoonLordRarity = 13; - } + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 14; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 3.5f; + item.value = 2000; + item.shoot = mod.ProjectileType("BloodfireArrow"); + item.shootSpeed = 10f; + item.ammo = 40; + item.Calamity().postMoonLordRarity = 13; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/BloodyEdge.cs b/Items/Weapons/BloodyEdge.cs index 87b83582e7..be9a79d13a 100644 --- a/Items/Weapons/BloodyEdge.cs +++ b/Items/Weapons/BloodyEdge.cs @@ -6,70 +6,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BloodyEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Edge"); - Tooltip.SetDefault("Chance to heal the player on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Edge"); + Tooltip.SetDefault("Chance to heal the player on enemy hits"); + } - public override void SetDefaults() - { - item.width = 46; - item.damage = 52; - item.melee = true; - item.useAnimation = 23; - item.useStyle = 1; - item.useTime = 23; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + public override void SetDefaults() + { + item.width = 46; + item.damage = 52; + item.melee = true; + item.useAnimation = 23; + item.useStyle = 1; + item.useTime = 23; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.useTurn = true; - item.height = 60; + item.height = 60; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LightsBane); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.Muramasa); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BloodButcherer); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.Muramasa); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LightsBane); + recipe.AddIngredient(ItemID.BladeofGrass); + recipe.AddIngredient(ItemID.Muramasa); + recipe.AddIngredient(ItemID.FieryGreatsword); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BloodButcherer); + recipe.AddIngredient(ItemID.BladeofGrass); + recipe.AddIngredient(ItemID.Muramasa); + recipe.AddIngredient(ItemID.FieryGreatsword); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - int healAmount = (Main.rand.Next(3) + 1); - if (Main.rand.NextBool(2)) - { - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + int healAmount = (Main.rand.Next(3) + 1); + if (Main.rand.NextBool(2)) + { + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + } } diff --git a/Items/Weapons/BlossomFlux.cs b/Items/Weapons/BlossomFlux.cs index 98e3769776..47716755f4 100644 --- a/Items/Weapons/BlossomFlux.cs +++ b/Items/Weapons/BlossomFlux.cs @@ -5,70 +5,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BlossomFlux : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blossom Flux"); - Tooltip.SetDefault("Legendary Drop\n" + - "Fires a stream of leaves\n" + - "Right click to fire a spore orb that explodes into a cloud of spore gas\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blossom Flux"); + Tooltip.SetDefault("Legendary Drop\n" + + "Fires a stream of leaves\n" + + "Right click to fire a spore orb that explodes into a cloud of spore gas\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.damage = 22; - item.ranged = true; - item.width = 40; - item.height = 62; - item.useTime = 4; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 0.15f; + public override void SetDefaults() + { + item.damage = 22; + item.ranged = true; + item.width = 40; + item.height = 62; + item.useTime = 4; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0.15f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LeafArrow"); - item.shootSpeed = 10f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 17; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("LeafArrow"); + item.shootSpeed = 10f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 17; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 25; - item.useAnimation = 25; - item.UseSound = SoundID.Item77; - } - else - { - item.useTime = 2; - item.useAnimation = 16; - item.UseSound = SoundID.Item5; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 25; + item.useAnimation = 25; + item.UseSound = SoundID.Item77; + } + else + { + item.useTime = 2; + item.useAnimation = 16; + item.UseSound = SoundID.Item5; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SporeBomb"), (int)((double)damage * 6.0), (knockBack * 60f), player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LeafArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SporeBomb"), (int)((double)damage * 6.0), (knockBack * 60f), player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LeafArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } diff --git a/Items/Weapons/BlushieStaff.cs b/Items/Weapons/BlushieStaff.cs index 17e36ad2dd..1e30a5aa23 100644 --- a/Items/Weapons/BlushieStaff.cs +++ b/Items/Weapons/BlushieStaff.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BlushieStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Staff of Blushie"); - Tooltip.SetDefault("Hold your mouse, wait, wait, wait, and put your trust in the power of blue magic"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Staff of Blushie"); + Tooltip.SetDefault("Hold your mouse, wait, wait, wait, and put your trust in the power of blue magic"); + } - public override void SetDefaults() - { - item.width = 38; - item.height = 38; - item.useStyle = 4; - item.useAnimation = 30; - item.useTime = 30; - item.channel = true; - item.noMelee = true; - item.damage = 1; - item.knockBack = 1f; - item.autoReuse = false; - item.useTurn = false; - item.magic = true; + public override void SetDefaults() + { + item.width = 38; + item.height = 38; + item.useStyle = 4; + item.useAnimation = 30; + item.useTime = 30; + item.channel = true; + item.noMelee = true; + item.damage = 1; + item.knockBack = 1f; + item.autoReuse = false; + item.useTurn = false; + item.magic = true; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.UseSound = SoundID.Item1; - item.shoot = mod.ProjectileType("BlushieStaffProj"); - item.mana = 200; - item.shootSpeed = 0f; - item.Calamity().postMoonLordRarity = 19; - } + item.shoot = mod.ProjectileType("BlushieStaffProj"); + item.mana = 200; + item.shootSpeed = 0f; + item.Calamity().postMoonLordRarity = 19; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddIngredient(null, "ShadowspecBar", 50); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddIngredient(null, "ShadowspecBar", 50); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Brimlash.cs b/Items/Weapons/Brimlash.cs index f6842c6594..b6ee2ab4d4 100644 --- a/Items/Weapons/Brimlash.cs +++ b/Items/Weapons/Brimlash.cs @@ -6,54 +6,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Brimlash : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlash"); - Tooltip.SetDefault("Fires a brimstone bolt that explodes into more bolts on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlash"); + Tooltip.SetDefault("Fires a brimstone bolt that explodes into more bolts on death"); + } - public override void SetDefaults() - { - item.width = 50; - item.damage = 64; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; + public override void SetDefaults() + { + item.width = 50; + item.damage = 64; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.shoot = mod.ProjectileType("Brimlash"); - item.shootSpeed = 15f; - } + item.shoot = mod.ProjectileType("Brimlash"); + item.shootSpeed = 15f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 4); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddIngredient(null, "LivingShard", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 4); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddIngredient(null, "LivingShard", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } } diff --git a/Items/Weapons/BrimlashBuster.cs b/Items/Weapons/BrimlashBuster.cs index 927779c41d..303c303e8f 100644 --- a/Items/Weapons/BrimlashBuster.cs +++ b/Items/Weapons/BrimlashBuster.cs @@ -6,63 +6,63 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BrimlashBuster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlash Buster"); - Tooltip.SetDefault("50% chance to do triple damage on enemy hits\n" + - "Fires a brimstone bolt that explodes into more bolts on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlash Buster"); + Tooltip.SetDefault("50% chance to do triple damage on enemy hits\n" + + "Fires a brimstone bolt that explodes into more bolts on death"); + } - public override void SetDefaults() - { - item.width = 68; - item.damage = 100; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 68; + public override void SetDefaults() + { + item.width = 68; + item.damage = 100; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 68; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.shoot = mod.ProjectileType("Brimlash"); - item.shootSpeed = 18f; - } + item.shoot = mod.ProjectileType("Brimlash"); + item.shootSpeed = 18f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Brimlash"); - recipe.AddIngredient(null, "CoreofChaos", 3); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Brimlash"); + recipe.AddIngredient(null, "CoreofChaos", 3); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (Main.rand.NextBool(3)) - { - item.damage = 378; - } - else - { - item.damage = 126; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + if (Main.rand.NextBool(3)) + { + item.damage = 378; + } + else + { + item.damage = 126; + } + } + } } diff --git a/Items/Weapons/BrimroseStaff.cs b/Items/Weapons/BrimroseStaff.cs index b7e5bfbeb7..289d653b99 100644 --- a/Items/Weapons/BrimroseStaff.cs +++ b/Items/Weapons/BrimroseStaff.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BrimroseStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimrose Staff"); - Tooltip.SetDefault("Fires a spread of brimstone beams"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimrose Staff"); + Tooltip.SetDefault("Fires a spread of brimstone beams"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 14; - item.width = 36; - item.height = 34; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 14; + item.width = 36; + item.height = 34; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBeam"); - item.shootSpeed = 6f; - } + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBeam"); + item.shootSpeed = 6f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/BrimstoneFury.cs b/Items/Weapons/BrimstoneFury.cs index a06677c95e..9d15a4a03d 100644 --- a/Items/Weapons/BrimstoneFury.cs +++ b/Items/Weapons/BrimstoneFury.cs @@ -6,52 +6,52 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BrimstoneFury : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fury"); - Tooltip.SetDefault("Fires a spread of brimstone bolts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fury"); + Tooltip.SetDefault("Fires a spread of brimstone bolts"); + } - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.width = 30; - item.height = 58; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBolt"); - item.shootSpeed = 13f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 30; + item.height = 58; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.75f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBolt"); + item.shootSpeed = 13f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(2); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBolt"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(2); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBolt"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs index b76b0155b7..ae257f5b9a 100644 --- a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs +++ b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs @@ -5,45 +5,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.BrimstoneWaifu { public class SeethingDischarge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seething Discharge"); - Tooltip.SetDefault("Fires a barrage of brimstone blasts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seething Discharge"); + Tooltip.SetDefault("Fires a barrage of brimstone blasts"); + } - public override void SetDefaults() - { - item.damage = 58; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 32; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.75f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); + public override void SetDefaults() + { + item.damage = 58; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 32; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.75f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SeethingDischargeBrimstoneBarrage"); - item.shootSpeed = 6f; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("SeethingDischargeBrimstoneBarrage"); + item.shootSpeed = 6f; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + 10f * 0.05f; - float SpeedY = speedY + 10f * 0.05f; - float SpeedX2 = speedX - 10f * 0.05f; - float SpeedY2 = speedY - 10f * 0.05f; - float SpeedX3 = speedX + 0f * 0.05f; - float SpeedY3 = speedY + 0f * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, mod.ProjectileType("SeethingDischargeBrimstoneHellblast"), damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + 10f * 0.05f; + float SpeedY = speedY + 10f * 0.05f; + float SpeedX2 = speedX - 10f * 0.05f; + float SpeedY2 = speedY - 10f * 0.05f; + float SpeedX3 = speedX + 0f * 0.05f; + float SpeedY3 = speedY + 0f * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, mod.ProjectileType("SeethingDischargeBrimstoneHellblast"), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/BrinyBaron.cs b/Items/Weapons/BrinyBaron.cs index e0f0be08c0..5e61b47e56 100644 --- a/Items/Weapons/BrinyBaron.cs +++ b/Items/Weapons/BrinyBaron.cs @@ -6,80 +6,80 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BrinyBaron : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Briny Baron"); - Tooltip.SetDefault("Legendary Drop\n" + - "Striking an enemy with the blade causes a briny typhoon to appear\n" + - "Right click to fire a razorwind aqua blade\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Briny Baron"); + Tooltip.SetDefault("Legendary Drop\n" + + "Striking an enemy with the blade causes a briny typhoon to appear\n" + + "Right click to fire a razorwind aqua blade\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.width = 62; - item.damage = 80; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; + public override void SetDefaults() + { + item.width = 62; + item.damage = 80; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; item.shootSpeed = 4f; item.Calamity().postMoonLordRarity = 17; - } + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 15; - item.useAnimation = 15; - item.UseSound = SoundID.Item84; + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 15; + item.useAnimation = 15; + item.UseSound = SoundID.Item84; item.shoot = mod.ProjectileType("Razorwind"); - } - else - { - item.noMelee = false; - item.noUseGraphic = false; - item.useTime = 20; - item.useAnimation = 20; - item.UseSound = SoundID.Item1; + } + else + { + item.noMelee = false; + item.noUseGraphic = false; + item.useTime = 20; + item.useAnimation = 20; + item.UseSound = SoundID.Item1; item.shoot = 0; - } - return base.CanUseItem(player); - } + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Razorwind"), damage, knockBack, player.whoAmI, 0f, 0f); + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Razorwind"), damage, knockBack, player.whoAmI, 0f, 0f); return false; - } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrinyTyphoonBubble"), (int)((float)item.damage * 0.5f * player.meleeDamage), knockback, player.whoAmI); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrinyTyphoonBubble"), (int)((float)item.damage * 0.5f * player.meleeDamage), knockback, player.whoAmI); + } + } } diff --git a/Items/Weapons/Bumblebirb/GildedProboscis.cs b/Items/Weapons/Bumblebirb/GildedProboscis.cs index 248d265b50..33202303b5 100644 --- a/Items/Weapons/Bumblebirb/GildedProboscis.cs +++ b/Items/Weapons/Bumblebirb/GildedProboscis.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Bumblebirb { DisplayName.SetDefault("Gilded Proboscis"); Tooltip.SetDefault("Ignores immunity frames\n" + - "Heals the player on hit"); + "Heals the player on hit"); } public override void SetDefaults() @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons.Bumblebirb item.rare = 10; item.shoot = mod.ProjectileType("GildedProboscis"); item.shootSpeed = 13f; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override bool CanUseItem(Player player) { diff --git a/Items/Weapons/Bumblebirb/GoldenEagle.cs b/Items/Weapons/Bumblebirb/GoldenEagle.cs index d382adba64..dea40fc04c 100644 --- a/Items/Weapons/Bumblebirb/GoldenEagle.cs +++ b/Items/Weapons/Bumblebirb/GoldenEagle.cs @@ -1,66 +1,62 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Bumblebirb { public class GoldenEagle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golden Eagle"); - Tooltip.SetDefault("Fires 5 bullets at once"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Golden Eagle"); + Tooltip.SetDefault("Fires 5 bullets at once"); + } - public override void SetDefaults() - { - item.damage = 36; - item.ranged = true; - item.noMelee = true; - item.width = 46; - item.height = 30; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.knockBack = 3f; + public override void SetDefaults() + { + item.damage = 36; + item.ranged = true; + item.noMelee = true; + item.width = 46; + item.height = 30; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.knockBack = 3f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 12; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + 5f * 0.05f; - float SpeedY = speedY + 5f * 0.05f; - float SpeedX2 = speedX - 5f * 0.05f; - float SpeedY2 = speedY - 5f * 0.05f; - float SpeedX3 = speedX + 0f * 0.05f; - float SpeedY3 = speedY + 0f * 0.05f; - float SpeedX4 = speedX - 10f * 0.05f; - float SpeedY4 = speedY - 10f * 0.05f; - float SpeedX5 = speedX + 10f * 0.05f; - float SpeedY5 = speedY + 10f * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX5, SpeedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + 5f * 0.05f; + float SpeedY = speedY + 5f * 0.05f; + float SpeedX2 = speedX - 5f * 0.05f; + float SpeedY2 = speedY - 5f * 0.05f; + float SpeedX3 = speedX + 0f * 0.05f; + float SpeedY3 = speedY + 0f * 0.05f; + float SpeedX4 = speedX - 10f * 0.05f; + float SpeedY4 = speedY - 10f * 0.05f; + float SpeedX5 = speedX + 10f * 0.05f; + float SpeedY5 = speedY + 10f * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX5, SpeedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/Bumblebirb/RougeSlash.cs b/Items/Weapons/Bumblebirb/RougeSlash.cs index 413f2449be..d99171181c 100644 --- a/Items/Weapons/Bumblebirb/RougeSlash.cs +++ b/Items/Weapons/Bumblebirb/RougeSlash.cs @@ -6,40 +6,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Bumblebirb { public class RougeSlash : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rouge Slash"); - Tooltip.SetDefault("Fires a wave of 3 rouge air slashes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rouge Slash"); + Tooltip.SetDefault("Fires a wave of 3 rouge air slashes"); + } - public override void SetDefaults() - { - item.damage = 90; - item.magic = true; - item.mana = 30; - item.width = 28; - item.height = 32; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item91; + public override void SetDefaults() + { + item.damage = 90; + item.magic = true; + item.mana = 30; + item.width = 28; + item.height = 32; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item91; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("RougeSlashLarge"); - item.shootSpeed = 24f; - item.Calamity().postMoonLordRarity = 12; - } + item.shoot = mod.ProjectileType("RougeSlashLarge"); + item.shootSpeed = 24f; + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("RougeSlashLarge"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, mod.ProjectileType("RougeSlashMedium"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, speedX * 0.6f, speedY * 0.6f, mod.ProjectileType("RougeSlashSmall"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("RougeSlashLarge"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, mod.ProjectileType("RougeSlashMedium"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.6f, speedY * 0.6f, mod.ProjectileType("RougeSlashSmall"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/BurningSea.cs b/Items/Weapons/BurningSea.cs index 3ae06988ef..32657011a5 100644 --- a/Items/Weapons/BurningSea.cs +++ b/Items/Weapons/BurningSea.cs @@ -5,40 +5,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BurningSea : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burning Sea"); - Tooltip.SetDefault("Fires a bouncing brimstone fireball that splits into homing fireballs upon collision with water"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burning Sea"); + Tooltip.SetDefault("Fires a bouncing brimstone fireball that splits into homing fireballs upon collision with water"); + } - public override void SetDefaults() - { - item.damage = 79; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; + public override void SetDefaults() + { + item.damage = 79; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneFireball"); - item.shootSpeed = 15f; - } + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneFireball"); + item.shootSpeed = 15f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/BurntSienna.cs b/Items/Weapons/BurntSienna.cs index 56e90874a7..1c43b35b54 100644 --- a/Items/Weapons/BurntSienna.cs +++ b/Items/Weapons/BurntSienna.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,49 +6,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class BurntSienna : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burnt Sienna"); - Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burnt Sienna"); + Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death"); + } - public override void SetDefaults() - { - item.width = 42; - item.damage = 35; - item.melee = true; - item.useAnimation = 21; - item.useTime = 21; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shootSpeed = 5f; - } + public override void SetDefaults() + { + item.width = 42; + item.damage = 35; + item.melee = true; + item.useAnimation = 21; + item.useTime = 21; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 54; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shootSpeed = 5f; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("BurntSienna"), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("BurntSienna"), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("BurntSienna"), 0, 0f, player.whoAmI); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + float randomSpeedX = (float)Main.rand.Next(3); + float randomSpeedY = (float)Main.rand.Next(3, 5); + Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("BurntSienna"), 0, 0f, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("BurntSienna"), 0, 0f, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("BurntSienna"), 0, 0f, player.whoAmI); + } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); + } + } + } } diff --git a/Items/Weapons/Butcher.cs b/Items/Weapons/Butcher.cs index 08d92eca56..9ed838f220 100644 --- a/Items/Weapons/Butcher.cs +++ b/Items/Weapons/Butcher.cs @@ -6,51 +6,51 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Butcher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Butcher"); - Tooltip.SetDefault("Fires faster and more accurately the longer you hold the trigger"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Butcher"); + Tooltip.SetDefault("Fires faster and more accurately the longer you hold the trigger"); + } - public override void SetDefaults() - { - item.damage = 17; - item.width = 20; - item.height = 12; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = 5; - item.rare = 5; - item.knockBack = 1f; + public override void SetDefaults() + { + item.damage = 17; + item.width = 20; + item.height = 12; + item.useTime = 40; + item.useAnimation = 40; + item.useStyle = 5; + item.rare = 5; + item.knockBack = 1f; item.value = Item.buyPrice(0, 36, 0, 0); item.UseSound = SoundID.Item38; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Butcher"); - item.shootSpeed = 12f; - item.useAmmo = 97; - } + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Butcher"); + item.shootSpeed = 12f; + item.useAmmo = 97; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Butcher"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Butcher"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(null, "EssenceofChaos", 4); - recipe.AddIngredient(null, "EssenceofEleum", 4); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Shotgun); + recipe.AddIngredient(null, "EssenceofChaos", 4); + recipe.AddIngredient(null, "EssenceofEleum", 4); + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Calamitas/BlightedEyeStaff.cs b/Items/Weapons/Calamitas/BlightedEyeStaff.cs index e11cbf749d..859dd2d683 100644 --- a/Items/Weapons/Calamitas/BlightedEyeStaff.cs +++ b/Items/Weapons/Calamitas/BlightedEyeStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs b/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs index bd02574255..a2aa290060 100644 --- a/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs +++ b/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs @@ -5,31 +5,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Calamitas { public class BrimstoneFlameblaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Flameblaster"); - Tooltip.SetDefault("Fires bouncing brimstone fireballs"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Flameblaster"); + Tooltip.SetDefault("Fires bouncing brimstone fireballs"); + } - public override void SetDefaults() - { - item.damage = 64; - item.ranged = true; - item.width = 50; - item.height = 18; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 64; + item.ranged = true; + item.width = 50; + item.height = 18; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBallFriendly"); - item.shootSpeed = 10f; - item.useAmmo = 23; - } - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBallFriendly"); + item.shootSpeed = 10f; + item.useAmmo = 23; + } + } } diff --git a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs index 9ceab49cc6..80462822b4 100644 --- a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs +++ b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs @@ -5,30 +5,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Calamitas { public class BrimstoneFlamesprayer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Havoc's Breath"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Havoc's Breath"); + } - public override void SetDefaults() - { - item.damage = 59; - item.ranged = true; - item.width = 50; - item.height = 18; - item.useTime = 9; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 59; + item.ranged = true; + item.width = 50; + item.height = 18; + item.useTime = 9; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneFireFriendly"); - item.shootSpeed = 8.5f; - item.useAmmo = 23; - } - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneFireFriendly"); + item.shootSpeed = 8.5f; + item.useAmmo = 23; + } + } } diff --git a/Items/Weapons/CarnageRay.cs b/Items/Weapons/CarnageRay.cs index 28c9fcd7bc..12117862ce 100644 --- a/Items/Weapons/CarnageRay.cs +++ b/Items/Weapons/CarnageRay.cs @@ -5,46 +5,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CarnageRay : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Carnage Ray"); - Tooltip.SetDefault("Fires a blood ray that splits if enemies are near it"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Carnage Ray"); + Tooltip.SetDefault("Fires a blood ray that splits if enemies are near it"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 24; - item.magic = true; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; + public override void SetDefaults() + { + item.damage = 24; + item.magic = true; + item.mana = 10; + item.width = 46; + item.height = 46; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; item.value = Item.buyPrice(0, 12, 0, 0); item.rare = 4; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodRay"); - item.shootSpeed = 6f; - } + item.UseSound = SoundID.Item72; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodRay"); + item.shootSpeed = 6f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(ItemID.CrimsonRod); - recipe.AddIngredient(ItemID.AmberStaff); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(null, "BloodSample", 15); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WandofSparking); + recipe.AddIngredient(ItemID.CrimsonRod); + recipe.AddIngredient(ItemID.AmberStaff); + recipe.AddIngredient(ItemID.MagicMissile); + recipe.AddIngredient(null, "BloodSample", 15); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/CatastropheClaymore.cs b/Items/Weapons/CatastropheClaymore.cs index ba28a65dab..56509fac72 100644 --- a/Items/Weapons/CatastropheClaymore.cs +++ b/Items/Weapons/CatastropheClaymore.cs @@ -6,87 +6,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CatastropheClaymore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe Claymore"); - Tooltip.SetDefault("Fires explosive energy bolts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe Claymore"); + Tooltip.SetDefault("Fires explosive energy bolts"); + } - public override void SetDefaults() - { - item.width = 56; - item.damage = 67; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("CalamityAura"); - item.shootSpeed = 11f; - } + public override void SetDefaults() + { + item.width = 56; + item.damage = 67; + item.melee = true; + item.useAnimation = 23; + item.useTime = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 56; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("CalamityAura"); + item.shootSpeed = 11f; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("CalamityAura"); break; - case 1: type = mod.ProjectileType("CalamityAuraType2"); break; - case 2: type = mod.ProjectileType("CalamityAuraType3"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(3)) + { + case 0: + type = mod.ProjectileType("CalamityAura"); + break; + case 1: + type = mod.ProjectileType("CalamityAuraType2"); + break; + case 2: + type = mod.ProjectileType("CalamityAuraType3"); + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.CursedFlame, 5); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.Ichor, 5); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(ItemID.CursedFlame, 5); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(ItemID.Ichor, 5); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 73); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 73); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(3)) - { - target.AddBuff(BuffID.Ichor, 120); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 180); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(3)) + { + target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 180); + } + } + } } diff --git a/Items/Weapons/CausticEdge.cs b/Items/Weapons/CausticEdge.cs index aa8523bdb5..13557c05a4 100644 --- a/Items/Weapons/CausticEdge.cs +++ b/Items/Weapons/CausticEdge.cs @@ -6,53 +6,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CausticEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Caustic Edge"); - Tooltip.SetDefault("Inflicts poison and venom on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Caustic Edge"); + Tooltip.SetDefault("Inflicts poison and venom on enemy hits"); + } - public override void SetDefaults() - { - item.width = 46; - item.damage = 44; - item.melee = true; + public override void SetDefaults() + { + item.width = 46; + item.damage = 44; + item.melee = true; item.useTurn = true; - item.useAnimation = 27; - item.useStyle = 1; - item.useTime = 27; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; + item.useAnimation = 27; + item.useStyle = 1; + item.useTime = 27; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.AddIngredient(ItemID.Deathweed, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BladeofGrass); + recipe.AddIngredient(ItemID.LavaBucket); + recipe.AddIngredient(ItemID.Deathweed, 5); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 74); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 74); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 480); - target.AddBuff(BuffID.Venom, 240); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 480); + target.AddBuff(BuffID.Venom, 240); + } + } } diff --git a/Items/Weapons/CelestialClaymore.cs b/Items/Weapons/CelestialClaymore.cs index a5e6687dba..97847e6cb2 100644 --- a/Items/Weapons/CelestialClaymore.cs +++ b/Items/Weapons/CelestialClaymore.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,108 +7,115 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CelestialClaymore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestial Claymore"); - Tooltip.SetDefault("Spawns cosmic energy flames near the player that generate large explosions"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestial Claymore"); + Tooltip.SetDefault("Spawns cosmic energy flames near the player that generate large explosions"); + } - public override void SetDefaults() - { - item.width = 50; - item.damage = 63; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("CosmicSpiritBomb1"); - item.shootSpeed = 0.1f; - } + public override void SetDefaults() + { + item.width = 50; + item.damage = 63; + item.melee = true; + item.useAnimation = 23; + item.useTime = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("CosmicSpiritBomb1"); + item.shootSpeed = 0.1f; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("CosmicSpiritBomb1"); break; - case 1: type = mod.ProjectileType("CosmicSpiritBomb2"); break; - case 2: type = mod.ProjectileType("CosmicSpiritBomb3"); break; - default: break; - } - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 3; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + switch (Main.rand.Next(3)) + { + case 0: + type = mod.ProjectileType("CosmicSpiritBomb1"); + break; + case 1: + type = mod.ProjectileType("CosmicSpiritBomb2"); + break; + case 2: + type = mod.ProjectileType("CosmicSpiritBomb3"); + break; + default: + break; + } + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + } + return false; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int num249 = Main.rand.Next(2); - if (num249 == 0) - { - num249 = 15; - } - else if (num249 == 1) - { - num249 = 73; - } - else - { - num249 = 244; - } - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default, 1.3f); - Main.dust[num250].velocity *= 0.2f; - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int num249 = Main.rand.Next(2); + if (num249 == 0) + { + num249 = 15; + } + else if (num249 == 1) + { + num249 = 73; + } + else + { + num249 = 244; + } + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default, 1.3f); + Main.dust[num250].velocity *= 0.2f; + } + } + } } diff --git a/Items/Weapons/Chaotrix.cs b/Items/Weapons/Chaotrix.cs index 63a5b224b7..0629db20d6 100644 --- a/Items/Weapons/Chaotrix.cs +++ b/Items/Weapons/Chaotrix.cs @@ -5,36 +5,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Chaotrix : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotrix"); - Tooltip.SetDefault("Explodes on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotrix"); + Tooltip.SetDefault("Explodes on enemy hits"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Yelets); - item.damage = 110; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Yelets); + item.damage = 110; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ChaotrixProjectile"); - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("ChaotrixProjectile"); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ChargedDartRifle.cs b/Items/Weapons/ChargedDartRifle.cs index c59b38f08c..f91be8c10e 100644 --- a/Items/Weapons/ChargedDartRifle.cs +++ b/Items/Weapons/ChargedDartRifle.cs @@ -6,75 +6,75 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ChargedDartRifle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charged Dart Blaster"); - Tooltip.SetDefault("Right click to fire an exploding energy blast that bounces"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Charged Dart Blaster"); + Tooltip.SetDefault("Right click to fire an exploding energy blast that bounces"); + } - public override void SetDefaults() - { - item.damage = 126; - item.ranged = true; - item.width = 60; - item.height = 24; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 126; + item.ranged = true; + item.width = 60; + item.height = 24; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.shootSpeed = 22f; - item.shoot = mod.ProjectileType("ChargedBlast"); - item.useAmmo = 283; - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.autoReuse = true; + item.shootSpeed = 22f; + item.shoot = mod.ProjectileType("ChargedBlast"); + item.useAmmo = 283; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast3"), (int)((double)damage * 0.85), knockBack, player.whoAmI, 0f, 0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast3"), (int)((double)damage * 0.85), knockBack, player.whoAmI, 0f, 0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DartRifle); - recipe.AddIngredient(ItemID.MartianConduitPlating, 25); - recipe.AddIngredient(null, "CoreofEleum", 3); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DartRifle); + recipe.AddIngredient(ItemID.MartianConduitPlating, 25); + recipe.AddIngredient(null, "CoreofEleum", 3); recipe.AddIngredient(ItemID.FragmentVortex, 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DartPistol); - recipe.AddIngredient(ItemID.MartianConduitPlating, 25); - recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DartPistol); + recipe.AddIngredient(ItemID.MartianConduitPlating, 25); + recipe.AddIngredient(null, "CoreofEleum", 3); recipe.AddIngredient(ItemID.FragmentVortex, 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ClaretCannon.cs b/Items/Weapons/ClaretCannon.cs index 57bf6fe8fd..ed9450709d 100644 --- a/Items/Weapons/ClaretCannon.cs +++ b/Items/Weapons/ClaretCannon.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 24f; item.shoot = mod.ProjectileType("BloodfireBullet"); item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/CleansingBlaze.cs b/Items/Weapons/CleansingBlaze.cs index 1ad7c85b69..32ac951f44 100644 --- a/Items/Weapons/CleansingBlaze.cs +++ b/Items/Weapons/CleansingBlaze.cs @@ -7,78 +7,78 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CleansingBlaze : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cleansing Blaze"); - Tooltip.SetDefault("90% chance to not consume gel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cleansing Blaze"); + Tooltip.SetDefault("90% chance to not consume gel"); + } - public override void SetDefaults() - { - item.damage = 250; - item.ranged = true; - item.width = 64; - item.height = 32; - item.useTime = 3; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("EssenceFire"); - item.shootSpeed = 14f; - item.useAmmo = 23; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.damage = 250; + item.ranged = true; + item.width = 64; + item.height = 32; + item.useTime = 3; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("EssenceFire"); + item.shootSpeed = 14f; + item.useAmmo = 23; + item.Calamity().postMoonLordRarity = 14; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(32f, 14f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/CleansingBlazeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(32f, 14f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/CleansingBlazeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(2, 4); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(2, 4); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 90) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 12); - recipe.AddIngredient(null, "NightmareFuel", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 12); - recipe.AddIngredient(null, "EndothermicEnergy", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 12); + recipe.AddIngredient(null, "NightmareFuel", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 12); + recipe.AddIngredient(null, "EndothermicEnergy", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Climax.cs b/Items/Weapons/Climax.cs index d679f5b62a..9524195755 100644 --- a/Items/Weapons/Climax.cs +++ b/Items/Weapons/Climax.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,80 +7,80 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Climax : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Voltaic Climax"); - Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voltaic Climax"); + Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 90; - item.magic = true; - item.mana = 30; - item.width = 78; - item.height = 78; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Climax"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.damage = 90; + item.magic = true; + item.mana = 30; + item.width = 78; + item.height = 78; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Climax"); + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 14; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - vector2 += new Vector2(num78, num79); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + vector2 += new Vector2(num78, num79); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MagneticMeltdown"); - recipe.AddIngredient(null, "DarksunFragment", 15); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MagneticMeltdown"); + recipe.AddIngredient(null, "DarksunFragment", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ClockGatlignum.cs b/Items/Weapons/ClockGatlignum.cs index 5530fad3f3..64487aac8c 100644 --- a/Items/Weapons/ClockGatlignum.cs +++ b/Items/Weapons/ClockGatlignum.cs @@ -6,65 +6,65 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ClockGatlignum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clock Gatlignum"); - Tooltip.SetDefault("33% chance to not consume ammo\n" + - "Fires a string of high velocity bullets"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clock Gatlignum"); + Tooltip.SetDefault("33% chance to not consume ammo\n" + + "Fires a string of high velocity bullets"); + } - public override void SetDefaults() - { - item.damage = 60; - item.ranged = true; - item.width = 66; - item.height = 34; - item.useTime = 2; - item.reuseDelay = 10; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.75f; + public override void SetDefaults() + { + item.damage = 60; + item.ranged = true; + item.width = 66; + item.height = 34; + item.useTime = 2; + item.reuseDelay = 10; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.75f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, 242, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, 242, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Gatligator); - recipe.AddIngredient(ItemID.VenusMagnum); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Gatligator); + recipe.AddIngredient(ItemID.VenusMagnum); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ClockworkBow.cs b/Items/Weapons/ClockworkBow.cs index 4c7b6be98e..c00fa895ae 100644 --- a/Items/Weapons/ClockworkBow.cs +++ b/Items/Weapons/ClockworkBow.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Clockwork Bow"); Tooltip.SetDefault("Fires a storm of arrows in random directions\n" + - "All arrows fired will go through blocks"); + "All arrows fired will go through blocks"); } public override void SetDefaults() @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 30f; item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { diff --git a/Items/Weapons/Cnidarian.cs b/Items/Weapons/Cnidarian.cs index 464accef7c..644802f622 100644 --- a/Items/Weapons/Cnidarian.cs +++ b/Items/Weapons/Cnidarian.cs @@ -5,36 +5,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Cnidarian : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cnidarian"); - Tooltip.SetDefault("Fires a seashell when enemies are near"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cnidarian"); + Tooltip.SetDefault("Fires a seashell when enemies are near"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.CorruptYoyo); - item.damage = 13; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3f; + public override void SetDefaults() + { + item.CloneDefaults(ItemID.CorruptYoyo); + item.damage = 13; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CnidarianProjectile"); - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("CnidarianProjectile"); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/CometQuasher.cs b/Items/Weapons/CometQuasher.cs index bd6fca1323..093c8b677f 100644 --- a/Items/Weapons/CometQuasher.cs +++ b/Items/Weapons/CometQuasher.cs @@ -1,109 +1,108 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class CometQuasher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet Quasher"); - Tooltip.SetDefault("Summons a swarm of meteors from the sky on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet Quasher"); + Tooltip.SetDefault("Summons a swarm of meteors from the sky on enemy hits"); + } - public override void SetDefaults() - { - item.width = 54; - item.damage = 120; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; + public override void SetDefaults() + { + item.width = 54; + item.damage = 120; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 7.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 54; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shootSpeed = 9f; - } + item.shootSpeed = 9f; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num112 = 3; - for (int num113 = 0; num113 < num112; num113++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float num114 = num78; - float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); - Main.projectile[proj].Calamity().forceMelee = true; - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num112 = 3; + for (int num113 = 0; num113 < num112; num113++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float num114 = num78; + float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 25); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ConferenceCall.cs b/Items/Weapons/ConferenceCall.cs index 70dbc8fa77..98555184fe 100644 --- a/Items/Weapons/ConferenceCall.cs +++ b/Items/Weapons/ConferenceCall.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,111 +7,111 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ConferenceCall : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Conclave Crossfire"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + - "Fires two spreads of bullets, one from the gun and one from the sky"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Conclave Crossfire"); + Tooltip.SetDefault("50% chance to not consume ammo\n" + + "Fires two spreads of bullets, one from the gun and one from the sky"); + } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 66; - item.height = 26; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 66; + item.height = 26; + item.useTime = 26; + item.useAnimation = 26; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = 10; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shootSpeed = 13f; + item.shoot = 10; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - for (int num108 = 0; num108 < num6; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(4, 6); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + for (int num108 = 0; num108 < num6; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TacticalShotgun); - recipe.AddIngredient(null, "CoreofChaos", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TacticalShotgun); + recipe.AddIngredient(null, "CoreofChaos", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Contagion.cs b/Items/Weapons/Contagion.cs index d06f6fba2d..b7c11dd4ac 100644 --- a/Items/Weapons/Contagion.cs +++ b/Items/Weapons/Contagion.cs @@ -5,49 +5,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Contagion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion"); - Tooltip.SetDefault("Fires contagion arrows that leave exploding orbs behind as they travel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion"); + Tooltip.SetDefault("Fires contagion arrows that leave exploding orbs behind as they travel"); + } - public override void SetDefaults() - { - item.damage = 4000; - item.ranged = true; - item.width = 22; - item.height = 50; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 4000; + item.ranged = true; + item.width = 22; + item.height = 50; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 5f; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("Contagion"); - item.shootSpeed = 20f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 16; - } + item.shoot = mod.ProjectileType("Contagion"); + item.shootSpeed = 20f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 16; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(ItemID.Phantasm); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(ItemID.Phantasm); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Contagion"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Contagion"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/CoralSpout.cs b/Items/Weapons/CoralSpout.cs index 8478879882..05be91fb16 100644 --- a/Items/Weapons/CoralSpout.cs +++ b/Items/Weapons/CoralSpout.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CoralSpout : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Coral Spout"); - Tooltip.SetDefault("Casts coral water spouts that lay on the ground and damage enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coral Spout"); + Tooltip.SetDefault("Casts coral water spouts that lay on the ground and damage enemies"); + } - public override void SetDefaults() - { - item.damage = 13; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 13; + item.magic = true; + item.mana = 4; + item.width = 28; + item.height = 30; + item.useTime = 26; + item.useAnimation = 26; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item17; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CoralSpike"); - item.shootSpeed = 16f; - } + item.UseSound = SoundID.Item17; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CoralSpike"); + item.shootSpeed = 16f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddIngredient(ItemID.Coral, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/CosmicBolter.cs b/Items/Weapons/CosmicBolter.cs index 5da814c5f9..a1a7223b96 100644 --- a/Items/Weapons/CosmicBolter.cs +++ b/Items/Weapons/CosmicBolter.cs @@ -6,66 +6,66 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CosmicBolter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Bolter"); - Tooltip.SetDefault("Fires three bouncing energy bolts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Bolter"); + Tooltip.SetDefault("Fires three bouncing energy bolts"); + } - public override void SetDefaults() - { - item.damage = 60; - item.ranged = true; - item.width = 40; - item.height = 76; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LunarBolt2"); - item.shootSpeed = 10f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 60; + item.ranged = true; + item.width = 40; + item.height = 76; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LunarBolt2"); + item.shootSpeed = 10f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 30f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt2"), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 30f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt2"), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LunarianBow"); - recipe.AddIngredient(null, "LivingShard", 5); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LunarianBow"); + recipe.AddIngredient(null, "LivingShard", 5); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/CosmicDischarge.cs b/Items/Weapons/CosmicDischarge.cs index be6724f9a6..5c3b1bc30b 100644 --- a/Items/Weapons/CosmicDischarge.cs +++ b/Items/Weapons/CosmicDischarge.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CosmicDischarge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Discharge"); - Tooltip.SetDefault("Legendary Drop\n" + - "Striking an enemy with the whip causes glacial explosions and grants the player the cosmic freeze buff\n" + - "This buff gives the player increased life regen while standing still and freezes enemies near the player\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Discharge"); + Tooltip.SetDefault("Legendary Drop\n" + + "Striking an enemy with the whip causes glacial explosions and grants the player the cosmic freeze buff\n" + + "This buff gives the player increased life regen while standing still and freezes enemies near the player\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.damage = 1000; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = 5; - item.knockBack = 0.5f; - item.UseSound = SoundID.Item122; + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 1000; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.autoReuse = true; + item.melee = true; + item.useAnimation = 15; + item.useTime = 15; + item.useStyle = 5; + item.knockBack = 0.5f; + item.UseSound = SoundID.Item122; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("CosmicDischarge"); - item.Calamity().postMoonLordRarity = 17; - } + item.shoot = mod.ProjectileType("CosmicDischarge"); + item.Calamity().postMoonLordRarity = 17; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); + return false; + } + } } diff --git a/Items/Weapons/CosmicImmaterializer.cs b/Items/Weapons/CosmicImmaterializer.cs index 7c5531df76..815d748e04 100644 --- a/Items/Weapons/CosmicImmaterializer.cs +++ b/Items/Weapons/CosmicImmaterializer.cs @@ -1,9 +1,9 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons { @@ -37,8 +37,8 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("CosmicEnergy"); item.shootSpeed = 10f; item.summon = true; - item.Calamity().postMoonLordRarity = 15; - } + item.Calamity().postMoonLordRarity = 15; + } public override bool CanUseItem(Player player) { @@ -55,9 +55,9 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - CalamityPlayer modPlayer = player.Calamity(); - bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon; - player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon; + player.itemTime = item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/CosmicRainbow.cs b/Items/Weapons/CosmicRainbow.cs index eb4df45629..fc6ca53a79 100644 --- a/Items/Weapons/CosmicRainbow.cs +++ b/Items/Weapons/CosmicRainbow.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,110 +7,110 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CosmicRainbow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Rainbow"); - Tooltip.SetDefault("Launches a barrage of rainbows"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Rainbow"); + Tooltip.SetDefault("Launches a barrage of rainbows"); + } - public override void SetDefaults() - { - item.damage = 105; - item.magic = true; - item.mana = 30; - item.width = 38; - item.height = 66; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item67; - item.autoReuse = true; - item.shoot = 250; - item.shootSpeed = 18f; - } + public override void SetDefaults() + { + item.damage = 105; + item.magic = true; + item.mana = 30; + item.width = 38; + item.height = 66; + item.useTime = 35; + item.useAnimation = 35; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item67; + item.autoReuse = true; + item.shoot = 250; + item.shootSpeed = 18f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RainbowGun); - recipe.AddIngredient(null, "MeldiateBar", 5); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RainbowGun); + recipe.AddIngredient(null, "MeldiateBar", 5); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 60f; - bool flag11 = Collision.CanHit(vector, 0, 0, vector + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - Projectile.NewProjectile(vector.X + value9.X, vector.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - for (int num108 = 0; num108 < 2; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-15, 16) * 0.01f; - float speedY5 = num79 + (float)Main.rand.Next(-15, 16) * 0.01f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 60f; + bool flag11 = Collision.CanHit(vector, 0, 0, vector + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + Projectile.NewProjectile(vector.X + value9.X, vector.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + for (int num108 = 0; num108 < 2; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-15, 16) * 0.01f; + float speedY5 = num79 + (float)Main.rand.Next(-15, 16) * 0.01f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } diff --git a/Items/Weapons/Cosmilamp.cs b/Items/Weapons/Cosmilamp.cs index e87aefd42a..613447eaa2 100644 --- a/Items/Weapons/Cosmilamp.cs +++ b/Items/Weapons/Cosmilamp.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,63 +7,63 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Cosmilamp : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmilamp"); - Tooltip.SetDefault("Summons a cosmic lantern to fight for you\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmilamp"); + Tooltip.SetDefault("Summons a cosmic lantern to fight for you\n" + "Takes up 2 minion slots"); - } + } - public override void SetDefaults() - { - item.damage = 180; - item.mana = 10; - item.width = 42; - item.height = 60; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 180; + item.mana = 10; + item.width = 42; + item.height = 60; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Cosmilamp"); - item.shootSpeed = 10f; - item.summon = true; - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("Cosmilamp"); + item.shootSpeed = 10f; + item.summon = true; + item.Calamity().postMoonLordRarity = 13; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Cosmilamp"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Cosmilamp"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Crabulon/Fungicide.cs b/Items/Weapons/Crabulon/Fungicide.cs index 331f5660e7..65ccee95f4 100644 --- a/Items/Weapons/Crabulon/Fungicide.cs +++ b/Items/Weapons/Crabulon/Fungicide.cs @@ -1,51 +1,47 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Crabulon { public class Fungicide : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungicide"); - Tooltip.SetDefault("Shoots fungal rounds that split on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungicide"); + Tooltip.SetDefault("Shoots fungal rounds that split on death"); + } - public override void SetDefaults() - { - item.damage = 11; - item.ranged = true; - item.width = 40; - item.height = 26; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; + public override void SetDefaults() + { + item.damage = 11; + item.ranged = true; + item.width = 40; + item.height = 26; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FungiOrb"); - item.shootSpeed = 14f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FungiOrb"); + item.shootSpeed = 14f; + item.useAmmo = 97; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("FungiOrb"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("FungiOrb"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Crabulon/HyphaeRod.cs b/Items/Weapons/Crabulon/HyphaeRod.cs index c908d4bec8..f28af66a8c 100644 --- a/Items/Weapons/Crabulon/HyphaeRod.cs +++ b/Items/Weapons/Crabulon/HyphaeRod.cs @@ -1,94 +1,93 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons.Crabulon { public class HyphaeRod : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hyphae Rod"); - Tooltip.SetDefault("Creates mushroom spores near the player"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hyphae Rod"); + Tooltip.SetDefault("Creates mushroom spores near the player"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 7; - item.width = 34; - item.height = 34; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 7; + item.width = 34; + item.height = 34; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = 590; - item.shootSpeed = 1f; - } + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = 590; + item.shootSpeed = 1f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld + vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); - vector2.Y -= (float)(50 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-180, 181) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); - Main.projectile[proj].Calamity().forceMagic = true; - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); + Vector2 vector3 = Main.MouseWorld + vector2; + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 3; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); + vector2.Y -= (float)(50 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-180, 181) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); + Main.projectile[proj].Calamity().forceMagic = true; + } + return false; + } + } } diff --git a/Items/Weapons/Crabulon/MycelialClaws.cs b/Items/Weapons/Crabulon/MycelialClaws.cs index fe59e5426a..4d9d527352 100644 --- a/Items/Weapons/Crabulon/MycelialClaws.cs +++ b/Items/Weapons/Crabulon/MycelialClaws.cs @@ -6,35 +6,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Crabulon { public class MycelialClaws : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mycelial Claws"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mycelial Claws"); + } - public override void SetDefaults() - { - item.width = 22; - item.damage = 14; - item.melee = true; - item.useAnimation = 6; - item.useStyle = 1; - item.useTime = 6; - item.useTurn = true; - item.knockBack = 3.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 24; + public override void SetDefaults() + { + item.width = 22; + item.damage = 14; + item.melee = true; + item.useAnimation = 6; + item.useStyle = 1; + item.useTime = 6; + item.useTurn = true; + item.knockBack = 3.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 24; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 56); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 56); + } + } + } } diff --git a/Items/Weapons/Cryogen/Avalanche.cs b/Items/Weapons/Cryogen/Avalanche.cs index e39a8b2834..dcaada6102 100644 --- a/Items/Weapons/Cryogen/Avalanche.cs +++ b/Items/Weapons/Cryogen/Avalanche.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Cryogen/BittercoldStaff.cs b/Items/Weapons/Cryogen/BittercoldStaff.cs index 2cfb0e4135..42a4cc6c11 100644 --- a/Items/Weapons/Cryogen/BittercoldStaff.cs +++ b/Items/Weapons/Cryogen/BittercoldStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Cryogen/EffluviumBow.cs b/Items/Weapons/Cryogen/EffluviumBow.cs index 018a1df9f2..597ff34b44 100644 --- a/Items/Weapons/Cryogen/EffluviumBow.cs +++ b/Items/Weapons/Cryogen/EffluviumBow.cs @@ -6,55 +6,55 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Cryogen { public class EffluviumBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Effluvium Bow"); - Tooltip.SetDefault("Fires two mist arrows at once"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Effluvium Bow"); + Tooltip.SetDefault("Fires two mist arrows at once"); + } - public override void SetDefaults() - { - item.damage = 51; - item.ranged = true; - item.width = 26; - item.height = 70; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MistArrow"); - item.shootSpeed = 12f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 51; + item.ranged = true; + item.width = 26; + item.height = 70; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MistArrow"); + item.shootSpeed = 12f; + item.useAmmo = 40; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 7); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 7); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedA = speedX; - float SpeedB = speedY; - for (int index = 0; index < 2; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("MistArrow"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedA = speedX; + float SpeedB = speedY; + for (int index = 0; index < 2; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("MistArrow"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } diff --git a/Items/Weapons/Cryogen/GlacialCrusher.cs b/Items/Weapons/Cryogen/GlacialCrusher.cs index b0f098a3fc..27d377392a 100644 --- a/Items/Weapons/Cryogen/GlacialCrusher.cs +++ b/Items/Weapons/Cryogen/GlacialCrusher.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Items.Weapons.Cryogen { @@ -11,11 +10,11 @@ namespace CalamityMod.Items.Weapons.Cryogen public override void SetStaticDefaults() { DisplayName.SetDefault("Glacial Crusher"); - Tooltip.SetDefault("Fires very slow frost projectiles that gain strength as they travel and freeze enemies\n" + - "Enemies are frozen for longer the further the projectile travels\n" + - "True melee strikes cause tremendous damage to frozen enemies\n" + - "Enemies that cannot be frozen take increased damage"); - } + Tooltip.SetDefault("Fires very slow frost projectiles that gain strength as they travel and freeze enemies\n" + + "Enemies are frozen for longer the further the projectile travels\n" + + "True melee strikes cause tremendous damage to frozen enemies\n" + + "Enemies that cannot be frozen take increased damage"); + } public override void SetDefaults() { @@ -53,18 +52,18 @@ namespace CalamityMod.Items.Weapons.Cryogen } } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { - if (target.buffImmune[mod.BuffType("GlacialState")]) - { - damage *= 2; - knockBack *= 2f; - } - else if (target.Calamity().gState) - { - damage *= 3; - knockBack *= 3f; - } - } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { + if (target.buffImmune[mod.BuffType("GlacialState")]) + { + damage *= 2; + knockBack *= 2f; + } + else if (target.Calamity().gState) + { + damage *= 3; + knockBack *= 3f; + } + } } } diff --git a/Items/Weapons/CrystalBlade.cs b/Items/Weapons/CrystalBlade.cs index 23ffcec9f1..f9f2ce192a 100644 --- a/Items/Weapons/CrystalBlade.cs +++ b/Items/Weapons/CrystalBlade.cs @@ -5,48 +5,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CrystalBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Blade"); - Tooltip.SetDefault("Fires slow-moving clouds of crystal dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Blade"); + Tooltip.SetDefault("Fires slow-moving clouds of crystal dust"); + } - public override void SetDefaults() - { - item.width = 66; - item.damage = 45; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; + public override void SetDefaults() + { + item.width = 66; + item.damage = 45; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("CrystalDust"); - item.shootSpeed = 3f; - } + item.shoot = mod.ProjectileType("CrystalDust"); + item.shootSpeed = 3f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.CobaltSword); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.PalladiumSword); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.CobaltSword); + recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.PalladiumSword); + recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/CrystalFlareStaff.cs b/Items/Weapons/CrystalFlareStaff.cs index 378aeff37b..df228afeb5 100644 --- a/Items/Weapons/CrystalFlareStaff.cs +++ b/Items/Weapons/CrystalFlareStaff.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CrystalFlareStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Flare Staff"); - Tooltip.SetDefault("Fires blue frost flames that explode"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Flare Staff"); + Tooltip.SetDefault("Fires blue frost flames that explode"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 30; - item.magic = true; - item.mana = 15; - item.width = 44; - item.height = 46; - item.useTime = 12; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.25f; + public override void SetDefaults() + { + item.damage = 30; + item.magic = true; + item.mana = 15; + item.width = 44; + item.height = 46; + item.useTime = 12; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.25f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SpiritFlameCurse"); - item.shootSpeed = 14f; - } + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SpiritFlameCurse"); + item.shootSpeed = 14f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofEleum", 3); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.FrostStaff); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofEleum", 3); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.FrostStaff); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/CursedCapper.cs b/Items/Weapons/CursedCapper.cs index c7c2f20853..f579093870 100644 --- a/Items/Weapons/CursedCapper.cs +++ b/Items/Weapons/CursedCapper.cs @@ -5,47 +5,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class CursedCapper : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cursed Capper"); - Tooltip.SetDefault("Fires cursed bullets"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed Capper"); + Tooltip.SetDefault("Fires cursed bullets"); + } - public override void SetDefaults() - { - item.damage = 24; - item.ranged = true; - item.width = 44; - item.height = 32; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; + public override void SetDefaults() + { + item.damage = 24; + item.ranged = true; + item.width = 44; + item.height = 32; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = ProjectileID.CursedBullet; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 14f; + item.shoot = ProjectileID.CursedBullet; + item.useAmmo = 97; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CursedBullet, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CursedBullet, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PhoenixBlaster); - recipe.AddIngredient(ItemID.CursedFlame, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PhoenixBlaster); + recipe.AddIngredient(ItemID.CursedFlame, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/DarkechoGreatbow.cs b/Items/Weapons/DarkechoGreatbow.cs index f53946636d..2cc68936f4 100644 --- a/Items/Weapons/DarkechoGreatbow.cs +++ b/Items/Weapons/DarkechoGreatbow.cs @@ -6,55 +6,55 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class DarkechoGreatbow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Darkecho Greatbow"); - Tooltip.SetDefault("Fires two arrows at once\n" + - "Fires an additional crystal dart"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Darkecho Greatbow"); + Tooltip.SetDefault("Fires two arrows at once\n" + + "Fires an additional crystal dart"); + } - public override void SetDefaults() - { - item.damage = 34; - item.ranged = true; - item.width = 34; - item.height = 62; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 34; + item.ranged = true; + item.width = 34; + item.height = 62; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[index].noDropItem = true; - } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[projectile].penetrate = 3; - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[index].noDropItem = true; + } + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[projectile].penetrate = 3; + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/DarklightGreatsword.cs b/Items/Weapons/DarklightGreatsword.cs index 1fd01e552c..505adefa21 100644 --- a/Items/Weapons/DarklightGreatsword.cs +++ b/Items/Weapons/DarklightGreatsword.cs @@ -6,61 +6,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class DarklightGreatsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Darklight Greatsword"); - Tooltip.SetDefault("Fires a darklight orb that splits on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Darklight Greatsword"); + Tooltip.SetDefault("Fires a darklight orb that splits on death"); + } - public override void SetDefaults() - { - item.width = 56; - item.damage = 55; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; + public override void SetDefaults() + { + item.width = 56; + item.damage = 55; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("StarCrystal"); - item.shootSpeed = 16f; - } + item.shoot = mod.ProjectileType("StarCrystal"); + item.shootSpeed = 16f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * 0.6), knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * 0.6), knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 12); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ItemID.SoulofNight); - recipe.AddIngredient(ItemID.SoulofLight); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 12); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddIngredient(ItemID.SoulofNight); + recipe.AddIngredient(ItemID.SoulofLight); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 29); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 29); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + } + } } diff --git a/Items/Weapons/DeathValley.cs b/Items/Weapons/DeathValley.cs index dd1b514c69..215a8897bf 100644 --- a/Items/Weapons/DeathValley.cs +++ b/Items/Weapons/DeathValley.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class DeathValley : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Valley Duster"); - Tooltip.SetDefault("Casts a large blast of dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Valley Duster"); + Tooltip.SetDefault("Casts a large blast of dust"); + } - public override void SetDefaults() - { - item.damage = 110; - item.magic = true; - item.mana = 9; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 110; + item.magic = true; + item.mana = 9; + item.width = 28; + item.height = 30; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DustProjectile"); - item.shootSpeed = 5f; - } + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DustProjectile"); + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Tradewinds"); - recipe.AddIngredient(ItemID.FossilOre, 25); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(null, "DesertFeather", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Tradewinds"); + recipe.AddIngredient(ItemID.FossilOre, 25); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(null, "DesertFeather", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/DemonicPitchfork.cs b/Items/Weapons/DemonicPitchfork.cs index 26e4a80346..8101a9ed86 100644 --- a/Items/Weapons/DemonicPitchfork.cs +++ b/Items/Weapons/DemonicPitchfork.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class DemonicPitchfork : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demonic Pitchfork"); - Tooltip.SetDefault("Fires a demonic pitchfork"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonic Pitchfork"); + Tooltip.SetDefault("Fires a demonic pitchfork"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 82; - item.magic = true; - item.mana = 11; - item.width = 56; - item.height = 56; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; + public override void SetDefaults() + { + item.damage = 82; + item.magic = true; + item.mana = 11; + item.width = 56; + item.height = 56; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DemonicPitchfork"); - item.shootSpeed = 16f; - } + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DemonicPitchfork"); + item.shootSpeed = 16f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Obsidian, 20); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Obsidian, 20); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/DepthBlade.cs b/Items/Weapons/DepthBlade.cs index 1e486298e5..1869af4295 100644 --- a/Items/Weapons/DepthBlade.cs +++ b/Items/Weapons/DepthBlade.cs @@ -6,42 +6,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class DepthBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Depth Blade"); - Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + - "The lower the enemies' defense the more damage they take from this debuff"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Depth Blade"); + Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + + "The lower the enemies' defense the more damage they take from this debuff"); + } - public override void SetDefaults() - { - item.width = 40; - item.damage = 22; - item.melee = true; - item.useAnimation = 22; - item.useTime = 22; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; + public override void SetDefaults() + { + item.width = 40; + item.damage = 22; + item.melee = true; + item.useAnimation = 22; + item.useTime = 22; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 40; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 180); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 180); + } + } } diff --git a/Items/Weapons/DesertScourge/AquaticDischarge.cs b/Items/Weapons/DesertScourge/AquaticDischarge.cs index 4d5ef13614..401c9233c7 100644 --- a/Items/Weapons/DesertScourge/AquaticDischarge.cs +++ b/Items/Weapons/DesertScourge/AquaticDischarge.cs @@ -6,45 +6,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DesertScourge { public class AquaticDischarge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Discharge"); - Tooltip.SetDefault("Enemies release electric sparks on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Discharge"); + Tooltip.SetDefault("Enemies release electric sparks on death"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 32; - item.height = 32; - item.damage = 23; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 12; + item.useTime = 12; + item.width = 32; + item.height = 32; + item.damage = 23; + item.melee = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } } diff --git a/Items/Weapons/DesertScourge/Barinade.cs b/Items/Weapons/DesertScourge/Barinade.cs index 368bddcdb9..c778e9f39c 100644 --- a/Items/Weapons/DesertScourge/Barinade.cs +++ b/Items/Weapons/DesertScourge/Barinade.cs @@ -6,32 +6,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DesertScourge { public class Barinade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Barinade"); - Tooltip.SetDefault("Shoots electric bolt arrows that explode"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Barinade"); + Tooltip.SetDefault("Shoots electric bolt arrows that explode"); + } - public override void SetDefaults() - { - item.damage = 8; - item.ranged = true; - item.width = 30; - item.height = 44; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 8; + item.ranged = true; + item.width = 30; + item.height = 44; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 14f; - item.useAmmo = 40; - } + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 14f; + item.useAmmo = 40; + } /*public void OverhaulInit() { @@ -39,9 +39,9 @@ namespace CalamityMod.Items.Weapons.DesertScourge }*/ public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/DesertScourge/SeaboundStaff.cs b/Items/Weapons/DesertScourge/SeaboundStaff.cs index 2ffdcb49da..1391c6e5eb 100644 --- a/Items/Weapons/DesertScourge/SeaboundStaff.cs +++ b/Items/Weapons/DesertScourge/SeaboundStaff.cs @@ -6,58 +6,58 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DesertScourge { public class SeaboundStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seabound Staff"); - Tooltip.SetDefault("Summons a brittle star to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seabound Staff"); + Tooltip.SetDefault("Summons a brittle star to fight for you"); + } - public override void SetDefaults() - { - item.damage = 11; - item.mana = 10; - item.width = 32; - item.height = 32; - item.useTime = 36; - item.useAnimation = 36; - item.scale = 0.75f; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 11; + item.mana = 10; + item.width = 32; + item.height = 32; + item.useTime = 36; + item.useAnimation = 36; + item.scale = 0.75f; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrittleStar"); - item.shootSpeed = 10f; - item.summon = true; - } + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrittleStar"); + item.shootSpeed = 10f; + item.summon = true; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/DesertScourge/StormSpray.cs b/Items/Weapons/DesertScourge/StormSpray.cs index b205b65038..2a46fa1331 100644 --- a/Items/Weapons/DesertScourge/StormSpray.cs +++ b/Items/Weapons/DesertScourge/StormSpray.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DesertScourge { public class StormSpray : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Spray"); - Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Spray"); + Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 18; - item.magic = true; - item.mana = 8; - item.width = 42; - item.height = 42; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 18; + item.magic = true; + item.mana = 8; + item.width = 42; + item.height = 42; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WaterStream"); - item.shootSpeed = 10f; - } + item.UseSound = SoundID.Item13; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WaterStream"); + item.shootSpeed = 10f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/Devastation.cs b/Items/Weapons/Devastation.cs index 2dbbf299dd..33b322d8ec 100644 --- a/Items/Weapons/Devastation.cs +++ b/Items/Weapons/Devastation.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,119 +7,126 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Devastation : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devastation"); - Tooltip.SetDefault("Fires galaxy blasts that explode"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devastation"); + Tooltip.SetDefault("Fires galaxy blasts that explode"); + } - public override void SetDefaults() - { - item.width = 72; - item.damage = 160; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; + public override void SetDefaults() + { + item.width = 72; + item.damage = 160; + item.melee = true; + item.useAnimation = 24; + item.useTime = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("GalaxyBlast"); - item.shootSpeed = 16f; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 16f; + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(6)) - { - case 1: type = mod.ProjectileType("GalaxyBlast"); break; - case 2: type = mod.ProjectileType("GalaxyBlastType2"); break; - case 3: type = mod.ProjectileType("GalaxyBlastType3"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 4; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType3"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(1)); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(6)) + { + case 1: + type = mod.ProjectileType("GalaxyBlast"); + break; + case 2: + type = mod.ProjectileType("GalaxyBlastType2"); + break; + case 3: + type = mod.ProjectileType("GalaxyBlastType3"); + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 4; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType3"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(1)); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CatastropheClaymore"); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "AstralBar", 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CatastropheClaymore"); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "AstralBar", 10); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 73); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 73); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 300); + } + } } diff --git a/Items/Weapons/DevilsDevastation.cs b/Items/Weapons/DevilsDevastation.cs index 08c1fedb96..f7517c2f57 100644 --- a/Items/Weapons/DevilsDevastation.cs +++ b/Items/Weapons/DevilsDevastation.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,166 +7,166 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class DevilsDevastation : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devil's Devastation"); - Tooltip.SetDefault("Fires a spread of demonic blades and blasts\n" + - "Critical hits cause shadowflame explosions"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devil's Devastation"); + Tooltip.SetDefault("Fires a spread of demonic blades and blasts\n" + + "Critical hits cause shadowflame explosions"); + } - public override void SetDefaults() - { - item.width = 74; - item.damage = 470; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 74; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Oathblade"); - item.shootSpeed = 28f; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.width = 74; + item.damage = 470; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 74; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Oathblade"); + item.shootSpeed = 28f; + item.Calamity().postMoonLordRarity = 14; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(4); - for (int j = 0; j < numProj + 1; j++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (numProj - 1))); - int demon = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[demon].penetrate = 1; - } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType3"), damage, knockBack, player.whoAmI, 0f, 1f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(4); + for (int j = 0; j < numProj + 1; j++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (numProj - 1))); + int demon = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[demon].penetrate = 1; + } + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 3; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType3"), damage, knockBack, player.whoAmI, 0f, 1f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Devastation"); - recipe.AddIngredient(null, "TrueForbiddenOathblade"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Devastation"); + recipe.AddIngredient(null, "TrueForbiddenOathblade"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 300); - target.AddBuff(BuffID.OnFire, 300); - if (crit) - { - target.AddBuff(BuffID.ShadowFlame, 900); - target.AddBuff(BuffID.OnFire, 900); - player.ApplyDamageToNPC(target, damage * 4, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 4.5f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 3f; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 300); + target.AddBuff(BuffID.OnFire, 300); + if (crit) + { + target.AddBuff(BuffID.ShadowFlame, 900); + target.AddBuff(BuffID.OnFire, 900); + player.ApplyDamageToNPC(target, damage * 4, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 4.5f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 3f; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 1.5f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } + } } diff --git a/Items/Weapons/DevourerofGods/DeathhailStaff.cs b/Items/Weapons/DevourerofGods/DeathhailStaff.cs index 69a7732eea..378e363584 100644 --- a/Items/Weapons/DevourerofGods/DeathhailStaff.cs +++ b/Items/Weapons/DevourerofGods/DeathhailStaff.cs @@ -1,6 +1,6 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods { DisplayName.SetDefault("Deathhail Staff"); Tooltip.SetDefault("Rain death upon your foes!\n" + - "Casts a storm of nebula shots from the sky"); + "Casts a storm of nebula shots from the sky"); Item.staff[item.type] = true; } @@ -35,16 +35,16 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.autoReuse = true; item.shoot = mod.ProjectileType("MagicNebulaShot"); item.shootSpeed = 18f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(40f, 42f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(40f, 42f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int i = Main.myPlayer; float num72 = item.shootSpeed; diff --git a/Items/Weapons/DevourerofGods/Deathwind.cs b/Items/Weapons/DevourerofGods/Deathwind.cs index 50e02cb851..c0aae8de64 100644 --- a/Items/Weapons/DevourerofGods/Deathwind.cs +++ b/Items/Weapons/DevourerofGods/Deathwind.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Weapons.DevourerofGods public override void SetStaticDefaults() { DisplayName.SetDefault("Deathwind"); - Tooltip.SetDefault("Fires a spread of arrows\n" + - "Wooden arrows are converted to nebula shots"); - } + Tooltip.SetDefault("Fires a spread of arrows\n" + + "Wooden arrows are converted to nebula shots"); + } public override void SetDefaults() { @@ -33,16 +33,16 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.shoot = mod.ProjectileType("NebulaShot"); item.shootSpeed = 20f; item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(20f, 41f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(20f, 41f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float SpeedA = speedX; float SpeedB = speedY; diff --git a/Items/Weapons/DevourerofGods/EradicatorMelee.cs b/Items/Weapons/DevourerofGods/EradicatorMelee.cs index dc4b3281d6..2577f6ee2b 100644 --- a/Items/Weapons/DevourerofGods/EradicatorMelee.cs +++ b/Items/Weapons/DevourerofGods/EradicatorMelee.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons.DevourerofGods public override void SetStaticDefaults() { DisplayName.SetDefault("Eradicator"); - Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); - } + Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); + } public override void SetDefaults() { @@ -32,13 +32,13 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.rare = 10; item.shoot = mod.ProjectileType("EradicatorMeleeProjectile"); item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/EradicatorMeleeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/EradicatorMeleeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } } diff --git a/Items/Weapons/DevourerofGods/Excelsus.cs b/Items/Weapons/DevourerofGods/Excelsus.cs index 1a7e2d22f2..a556e8cf42 100644 --- a/Items/Weapons/DevourerofGods/Excelsus.cs +++ b/Items/Weapons/DevourerofGods/Excelsus.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods { DisplayName.SetDefault("Excelsus"); Tooltip.SetDefault("Fires a spread of spinning blades\n" + - "Summons laser fountains on hit"); + "Summons laser fountains on hit"); } public override void SetDefaults() @@ -32,39 +32,39 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.rare = 10; item.shoot = mod.ProjectileType("Excelsus"); item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(39f, 47f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(39f, 47f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int index = 0; index < 3; ++index) { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - switch (index) - { - case 0: - type = mod.ProjectileType("Excelsus"); - break; - case 1: - type = mod.ProjectileType("ExcelsusBlue"); - break; - case 2: - type = mod.ProjectileType("ExcelsusPink"); - break; - } + switch (index) + { + case 0: + type = mod.ProjectileType("Excelsus"); + break; + case 1: + type = mod.ProjectileType("ExcelsusBlue"); + break; + case 2: + type = mod.ProjectileType("ExcelsusPink"); + break; + } Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("LaserFountain"), 0, 0, Main.myPlayer); } diff --git a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs index 1089d3c3b7..db2014df87 100644 --- a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs +++ b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,35 +7,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DevourerofGods { public class StaffoftheMechworm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Staff of the Mechworm"); - Tooltip.SetDefault("Summons an aerial mechworm to fight for you\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Staff of the Mechworm"); + Tooltip.SetDefault("Summons an aerial mechworm to fight for you\n" + "Damage scales with the amount of minion slots you have\n" + "The damage scaling stops growing after 10 minion slots"); - } + } - public override void SetDefaults() - { - item.damage = 30; - item.mana = 15; - item.width = 58; - item.height = 58; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 30; + item.mana = 15; + item.width = 58; + item.height = 58; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item113; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MechwormHead"); - item.shootSpeed = 10f; - item.summon = true; - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("MechwormHead"); + item.shootSpeed = 10f; + item.summon = true; + item.Calamity().postMoonLordRarity = 13; + } public override bool CanUseItem(Player player) { @@ -57,108 +57,108 @@ namespace CalamityMod.Items.Weapons.DevourerofGods } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + { int maxMinionScale = player.maxMinions; if (maxMinionScale > 10) { maxMinionScale = 10; } - damage = (int)(damage * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); - int owner = player.whoAmI; - float num72 = item.shootSpeed; - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = num72; - } + damage = (int)(damage * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); + int owner = player.whoAmI; + float num72 = item.shootSpeed; + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); + Vector2 vector3 = Main.MouseWorld - vector2; + float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) + { + velX = (float)player.direction; + velY = 0f; + dist = num72; + } else - { - dist = num72 / dist; - } - velX *= dist; - velY *= dist; - int head = -1; - int tail = -1; - int typeHead = mod.ProjectileType("MechwormHead"); - int typeTail = mod.ProjectileType("MechwormTail"); - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (head == -1 && Main.projectile[i].type == typeHead) - { - head = i; - } - else if (tail == -1 && Main.projectile[i].type == typeTail) - { - tail = i; - } - if (head != -1 && tail != -1) - { - break; - } - } - } - if (head == -1 && tail == -1) - { - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - velX = 0f; - velY = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, knockBack, owner); + { + dist = num72 / dist; + } + velX *= dist; + velY *= dist; + int head = -1; + int tail = -1; + int typeHead = mod.ProjectileType("MechwormHead"); + int typeTail = mod.ProjectileType("MechwormTail"); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == owner) + { + if (head == -1 && Main.projectile[i].type == typeHead) + { + head = i; + } + else if (tail == -1 && Main.projectile[i].type == typeTail) + { + tail = i; + } + if (head != -1 && tail != -1) + { + break; + } + } + } + if (head == -1 && tail == -1) + { + float num77 = Vector2.Dot(value, vector3); + if (num77 > 0f) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + velX = 0f; + velY = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, knockBack, owner); - int prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, (float)prev); + int prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, (float)prev); - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - } - else if (head != -1 && tail != -1) - { - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, Main.projectile[tail].ai[0]); - int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)body); + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, knockBack, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + } + else if (head != -1 && tail != -1) + { + int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, Main.projectile[tail].ai[0]); + int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)body); - Main.projectile[body].localAI[1] = (float)back; - Main.projectile[body].ai[1] = 1f; - Main.projectile[body].netUpdate = true; + Main.projectile[body].localAI[1] = (float)back; + Main.projectile[body].ai[1] = 1f; + Main.projectile[body].netUpdate = true; - Main.projectile[back].localAI[1] = (float)tail; - Main.projectile[back].netUpdate = true; - Main.projectile[back].ai[1] = 1f; + Main.projectile[back].localAI[1] = (float)tail; + Main.projectile[back].netUpdate = true; + Main.projectile[back].ai[1] = 1f; - Main.projectile[tail].ai[0] = (float)back; - Main.projectile[tail].netUpdate = true; - Main.projectile[tail].ai[1] = 1f; - } - return false; - } - } + Main.projectile[tail].ai[0] = (float)back; + Main.projectile[tail].netUpdate = true; + Main.projectile[tail].ai[1] = 1f; + } + return false; + } + } } diff --git a/Items/Weapons/DevourerofGods/TheObliterator.cs b/Items/Weapons/DevourerofGods/TheObliterator.cs index 72c8981fac..628ebc85eb 100644 --- a/Items/Weapons/DevourerofGods/TheObliterator.cs +++ b/Items/Weapons/DevourerofGods/TheObliterator.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("TheObliterator"); - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } } } diff --git a/Items/Weapons/DraconicDestruction.cs b/Items/Weapons/DraconicDestruction.cs index 40ca2f9ab2..36456274a5 100644 --- a/Items/Weapons/DraconicDestruction.cs +++ b/Items/Weapons/DraconicDestruction.cs @@ -6,57 +6,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class DraconicDestruction : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draconic Destruction"); - Tooltip.SetDefault("Fires a draconic sword beam that explodes into additional beams\n" + - "Additional beams fly up and down to shred enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draconic Destruction"); + Tooltip.SetDefault("Fires a draconic sword beam that explodes into additional beams\n" + + "Additional beams fly up and down to shred enemies"); + } - public override void SetDefaults() - { - item.width = 94; - item.damage = 210; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 94; + public override void SetDefaults() + { + item.width = 94; + item.damage = 210; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 7.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 94; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("DracoBeam"); - item.shootSpeed = 14f; - item.Calamity().postMoonLordRarity = 16; - } + item.shootSpeed = 14f; + item.Calamity().postMoonLordRarity = 16; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "CoreofCinder", 3); - recipe.AddIngredient(null, "CoreofEleum", 3); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "CoreofCinder", 3); + recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 35); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 35); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } } diff --git a/Items/Weapons/DraedonsExoblade.cs b/Items/Weapons/DraedonsExoblade.cs index a38ffb8a79..26a68670e7 100644 --- a/Items/Weapons/DraedonsExoblade.cs +++ b/Items/Weapons/DraedonsExoblade.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,9 +8,9 @@ namespace CalamityMod.Items.Weapons { public class DraedonsExoblade : ModItem { - private static int BaseDamage = 6700; + private static int BaseDamage = 6700; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Exoblade"); Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + @@ -38,17 +38,17 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("Exobeam"); item.shootSpeed = 19f; - item.Calamity().postMoonLordRarity = 15; - } + item.Calamity().postMoonLordRarity = 15; + } - // Gains 100% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * player.meleeDamage; - } + // Gains 100% of missing health as base damage. + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + flat += lifeAmount * player.meleeDamage; + } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) { @@ -62,16 +62,16 @@ namespace CalamityMod.Items.Weapons { Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Exoboom"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); } - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); float xPos = (Main.rand.NextBool(2)) ? player.position.X + 800 : player.position.X - 800; Vector2 vector2 = new Vector2(xPos, player.position.Y + Main.rand.Next(-800, 801)); float num80 = xPos; diff --git a/Items/Weapons/Drataliornus.cs b/Items/Weapons/Drataliornus.cs index 2c8f297b6f..70701e055d 100644 --- a/Items/Weapons/Drataliornus.cs +++ b/Items/Weapons/Drataliornus.cs @@ -6,41 +6,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Drataliornus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drataliornus"); - Tooltip.SetDefault(@"Fires an escalating stream of fireballs. + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drataliornus"); + Tooltip.SetDefault(@"Fires an escalating stream of fireballs. Fireballs rain meteors, leave dragon dust trails, and launch additional bolts at max speed. Taking damage while firing the stream will interrupt it and reduce your wing flight time. Right click to fire two devastating barrages of five empowered fireballs. 'Just don't get hit'"); - } + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.damage = 620; - item.knockBack = 1f; + item.knockBack = 1f; item.shootSpeed = 18f; - item.useStyle = 5; - item.useAnimation = 10; - item.useTime = 10; + item.useStyle = 5; + item.useAnimation = 10; + item.useTime = 10; item.reuseDelay = 0; item.width = 64; - item.height = 84; - item.UseSound = SoundID.Item5; - item.shoot = mod.ProjectileType("Drataliornus"); + item.height = 84; + item.UseSound = SoundID.Item5; + item.shoot = mod.ProjectileType("Drataliornus"); item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.noMelee = true; item.noUseGraphic = true; - item.ranged = true; + item.ranged = true; item.channel = true; - item.useTurn = false; - item.useAmmo = AmmoID.Arrow; - item.autoReuse = true; - item.Calamity().postMoonLordRarity = 16; - } + item.useTurn = false; + item.useAmmo = AmmoID.Arrow; + item.autoReuse = true; + item.Calamity().postMoonLordRarity = 16; + } public override bool AltFunctionUse(Player player) { @@ -66,8 +66,8 @@ Right click to fire two devastating barrages of five empowered fireballs. return base.CanUseItem(player); } - public override bool Shoot (Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { if (player.altFunctionUse == 2) //tsunami { const float num3 = 0.471238898f; @@ -87,8 +87,8 @@ Right click to fire two devastating barrages of five empowered fireballs. Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Drataliornus"), 0, 0f, player.whoAmI); } - return false; - } + return false; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Dualpoon.cs b/Items/Weapons/Dualpoon.cs index 3dd8f0aafa..eadfc912c1 100644 --- a/Items/Weapons/Dualpoon.cs +++ b/Items/Weapons/Dualpoon.cs @@ -6,31 +6,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Dualpoon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dualpoon"); - Tooltip.SetDefault("Launches two harpoons"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dualpoon"); + Tooltip.SetDefault("Launches two harpoons"); + } - public override void SetDefaults() - { - item.damage = 70; - item.ranged = true; - item.width = 56; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; + public override void SetDefaults() + { + item.damage = 70; + item.ranged = true; + item.width = 56; + item.height = 28; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("Triploon"); - } + item.UseSound = SoundID.Item10; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("Triploon"); + } public override Vector2? HoldoutOffset() { @@ -38,37 +38,37 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 2; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[harpoon].timeLeft = 300; - } - return false; - } + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Harpoon, 2); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Harpoon, 2); recipe.AddIngredient(ItemID.HallowedBar, 5); recipe.AddIngredient(ItemID.SoulofMight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Earth.cs b/Items/Weapons/Earth.cs index 98a81454ae..6f4e333cb5 100644 --- a/Items/Weapons/Earth.cs +++ b/Items/Weapons/Earth.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,106 +7,106 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Earth : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 50 when striking them\n" + - "Your attacks will heal you a lot\n" + - "Rains RGB meteors that explode into more meteors after a short time on enemy hits\n" + - "Ice meteors freeze enemies\n" + - "Flame meteors explode\n" + - "Green meteors spawn healing orbs"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + Tooltip.SetDefault("Has a chance to lower enemy defense by 50 when striking them\n" + + "Your attacks will heal you a lot\n" + + "Rains RGB meteors that explode into more meteors after a short time on enemy hits\n" + + "Ice meteors freeze enemies\n" + + "Flame meteors explode\n" + + "Green meteors spawn healing orbs"); + } - public override void SetDefaults() - { - item.width = 92; - item.damage = 840; - item.melee = true; - item.useAnimation = 16; - item.useStyle = 1; - item.useTime = 16; - item.useTurn = true; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 104; + public override void SetDefaults() + { + item.width = 92; + item.damage = 840; + item.melee = true; + item.useAnimation = 16; + item.useStyle = 1; + item.useTime = 16; + item.useTurn = true; + item.knockBack = 9.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 104; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - float num72 = 25f; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78; - float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Earth"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - if (Main.rand.NextBool(2)) - { - target.defense -= 50; - } - int heal = Main.rand.Next(1, 69); - player.statLife += heal; - player.HealEffect(heal); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + float num72 = 25f; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 3; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78; + float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Earth"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + if (Main.rand.NextBool(2)) + { + target.defense -= 50; + } + int heal = Main.rand.Next(1, 69); + player.statLife += heal; + player.HealEffect(heal); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GrandGuardian"); - recipe.AddIngredient(null, "GalacticaBlade"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GrandGuardian"); + recipe.AddIngredient(null, "GalacticaBlade"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/EarthenPike.cs b/Items/Weapons/EarthenPike.cs index caf1ca4cdf..9bc314e83b 100644 --- a/Items/Weapons/EarthenPike.cs +++ b/Items/Weapons/EarthenPike.cs @@ -5,33 +5,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class EarthenPike : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earthen Pike"); - Tooltip.SetDefault("Crushes enemy defenses\n" + - "Sprays fossil shards on use"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earthen Pike"); + Tooltip.SetDefault("Crushes enemy defenses\n" + + "Sprays fossil shards on use"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 50; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = 5; - item.useTime = 25; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 60; + public override void SetDefaults() + { + item.width = 60; + item.damage = 50; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 25; + item.useStyle = 5; + item.useTime = 25; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 60; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("EarthenPike"); - item.shootSpeed = 6f; - } - } + item.shoot = mod.ProjectileType("EarthenPike"); + item.shootSpeed = 6f; + } + } } diff --git a/Items/Weapons/Effervescence.cs b/Items/Weapons/Effervescence.cs index 9e14902d9d..76668bba41 100644 --- a/Items/Weapons/Effervescence.cs +++ b/Items/Weapons/Effervescence.cs @@ -5,54 +5,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Effervescence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Effervescence"); - Tooltip.SetDefault("Shoots a massive spread of bubbles"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Effervescence"); + Tooltip.SetDefault("Shoots a massive spread of bubbles"); + } - public override void SetDefaults() - { - item.damage = 36; - item.magic = true; - item.mana = 17; - item.width = 56; - item.height = 26; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item95; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = mod.ProjectileType("UberBubble"); - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.damage = 36; + item.magic = true; + item.mana = 17; + item.width = 56; + item.height = 26; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.75f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item95; + item.autoReuse = true; + item.shootSpeed = 13f; + item.shoot = mod.ProjectileType("UberBubble"); + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int randomBullets = 0; randomBullets <= 4; randomBullets++) - { - float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int randomBullets = 0; randomBullets <= 4; randomBullets++) + { + float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BubbleGun); - recipe.AddIngredient(ItemID.Xenopopper); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BubbleGun); + recipe.AddIngredient(ItemID.Xenopopper); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ElementalAxe.cs b/Items/Weapons/ElementalAxe.cs index b2825eac32..f183e0a075 100644 --- a/Items/Weapons/ElementalAxe.cs +++ b/Items/Weapons/ElementalAxe.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,70 +6,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ElementalAxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Axe"); - Tooltip.SetDefault("Summons an elemental axe to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Axe"); + Tooltip.SetDefault("Summons an elemental axe to fight for you"); + } - public override void SetDefaults() - { - item.damage = 140; - item.summon = true; - item.mana = 10; - item.width = 36; - item.height = 36; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 140; + item.summon = true; + item.mana = 10; + item.width = 36; + item.height = 36; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementalAxe"); - item.shootSpeed = 10f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementalAxe"); + item.shootSpeed = 10f; + item.Calamity().postMoonLordRarity = 12; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "InfernaCutter"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "InfernaCutter"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ElementalBlaster.cs b/Items/Weapons/ElementalBlaster.cs index 9010dd55f9..7abb0bff91 100644 --- a/Items/Weapons/ElementalBlaster.cs +++ b/Items/Weapons/ElementalBlaster.cs @@ -6,42 +6,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ElementalBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Blaster"); - Tooltip.SetDefault("Does not consume ammo\n" + - "Fires a storm of rainbow blasts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Blaster"); + Tooltip.SetDefault("Does not consume ammo\n" + + "Fires a storm of rainbow blasts"); + } - public override void SetDefaults() - { - item.damage = 77; - item.ranged = true; - item.width = 104; - item.height = 42; - item.useTime = 2; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.75f; + public override void SetDefaults() + { + item.damage = 77; + item.ranged = true; + item.width = 104; + item.height = 42; + item.useTime = 2; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.75f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("RainbowBlast"); - item.shootSpeed = 18f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("RainbowBlast"); + item.shootSpeed = 18f; + item.Calamity().postMoonLordRarity = 12; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "SpectralstormCannon"); recipe.AddIngredient(null, "ClockGatlignum"); recipe.AddIngredient(null, "PaintballBlaster"); @@ -50,6 +50,6 @@ namespace CalamityMod.Items.Weapons recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/ElementalEruption.cs b/Items/Weapons/ElementalEruption.cs index bc7060cb42..b90836286f 100644 --- a/Items/Weapons/ElementalEruption.cs +++ b/Items/Weapons/ElementalEruption.cs @@ -6,66 +6,66 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ElementalEruption : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Eruption"); - Tooltip.SetDefault("90% chance to not consume gel\n" + - "Fires a spread of rainbow flames"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Eruption"); + Tooltip.SetDefault("90% chance to not consume gel\n" + + "Fires a spread of rainbow flames"); + } - public override void SetDefaults() - { - item.damage = 50; - item.ranged = true; - item.width = 64; - item.height = 34; - item.useTime = 5; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 50; + item.ranged = true; + item.width = 64; + item.height = 34; + item.useTime = 5; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraFireGreen2"); - item.shootSpeed = 10f; - item.useAmmo = 23; - item.Calamity().postMoonLordRarity = 12; - } + item.shoot = mod.ProjectileType("TerraFireGreen2"); + item.shootSpeed = 10f; + item.useAmmo = 23; + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(3, 5); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(3, 5); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 90) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "TerraFlameburster"); - recipe.AddIngredient(null, "Meowthrower"); - recipe.AddIngredient(null, "MepheticSprayer"); - recipe.AddIngredient(null, "BrimstoneFlamesprayer"); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "TerraFlameburster"); + recipe.AddIngredient(null, "Meowthrower"); + recipe.AddIngredient(null, "MepheticSprayer"); + recipe.AddIngredient(null, "BrimstoneFlamesprayer"); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ElementalExcalibur.cs b/Items/Weapons/ElementalExcalibur.cs index a24418040d..54ee199faf 100644 --- a/Items/Weapons/ElementalExcalibur.cs +++ b/Items/Weapons/ElementalExcalibur.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,148 +6,148 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class ElementalExcalibur : ModItem - { - private static int BaseDamage = 10000; - private int BeamType = 0; - private int alpha = 50; + public class ElementalExcalibur : ModItem + { + private static int BaseDamage = 10000; + private int BeamType = 0; + private int alpha = 50; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Excalibur"); - Tooltip.SetDefault("Freezes enemies and heals the player on hit\n" + - "Fires rainbow beams that change their behavior based on their color"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Excalibur"); + Tooltip.SetDefault("Freezes enemies and heals the player on hit\n" + + "Fires rainbow beams that change their behavior based on their color"); + } - public override void SetDefaults() - { - item.damage = BaseDamage; - item.crit += 10; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.useTurn = true; - item.melee = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.width = 92; - item.height = 92; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("ElementalExcaliburBeam"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 20; - } + public override void SetDefaults() + { + item.damage = BaseDamage; + item.crit += 10; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.useTurn = true; + item.melee = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.width = 92; + item.height = 92; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("ElementalExcaliburBeam"); + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 20; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(46f, 44f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/ElementalExcaliburGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(46f, 44f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/ElementalExcaliburGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, (float)BeamType, 0f); + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, (float)BeamType, 0f); - BeamType++; - if (BeamType > 11) - BeamType = 0; + BeamType++; + if (BeamType > 11) + BeamType = 0; - return false; - } + return false; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - Color color = new Color(255, 0, 0, alpha); - switch (BeamType) - { - case 0: // Red - break; - case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; - default: - break; - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + Color color = new Color(255, 0, 0, alpha); + switch (BeamType) + { + case 0: // Red + break; + case 1: // Orange + color = new Color(255, 128, 0, alpha); + break; + case 2: // Yellow + color = new Color(255, 255, 0, alpha); + break; + case 3: // Lime + color = new Color(128, 255, 0, alpha); + break; + case 4: // Green + color = new Color(0, 255, 0, alpha); + break; + case 5: // Turquoise + color = new Color(0, 255, 128, alpha); + break; + case 6: // Cyan + color = new Color(0, 255, 255, alpha); + break; + case 7: // Light Blue + color = new Color(0, 128, 255, alpha); + break; + case 8: // Blue + color = new Color(0, 0, 255, alpha); + break; + case 9: // Purple + color = new Color(128, 0, 255, alpha); + break; + case 10: // Fuschia + color = new Color(255, 0, 255, alpha); + break; + case 11: // Hot Pink + color = new Color(255, 0, 128, alpha); + break; + default: + break; + } - Dust dust24 = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, color, 1.2f)]; - dust24.noGravity = true; - } - } + Dust dust24 = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, color, 1.2f)]; + dust24.noGravity = true; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 60); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - target.AddBuff(mod.BuffType("GlacialState"), 240); - target.AddBuff(mod.BuffType("Plague"), 240); - target.AddBuff(mod.BuffType("HolyLight"), 240); - target.AddBuff(BuffID.CursedInferno, 240); - target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Ichor, 240); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - int healAmount = (Main.rand.Next(10) + 10); - player.statLife += healAmount; - player.HealEffect(healAmount); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 60); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + target.AddBuff(mod.BuffType("GlacialState"), 240); + target.AddBuff(mod.BuffType("Plague"), 240); + target.AddBuff(mod.BuffType("HolyLight"), 240); + target.AddBuff(BuffID.CursedInferno, 240); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Ichor, 240); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + int healAmount = (Main.rand.Next(10) + 10); + player.statLife += healAmount; + player.HealEffect(healAmount); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GreatswordofBlah"); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(ItemID.LargeDiamond, 3); - recipe.AddIngredient(ItemID.LightShard, 10); - recipe.AddIngredient(ItemID.DarkShard, 10); - recipe.AddIngredient(null, "LivingShard", 10); - recipe.AddIngredient(null, "GalacticaSingularity", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "CalamitousEssence", 10); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(null, "HellcasterFragment", 10); - recipe.AddIngredient(ItemID.SoulofLight, 50); - recipe.AddIngredient(ItemID.SoulofNight, 50); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GreatswordofBlah"); + recipe.AddIngredient(ItemID.TrueExcalibur); + recipe.AddIngredient(ItemID.LargeDiamond, 3); + recipe.AddIngredient(ItemID.LightShard, 10); + recipe.AddIngredient(ItemID.DarkShard, 10); + recipe.AddIngredient(null, "LivingShard", 10); + recipe.AddIngredient(null, "GalacticaSingularity", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "CalamitousEssence", 10); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(null, "HellcasterFragment", 10); + recipe.AddIngredient(ItemID.SoulofLight, 50); + recipe.AddIngredient(ItemID.SoulofNight, 50); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ElementalRay.cs b/Items/Weapons/ElementalRay.cs index 056b4d7ca0..3c332dd763 100644 --- a/Items/Weapons/ElementalRay.cs +++ b/Items/Weapons/ElementalRay.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ElementalRay : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Ray"); - Tooltip.SetDefault("Casts a rainbow ray that splits when enemies are near it"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Ray"); + Tooltip.SetDefault("Casts a rainbow ray that splits when enemies are near it"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 150; - item.magic = true; - item.mana = 18; - item.width = 62; - item.height = 62; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; + public override void SetDefaults() + { + item.damage = 150; + item.magic = true; + item.mana = 18; + item.width = 62; + item.height = 62; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementRay"); - item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementRay"); + item.shootSpeed = 6f; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "TerraRay"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "TerraRay"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ElementalShortsword.cs b/Items/Weapons/ElementalShortsword.cs index 9d5314c44f..a1d68f3713 100644 --- a/Items/Weapons/ElementalShortsword.cs +++ b/Items/Weapons/ElementalShortsword.cs @@ -6,68 +6,68 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ElementalShortsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Shiv"); - Tooltip.SetDefault("Don't underestimate the power of shivs\n" + - "Shoots a rainbow orb that spawns shivs at multiple locations"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Shiv"); + Tooltip.SetDefault("Don't underestimate the power of shivs\n" + + "Shoots a rainbow orb that spawns shivs at multiple locations"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 44; - item.height = 44; - item.damage = 180; - item.melee = true; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementBallShiv"); - item.shootSpeed = 14f; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 44; + item.height = 44; + item.damage = 180; + item.melee = true; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementBallShiv"); + item.shootSpeed = 14f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TerraShiv"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TerraShiv"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } } diff --git a/Items/Weapons/ElysianArrow.cs b/Items/Weapons/ElysianArrow.cs index 8ba8603ded..4919b9e9bf 100644 --- a/Items/Weapons/ElysianArrow.cs +++ b/Items/Weapons/ElysianArrow.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ElysianArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elysian Arrow"); - Tooltip.SetDefault("Summons meteors from the sky on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elysian Arrow"); + Tooltip.SetDefault("Summons meteors from the sky on death"); + } - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3f; - item.value = 2000; - item.shoot = mod.ProjectileType("ElysianArrow"); - item.shootSpeed = 10f; - item.ammo = 40; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 3f; + item.value = 2000; + item.shoot = mod.ProjectileType("ElysianArrow"); + item.shootSpeed = 10f; + item.ammo = 40; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddIngredient(ItemID.HolyArrow, 150); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(ItemID.HolyArrow, 150); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/EmpyreanKnives.cs b/Items/Weapons/EmpyreanKnives.cs index a9ffc51252..f31cf5d683 100644 --- a/Items/Weapons/EmpyreanKnives.cs +++ b/Items/Weapons/EmpyreanKnives.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Empyrean Knives"); - Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); - } + Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); + } public override void SetDefaults() { @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("EmpyreanKnives"); item.shootSpeed = 15f; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/EnergyStaff.cs b/Items/Weapons/EnergyStaff.cs index 40eaa8cd1e..f6e640e0a7 100644 --- a/Items/Weapons/EnergyStaff.cs +++ b/Items/Weapons/EnergyStaff.cs @@ -4,42 +4,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class EnergyStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Energy Staff"); - Tooltip.SetDefault("Summons a profaned energy turret to fight for you"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Staff"); + Tooltip.SetDefault("Summons a profaned energy turret to fight for you"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 170; - item.summon = true; - item.sentry = true; - item.mana = 25; - item.width = 66; - item.height = 68; - item.useTime = 38; - item.useAnimation = 38; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 170; + item.summon = true; + item.sentry = true; + item.mana = 25; + item.width = 66; + item.height = 68; + item.useTime = 38; + item.useAnimation = 38; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("ProfanedEnergy"); - item.Calamity().postMoonLordRarity = 12; - } + item.shoot = mod.ProjectileType("ProfanedEnergy"); + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { position = Main.MouseWorld; speedX = 0; speedY = 0; Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); player.UpdateMaxTurrets(); - return false; - } - } + return false; + } + } } diff --git a/Items/Weapons/EnhancedNanoRound.cs b/Items/Weapons/EnhancedNanoRound.cs index 66ce971a0c..f7f95c3415 100644 --- a/Items/Weapons/EnhancedNanoRound.cs +++ b/Items/Weapons/EnhancedNanoRound.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class EnhancedNanoRound : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Enhanced Nano Round"); - Tooltip.SetDefault("Confuses enemies and releases a cloud of nanites when enemies die"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enhanced Nano Round"); + Tooltip.SetDefault("Confuses enemies and releases a cloud of nanites when enemies die"); + } - public override void SetDefaults() - { - item.damage = 12; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 5.5f; - item.value = 500; - item.rare = 3; - item.shoot = mod.ProjectileType("EnhancedNanoRound"); - item.shootSpeed = 8f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 12; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 5.5f; + item.value = 500; + item.rare = 3; + item.shoot = mod.ProjectileType("EnhancedNanoRound"); + item.shootSpeed = 8f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NanoBullet, 250); - recipe.AddIngredient(null, "EssenceofEleum"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.NanoBullet, 250); + recipe.AddIngredient(null, "EssenceofEleum"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/EssenceFlayer.cs b/Items/Weapons/EssenceFlayer.cs index b73ae2c9c7..360bebd33b 100644 --- a/Items/Weapons/EssenceFlayer.cs +++ b/Items/Weapons/EssenceFlayer.cs @@ -7,66 +7,66 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class EssenceFlayer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence Flayer"); - Tooltip.SetDefault("Shoots an essence scythe that generates healing spirits on enemy kills"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Essence Flayer"); + Tooltip.SetDefault("Shoots an essence scythe that generates healing spirits on enemy kills"); + } - public override void SetDefaults() - { - item.width = 100; - item.damage = 450; - item.melee = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 78; + public override void SetDefaults() + { + item.width = 100; + item.damage = 450; + item.melee = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; + item.height = 78; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("EssenceScythe"); - item.shootSpeed = 21f; - item.Calamity().postMoonLordRarity = 14; - } + item.shootSpeed = 21f; + item.Calamity().postMoonLordRarity = 14; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(50f, 37f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/EssenceFlayerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(50f, 37f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/EssenceFlayerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 11); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 11); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 11); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 11); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + } } diff --git a/Items/Weapons/EvergladeSpray.cs b/Items/Weapons/EvergladeSpray.cs index 0ec5bee69a..64a475c949 100644 --- a/Items/Weapons/EvergladeSpray.cs +++ b/Items/Weapons/EvergladeSpray.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class EvergladeSpray : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Everglade Spray"); - Tooltip.SetDefault("Fires a stream of burning green ichor"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Everglade Spray"); + Tooltip.SetDefault("Fires a stream of burning green ichor"); + } - public override void SetDefaults() - { - item.damage = 28; - item.magic = true; - item.mana = 8; - item.width = 34; - item.height = 30; - item.useTime = 6; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; + public override void SetDefaults() + { + item.damage = 28; + item.magic = true; + item.mana = 8; + item.width = 34; + item.height = 30; + item.useTime = 6; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = mod.ProjectileType("EvergladeSprayProjectile"); - item.shootSpeed = 10f; - } + item.UseSound = SoundID.Item13; + item.autoReuse = true; + item.shoot = mod.ProjectileType("EvergladeSprayProjectile"); + item.shootSpeed = 10f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ichor, 20); - recipe.AddIngredient(null, "DraedonBar", 3); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ichor, 20); + recipe.AddIngredient(null, "DraedonBar", 3); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ExcaliburShortsword.cs b/Items/Weapons/ExcaliburShortsword.cs index 54b851ba52..8c3c9691c6 100644 --- a/Items/Weapons/ExcaliburShortsword.cs +++ b/Items/Weapons/ExcaliburShortsword.cs @@ -6,46 +6,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ExcaliburShortsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excalibur Shortsword"); - Tooltip.SetDefault("Don't underestimate the power of shortswords"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excalibur Shortsword"); + Tooltip.SetDefault("Don't underestimate the power of shortswords"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 40; - item.height = 40; - item.damage = 55; - item.melee = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 40; + item.height = 40; + item.damage = 55; + item.melee = true; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HallowedBar, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 57); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 57); + } + } + } } diff --git a/Items/Weapons/ExsanguinationLance.cs b/Items/Weapons/ExsanguinationLance.cs index 8339afd4c2..0d92493ba0 100644 --- a/Items/Weapons/ExsanguinationLance.cs +++ b/Items/Weapons/ExsanguinationLance.cs @@ -5,53 +5,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ExsanguinationLance : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exsanguination Lance"); - Tooltip.SetDefault("Explodes on enemy hits and summons homing flares on critical hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exsanguination Lance"); + Tooltip.SetDefault("Explodes on enemy hits and summons homing flares on critical hits"); + } - public override void SetDefaults() - { - item.width = 44; - item.damage = 77; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 5; - item.useTime = 22; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; + public override void SetDefaults() + { + item.width = 44; + item.damage = 77; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 5; + item.useTime = 22; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("ExsanguinationLanceProjectile"); - item.shootSpeed = 8f; - } + item.shoot = mod.ProjectileType("ExsanguinationLanceProjectile"); + item.shootSpeed = 8f; + } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Fabstaff.cs b/Items/Weapons/Fabstaff.cs index 752055d22b..bcf40c71eb 100644 --- a/Items/Weapons/Fabstaff.cs +++ b/Items/Weapons/Fabstaff.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Fabstaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fabstaff"); - Tooltip.SetDefault("Casts a bouncing beam that splits when enemies are near it\n" + - "The splitting can trigger long after the beam has vanished"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fabstaff"); + Tooltip.SetDefault("Casts a bouncing beam that splits when enemies are near it\n" + + "The splitting can trigger long after the beam has vanished"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 800; - item.magic = true; - item.mana = 50; - item.width = 84; - item.height = 84; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 800; + item.magic = true; + item.mana = 50; + item.width = 84; + item.height = 84; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FabRay"); - item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 18; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("FabRay"); + item.shootSpeed = 6f; + item.Calamity().postMoonLordRarity = 18; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddIngredient(null, "ShadowspecBar", 50); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddIngredient(null, "ShadowspecBar", 50); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FeralthornClaymore.cs b/Items/Weapons/FeralthornClaymore.cs index 1449f6d2b9..ab2c7525db 100644 --- a/Items/Weapons/FeralthornClaymore.cs +++ b/Items/Weapons/FeralthornClaymore.cs @@ -6,58 +6,58 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FeralthornClaymore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feralthorn Claymore"); - Tooltip.SetDefault("Summons thorns on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feralthorn Claymore"); + Tooltip.SetDefault("Summons thorns on enemy hits"); + } - public override void SetDefaults() - { - item.width = 68; - item.damage = 63; - item.melee = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.useTurn = true; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; + public override void SetDefaults() + { + item.width = 68; + item.damage = 63; + item.melee = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.useTurn = true; + item.knockBack = 7.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); - } - } + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); - } - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + for (int x = 0; x < 2; x++) + { + Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); + } + for (int x = 0; x < 2; x++) + { + Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); + } + } + } } diff --git a/Items/Weapons/FiniteUse/Bazooka.cs b/Items/Weapons/FiniteUse/Bazooka.cs index e17b78a4e4..d88c61066b 100644 --- a/Items/Weapons/FiniteUse/Bazooka.cs +++ b/Items/Weapons/FiniteUse/Bazooka.cs @@ -1,96 +1,96 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.FiniteUse { public class Bazooka : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bazooka"); - Tooltip.SetDefault("Uses Grenade Shells\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bazooka"); + Tooltip.SetDefault("Uses Grenade Shells\n" + "Does more damage to inorganic enemies\n" + - "Can be used twice per boss battle"); - } + "Can be used twice per boss battle"); + } - public override void SetDefaults() - { - item.damage = 500; - item.width = 66; - item.height = 26; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 10f; + public override void SetDefaults() + { + item.damage = 500; + item.width = 66; + item.height = 26; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 10f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/BazookaFull"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("GrenadeRound"); - item.useAmmo = mod.ItemType("GrenadeRounds"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 2; - } - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/BazookaFull"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("GrenadeRound"); + item.useAmmo = mod.ItemType("GrenadeRounds"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 2; + } + } - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 2; - } - return true; - } + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 2; + } + return true; + } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 2; - } + public override bool CanUseItem(Player player) + { + return item.Calamity().timesUsed < 2; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 0; - } - } + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 0; + } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].Calamity().timesUsed++; - } - } - } - return true; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].Calamity().timesUsed++; + } + } + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 20); recipe.anyIronBar = true; recipe.AddIngredient(ItemID.IllegalGunParts); recipe.AddIngredient(ItemID.AdamantiteBar, 15); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.SetResult(this); + recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.IronBar, 20); recipe.anyIronBar = true; @@ -100,5 +100,5 @@ namespace CalamityMod.Items.Weapons.FiniteUse recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Weapons/FiniteUse/ElephantKiller.cs b/Items/Weapons/FiniteUse/ElephantKiller.cs index 3fdacba176..3571e78554 100644 --- a/Items/Weapons/FiniteUse/ElephantKiller.cs +++ b/Items/Weapons/FiniteUse/ElephantKiller.cs @@ -1,97 +1,97 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.FiniteUse { public class ElephantKiller : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elephant Killer"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elephant Killer"); + Tooltip.SetDefault("Uses Magnum Rounds\n" + "Does more damage to organic enemies\n" + - "Can be used thrice per boss battle"); - } + "Can be used thrice per boss battle"); + } - public override void SetDefaults() - { - item.damage = 2000; + public override void SetDefaults() + { + item.damage = 2000; item.crit += 66; - item.width = 46; - item.height = 26; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; + item.width = 46; + item.height = 26; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnumRound"); - item.useAmmo = mod.ItemType("MagnumRounds"); - item.Calamity().postMoonLordRarity = 12; - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 3; - } - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnumRound"); + item.useAmmo = mod.ItemType("MagnumRounds"); + item.Calamity().postMoonLordRarity = 12; + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 3; + } + } - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 3; - } - return true; - } + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 3; + } + return true; + } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 3; - } + public override bool CanUseItem(Player player) + { + return item.Calamity().timesUsed < 3; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 0; - } - } + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 0; + } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].Calamity().timesUsed++; - } - } - } - return true; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].Calamity().timesUsed++; + } + } + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "LightningHawk"); recipe.AddIngredient(ItemID.LunarBar, 30); recipe.AddIngredient(ItemID.IllegalGunParts); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FiniteUse/ExplosiveShells.cs b/Items/Weapons/FiniteUse/ExplosiveShells.cs index f7bbc09dbe..a4111b481b 100644 --- a/Items/Weapons/FiniteUse/ExplosiveShells.cs +++ b/Items/Weapons/FiniteUse/ExplosiveShells.cs @@ -3,25 +3,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.FiniteUse { public class ExplosiveShells : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosive Shotgun Shell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Shotgun Shell"); + } - public override void SetDefaults() - { - item.damage = 30; - item.width = 18; - item.height = 18; - item.maxStack = 6; - item.consumable = true; - item.knockBack = 10f; - item.value = 15000; - item.rare = 8; - item.shoot = mod.ProjectileType("ExplosiveShellBullet"); - item.shootSpeed = 12f; - item.ammo = mod.ItemType("ExplosiveShells"); - } - } + public override void SetDefaults() + { + item.damage = 30; + item.width = 18; + item.height = 18; + item.maxStack = 6; + item.consumable = true; + item.knockBack = 10f; + item.value = 15000; + item.rare = 8; + item.shoot = mod.ProjectileType("ExplosiveShellBullet"); + item.shootSpeed = 12f; + item.ammo = mod.ItemType("ExplosiveShells"); + } + } } diff --git a/Items/Weapons/FiniteUse/GrenadeRounds.cs b/Items/Weapons/FiniteUse/GrenadeRounds.cs index 1988e53047..16e464b66c 100644 --- a/Items/Weapons/FiniteUse/GrenadeRounds.cs +++ b/Items/Weapons/FiniteUse/GrenadeRounds.cs @@ -3,25 +3,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.FiniteUse { public class GrenadeRounds : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grenade Shells"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grenade Shells"); + } - public override void SetDefaults() - { - item.damage = 200; - item.width = 18; - item.height = 18; - item.maxStack = 9; - item.consumable = true; - item.knockBack = 10f; - item.value = 15000; - item.rare = 8; - item.shoot = mod.ProjectileType("GrenadeRound"); - item.shootSpeed = 12f; - item.ammo = mod.ItemType("GrenadeRounds"); - } - } + public override void SetDefaults() + { + item.damage = 200; + item.width = 18; + item.height = 18; + item.maxStack = 9; + item.consumable = true; + item.knockBack = 10f; + item.value = 15000; + item.rare = 8; + item.shoot = mod.ProjectileType("GrenadeRound"); + item.shootSpeed = 12f; + item.ammo = mod.ItemType("GrenadeRounds"); + } + } } diff --git a/Items/Weapons/FiniteUse/Hydra.cs b/Items/Weapons/FiniteUse/Hydra.cs index 3fe1041a2c..5e833a529c 100644 --- a/Items/Weapons/FiniteUse/Hydra.cs +++ b/Items/Weapons/FiniteUse/Hydra.cs @@ -1,103 +1,103 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.FiniteUse { public class Hydra : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hydra"); - Tooltip.SetDefault("Uses Explosive Shotgun Shells\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydra"); + Tooltip.SetDefault("Uses Explosive Shotgun Shells\n" + "Does more damage to everything\n" + - "Can be used once per boss battle"); - } + "Can be used once per boss battle"); + } - public override void SetDefaults() - { - item.damage = 120; - item.width = 66; - item.height = 30; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 10f; + public override void SetDefaults() + { + item.damage = 120; + item.width = 66; + item.height = 30; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 10f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Hydra"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("ExplosiveShellBullet"); - item.useAmmo = mod.ItemType("ExplosiveShells"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 1; - } - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Hydra"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("ExplosiveShellBullet"); + item.useAmmo = mod.ItemType("ExplosiveShells"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 1; + } + } - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 1; - } - return true; - } + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 1; + } + return true; + } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 1; - } + public override bool CanUseItem(Player player) + { + return item.Calamity().timesUsed < 1; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 0; - } - } + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 0; + } + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 15; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-65, 66) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-65, 66) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].Calamity().timesUsed++; - } - } - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int index = 0; index < 15; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-65, 66) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-65, 66) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].Calamity().timesUsed++; + } + } + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(ItemID.IronBar, 20); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.Ectoplasm, 20); + recipe.AddIngredient(ItemID.IronBar, 20); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddIngredient(ItemID.Ectoplasm, 20); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FiniteUse/LightningHawk.cs b/Items/Weapons/FiniteUse/LightningHawk.cs index fc426ee13d..b8e4b23597 100644 --- a/Items/Weapons/FiniteUse/LightningHawk.cs +++ b/Items/Weapons/FiniteUse/LightningHawk.cs @@ -1,90 +1,90 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.FiniteUse { public class LightningHawk : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lightning Hawk"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lightning Hawk"); + Tooltip.SetDefault("Uses Magnum Rounds\n" + "Does more damage to organic enemies\n" + - "Can be used thrice per boss battle"); - } + "Can be used thrice per boss battle"); + } - public override void SetDefaults() - { - item.damage = 400; + public override void SetDefaults() + { + item.damage = 400; item.crit += 56; - item.width = 50; - item.height = 28; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; + item.width = 50; + item.height = 28; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnumRound"); - item.useAmmo = mod.ItemType("MagnumRounds"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 3; - } - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnumRound"); + item.useAmmo = mod.ItemType("MagnumRounds"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 3; + } + } - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 3; - } - return true; - } + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 3; + } + return true; + } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 3; - } + public override bool CanUseItem(Player player) + { + return item.Calamity().timesUsed < 3; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 0; - } - } + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 0; + } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].Calamity().timesUsed++; - } - } - } - return true; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].Calamity().timesUsed++; + } + } + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "Magnum"); recipe.AddIngredient(ItemID.SoulofMight, 20); recipe.AddIngredient(ItemID.SoulofSight, 20); @@ -92,8 +92,8 @@ namespace CalamityMod.Items.Weapons.FiniteUse recipe.AddIngredient(ItemID.IllegalGunParts); recipe.AddIngredient(ItemID.HallowedBar, 10); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FiniteUse/Magnum.cs b/Items/Weapons/FiniteUse/Magnum.cs index d23e3fade1..bfe36352b8 100644 --- a/Items/Weapons/FiniteUse/Magnum.cs +++ b/Items/Weapons/FiniteUse/Magnum.cs @@ -1,97 +1,97 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.FiniteUse { public class Magnum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnum"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnum"); + Tooltip.SetDefault("Uses Magnum Rounds\n" + "Does more damage to organic enemies\n" + - "Can be used thrice per boss battle"); - } + "Can be used thrice per boss battle"); + } - public override void SetDefaults() - { - item.damage = 80; + public override void SetDefaults() + { + item.damage = 80; item.crit += 46; - item.width = 46; - item.height = 24; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; + item.width = 46; + item.height = 24; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnumRound"); - item.useAmmo = mod.ItemType("MagnumRounds"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 3; - } - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnumRound"); + item.useAmmo = mod.ItemType("MagnumRounds"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 3; + } + } - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 3; - } - return true; - } + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 3; + } + return true; + } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 3; - } + public override bool CanUseItem(Player player) + { + return item.Calamity().timesUsed < 3; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.Calamity().timesUsed = 0; - } - } + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.Calamity().timesUsed = 0; + } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].Calamity().timesUsed++; - } - } - } - return true; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].Calamity().timesUsed++; + } + } + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.FlintlockPistol); recipe.AddIngredient(ItemID.IronBar, 10); recipe.anyIronBar = true; recipe.AddIngredient(ItemID.Diamond, 5); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FiniteUse/MagnumRounds.cs b/Items/Weapons/FiniteUse/MagnumRounds.cs index 68e4e77379..b8fa490456 100644 --- a/Items/Weapons/FiniteUse/MagnumRounds.cs +++ b/Items/Weapons/FiniteUse/MagnumRounds.cs @@ -3,26 +3,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.FiniteUse { public class MagnumRounds : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnum Rounds"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnum Rounds"); + } - public override void SetDefaults() - { - item.damage = 80; + public override void SetDefaults() + { + item.damage = 80; item.crit += 4; item.width = 18; - item.height = 18; - item.maxStack = 12; - item.consumable = true; - item.knockBack = 8f; - item.value = 10000; - item.rare = 8; - item.shoot = mod.ProjectileType("MagnumRound"); - item.shootSpeed = 12f; - item.ammo = mod.ItemType("MagnumRounds"); - } - } + item.height = 18; + item.maxStack = 12; + item.consumable = true; + item.knockBack = 8f; + item.value = 10000; + item.rare = 8; + item.shoot = mod.ProjectileType("MagnumRound"); + item.shootSpeed = 12f; + item.ammo = mod.ItemType("MagnumRounds"); + } + } } diff --git a/Items/Weapons/FirestormCannon.cs b/Items/Weapons/FirestormCannon.cs index 1231f3592e..8f35b37372 100644 --- a/Items/Weapons/FirestormCannon.cs +++ b/Items/Weapons/FirestormCannon.cs @@ -1,102 +1,101 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class FirestormCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Firestorm Cannon"); - Tooltip.SetDefault("70% chance to not consume flares\n" + - "Right click to fire a spread of flares"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Firestorm Cannon"); + Tooltip.SetDefault("70% chance to not consume flares\n" + + "Right click to fire a spread of flares"); + } - public override void SetDefaults() - { - item.damage = 18; - item.ranged = true; - item.width = 56; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; + public override void SetDefaults() + { + item.damage = 18; + item.ranged = true; + item.width = 56; + item.height = 28; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 163; - item.shootSpeed = 5.5f; - item.useAmmo = 931; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 163; + item.shootSpeed = 5.5f; + item.useAmmo = 931; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 70) + return false; + return true; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 27; - item.useAnimation = 27; - } - else - { - item.useTime = 9; - item.useAnimation = 9; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 27; + item.useAnimation = 27; + } + else + { + item.useTime = 9; + item.useAnimation = 9; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[flare].penetrate = 1; - Main.projectile[flare].timeLeft = 600; - Main.projectile[flare].Calamity().forceRanged = true; - } - return false; - } - else - { - int num6 = Main.rand.Next(1, 3); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].Calamity().forceRanged = true; - Main.projectile[projectile].timeLeft = 200; - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + int num6 = Main.rand.Next(4, 6); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; + int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[flare].penetrate = 1; + Main.projectile[flare].timeLeft = 600; + Main.projectile[flare].Calamity().forceRanged = true; + } + return false; + } + else + { + int num6 = Main.rand.Next(1, 3); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].Calamity().forceRanged = true; + Main.projectile[projectile].timeLeft = 200; + } + return false; + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.FlareGun); recipe.AddIngredient(ItemID.Boomstick); recipe.AddIngredient(ItemID.GoldBar, 10); @@ -112,6 +111,6 @@ namespace CalamityMod.Items.Weapons recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/FlameScytheMelee.cs b/Items/Weapons/FlameScytheMelee.cs index e3748f51ce..112ba9b5e7 100644 --- a/Items/Weapons/FlameScytheMelee.cs +++ b/Items/Weapons/FlameScytheMelee.cs @@ -5,40 +5,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FlameScytheMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame Scythe"); - Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame Scythe"); + Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); + } - public override void SetDefaults() - { - item.width = 50; - item.damage = 130; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 48; + public override void SetDefaults() + { + item.width = 50; + item.damage = 130; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 48; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("FlameScytheProjectileMelee"); - item.shootSpeed = 16f; - } + item.shoot = mod.ProjectileType("FlameScytheProjectileMelee"); + item.shootSpeed = 16f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FlameburstShortsword.cs b/Items/Weapons/FlameburstShortsword.cs index 68290b6e6d..95d8c3b586 100644 --- a/Items/Weapons/FlameburstShortsword.cs +++ b/Items/Weapons/FlameburstShortsword.cs @@ -2,60 +2,59 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class FlameburstShortsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flameburst Shortsword"); - Tooltip.SetDefault("Enemies explode on hit when below half life"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flameburst Shortsword"); + Tooltip.SetDefault("Enemies explode on hit when below half life"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 30; - item.height = 30; - item.damage = 35; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 30; + item.height = 30; + item.damage = 35; + item.melee = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 7); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= (target.lifeMax * 0.5f)) - { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= (target.lifeMax * 0.5f)) + { + int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceMelee = true; + } + } + } } diff --git a/Items/Weapons/FlareBolt.cs b/Items/Weapons/FlareBolt.cs index f222c7d594..45635bc438 100644 --- a/Items/Weapons/FlareBolt.cs +++ b/Items/Weapons/FlareBolt.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FlareBolt : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Bolt"); - Tooltip.SetDefault("Casts a slow-moving ball of flame"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Bolt"); + Tooltip.SetDefault("Casts a slow-moving ball of flame"); + } - public override void SetDefaults() - { - item.damage = 27; - item.magic = true; - item.mana = 12; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 27; + item.magic = true; + item.mana = 12; + item.width = 28; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlareBoltProjectile"); - item.shootSpeed = 7.5f; - } + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlareBoltProjectile"); + item.shootSpeed = 7.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 6); - recipe.AddIngredient(ItemID.Obsidian, 9); - recipe.AddIngredient(ItemID.Fireblossom, 2); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 6); + recipe.AddIngredient(ItemID.Obsidian, 9); + recipe.AddIngredient(ItemID.Fireblossom, 2); + recipe.AddIngredient(ItemID.LavaBucket); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FlarefrostBlade.cs b/Items/Weapons/FlarefrostBlade.cs index 81c67b830b..1168ca1d40 100644 --- a/Items/Weapons/FlarefrostBlade.cs +++ b/Items/Weapons/FlarefrostBlade.cs @@ -6,64 +6,64 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FlarefrostBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flarefrost Blade"); - Tooltip.SetDefault("Fires a homing flarefrost orb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flarefrost Blade"); + Tooltip.SetDefault("Fires a homing flarefrost orb"); + } - public override void SetDefaults() - { - item.width = 66; - item.damage = 65; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; + public override void SetDefaults() + { + item.width = 66; + item.damage = 65; + item.melee = true; + item.useAnimation = 24; + item.useTime = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("Flarefrost"); - item.shootSpeed = 11f; - } + item.shoot = mod.ProjectileType("Flarefrost"); + item.shootSpeed = 11f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 8); - recipe.AddIngredient(ItemID.HellstoneBar, 8); - recipe.AddIngredient(ItemID.HallowedBar, 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 8); + recipe.AddIngredient(ItemID.HellstoneBar, 8); + recipe.AddIngredient(ItemID.HallowedBar, 4); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustChoice = Main.rand.Next(2); - if (dustChoice == 0) - { - dustChoice = 67; - } - else - { - dustChoice = 6; - } - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustChoice); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int dustChoice = Main.rand.Next(2); + if (dustChoice == 0) + { + dustChoice = 67; + } + else + { + dustChoice = 6; + } + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustChoice); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); + } + } } diff --git a/Items/Weapons/FlarewingBow.cs b/Items/Weapons/FlarewingBow.cs index a93b6465ea..358cf719e2 100644 --- a/Items/Weapons/FlarewingBow.cs +++ b/Items/Weapons/FlarewingBow.cs @@ -6,75 +6,75 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FlarewingBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flarewing Bow"); - Tooltip.SetDefault("Shoots a spread of arrows\n" + - "Wooden arrows are converted to bouncing obsidian bats"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flarewing Bow"); + Tooltip.SetDefault("Shoots a spread of arrows\n" + + "Wooden arrows are converted to bouncing obsidian bats"); + } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 20; - item.height = 62; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 16f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 20; + item.height = 62; + item.useTime = 28; + item.useAnimation = 28; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 16f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 5; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 50f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - if (type == ProjectileID.WoodenArrowFriendly) - { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("FlareBat"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num123].noDropItem = true; - } - else - { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.66), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num123].noDropItem = true; - } - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 5; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 50f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + if (type == ProjectileID.WoodenArrowFriendly) + { + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("FlareBat"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num123].noDropItem = true; + } + else + { + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.66), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num123].noDropItem = true; + } + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellwingBow); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddIngredient(ItemID.LivingFireBlock, 50); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellwingBow); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddIngredient(ItemID.LivingFireBlock, 50); + recipe.AddIngredient(ItemID.Obsidian, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FlashBullet.cs b/Items/Weapons/FlashBullet.cs index 47cf1917dd..fb9f9db501 100644 --- a/Items/Weapons/FlashBullet.cs +++ b/Items/Weapons/FlashBullet.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FlashBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flash Round"); - Tooltip.SetDefault("Gives off a concussive blast that confuses enemies in a large area for a short time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flash Round"); + Tooltip.SetDefault("Gives off a concussive blast that confuses enemies in a large area for a short time"); + } - public override void SetDefaults() - { - item.damage = 7; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.15f; - item.value = 250; - item.rare = 1; - item.shoot = mod.ProjectileType("FlashBullet"); - item.shootSpeed = 12f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 7; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.15f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("FlashBullet"); + item.shootSpeed = 12f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Glass, 3); - recipe.AddIngredient(ItemID.Grenade); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 10); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Glass, 3); + recipe.AddIngredient(ItemID.Grenade); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 10); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Floodtide.cs b/Items/Weapons/Floodtide.cs index f086147567..257730d135 100644 --- a/Items/Weapons/Floodtide.cs +++ b/Items/Weapons/Floodtide.cs @@ -2,17 +2,16 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class Floodtide : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Floodtide"); - Tooltip.SetDefault("Launches sharks, because sharks are awesome!"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Floodtide"); + Tooltip.SetDefault("Launches sharks, because sharks are awesome!"); + } public override void SetDefaults() { @@ -22,7 +21,7 @@ namespace CalamityMod.Items.Weapons item.height = 64; item.useTime = 23; item.useAnimation = 23; - item.useTurn = true; + item.useTurn = true; item.useStyle = 1; item.knockBack = 6f; item.value = Item.buyPrice(0, 60, 0, 0); @@ -35,14 +34,14 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - return false; + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + return false; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -54,27 +53,27 @@ namespace CalamityMod.Items.Weapons } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 5); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(ItemID.AdamantiteBar, 5); + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 5); + recipe.AddIngredient(ItemID.SharkFin, 2); + recipe.AddIngredient(ItemID.AdamantiteBar, 5); recipe.AddIngredient(null, "DepthCells", 10); recipe.AddIngredient(null, "Lumenite", 10); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 5); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(ItemID.TitaniumBar, 5); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 5); + recipe.AddIngredient(ItemID.SharkFin, 2); + recipe.AddIngredient(ItemID.TitaniumBar, 5); recipe.AddIngredient(null, "DepthCells", 10); recipe.AddIngredient(null, "Lumenite", 10); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/ForbiddenOathblade.cs b/Items/Weapons/ForbiddenOathblade.cs index 3e54735592..538f31e98d 100644 --- a/Items/Weapons/ForbiddenOathblade.cs +++ b/Items/Weapons/ForbiddenOathblade.cs @@ -6,102 +6,102 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ForbiddenOathblade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Forbidden Oathblade"); - Tooltip.SetDefault("Fires a demonic scythe and critical hits cause shadowflame explosions"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Forbidden Oathblade"); + Tooltip.SetDefault("Fires a demonic scythe and critical hits cause shadowflame explosions"); + } - public override void SetDefaults() - { - item.width = 76; - item.damage = 64; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 76; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("Oathblade"); - item.shootSpeed = 3f; - } + public override void SetDefaults() + { + item.width = 76; + item.damage = 64; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 76; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("Oathblade"); + item.shootSpeed = 3f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BladecrestOathsword"); - recipe.AddIngredient(null, "OldLordOathsword"); - recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BladecrestOathsword"); + recipe.AddIngredient(null, "OldLordOathsword"); + recipe.AddIngredient(ItemID.SoulofFright, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 240); - target.AddBuff(BuffID.OnFire, 240); - if (crit) - { - target.AddBuff(BuffID.ShadowFlame, 720); - target.AddBuff(BuffID.OnFire, 720); - player.ApplyDamageToNPC(target, damage * 2, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 4.5f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 3f; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 240); + target.AddBuff(BuffID.OnFire, 240); + if (crit) + { + target.AddBuff(BuffID.ShadowFlame, 720); + target.AddBuff(BuffID.OnFire, 720); + player.ApplyDamageToNPC(target, damage * 2, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 4.5f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 3f; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 1.5f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } + } } diff --git a/Items/Weapons/ForbiddenSun.cs b/Items/Weapons/ForbiddenSun.cs index 79ca70edae..7a7cb0c49f 100644 --- a/Items/Weapons/ForbiddenSun.cs +++ b/Items/Weapons/ForbiddenSun.cs @@ -5,40 +5,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ForbiddenSun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Forbidden Sun"); - Tooltip.SetDefault("Casts a fire orb that emits a gigantic explosion on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Forbidden Sun"); + Tooltip.SetDefault("Casts a fire orb that emits a gigantic explosion on death"); + } - public override void SetDefaults() - { - item.damage = 80; - item.magic = true; - item.mana = 33; - item.width = 28; - item.height = 30; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 80; + item.magic = true; + item.mana = 33; + item.width = 28; + item.height = 30; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ForbiddenSunProjectile"); - item.shootSpeed = 9f; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("ForbiddenSunProjectile"); + item.shootSpeed = 9f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 6); - recipe.AddIngredient(ItemID.LivingFireBlock, 50); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 6); + recipe.AddIngredient(ItemID.LivingFireBlock, 50); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ForsakenSaber.cs b/Items/Weapons/ForsakenSaber.cs index af0cbbbfe4..873e3e5606 100644 --- a/Items/Weapons/ForsakenSaber.cs +++ b/Items/Weapons/ForsakenSaber.cs @@ -6,54 +6,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ForsakenSaber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Forsaken Saber"); - Tooltip.SetDefault("Shoots a sand blade that alters its velocity as it travels"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Forsaken Saber"); + Tooltip.SetDefault("Shoots a sand blade that alters its velocity as it travels"); + } - public override void SetDefaults() - { - item.width = 54; - item.damage = 65; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 52; + public override void SetDefaults() + { + item.width = 54; + item.damage = 65; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 52; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("SandBlade"); - item.shootSpeed = 5f; - } + item.shoot = mod.ProjectileType("SandBlade"); + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.AdamantiteBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.TitaniumBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.AdamantiteBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.TitaniumBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 159); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 159); + } + } + } } diff --git a/Items/Weapons/FourSeasonsGalaxia.cs b/Items/Weapons/FourSeasonsGalaxia.cs index f4b971d5d5..f4400b8b04 100644 --- a/Items/Weapons/FourSeasonsGalaxia.cs +++ b/Items/Weapons/FourSeasonsGalaxia.cs @@ -6,145 +6,145 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FourSeasonsGalaxia : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galaxia"); - Tooltip.SetDefault("Fires homing projectiles that inflict different debuffs depending on what biome you're in\n" + - "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + - "Projectiles also change based on moon events"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galaxia"); + Tooltip.SetDefault("Fires homing projectiles that inflict different debuffs depending on what biome you're in\n" + + "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + + "Projectiles also change based on moon events"); + } - public override void SetDefaults() - { - item.width = 70; - item.damage = 425; - item.melee = true; - item.useAnimation = 17; - item.useTime = 17; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 9; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 70; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Galaxia"); - item.shootSpeed = 24f; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.width = 70; + item.damage = 425; + item.melee = true; + item.useAnimation = 17; + item.useTime = 17; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 9; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 70; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Galaxia"); + item.shootSpeed = 24f; + item.Calamity().postMoonLordRarity = 14; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "OmegaBiomeBlade"); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "OmegaBiomeBlade"); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 0); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 0); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - player.AddBuff(BuffID.Thorns, 600); - } - else if (snow) - { - player.AddBuff(BuffID.Warmth, 600); - } - else if (beach) - { - player.AddBuff(BuffID.Wet, 600); - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - } - else if (dungeon) - { - player.AddBuff(BuffID.Dangersense, 600); - } - else if (desert) - { - player.AddBuff(BuffID.Endurance, 600); - } - else if (glow) - { - player.AddBuff(BuffID.Spelunker, 600); - } - else if (hell) - { - player.AddBuff(BuffID.Inferno, 600); - } - else if (holy) - { - player.AddBuff(BuffID.Heartreach, 600); - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - } - else - { - player.AddBuff(BuffID.DryadsWard, 600); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + player.AddBuff(BuffID.Thorns, 600); + } + else if (snow) + { + player.AddBuff(BuffID.Warmth, 600); + } + else if (beach) + { + player.AddBuff(BuffID.Wet, 600); + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + } + else if (dungeon) + { + player.AddBuff(BuffID.Dangersense, 600); + } + else if (desert) + { + player.AddBuff(BuffID.Endurance, 600); + } + else if (glow) + { + player.AddBuff(BuffID.Spelunker, 600); + } + else if (hell) + { + player.AddBuff(BuffID.Inferno, 600); + } + else if (holy) + { + player.AddBuff(BuffID.Heartreach, 600); + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + } + else + { + player.AddBuff(BuffID.DryadsWard, 600); + } + } + } } diff --git a/Items/Weapons/FrigidflashBolt.cs b/Items/Weapons/FrigidflashBolt.cs index a00781dd53..9b39343d0e 100644 --- a/Items/Weapons/FrigidflashBolt.cs +++ b/Items/Weapons/FrigidflashBolt.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FrigidflashBolt : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frigidflash Bolt"); - Tooltip.SetDefault("Casts a slow-moving ball of flash-freezing magma"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frigidflash Bolt"); + Tooltip.SetDefault("Casts a slow-moving ball of flash-freezing magma"); + } - public override void SetDefaults() - { - item.damage = 45; - item.magic = true; - item.mana = 13; - item.width = 28; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 45; + item.magic = true; + item.mana = 13; + item.width = 28; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FrigidflashBoltProjectile"); - item.shootSpeed = 6.5f; - } + item.UseSound = SoundID.Item21; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FrigidflashBoltProjectile"); + item.shootSpeed = 6.5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FrostBolt"); - recipe.AddIngredient(null, "FlareBolt"); - recipe.AddIngredient(null, "EssenceofEleum", 2); - recipe.AddIngredient(null, "EssenceofChaos", 2); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FrostBolt"); + recipe.AddIngredient(null, "FlareBolt"); + recipe.AddIngredient(null, "EssenceofEleum", 2); + recipe.AddIngredient(null, "EssenceofChaos", 2); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FrostBolt.cs b/Items/Weapons/FrostBolt.cs index 12ce9d2500..7c8769eeed 100644 --- a/Items/Weapons/FrostBolt.cs +++ b/Items/Weapons/FrostBolt.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FrostBolt : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Bolt"); - Tooltip.SetDefault("Casts a slow-moving ball of frost"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Bolt"); + Tooltip.SetDefault("Casts a slow-moving ball of frost"); + } - public override void SetDefaults() - { - item.damage = 12; - item.magic = true; - item.mana = 6; - item.width = 28; - item.height = 30; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 12; + item.magic = true; + item.mana = 6; + item.width = 28; + item.height = 30; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FrostBoltProjectile"); - item.shootSpeed = 6f; - } + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FrostBoltProjectile"); + item.shootSpeed = 6f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IceBlock, 20); - recipe.AddIngredient(ItemID.Shiverthorn, 2); - recipe.AddIngredient(ItemID.SnowBlock, 10); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IceBlock, 20); + recipe.AddIngredient(ItemID.Shiverthorn, 2); + recipe.AddIngredient(ItemID.SnowBlock, 10); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FrostsparkBullet.cs b/Items/Weapons/FrostsparkBullet.cs index c663e278ab..f890a457e5 100644 --- a/Items/Weapons/FrostsparkBullet.cs +++ b/Items/Weapons/FrostsparkBullet.cs @@ -4,38 +4,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FrostsparkBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frostspark Bullet"); - Tooltip.SetDefault("Has a chance to freeze enemies and explode into electricity\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frostspark Bullet"); + Tooltip.SetDefault("Has a chance to freeze enemies and explode into electricity\n" + "Enemies that are immune to being frozen take more damage from these bullets"); - } + } - public override void SetDefaults() - { - item.damage = 11; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 600; - item.rare = 3; - item.shoot = mod.ProjectileType("FrostsparkBullet"); - item.shootSpeed = 14f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 11; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 600; + item.rare = 3; + item.shoot = mod.ProjectileType("FrostsparkBullet"); + item.shootSpeed = 14f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(null, "CryoBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 150); + recipe.AddIngredient(null, "CryoBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/FulgurationHalberd.cs b/Items/Weapons/FulgurationHalberd.cs index a12aa3bfcd..125f2f80db 100644 --- a/Items/Weapons/FulgurationHalberd.cs +++ b/Items/Weapons/FulgurationHalberd.cs @@ -5,85 +5,85 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class FulgurationHalberd : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fulguration Halberd"); - Tooltip.SetDefault("Inflicts burning blood on enemy hits\n" + - "Right click to use as a spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fulguration Halberd"); + Tooltip.SetDefault("Inflicts burning blood on enemy hits\n" + + "Right click to use as a spear"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 53; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; + public override void SetDefaults() + { + item.width = 60; + item.damage = 53; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.shootSpeed = 6f; - } + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = 5; - item.autoReuse = false; + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noMelee = true; + item.noUseGraphic = true; + item.useStyle = 5; + item.autoReuse = false; item.shoot = mod.ProjectileType("FulgurationHalberd"); - } - else - { - item.noMelee = false; - item.noUseGraphic = false; - item.useStyle = 1; - item.autoReuse = true; + } + else + { + item.noMelee = false; + item.noUseGraphic = false; + item.useStyle = 1; + item.autoReuse = true; item.shoot = 0; - } - return base.CanUseItem(player); - } + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("FulgurationHalberd"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("FulgurationHalberd"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BurningBlood"), 300); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BurningBlood"), 300); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(ItemID.OrichalcumHalberd); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(ItemID.MythrilHalberd); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ItemID.OrichalcumHalberd); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ItemID.MythrilHalberd); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GalacticaBlade.cs b/Items/Weapons/GalacticaBlade.cs index db38230e9f..c5f2ced691 100644 --- a/Items/Weapons/GalacticaBlade.cs +++ b/Items/Weapons/GalacticaBlade.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,112 +7,112 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GalacticaBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galactus Blade"); - Tooltip.SetDefault("Forged with the fury of nuclear chaos\n" + - "Launches a barrage of comets from the sky"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galactus Blade"); + Tooltip.SetDefault("Forged with the fury of nuclear chaos\n" + + "Launches a barrage of comets from the sky"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 110; - item.melee = true; - item.useAnimation = 17; - item.useStyle = 1; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.height = 58; + public override void SetDefaults() + { + item.width = 60; + item.damage = 110; + item.melee = true; + item.useAnimation = 17; + item.useStyle = 1; + item.useTime = 17; + item.useTurn = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item105; + item.autoReuse = true; + item.height = 58; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("GalacticaComet"); - item.shootSpeed = 23f; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 23f; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StarWrath); - recipe.AddIngredient(ItemID.SoulofMight, 20); - recipe.AddIngredient(null, "DivineGeode", 10); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.DarkShard); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StarWrath); + recipe.AddIngredient(ItemID.SoulofMight, 20); + recipe.AddIngredient(null, "DivineGeode", 10); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(ItemID.DarkShard); + recipe.AddIngredient(ItemID.LightShard); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 5; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-100, 101) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-100, 101) * 0.02f; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalacticaComet"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 5; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-100, 101) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-100, 101) * 0.02f; + int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalacticaComet"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + return false; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 164 : 229)); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 164 : 229)); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } } diff --git a/Items/Weapons/GalaxySmasherMelee.cs b/Items/Weapons/GalaxySmasherMelee.cs index f109e26c91..6d41940cb2 100644 --- a/Items/Weapons/GalaxySmasherMelee.cs +++ b/Items/Weapons/GalaxySmasherMelee.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -44,8 +43,8 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; + Main.projectile[proj].Calamity().forceMelee = true; + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Galeforce.cs b/Items/Weapons/Galeforce.cs index a150dcf333..615a9db3f2 100644 --- a/Items/Weapons/Galeforce.cs +++ b/Items/Weapons/Galeforce.cs @@ -6,53 +6,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Galeforce : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galeforce"); - Tooltip.SetDefault("Fires a spread of low-damage feathers"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galeforce"); + Tooltip.SetDefault("Fires a spread of low-damage feathers"); + } - public override void SetDefaults() - { - item.damage = 18; - item.ranged = true; - item.width = 32; - item.height = 52; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 18; + item.ranged = true; + item.width = 32; + item.height = 52; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(4); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X * 0.75f, perturbedSpeed.Y * 0.75f, mod.ProjectileType("FeatherLarge"), (int)((double)damage * 0.25), 0f, player.whoAmI, 0f, 0f); - } - return true; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(4); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X * 0.75f, perturbedSpeed.Y * 0.75f, mod.ProjectileType("FeatherLarge"), (int)((double)damage * 0.25), 0f, player.whoAmI, 0f, 0f); + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 8); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 8); + recipe.AddIngredient(ItemID.SunplateBlock, 3); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GammaFusillade.cs b/Items/Weapons/GammaFusillade.cs index 6ac9ce5644..155176ddff 100644 --- a/Items/Weapons/GammaFusillade.cs +++ b/Items/Weapons/GammaFusillade.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GammaFusillade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Biofusillade"); - Tooltip.SetDefault("Unleashes a concentrated beam of life energy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Biofusillade"); + Tooltip.SetDefault("Unleashes a concentrated beam of life energy"); + } - public override void SetDefaults() - { - item.damage = 110; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; + public override void SetDefaults() + { + item.damage = 110; + item.magic = true; + item.mana = 4; + item.width = 28; + item.height = 30; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GammaLaser"); - item.shootSpeed = 20f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("GammaLaser"); + item.shootSpeed = 20f; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 8); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 8); + recipe.AddIngredient(ItemID.SpellTome); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Genisis.cs b/Items/Weapons/Genisis.cs index c4c1dabe86..1a48fecc09 100644 --- a/Items/Weapons/Genisis.cs +++ b/Items/Weapons/Genisis.cs @@ -6,62 +6,62 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Genisis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Genisis"); - Tooltip.SetDefault("Fires a Y-shaped beam of destructive energy and a spread of lasers"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Genisis"); + Tooltip.SetDefault("Fires a Y-shaped beam of destructive energy and a spread of lasers"); + } - public override void SetDefaults() - { - item.damage = 65; - item.magic = true; - item.mana = 4; - item.width = 74; - item.height = 28; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; + public override void SetDefaults() + { + item.damage = 65; + item.magic = true; + item.mana = 4; + item.width = 74; + item.height = 28; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("BigBeamofDeath"); - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("BigBeamofDeath"); + item.Calamity().postMoonLordRarity = 12; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - int num6 = 3; - float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; - for (int index = 0; index < num6; ++index) - { - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, 440, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[projectile].timeLeft = 120; - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num6 = 3; + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + for (int index = 0; index < num6; ++index) + { + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, 440, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0f, 0f); + Main.projectile[projectile].timeLeft = 120; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LaserMachinegun); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GleamingMagnolia.cs b/Items/Weapons/GleamingMagnolia.cs index 7be4547da2..156f3ee362 100644 --- a/Items/Weapons/GleamingMagnolia.cs +++ b/Items/Weapons/GleamingMagnolia.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GleamingMagnolia : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gleaming Magnolia"); - Tooltip.SetDefault("Casts a gleaming bolt that explodes into smaller bolts"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gleaming Magnolia"); + Tooltip.SetDefault("Casts a gleaming bolt that explodes into smaller bolts"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 32; - item.magic = true; - item.mana = 11; - item.width = 52; - item.height = 54; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 32; + item.magic = true; + item.mana = 11; + item.width = 52; + item.height = 54; + item.useTime = 27; + item.useAnimation = 27; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GleamingBolt"); - item.shootSpeed = 14f; - } + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("GleamingBolt"); + item.shootSpeed = 14f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ManaRose"); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ManaRose"); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GoldenGun.cs b/Items/Weapons/GoldenGun.cs index 5d044d5fb2..c7e52f0858 100644 --- a/Items/Weapons/GoldenGun.cs +++ b/Items/Weapons/GoldenGun.cs @@ -6,30 +6,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GoldenGun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golden Gun"); - Tooltip.SetDefault("Shoots a straight line of ichor"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Golden Gun"); + Tooltip.SetDefault("Shoots a straight line of ichor"); + } - public override void SetDefaults() - { - item.damage = 5; - item.width = 78; - item.height = 36; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 5; + item.width = 78; + item.height = 36; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GoldenGun"); - item.shootSpeed = 12f; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = mod.ProjectileType("GoldenGun"); + item.shootSpeed = 12f; + } public override Vector2? HoldoutOffset() { @@ -38,9 +38,9 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } public override void AddRecipes() { diff --git a/Items/Weapons/GoldplumeSpear.cs b/Items/Weapons/GoldplumeSpear.cs index 223c7f6fa7..e20260a2be 100644 --- a/Items/Weapons/GoldplumeSpear.cs +++ b/Items/Weapons/GoldplumeSpear.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GoldplumeSpear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Goldplume Spear"); - Tooltip.SetDefault("Shoots falling feathers"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Goldplume Spear"); + Tooltip.SetDefault("Shoots falling feathers"); + } - public override void SetDefaults() - { - item.width = 54; - item.damage = 23; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = 5; - item.useTime = 23; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 54; + public override void SetDefaults() + { + item.width = 54; + item.damage = 23; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 23; + item.useStyle = 5; + item.useTime = 23; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 54; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.shoot = mod.ProjectileType("GoldplumeSpearProjectile"); - item.shootSpeed = 5f; - } + item.shoot = mod.ProjectileType("GoldplumeSpearProjectile"); + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 10); - recipe.AddIngredient(ItemID.SunplateBlock, 4); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 10); + recipe.AddIngredient(ItemID.SunplateBlock, 4); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GrandGuardian.cs b/Items/Weapons/GrandGuardian.cs index 14a2650b64..514a52ddc5 100644 --- a/Items/Weapons/GrandGuardian.cs +++ b/Items/Weapons/GrandGuardian.cs @@ -6,83 +6,83 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GrandGuardian : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grand Guardian"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 15 when striking them\n" + - "If enemy defense is 0 or below your attacks will heal you\n" + - "Striking enemies causes a large explosion\n" + - "Striking enemies that have under half life will make you release rainbow bolts\n" + - "Enemies spawn healing orbs on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Guardian"); + Tooltip.SetDefault("Has a chance to lower enemy defense by 15 when striking them\n" + + "If enemy defense is 0 or below your attacks will heal you\n" + + "Striking enemies causes a large explosion\n" + + "Striking enemies that have under half life will make you release rainbow bolts\n" + + "Enemies spawn healing orbs on death"); + } - public override void SetDefaults() - { - item.width = 124; - item.damage = 150; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 124; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; - item.shootSpeed = 12f; - } + public override void SetDefaults() + { + item.width = 124; + item.damage = 150; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 124; + item.value = Item.buyPrice(1, 0, 0, 0); + item.rare = 10; + item.shootSpeed = 12f; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(5)) - { - target.defense -= 15; - } - if (target.defense <= 0 && target.canGhostHeal) - { - player.statLife += 4; - player.HealEffect(4); - } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("RainbowBoom"), (int)((float)item.damage * player.meleeDamage * 0.5f), 0f, player.whoAmI); - if (target.life <= (target.lifeMax * 0.5f)) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(player.Center.X, player.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI); - } - if (target.life <= 0) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, player.whoAmI); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(5)) + { + target.defense -= 15; + } + if (target.defense <= 0 && target.canGhostHeal) + { + player.statLife += 4; + player.HealEffect(4); + } + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("RainbowBoom"), (int)((float)item.damage * player.meleeDamage * 0.5f), 0f, player.whoAmI); + if (target.life <= (target.lifeMax * 0.5f)) + { + float randomSpeedX = (float)Main.rand.Next(9); + float randomSpeedY = (float)Main.rand.Next(6, 15); + Projectile.NewProjectile(player.Center.X, player.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI); + Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI); + } + if (target.life <= 0) + { + float randomSpeedX = (float)Main.rand.Next(9); + float randomSpeedY = (float)Main.rand.Next(6, 15); + Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, player.whoAmI); + } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[dust].noGravity = true; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[dust].noGravity = true; + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MajesticGuard"); - recipe.AddIngredient(null, "BarofLife", 10); - recipe.AddIngredient(null, "GalacticaSingularity", 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MajesticGuard"); + recipe.AddIngredient(null, "BarofLife", 10); + recipe.AddIngredient(null, "GalacticaSingularity", 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Grax.cs b/Items/Weapons/Grax.cs index 0c0e0fd911..1c5223b935 100644 --- a/Items/Weapons/Grax.cs +++ b/Items/Weapons/Grax.cs @@ -5,48 +5,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Grax : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grax"); - Tooltip.SetDefault("Hitting an enemy will greatly boost your defense and melee stats for a short time"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grax"); + Tooltip.SetDefault("Hitting an enemy will greatly boost your defense and melee stats for a short time"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 450; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 4; - item.useTurn = true; - item.axe = 50; - item.hammer = 200; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; + public override void SetDefaults() + { + item.width = 60; + item.damage = 450; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 4; + item.useTurn = true; + item.axe = 50; + item.hammer = 200; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; item.tileBoost += 5; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FellerofEvergreens"); - recipe.AddIngredient(null, "DraedonBar", 5); - recipe.AddRecipeGroup("LunarHamaxe"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FellerofEvergreens"); + recipe.AddIngredient(null, "DraedonBar", 5); + recipe.AddRecipeGroup("LunarHamaxe"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - player.AddBuff(mod.BuffType("GraxDefense"), 600); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + player.AddBuff(mod.BuffType("GraxDefense"), 600); + } + } } diff --git a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs index 57c307a06a..759a551538 100644 --- a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs +++ b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs @@ -6,60 +6,60 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.GreatSandShark { public class SandSharknadoStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Sharknado Staff"); - Tooltip.SetDefault("Summons a sandnado to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Sharknado Staff"); + Tooltip.SetDefault("Summons a sandnado to fight for you"); + } - public override void SetDefaults() - { - item.damage = 65; - item.mana = 10; - item.width = 48; - item.height = 56; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 65; + item.mana = 10; + item.width = 48; + item.height = 56; + item.useTime = 35; + item.useAnimation = 35; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Sandnado"); - item.shootSpeed = 10f; - item.summon = true; - } + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Sandnado"); + item.shootSpeed = 10f; + item.summon = true; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.TempestStaff); diff --git a/Items/Weapons/GreatSandShark/Sandstorm.cs b/Items/Weapons/GreatSandShark/Sandstorm.cs index ca2e88da41..dbb9d3e106 100644 --- a/Items/Weapons/GreatSandShark/Sandstorm.cs +++ b/Items/Weapons/GreatSandShark/Sandstorm.cs @@ -6,54 +6,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.GreatSandShark { public class Sandstorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandstorm"); - Tooltip.SetDefault("Fires sand bullets that explode"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandstorm"); + Tooltip.SetDefault("Fires sand bullets that explode"); + } - public override void SetDefaults() - { - item.damage = 73; - item.ranged = true; - item.width = 62; - item.height = 26; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 73; + item.ranged = true; + item.width = 62; + item.height = 26; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("SandstormBullet"); - item.useAmmo = AmmoID.Sand; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("SandstormBullet"); + item.useAmmo = AmmoID.Sand; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SandstormBullet"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SandstormBullet"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Sandgun); - recipe.AddIngredient(null, "GrandScale"); - recipe.AddIngredient(ItemID.Amber, 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Sandgun); + recipe.AddIngredient(null, "GrandScale"); + recipe.AddIngredient(ItemID.Amber, 5); recipe.AddIngredient(ItemID.SandBlock, 50); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GreatSandShark/Tumbleweed.cs b/Items/Weapons/GreatSandShark/Tumbleweed.cs index f79899a6d2..c96ea2babe 100644 --- a/Items/Weapons/GreatSandShark/Tumbleweed.cs +++ b/Items/Weapons/GreatSandShark/Tumbleweed.cs @@ -5,33 +5,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.GreatSandShark { public class Tumbleweed : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tumbleweed"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tumbleweed"); Tooltip.SetDefault("Releases a rolling tumbleweed on hit"); } - public override void SetDefaults() - { - item.damage = 125; - item.melee = true; - item.width = 30; - item.height = 10; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; + public override void SetDefaults() + { + item.damage = 125; + item.melee = true; + item.width = 30; + item.height = 10; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; item.noUseGraphic = true; - item.knockBack = 8f; + item.knockBack = 8f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.channel = true; - item.shoot = mod.ProjectileType("Tumbleweed"); - item.shootSpeed = 12f; - } + item.shoot = mod.ProjectileType("Tumbleweed"); + item.shootSpeed = 12f; + } public override void AddRecipes() { diff --git a/Items/Weapons/GreatbowofTurmoil.cs b/Items/Weapons/GreatbowofTurmoil.cs index 6bccf74e48..467621c0bf 100644 --- a/Items/Weapons/GreatbowofTurmoil.cs +++ b/Items/Weapons/GreatbowofTurmoil.cs @@ -6,78 +6,85 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GreatbowofTurmoil : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Greatbow of Turmoil"); - Tooltip.SetDefault("Fires 3 arrows at once\n" + - "Fires 2 additional cursed, hellfire, or ichor arrows"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greatbow of Turmoil"); + Tooltip.SetDefault("Fires 3 arrows at once\n" + + "Fires 2 additional cursed, hellfire, or ichor arrows"); + } - public override void SetDefaults() - { - item.damage = 33; - item.ranged = true; - item.width = 18; - item.height = 36; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 17f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 33; + item.ranged = true; + item.width = 18; + item.height = 36; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 17f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - switch (Main.rand.Next(3)) - { - case 0: type = ProjectileID.CursedArrow; break; - case 1: type = ProjectileID.HellfireArrow; break; - case 2: type = ProjectileID.IchorArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[index].noDropItem = true; - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + switch (Main.rand.Next(3)) + { + case 0: + type = ProjectileID.CursedArrow; + break; + case 1: + type = ProjectileID.HellfireArrow; + break; + case 2: + type = ProjectileID.IchorArrow; + break; + default: + break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[index].noDropItem = true; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GreatswordofBlah.cs b/Items/Weapons/GreatswordofBlah.cs index 08fc11d53e..642f5f5c2e 100644 --- a/Items/Weapons/GreatswordofBlah.cs +++ b/Items/Weapons/GreatswordofBlah.cs @@ -5,47 +5,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GreatswordofBlah : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Greatsword of Blah"); - Tooltip.SetDefault("A pale white sword from a forgotten land\n" + - "Fires a rainbow orb that emits rainbow rain on death for a time\n" + - "You can hear faint yet comforting whispers emanating from the blade\n" + - "'No matter where you may be you are never alone\n" + - "I shall always be at your side, my lord'"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greatsword of Blah"); + Tooltip.SetDefault("A pale white sword from a forgotten land\n" + + "Fires a rainbow orb that emits rainbow rain on death for a time\n" + + "You can hear faint yet comforting whispers emanating from the blade\n" + + "'No matter where you may be you are never alone\n" + + "I shall always be at your side, my lord'"); + } - public override void SetDefaults() - { - item.width = 110; - item.damage = 480; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 110; + public override void SetDefaults() + { + item.width = 110; + item.damage = 480; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 110; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("JudgementBlah"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 14; - } + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 14; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GreatswordofJudgement"); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GreatswordofJudgement"); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/GreatswordofJudgement.cs b/Items/Weapons/GreatswordofJudgement.cs index b9cc06b301..5fccf3d7b5 100644 --- a/Items/Weapons/GreatswordofJudgement.cs +++ b/Items/Weapons/GreatswordofJudgement.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class GreatswordofJudgement : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Greatsword of Judgement"); - Tooltip.SetDefault("A pale white sword from a forgotten land\n" + - "Fires a white orb that emits white rain on death for a time\n" + - "You can hear faint yet comforting whispers emanating from the blade\n" + - "'No matter where you may be you are never alone\n" + - "I shall always be at your side, my lord'"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greatsword of Judgement"); + Tooltip.SetDefault("A pale white sword from a forgotten land\n" + + "Fires a white orb that emits white rain on death for a time\n" + + "You can hear faint yet comforting whispers emanating from the blade\n" + + "'No matter where you may be you are never alone\n" + + "I shall always be at your side, my lord'"); + } - public override void SetDefaults() - { - item.width = 70; - item.damage = 52; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; + public override void SetDefaults() + { + item.width = 70; + item.damage = 52; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("Judgement"); - item.shootSpeed = 10f; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 10f; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 11); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarBar, 11); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HalleysInferno.cs b/Items/Weapons/HalleysInferno.cs index c9a556cb04..f1e1bf8f60 100644 --- a/Items/Weapons/HalleysInferno.cs +++ b/Items/Weapons/HalleysInferno.cs @@ -1,66 +1,62 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons { - public class HalleysInferno : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Halley's Inferno"); - Tooltip.SetDefault("Halley came sooner than expected\n" + - "Fires a flaming comet\n" + - "50% chance to not consume gel"); - } + public class HalleysInferno : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Halley's Inferno"); + Tooltip.SetDefault("Halley came sooner than expected\n" + + "Fires a flaming comet\n" + + "50% chance to not consume gel"); + } - public override void SetDefaults() - { - item.damage = 1750; + public override void SetDefaults() + { + item.damage = 1750; item.crit += 20; - item.ranged = true; - item.width = 84; - item.height = 34; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item34; + item.ranged = true; + item.width = 84; + item.height = 34; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; - item.Calamity().postMoonLordRarity = 13; - item.autoReuse = true; - item.shoot = mod.ProjectileType("HalleysComet"); - item.shootSpeed = 14.6f; - item.useAmmo = 23; - } + item.Calamity().postMoonLordRarity = 13; + item.autoReuse = true; + item.shoot = mod.ProjectileType("HalleysComet"); + item.shootSpeed = 14.6f; + item.useAmmo = 23; + } public override Vector2? HoldoutOffset() { return new Vector2(-15, 0); } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("RuinousSoul"), 4); - recipe.AddIngredient(mod.ItemType("ExodiumClusterOre"), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("RuinousSoul"), 4); + recipe.AddIngredient(mod.ItemType("ExodiumClusterOre"), 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HarvestStaff.cs b/Items/Weapons/HarvestStaff.cs index 68f31024e3..f7ac2b369f 100644 --- a/Items/Weapons/HarvestStaff.cs +++ b/Items/Weapons/HarvestStaff.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HarvestStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Harvest Staff"); - Tooltip.SetDefault("Casts flaming pumpkins"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Harvest Staff"); + Tooltip.SetDefault("Casts flaming pumpkins"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 15; - item.magic = true; - item.mana = 5; - item.width = 28; - item.height = 30; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; + public override void SetDefaults() + { + item.damage = 15; + item.magic = true; + item.mana = 5; + item.width = 28; + item.height = 30; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlamingPumpkin"); - item.shootSpeed = 10f; - item.scale = 0.9f; - } + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlamingPumpkin"); + item.shootSpeed = 10f; + item.scale = 0.9f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pumpkin, 20); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pumpkin, 20); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HeartRapier.cs b/Items/Weapons/HeartRapier.cs index 808cf2126a..33c11224b6 100644 --- a/Items/Weapons/HeartRapier.cs +++ b/Items/Weapons/HeartRapier.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HeartRapier : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heart Rapier"); - Tooltip.SetDefault("Heals the player on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heart Rapier"); + Tooltip.SetDefault("Heals the player on enemy hits"); + } - public override void SetDefaults() - { - item.width = 44; - item.damage = 38; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 44; + public override void SetDefaults() + { + item.width = 44; + item.damage = 38; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 44; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("HeartRapierProjectile"); - item.shootSpeed = 5f; - } + item.shoot = mod.ProjectileType("HeartRapierProjectile"); + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeCrystal, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeCrystal, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HeavenlyGale.cs b/Items/Weapons/HeavenlyGale.cs index 25e4163c42..dc1b9fd0c9 100644 --- a/Items/Weapons/HeavenlyGale.cs +++ b/Items/Weapons/HeavenlyGale.cs @@ -6,72 +6,80 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HeavenlyGale : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavenly Gale"); - Tooltip.SetDefault("Fires a barrage of 5 random exo arrows\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heavenly Gale"); + Tooltip.SetDefault("Fires a barrage of 5 random exo arrows\n" + "Green exo arrows explode into a tornado on death\n" + "Blue exo arrows cause a second group of arrows to fire on enemy hits\n" + "Orange exo arrows cause explosions on death\n" + "Teal exo arrows ignore enemy immunity frames"); - } + } - public override void SetDefaults() - { - item.damage = 600; - item.ranged = true; - item.width = 44; - item.height = 58; - item.useTime = 9; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 600; + item.ranged = true; + item.width = 44; + item.height = 58; + item.useTime = 9; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 17f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 15; - } + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 17f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 15; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 5; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - switch (Main.rand.Next(10)) - { + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 5; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + switch (Main.rand.Next(10)) + { case 0: - case 1: + case 1: case 2: - case 3: type = mod.ProjectileType("TealExoArrow"); break; + case 3: + type = mod.ProjectileType("TealExoArrow"); + break; case 4: case 5: - case 6: type = mod.ProjectileType("OrangeExoArrow"); break; + case 6: + type = mod.ProjectileType("OrangeExoArrow"); + break; case 7: - case 8: type = mod.ProjectileType("BlueExoArrow"); break; - case 9: type = mod.ProjectileType("GreenExoArrow"); break; - } - Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } + case 8: + type = mod.ProjectileType("BlueExoArrow"); + break; + case 9: + type = mod.ProjectileType("GreenExoArrow"); + break; + } + Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } public override void AddRecipes() { diff --git a/Items/Weapons/HeliumFlash.cs b/Items/Weapons/HeliumFlash.cs index f285d414b1..c456bbe9b2 100644 --- a/Items/Weapons/HeliumFlash.cs +++ b/Items/Weapons/HeliumFlash.cs @@ -1,8 +1,8 @@ -using System; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons { diff --git a/Items/Weapons/HellBurst.cs b/Items/Weapons/HellBurst.cs index 1748e44111..ec2874a5d3 100644 --- a/Items/Weapons/HellBurst.cs +++ b/Items/Weapons/HellBurst.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HellBurst : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hell Burst"); - Tooltip.SetDefault("Casts a beam of flame"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hell Burst"); + Tooltip.SetDefault("Casts a beam of flame"); + } - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 14; - item.width = 52; - item.height = 52; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 14; + item.width = 52; + item.height = 52; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item34; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlameBeamTip"); - item.shootSpeed = 32f; - } + item.UseSound = SoundID.Item34; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlameBeamTip"); + item.shootSpeed = 32f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Flamelash); - recipe.AddIngredient(ItemID.CrystalVileShard); - recipe.AddIngredient(ItemID.DarkShard, 2); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Flamelash); + recipe.AddIngredient(ItemID.CrystalVileShard); + recipe.AddIngredient(ItemID.DarkShard, 2); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HellfireFlamberge.cs b/Items/Weapons/HellfireFlamberge.cs index 68dd124c3b..695ddca6e6 100644 --- a/Items/Weapons/HellfireFlamberge.cs +++ b/Items/Weapons/HellfireFlamberge.cs @@ -6,75 +6,82 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HellfireFlamberge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellfire Flamberge"); - Tooltip.SetDefault("Fires a spread of fireballs"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellfire Flamberge"); + Tooltip.SetDefault("Fires a spread of fireballs"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 102; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; + public override void SetDefaults() + { + item.width = 60; + item.damage = 102; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.useTurn = true; + item.knockBack = 7.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("ChaosFlameSmall"); - item.shootSpeed = 20f; - } + item.shoot = mod.ProjectileType("ChaosFlameSmall"); + item.shootSpeed = 20f; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 20); - float SpeedA = speedX; - float SpeedB = speedY; - for (int index = 0; index < 3; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - switch (index) - { - case 0: type = mod.ProjectileType("ChaosFlameSmall"); break; - case 1: type = mod.ProjectileType("ChaosFlameMedium"); break; - case 2: type = mod.ProjectileType("ChaosFlameLarge"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 20); + float SpeedA = speedX; + float SpeedB = speedY; + for (int index = 0; index < 3; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + switch (index) + { + case 0: + type = mod.ProjectileType("ChaosFlameSmall"); + break; + case 1: + type = mod.ProjectileType("ChaosFlameMedium"); + break; + case 2: + type = mod.ProjectileType("ChaosFlameLarge"); + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } } diff --git a/Items/Weapons/HellionFlowerSpear.cs b/Items/Weapons/HellionFlowerSpear.cs index 03d1b0ce8e..3ee659b993 100644 --- a/Items/Weapons/HellionFlowerSpear.cs +++ b/Items/Weapons/HellionFlowerSpear.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HellionFlowerSpear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellion Flower Spear"); - Tooltip.SetDefault("Shoots a flower spear tip\n" + - "Summons petals from the sky on critical hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellion Flower Spear"); + Tooltip.SetDefault("Shoots a flower spear tip\n" + + "Summons petals from the sky on critical hits"); + } - public override void SetDefaults() - { - item.width = 64; - item.damage = 67; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 64; + public override void SetDefaults() + { + item.width = 64; + item.damage = 67; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 64; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.shoot = mod.ProjectileType("HellionFlowerSpearProjectile"); - item.shootSpeed = 8f; - } + item.shoot = mod.ProjectileType("HellionFlowerSpearProjectile"); + item.shootSpeed = 8f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Hellkite.cs b/Items/Weapons/Hellkite.cs index 4de842ffae..8aa1a288ef 100644 --- a/Items/Weapons/Hellkite.cs +++ b/Items/Weapons/Hellkite.cs @@ -6,94 +6,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Hellkite : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellkite"); - Tooltip.SetDefault("Contains the power of an ancient drake\n" + - "Summons flame geyser explosions on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellkite"); + Tooltip.SetDefault("Contains the power of an ancient drake\n" + + "Summons flame geyser explosions on enemy hits"); + } - public override void SetDefaults() - { - item.width = 84; - item.damage = 100; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 84; + public override void SetDefaults() + { + item.width = 84; + item.damage = 100; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 84; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 8); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 8); + recipe.AddIngredient(ItemID.FieryGreatsword); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - player.ApplyDamageToNPC(target, damage, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 6f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 6f; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default, num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 6f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + player.ApplyDamageToNPC(target, damage, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 6f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 6f; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default, num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 6f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } } diff --git a/Items/Weapons/HellwingStaff.cs b/Items/Weapons/HellwingStaff.cs index c7837e2907..bcd296eff4 100644 --- a/Items/Weapons/HellwingStaff.cs +++ b/Items/Weapons/HellwingStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,105 +7,105 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HellwingStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellwing Staff"); - Tooltip.SetDefault("Casts pillars of flame"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellwing Staff"); + Tooltip.SetDefault("Casts pillars of flame"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 18; - item.width = 54; - item.height = 52; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 18; + item.width = 54; + item.height = 52; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlamePillar"); - item.shootSpeed = 9f; - } + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlamePillar"); + item.shootSpeed = 9f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LavaBucket, 2); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LavaBucket, 2); + recipe.AddIngredient(ItemID.HellstoneBar, 7); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num130 = 7; - if (Main.rand.NextBool(6)) - { - num130++; - } - if (Main.rand.NextBool(7)) - { - num130++; - } - if (Main.rand.NextBool(8)) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num131); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("FlamePillar"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num130 = 7; + if (Main.rand.NextBool(6)) + { + num130++; + } + if (Main.rand.NextBool(7)) + { + num130++; + } + if (Main.rand.NextBool(8)) + { + num130++; + } + for (int num131 = 0; num131 < num130; num131++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num131); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("FlamePillar"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } diff --git a/Items/Weapons/Helstorm.cs b/Items/Weapons/Helstorm.cs index ed53dc9134..a50907da09 100644 --- a/Items/Weapons/Helstorm.cs +++ b/Items/Weapons/Helstorm.cs @@ -5,58 +5,58 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Helstorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Helstorm"); - Tooltip.SetDefault("Fires two bullets at once\n" + - "The gun also deals damage to enemies that touch it"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Helstorm"); + Tooltip.SetDefault("Fires two bullets at once\n" + + "The gun also deals damage to enemies that touch it"); + } - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 50; - item.height = 24; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.knockBack = 2.5f; + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 50; + item.height = 24; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.knockBack = 2.5f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 11.5f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 11.5f; + item.useAmmo = 97; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 2; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int index = 0; index < 2; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CruptixBar", 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); - } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 360); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 360); + } + } } diff --git a/Items/Weapons/HiveMind/DankStaff.cs b/Items/Weapons/HiveMind/DankStaff.cs index 3517c3b205..e189ae58b8 100644 --- a/Items/Weapons/HiveMind/DankStaff.cs +++ b/Items/Weapons/HiveMind/DankStaff.cs @@ -6,69 +6,69 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.HiveMind { public class DankStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dank Staff"); - Tooltip.SetDefault("Summons a dank creeper to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dank Staff"); + Tooltip.SetDefault("Summons a dank creeper to fight for you"); + } - public override void SetDefaults() - { - item.damage = 7; - item.mana = 10; - item.width = 58; - item.height = 58; - item.useTime = 36; - item.useAnimation = 36; - item.scale = 0.85f; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2.25f; + public override void SetDefaults() + { + item.damage = 7; + item.mana = 10; + item.width = 58; + item.height = 58; + item.useTime = 36; + item.useAnimation = 36; + item.scale = 0.85f; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2.25f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DankCreeper"); - item.shootSpeed = 10f; - item.summon = true; - } + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DankCreeper"); + item.shootSpeed = 10f; + item.summon = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 3); - recipe.AddIngredient(ItemID.DemoniteBar, 8); - recipe.AddIngredient(null, "TrueShadowScale", 7); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 3); + recipe.AddIngredient(ItemID.DemoniteBar, 8); + recipe.AddIngredient(null, "TrueShadowScale", 7); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/HiveMind/LeechingDagger.cs b/Items/Weapons/HiveMind/LeechingDagger.cs index f7763e9b46..8f3e1e0613 100644 --- a/Items/Weapons/HiveMind/LeechingDagger.cs +++ b/Items/Weapons/HiveMind/LeechingDagger.cs @@ -6,56 +6,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.HiveMind { public class LeechingDagger : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leeching Dagger"); - Tooltip.SetDefault("Enemies release homing leech orbs on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leeching Dagger"); + Tooltip.SetDefault("Enemies release homing leech orbs on death"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 26; - item.height = 26; - item.damage = 26; - item.melee = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 26; + item.height = 26; + item.damage = 26; + item.melee = true; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 2); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(null, "TrueShadowScale", 4); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 2); + recipe.AddIngredient(ItemID.DemoniteBar, 5); + recipe.AddIngredient(null, "TrueShadowScale", 4); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Leech"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Leech"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } } diff --git a/Items/Weapons/HiveMind/PerfectDark.cs b/Items/Weapons/HiveMind/PerfectDark.cs index d1673a24b9..57650b219c 100644 --- a/Items/Weapons/HiveMind/PerfectDark.cs +++ b/Items/Weapons/HiveMind/PerfectDark.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.HiveMind { public class PerfectDark : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perfect Dark"); - Tooltip.SetDefault("Fires a vile ball that sticks to tiles and explodes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perfect Dark"); + Tooltip.SetDefault("Fires a vile ball that sticks to tiles and explodes"); + } - public override void SetDefaults() - { - item.width = 50; - item.damage = 22; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; + public override void SetDefaults() + { + item.width = 50; + item.damage = 22; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.shoot = mod.ProjectileType("DarkBall"); - item.shootSpeed = 5f; - } + item.shoot = mod.ProjectileType("DarkBall"); + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 5); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 5); + recipe.AddIngredient(ItemID.DemoniteBar, 5); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HiveMind/ShaderainStaff.cs b/Items/Weapons/HiveMind/ShaderainStaff.cs index 7f3bf6d72c..2432e6b39d 100644 --- a/Items/Weapons/HiveMind/ShaderainStaff.cs +++ b/Items/Weapons/HiveMind/ShaderainStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,71 +7,71 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.HiveMind { public class ShaderainStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shaderain Staff"); - Tooltip.SetDefault("Fires a shade storm cloud"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shaderain Staff"); + Tooltip.SetDefault("Fires a shade storm cloud"); + } - public override void SetDefaults() - { - item.damage = 17; - item.magic = true; - item.mana = 10; - item.width = 34; - item.height = 34; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 0f; + public override void SetDefaults() + { + item.damage = 17; + item.magic = true; + item.mana = 10; + item.width = 34; + item.height = 34; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 0f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item66; - item.shoot = mod.ProjectileType("ShadeNimbus"); - item.shootSpeed = 16f; - } + item.UseSound = SoundID.Item66; + item.shoot = mod.ProjectileType("ShadeNimbus"); + item.shootSpeed = 16f; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num154 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("ShadeNimbusCloud"), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num154].ai[0] = (float)Main.mouseX + Main.screenPosition.X; - Main.projectile[num154].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num154 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("ShadeNimbusCloud"), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num154].ai[0] = (float)Main.mouseX + Main.screenPosition.X; + Main.projectile[num154].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 2); - recipe.AddIngredient(ItemID.DemoniteBar, 3); - recipe.AddIngredient(null, "TrueShadowScale", 12); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 2); + recipe.AddIngredient(ItemID.DemoniteBar, 3); + recipe.AddIngredient(null, "TrueShadowScale", 12); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HiveMind/Shadethrower.cs b/Items/Weapons/HiveMind/Shadethrower.cs index 6496f11d77..ca52e28e7e 100644 --- a/Items/Weapons/HiveMind/Shadethrower.cs +++ b/Items/Weapons/HiveMind/Shadethrower.cs @@ -6,54 +6,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.HiveMind { public class Shadethrower : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shadethrower"); - Tooltip.SetDefault("66% chance to not consume gel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadethrower"); + Tooltip.SetDefault("66% chance to not consume gel"); + } - public override void SetDefaults() - { - item.damage = 16; - item.ranged = true; - item.width = 54; - item.height = 14; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 16; + item.ranged = true; + item.width = 54; + item.height = 14; + item.useTime = 10; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ShadeFire"); - item.shootSpeed = 5.5f; - item.useAmmo = 23; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("ShadeFire"); + item.shootSpeed = 5.5f; + item.useAmmo = 23; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 66) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 66) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 3); - recipe.AddIngredient(ItemID.DemoniteBar, 7); - recipe.AddIngredient(null, "TrueShadowScale", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 3); + recipe.AddIngredient(ItemID.DemoniteBar, 7); + recipe.AddIngredient(null, "TrueShadowScale", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HiveMind/ShadowdropStaff.cs b/Items/Weapons/HiveMind/ShadowdropStaff.cs index d1eca54297..bcbb2fa934 100644 --- a/Items/Weapons/HiveMind/ShadowdropStaff.cs +++ b/Items/Weapons/HiveMind/ShadowdropStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,94 +7,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.HiveMind { public class ShadowdropStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shadowdrop Staff"); - Tooltip.SetDefault("Summons dark aura rain from the sky"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadowdrop Staff"); + Tooltip.SetDefault("Summons dark aura rain from the sky"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 19; - item.magic = true; - item.mana = 13; - item.width = 48; - item.height = 48; - item.useTime = 9; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; + public override void SetDefaults() + { + item.damage = 19; + item.magic = true; + item.mana = 13; + item.width = 48; + item.height = 48; + item.useTime = 9; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item66; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AuraRain"); - item.shootSpeed = 8f; - } + item.UseSound = SoundID.Item66; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AuraRain"); + item.shootSpeed = 8f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 5); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 5); + recipe.AddIngredient(ItemID.DemoniteBar, 5); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 10; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("AuraRain"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 10; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("AuraRain"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + return false; + } + } } diff --git a/Items/Weapons/HolidayHalberd.cs b/Items/Weapons/HolidayHalberd.cs index 9f87a207a5..493b7b1316 100644 --- a/Items/Weapons/HolidayHalberd.cs +++ b/Items/Weapons/HolidayHalberd.cs @@ -6,56 +6,60 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HolidayHalberd : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holiday Halberd"); - Tooltip.SetDefault("idk I'm miserable with names\n" + - "- The General\n" + - "Fires red and green bouncing balls that emit clouds as they travel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holiday Halberd"); + Tooltip.SetDefault("idk I'm miserable with names\n" + + "- The General\n" + + "Fires red and green bouncing balls that emit clouds as they travel"); + } - public override void SetDefaults() - { - item.width = 70; - item.damage = 94; - item.melee = true; - item.useAnimation = 17; - item.useStyle = 1; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; + public override void SetDefaults() + { + item.width = 70; + item.damage = 94; + item.melee = true; + item.useAnimation = 17; + item.useStyle = 1; + item.useTime = 17; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shoot = mod.ProjectileType("RedBall"); - item.shootSpeed = 12f; - } + item.shoot = mod.ProjectileType("RedBall"); + item.shootSpeed = 12f; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustType = 0; - switch (Main.rand.Next(4)) - { - case 1: dustType = 107; break; - case 2: dustType = 90; break; - } - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int dustType = 0; + switch (Main.rand.Next(4)) + { + case 1: + dustType = 107; + break; + case 2: + dustType = 90; + break; + } + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); + } + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (Main.rand.NextBool(3)) - { - type = mod.ProjectileType("GreenBall"); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (Main.rand.NextBool(3)) + { + type = mod.ProjectileType("GreenBall"); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + return false; + } + } } diff --git a/Items/Weapons/HolyFireBullet.cs b/Items/Weapons/HolyFireBullet.cs index 0b85189dfb..250960ea78 100644 --- a/Items/Weapons/HolyFireBullet.cs +++ b/Items/Weapons/HolyFireBullet.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HolyFireBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Fire Bullet"); - Tooltip.SetDefault("Explosive holy bullets"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Fire Bullet"); + Tooltip.SetDefault("Explosive holy bullets"); + } - public override void SetDefaults() - { - item.damage = 27; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 2f; - item.value = 2000; - item.rare = 10; - item.shoot = mod.ProjectileType("HolyFireBullet"); - item.shootSpeed = 12f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 27; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 2f; + item.value = 2000; + item.rare = 10; + item.shoot = mod.ProjectileType("HolyFireBullet"); + item.shootSpeed = 12f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ExplodingBullet, 100); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ExplodingBullet, 100); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/HyperiusBullet.cs b/Items/Weapons/HyperiusBullet.cs index 2d11f5bdbc..c38ca72996 100644 --- a/Items/Weapons/HyperiusBullet.cs +++ b/Items/Weapons/HyperiusBullet.cs @@ -4,38 +4,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class HyperiusBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hyperius Bullet"); - Tooltip.SetDefault("Your enemies might have a bad time\n" + - "Spawns additional bullets on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hyperius Bullet"); + Tooltip.SetDefault("Your enemies might have a bad time\n" + + "Spawns additional bullets on enemy hits"); + } - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 2000; - item.rare = 9; - item.shoot = mod.ProjectileType("HyperiusBullet"); - item.shootSpeed = 16f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 2000; + item.rare = 9; + item.shoot = mod.ProjectileType("HyperiusBullet"); + item.shootSpeed = 16f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 100); - recipe.AddIngredient(null, "BarofLife"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 100); + recipe.AddIngredient(null, "BarofLife"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/IcicleStaff.cs b/Items/Weapons/IcicleStaff.cs index 44459a245b..e2ec0178e3 100644 --- a/Items/Weapons/IcicleStaff.cs +++ b/Items/Weapons/IcicleStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Icicle Staff"); - Tooltip.SetDefault("Casts icicles from the sky"); - Item.staff[item.type] = true; + Tooltip.SetDefault("Casts icicles from the sky"); + Item.staff[item.type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Impaler.cs b/Items/Weapons/Impaler.cs index 2737c855e6..5608dc95e2 100644 --- a/Items/Weapons/Impaler.cs +++ b/Items/Weapons/Impaler.cs @@ -6,65 +6,65 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Impaler : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Impaler"); - Tooltip.SetDefault("Fires explosive and flaming stakes\n" + - "Instantly kills vampires and vampire bats"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Impaler"); + Tooltip.SetDefault("Fires explosive and flaming stakes\n" + + "Instantly kills vampires and vampire bats"); + } - public override void SetDefaults() - { - item.damage = 120; - item.ranged = true; - item.crit += 14; - item.width = 40; - item.height = 26; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 120; + item.ranged = true; + item.crit += 14; + item.width = 40; + item.height = 26; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlamingStake"); - item.shootSpeed = 10f; - item.useAmmo = 1836; - } + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlamingStake"); + item.shootSpeed = 10f; + item.useAmmo = 1836; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(0, -10); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(0, -10); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float)Main.rand.Next(-2, 3) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-2, 3) * 0.05f; - if (Main.rand.NextBool(3)) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ExplodingStake"), damage, knockBack, player.whoAmI, 0f, 0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FlamingStake"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-2, 3) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-2, 3) * 0.05f; + if (Main.rand.NextBool(3)) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ExplodingStake"), damage, knockBack, player.whoAmI, 0f, 0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FlamingStake"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 5); - recipe.AddIngredient(ItemID.StakeLauncher); - recipe.AddIngredient(ItemID.ExplosivePowder, 100); - recipe.AddIngredient(ItemID.LivingFireBlock, 75); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 5); + recipe.AddIngredient(ItemID.StakeLauncher); + recipe.AddIngredient(ItemID.ExplosivePowder, 100); + recipe.AddIngredient(ItemID.LivingFireBlock, 75); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/InfernaCutter.cs b/Items/Weapons/InfernaCutter.cs index ad8289702b..4ef20d7936 100644 --- a/Items/Weapons/InfernaCutter.cs +++ b/Items/Weapons/InfernaCutter.cs @@ -2,131 +2,130 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class InfernaCutter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Inferna Cutter"); - Tooltip.SetDefault("Critical hits with the blade cause small explosions\n" + - "Generates a number of small sparks when swung"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Inferna Cutter"); + Tooltip.SetDefault("Critical hits with the blade cause small explosions\n" + + "Generates a number of small sparks when swung"); + } - public override void SetDefaults() - { - item.damage = 85; - item.melee = true; - item.width = 60; - item.height = 46; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.axe = 27; - item.useStyle = 1; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 85; + item.melee = true; + item.width = 60; + item.height = 46; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.axe = 27; + item.useStyle = 1; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurityAxe"); - recipe.AddIngredient(ItemID.SoulofFright, 8); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurityAxe"); + recipe.AddIngredient(ItemID.SoulofFright, 8); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (player.whoAmI == Main.myPlayer) - { - if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) - { - float num339 = 0f; - float num340 = 0f; - float num341 = 0f; - float num342 = 0f; - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) - { - num339 = -7f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num339 = -6f; - num340 = 2f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) - { - num339 = -4f; - num340 = 4f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) - { - num339 = -2f; - num340 = 6f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) - { - num340 = 7f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num342 = 26f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) - { - num342 -= 4f; - num341 -= 20f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) - { - num341 += 6f; - } - if (player.direction == -1) - { - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) - { - num342 -= 8f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num342 -= 6f; - } - } - num339 *= 1.5f; - num340 *= 1.5f; - num342 *= (float)player.direction; - num341 *= player.gravDir; - Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Spark, (int)((float)item.damage * 0.1f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); - } - } - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (player.whoAmI == Main.myPlayer) + { + if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) + { + float num339 = 0f; + float num340 = 0f; + float num341 = 0f; + float num342 = 0f; + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num339 = -7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num339 = -6f; + num340 = 2f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) + { + num339 = -4f; + num340 = 4f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num339 = -2f; + num340 = 6f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num340 = 7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 = 26f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num342 -= 4f; + num341 -= 20f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num341 += 6f; + } + if (player.direction == -1) + { + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num342 -= 8f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 -= 6f; + } + } + num339 *= 1.5f; + num340 *= 1.5f; + num342 *= (float)player.direction; + num341 *= player.gravDir; + Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Spark, (int)((float)item.damage * 0.1f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); + } + } + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (crit) - { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceMelee = true; + } + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } } diff --git a/Items/Weapons/InfernalRift.cs b/Items/Weapons/InfernalRift.cs index 6579f20c67..8e4e427a17 100644 --- a/Items/Weapons/InfernalRift.cs +++ b/Items/Weapons/InfernalRift.cs @@ -6,73 +6,73 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class InfernalRift : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernal Rift"); - Tooltip.SetDefault("Summons infernal blades that spawn additional blades on enemy hits"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernal Rift"); + Tooltip.SetDefault("Summons infernal blades that spawn additional blades on enemy hits"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 15; - item.width = 16; - item.height = 16; - item.useAnimation = 16; - item.useTime = 4; - item.reuseDelay = item.useAnimation + 6; - item.crit = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 15; + item.width = 16; + item.height = 16; + item.useAnimation = 16; + item.useTime = 4; + item.reuseDelay = item.useAnimation + 6; + item.crit = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("InfernalBlade"); - item.shootSpeed = 16f; - } + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("InfernalBlade"); + item.shootSpeed = 16f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SkyFracture); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SkyFracture); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float f = Main.rand.NextFloat() * 6.28318548f; - float value12 = 20f; - float value13 = 60f; - Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - for (int num202 = 0; num202 < 50; num202++) - { - vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) - { - break; - } - f = Main.rand.NextFloat() * 6.28318548f; - } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 vector14 = mouseWorld - vector13; - Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; - vector14 = vector14.SafeNormalize(vector15) * num72; - vector14 = Vector2.Lerp(vector14, vector15, 0.25f); - Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num72 = item.shootSpeed; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float f = Main.rand.NextFloat() * 6.28318548f; + float value12 = 20f; + float value13 = 60f; + Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + for (int num202 = 0; num202 < 50; num202++) + { + vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) + { + break; + } + f = Main.rand.NextFloat() * 6.28318548f; + } + Vector2 mouseWorld = Main.MouseWorld; + Vector2 vector14 = mouseWorld - vector13; + Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; + vector14 = vector14.SafeNormalize(vector15) * num72; + vector14 = Vector2.Lerp(vector14, vector15, 0.25f); + Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Interfacer.cs b/Items/Weapons/Interfacer.cs index 9a6bb89e34..42ee4c94ca 100644 --- a/Items/Weapons/Interfacer.cs +++ b/Items/Weapons/Interfacer.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,66 +7,66 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Interfacer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Disseminator"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + - "Fires a spread of bullets from the gun, above, and below"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Disseminator"); + Tooltip.SetDefault("50% chance to not consume ammo\n" + + "Fires a spread of bullets from the gun, above, and below"); + } - public override void SetDefaults() - { - item.damage = 55; - item.ranged = true; - item.width = 66; - item.height = 24; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; + public override void SetDefaults() + { + item.damage = 55; + item.ranged = true; + item.width = 66; + item.height = 24; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = 10; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shootSpeed = 13f; + item.shoot = 10; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 12; + } public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + { + return new Vector2(-10, 0); + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(4, 6); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[bullet].extraUpdates += 1; } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { num78 = (float)player.direction; @@ -77,29 +77,29 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - int num107 = Main.rand.Next(4, 6); - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-50, 51); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int bullet = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + int num107 = Main.rand.Next(4, 6); + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-50, 51); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + int bullet = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[bullet].extraUpdates += 1; Main.projectile[bullet].tileCollide = false; @@ -126,17 +126,17 @@ namespace CalamityMod.Items.Weapons Main.projectile[bullet2].extraUpdates += 1; Main.projectile[bullet2].tileCollide = false; } - return false; - } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ConferenceCall"); - recipe.AddIngredient(ItemID.LunarBar, 10); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ConferenceCall"); + recipe.AddIngredient(ItemID.LunarBar, 10); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/IonBlaster.cs b/Items/Weapons/IonBlaster.cs index 01df593af3..7925ee4601 100644 --- a/Items/Weapons/IonBlaster.cs +++ b/Items/Weapons/IonBlaster.cs @@ -6,62 +6,62 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class IonBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ion Blaster"); - Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + - "The higher your mana the more damage they will do"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ion Blaster"); + Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + + "The higher your mana the more damage they will do"); + } - public override void SetDefaults() - { - item.width = 44; - item.damage = 30; - item.magic = true; - item.mana = 6; - item.useAnimation = 10; - item.useTime = 10; - item.useStyle = 5; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.height = 28; + public override void SetDefaults() + { + item.width = 44; + item.damage = 30; + item.magic = true; + item.mana = 6; + item.useAnimation = 10; + item.useTime = 10; + item.useStyle = 5; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item91; + item.autoReuse = true; + item.noMelee = true; + item.height = 28; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = mod.ProjectileType("IonBlast"); - item.shootSpeed = 3f; - } + item.shoot = mod.ProjectileType("IonBlast"); + item.shootSpeed = 3f; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float manaAmount = ((float)player.statMana * 0.01f); - float damageMult = manaAmount * 0.75f; - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].scale = manaAmount; - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float manaAmount = ((float)player.statMana * 0.01f); + float damageMult = manaAmount * 0.75f; + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].scale = manaAmount; + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddIngredient(ItemID.AdamantiteBar, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddIngredient(ItemID.TitaniumBar, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddIngredient(ItemID.AdamantiteBar, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddIngredient(ItemID.TitaniumBar, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Judgement.cs b/Items/Weapons/Judgement.cs index a52db6bad7..2d9d31d43a 100644 --- a/Items/Weapons/Judgement.cs +++ b/Items/Weapons/Judgement.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,94 +7,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Judgement : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Dance of Light"); - Tooltip.SetDefault("Casts a swarm of white flames from the sky"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Dance of Light"); + Tooltip.SetDefault("Casts a swarm of white flames from the sky"); + } - public override void SetDefaults() - { - item.damage = 500; - item.magic = true; - item.mana = 9; - item.width = 28; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 500; + item.magic = true; + item.mana = 9; + item.width = 28; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WhiteFlame"); - item.shootSpeed = 30f; - item.Calamity().postMoonLordRarity = 16; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("WhiteFlame"); + item.shootSpeed = 30f; + item.Calamity().postMoonLordRarity = 16; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarFlareBook); - recipe.AddIngredient(null, "WrathoftheAncients"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarFlareBook); + recipe.AddIngredient(null, "WrathoftheAncients"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); - } - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 3; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); + } + return false; + } + } } diff --git a/Items/Weapons/Lacerator.cs b/Items/Weapons/Lacerator.cs index 66f4875d1e..c7d9031608 100644 --- a/Items/Weapons/Lacerator.cs +++ b/Items/Weapons/Lacerator.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("LaceratorProjectile"); - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void AddRecipes() { diff --git a/Items/Weapons/Lazhar.cs b/Items/Weapons/Lazhar.cs index 711af63fb5..ae36a51863 100644 --- a/Items/Weapons/Lazhar.cs +++ b/Items/Weapons/Lazhar.cs @@ -5,50 +5,50 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Lazhar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lazhar"); - Tooltip.SetDefault("Fires a bouncing laser that explodes on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lazhar"); + Tooltip.SetDefault("Fires a bouncing laser that explodes on enemy hits"); + } - public override void SetDefaults() - { - item.damage = 75; - item.magic = true; - item.mana = 4; - item.width = 42; - item.height = 20; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 75; + item.magic = true; + item.mana = 4; + item.width = 42; + item.height = 20; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shootSpeed = 15f; - item.shoot = mod.ProjectileType("SolarBeam2"); - } + item.UseSound = SoundID.Item12; + item.autoReuse = true; + item.shootSpeed = 15f; + item.shoot = mod.ProjectileType("SolarBeam2"); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HeatRay); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddIngredient(ItemID.ChlorophyteBar, 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HeatRay); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddIngredient(ItemID.ChlorophyteBar, 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Leviathan/Greentide.cs b/Items/Weapons/Leviathan/Greentide.cs index 8cbdc43f77..04ddbcdde7 100644 --- a/Items/Weapons/Leviathan/Greentide.cs +++ b/Items/Weapons/Leviathan/Greentide.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Items.Weapons.Leviathan { public class Greentide : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Greentide"); - Tooltip.SetDefault("Summons green blasts of water from the sky on hit"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greentide"); + Tooltip.SetDefault("Summons green blasts of water from the sky on hit"); + } public override void SetDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Leviathan item.height = 60; item.useTime = 24; item.useAnimation = 24; - item.useTurn = true; + item.useTurn = true; item.useStyle = 1; item.knockBack = 7; item.value = Item.buyPrice(0, 60, 0, 0); @@ -33,80 +33,80 @@ namespace CalamityMod.Items.Weapons.Leviathan } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { int i = Main.myPlayer; - float num72 = item.shootSpeed; - float num74 = knockback; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 4; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78; - float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GreenWater"), (int)((float)item.damage * player.meleeDamage), num74, i, 0f, (float)Main.rand.Next(10)); - } + float num72 = item.shootSpeed; + float num74 = knockback; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 4; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78; + float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GreenWater"), (int)((float)item.damage * player.meleeDamage), num74, i, 0f, (float)Main.rand.Next(10)); + } } public override void MeleeEffects(Player player, Rectangle hitbox) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } if (Main.rand.NextBool(4)) { int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, randomDust); diff --git a/Items/Weapons/Leviathan/Leviatitan.cs b/Items/Weapons/Leviathan/Leviatitan.cs index 4454f6d0f9..9d9acdcdea 100644 --- a/Items/Weapons/Leviathan/Leviatitan.cs +++ b/Items/Weapons/Leviathan/Leviatitan.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Leviathan public override void SetStaticDefaults() { DisplayName.SetDefault("Leviatitan"); - Tooltip.SetDefault("Fires green and normal water blasts"); - } + Tooltip.SetDefault("Fires green and normal water blasts"); + } public override void SetDefaults() { diff --git a/Items/Weapons/Leviathan/LureofEnthrallment.cs b/Items/Weapons/Leviathan/LureofEnthrallment.cs index cda355357f..b16780bd51 100644 --- a/Items/Weapons/Leviathan/LureofEnthrallment.cs +++ b/Items/Weapons/Leviathan/LureofEnthrallment.cs @@ -1,27 +1,27 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Leviathan { public class LureofEnthrallment : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pearl of Enthrallment"); - Tooltip.SetDefault("Summons a siren to fight for you\n" + - "The siren stays above you, shooting water spears, ice mist, and treble clefs at nearby enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pearl of Enthrallment"); + Tooltip.SetDefault("Summons a siren to fight for you\n" + + "The siren stays above you, shooting water spears, ice mist, and treble clefs at nearby enemies"); + } - public override void SetDefaults() - { - item.width = 56; - item.height = 56; + public override void SetDefaults() + { + item.width = 56; + item.height = 56; item.value = Item.buyPrice(0, 30, 0, 0); item.rare = 7; - item.accessory = true; - } + item.accessory = true; + } public override bool CanEquipAccessory(Player player, int slot) { @@ -34,30 +34,30 @@ namespace CalamityMod.Items.Weapons.Leviathan } public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sirenWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("SirenLure")) == -1) - { - player.AddBuff(mod.BuffType("SirenLure"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SirenLure"), (int)(65f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.sirenWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("SirenLure")) == -1) + { + player.AddBuff(mod.BuffType("SirenLure"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SirenLure"), (int)(65f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Leviathan/SirensSong.cs b/Items/Weapons/Leviathan/SirensSong.cs index 638a93bcaf..e05d485c96 100644 --- a/Items/Weapons/Leviathan/SirensSong.cs +++ b/Items/Weapons/Leviathan/SirensSong.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Leviathan { float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, soundPitch, 0f); return false; } diff --git a/Items/Weapons/LifefruitScythe.cs b/Items/Weapons/LifefruitScythe.cs index e0750845a6..ac8e71174b 100644 --- a/Items/Weapons/LifefruitScythe.cs +++ b/Items/Weapons/LifefruitScythe.cs @@ -6,58 +6,58 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class LifefruitScythe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lifehunt Scythe"); - Tooltip.SetDefault("Heals the player on enemy hits and shoots an energy scythe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lifehunt Scythe"); + Tooltip.SetDefault("Heals the player on enemy hits and shoots an energy scythe"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 250; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 72; + public override void SetDefaults() + { + item.width = 60; + item.damage = 250; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; + item.height = 72; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("LifeScythe"); - item.shootSpeed = 9f; - item.Calamity().postMoonLordRarity = 12; - } + item.shootSpeed = 9f; + item.Calamity().postMoonLordRarity = 12; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - player.statLife += 5; - player.HealEffect(5); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + player.statLife += 5; + player.HealEffect(5); + } + } } diff --git a/Items/Weapons/Lucrecia.cs b/Items/Weapons/Lucrecia.cs index cb452f9f3b..7b44570232 100644 --- a/Items/Weapons/Lucrecia.cs +++ b/Items/Weapons/Lucrecia.cs @@ -7,83 +7,83 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Lucrecia : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lucrecia"); - Tooltip.SetDefault("Finesse\n" + - "Striking an enemy makes you immune for a short time\n" + - "Using this weapon drains your life\n" + - "Fires a DNA chain"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lucrecia"); + Tooltip.SetDefault("Finesse\n" + + "Striking an enemy makes you immune for a short time\n" + + "Using this weapon drains your life\n" + + "Fires a DNA chain"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 25; - item.useTime = 25; - item.width = 58; - item.height = 58; - item.damage = 90; - item.melee = true; - item.knockBack = 8.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DNA"); - item.shootSpeed = 32f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 25; + item.useTime = 25; + item.width = 58; + item.height = 58; + item.damage = 90; + item.melee = true; + item.knockBack = 8.25f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DNA"); + item.shootSpeed = 32f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - player.statLife -= 5; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-5, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + player.statLife -= 5; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-5, true); + } + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.SoulofLight, 5); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 234); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 234); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (!player.immune) - { - player.immune = true; - player.immuneTime = 5; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (!player.immune) + { + player.immune = true; + player.immuneTime = 5; + } + } + } } diff --git a/Items/Weapons/LunarianBow.cs b/Items/Weapons/LunarianBow.cs index 4bf2cff754..c44b27a290 100644 --- a/Items/Weapons/LunarianBow.cs +++ b/Items/Weapons/LunarianBow.cs @@ -6,74 +6,74 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class LunarianBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lunarian Bow"); - Tooltip.SetDefault("Fires two bouncing energy bolts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lunarian Bow"); + Tooltip.SetDefault("Fires two bouncing energy bolts"); + } - public override void SetDefaults() - { - item.damage = 23; - item.ranged = true; - item.width = 22; - item.height = 58; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LunarBolt"); - item.shootSpeed = 8f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 23; + item.ranged = true; + item.width = 22; + item.height = 58; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LunarBolt"); + item.shootSpeed = 8f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 15f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num121].noDropItem = true; - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 2; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 15f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num121].noDropItem = true; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DemonBow); - recipe.AddIngredient(ItemID.MoltenFury); - recipe.AddIngredient(ItemID.BeesKnees); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TendonBow); - recipe.AddIngredient(ItemID.MoltenFury); - recipe.AddIngredient(ItemID.BeesKnees); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DemonBow); + recipe.AddIngredient(ItemID.MoltenFury); + recipe.AddIngredient(ItemID.BeesKnees); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TendonBow); + recipe.AddIngredient(ItemID.MoltenFury); + recipe.AddIngredient(ItemID.BeesKnees); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/LunicEye.cs b/Items/Weapons/LunicEye.cs index ed00ba6681..e8eab1b9c7 100644 --- a/Items/Weapons/LunicEye.cs +++ b/Items/Weapons/LunicEye.cs @@ -2,69 +2,68 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Weapons { - public class LunicEye : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lunic Eye"); - Tooltip.SetDefault("Fires lunic beams that reduce enemy protection\n" + - "This weapon scales with all your damage stats at once"); - } + public class LunicEye : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lunic Eye"); + Tooltip.SetDefault("Fires lunic beams that reduce enemy protection\n" + + "This weapon scales with all your damage stats at once"); + } - public override void SetDefaults() - { - item.width = 80; - item.damage = 9; - item.rare = 5; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = 5; - item.knockBack = 4.5f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.noMelee = true; - item.height = 50; + public override void SetDefaults() + { + item.width = 80; + item.damage = 9; + item.rare = 5; + item.useAnimation = 15; + item.useTime = 15; + item.useStyle = 5; + item.knockBack = 4.5f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.autoReuse = true; + item.noMelee = true; + item.height = 50; item.value = Item.buyPrice(0, 36, 0, 0); item.shoot = mod.ProjectileType("LunicBeam"); - item.shootSpeed = 13f; - } + item.shootSpeed = 13f; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } - // Lunic Eye scales off of all damage types simultaneously (meaning it scales 5x from universal damage boosts). - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - float formula = 5f * (player.allDamage - 1f); - formula += player.meleeDamage - 1f; - formula += player.rangedDamage - 1f; - formula += player.magicDamage - 1f; - formula += player.minionDamage - 1f; - formula += player.Calamity().throwingDamage - 1f; - add += formula; - } + // Lunic Eye scales off of all damage types simultaneously (meaning it scales 5x from universal damage boosts). + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float formula = 5f * (player.allDamage - 1f); + formula += player.meleeDamage - 1f; + formula += player.rangedDamage - 1f; + formula += player.magicDamage - 1f; + formula += player.minionDamage - 1f; + formula += player.Calamity().throwingDamage - 1f; + add += formula; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddIngredient(null, "AerialiteBar", 15); - recipe.AddIngredient(ItemID.SunplateBlock, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 20); + recipe.AddIngredient(null, "AerialiteBar", 15); + recipe.AddIngredient(ItemID.SunplateBlock, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MagnaCannon.cs b/Items/Weapons/MagnaCannon.cs index 338be313b7..ef86b50c48 100644 --- a/Items/Weapons/MagnaCannon.cs +++ b/Items/Weapons/MagnaCannon.cs @@ -6,57 +6,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MagnaCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magna Cannon"); - Tooltip.SetDefault("Fires a concentrated blast of energy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magna Cannon"); + Tooltip.SetDefault("Fires a concentrated blast of energy"); + } - public override void SetDefaults() - { - item.damage = 19; - item.magic = true; - item.mana = 12; - item.width = 56; - item.height = 34; - item.useTime = 32; - item.useAnimation = 32; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 19; + item.magic = true; + item.mana = 12; + item.width = 56; + item.height = 34; + item.useTime = 32; + item.useAnimation = 32; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item117; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnaBlast"); - } + item.UseSound = SoundID.Item117; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnaBlast"); + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 3; ++index) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int index = 0; index < 3; ++index) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Granite, 25); - recipe.AddIngredient(ItemID.Obsidian, 15); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.SpaceGun); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Granite, 25); + recipe.AddIngredient(ItemID.Obsidian, 15); + recipe.AddIngredient(ItemID.Amber, 5); + recipe.AddIngredient(ItemID.SpaceGun); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MagnaStriker.cs b/Items/Weapons/MagnaStriker.cs index 21761ecfbb..d62eec399f 100644 --- a/Items/Weapons/MagnaStriker.cs +++ b/Items/Weapons/MagnaStriker.cs @@ -6,56 +6,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MagnaStriker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magna Striker"); - Tooltip.SetDefault("Fires a string of opal and magna strikes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magna Striker"); + Tooltip.SetDefault("Fires a string of opal and magna strikes"); + } - public override void SetDefaults() - { - item.damage = 42; - item.ranged = true; - item.width = 60; - item.height = 22; - item.useTime = 5; - item.reuseDelay = 6; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; + public override void SetDefaults() + { + item.damage = 42; + item.ranged = true; + item.width = 60; + item.height = 22; + item.useTime = 5; + item.reuseDelay = 6; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("OpalStrike"); - item.shootSpeed = 15f; - item.useAmmo = 97; - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("OpalStrike"); + item.shootSpeed = 15f; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int randomProj = Main.rand.Next(2); - if (randomProj == 0) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OpalStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MagnaStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int randomProj = Main.rand.Next(2); + if (randomProj == 0) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OpalStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MagnaStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "OpalStriker"); recipe.AddIngredient(null, "MagnaCannon"); recipe.AddIngredient(ItemID.AdamantiteBar, 6); @@ -71,6 +71,6 @@ namespace CalamityMod.Items.Weapons recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/MagneticMeltdown.cs b/Items/Weapons/MagneticMeltdown.cs index 260391c550..f0b08aeae3 100644 --- a/Items/Weapons/MagneticMeltdown.cs +++ b/Items/Weapons/MagneticMeltdown.cs @@ -5,55 +5,55 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MagneticMeltdown : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnetic Meltdown"); - Tooltip.SetDefault("Fires a spread of magnetic orbs"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnetic Meltdown"); + Tooltip.SetDefault("Fires a spread of magnetic orbs"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 135; - item.magic = true; - item.mana = 25; - item.width = 78; - item.height = 78; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 135; + item.magic = true; + item.mana = 25; + item.width = 78; + item.height = 78; + item.useTime = 27; + item.useAnimation = 27; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MagneticOrb"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 14; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("MagneticOrb"); + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 14; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 4; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1.0f, 0.0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int index = 0; index < 4; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1.0f, 0.0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(ItemID.SpectreStaff); - recipe.AddIngredient(ItemID.MagnetSphere); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(ItemID.SpectreStaff); + recipe.AddIngredient(ItemID.MagnetSphere); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MajesticGuard.cs b/Items/Weapons/MajesticGuard.cs index 23651823b5..0a9395b0a4 100644 --- a/Items/Weapons/MajesticGuard.cs +++ b/Items/Weapons/MajesticGuard.cs @@ -5,61 +5,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MajesticGuard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Majestic Guard"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 10 when striking them\n" + - "If enemy defense is 0 or below your attacks will heal you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Majestic Guard"); + Tooltip.SetDefault("Has a chance to lower enemy defense by 10 when striking them\n" + + "If enemy defense is 0 or below your attacks will heal you"); + } - public override void SetDefaults() - { - item.width = 98; - item.damage = 60; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 98; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - } + public override void SetDefaults() + { + item.width = 98; + item.damage = 60; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 98; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(5)) - target.defense -= 10; + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(5)) + target.defense -= 10; - // Healing effect does not trigger versus dummies - if (target.type == NPCID.TargetDummy) - return; + // Healing effect does not trigger versus dummies + if (target.type == NPCID.TargetDummy) + return; - if (target.defense <= 0 && target.canGhostHeal) - { - player.statLife += 3; - player.HealEffect(3); - } - } + if (target.defense <= 0 && target.canGhostHeal) + { + player.statLife += 3; + player.HealEffect(3); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteSword); - recipe.AddIngredient(ItemID.SoulofMight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumSword); - recipe.AddIngredient(ItemID.SoulofMight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteSword); + recipe.AddIngredient(ItemID.SoulofMight, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumSword); + recipe.AddIngredient(ItemID.SoulofMight, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ManaRose.cs b/Items/Weapons/ManaRose.cs index 94628a91fd..0a8201b284 100644 --- a/Items/Weapons/ManaRose.cs +++ b/Items/Weapons/ManaRose.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ManaRose : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mana Rose"); - Tooltip.SetDefault("Casts a mana bolt that explodes into smaller bolts"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mana Rose"); + Tooltip.SetDefault("Casts a mana bolt that explodes into smaller bolts"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 12; - item.magic = true; - item.mana = 8; - item.width = 38; - item.height = 38; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; + public override void SetDefaults() + { + item.damage = 12; + item.magic = true; + item.mana = 8; + item.width = 38; + item.height = 38; + item.useTime = 27; + item.useAnimation = 27; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ManaBolt"); - item.shootSpeed = 10f; - } + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ManaBolt"); + item.shootSpeed = 10f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NaturesGift); - recipe.AddIngredient(ItemID.JungleRose); - recipe.AddIngredient(ItemID.Moonglow, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.NaturesGift); + recipe.AddIngredient(ItemID.JungleRose); + recipe.AddIngredient(ItemID.Moonglow, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MandibleBow.cs b/Items/Weapons/MandibleBow.cs index 14494a109c..6250362ebd 100644 --- a/Items/Weapons/MandibleBow.cs +++ b/Items/Weapons/MandibleBow.cs @@ -6,31 +6,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MandibleBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mandible Bow"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mandible Bow"); + } - public override void SetDefaults() - { - item.damage = 13; - item.ranged = true; - item.width = 22; - item.height = 40; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 13; + item.ranged = true; + item.width = 22; + item.height = 40; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; - item.UseSound = SoundID.Item5; - item.autoReuse = false; - item.shoot = 10; - item.shootSpeed = 30f; - item.useAmmo = 40; - } + item.UseSound = SoundID.Item5; + item.autoReuse = false; + item.shoot = 10; + item.shootSpeed = 30f; + item.useAmmo = 40; + } /*public void OverhaulInit() { diff --git a/Items/Weapons/MandibleClaws.cs b/Items/Weapons/MandibleClaws.cs index 76dcbdf74f..f001fdefc0 100644 --- a/Items/Weapons/MandibleClaws.cs +++ b/Items/Weapons/MandibleClaws.cs @@ -5,27 +5,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MandibleClaws : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mandible Claws"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mandible Claws"); + } - public override void SetDefaults() - { - item.width = 22; - item.damage = 14; - item.melee = true; - item.useAnimation = 6; - item.useStyle = 1; - item.useTime = 6; - item.useTurn = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 18; + public override void SetDefaults() + { + item.width = 22; + item.damage = 14; + item.melee = true; + item.useAnimation = 6; + item.useStyle = 1; + item.useTime = 6; + item.useTurn = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 18; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; - } - } + } + } } diff --git a/Items/Weapons/MangroveChakramMelee.cs b/Items/Weapons/MangroveChakramMelee.cs index 8ce31bb5e2..806dd9d460 100644 --- a/Items/Weapons/MangroveChakramMelee.cs +++ b/Items/Weapons/MangroveChakramMelee.cs @@ -5,39 +5,39 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MangroveChakramMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mangrove Chakram"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mangrove Chakram"); + } - public override void SetDefaults() - { - item.width = 38; - item.damage = 84; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 38; + public override void SetDefaults() + { + item.width = 38; + item.damage = 84; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 38; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.shoot = mod.ProjectileType("MangroveChakramProjectileMelee"); - item.shootSpeed = 16f; - } + item.shootSpeed = 16f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MantisClaws.cs b/Items/Weapons/MantisClaws.cs index c87123ae89..ee5e3f8bbd 100644 --- a/Items/Weapons/MantisClaws.cs +++ b/Items/Weapons/MantisClaws.cs @@ -2,47 +2,46 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class MantisClaws : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mantis Claws"); - Tooltip.SetDefault("Explodes on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mantis Claws"); + Tooltip.SetDefault("Explodes on enemy hits"); + } - public override void SetDefaults() - { - item.width = 26; - item.damage = 120; - item.melee = true; - item.useAnimation = 6; - item.useStyle = 1; - item.useTime = 6; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 20; + public override void SetDefaults() + { + item.width = 26; + item.damage = 120; + item.melee = true; + item.useAnimation = 6; + item.useStyle = 1; + item.useTime = 6; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 20; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); + } + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), 0, knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } + Main.projectile[boom].Calamity().forceMelee = true; + } } } diff --git a/Items/Weapons/Mariana.cs b/Items/Weapons/Mariana.cs index 9f1612240a..1c13972b50 100644 --- a/Items/Weapons/Mariana.cs +++ b/Items/Weapons/Mariana.cs @@ -6,89 +6,89 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Mariana : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mariana"); - Tooltip.SetDefault("Tropical and deadly\n" + - "Enemies explode into water orbs on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mariana"); + Tooltip.SetDefault("Tropical and deadly\n" + + "Enemies explode into water orbs on death"); + } - public override void SetDefaults() - { - item.damage = 90; - item.width = 54; - item.height = 62; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - } + public override void SetDefaults() + { + item.damage = 90; + item.width = 54; + item.height = 62; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChlorophyteClaymore); - recipe.AddIngredient(ItemID.Coral, 3); - recipe.AddIngredient(ItemID.Starfish, 3); - recipe.AddIngredient(ItemID.Seashell, 3); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ChlorophyteClaymore); + recipe.AddIngredient(ItemID.Coral, 3); + recipe.AddIngredient(ItemID.Starfish, 3); + recipe.AddIngredient(ItemID.Seashell, 3); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - int num251 = Main.rand.Next(4, 6); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("MarianaProjectile"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0f); - } - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + int num251 = Main.rand.Next(4, 6); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("MarianaProjectile"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0f); + } + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); + } + } + } } diff --git a/Items/Weapons/MarkedMagnum.cs b/Items/Weapons/MarkedMagnum.cs index e483af17b4..6db8c0734a 100644 --- a/Items/Weapons/MarkedMagnum.cs +++ b/Items/Weapons/MarkedMagnum.cs @@ -2,69 +2,68 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Weapons { - public class MarkedMagnum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Marked Magnum"); - Tooltip.SetDefault("Shots reduce enemy protection\n" + - "This weapon scales with all your damage stats at once"); - } + public class MarkedMagnum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marked Magnum"); + Tooltip.SetDefault("Shots reduce enemy protection\n" + + "This weapon scales with all your damage stats at once"); + } - public override void SetDefaults() - { - item.damage = 4; - item.width = 54; - item.height = 20; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; + public override void SetDefaults() + { + item.damage = 4; + item.width = 54; + item.height = 20; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item33; - item.autoReuse = false; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MarkRound"); - } + item.UseSound = SoundID.Item33; + item.autoReuse = false; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MarkRound"); + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - // Marked Magnum scales off of all damage types simultaneously (meaning it scales 5x from universal damage boosts). - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - float formula = 5f * (player.allDamage - 1f); - formula += player.meleeDamage - 1f; - formula += player.rangedDamage - 1f; - formula += player.magicDamage - 1f; - formula += player.minionDamage - 1f; - formula += player.Calamity().throwingDamage - 1f; - add += formula; - } + // Marked Magnum scales off of all damage types simultaneously (meaning it scales 5x from universal damage boosts). + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float formula = 5f * (player.allDamage - 1f); + formula += player.meleeDamage - 1f; + formula += player.rangedDamage - 1f; + formula += player.magicDamage - 1f; + formula += player.minionDamage - 1f; + formula += player.Calamity().throwingDamage - 1f; + add += formula; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddIngredient(ItemID.Obsidian, 15); - recipe.AddIngredient(ItemID.GlowingMushroom, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 7); + recipe.AddIngredient(ItemID.Obsidian, 15); + recipe.AddIngredient(ItemID.GlowingMushroom, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MarniteRifleSpear.cs b/Items/Weapons/MarniteRifleSpear.cs index b3a8ae5c27..d5d9024bbe 100644 --- a/Items/Weapons/MarniteRifleSpear.cs +++ b/Items/Weapons/MarniteRifleSpear.cs @@ -5,48 +5,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MarniteRifleSpear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Marnite Rifle Spear"); - Tooltip.SetDefault("The gun damages enemies that touch it"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marnite Rifle Spear"); + Tooltip.SetDefault("The gun damages enemies that touch it"); + } - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 72; - item.height = 20; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = 5; - item.knockBack = 2.25f; + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 72; + item.height = 20; + item.useTime = 28; + item.useAnimation = 28; + item.useStyle = 5; + item.knockBack = 2.25f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 22f; - item.useAmmo = 97; - item.shoot = 10; - } + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 22f; + item.useAmmo = 97; + item.shoot = 10; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 7); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 7); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 7); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldBar, 7); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MarniteSpear.cs b/Items/Weapons/MarniteSpear.cs index dd5c2772df..d8588e696c 100644 --- a/Items/Weapons/MarniteSpear.cs +++ b/Items/Weapons/MarniteSpear.cs @@ -5,49 +5,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MarniteSpear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Marnite Spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marnite Spear"); + } - public override void SetDefaults() - { - item.width = 50; - item.damage = 20; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 21; - item.useStyle = 5; - item.useTime = 21; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 50; + public override void SetDefaults() + { + item.width = 50; + item.damage = 20; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 21; + item.useStyle = 5; + item.useTime = 21; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 50; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.shoot = mod.ProjectileType("MarniteSpearProjectile"); - item.shootSpeed = 5f; - } + item.shoot = mod.ProjectileType("MarniteSpearProjectile"); + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 5); - recipe.AddIngredient(ItemID.Granite, 9); - recipe.AddIngredient(ItemID.Marble, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 5); - recipe.AddIngredient(ItemID.Granite, 9); - recipe.AddIngredient(ItemID.Marble, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 5); + recipe.AddIngredient(ItemID.Granite, 9); + recipe.AddIngredient(ItemID.Marble, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldBar, 5); + recipe.AddIngredient(ItemID.Granite, 9); + recipe.AddIngredient(ItemID.Marble, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Megafleet.cs b/Items/Weapons/Megafleet.cs index 618d750a6e..1772404978 100644 --- a/Items/Weapons/Megafleet.cs +++ b/Items/Weapons/Megafleet.cs @@ -1,73 +1,69 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons { public class Megafleet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Voidragon"); - Tooltip.SetDefault("Fires void blasts that explode"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voidragon"); + Tooltip.SetDefault("Fires void blasts that explode"); + } - public override void SetDefaults() - { - item.damage = 1000; - item.ranged = true; - item.width = 96; - item.height = 38; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 1000; + item.ranged = true; + item.width = 96; + item.height = 38; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 18f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 16; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 18f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 16; + } public override Vector2? HoldoutOffset() { return new Vector2(-10, 0); } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 95) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 95) + return false; + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-5, 6) * 0.05f; + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; type = (Main.rand.NextBool(2) ? mod.ProjectileType("Voidragon") : type); - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Seadragon"); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Seadragon"); recipe.AddIngredient(null, "ShadowspecBar", 5); recipe.AddIngredient(ItemID.SoulofMight, 30); recipe.AddTile(null, "DraedonsForge"); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/Megalodon.cs b/Items/Weapons/Megalodon.cs index f5401b4de5..8dd233127e 100644 --- a/Items/Weapons/Megalodon.cs +++ b/Items/Weapons/Megalodon.cs @@ -6,32 +6,32 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Megalodon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Megalodon"); - Tooltip.SetDefault("50% chance to not consume ammo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Megalodon"); + Tooltip.SetDefault("50% chance to not consume ammo"); + } - public override void SetDefaults() - { - item.damage = 32; - item.ranged = true; - item.width = 72; - item.height = 32; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; + public override void SetDefaults() + { + item.damage = 32; + item.ranged = true; + item.width = 72; + item.height = 32; + item.useTime = 6; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + } public override Vector2? HoldoutOffset() { @@ -39,30 +39,30 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Megashark); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Megashark); recipe.AddIngredient(null, "DepthCells", 10); recipe.AddIngredient(null, "Lumenite", 10); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Meowthrower.cs b/Items/Weapons/Meowthrower.cs index 8c3a5cdb69..77978bceaf 100644 --- a/Items/Weapons/Meowthrower.cs +++ b/Items/Weapons/Meowthrower.cs @@ -6,61 +6,66 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Meowthrower : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meowthrower"); - Tooltip.SetDefault("50% chance to not consume gel\n" + - "Fires blue and pink flames that emit meows on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meowthrower"); + Tooltip.SetDefault("50% chance to not consume gel\n" + + "Fires blue and pink flames that emit meows on enemy hits"); + } - public override void SetDefaults() - { - item.damage = 28; - item.ranged = true; - item.width = 74; - item.height = 24; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.25f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MeowFire"); - item.shootSpeed = 5.5f; - item.useAmmo = 23; - } + public override void SetDefaults() + { + item.damage = 28; + item.ranged = true; + item.width = 74; + item.height = 24; + item.useTime = 10; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.25f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MeowFire"); + item.shootSpeed = 5.5f; + item.useAmmo = 23; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(1, 3); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - switch (Main.rand.Next(3)) - { - case 1: type = mod.ProjectileType("MeowFire"); break; - case 2: type = mod.ProjectileType("MeowFire2"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedA = speedX; + float SpeedB = speedY; + int num6 = Main.rand.Next(1, 3); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + switch (Main.rand.Next(3)) + { + case 1: + type = mod.ProjectileType("MeowFire"); + break; + case 2: + type = mod.ProjectileType("MeowFire2"); + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } diff --git a/Items/Weapons/MineralMortar.cs b/Items/Weapons/MineralMortar.cs index 953a6233d0..4352f57b43 100644 --- a/Items/Weapons/MineralMortar.cs +++ b/Items/Weapons/MineralMortar.cs @@ -5,53 +5,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MineralMortar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mineral Mortar"); - Tooltip.SetDefault("Shoots an onyx bomb that explodes into sand sharks on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mineral Mortar"); + Tooltip.SetDefault("Shoots an onyx bomb that explodes into sand sharks on death"); + } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 58; - item.height = 26; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 58; + item.height = 26; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = mod.ProjectileType("OnyxSharkBomb"); - item.useAmmo = 771; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 14f; + item.shoot = mod.ProjectileType("OnyxSharkBomb"); + item.useAmmo = 771; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OnyxSharkBomb"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OnyxSharkBomb"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.AdamantiteBar, 13); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.TitaniumBar, 13); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.AdamantiteBar, 13); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.TitaniumBar, 13); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Minigun.cs b/Items/Weapons/Minigun.cs index 8e934405ce..ce67c2d214 100644 --- a/Items/Weapons/Minigun.cs +++ b/Items/Weapons/Minigun.cs @@ -6,63 +6,63 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Minigun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Minigun"); - Tooltip.SetDefault("80% chance to not consume ammo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Minigun"); + Tooltip.SetDefault("80% chance to not consume ammo"); + } - public override void SetDefaults() - { - item.damage = 390; - item.ranged = true; - item.width = 72; - item.height = 34; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; + public override void SetDefaults() + { + item.damage = 390; + item.ranged = true; + item.width = 72; + item.height = 34; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 22f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 14; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 22f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 14; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 80) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 80) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ChainGun); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MirrorBlade.cs b/Items/Weapons/MirrorBlade.cs index 565ce612d0..6677e16bb5 100644 --- a/Items/Weapons/MirrorBlade.cs +++ b/Items/Weapons/MirrorBlade.cs @@ -5,54 +5,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MirrorBlade : ModItem - { - private int baseDamage = 295; + { + private int baseDamage = 295; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mirror Blade"); - Tooltip.SetDefault("The amount of contact damage an enemy does is added to this weapons' damage\n" + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mirror Blade"); + Tooltip.SetDefault("The amount of contact damage an enemy does is added to this weapons' damage\n" + "You must hit an enemy with the blade to trigger this effect"); - } + } - public override void SetDefaults() - { - item.width = 52; - item.damage = baseDamage; - item.melee = true; - item.useAnimation = 12; - item.useTime = 12; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; + public override void SetDefaults() + { + item.width = 52; + item.damage = baseDamage; + item.melee = true; + item.useAnimation = 12; + item.useTime = 12; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("MirrorBlast"); - item.Calamity().postMoonLordRarity = 13; - } + item.shoot = mod.ProjectileType("MirrorBlast"); + item.Calamity().postMoonLordRarity = 13; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - int conDamage = target.damage + baseDamage; - if (conDamage < baseDamage) - { - conDamage = baseDamage; - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int conDamage = target.damage + baseDamage; + if (conDamage < baseDamage) + { + conDamage = baseDamage; + } if (conDamage > 750) { conDamage = 750; } item.damage = conDamage; - } - } + } + } } diff --git a/Items/Weapons/Mistlestorm.cs b/Items/Weapons/Mistlestorm.cs index 4e3e2a7148..a01e7e02c6 100644 --- a/Items/Weapons/Mistlestorm.cs +++ b/Items/Weapons/Mistlestorm.cs @@ -6,34 +6,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Mistlestorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mistlestorm"); - Tooltip.SetDefault("Casts a storm of pine needles and leaves"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mistlestorm"); + Tooltip.SetDefault("Casts a storm of pine needles and leaves"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 66; - item.magic = true; - item.mana = 5; - item.width = 48; - item.height = 48; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 66; + item.magic = true; + item.mana = 5; + item.width = 48; + item.height = 48; + item.useTime = 6; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.shoot = 336; - item.shootSpeed = 24f; - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shoot = 336; + item.shootSpeed = 24f; + item.Calamity().postMoonLordRarity = 13; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -54,15 +54,15 @@ namespace CalamityMod.Items.Weapons } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Razorpine); + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Razorpine); recipe.AddIngredient(ItemID.LeafBlower); recipe.AddIngredient(null, "UeliaceBar", 7); recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MolecularManipulator.cs b/Items/Weapons/MolecularManipulator.cs index 9eb14db0df..3f82c1a489 100644 --- a/Items/Weapons/MolecularManipulator.cs +++ b/Items/Weapons/MolecularManipulator.cs @@ -7,34 +7,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MolecularManipulator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Molecular Manipulator"); - Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + - "Fires a fast null bullet that distorts NPC stats\n" + - "Uses your life as ammo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Molecular Manipulator"); + Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + + "Fires a fast null bullet that distorts NPC stats\n" + + "Uses your life as ammo"); + } - public override void SetDefaults() - { - item.damage = 700; - item.ranged = true; - item.width = 60; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; + public override void SetDefaults() + { + item.damage = 700; + item.ranged = true; + item.width = 60; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = mod.ProjectileType("NullShot2"); - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shootSpeed = 25f; + item.shoot = mod.ProjectileType("NullShot2"); + item.Calamity().postMoonLordRarity = 13; + } public override Vector2? HoldoutOffset() { @@ -42,15 +42,15 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - player.statLife -= 5; - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot2"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + { + player.statLife -= 5; + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot2"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } public override void AddRecipes() { diff --git a/Items/Weapons/Monsoon.cs b/Items/Weapons/Monsoon.cs index b5d4800205..bf3b2841be 100644 --- a/Items/Weapons/Monsoon.cs +++ b/Items/Weapons/Monsoon.cs @@ -2,91 +2,90 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class Monsoon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Monsoon"); - Tooltip.SetDefault("Fires a spread of 5 arrows\n" + - "Wooden arrows have a chance to be converted to typhoon arrows or sharks"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Monsoon"); + Tooltip.SetDefault("Fires a spread of 5 arrows\n" + + "Wooden arrows have a chance to be converted to typhoon arrows or sharks"); + } - public override void SetDefaults() - { - item.damage = 63; - item.ranged = true; - item.width = 46; - item.height = 78; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 10f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 63; + item.ranged = true; + item.width = 46; + item.height = 78; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 10f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 5; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - if (type == ProjectileID.WoodenArrowFriendly) - { - if (Main.rand.NextBool(12)) - { - type = 408; - } - if (Main.rand.NextBool(25)) - { - type = mod.ProjectileType("TyphoonArrow"); - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].Calamity().forceRanged = true; - Main.projectile[num121].noDropItem = true; - } - else - { - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 5; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + if (type == ProjectileID.WoodenArrowFriendly) + { + if (Main.rand.NextBool(12)) + { + type = 408; + } + if (Main.rand.NextBool(25)) + { + type = mod.ProjectileType("TyphoonArrow"); + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].Calamity().forceRanged = true; + Main.projectile[num121].noDropItem = true; + } + else + { + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentVortex, 15); - recipe.AddIngredient(ItemID.Tsunami); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentVortex, 15); + recipe.AddIngredient(ItemID.Tsunami); + recipe.AddIngredient(ItemID.SharkFin, 2); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/MortarRound.cs b/Items/Weapons/MortarRound.cs index a1ee3ab33c..35c97591af 100644 --- a/Items/Weapons/MortarRound.cs +++ b/Items/Weapons/MortarRound.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class MortarRound : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mortar Round"); - Tooltip.SetDefault("Large blast radius. Will destroy tiles\n" + - "Used by normal guns"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mortar Round"); + Tooltip.SetDefault("Large blast radius. Will destroy tiles\n" + + "Used by normal guns"); + } - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 20; - item.height = 14; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 7.5f; - item.value = 500; - item.rare = 3; - item.ammo = 97; - item.shoot = mod.ProjectileType("MortarRound"); - } + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 20; + item.height = 14; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 7.5f; + item.value = 500; + item.rare = 3; + item.ammo = 97; + item.shoot = mod.ProjectileType("MortarRound"); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RocketIV, 100); - recipe.AddIngredient(null, "UeliaceBar"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RocketIV, 100); + recipe.AddIngredient(null, "UeliaceBar"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Mourningstar.cs b/Items/Weapons/Mourningstar.cs index 65ef721910..f95c0c6e51 100644 --- a/Items/Weapons/Mourningstar.cs +++ b/Items/Weapons/Mourningstar.cs @@ -5,53 +5,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Mourningstar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mourningstar"); - Tooltip.SetDefault("Launches a solar whip sword and a solar particle trail that explodes on hit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mourningstar"); + Tooltip.SetDefault("Launches a solar whip sword and a solar particle trail that explodes on hit"); + } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.damage = 650; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 10; - item.useTime = 10; - item.useStyle = 5; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item116; + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 650; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.autoReuse = true; + item.melee = true; + item.useAnimation = 10; + item.useTime = 10; + item.useStyle = 5; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item116; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("Mourningstar"); - item.Calamity().postMoonLordRarity = 14; - } + item.shoot = mod.ProjectileType("Mourningstar"); + item.Calamity().postMoonLordRarity = 14; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(ItemID.SolarEruption); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(ItemID.SolarEruption); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 - float ai3X = (Main.rand.NextFloat() - 0.25f) * 0.7853982f; //0.5 - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3X); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 + float ai3X = (Main.rand.NextFloat() - 0.25f) * 0.7853982f; //0.5 + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3X); + return false; + } + } } diff --git a/Items/Weapons/Murasama.cs b/Items/Weapons/Murasama.cs index d0a67736e0..7730dd7df5 100644 --- a/Items/Weapons/Murasama.cs +++ b/Items/Weapons/Murasama.cs @@ -1,50 +1,50 @@ +using CalamityMod.World; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.Weapons { - public class Murasama : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Murasama"); - Tooltip.SetDefault("There will be blood!\n" + - "ID and power-level locked\n" + - "Prove your strength or have the correct user ID to wield this sword"); - } + public class Murasama : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murasama"); + Tooltip.SetDefault("There will be blood!\n" + + "ID and power-level locked\n" + + "Prove your strength or have the correct user ID to wield this sword"); + } - public override void SetDefaults() - { - item.width = 72; - item.damage = 999; - item.crit += 30; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.useAnimation = 25; - item.useStyle = 5; - item.useTime = 5; - item.knockBack = 6.5f; - item.autoReuse = false; - item.height = 78; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Murasama"); - item.shootSpeed = 24f; - item.Calamity().postMoonLordRarity = 15; - } + public override void SetDefaults() + { + item.width = 72; + item.damage = 999; + item.crit += 30; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.useAnimation = 25; + item.useStyle = 5; + item.useTime = 5; + item.knockBack = 6.5f; + item.autoReuse = false; + item.height = 78; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Murasama"); + item.shootSpeed = 24f; + item.Calamity().postMoonLordRarity = 15; + } - public override bool CanUseItem(Player player) - { - return CalamityWorld.downedYharon || player.name == "Sam" || player.name == "Samuel Rodrigues"; - } + public override bool CanUseItem(Player player) + { + return CalamityWorld.downedYharon || player.name == "Sam" || player.name == "Samuel Rodrigues"; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/NanoblackReaperMelee.cs b/Items/Weapons/NanoblackReaperMelee.cs index f77d8a737b..1fec0110bc 100644 --- a/Items/Weapons/NanoblackReaperMelee.cs +++ b/Items/Weapons/NanoblackReaperMelee.cs @@ -2,66 +2,65 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { - public class NanoblackReaperMelee : ModItem - { - public static int BaseDamage = 800; - public static float Knockback = 9f; - public static float Speed = 16f; + public class NanoblackReaperMelee : ModItem + { + public static int BaseDamage = 800; + public static float Knockback = 9f; + public static float Speed = 16f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Reaper"); - Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanoblack Reaper"); + Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'"); + } - public override void SetDefaults() - { - item.width = 78; - item.height = 64; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = Knockback; - item.useTime = 6; - item.useAnimation = 6; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; + public override void SetDefaults() + { + item.width = 78; + item.height = 64; + item.melee = true; + item.damage = BaseDamage; + item.knockBack = Knockback; + item.useTime = 6; + item.useAnimation = 6; + item.autoReuse = true; + item.noMelee = true; + item.noUseGraphic = true; - item.useStyle = 1; - item.UseSound = SoundID.Item18; + item.useStyle = 1; + item.UseSound = SoundID.Item18; - item.rare = 10; - item.Calamity().postMoonLordRarity = 16; - item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 16; + item.value = Item.buyPrice(5, 0, 0, 0); - item.shoot = mod.ProjectileType("NanoblackMain"); - item.shootSpeed = Speed; - } + item.shoot = mod.ProjectileType("NanoblackMain"); + item.shootSpeed = Speed; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; + Main.projectile[proj].Calamity().forceMelee = true; + return false; } public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(null, "DraedonsForge"); - r.AddIngredient(null, "GhoulishGouger"); - r.AddIngredient(null, "SoulHarvester"); - r.AddIngredient(null, "EssenceFlayer"); - r.AddIngredient(null, "ShadowspecBar", 5); - r.AddIngredient(null, "EndothermicEnergy", 40); - r.AddIngredient(null, "DarkPlasma", 10); - r.AddIngredient(ItemID.Nanites, 400); - r.AddRecipe(); - } - } + { + ModRecipe r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(null, "DraedonsForge"); + r.AddIngredient(null, "GhoulishGouger"); + r.AddIngredient(null, "SoulHarvester"); + r.AddIngredient(null, "EssenceFlayer"); + r.AddIngredient(null, "ShadowspecBar", 5); + r.AddIngredient(null, "EndothermicEnergy", 40); + r.AddIngredient(null, "DarkPlasma", 10); + r.AddIngredient(ItemID.Nanites, 400); + r.AddRecipe(); + } + } } diff --git a/Items/Weapons/NapalmArrow.cs b/Items/Weapons/NapalmArrow.cs index b0410d0fd8..4aa0ff16a3 100644 --- a/Items/Weapons/NapalmArrow.cs +++ b/Items/Weapons/NapalmArrow.cs @@ -4,38 +4,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class NapalmArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Napalm Arrow"); - Tooltip.SetDefault("Explodes into fire shards"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Napalm Arrow"); + Tooltip.SetDefault("Explodes into fire shards"); + } - public override void SetDefaults() - { - item.damage = 13; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 1000; - item.rare = 3; - item.shoot = mod.ProjectileType("NapalmArrow"); - item.shootSpeed = 13f; - item.ammo = 40; - } + public override void SetDefaults() + { + item.damage = 13; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("NapalmArrow"); + item.shootSpeed = 13f; + item.ammo = 40; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos"); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(ItemID.WoodenArrow, 250); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddIngredient(ItemID.Torch); + recipe.AddIngredient(ItemID.WoodenArrow, 250); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Needler.cs b/Items/Weapons/Needler.cs index b8574ddde1..bb8d0ac3b9 100644 --- a/Items/Weapons/Needler.cs +++ b/Items/Weapons/Needler.cs @@ -6,42 +6,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Needler : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Needler"); - Tooltip.SetDefault("Fires needles that stick to enemies and explode"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Needler"); + Tooltip.SetDefault("Fires needles that stick to enemies and explode"); + } - public override void SetDefaults() - { - item.damage = 38; - item.ranged = true; - item.width = 44; - item.height = 26; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 38; + item.ranged = true; + item.width = 44; + item.height = 26; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item108; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("Needler"); - item.useAmmo = 97; - } + item.UseSound = SoundID.Item108; + item.autoReuse = true; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("Needler"); + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Needler"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Needler"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/NeptunesBounty.cs b/Items/Weapons/NeptunesBounty.cs index c013b8953b..e30555232b 100644 --- a/Items/Weapons/NeptunesBounty.cs +++ b/Items/Weapons/NeptunesBounty.cs @@ -6,60 +6,60 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class NeptunesBounty : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Neptune's Bounty"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Neptune's Bounty"); Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + - "The lower the enemies' defense the more damage they take from this debuff\n" + - "Fires a trident that rains additional tridents as it travels"); + "The lower the enemies' defense the more damage they take from this debuff\n" + + "Fires a trident that rains additional tridents as it travels"); } - public override void SetDefaults() - { - item.width = 80; - item.damage = 380; - item.melee = true; - item.useAnimation = 22; - item.useTime = 22; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; + public override void SetDefaults() + { + item.width = 80; + item.damage = 380; + item.melee = true; + item.useAnimation = 22; + item.useTime = 22; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("NeptuneOrb"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 13; - } + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 13; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AbyssBlade"); - recipe.AddIngredient(null, "RuinousSoul", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AbyssBlade"); + recipe.AddIngredient(null, "RuinousSoul", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); recipe.AddIngredient(null, "DepthCells", 15); recipe.AddIngredient(null, "Lumenite", 15); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + } } diff --git a/Items/Weapons/NettlelineGreatbow.cs b/Items/Weapons/NettlelineGreatbow.cs index 31bdef922b..efb45ac41a 100644 --- a/Items/Weapons/NettlelineGreatbow.cs +++ b/Items/Weapons/NettlelineGreatbow.cs @@ -6,78 +6,83 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class NettlelineGreatbow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nettlevine Greatbow"); - Tooltip.SetDefault("Shoots 4 arrows at once\n" + - "Fires 2 additional venom or chlorophyte arrows"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nettlevine Greatbow"); + Tooltip.SetDefault("Shoots 4 arrows at once\n" + + "Fires 2 additional venom or chlorophyte arrows"); + } - public override void SetDefaults() - { - item.damage = 120; - item.ranged = true; - item.width = 36; - item.height = 64; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.damage = 120; + item.ranged = true; + item.width = 36; + item.height = 64; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 4; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - switch (Main.rand.Next(2)) - { - case 0: type = ProjectileID.VenomArrow; break; - case 1: type = ProjectileID.ChlorophyteArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[index].noDropItem = true; - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 4; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + switch (Main.rand.Next(2)) + { + case 0: + type = ProjectileID.VenomArrow; + break; + case 1: + type = ProjectileID.ChlorophyteArrow; + break; + default: + break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[index].noDropItem = true; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/NightsRay.cs b/Items/Weapons/NightsRay.cs index 34a888b442..06ca52c770 100644 --- a/Items/Weapons/NightsRay.cs +++ b/Items/Weapons/NightsRay.cs @@ -5,46 +5,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class NightsRay : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Night's Ray"); - Tooltip.SetDefault("Fires a dark ray that splits if enemies are near it"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Night's Ray"); + Tooltip.SetDefault("Fires a dark ray that splits if enemies are near it"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 24; - item.magic = true; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; + public override void SetDefaults() + { + item.damage = 24; + item.magic = true; + item.mana = 10; + item.width = 50; + item.height = 50; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; item.value = Item.buyPrice(0, 12, 0, 0); item.rare = 4; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NightRay"); - item.shootSpeed = 6f; - } + item.UseSound = SoundID.Item72; + item.autoReuse = true; + item.shoot = mod.ProjectileType("NightRay"); + item.shootSpeed = 6f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(ItemID.Vilethorn); - recipe.AddIngredient(ItemID.AmberStaff); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WandofSparking); + recipe.AddIngredient(ItemID.Vilethorn); + recipe.AddIngredient(ItemID.AmberStaff); + recipe.AddIngredient(ItemID.MagicMissile); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/NightsStabber.cs b/Items/Weapons/NightsStabber.cs index f79c17af58..3539547d7c 100644 --- a/Items/Weapons/NightsStabber.cs +++ b/Items/Weapons/NightsStabber.cs @@ -6,69 +6,69 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class NightsStabber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Night's Stabber"); - Tooltip.SetDefault("Don't underestimate the power of stabby knives\n" + - "Enemies release homing dark energy on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Night's Stabber"); + Tooltip.SetDefault("Don't underestimate the power of stabby knives\n" + + "Enemies release homing dark energy on death"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 30; - item.height = 30; - item.damage = 52; - item.melee = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 30; + item.height = 30; + item.damage = 52; + item.melee = true; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientShiv"); - recipe.AddIngredient(null, "SporeKnife"); - recipe.AddIngredient(null, "FlameburstShortsword"); - recipe.AddIngredient(null, "LeechingDagger"); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientShiv"); - recipe.AddIngredient(null, "SporeKnife"); - recipe.AddIngredient(null, "FlameburstShortsword"); - recipe.AddIngredient(null, "BloodyRupture"); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientShiv"); + recipe.AddIngredient(null, "SporeKnife"); + recipe.AddIngredient(null, "FlameburstShortsword"); + recipe.AddIngredient(null, "LeechingDagger"); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientShiv"); + recipe.AddIngredient(null, "SporeKnife"); + recipe.AddIngredient(null, "FlameburstShortsword"); + recipe.AddIngredient(null, "BloodyRupture"); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - for (int i = 0; i <= 2; i++) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("NightStabber"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + for (int i = 0; i <= 2; i++) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("NightStabber"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } + } } diff --git a/Items/Weapons/NuclearFury.cs b/Items/Weapons/NuclearFury.cs index aebc34faf0..c284e0f61c 100644 --- a/Items/Weapons/NuclearFury.cs +++ b/Items/Weapons/NuclearFury.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,60 +7,60 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class NuclearFury : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nuclear Fury"); - Tooltip.SetDefault("Casts a torrent of cosmic typhoons"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Fury"); + Tooltip.SetDefault("Casts a torrent of cosmic typhoons"); + } - public override void SetDefaults() - { - item.damage = 95; - item.magic = true; - item.mana = 13; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 95; + item.magic = true; + item.mana = 13; + item.width = 28; + item.height = 30; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item84; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NuclearFuryProjectile"); - item.shootSpeed = 16f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("NuclearFuryProjectile"); + item.shootSpeed = 16f; + item.Calamity().postMoonLordRarity = 12; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(position.X, position.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), type, damage, knockBack, Main.myPlayer); - Projectile.NewProjectile(position.X, position.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), type, damage, knockBack, Main.myPlayer); - } - return false; - } + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(position.X, position.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); + Projectile.NewProjectile(position.X, position.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.SoulofSight, 10); - recipe.AddIngredient(ItemID.UnicornHorn, 5); - recipe.AddIngredient(ItemID.RazorbladeTyphoon); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(ItemID.SoulofSight, 10); + recipe.AddIngredient(ItemID.UnicornHorn, 5); + recipe.AddIngredient(ItemID.RazorbladeTyphoon); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/NullificationRifle.cs b/Items/Weapons/NullificationRifle.cs index 6c6866bf6c..43176975a8 100644 --- a/Items/Weapons/NullificationRifle.cs +++ b/Items/Weapons/NullificationRifle.cs @@ -7,33 +7,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class NullificationRifle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nullification Pistol"); - Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + - "Fires a fast null bullet that distorts NPC stats\n" + - "Uses your life as ammo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nullification Pistol"); + Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + + "Fires a fast null bullet that distorts NPC stats\n" + + "Uses your life as ammo"); + } - public override void SetDefaults() - { - item.damage = 135; - item.ranged = true; - item.width = 64; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 135; + item.ranged = true; + item.width = 64; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = mod.ProjectileType("NullShot"); - } + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 25f; + item.shoot = mod.ProjectileType("NullShot"); + } public override Vector2? HoldoutOffset() { @@ -41,18 +41,18 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - player.statLife -= 5; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-5, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + { + player.statLife -= 5; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-5, true); + } + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/OldLordOathsword.cs b/Items/Weapons/OldLordOathsword.cs index fde87a51dc..31139ca960 100644 --- a/Items/Weapons/OldLordOathsword.cs +++ b/Items/Weapons/OldLordOathsword.cs @@ -6,76 +6,76 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class OldLordOathsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Old Lord Oathsword"); - Tooltip.SetDefault("A relic of the ancient underworld\n" + - "Critical hits cause lava explosions"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Old Lord Oathsword"); + Tooltip.SetDefault("A relic of the ancient underworld\n" + + "Critical hits cause lava explosions"); + } - public override void SetDefaults() - { - item.damage = 34; - item.width = 78; - item.height = 78; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + public override void SetDefaults() + { + item.damage = 34; + item.width = 78; + item.height = 78; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (crit) - { - target.AddBuff(BuffID.OnFire, 600, false); - player.ApplyDamageToNPC(target, damage, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 200, default, num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 100, default, num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 0, default, num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + target.AddBuff(BuffID.OnFire, 600, false); + player.ApplyDamageToNPC(target, damage, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 200, default, num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 100, default, num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 0, default, num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } + } } diff --git a/Items/Weapons/OmegaBiomeBlade.cs b/Items/Weapons/OmegaBiomeBlade.cs index 9b45c610dd..11d0e90515 100644 --- a/Items/Weapons/OmegaBiomeBlade.cs +++ b/Items/Weapons/OmegaBiomeBlade.cs @@ -6,62 +6,62 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class OmegaBiomeBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Biome Blade"); - Tooltip.SetDefault("Fires different homing projectiles based on what biome you're in\n" + - "Projectiles also change based on moon events"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Biome Blade"); + Tooltip.SetDefault("Fires different homing projectiles based on what biome you're in\n" + + "Projectiles also change based on moon events"); + } - public override void SetDefaults() - { - item.width = 62; - item.damage = 220; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; + public override void SetDefaults() + { + item.width = 62; + item.damage = 220; + item.melee = true; + item.useAnimation = 18; + item.useTime = 18; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; - item.shoot = mod.ProjectileType("OmegaBiomeOrb"); - item.shootSpeed = 15f; - item.Calamity().postMoonLordRarity = 12; - } + item.shoot = mod.ProjectileType("OmegaBiomeOrb"); + item.shootSpeed = 15f; + item.Calamity().postMoonLordRarity = 12; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int projectiles = 0; projectiles <= 2; projectiles++) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OmegaBiomeOrb"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } + { + for (int projectiles = 0; projectiles <= 2; projectiles++) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OmegaBiomeOrb"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueBiomeBlade"); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "BarofLife", 3); - recipe.AddIngredient(null, "GalacticaSingularity", 3); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueBiomeBlade"); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "BarofLife", 3); + recipe.AddIngredient(null, "GalacticaSingularity", 3); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 0); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 0); + } + } + } } diff --git a/Items/Weapons/Omniblade.cs b/Items/Weapons/Omniblade.cs index 155a2d5f17..149108cda9 100644 --- a/Items/Weapons/Omniblade.cs +++ b/Items/Weapons/Omniblade.cs @@ -5,50 +5,50 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Omniblade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omniblade"); - Tooltip.SetDefault("An ancient blade forged by the legendary Omnir\n" + - "Has a 20% chance to give enemies the whispering death debuff on hit\n" + - "This debuff cuts enemy defense by 50"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omniblade"); + Tooltip.SetDefault("An ancient blade forged by the legendary Omnir\n" + + "Has a 20% chance to give enemies the whispering death debuff on hit\n" + + "This debuff cuts enemy defense by 50"); + } - public override void SetDefaults() - { - item.width = 64; - item.damage = 63; - item.crit += 45; - item.melee = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 146; + public override void SetDefaults() + { + item.width = 64; + item.damage = 63; + item.crit += 45; + item.melee = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.useTurn = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 146; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(5)) - { - target.AddBuff(mod.BuffType("WhisperingDeath"), 360); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(5)) + { + target.AddBuff(mod.BuffType("WhisperingDeath"), 360); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Katana); recipe.AddIngredient(null, "BarofLife", 20); - recipe.AddIngredient(null, "CoreofCalamity", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddIngredient(null, "CoreofCalamity", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/OnyxChainBlaster.cs b/Items/Weapons/OnyxChainBlaster.cs index ba4200a7ef..667bc03c6e 100644 --- a/Items/Weapons/OnyxChainBlaster.cs +++ b/Items/Weapons/OnyxChainBlaster.cs @@ -6,70 +6,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class OnyxChainBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Onyx Chain Blaster"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + - "Fires a spread of bullets and an onyx shard"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Onyx Chain Blaster"); + Tooltip.SetDefault("50% chance to not consume ammo\n" + + "Fires a spread of bullets and an onyx shard"); + } - public override void SetDefaults() - { - item.damage = 58; - item.ranged = true; - item.width = 64; - item.height = 32; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; + public override void SetDefaults() + { + item.damage = 58; + item.ranged = true; + item.width = 64; + item.height = 32; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 24f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 24f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 12; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.9f, SpeedY * 0.9f, 661, damage, knockBack, player.whoAmI, 0f, 0f); - for (int i = 0; i <= 3; i++) - { - float SpeedNewX = speedX + (float) Main.rand.Next(-45, 46) * 0.05f; - float SpeedNewY = speedY + (float) Main.rand.Next(-45, 46) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedNewX, SpeedNewY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.9f, SpeedY * 0.9f, 661, damage, knockBack, player.whoAmI, 0f, 0f); + for (int i = 0; i <= 3; i++) + { + float SpeedNewX = speedX + (float)Main.rand.Next(-45, 46) * 0.05f; + float SpeedNewY = speedY + (float)Main.rand.Next(-45, 46) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedNewX, SpeedNewY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.OnyxBlaster); - recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.OnyxBlaster); + recipe.AddIngredient(ItemID.ChainGun); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Onyxia.cs b/Items/Weapons/Onyxia.cs index 58a51c3ff3..a58538ab21 100644 --- a/Items/Weapons/Onyxia.cs +++ b/Items/Weapons/Onyxia.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Onyxia"); Tooltip.SetDefault(NotConsumeAmmo.ToString() + "% chance to not consume ammo\n" + - "Fires a storm of bullets and onyx shards"); + "Fires a storm of bullets and onyx shards"); } public override void SetDefaults() @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 28f; item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/OpalStriker.cs b/Items/Weapons/OpalStriker.cs index 9acfd8c898..54cfcbe2f3 100644 --- a/Items/Weapons/OpalStriker.cs +++ b/Items/Weapons/OpalStriker.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class OpalStriker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Opal Striker"); - Tooltip.SetDefault("Fires a string of opal strikes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Opal Striker"); + Tooltip.SetDefault("Fires a string of opal strikes"); + } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 64; - item.height = 16; - item.useTime = 5; - item.reuseDelay = 25; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 0f; + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 64; + item.height = 16; + item.useTime = 5; + item.reuseDelay = 25; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("OpalStrike"); - item.shootSpeed = 6f; - item.useAmmo = 97; - } + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("OpalStrike"); + item.shootSpeed = 6f; + item.useAmmo = 97; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OpalStrike"), damage, 0f, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OpalStrike"), damage, 0f, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Marble, 20); recipe.AddIngredient(ItemID.Amber, 5); recipe.AddIngredient(ItemID.Diamond, 3); @@ -49,6 +49,6 @@ namespace CalamityMod.Items.Weapons recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/P90.cs b/Items/Weapons/P90.cs index e0df7ea6fa..c5a1fc1c0a 100644 --- a/Items/Weapons/P90.cs +++ b/Items/Weapons/P90.cs @@ -5,67 +5,67 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class P90 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("P90"); - Tooltip.SetDefault("33% chance to not consume ammo\n" + - "It's a bullet hose"); - } + public class P90 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("P90"); + Tooltip.SetDefault("33% chance to not consume ammo\n" + + "It's a bullet hose"); + } - public override void SetDefaults() - { - item.damage = 11; - item.ranged = true; - item.width = 60; - item.height = 28; - item.useTime = 2; - item.useAnimation = 2; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 18f; - item.useAmmo = 97; - } + public override void SetDefaults() + { + item.damage = 11; + item.ranged = true; + item.width = 60; + item.height = 28; + item.useTime = 2; + item.useAnimation = 2; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 18f; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-14, -1); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-14, -1); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 2; ++i) - { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 2; ++i) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddIngredient(null, "CoreofEleum", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 10); + recipe.anyIronBar = true; + recipe.AddIngredient(null, "CoreofEleum", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/PaintballBlaster.cs b/Items/Weapons/PaintballBlaster.cs index 327acd2398..2b28299f23 100644 --- a/Items/Weapons/PaintballBlaster.cs +++ b/Items/Weapons/PaintballBlaster.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,76 +7,76 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class PaintballBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Speed Blaster"); - Tooltip.SetDefault("Shoots a string of paint blasts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Speed Blaster"); + Tooltip.SetDefault("Shoots a string of paint blasts"); + } - public override void SetDefaults() - { - item.damage = 26; - item.ranged = true; - item.width = 54; - item.height = 26; - item.useAnimation = 24; - item.reuseDelay = 9; - item.useTime = 4; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; + public override void SetDefaults() + { + item.damage = 26; + item.ranged = true; + item.width = 54; + item.height = 26; + item.useAnimation = 24; + item.reuseDelay = 9; + item.useTime = 4; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = null; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = 587; - } + item.UseSound = null; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = 587; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - float num208 = num78; - float num209 = num79; - num208 += (float)Main.rand.Next(-1, 2) * 0.5f; - num209 += (float)Main.rand.Next(-1, 2) * 0.5f; - if (Collision.CanHitLine(player.Center, 0, 0, vector2 + new Vector2(num208, num209) * 2f, 0, 0)) - { - vector2 += new Vector2(num208, num209); - } - Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, 587, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(12) / 6f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + float num208 = num78; + float num209 = num79; + num208 += (float)Main.rand.Next(-1, 2) * 0.5f; + num209 += (float)Main.rand.Next(-1, 2) * 0.5f; + if (Collision.CanHitLine(player.Center, 0, 0, vector2 + new Vector2(num208, num209) * 2f, 0, 0)) + { + vector2 += new Vector2(num208, num209); + } + Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, 587, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(12) / 6f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PainterPaintballGun); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddIngredient(ItemID.HallowedBar, 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PainterPaintballGun); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddIngredient(ItemID.HallowedBar, 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Perforators/Aorta.cs b/Items/Weapons/Perforators/Aorta.cs index 9c2610a0f0..99a9ea9cf1 100644 --- a/Items/Weapons/Perforators/Aorta.cs +++ b/Items/Weapons/Perforators/Aorta.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Perforators { public class Aorta : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aorta"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aorta"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Valor); - item.damage = 25; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4.25f; + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Valor); + item.damage = 25; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4.25f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.autoReuse = false; - item.shoot = mod.ProjectileType("AortaProjectile"); - } + item.autoReuse = false; + item.shoot = mod.ProjectileType("AortaProjectile"); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 6); - recipe.AddIngredient(ItemID.Vertebrae, 3); - recipe.AddIngredient(ItemID.CrimtaneBar, 3); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 6); + recipe.AddIngredient(ItemID.Vertebrae, 3); + recipe.AddIngredient(ItemID.CrimtaneBar, 3); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Perforators/BloodBath.cs b/Items/Weapons/Perforators/BloodBath.cs index f50389ddb4..40e8092378 100644 --- a/Items/Weapons/Perforators/BloodBath.cs +++ b/Items/Weapons/Perforators/BloodBath.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,102 +7,102 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Perforators { public class BloodBath : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Bath"); - Tooltip.SetDefault("Drenches your foes in blood"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Bath"); + Tooltip.SetDefault("Drenches your foes in blood"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 25; - item.magic = true; - item.mana = 10; - item.width = 52; - item.height = 50; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.75f; + public override void SetDefaults() + { + item.damage = 25; + item.magic = true; + item.mana = 10; + item.width = 52; + item.height = 50; + item.useTime = 15; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.75f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodBeam"); - item.shootSpeed = 9f; - } + item.UseSound = SoundID.Item21; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodBeam"); + item.shootSpeed = 9f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 8); - recipe.AddIngredient(ItemID.Vertebrae, 3); - recipe.AddIngredient(ItemID.CrimtaneBar, 2); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 8); + recipe.AddIngredient(ItemID.Vertebrae, 3); + recipe.AddIngredient(ItemID.CrimtaneBar, 2); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 2; - if (Main.rand.NextBool(3)) - { - num107++; - } - if (Main.rand.NextBool(3)) - { - num107++; - } - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 2; + if (Main.rand.NextBool(3)) + { + num107++; + } + if (Main.rand.NextBool(3)) + { + num107++; + } + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); + } + return false; + } + } } diff --git a/Items/Weapons/Perforators/BloodClotStaff.cs b/Items/Weapons/Perforators/BloodClotStaff.cs index 934c627325..f07a7950a8 100644 --- a/Items/Weapons/Perforators/BloodClotStaff.cs +++ b/Items/Weapons/Perforators/BloodClotStaff.cs @@ -6,68 +6,68 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Perforators { public class BloodClotStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot Staff"); - Tooltip.SetDefault("Summons a blood clot to fight for you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Clot Staff"); + Tooltip.SetDefault("Summons a blood clot to fight for you"); + } - public override void SetDefaults() - { - item.damage = 7; - item.mana = 10; - item.width = 58; - item.height = 64; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2.25f; + public override void SetDefaults() + { + item.damage = 7; + item.mana = 10; + item.width = 58; + item.height = 64; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2.25f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodClotMinion"); - item.shootSpeed = 10f; - item.summon = true; - } + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodClotMinion"); + item.shootSpeed = 10f; + item.summon = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(null, "BloodSample", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Vertebrae, 4); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddIngredient(null, "BloodSample", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/Perforators/BloodyRupture.cs b/Items/Weapons/Perforators/BloodyRupture.cs index d67a44f8fb..d643fd6360 100644 --- a/Items/Weapons/Perforators/BloodyRupture.cs +++ b/Items/Weapons/Perforators/BloodyRupture.cs @@ -6,56 +6,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Perforators { public class BloodyRupture : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Rupture"); - Tooltip.SetDefault("Enemies release homing blood orbs on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Rupture"); + Tooltip.SetDefault("Enemies release homing blood orbs on death"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 24; - item.height = 24; - item.damage = 26; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 24; + item.height = 24; + item.damage = 26; + item.melee = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 4); - recipe.AddIngredient(ItemID.Vertebrae, 2); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 4); + recipe.AddIngredient(ItemID.Vertebrae, 2); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Blood"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Blood"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } } diff --git a/Items/Weapons/Perforators/Eviscerator.cs b/Items/Weapons/Perforators/Eviscerator.cs index 3b13d7d8df..23fc36b069 100644 --- a/Items/Weapons/Perforators/Eviscerator.cs +++ b/Items/Weapons/Perforators/Eviscerator.cs @@ -1,63 +1,59 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Perforators { public class Eviscerator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eviscerator"); - Tooltip.SetDefault("Fires a slow-moving blood clot"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eviscerator"); + Tooltip.SetDefault("Fires a slow-moving blood clot"); + } - public override void SetDefaults() - { - item.damage = 65; - item.ranged = true; - item.width = 58; - item.height = 22; - item.crit += 25; - item.useTime = 60; - item.useAnimation = 60; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; + public override void SetDefaults() + { + item.damage = 65; + item.ranged = true; + item.width = 58; + item.height = 22; + item.crit += 25; + item.useTime = 60; + item.useAnimation = 60; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodClotFriendly"); - item.shootSpeed = 22f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodClotFriendly"); + item.shootSpeed = 22f; + item.useAmmo = 97; + } public override Vector2? HoldoutOffset() { return new Vector2(-7, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodClotFriendly"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodClotFriendly"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 8); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 4); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 8); + recipe.AddIngredient(ItemID.Vertebrae, 4); + recipe.AddIngredient(ItemID.CrimtaneBar, 4); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Perforators/SausageMaker.cs b/Items/Weapons/Perforators/SausageMaker.cs index c2c0b16057..4440b7611b 100644 --- a/Items/Weapons/Perforators/SausageMaker.cs +++ b/Items/Weapons/Perforators/SausageMaker.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Perforators { public class SausageMaker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sausage Maker"); - Tooltip.SetDefault("Sprays homing blood on hit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sausage Maker"); + Tooltip.SetDefault("Sprays homing blood on hit"); + } - public override void SetDefaults() - { - item.width = 44; - item.damage = 29; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 42; + public override void SetDefaults() + { + item.width = 44; + item.damage = 29; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 42; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.shoot = mod.ProjectileType("SausageMaker"); - item.shootSpeed = 6f; - } + item.shoot = mod.ProjectileType("SausageMaker"); + item.shootSpeed = 6f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 8); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 8); + recipe.AddIngredient(ItemID.Vertebrae, 4); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Perforators/VeinBurster.cs b/Items/Weapons/Perforators/VeinBurster.cs index 82734ca0a4..52d4ef1e01 100644 --- a/Items/Weapons/Perforators/VeinBurster.cs +++ b/Items/Weapons/Perforators/VeinBurster.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Perforators { public class VeinBurster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vein Burster"); - Tooltip.SetDefault("Fires a blood ball that sticks to tiles and explodes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vein Burster"); + Tooltip.SetDefault("Fires a blood ball that sticks to tiles and explodes"); + } - public override void SetDefaults() - { - item.width = 52; - item.damage = 22; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; + public override void SetDefaults() + { + item.width = 52; + item.damage = 22; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.shoot = mod.ProjectileType("BloodBall"); - item.shootSpeed = 5f; - } + item.shoot = mod.ProjectileType("BloodBall"); + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 5); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(null, "BloodSample", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Vertebrae, 5); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddIngredient(null, "BloodSample", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Phangasm.cs b/Items/Weapons/Phangasm.cs index a1ba3043c3..7e4551f181 100644 --- a/Items/Weapons/Phangasm.cs +++ b/Items/Weapons/Phangasm.cs @@ -6,51 +6,51 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Phangasm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phangasm"); - Tooltip.SetDefault("Fires a spread of arrows and emits phantom arrows on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phangasm"); + Tooltip.SetDefault("Fires a spread of arrows and emits phantom arrows on enemy hits"); + } - public override void SetDefaults() - { - item.damage = 112; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.knockBack = 3f; + public override void SetDefaults() + { + item.damage = 112; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.knockBack = 3f; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.UseSound = SoundID.Item5; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Phangasm"); - item.shootSpeed = 20f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 14; - } + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Phangasm"); + item.shootSpeed = 20f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 14; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Phangasm"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Phangasm"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Phantasm); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Phantasm); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/PhantasmalFury.cs b/Items/Weapons/PhantasmalFury.cs index 4fa31c9168..ab540862b6 100644 --- a/Items/Weapons/PhantasmalFury.cs +++ b/Items/Weapons/PhantasmalFury.cs @@ -5,44 +5,44 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class PhantasmalFury : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantasmal Fury"); - Tooltip.SetDefault("Casts a phantasmal bolt that explodes into more bolts"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantasmal Fury"); + Tooltip.SetDefault("Casts a phantasmal bolt that explodes into more bolts"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 320; - item.magic = true; - item.mana = 20; - item.width = 62; - item.height = 60; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; + public override void SetDefaults() + { + item.damage = 320; + item.magic = true; + item.mana = 20; + item.width = 62; + item.height = 60; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PhantasmalFury"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("PhantasmalFury"); + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 13; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreStaff); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddIngredient(null, "DarkPlasma"); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpectreStaff); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddIngredient(null, "DarkPlasma"); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/PhoenixBlade.cs b/Items/Weapons/PhoenixBlade.cs index f7aff53664..ea4e4337e2 100644 --- a/Items/Weapons/PhoenixBlade.cs +++ b/Items/Weapons/PhoenixBlade.cs @@ -1,71 +1,69 @@ -using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class PhoenixBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phoenix Blade"); - Tooltip.SetDefault("Enemies explode and emit healing flames on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phoenix Blade"); + Tooltip.SetDefault("Enemies explode and emit healing flames on death"); + } - public override void SetDefaults() - { - item.width = 106; - item.damage = 95; - item.melee = true; - item.useAnimation = 29; - item.useStyle = 1; - item.useTime = 29; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 106; + public override void SetDefaults() + { + item.width = 106; + item.damage = 95; + item.melee = true; + item.useAnimation = 29; + item.useStyle = 1; + item.useTime = 29; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 106; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; - item.shootSpeed = 12f; - } + item.shootSpeed = 12f; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), damage, knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - float randomSpeedX = (float)Main.rand.Next(5); - float randomSpeedY = (float)Main.rand.Next(3, 7); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("PhoenixHeal"), item.damage, knockback, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("PhoenixHeal"), item.damage, knockback, player.whoAmI); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), damage, knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceMelee = true; + float randomSpeedX = (float)Main.rand.Next(5); + float randomSpeedY = (float)Main.rand.Next(3, 7); + Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("PhoenixHeal"), item.damage, knockback, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("PhoenixHeal"), item.damage, knockback, player.whoAmI); + } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BreakerBlade); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BreakerBlade); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Photoviscerator.cs b/Items/Weapons/Photoviscerator.cs index 61fb34c704..b2b54adc95 100644 --- a/Items/Weapons/Photoviscerator.cs +++ b/Items/Weapons/Photoviscerator.cs @@ -6,34 +6,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Photoviscerator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Photoviscerator"); - Tooltip.SetDefault("90% chance to not consume gel\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Photoviscerator"); + Tooltip.SetDefault("90% chance to not consume gel\n" + "Fires a stream of exo flames that literally melts everything"); - } + } - public override void SetDefaults() - { - item.damage = 250; - item.ranged = true; - item.width = 84; - item.height = 30; - item.useTime = 2; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 250; + item.ranged = true; + item.width = 84; + item.height = 30; + item.useTime = 2; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("ExoFire"); - item.shootSpeed = 6f; - item.useAmmo = 23; - item.Calamity().postMoonLordRarity = 15; - } + item.shoot = mod.ProjectileType("ExoFire"); + item.shootSpeed = 6f; + item.useAmmo = 23; + item.Calamity().postMoonLordRarity = 15; + } public override Vector2? HoldoutOffset() { @@ -42,28 +42,28 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } return false; } public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } + { + if (Main.rand.Next(0, 100) < 90) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ElementalEruption"); - recipe.AddIngredient(null, "CleansingBlaze"); - recipe.AddIngredient(null, "HalleysInferno"); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ElementalEruption"); + recipe.AddIngredient(null, "CleansingBlaze"); + recipe.AddIngredient(null, "HalleysInferno"); recipe.AddIngredient(null, "NightmareFuel", 5); recipe.AddIngredient(null, "EndothermicEnergy", 5); recipe.AddIngredient(null, "CosmiliteBar", 5); @@ -75,5 +75,5 @@ namespace CalamityMod.Items.Weapons recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Weapons/PlagueKeeper.cs b/Items/Weapons/PlagueKeeper.cs index 8ab4540e04..e600eddb2b 100644 --- a/Items/Weapons/PlagueKeeper.cs +++ b/Items/Weapons/PlagueKeeper.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -10,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Keeper"); - Tooltip.SetDefault("Fires a plague and bee cloud"); - } + Tooltip.SetDefault("Fires a plague and bee cloud"); + } public override void SetDefaults() { @@ -30,8 +29,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("PlagueBeeDust"); item.shootSpeed = 9f; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { @@ -53,8 +52,8 @@ namespace CalamityMod.Items.Weapons int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, player.beeType(), player.beeDamage(item.damage / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); Main.projectile[bee].penetrate = 1; - Main.projectile[bee].Calamity().forceMelee = true; - } + Main.projectile[bee].Calamity().forceMelee = true; + } } } } diff --git a/Items/Weapons/Plaguebringer/Malevolence.cs b/Items/Weapons/Plaguebringer/Malevolence.cs index cbccf6e23d..e63c3adebb 100644 --- a/Items/Weapons/Plaguebringer/Malevolence.cs +++ b/Items/Weapons/Plaguebringer/Malevolence.cs @@ -6,42 +6,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Plaguebringer { public class Malevolence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malevolence"); - Tooltip.SetDefault("Fires two plague arrows that explode into bees on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malevolence"); + Tooltip.SetDefault("Fires two plague arrows that explode into bees on death"); + } - public override void SetDefaults() - { - item.damage = 51; - item.ranged = true; - item.width = 36; - item.height = 58; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item97; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("PlagueArrow"); - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 51; + item.ranged = true; + item.width = 36; + item.height = 58; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item97; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("PlagueArrow"); + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("PlagueArrow"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("PlagueArrow"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } diff --git a/Items/Weapons/Plaguebringer/MepheticSprayer.cs b/Items/Weapons/Plaguebringer/MepheticSprayer.cs index 81289e0eb1..51a4b33069 100644 --- a/Items/Weapons/Plaguebringer/MepheticSprayer.cs +++ b/Items/Weapons/Plaguebringer/MepheticSprayer.cs @@ -5,30 +5,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Plaguebringer { public class MepheticSprayer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blight Spewer"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blight Spewer"); + } - public override void SetDefaults() - { - item.damage = 110; - item.ranged = true; - item.width = 76; - item.height = 36; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 110; + item.ranged = true; + item.width = 76; + item.height = 36; + item.useTime = 10; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CorossiveFlames"); - item.shootSpeed = 7.5f; - item.useAmmo = 23; - } - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("CorossiveFlames"); + item.shootSpeed = 7.5f; + item.useAmmo = 23; + } + } } diff --git a/Items/Weapons/Plaguebringer/PestilentDefiler.cs b/Items/Weapons/Plaguebringer/PestilentDefiler.cs index a276cc5022..70c4004c6f 100644 --- a/Items/Weapons/Plaguebringer/PestilentDefiler.cs +++ b/Items/Weapons/Plaguebringer/PestilentDefiler.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Plaguebringer public override void SetStaticDefaults() { DisplayName.SetDefault("Pestilent Defiler"); - Tooltip.SetDefault("Fires a plague round that explodes and splits on death"); - } + Tooltip.SetDefault("Fires a plague round that explodes and splits on death"); + } public override void SetDefaults() { diff --git a/Items/Weapons/Plaguebringer/PlagueStaff.cs b/Items/Weapons/Plaguebringer/PlagueStaff.cs index f8ab54b579..cf7f04fb98 100644 --- a/Items/Weapons/Plaguebringer/PlagueStaff.cs +++ b/Items/Weapons/Plaguebringer/PlagueStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,70 +7,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Plaguebringer { public class PlagueStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Staff"); - Tooltip.SetDefault("Fires a spread of plague fangs"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Staff"); + Tooltip.SetDefault("Fires a spread of plague fangs"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 78; - item.magic = true; - item.mana = 22; - item.width = 46; - item.height = 46; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; + public override void SetDefaults() + { + item.damage = 78; + item.magic = true; + item.mana = 22; + item.width = 46; + item.height = 46; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlagueFang"); - item.shootSpeed = 16f; - } + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlagueFang"); + item.shootSpeed = 16f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - int num130 = 6; - if (Main.rand.NextBool(3)) - { - num130++; - } - if (Main.rand.NextBool(4)) - { - num130++; - } - if (Main.rand.NextBool(5)) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) - { - float num132 = num78; - float num133 = num79; - float num134 = 0.05f * (float)num131; - num132 += (float)Main.rand.Next(-120, 121) * num134; - num133 += (float)Main.rand.Next(-120, 121) * num134; - num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); - num80 = num72 / num80; - num132 *= num80; - num133 *= num80; - float x2 = vector2.X; - float y2 = vector2.Y; - Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("PlagueFang"), damage, knockBack, Main.myPlayer, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num72 = item.shootSpeed; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + int num130 = 6; + if (Main.rand.NextBool(3)) + { + num130++; + } + if (Main.rand.NextBool(4)) + { + num130++; + } + if (Main.rand.NextBool(5)) + { + num130++; + } + for (int num131 = 0; num131 < num130; num131++) + { + float num132 = num78; + float num133 = num79; + float num134 = 0.05f * (float)num131; + num132 += (float)Main.rand.Next(-120, 121) * num134; + num133 += (float)Main.rand.Next(-120, 121) * num134; + num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); + num80 = num72 / num80; + num132 *= num80; + num133 *= num80; + float x2 = vector2.X; + float y2 = vector2.Y; + Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("PlagueFang"), damage, knockBack, Main.myPlayer, 0f, 0f); + } + return false; + } + } } diff --git a/Items/Weapons/Plaguebringer/TheHive.cs b/Items/Weapons/Plaguebringer/TheHive.cs index 8f3d323197..7728b8aadb 100644 --- a/Items/Weapons/Plaguebringer/TheHive.cs +++ b/Items/Weapons/Plaguebringer/TheHive.cs @@ -6,45 +6,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Plaguebringer { public class TheHive : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive"); - Tooltip.SetDefault("Launches a variety of rockets that explode into bees on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Hive"); + Tooltip.SetDefault("Launches a variety of rockets that explode into bees on death"); + } - public override void SetDefaults() - { - item.damage = 70; - item.ranged = true; - item.width = 62; - item.height = 30; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 70; + item.ranged = true; + item.width = 62; + item.height = 30; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BeeRPG"); - item.shootSpeed = 13f; - item.useAmmo = 771; - } + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BeeRPG"); + item.shootSpeed = 13f; + item.useAmmo = 771; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(4)) - { - case 0: type = mod.ProjectileType("GoliathRocket"); break; - case 1: type = mod.ProjectileType("HiveMissile"); break; - case 2: type = mod.ProjectileType("HiveBomb"); break; - case 3: type = mod.ProjectileType("BeeRPG"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(4)) + { + case 0: + type = mod.ProjectileType("GoliathRocket"); + break; + case 1: + type = mod.ProjectileType("HiveMissile"); + break; + case 2: + type = mod.ProjectileType("HiveBomb"); + break; + case 3: + type = mod.ProjectileType("BeeRPG"); + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Plaguebringer/VirulentKatana.cs b/Items/Weapons/Plaguebringer/VirulentKatana.cs index 49f4f06e63..7f818f92ec 100644 --- a/Items/Weapons/Plaguebringer/VirulentKatana.cs +++ b/Items/Weapons/Plaguebringer/VirulentKatana.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons.Plaguebringer public override void SetStaticDefaults() { DisplayName.SetDefault("Virulence"); - Tooltip.SetDefault("Fires a plague cloud"); - } + Tooltip.SetDefault("Fires a plague cloud"); + } public override void SetDefaults() { diff --git a/Items/Weapons/PlanetaryAnnihilation.cs b/Items/Weapons/PlanetaryAnnihilation.cs index 904eb03441..3e7ac8d35e 100644 --- a/Items/Weapons/PlanetaryAnnihilation.cs +++ b/Items/Weapons/PlanetaryAnnihilation.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,113 +7,113 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class PlanetaryAnnihilation : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Planetary Annihilation"); - Tooltip.SetDefault("Fires a storm of arrows from the sky\n" + - "Wooden arrows are converted to homing energy bolts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Planetary Annihilation"); + Tooltip.SetDefault("Fires a storm of arrows from the sky\n" + + "Wooden arrows are converted to homing energy bolts"); + } - public override void SetDefaults() - { - item.damage = 75; - item.ranged = true; - item.width = 58; - item.height = 102; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraBallBow"); - item.shootSpeed = 12f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.damage = 75; + item.ranged = true; + item.width = 58; + item.height = 102; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraBallBow"); + item.shootSpeed = 12f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 12; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= 100f; - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - if (type == ProjectileID.WoodenArrowFriendly) - { - for (int i = 0; i < 7; i++) - { - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBallBow"), damage, knockBack, player.whoAmI, 0f, (float)i); - } - } - else - { - for (int i = 0; i < 7; i++) - { - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= 100f; + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + if (type == ProjectileID.WoodenArrowFriendly) + { + for (int i = 0; i < 7; i++) + { + float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBallBow"), damage, knockBack, player.whoAmI, 0f, (float)i); + } + } + else + { + for (int i = 0; i < 7; i++) + { + float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmicBolter"); - recipe.AddIngredient(ItemID.DaedalusStormbow); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmicBolter"); + recipe.AddIngredient(ItemID.DaedalusStormbow); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/PlasmaRifle.cs b/Items/Weapons/PlasmaRifle.cs index 55f1abe302..2ac93846a2 100644 --- a/Items/Weapons/PlasmaRifle.cs +++ b/Items/Weapons/PlasmaRifle.cs @@ -5,94 +5,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class PlasmaRifle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plasma Rifle"); - Tooltip.SetDefault("Fires a plasma blast that explodes\n" + - "Right click to fire plasma bolts"); - } + public class PlasmaRifle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Rifle"); + Tooltip.SetDefault("Fires a plasma blast that explodes\n" + + "Right click to fire plasma bolts"); + } - public override void SetDefaults() - { - item.damage = 460; - item.mana = 40; - item.magic = true; - item.width = 48; - item.height = 22; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 460; + item.mana = 40; + item.magic = true; + item.width = 48; + item.height = 22; + item.useTime = 40; + item.useAnimation = 40; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("PlasmaShot"); - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("PlasmaShot"); + item.Calamity().postMoonLordRarity = 12; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.mana = 5; - item.useTime = 8; - item.useAnimation = 8; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - } - else - { - item.mana = 40; - item.useTime = 40; - item.useAnimation = 40; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.mana = 5; + item.useTime = 8; + item.useAnimation = 8; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + } + else + { + item.mana = 40; + item.useTime = 40; + item.useAnimation = 40; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaBolt"), damage, knockBack, player.whoAmI, 0f, 0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaShot"), (int)(damage * 0.75f), knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaBolt"), damage, knockBack, player.whoAmI, 0f, 0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaShot"), (int)(damage * 0.75f), knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(ItemID.Musket); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(ItemID.TheUndertaker); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(ItemID.Musket); + recipe.AddIngredient(ItemID.ToxicFlask); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(ItemID.TheUndertaker); + recipe.AddIngredient(ItemID.ToxicFlask); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/PlasmaRod.cs b/Items/Weapons/PlasmaRod.cs index 337d020ccb..ca8f0d30cd 100644 --- a/Items/Weapons/PlasmaRod.cs +++ b/Items/Weapons/PlasmaRod.cs @@ -5,34 +5,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class PlasmaRod : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plasma Rod"); - Tooltip.SetDefault("Casts a low-damage plasma bolt\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Rod"); + Tooltip.SetDefault("Casts a low-damage plasma bolt\n" + "Shooting a tile will cause several bolts with increased damage to fire\n" + "Shooting an enemy will cause several debuffs for a short time"); - Item.staff[item.type] = true; - } + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 8; - item.magic = true; - item.mana = 10; - item.width = 40; - item.height = 40; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; + public override void SetDefaults() + { + item.damage = 8; + item.magic = true; + item.mana = 10; + item.width = 40; + item.height = 40; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlasmaRay"); - item.shootSpeed = 6f; - } - } + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlasmaRay"); + item.shootSpeed = 6f; + } + } } diff --git a/Items/Weapons/Polterghast/BansheeHook.cs b/Items/Weapons/Polterghast/BansheeHook.cs index 89dacf360b..25dcb079d9 100644 --- a/Items/Weapons/Polterghast/BansheeHook.cs +++ b/Items/Weapons/Polterghast/BansheeHook.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Polterghast item.rare = 10; item.shoot = mod.ProjectileType("BansheeHook"); item.shootSpeed = 42f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override bool CanUseItem(Player player) { diff --git a/Items/Weapons/Polterghast/DaemonsFlame.cs b/Items/Weapons/Polterghast/DaemonsFlame.cs index 58ec52d98e..3a86520619 100644 --- a/Items/Weapons/Polterghast/DaemonsFlame.cs +++ b/Items/Weapons/Polterghast/DaemonsFlame.cs @@ -6,40 +6,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Polterghast { public class DaemonsFlame : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daemon's Flame"); - Tooltip.SetDefault("Shoots daemon flame arrows as well as regular arrows"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daemon's Flame"); + Tooltip.SetDefault("Shoots daemon flame arrows as well as regular arrows"); + } - public override void SetDefaults() - { - item.damage = 160; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 160; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.knockBack = 4f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item5; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DaemonsFlame"); - item.shootSpeed = 20f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 13; - } + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DaemonsFlame"); + item.shootSpeed = 20f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 13; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DaemonsFlame"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DaemonsFlame"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Polterghast/EtherealSubjugator.cs b/Items/Weapons/Polterghast/EtherealSubjugator.cs index e7768eef19..9bff4ed9e2 100644 --- a/Items/Weapons/Polterghast/EtherealSubjugator.cs +++ b/Items/Weapons/Polterghast/EtherealSubjugator.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons.Polterghast item.shoot = mod.ProjectileType("PhantomGuy"); item.shootSpeed = 10f; item.summon = true; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Polterghast/FatesReveal.cs b/Items/Weapons/Polterghast/FatesReveal.cs index 7f274630ec..ebfb0d27ee 100644 --- a/Items/Weapons/Polterghast/FatesReveal.cs +++ b/Items/Weapons/Polterghast/FatesReveal.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,37 +7,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Polterghast { public class FatesReveal : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fate's Reveal"); - Tooltip.SetDefault("Spawns ghostly fireballs that follow the player"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fate's Reveal"); + Tooltip.SetDefault("Spawns ghostly fireballs that follow the player"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 60; - item.magic = true; - item.mana = 20; - item.width = 68; - item.height = 72; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 20; + item.width = 68; + item.height = 72; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FatesReveal"); - item.shootSpeed = 1f; - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("FatesReveal"); + item.shootSpeed = 1f; + item.Calamity().postMoonLordRarity = 13; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y; @@ -59,15 +59,15 @@ namespace CalamityMod.Items.Weapons.Polterghast } vector += new Vector2(num78, num79); int num107 = 5; - for (int num108 = 0; num108 < num107; num108++) - { - vector.X += (float)Main.rand.Next(-100, 101); - vector.Y += (float)(Main.rand.Next(-25, 26) * num108); + for (int num108 = 0; num108 < num107; num108++) + { + vector.X += (float)Main.rand.Next(-100, 101); + vector.Y += (float)(Main.rand.Next(-25, 26) * num108); float spawnX = vector.X; float spawnY = vector.Y; - Projectile.NewProjectile(spawnX, spawnY, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - } - return false; - } - } + Projectile.NewProjectile(spawnX, spawnY, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + } + return false; + } + } } diff --git a/Items/Weapons/Polterghast/GhastlyVisage.cs b/Items/Weapons/Polterghast/GhastlyVisage.cs index 14c4dca6d0..e8c0fb0434 100644 --- a/Items/Weapons/Polterghast/GhastlyVisage.cs +++ b/Items/Weapons/Polterghast/GhastlyVisage.cs @@ -4,38 +4,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Polterghast { public class GhastlyVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghastly Visage"); - Tooltip.SetDefault("Fires homing ghast energy that explodes"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Visage"); + Tooltip.SetDefault("Fires homing ghast energy that explodes"); + } - public override void SetDefaults() - { - item.damage = 92; - item.magic = true; - item.noUseGraphic = true; - item.channel = true; - item.mana = 20; - item.width = 78; - item.height = 70; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 92; + item.magic = true; + item.noUseGraphic = true; + item.channel = true; + item.mana = 20; + item.width = 78; + item.height = 70; + item.useTime = 27; + item.useAnimation = 27; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("GhastlyVisage"); - item.Calamity().postMoonLordRarity = 13; - } + item.shoot = mod.ProjectileType("GhastlyVisage"); + item.Calamity().postMoonLordRarity = 13; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhastlyVisage"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhastlyVisage"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Polterghast/TerrorBlade.cs b/Items/Weapons/Polterghast/TerrorBlade.cs index 141309a273..4138157f6d 100644 --- a/Items/Weapons/Polterghast/TerrorBlade.cs +++ b/Items/Weapons/Polterghast/TerrorBlade.cs @@ -6,40 +6,40 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Polterghast { public class TerrorBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terror Blade"); - Tooltip.SetDefault("Fires a terror beam that bounces off tiles\n" + - "On every bounce it emits an explosion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terror Blade"); + Tooltip.SetDefault("Fires a terror beam that bounces off tiles\n" + + "On every bounce it emits an explosion"); + } - public override void SetDefaults() - { - item.width = 88; - item.damage = 350; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; + public override void SetDefaults() + { + item.width = 88; + item.damage = 350; + item.melee = true; + item.useAnimation = 18; + item.useTime = 18; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("TerrorBeam"); - item.shootSpeed = 20f; - item.Calamity().postMoonLordRarity = 13; - } + item.shootSpeed = 20f; + item.Calamity().postMoonLordRarity = 13; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 60); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 60); + } + } + } } diff --git a/Items/Weapons/PrimordialAncient.cs b/Items/Weapons/PrimordialAncient.cs index 4986e2a1cd..25925a745f 100644 --- a/Items/Weapons/PrimordialAncient.cs +++ b/Items/Weapons/PrimordialAncient.cs @@ -5,45 +5,45 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class PrimordialAncient : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Primordial Ancient"); - Tooltip.SetDefault("An ancient relic from an ancient land\n" + - "Casts a gigantic blast of dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Primordial Ancient"); + Tooltip.SetDefault("An ancient relic from an ancient land\n" + + "Casts a gigantic blast of dust"); + } - public override void SetDefaults() - { - item.damage = 385; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; + public override void SetDefaults() + { + item.damage = 385; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 30; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Ancient"); - item.shootSpeed = 8f; - item.Calamity().postMoonLordRarity = 14; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("Ancient"); + item.shootSpeed = 8f; + item.Calamity().postMoonLordRarity = 14; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PrimordialEarth"); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 10); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PrimordialEarth"); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 10); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/PrimordialEarth.cs b/Items/Weapons/PrimordialEarth.cs index 6ba02825e8..2df644bf0f 100644 --- a/Items/Weapons/PrimordialEarth.cs +++ b/Items/Weapons/PrimordialEarth.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class PrimordialEarth : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Primordial Earth"); - Tooltip.SetDefault("Casts a large blast of dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Primordial Earth"); + Tooltip.SetDefault("Casts a large blast of dust"); + } - public override void SetDefaults() - { - item.damage = 85; - item.magic = true; - item.mana = 19; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7; + public override void SetDefaults() + { + item.damage = 85; + item.magic = true; + item.mana = 19; + item.width = 28; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SupremeDustProjectile"); - item.shootSpeed = 4f; - } + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SupremeDustProjectile"); + item.shootSpeed = 4f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DeathValley"); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 3); - recipe.AddIngredient(ItemID.MeteoriteBar, 5); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DeathValley"); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 3); + recipe.AddIngredient(ItemID.MeteoriteBar, 5); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ProfanedSword.cs b/Items/Weapons/ProfanedSword.cs index 2e5c82847b..13b3838a48 100644 --- a/Items/Weapons/ProfanedSword.cs +++ b/Items/Weapons/ProfanedSword.cs @@ -7,12 +7,12 @@ namespace CalamityMod.Items.Weapons { public class ProfanedSword : ModItem { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Sword"); - Tooltip.SetDefault("Summons brimstone geysers on hit\n" + - "Right click to throw like a javelin that explodes on hit"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Sword"); + Tooltip.SetDefault("Summons brimstone geysers on hit\n" + + "Right click to throw like a javelin that explodes on hit"); + } public override void SetDefaults() { @@ -22,47 +22,47 @@ namespace CalamityMod.Items.Weapons item.height = 50; item.useTime = 23; item.useAnimation = 23; - item.useTurn = true; + item.useTurn = true; item.useStyle = 1; item.knockBack = 7.5f; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.shootSpeed = 20f; - } + item.shootSpeed = 20f; + } - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.noMelee = true; - item.noUseGraphic = true; - item.shoot = mod.ProjectileType("ProfanedSword"); - } - else - { - item.noMelee = false; - item.noUseGraphic = false; - item.shoot = 0; - } - return base.CanUseItem(player); - } - - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ProfanedSword"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + public override bool AltFunctionUse(Player player) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noMelee = true; + item.noUseGraphic = true; + item.shoot = mod.ProjectileType("ProfanedSword"); + } + else + { + item.noMelee = false; + item.noUseGraphic = false; + item.shoot = 0; + } + return base.CanUseItem(player); + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ProfanedSword"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Brimblast"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); } @@ -75,12 +75,12 @@ namespace CalamityMod.Items.Weapons } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/ProporsePistol.cs b/Items/Weapons/ProporsePistol.cs index 05002daee7..1f60c33271 100644 --- a/Items/Weapons/ProporsePistol.cs +++ b/Items/Weapons/ProporsePistol.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ProporsePistol : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Proporse Pistol"); - Tooltip.SetDefault("Fires a blue energy blast that bounces"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Proporse Pistol"); + Tooltip.SetDefault("Fires a blue energy blast that bounces"); + } - public override void SetDefaults() - { - item.damage = 90; - item.ranged = true; - item.width = 36; - item.height = 20; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 90; + item.ranged = true; + item.width = 36; + item.height = 20; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("ProBolt"); - item.useAmmo = 97; - } + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("ProBolt"); + item.useAmmo = 97; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ProBolt"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ProBolt"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Providence/BlissfulBombardier.cs b/Items/Weapons/Providence/BlissfulBombardier.cs index 55ec3f442b..0af2699d06 100644 --- a/Items/Weapons/Providence/BlissfulBombardier.cs +++ b/Items/Weapons/Providence/BlissfulBombardier.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Providence item.shootSpeed = 24f; item.shoot = mod.ProjectileType("Nuke"); item.useAmmo = 771; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Providence/HolyCollider.cs b/Items/Weapons/Providence/HolyCollider.cs index 158769b4c7..749547ac7c 100644 --- a/Items/Weapons/Providence/HolyCollider.cs +++ b/Items/Weapons/Providence/HolyCollider.cs @@ -30,32 +30,32 @@ namespace CalamityMod.Items.Weapons.Providence item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shootSpeed = 10f; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } - float spread = 45f * 0.0174f; + float spread = 45f * 0.0174f; double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; diff --git a/Items/Weapons/Providence/PurgeGuzzler.cs b/Items/Weapons/Providence/PurgeGuzzler.cs index 077b941cb2..ad075378b7 100644 --- a/Items/Weapons/Providence/PurgeGuzzler.cs +++ b/Items/Weapons/Providence/PurgeGuzzler.cs @@ -5,33 +5,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Providence { public class PurgeGuzzler : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purge Guzzler"); - Tooltip.SetDefault("Fires three beams of holy energy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purge Guzzler"); + Tooltip.SetDefault("Fires three beams of holy energy"); + } - public override void SetDefaults() - { - item.damage = 80; - item.magic = true; - item.mana = 12; - item.width = 58; - item.height = 44; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + public override void SetDefaults() + { + item.damage = 80; + item.magic = true; + item.mana = 12; + item.width = 58; + item.height = 44; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("HolyLaser"); - item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 12; - } + item.shoot = mod.ProjectileType("HolyLaser"); + item.shootSpeed = 6f; + item.Calamity().postMoonLordRarity = 12; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -44,5 +44,5 @@ namespace CalamityMod.Items.Weapons.Providence } return false; } - } + } } diff --git a/Items/Weapons/Providence/SolarFlare.cs b/Items/Weapons/Providence/SolarFlare.cs index cf6d3af2bb..6113c568f7 100644 --- a/Items/Weapons/Providence/SolarFlare.cs +++ b/Items/Weapons/Providence/SolarFlare.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Providence item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("SolarFlareYoyo"); - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } } } diff --git a/Items/Weapons/Providence/TelluricGlare.cs b/Items/Weapons/Providence/TelluricGlare.cs index 65bee202d4..13a130c2dd 100644 --- a/Items/Weapons/Providence/TelluricGlare.cs +++ b/Items/Weapons/Providence/TelluricGlare.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Providence public override void SetStaticDefaults() { DisplayName.SetDefault("Telluric Glare"); - Tooltip.SetDefault("Shoots an extremely fast energy arrow"); - } + Tooltip.SetDefault("Shoots an extremely fast energy arrow"); + } public override void SetDefaults() { @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Providence item.shoot = mod.ProjectileType("TelluricGlare"); item.shootSpeed = 12f; item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Pumpler.cs b/Items/Weapons/Pumpler.cs index add7711260..84fd3c7a79 100644 --- a/Items/Weapons/Pumpler.cs +++ b/Items/Weapons/Pumpler.cs @@ -6,94 +6,94 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Pumpler : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pumpler"); - Tooltip.SetDefault("33% chance to not consume ammo\n" + - "Right click to fire an explosive pumpkin"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pumpler"); + Tooltip.SetDefault("33% chance to not consume ammo\n" + + "Right click to fire an explosive pumpkin"); + } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 50; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.25f; + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 50; + item.height = 28; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.25f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 11f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 11f; + item.useAmmo = 97; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 36; - item.useAnimation = 36; - item.shootSpeed = 4f; - } - else - { - item.useTime = 9; - item.useAnimation = 9; - item.shootSpeed = 11f; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 36; + item.useAnimation = 36; + item.shootSpeed = 4f; + } + else + { + item.useTime = 9; + item.useAnimation = 9; + item.shootSpeed = 11f; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.JackOLantern, (int)((double)damage * 1.65), knockBack * 4f, player.whoAmI, 0f, 0f); - } - else - { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.JackOLantern, (int)((double)damage * 1.65), knockBack * 4f, player.whoAmI, 0f, 0f); + } + else + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pumpkin, 30); - recipe.AddIngredient(ItemID.PumpkinSeed, 5); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pumpkin, 30); + recipe.AddIngredient(ItemID.PumpkinSeed, 5); + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Purge.cs b/Items/Weapons/Purge.cs index 9eb4b43752..d1fec92029 100644 --- a/Items/Weapons/Purge.cs +++ b/Items/Weapons/Purge.cs @@ -5,49 +5,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Purge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nano Purge"); - Tooltip.SetDefault("Fires a barrage of nano lasers"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nano Purge"); + Tooltip.SetDefault("Fires a barrage of nano lasers"); + } - public override void SetDefaults() - { - item.damage = 70; - item.magic = true; - item.mana = 6; - item.width = 20; - item.height = 12; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 3f; + public override void SetDefaults() + { + item.damage = 70; + item.magic = true; + item.mana = 6; + item.width = 20; + item.height = 12; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 3f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Purge"); - item.shootSpeed = 24f; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("Purge"); + item.shootSpeed = 24f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddIngredient(ItemID.LaserMachinegun); - recipe.AddIngredient(ItemID.Nanites, 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentVortex, 20); + recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddIngredient(ItemID.Nanites, 100); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Purge"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Purge"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/PurityAxe.cs b/Items/Weapons/PurityAxe.cs index a3ff3f40e9..fbf8d4f87a 100644 --- a/Items/Weapons/PurityAxe.cs +++ b/Items/Weapons/PurityAxe.cs @@ -5,84 +5,84 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class PurityAxe : ModItem - { - private static int AxePower = 25; - private static float PowderSpeed = 21f; + public class PurityAxe : ModItem + { + private static int AxePower = 25; + private static float PowderSpeed = 21f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Axe of Purity"); - Tooltip.SetDefault("Left click to use as a tool\n" + - "Right click to cleanse evil"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Axe of Purity"); + Tooltip.SetDefault("Left click to use as a tool\n" + + "Right click to cleanse evil"); + } - public override void SetDefaults() - { - item.damage = 43; - item.melee = true; - item.width = 58; - item.height = 46; - item.useTime = 19; - item.useAnimation = 19; - item.useTurn = true; - item.axe = AxePower; - item.useStyle = 1; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 43; + item.melee = true; + item.width = 58; + item.height = 46; + item.useTime = 19; + item.useAnimation = 19; + item.useTurn = true; + item.axe = AxePower; + item.useStyle = 1; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int powderDamage = (int)(0.85f * damage); - int idx = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, powderDamage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[idx].melee = true; - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int powderDamage = (int)(0.85f * damage); + int idx = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, powderDamage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[idx].melee = true; + return false; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.axe = 0; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = PowderSpeed; - } - else - { - item.axe = AxePower; - item.shoot = 0; - item.shootSpeed = 0f; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.axe = 0; + item.shoot = ProjectileID.PurificationPowder; + item.shootSpeed = PowderSpeed; + } + else + { + item.axe = AxePower; + item.shoot = 0; + item.shootSpeed = 0f; + } + return base.CanUseItem(player); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FellerofEvergreens"); - recipe.AddIngredient(ItemID.PurificationPowder, 20); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddIngredient(ItemID.CrystalShard, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FellerofEvergreens"); + recipe.AddIngredient(ItemID.PurificationPowder, 20); + recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddIngredient(ItemID.CrystalShard, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/PwnagehammerMelee.cs b/Items/Weapons/PwnagehammerMelee.cs index 49e8562396..5dfc013013 100644 --- a/Items/Weapons/PwnagehammerMelee.cs +++ b/Items/Weapons/PwnagehammerMelee.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws an extremely fast hammer"); - } + Tooltip.SetDefault("Throws an extremely fast hammer"); + } public override void SetDefaults() { diff --git a/Items/Weapons/Quagmire.cs b/Items/Weapons/Quagmire.cs index 4066d2afbe..7c266526fc 100644 --- a/Items/Weapons/Quagmire.cs +++ b/Items/Weapons/Quagmire.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Quagmire : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Quagmire"); - Tooltip.SetDefault("Fires spore clouds"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Quagmire"); + Tooltip.SetDefault("Fires spore clouds"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.HelFire); - item.width = 30; - item.height = 36; - item.damage = 52; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.CloneDefaults(ItemID.HelFire); + item.width = 30; + item.height = 36; + item.damage = 52; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("QuagmireProjectile"); - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("QuagmireProjectile"); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/RaidersGlory.cs b/Items/Weapons/RaidersGlory.cs index 4d6d99bd6c..7e4ce1fedf 100644 --- a/Items/Weapons/RaidersGlory.cs +++ b/Items/Weapons/RaidersGlory.cs @@ -5,39 +5,39 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class RaidersGlory : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Raider's Glory"); - Tooltip.SetDefault("Fires ichor arrows"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Raider's Glory"); + Tooltip.SetDefault("Fires ichor arrows"); + } - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.crit += 10; - item.width = 58; - item.height = 22; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 15f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.crit += 10; + item.width = 58; + item.height = 22; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 15f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[projectile].extraUpdates++; - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[projectile].extraUpdates++; + return false; + } + } } diff --git a/Items/Weapons/RareVariants/Arbalest.cs b/Items/Weapons/RareVariants/Arbalest.cs index cdb24cb279..5a25bb791a 100644 --- a/Items/Weapons/RareVariants/Arbalest.cs +++ b/Items/Weapons/RareVariants/Arbalest.cs @@ -5,48 +5,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class Arbalest : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arbalest"); - Tooltip.SetDefault("Fires volleys of high-speed arrows"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arbalest"); + Tooltip.SetDefault("Fires volleys of high-speed arrows"); + } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.crit += 20; - item.width = 58; - item.height = 22; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 10f; - item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.crit += 20; + item.width = 58; + item.height = 22; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 10f; + item.useAmmo = 40; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 3; i++) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].extraUpdates += i; - Main.projectile[proj].noDropItem = true; - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 3; i++) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].extraUpdates += i; + Main.projectile[proj].noDropItem = true; + } + return false; + } + } } diff --git a/Items/Weapons/RareVariants/Carnage.cs b/Items/Weapons/RareVariants/Carnage.cs index 675eca800c..ca6fc35367 100644 --- a/Items/Weapons/RareVariants/Carnage.cs +++ b/Items/Weapons/RareVariants/Carnage.cs @@ -6,79 +6,79 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class Carnage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Carnage"); - Tooltip.SetDefault("Enemies explode into homing blood on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Carnage"); + Tooltip.SetDefault("Enemies explode into homing blood on death"); + } - public override void SetDefaults() - { - item.width = 46; - item.damage = 55; - item.melee = true; - item.useAnimation = 21; - item.useStyle = 1; - item.useTime = 21; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; - item.height = 60; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.width = 46; + item.damage = 55; + item.melee = true; + item.useAnimation = 21; + item.useStyle = 1; + item.useTime = 21; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.useTurn = true; + item.height = 60; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.Calamity().postMoonLordRarity = 22; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 74); - target.position.X += (float)(target.width / 2); - target.position.Y += (float)(target.height / 2); - target.position.X -= (float)(target.width / 2); - target.position.Y -= (float)(target.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 25; num623++) - { - int num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - int num251 = Main.rand.Next(4, 6); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("Blood"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0f); - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 74); + target.position.X += (float)(target.width / 2); + target.position.Y += (float)(target.height / 2); + target.position.X -= (float)(target.width / 2); + target.position.Y -= (float)(target.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 25; num623++) + { + int num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + int num251 = Main.rand.Next(4, 6); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("Blood"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0f); + } + } + } + } } diff --git a/Items/Weapons/RareVariants/ClothiersWrath.cs b/Items/Weapons/RareVariants/ClothiersWrath.cs index 066aeb61df..62d480b7c0 100644 --- a/Items/Weapons/RareVariants/ClothiersWrath.cs +++ b/Items/Weapons/RareVariants/ClothiersWrath.cs @@ -2,49 +2,48 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons.RareVariants { public class ClothiersWrath : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clothier's Wrath"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clothier's Wrath"); + } - public override void SetDefaults() - { - item.damage = 24; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 30; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ProjectileID.ClothiersCurse; - item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.damage = 24; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 30; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = ProjectileID.ClothiersCurse; + item.shootSpeed = 6f; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(2); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceMagic = true; - } - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(2); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int proj = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].Calamity().forceMagic = true; + } + return false; + } + } } diff --git a/Items/Weapons/RareVariants/Cryophobia.cs b/Items/Weapons/RareVariants/Cryophobia.cs index 9c9ea5bd0e..6cbd6f6d75 100644 --- a/Items/Weapons/RareVariants/Cryophobia.cs +++ b/Items/Weapons/RareVariants/Cryophobia.cs @@ -6,37 +6,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class Cryophobia : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryophobia"); - Tooltip.SetDefault("Chill"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryophobia"); + Tooltip.SetDefault("Chill"); + } - public override void SetDefaults() - { - item.damage = 24; - item.magic = true; - item.mana = 18; - item.width = 56; - item.height = 34; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item117; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("CryoBlast"); - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.damage = 24; + item.magic = true; + item.mana = 18; + item.width = 56; + item.height = 34; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item117; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("CryoBlast"); + item.Calamity().postMoonLordRarity = 22; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + } } diff --git a/Items/Weapons/RareVariants/EvilSmasher.cs b/Items/Weapons/RareVariants/EvilSmasher.cs index 382138074c..3c935f2146 100644 --- a/Items/Weapons/RareVariants/EvilSmasher.cs +++ b/Items/Weapons/RareVariants/EvilSmasher.cs @@ -5,48 +5,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class EvilSmasher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Evil Smasher"); - Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh...ER!"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Evil Smasher"); + Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh...ER!"); + } - public override void SetDefaults() - { - item.width = 62; - item.damage = 55; - item.melee = true; - item.useAnimation = 30; - item.useStyle = 1; - item.useTime = 30; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; + public override void SetDefaults() + { + item.width = 62; + item.damage = 55; + item.melee = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FossilSpike"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - if (Main.rand.NextBool(3)) - { - item.damage = 82; - item.useAnimation = 15; - item.useTime = 15; - item.knockBack = 14f; - } - else - { - item.damage = 55; - item.useAnimation = 30; - item.useTime = 30; - item.knockBack = 8f; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FossilSpike"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + if (Main.rand.NextBool(3)) + { + item.damage = 82; + item.useAnimation = 15; + item.useTime = 15; + item.knockBack = 14f; + } + else + { + item.damage = 55; + item.useAnimation = 30; + item.useTime = 30; + item.knockBack = 8f; + } + } + } } diff --git a/Items/Weapons/RareVariants/EyeofMagnus.cs b/Items/Weapons/RareVariants/EyeofMagnus.cs index ea45d6ecb6..75a28f7636 100644 --- a/Items/Weapons/RareVariants/EyeofMagnus.cs +++ b/Items/Weapons/RareVariants/EyeofMagnus.cs @@ -5,38 +5,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class EyeofMagnus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of Magnus"); - Tooltip.SetDefault("Fires powerful beams\n" + - "Heals mana and health on hit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Magnus"); + Tooltip.SetDefault("Fires powerful beams\n" + + "Heals mana and health on hit"); + } - public override void SetDefaults() - { - item.width = 80; - item.damage = 55; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 5; - item.knockBack = 2f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.magic = true; - item.mana = 7; - item.autoReuse = true; - item.noMelee = true; - item.height = 50; - item.value = Item.buyPrice(0, 36, 0, 0); - item.shoot = mod.ProjectileType("MagnusBeam"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.width = 80; + item.damage = 55; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 5; + item.knockBack = 2f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.magic = true; + item.mana = 7; + item.autoReuse = true; + item.noMelee = true; + item.height = 50; + item.value = Item.buyPrice(0, 36, 0, 0); + item.shoot = mod.ProjectileType("MagnusBeam"); + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 22; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + } } diff --git a/Items/Weapons/RareVariants/GrandDad.cs b/Items/Weapons/RareVariants/GrandDad.cs index b02299985e..1e491ba375 100644 --- a/Items/Weapons/RareVariants/GrandDad.cs +++ b/Items/Weapons/RareVariants/GrandDad.cs @@ -1,45 +1,45 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs; namespace CalamityMod.Items.Weapons.RareVariants { public class GrandDad : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grand Dad"); - Tooltip.SetDefault("Lowers enemy defense to 0 when they are struck\n" + - "Yeets enemies across space and time\n" + - "7"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Dad"); + Tooltip.SetDefault("Lowers enemy defense to 0 when they are struck\n" + + "Yeets enemies across space and time\n" + + "7"); + } - public override void SetDefaults() - { - item.width = 124; - item.damage = 777; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 77f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 124; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.width = 124; + item.damage = 777; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 77f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 124; + item.value = Item.buyPrice(1, 0, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 22; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (CalamityGlobalNPC.ShouldAffectNPC(target)) - { - target.knockBackResist = 7f; - target.defense = 0; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (CalamityGlobalNPC.ShouldAffectNPC(target)) + { + target.knockBackResist = 7f; + target.defense = 0; + } + } + } } diff --git a/Items/Weapons/RareVariants/Hellborn.cs b/Items/Weapons/RareVariants/Hellborn.cs index 9160cc4130..73f2986d88 100644 --- a/Items/Weapons/RareVariants/Hellborn.cs +++ b/Items/Weapons/RareVariants/Hellborn.cs @@ -5,55 +5,55 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class Hellborn : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellborn"); - Tooltip.SetDefault("Converts all bullets to explosive rounds\n" + - "Enemies that touch the gun while it's being fired take massive damage"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellborn"); + Tooltip.SetDefault("Converts all bullets to explosive rounds\n" + + "Enemies that touch the gun while it's being fired take massive damage"); + } - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 50; - item.height = 24; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.knockBack = 1f; + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 50; + item.height = 24; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.knockBack = 1f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 14f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 22; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 14f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 3; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int index = 0; index < 3; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { - damage *= 15; - } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { + damage *= 15; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 360); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 360); + } + } } diff --git a/Items/Weapons/RareVariants/Infinity.cs b/Items/Weapons/RareVariants/Infinity.cs index 8221587180..948bb09fea 100644 --- a/Items/Weapons/RareVariants/Infinity.cs +++ b/Items/Weapons/RareVariants/Infinity.cs @@ -5,56 +5,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { - public class Infinity : ModItem - { + public class Infinity : ModItem + { internal int rotation = 0; internal bool limit = true; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infinity"); - Tooltip.SetDefault("Bad PC\n" + - "Fires a barrage of energy bolts that split and bounce\n" + - "Right click to fire a barrage of normal bullets\n" + + { + DisplayName.SetDefault("Infinity"); + Tooltip.SetDefault("Bad PC\n" + + "Fires a barrage of energy bolts that split and bounce\n" + + "Right click to fire a barrage of normal bullets\n" + "They say infinity is neverending, yet you hold it in your hands"); - } + } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 56; - item.height = 24; - item.useTime = 2; - item.reuseDelay = 6; - item.useAnimation = 1800; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1f; + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 56; + item.height = 24; + item.useTime = 2; + item.reuseDelay = 6; + item.useAnimation = 1800; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 22; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 22; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { - if (player.altFunctionUse == 2) - { + if (player.altFunctionUse == 2) + { //If you right click, shoots an helix of normal bullets Vector2 num7 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(rotation)); Vector2 num8 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(-rotation)); @@ -80,9 +80,9 @@ namespace CalamityMod.Items.Weapons.RareVariants limit = true; } return false; - } - else - { + } + else + { //If left click, do the same as above but spawn Charged Blasts instead Vector2 num7 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(rotation)); Vector2 num8 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(-rotation)); @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Weapons.RareVariants limit = true; } return false; - } - } - } + } + } + } } diff --git a/Items/Weapons/RareVariants/LeadWizard.cs b/Items/Weapons/RareVariants/LeadWizard.cs index fdccfb3dc4..af13b1871b 100644 --- a/Items/Weapons/RareVariants/LeadWizard.cs +++ b/Items/Weapons/RareVariants/LeadWizard.cs @@ -6,58 +6,58 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class LeadWizard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lead Wizard"); - Tooltip.SetDefault("Something's not right...\n" + - "33% chance to not consume ammo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lead Wizard"); + Tooltip.SetDefault("Something's not right...\n" + + "33% chance to not consume ammo"); + } - public override void SetDefaults() - { - item.damage = 70; - item.crit += 30; - item.ranged = true; - item.width = 66; - item.height = 34; - item.useTime = 2; - item.reuseDelay = 10; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 70; + item.crit += 30; + item.ranged = true; + item.width = 66; + item.height = 34; + item.useTime = 2; + item.reuseDelay = 10; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 22; - } + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 22; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float rotation = MathHelper.ToRadians(6); - for (int i = 0; i < 2; i++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, (i == 1 ? 0 : 2))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, 242, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float rotation = MathHelper.ToRadians(6); + for (int i = 0; i < 2; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, (i == 1 ? 0 : 2))); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, 242, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } + } } diff --git a/Items/Weapons/RareVariants/Norfleet.cs b/Items/Weapons/RareVariants/Norfleet.cs index 05570a30f8..b04e0ee158 100644 --- a/Items/Weapons/RareVariants/Norfleet.cs +++ b/Items/Weapons/RareVariants/Norfleet.cs @@ -6,14 +6,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class Norfleet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Norfleet"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Norfleet"); + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.damage = 1280; item.knockBack = 15f; item.shootSpeed = 30f; @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons.RareVariants item.useTurn = false; item.useAmmo = 75; item.autoReuse = true; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } public override Vector2? HoldoutOffset() { @@ -43,9 +43,9 @@ namespace CalamityMod.Items.Weapons.RareVariants } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Norfleet"), 0, 0f, player.whoAmI); + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Norfleet"), 0, 0f, player.whoAmI); return false; - } - } + } + } } diff --git a/Items/Weapons/RareVariants/PearlGod.cs b/Items/Weapons/RareVariants/PearlGod.cs index 6a56ec4e93..addd3c44e1 100644 --- a/Items/Weapons/RareVariants/PearlGod.cs +++ b/Items/Weapons/RareVariants/PearlGod.cs @@ -6,48 +6,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class PearlGod : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pearl God"); - Tooltip.SetDefault("Your life is mine..."); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pearl God"); + Tooltip.SetDefault("Your life is mine..."); + } - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.width = 50; - item.height = 32; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 50; + item.height = 32; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("ShockblastRound"); - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 22; - } + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("ShockblastRound"); + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 22; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 2; ++index) - { - float speedMult = (float)(index + 1) * 0.15f; - Projectile.NewProjectile(position.X, position.Y, speedX * speedMult, speedY * speedMult, mod.ProjectileType("FrostsparkBullet"), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0f, 0f); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int index = 0; index < 2; ++index) + { + float speedMult = (float)(index + 1) * 0.15f; + Projectile.NewProjectile(position.X, position.Y, speedX * speedMult, speedY * speedMult, mod.ProjectileType("FrostsparkBullet"), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0f, 0f); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/RareVariants/Skullmasher.cs b/Items/Weapons/RareVariants/Skullmasher.cs index c3d1009205..b17b6e54c0 100644 --- a/Items/Weapons/RareVariants/Skullmasher.cs +++ b/Items/Weapons/RareVariants/Skullmasher.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons.RareVariants item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 22; - } + item.Calamity().postMoonLordRarity = 22; + } public override Vector2? HoldoutOffset() { @@ -42,13 +42,13 @@ namespace CalamityMod.Items.Weapons.RareVariants public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int index = 0; index < 5; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0f, 0f); - } + for (int index = 0; index < 5; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0f, 0f); + } return false; } - } + } } diff --git a/Items/Weapons/RareVariants/Swordsplosion.cs b/Items/Weapons/RareVariants/Swordsplosion.cs index 40dea0f554..7e96ecd659 100644 --- a/Items/Weapons/RareVariants/Swordsplosion.cs +++ b/Items/Weapons/RareVariants/Swordsplosion.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,99 +7,107 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class Swordsplosion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Swordsplosion"); - Tooltip.SetDefault("Sword swarm"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Swordsplosion"); + Tooltip.SetDefault("Sword swarm"); + } - public override void SetDefaults() - { - item.width = 84; - item.damage = 60; - item.melee = true; - item.useAnimation = 30; - item.useTime = 30; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 15f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 84; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 16f; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.width = 84; + item.damage = 60; + item.melee = true; + item.useAnimation = 30; + item.useTime = 30; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 15f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 84; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 16f; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(4)) - { - case 0: type = mod.ProjectileType("EonBeam"); break; - case 1: type = mod.ProjectileType("EonBeamV2"); break; - case 2: type = mod.ProjectileType("EonBeamV3"); break; - case 3: type = mod.ProjectileType("EonBeamV4"); break; - } - float num72 = Main.rand.Next(22, 30); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 16; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f; - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(4)) + { + case 0: + type = mod.ProjectileType("EonBeam"); + break; + case 1: + type = mod.ProjectileType("EonBeamV2"); + break; + case 2: + type = mod.ProjectileType("EonBeamV3"); + break; + case 3: + type = mod.ProjectileType("EonBeamV4"); + break; + } + float num72 = Main.rand.Next(22, 30); + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 16; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f; + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 480); - target.AddBuff(mod.BuffType("GlacialState"), 480); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 480); - target.AddBuff(mod.BuffType("Plague"), 480); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 480); + target.AddBuff(mod.BuffType("GlacialState"), 480); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 480); + target.AddBuff(mod.BuffType("Plague"), 480); + } + } } diff --git a/Items/Weapons/RareVariants/ThornBlossom.cs b/Items/Weapons/RareVariants/ThornBlossom.cs index 1878d853f3..66ae32c1a4 100644 --- a/Items/Weapons/RareVariants/ThornBlossom.cs +++ b/Items/Weapons/RareVariants/ThornBlossom.cs @@ -6,50 +6,50 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class ThornBlossom : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Thorn Blossom"); - Tooltip.SetDefault("Every rose has its thorn"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thorn Blossom"); + Tooltip.SetDefault("Every rose has its thorn"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 45; - item.magic = true; - item.mana = 10; - item.width = 66; - item.height = 68; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 45; + item.magic = true; + item.mana = 10; + item.width = 66; + item.height = 68; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BeamingBolt"); - item.shootSpeed = 20f; - item.Calamity().postMoonLordRarity = 22; - } + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BeamingBolt"); + item.shootSpeed = 20f; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - player.statLife -= 5; - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - for (int index = 0; index < 3; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-120, 121) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-120, 121) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.5f, SpeedY * 1.5f, 150, (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); - } - Projectile.NewProjectile(position.X, position.Y, speedX * 0.66f, speedY * 0.66f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + player.statLife -= 5; + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + for (int index = 0; index < 3; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-120, 121) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-120, 121) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.5f, SpeedY * 1.5f, 150, (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); + } + Projectile.NewProjectile(position.X, position.Y, speedX * 0.66f, speedY * 0.66f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/RareVariants/Thunderstorm.cs b/Items/Weapons/RareVariants/Thunderstorm.cs index a10e252d32..4a48189ea0 100644 --- a/Items/Weapons/RareVariants/Thunderstorm.cs +++ b/Items/Weapons/RareVariants/Thunderstorm.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class Thunderstorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Thunderstorm"); - Tooltip.SetDefault("Make it rain"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thunderstorm"); + Tooltip.SetDefault("Make it rain"); + } - public override void SetDefaults() - { - item.damage = 360; - item.mana = 50; - item.magic = true; - item.width = 48; - item.height = 22; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("ThunderstormShot"); - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.damage = 360; + item.mana = 50; + item.magic = true; + item.width = 48; + item.height = 22; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("ThunderstormShot"); + item.Calamity().postMoonLordRarity = 22; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + } } diff --git a/Items/Weapons/RareVariants/TrueConferenceCall.cs b/Items/Weapons/RareVariants/TrueConferenceCall.cs index 8d3fced23f..4144e8a32b 100644 --- a/Items/Weapons/RareVariants/TrueConferenceCall.cs +++ b/Items/Weapons/RareVariants/TrueConferenceCall.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,96 +7,96 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class TrueConferenceCall : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Conference Call"); - Tooltip.SetDefault("@everyone"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Conference Call"); + Tooltip.SetDefault("@everyone"); + } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 66; - item.height = 26; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 66; + item.height = 26; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 18f; - item.shoot = 10; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 22; - } + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shootSpeed = 18f; + item.shoot = 10; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 22; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int bulletAmt = 6; - for (int index = 0; index < bulletAmt; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].extraUpdates += 1; - } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - for (int num108 = 0; num108 < bulletAmt; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-15, 16) * 0.01f; - float speedY5 = num79 + (float)Main.rand.Next(-15, 16) * 0.01f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].extraUpdates += 1; - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int bulletAmt = 6; + for (int index = 0; index < bulletAmt; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + for (int num108 = 0; num108 < bulletAmt; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-15, 16) * 0.01f; + float speedY5 = num79 + (float)Main.rand.Next(-15, 16) * 0.01f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + return false; + } + } } diff --git a/Items/Weapons/RareVariants/VoidVortex.cs b/Items/Weapons/RareVariants/VoidVortex.cs index f97de23c94..fd48194598 100644 --- a/Items/Weapons/RareVariants/VoidVortex.cs +++ b/Items/Weapons/RareVariants/VoidVortex.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,72 +7,72 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.RareVariants { public class VoidVortex : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Void Vortex"); - Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void Vortex"); + Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 300; - item.magic = true; - item.mana = 60; - item.width = 130; - item.height = 130; - item.useTime = 45; - item.useAnimation = 45; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Climax2"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 22; - } + public override void SetDefaults() + { + item.damage = 300; + item.magic = true; + item.mana = 60; + item.width = 130; + item.height = 130; + item.useTime = 45; + item.useAnimation = 45; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Climax2"); + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 22; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - vector2 += new Vector2(num78, num79); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - float passedVar = 1f; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, passedVar, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, -passedVar, 0f); - passedVar += 1f; - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + vector2 += new Vector2(num78, num79); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + float passedVar = 1f; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, passedVar, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, -passedVar, 0f); + passedVar += 1f; + } + return false; + } + } } diff --git a/Items/Weapons/Ravager/Hematemesis.cs b/Items/Weapons/Ravager/Hematemesis.cs index ebcda85617..3b17f345a9 100644 --- a/Items/Weapons/Ravager/Hematemesis.cs +++ b/Items/Weapons/Ravager/Hematemesis.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ravager { public class Hematemesis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hematemesis"); - Tooltip.SetDefault("Casts a barrage of blood geysers from below"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hematemesis"); + Tooltip.SetDefault("Casts a barrage of blood geysers from below"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 90; - item.magic = true; - item.mana = 14; + public override void SetDefaults() + { + item.damage = 90; + item.magic = true; + item.mana = 14; item.rare = 8; - item.width = 48; - item.height = 54; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.75f; + item.width = 48; + item.height = 54; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.75f; item.value = Item.buyPrice(0, 80, 0, 0); item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodBlast"); - item.shootSpeed = 10f; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodBlast"); + item.shootSpeed = 10f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - position = Main.MouseWorld; - for (int x = 0; x < 10; x++) + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + position = Main.MouseWorld; + for (int x = 0; x < 10; x++) { Projectile.NewProjectile(position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockBack, Main.myPlayer, 0f, 0f); } return false; - } - } + } + } } diff --git a/Items/Weapons/Ravager/RealmRavager.cs b/Items/Weapons/Ravager/RealmRavager.cs index a4a77ac81b..1570e60be3 100644 --- a/Items/Weapons/Ravager/RealmRavager.cs +++ b/Items/Weapons/Ravager/RealmRavager.cs @@ -6,47 +6,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ravager { public class RealmRavager : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Realm Ravager"); - Tooltip.SetDefault("Shoots a burst of explosive bullets"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Realm Ravager"); + Tooltip.SetDefault("Shoots a burst of explosive bullets"); + } - public override void SetDefaults() - { - item.damage = 50; - item.ranged = true; - item.width = 76; - item.height = 32; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 50; + item.ranged = true; + item.width = 76; + item.height = 32; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 30f; - item.shoot = mod.ProjectileType("RealmRavagerBullet"); - item.useAmmo = 97; - } + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shootSpeed = 30f; + item.shoot = mod.ProjectileType("RealmRavagerBullet"); + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 5; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("RealmRavagerBullet"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int index = 0; index < 5; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("RealmRavagerBullet"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } diff --git a/Items/Weapons/Ravager/SpikecragStaff.cs b/Items/Weapons/Ravager/SpikecragStaff.cs index 9db62838b4..3c3db33370 100644 --- a/Items/Weapons/Ravager/SpikecragStaff.cs +++ b/Items/Weapons/Ravager/SpikecragStaff.cs @@ -6,35 +6,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ravager { public class SpikecragStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spikecrag Staff"); - Tooltip.SetDefault("Summons a spikecrag to protect you"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spikecrag Staff"); + Tooltip.SetDefault("Summons a spikecrag to protect you"); + } - public override void SetDefaults() - { - item.damage = 120; - item.mana = 10; - item.summon = true; - item.sentry = true; - item.width = 50; - item.height = 50; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; + public override void SetDefaults() + { + item.damage = 120; + item.mana = 10; + item.summon = true; + item.sentry = true; + item.width = 50; + item.height = 50; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.autoReuse = true; - item.shootSpeed = 20f; - item.UseSound = SoundID.Item78; - item.shoot = mod.ProjectileType("Spikecrag"); - } + item.autoReuse = true; + item.shootSpeed = 20f; + item.UseSound = SoundID.Item78; + item.shoot = mod.ProjectileType("Spikecrag"); + } - public override bool AltFunctionUse(Player player) + public override bool AltFunctionUse(Player player) { return true; } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ravager player.UpdateMaxTurrets(); } return false; - } + } public override bool UseItem(Player player) { if (player.altFunctionUse == 2) @@ -58,5 +58,5 @@ namespace CalamityMod.Items.Weapons.Ravager } return base.UseItem(player); } - } + } } diff --git a/Items/Weapons/Ravager/UltimusCleaver.cs b/Items/Weapons/Ravager/UltimusCleaver.cs index ac093cc176..8ef14fbf85 100644 --- a/Items/Weapons/Ravager/UltimusCleaver.cs +++ b/Items/Weapons/Ravager/UltimusCleaver.cs @@ -6,99 +6,99 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ravager { public class UltimusCleaver : ModItem - { + { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ultimus Cleaver"); - Tooltip.SetDefault("Launches damaging homing sparks"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultimus Cleaver"); + Tooltip.SetDefault("Launches damaging homing sparks"); + } - public override void SetDefaults() - { - item.damage = 300; - item.melee = true; - item.rare = 8; - item.width = 72; - item.height = 62; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 1; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.autoReuse = true; - item.UseSound = SoundID.Item1; - } + public override void SetDefaults() + { + item.damage = 300; + item.melee = true; + item.rare = 8; + item.width = 72; + item.height = 62; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.autoReuse = true; + item.UseSound = SoundID.Item1; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (player.whoAmI == Main.myPlayer) - { - if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) - { - float num339 = 0f; - float num340 = 0f; - float num341 = 0f; - float num342 = 0f; - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) - { - num339 = -7f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num339 = -6f; - num340 = 2f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) - { - num339 = -4f; - num340 = 4f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) - { - num339 = -2f; - num340 = 6f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) - { - num340 = 7f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num342 = 26f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) - { - num342 -= 4f; - num341 -= 20f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) - { - num341 += 6f; - } - if (player.direction == -1) - { - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) - { - num342 -= 8f; - } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) - { - num342 -= 6f; - } - } - num339 *= 1.5f; - num340 *= 1.5f; - num342 *= (float)player.direction; - num341 *= player.gravDir; - Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, - (float)player.direction * num340, num339 * player.gravDir, mod.ProjectileType("UltimusCleaverDust"), (int)((float)item.damage * 0.1f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); - } - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (player.whoAmI == Main.myPlayer) + { + if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) + { + float num339 = 0f; + float num340 = 0f; + float num341 = 0f; + float num342 = 0f; + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num339 = -7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num339 = -6f; + num340 = 2f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) + { + num339 = -4f; + num340 = 4f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num339 = -2f; + num340 = 6f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num340 = 7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 = 26f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num342 -= 4f; + num341 -= 20f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num341 += 6f; + } + if (player.direction == -1) + { + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num342 -= 8f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 -= 6f; + } + } + num339 *= 1.5f; + num340 *= 1.5f; + num342 *= (float)player.direction; + num341 *= player.gravDir; + Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, + (float)player.direction * num340, num339 * player.gravDir, mod.ProjectileType("UltimusCleaverDust"), (int)((float)item.damage * 0.1f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); + } + } + } + } } diff --git a/Items/Weapons/RedSun.cs b/Items/Weapons/RedSun.cs index 314d5fa11f..abde3aa5fb 100644 --- a/Items/Weapons/RedSun.cs +++ b/Items/Weapons/RedSun.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Red Sun"); Tooltip.SetDefault("Over paradise\n" + - "Drops a barrage of solar flares from the sky"); + "Drops a barrage of solar flares from the sky"); } public override void SetDefaults() @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("SolarFlare"); item.shootSpeed = 15f; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } public override void AddRecipes() { diff --git a/Items/Weapons/RedtideSword.cs b/Items/Weapons/RedtideSword.cs index bf4d7a2677..507b970150 100644 --- a/Items/Weapons/RedtideSword.cs +++ b/Items/Weapons/RedtideSword.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Redtide Sword"); - Tooltip.SetDefault("Throws short-range whirlpools"); - } + Tooltip.SetDefault("Throws short-range whirlpools"); + } public override void SetDefaults() { @@ -27,17 +27,17 @@ namespace CalamityMod.Items.Weapons item.height = 42; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - item.shoot = mod.ProjectileType("Whirlpool"); - item.shootSpeed = 6f; - } + item.shoot = mod.ProjectileType("Whirlpool"); + item.shootSpeed = 6f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "VictideBar", 3); diff --git a/Items/Weapons/RelicofRuin.cs b/Items/Weapons/RelicofRuin.cs index 0a5c67ba8d..c60022754e 100644 --- a/Items/Weapons/RelicofRuin.cs +++ b/Items/Weapons/RelicofRuin.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Relic of Ruin"); - Tooltip.SetDefault("Casts a spread of sand blades"); - } + Tooltip.SetDefault("Casts a spread of sand blades"); + } public override void SetDefaults() { diff --git a/Items/Weapons/RoyalKnivesMelee.cs b/Items/Weapons/RoyalKnivesMelee.cs index ace6648354..24dca94768 100644 --- a/Items/Weapons/RoyalKnivesMelee.cs +++ b/Items/Weapons/RoyalKnivesMelee.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Illustrious Knives"); - Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); - } + Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); + } public override void SetDefaults() { @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("RoyalKnifeMelee"); item.shootSpeed = 9f; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/RubberMortarRound.cs b/Items/Weapons/RubberMortarRound.cs index 6fd13d84d7..4f49554fce 100644 --- a/Items/Weapons/RubberMortarRound.cs +++ b/Items/Weapons/RubberMortarRound.cs @@ -4,38 +4,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class RubberMortarRound : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rubber Mortar Round"); - Tooltip.SetDefault("Large blast radius\n" + - "Will destroy tiles on each bounce\n" + - "Used by normal guns"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rubber Mortar Round"); + Tooltip.SetDefault("Large blast radius\n" + + "Will destroy tiles on each bounce\n" + + "Used by normal guns"); + } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 20; - item.height = 14; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 7.5f; - item.value = 1000; - item.rare = 5; - item.ammo = 97; - item.shoot = mod.ProjectileType("RubberMortarRound"); - } + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 20; + item.height = 14; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 7.5f; + item.value = 1000; + item.rare = 5; + item.ammo = 97; + item.shoot = mod.ProjectileType("RubberMortarRound"); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MortarRound", 100); - recipe.AddIngredient(ItemID.PinkGel, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MortarRound", 100); + recipe.AddIngredient(ItemID.PinkGel, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SDFMG.cs b/Items/Weapons/SDFMG.cs index c4cb7e3ba1..6c89fbdadd 100644 --- a/Items/Weapons/SDFMG.cs +++ b/Items/Weapons/SDFMG.cs @@ -1,82 +1,78 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons { - public class SDFMG : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SDFMG"); - Tooltip.SetDefault("It came from the edge of Terraria\n" + - "50% chance to not consume ammo"); - } + public class SDFMG : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SDFMG"); + Tooltip.SetDefault("It came from the edge of Terraria\n" + + "50% chance to not consume ammo"); + } - public override void SetDefaults() - { - item.damage = 250; - item.ranged = true; - item.width = 74; - item.height = 34; - item.crit += 16; - item.useTime = 2; - item.useAnimation = 2; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.damage = 250; + item.ranged = true; + item.width = 74; + item.height = 34; + item.crit += 16; + item.useTime = 2; + item.useAnimation = 2; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 14; + } public override Vector2? HoldoutOffset() { return new Vector2(-10, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; - if (Main.rand.NextBool(5)) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FishronRPG"), damage, knockBack, player.whoAmI, 0f, 0f); - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; + if (Main.rand.NextBool(5)) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FishronRPG"), damage, knockBack, player.whoAmI, 0f, 0f); + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SDMG); - recipe.AddIngredient(ItemID.ShrimpyTruffle); - recipe.AddIngredient(null, "CosmiliteBar", 4); - recipe.AddIngredient(null, "Phantoplasm", 4); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SDMG); + recipe.AddIngredient(ItemID.ShrimpyTruffle); + recipe.AddIngredient(null, "CosmiliteBar", 4); + recipe.AddIngredient(null, "Phantoplasm", 4); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SHPC.cs b/Items/Weapons/SHPC.cs index 1b08817151..64cc551fb3 100644 --- a/Items/Weapons/SHPC.cs +++ b/Items/Weapons/SHPC.cs @@ -6,88 +6,88 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class SHPC : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SHPC"); - Tooltip.SetDefault("Legendary Drop\n" + - "Fires plasma orbs that linger and emit massive explosions\n" + - "Right click to fire powerful energy beams\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SHPC"); + Tooltip.SetDefault("Legendary Drop\n" + + "Fires plasma orbs that linger and emit massive explosions\n" + + "Right click to fire powerful energy beams\n" + "Revengeance drop"); - } + } - public override void SetDefaults() - { - item.damage = 22; - item.magic = true; - item.mana = 20; - item.width = 96; - item.height = 34; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; + public override void SetDefaults() + { + item.damage = 22; + item.magic = true; + item.mana = 20; + item.width = 96; + item.height = 34; + item.useTime = 50; + item.useAnimation = 50; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; item.rare = 5; item.value = Item.buyPrice(0, 36, 0, 0); item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SHPB"); - item.shootSpeed = 20f; - item.Calamity().postMoonLordRarity = 17; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("SHPB"); + item.shootSpeed = 20f; + item.Calamity().postMoonLordRarity = 17; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 0); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 7; - item.useAnimation = 7; - item.mana = 6; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - } - else - { - item.useTime = 50; - item.useAnimation = 50; - item.mana = 20; - item.UseSound = SoundID.Item92; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 7; + item.useAnimation = 7; + item.mana = 6; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + } + else + { + item.useTime = 50; + item.useAnimation = 50; + item.mana = 20; + item.UseSound = SoundID.Item92; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - for (int shootAmt = 0; shootAmt < 3; shootAmt++) - { - float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SHPL"), damage, (knockBack * 0.5f), player.whoAmI, 0.0f, 0.0f); - } - return false; - } - else - { - for (int shootAmt = 0; shootAmt < 3; shootAmt++) - { - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SHPB"), (int)((double)damage * 1.1), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + for (int shootAmt = 0; shootAmt < 3; shootAmt++) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SHPL"), damage, (knockBack * 0.5f), player.whoAmI, 0.0f, 0.0f); + } + return false; + } + else + { + for (int shootAmt = 0; shootAmt < 3; shootAmt++) + { + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SHPB"), (int)((double)damage * 1.1), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } + } } diff --git a/Items/Weapons/SanguineFlare.cs b/Items/Weapons/SanguineFlare.cs index d4378b7f51..bb327c7a40 100644 --- a/Items/Weapons/SanguineFlare.cs +++ b/Items/Weapons/SanguineFlare.cs @@ -5,54 +5,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class SanguineFlare : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sanguine Flare"); - Tooltip.SetDefault("Fires a blast of sanguine flares that drain enemy life"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sanguine Flare"); + Tooltip.SetDefault("Fires a blast of sanguine flares that drain enemy life"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 220; - item.magic = true; - item.mana = 22; - item.width = 56; - item.height = 60; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; + public override void SetDefaults() + { + item.damage = 220; + item.magic = true; + item.mana = 22; + item.width = 56; + item.height = 60; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SanguineFlare"); - item.shootSpeed = 14f; - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("SanguineFlare"); + item.shootSpeed = 14f; + item.Calamity().postMoonLordRarity = 13; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(6, 9); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(6, 9); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Scorpion.cs b/Items/Weapons/Scorpion.cs index a993f514f1..cc9498a6fb 100644 --- a/Items/Weapons/Scorpion.cs +++ b/Items/Weapons/Scorpion.cs @@ -5,78 +5,78 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Scorpion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scorpio"); - Tooltip.SetDefault("BOOM\n" + - "Right click to fire a nuke"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scorpio"); + Tooltip.SetDefault("BOOM\n" + + "Right click to fire a nuke"); + } - public override void SetDefaults() - { - item.damage = 95; - item.ranged = true; - item.width = 58; - item.height = 26; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; + public override void SetDefaults() + { + item.damage = 95; + item.ranged = true; + item.width = 58; + item.height = 26; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("MiniRocket"); - item.useAmmo = 771; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("MiniRocket"); + item.useAmmo = 771; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 39; - item.useAnimation = 39; - } - else - { - item.useTime = 13; - item.useAnimation = 13; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 39; + item.useAnimation = 39; + } + else + { + item.useTime = 13; + item.useAnimation = 13; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigNuke"), (int)((double)damage * 3.0), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MiniRocket"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigNuke"), (int)((double)damage * 3.0), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MiniRocket"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SnowmanCannon); - recipe.AddIngredient(ItemID.GrenadeLauncher); - recipe.AddIngredient(ItemID.RocketLauncher); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SnowmanCannon); + recipe.AddIngredient(ItemID.GrenadeLauncher); + recipe.AddIngredient(ItemID.RocketLauncher); + recipe.AddIngredient(ItemID.FragmentVortex, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ScourgeoftheCosmos.cs b/Items/Weapons/ScourgeoftheCosmos.cs index 0d385f1156..262c0203b0 100644 --- a/Items/Weapons/ScourgeoftheCosmos.cs +++ b/Items/Weapons/ScourgeoftheCosmos.cs @@ -5,33 +5,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class ScourgeoftheCosmos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge of the Cosmos"); - Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge of the Cosmos"); + Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); + } - public override void SetDefaults() - { - item.width = 18; - item.damage = 2200; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 20; + public override void SetDefaults() + { + item.width = 18; + item.damage = 2200; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 5f; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.height = 20; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); - item.shootSpeed = 15f; - item.Calamity().postMoonLordRarity = 14; - } + item.shootSpeed = 15f; + item.Calamity().postMoonLordRarity = 14; + } public override void AddRecipes() { diff --git a/Items/Weapons/Seabow.cs b/Items/Weapons/Seabow.cs index 3d77424f5a..1445f62c58 100644 --- a/Items/Weapons/Seabow.cs +++ b/Items/Weapons/Seabow.cs @@ -5,48 +5,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Seabow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seabow"); - Tooltip.SetDefault("Fires slow-moving water blasts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seabow"); + Tooltip.SetDefault("Fires slow-moving water blasts"); + } - public override void SetDefaults() - { - item.damage = 14; - item.ranged = true; - item.width = 22; - item.height = 46; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 14; + item.ranged = true; + item.width = 22; + item.height = 46; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, mod.ProjectileType("SandWater"), (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); - return true; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, mod.ProjectileType("SandWater"), (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Seadragon.cs b/Items/Weapons/Seadragon.cs index 3a3334d937..cb21ecefb8 100644 --- a/Items/Weapons/Seadragon.cs +++ b/Items/Weapons/Seadragon.cs @@ -6,34 +6,34 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Seadragon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seadragon"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + - "Has a chance to fire homing rockets that explode into fire shards on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seadragon"); + Tooltip.SetDefault("50% chance to not consume ammo\n" + + "Has a chance to fire homing rockets that explode into fire shards on death"); + } - public override void SetDefaults() - { - item.damage = 125; - item.ranged = true; - item.width = 78; - item.height = 26; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; + public override void SetDefaults() + { + item.damage = 125; + item.ranged = true; + item.width = 78; + item.height = 26; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 13; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 13; + } public override Vector2? HoldoutOffset() { @@ -41,36 +41,36 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + (float) Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); if (Main.rand.NextBool(10)) { Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SeaDragonRocket"), damage * 2, knockBack, player.whoAmI, 0f, 0f); } - return false; - } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Megalodon"); - recipe.AddIngredient(null, "Phantoplasm", 9); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Megalodon"); + recipe.AddIngredient(null, "Phantoplasm", 9); recipe.AddIngredient(null, "ArmoredShell", 3); recipe.AddIngredient(null, "DepthCells", 15); recipe.AddIngredient(null, "Lumenite", 15); recipe.AddIngredient(null, "Tenebris", 5); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/ShadowboltStaff.cs b/Items/Weapons/ShadowboltStaff.cs index 1e7674d057..90eb3ef56f 100644 --- a/Items/Weapons/ShadowboltStaff.cs +++ b/Items/Weapons/ShadowboltStaff.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Shadowbolt"); item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void AddRecipes() { diff --git a/Items/Weapons/Shredder.cs b/Items/Weapons/Shredder.cs index 34c8eefcca..ad3b73c703 100644 --- a/Items/Weapons/Shredder.cs +++ b/Items/Weapons/Shredder.cs @@ -6,82 +6,82 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Shredder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shredder"); - Tooltip.SetDefault("The myth, the legend, the weapon that drops more frames than any other\n" + - "Fires a barrage of energy bolts that split and bounce\n" + - "Right click to fire a barrage of normal bullets"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shredder"); + Tooltip.SetDefault("The myth, the legend, the weapon that drops more frames than any other\n" + + "Fires a barrage of energy bolts that split and bounce\n" + + "Right click to fire a barrage of normal bullets"); + } - public override void SetDefaults() - { - item.damage = 28; - item.ranged = true; - item.width = 56; - item.height = 24; - item.useTime = 3; - item.reuseDelay = 10; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; + public override void SetDefaults() + { + item.damage = 28; + item.ranged = true; + item.width = 56; + item.height = 24; + item.useTime = 3; + item.reuseDelay = 10; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 12; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int bulletAmt = 4; - if (player.altFunctionUse == 2) - { - for (int index = 0; index < bulletAmt; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int bulletAmt = 4; + if (player.altFunctionUse == 2) + { + for (int index = 0; index < bulletAmt; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } - return false; - } - else - { - for (int index = 0; index < bulletAmt; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + else + { + for (int index = 0; index < bulletAmt; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } - return false; - } - } + return false; + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); recipe.AddIngredient(null, "BarofLife", 5); recipe.AddIngredient(null, "ChargedDartRifle"); recipe.AddIngredient(ItemID.LunarBar, 5); @@ -90,6 +90,6 @@ namespace CalamityMod.Items.Weapons recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/Shroomer.cs b/Items/Weapons/Shroomer.cs index 20945f851a..9de3172205 100644 --- a/Items/Weapons/Shroomer.cs +++ b/Items/Weapons/Shroomer.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Shroomer"); - Tooltip.SetDefault("Has a chance to fire an extremely powerful homing mushroom"); - } + Tooltip.SetDefault("Has a chance to fire an extremely powerful homing mushroom"); + } public override void SetDefaults() { diff --git a/Items/Weapons/SkyGlaze.cs b/Items/Weapons/SkyGlaze.cs index b3681e7d94..cb77274815 100644 --- a/Items/Weapons/SkyGlaze.cs +++ b/Items/Weapons/SkyGlaze.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/SlagMagnum.cs b/Items/Weapons/SlagMagnum.cs index 158c55d8d9..2acefd5a6d 100644 --- a/Items/Weapons/SlagMagnum.cs +++ b/Items/Weapons/SlagMagnum.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons { @@ -14,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Slag Magnum"); - Tooltip.SetDefault("Shoots fossil shards that split into additional shards on death"); - } + Tooltip.SetDefault("Shoots fossil shards that split into additional shards on death"); + } public override void SetDefaults() { diff --git a/Items/Weapons/SlimeGod/CorroslimeStaff.cs b/Items/Weapons/SlimeGod/CorroslimeStaff.cs index 1cbb7a7007..f9b72acccd 100644 --- a/Items/Weapons/SlimeGod/CorroslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CorroslimeStaff.cs @@ -44,30 +44,30 @@ namespace CalamityMod.Items.Weapons.SlimeGod recipe.AddRecipe(); } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs index 69a2389b57..4ef127abbb 100644 --- a/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs +++ b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Corrupted Crusher Blade"); - Tooltip.SetDefault("Inflicts cursed inferno and critical hits lower enemy defense"); - } + Tooltip.SetDefault("Inflicts cursed inferno and critical hits lower enemy defense"); + } public override void SetDefaults() { @@ -38,16 +38,16 @@ namespace CalamityMod.Items.Weapons.SlimeGod } } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 180); - if (target.defense > 0 && crit) - { - target.defense -= 5; - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 180); + if (target.defense > 0 && crit) + { + target.defense -= 5; + } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "EbonianGel", 15); diff --git a/Items/Weapons/SlimeGod/CrimslimeStaff.cs b/Items/Weapons/SlimeGod/CrimslimeStaff.cs index fcd8eff8cc..e5bb2135d8 100644 --- a/Items/Weapons/SlimeGod/CrimslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CrimslimeStaff.cs @@ -44,30 +44,30 @@ namespace CalamityMod.Items.Weapons.SlimeGod recipe.AddRecipe(); } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs index f848c75e79..6b9d820877 100644 --- a/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs +++ b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Crimson Crusher Blade"); - Tooltip.SetDefault("Inflicts ichor and critical hits lower enemy contact damage"); - } + Tooltip.SetDefault("Inflicts ichor and critical hits lower enemy contact damage"); + } public override void SetDefaults() { @@ -38,16 +38,16 @@ namespace CalamityMod.Items.Weapons.SlimeGod } } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - if (target.damage > 0 && crit) - { - target.damage -= 10; - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + if (target.damage > 0 && crit) + { + target.damage -= 10; + } + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "EbonianGel", 15); diff --git a/Items/Weapons/SlimeGod/GeliticBlade.cs b/Items/Weapons/SlimeGod/GeliticBlade.cs index a496707cfc..eac5d056b8 100644 --- a/Items/Weapons/SlimeGod/GeliticBlade.cs +++ b/Items/Weapons/SlimeGod/GeliticBlade.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Gelitic Blade"); - Tooltip.SetDefault("Fires a gel wave that slows down on enemy hits"); - } + Tooltip.SetDefault("Fires a gel wave that slows down on enemy hits"); + } public override void SetDefaults() { diff --git a/Items/Weapons/SlimeGod/Goobow.cs b/Items/Weapons/SlimeGod/Goobow.cs index ae5e9f5a1d..21005a0b33 100644 --- a/Items/Weapons/SlimeGod/Goobow.cs +++ b/Items/Weapons/SlimeGod/Goobow.cs @@ -2,70 +2,69 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons.SlimeGod { public class Goobow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Goobow"); - Tooltip.SetDefault("Fires two streams of slime"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Goobow"); + Tooltip.SetDefault("Fires two streams of slime"); + } - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.width = 30; - item.height = 48; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 30; + item.height = 48; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 20f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 0.6f, speedY * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].Calamity().forceRanged = true; - } - return true; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 2; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 20f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + if (!flag11) + { + value9 -= vector7; + } + int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 0.6f, speedY * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI, 0f, 0f); + Main.projectile[projectile].Calamity().forceRanged = true; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 18); - recipe.AddIngredient(ItemID.Gel, 30); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 18); + recipe.AddIngredient(ItemID.Gel, 30); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SlimeGod/GunkShot.cs b/Items/Weapons/SlimeGod/GunkShot.cs index 3035334cef..335847b5de 100644 --- a/Items/Weapons/SlimeGod/GunkShot.cs +++ b/Items/Weapons/SlimeGod/GunkShot.cs @@ -1,68 +1,64 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons.SlimeGod { public class GunkShot : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gunk Shot"); - Tooltip.SetDefault("Shoots a spread of bullets"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gunk Shot"); + Tooltip.SetDefault("Shoots a spread of bullets"); + } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 42; - item.height = 18; - item.useTime = 32; - item.useAnimation = 32; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 42; + item.height = 18; + item.useTime = 32; + item.useAnimation = 32; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; item.value = Item.buyPrice(0, 12, 0, 0); item.rare = 4; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 5f; - item.useAmmo = 97; - } + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 5f; + item.useAmmo = 97; + } public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(3, 5); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(3, 5); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PurifiedGel", 18); recipe.AddIngredient(ItemID.Gel, 15); recipe.AddIngredient(ItemID.HellstoneBar, 5); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.cs b/Items/Weapons/SlimeGod/OverloadedBlaster.cs index 23bab11b5f..6a35822f08 100644 --- a/Items/Weapons/SlimeGod/OverloadedBlaster.cs +++ b/Items/Weapons/SlimeGod/OverloadedBlaster.cs @@ -1,65 +1,61 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons.SlimeGod { public class OverloadedBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Overloaded Blaster"); - Tooltip.SetDefault("33% chance to not consume gel\n" + - "Fires a large spread of bouncing slime"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Overloaded Blaster"); + Tooltip.SetDefault("33% chance to not consume gel\n" + + "Fires a large spread of bouncing slime"); + } - public override void SetDefaults() - { - item.damage = 16; - item.ranged = true; - item.width = 42; - item.height = 20; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; + public override void SetDefaults() + { + item.damage = 16; + item.ranged = true; + item.width = 42; + item.height = 20; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; item.value = Item.buyPrice(0, 12, 0, 0); item.rare = 4; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shootSpeed = 6.5f; - item.shoot = mod.ProjectileType("SlimeBolt"); - item.useAmmo = 23; - } + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shootSpeed = 6.5f; + item.shoot = mod.ProjectileType("SlimeBolt"); + item.useAmmo = 23; + } public override Vector2? HoldoutOffset() { return new Vector2(-4, 0); } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int index = 0; index < 5; ++index) { - float num7 = speedX; + float num7 = speedX; float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; - } - } + } + } } diff --git a/Items/Weapons/SlimeGod/TheGodsGambit.cs b/Items/Weapons/SlimeGod/TheGodsGambit.cs index a2f573f176..6e28b412e3 100644 --- a/Items/Weapons/SlimeGod/TheGodsGambit.cs +++ b/Items/Weapons/SlimeGod/TheGodsGambit.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("The God's Gambit"); - Tooltip.SetDefault("Fires a stream of slime when enemies are near"); - } + Tooltip.SetDefault("Fires a stream of slime when enemies are near"); + } public override void SetDefaults() { diff --git a/Items/Weapons/SolsticeClaymore.cs b/Items/Weapons/SolsticeClaymore.cs index 4cf90d4b6e..63097b9ab8 100644 --- a/Items/Weapons/SolsticeClaymore.cs +++ b/Items/Weapons/SolsticeClaymore.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("SolsticeBeam"); item.shootSpeed = 16f; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { diff --git a/Items/Weapons/SomaPrime.cs b/Items/Weapons/SomaPrime.cs index ec88bb56f8..2f88fb8311 100644 --- a/Items/Weapons/SomaPrime.cs +++ b/Items/Weapons/SomaPrime.cs @@ -5,68 +5,68 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class SomaPrime : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soma Prime"); - Tooltip.SetDefault("Shoots extremely powerful high velocity rounds that inflict a powerful bleed debuff"); - } + public class SomaPrime : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soma Prime"); + Tooltip.SetDefault("Shoots extremely powerful high velocity rounds that inflict a powerful bleed debuff"); + } - public override void SetDefaults() - { - item.damage = 600; - item.ranged = true; - item.width = 94; - item.height = 34; - item.crit += 40; - item.useTime = 2; - item.useAnimation = 2; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SlashRound"); - item.shootSpeed = 30f; - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 16; - } + public override void SetDefaults() + { + item.damage = 600; + item.ranged = true; + item.width = 94; + item.height = 34; + item.crit += 40; + item.useTime = 2; + item.useAnimation = 2; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SlashRound"); + item.shootSpeed = 30f; + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 16; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "P90"); - recipe.AddIngredient(null, "Minigun"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "P90"); + recipe.AddIngredient(null, "Minigun"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SlashRound"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SlashRound"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + } } diff --git a/Items/Weapons/SoulHarvester.cs b/Items/Weapons/SoulHarvester.cs index dd32bc6466..828bd76390 100644 --- a/Items/Weapons/SoulHarvester.cs +++ b/Items/Weapons/SoulHarvester.cs @@ -6,79 +6,79 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class SoulHarvester : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Harvester"); - Tooltip.SetDefault("Shoots a soul scythe\n" + - "Enemies explode when on low health, spreading the plague"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Harvester"); + Tooltip.SetDefault("Shoots a soul scythe\n" + + "Enemies explode when on low health, spreading the plague"); + } - public override void SetDefaults() - { - item.width = 62; - item.damage = 98; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("SoulScythe"); - item.shootSpeed = 18f; - } + public override void SetDefaults() + { + item.width = 62; + item.damage = 98; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; + item.height = 64; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("SoulScythe"); + item.shootSpeed = 18f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PlagueCellCluster", 10); - recipe.AddIngredient(ItemID.CursedFlame, 20); - recipe.AddIngredient(ItemID.DeathSickle); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PlagueCellCluster", 10); + recipe.AddIngredient(ItemID.CursedFlame, 20); + recipe.AddIngredient(ItemID.DeathSickle); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - target.AddBuff(BuffID.CursedInferno, 300); - if (target.life <= (target.lifeMax * 0.15f)) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + target.AddBuff(BuffID.CursedInferno, 300); + if (target.life <= (target.lifeMax * 0.15f)) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/Items/Weapons/SoulPiercer.cs b/Items/Weapons/SoulPiercer.cs index e30df3d9d3..d0a6074a47 100644 --- a/Items/Weapons/SoulPiercer.cs +++ b/Items/Weapons/SoulPiercer.cs @@ -1,8 +1,8 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons { @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Piercer"); - Tooltip.SetDefault("Casts a powerful ray that summons extra rays on enemy hits"); - Item.staff[item.type] = true; + Tooltip.SetDefault("Casts a powerful ray that summons extra rays on enemy hits"); + Item.staff[item.type] = true; } public override void SetDefaults() @@ -33,29 +33,29 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("SoulPiercer"); item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(32f, 30f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/SoulPiercerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(32f, 30f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/SoulPiercerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBar", 12); - recipe.AddIngredient(null, "NightmareFuel", 6); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(null, "NightmareFuel", 6); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 12); - recipe.AddIngredient(null, "EndothermicEnergy", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 12); + recipe.AddIngredient(null, "EndothermicEnergy", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/SparkSpreader.cs b/Items/Weapons/SparkSpreader.cs index 2bb371a910..fe9dacd927 100644 --- a/Items/Weapons/SparkSpreader.cs +++ b/Items/Weapons/SparkSpreader.cs @@ -1,63 +1,59 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Items.Weapons { - public class SparkSpreader : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spark Spreader"); - Tooltip.SetDefault("20% chance to not consume gel"); - } + public class SparkSpreader : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spark Spreader"); + Tooltip.SetDefault("20% chance to not consume gel"); + } - public override void SetDefaults() - { - item.damage = 7; - item.ranged = true; - item.width = 52; - item.height = 20; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 7; + item.ranged = true; + item.width = 52; + item.height = 20; + item.useTime = 10; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SparkSpreaderFire"); - item.shootSpeed = 5f; - item.useAmmo = 23; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("SparkSpreaderFire"); + item.shootSpeed = 5f; + item.useAmmo = 23; + } public override Vector2? HoldoutOffset() { return new Vector2(-4, 0); } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 20) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 20) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlareGun, 1); - recipe.AddIngredient(ItemID.Ruby, 1); - recipe.AddIngredient(ItemID.Gel, 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FlareGun, 1); + recipe.AddIngredient(ItemID.Ruby, 1); + recipe.AddIngredient(ItemID.Gel, 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SpatialLance.cs b/Items/Weapons/SpatialLance.cs index d08749ef05..45b8208e6e 100644 --- a/Items/Weapons/SpatialLance.cs +++ b/Items/Weapons/SpatialLance.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Elemental Lance"); Tooltip.SetDefault("Rend the cosmos asunder!\n" + - "Fires a lance beam that splits multiple times as it travels"); + "Fires a lance beam that splits multiple times as it travels"); } public override void SetDefaults() @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("SpatialLanceProjectile"); item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override bool CanUseItem(Player player) { diff --git a/Items/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs index 1978460f05..24c39de587 100644 --- a/Items/Weapons/SpectralstormCannon.cs +++ b/Items/Weapons/SpectralstormCannon.cs @@ -1,73 +1,72 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class SpectralstormCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spectralstorm Cannon"); - Tooltip.SetDefault("70% chance to not consume flares\n" + - "Fires a storm of ectoplasm and flares"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spectralstorm Cannon"); + Tooltip.SetDefault("70% chance to not consume flares\n" + + "Fires a storm of ectoplasm and flares"); + } - public override void SetDefaults() - { - item.damage = 44; - item.ranged = true; - item.width = 66; - item.height = 26; - item.useTime = 3; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; + public override void SetDefaults() + { + item.damage = 44; + item.ranged = true; + item.width = 66; + item.height = 26; + item.useTime = 3; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 163; - item.shootSpeed = 9.5f; - item.useAmmo = 931; - } + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 163; + item.shootSpeed = 9.5f; + item.useAmmo = 931; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 70) + return false; + return true; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(1, 2); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 200; - Main.projectile[projectile].Calamity().forceRanged = true; - } - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceRanged = true; - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(1, 2); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 200; + Main.projectile[projectile].Calamity().forceRanged = true; + } + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].Calamity().forceRanged = true; + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "FirestormCannon"); recipe.AddIngredient(ItemID.FragmentVortex, 20); recipe.AddIngredient(ItemID.Ectoplasm, 10); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/SpectreRifle.cs b/Items/Weapons/SpectreRifle.cs index f97d0643e1..cec28e1782 100644 --- a/Items/Weapons/SpectreRifle.cs +++ b/Items/Weapons/SpectreRifle.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -11,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Spectre Rifle"); - Tooltip.SetDefault("Fires a powerful homing soul"); - } + Tooltip.SetDefault("Fires a powerful homing soul"); + } public override void SetDefaults() { @@ -35,16 +34,16 @@ namespace CalamityMod.Items.Weapons item.useAmmo = 97; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceRanged = true; - return false; + Main.projectile[proj].Calamity().forceRanged = true; + return false; } public override void AddRecipes() diff --git a/Items/Weapons/SporeKnife.cs b/Items/Weapons/SporeKnife.cs index 2cd3c977e0..a4247ef6ac 100644 --- a/Items/Weapons/SporeKnife.cs +++ b/Items/Weapons/SporeKnife.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -55,8 +54,8 @@ namespace CalamityMod.Items.Weapons if (target.life <= 0) { int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - Main.projectile[proj].Calamity().forceMelee = true; - } + Main.projectile[proj].Calamity().forceMelee = true; + } } } } diff --git a/Items/Weapons/Spyker.cs b/Items/Weapons/Spyker.cs index c747049ef7..b44ed9482d 100644 --- a/Items/Weapons/Spyker.cs +++ b/Items/Weapons/Spyker.cs @@ -6,54 +6,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Spyker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spyker"); - Tooltip.SetDefault("Fires spikes that stick to enemies, tiles, and explode into shrapnel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spyker"); + Tooltip.SetDefault("Fires spikes that stick to enemies, tiles, and explode into shrapnel"); + } - public override void SetDefaults() - { - item.damage = 250; - item.ranged = true; - item.width = 44; - item.height = 26; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; + public override void SetDefaults() + { + item.damage = 250; + item.ranged = true; + item.width = 44; + item.height = 26; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item108; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("Spyker"); - item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("Spyker"); + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 12; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Spyker"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Spyker"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Needler"); - recipe.AddIngredient(ItemID.Stynger); - recipe.AddIngredient(null, "UeliaceBar", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Needler"); + recipe.AddIngredient(ItemID.Stynger); + recipe.AddIngredient(null, "UeliaceBar", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/StarCannonEX.cs b/Items/Weapons/StarCannonEX.cs index 6d973f91d7..473678e948 100644 --- a/Items/Weapons/StarCannonEX.cs +++ b/Items/Weapons/StarCannonEX.cs @@ -2,37 +2,36 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class StarCannonEX : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star Cannon EX"); - Tooltip.SetDefault("Fires a mix of normal, starfury, and astral stars"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star Cannon EX"); + Tooltip.SetDefault("Fires a mix of normal, starfury, and astral stars"); + } - public override void SetDefaults() - { - item.damage = 100; - item.ranged = true; - item.width = 66; - item.height = 22; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; + public override void SetDefaults() + { + item.damage = 100; + item.ranged = true; + item.width = 66; + item.height = 22; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; item.rare = 7; - item.noMelee = true; - item.knockBack = 8f; + item.noMelee = true; + item.knockBack = 8f; item.value = Item.buyPrice(0, 60, 0, 0); item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = 12; - item.shootSpeed = 15f; - item.useAmmo = AmmoID.FallenStar; - } + item.autoReuse = true; + item.shoot = 12; + item.shootSpeed = 15f; + item.useAmmo = AmmoID.FallenStar; + } public override Vector2? HoldoutOffset() { @@ -40,35 +39,40 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(1, 3); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; + { + int num6 = Main.rand.Next(1, 3); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; switch (Main.rand.Next(3)) { - case 0: break; - case 1: type = 9; break; - case 2: type = mod.ProjectileType("AstralStar"); break; + case 0: + break; + case 1: + type = 9; + break; + case 2: + type = mod.ProjectileType("AstralStar"); + break; } - int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[star].Calamity().forceRanged = true; - } - return false; - } + int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[star].Calamity().forceRanged = true; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.StarCannon); recipe.AddIngredient(null, "AstralJelly", 10); - recipe.AddIngredient(null, "Stardust", 25); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(null, "Stardust", 25); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/StardustStaff.cs b/Items/Weapons/StardustStaff.cs index 7ba18b7af6..e40ec5745d 100644 --- a/Items/Weapons/StardustStaff.cs +++ b/Items/Weapons/StardustStaff.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Eidolon Staff"); Tooltip.SetDefault("The power of an ancient cultist resonates within this staff\n" + - "Fires a spread of ancient light and has a chance to fire a spinning ice cluster"); + "Fires a spread of ancient light and has a chance to fire a spinning ice cluster"); Item.staff[item.type] = true; } diff --git a/Items/Weapons/Starfleet.cs b/Items/Weapons/Starfleet.cs index d317003c7f..f22fc722a6 100644 --- a/Items/Weapons/Starfleet.cs +++ b/Items/Weapons/Starfleet.cs @@ -6,33 +6,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Starfleet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starfleet"); - Tooltip.SetDefault("Fires a spread of plasma blasts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starfleet"); + Tooltip.SetDefault("Fires a spread of plasma blasts"); + } - public override void SetDefaults() - { - item.damage = 78; - item.ranged = true; - item.width = 80; - item.height = 26; - item.useTime = 55; - item.useAnimation = 55; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 15f; + public override void SetDefaults() + { + item.damage = 78; + item.ranged = true; + item.width = 80; + item.height = 26; + item.useTime = 55; + item.useAnimation = 55; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 15f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlasmaBlast"); - item.shootSpeed = 12f; - item.useAmmo = 75; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlasmaBlast"); + item.shootSpeed = 12f; + item.useAmmo = 75; + item.Calamity().postMoonLordRarity = 12; + } public override Vector2? HoldoutOffset() { @@ -40,27 +40,27 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int index = 0; index < 5; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } + { + for (int index = 0; index < 5; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "StarCannonEX"); recipe.AddIngredient(ItemID.ElectrosphereLauncher); recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/StarfleetMK2.cs b/Items/Weapons/StarfleetMK2.cs index e79fd70259..70955b854a 100644 --- a/Items/Weapons/StarfleetMK2.cs +++ b/Items/Weapons/StarfleetMK2.cs @@ -6,15 +6,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class StarfleetMK2 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starmada"); - Tooltip.SetDefault("Fires a barrage of stars and plasma blasts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starmada"); + Tooltip.SetDefault("Fires a barrage of stars and plasma blasts"); + } - public override void SetDefaults() - { + public override void SetDefaults() + { item.damage = 308; item.knockBack = 15f; item.shootSpeed = 16f; @@ -35,8 +35,8 @@ namespace CalamityMod.Items.Weapons item.useTurn = false; item.useAmmo = 75; item.autoReuse = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override Vector2? HoldoutOffset() { @@ -44,20 +44,20 @@ namespace CalamityMod.Items.Weapons } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("StarfleetMK2"), 0, 0f, player.whoAmI); + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("StarfleetMK2"), 0, 0f, player.whoAmI); return false; - } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "Starfleet"); recipe.AddIngredient(null, "CosmiliteBar", 10); recipe.AddIngredient(null, "ExodiumClusterOre", 15); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - } - } + } + } } diff --git a/Items/Weapons/StarnightLance.cs b/Items/Weapons/StarnightLance.cs index 80247044bd..903750684a 100644 --- a/Items/Weapons/StarnightLance.cs +++ b/Items/Weapons/StarnightLance.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Starnight Lance"); - Tooltip.SetDefault("Shoots a starnight beam"); - } + Tooltip.SetDefault("Shoots a starnight beam"); + } public override void SetDefaults() { diff --git a/Items/Weapons/StellarContemptMelee.cs b/Items/Weapons/StellarContemptMelee.cs index 60cfc83ab6..416120f8b8 100644 --- a/Items/Weapons/StellarContemptMelee.cs +++ b/Items/Weapons/StellarContemptMelee.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -14,13 +13,13 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Contempt"); - Tooltip.SetDefault("Lunar flares rain down on enemy hits"); + Tooltip.SetDefault("Lunar flares rain down on enemy hits"); } public override void SetDefaults() { item.width = 66; - item.height = 64; + item.height = 64; item.melee = true; item.damage = BaseDamage; item.knockBack = 9f; @@ -44,8 +43,8 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; + Main.projectile[proj].Calamity().forceMelee = true; + return false; } public override void AddRecipes() @@ -56,8 +55,8 @@ namespace CalamityMod.Items.Weapons r.AddIngredient(ItemID.LunarBar, 10); r.AddIngredient(ItemID.FragmentSolar, 10); r.AddIngredient(ItemID.FragmentNebula, 10); - r.AddTile(TileID.LunarCraftingStation); - r.AddRecipe(); + r.AddTile(TileID.LunarCraftingStation); + r.AddRecipe(); } } } diff --git a/Items/Weapons/StellarStriker.cs b/Items/Weapons/StellarStriker.cs index c545aeb721..47a85f5c34 100644 --- a/Items/Weapons/StellarStriker.cs +++ b/Items/Weapons/StellarStriker.cs @@ -1,112 +1,111 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class StellarStriker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Striker"); - Tooltip.SetDefault("Summons a swarm of lunar flares from the sky on enemy hits"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stellar Striker"); + Tooltip.SetDefault("Summons a swarm of lunar flares from the sky on enemy hits"); + } - public override void SetDefaults() - { - item.width = 84; - item.damage = 640; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 90; + public override void SetDefaults() + { + item.width = 84; + item.damage = 640; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 7.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 90; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); - int i = Main.myPlayer; - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num112 = 2; - for (int num113 = 0; num113 < num112; num113++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float num114 = num78; - float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, 645, (int)((double)((float)item.damage * player.meleeDamage) * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); - Main.projectile[proj].Calamity().forceMelee = true; - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); + int i = Main.myPlayer; + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num112 = 2; + for (int num113 = 0; num113 < num112; num113++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float num114 = num78; + float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, 645, (int)((double)((float)item.damage * player.meleeDamage) * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); + Main.projectile[proj].Calamity().forceMelee = true; + } + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 229); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 229); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CometQuasher"); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CometQuasher"); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/StormDragoon.cs b/Items/Weapons/StormDragoon.cs index caf56f2c54..6b7a1bbe09 100644 --- a/Items/Weapons/StormDragoon.cs +++ b/Items/Weapons/StormDragoon.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Dragoon"); - Tooltip.SetDefault("Fires a spray of bullets"); - } + Tooltip.SetDefault("Fires a spray of bullets"); + } public override void SetDefaults() { @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 18f; item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/StormRuler.cs b/Items/Weapons/StormRuler.cs index 13d7356511..db47c4d545 100644 --- a/Items/Weapons/StormRuler.cs +++ b/Items/Weapons/StormRuler.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Storm Ruler"); Tooltip.SetDefault("Only a storm can fell a greatwood\n" + - "Fires beams that generate tornadoes on death\n" + - "Tornadoes suck enemies in"); + "Fires beams that generate tornadoes on death\n" + + "Tornadoes suck enemies in"); } public override void SetDefaults() diff --git a/Items/Weapons/StormSaber.cs b/Items/Weapons/StormSaber.cs index 613e9d5d48..86f8f41b62 100644 --- a/Items/Weapons/StormSaber.cs +++ b/Items/Weapons/StormSaber.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Saber"); - Tooltip.SetDefault("Fires a storm beam"); - } + Tooltip.SetDefault("Fires a storm beam"); + } public override void SetDefaults() { diff --git a/Items/Weapons/StormSurge.cs b/Items/Weapons/StormSurge.cs index 085d01108a..7c48cefbae 100644 --- a/Items/Weapons/StormSurge.cs +++ b/Items/Weapons/StormSurge.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class StormSurge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Surge"); - Tooltip.SetDefault("Fear the storm\n" + - "Does not consume ammo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Surge"); + Tooltip.SetDefault("Fear the storm\n" + + "Does not consume ammo"); + } - public override void SetDefaults() - { - item.damage = 22; - item.ranged = true; - item.width = 58; - item.height = 22; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item122; + public override void SetDefaults() + { + item.damage = 22; + item.ranged = true; + item.width = 58; + item.height = 22; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.UseSound = SoundID.Item122; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.autoReuse = false; - item.shoot = mod.ProjectileType("StormSurge"); - item.shootSpeed = 12f; - } + item.autoReuse = false; + item.shoot = mod.ProjectileType("StormSurge"); + item.shootSpeed = 12f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StormlionMandible"); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddIngredient(null, "AerialiteBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StormlionMandible"); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddIngredient(null, "AerialiteBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/StreamGouge.cs b/Items/Weapons/StreamGouge.cs index 9a62eccffd..3cdd1c76d8 100644 --- a/Items/Weapons/StreamGouge.cs +++ b/Items/Weapons/StreamGouge.cs @@ -1,8 +1,8 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Stream Gouge"); Tooltip.SetDefault("Fires an essence flame beam\n" + - "Ignores immunity frames"); + "Ignores immunity frames"); } public override void SetDefaults() @@ -34,16 +34,16 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("StreamGouge"); item.shootSpeed = 15f; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(50f, 48f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/StreamGougeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(50f, 48f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/StreamGougeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool CanUseItem(Player player) + public override bool CanUseItem(Player player) { for (int i = 0; i < 1000; ++i) { @@ -59,16 +59,16 @@ namespace CalamityMod.Items.Weapons { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddIngredient(null, "NightmareFuel", 7); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(null, "NightmareFuel", 7); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 7); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/SubsumingVortex.cs b/Items/Weapons/SubsumingVortex.cs index b030e787ba..7a849c9eab 100644 --- a/Items/Weapons/SubsumingVortex.cs +++ b/Items/Weapons/SubsumingVortex.cs @@ -1,76 +1,76 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons { public class SubsumingVortex : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Subsuming Vortex"); - Tooltip.SetDefault("Fires 3 vortexes of elemental energy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Subsuming Vortex"); + Tooltip.SetDefault("Fires 3 vortexes of elemental energy"); + } - public override void SetDefaults() - { - item.damage = 520; - item.magic = true; - item.mana = 20; - item.width = 38; - item.height = 48; - item.UseSound = SoundID.Item84; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; + public override void SetDefaults() + { + item.damage = 520; + item.magic = true; + item.mana = 20; + item.width = 38; + item.height = 48; + item.UseSound = SoundID.Item84; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("Vortex"); - item.shootSpeed = 9f; - item.Calamity().postMoonLordRarity = 15; - } + item.shoot = mod.ProjectileType("Vortex"); + item.shootSpeed = 9f; + item.Calamity().postMoonLordRarity = 15; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(19f, 22f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/SubsumingVortexGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(19f, 22f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/SubsumingVortexGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = 3; - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - float ai = (Main.rand.NextFloat() + 0.5f); - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, ai); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = 3; + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; + float ai = (Main.rand.NextFloat() + 0.5f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, ai); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AuguroftheElements"); - recipe.AddIngredient(null, "NuclearFury"); - recipe.AddIngredient(null, "RelicofRuin"); - recipe.AddIngredient(null, "TearsofHeaven"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AuguroftheElements"); + recipe.AddIngredient(null, "NuclearFury"); + recipe.AddIngredient(null, "RelicofRuin"); + recipe.AddIngredient(null, "TearsofHeaven"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); recipe.AddIngredient(null, "DarksunFragment", 5); recipe.AddIngredient(null, "HellcasterFragment", 3); recipe.AddIngredient(null, "Phantoplasm", 5); recipe.AddIngredient(null, "AuricOre", 25); recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SunkenSea/AquamarineStaff.cs b/Items/Weapons/SunkenSea/AquamarineStaff.cs index d390f1b7cc..aa841522bd 100644 --- a/Items/Weapons/SunkenSea/AquamarineStaff.cs +++ b/Items/Weapons/SunkenSea/AquamarineStaff.cs @@ -5,63 +5,63 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class AquamarineStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquamarine Staff"); - Tooltip.SetDefault("Shoots two blue bolts"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquamarine Staff"); + Tooltip.SetDefault("Shoots two blue bolts"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 3; - item.width = 38; - item.height = 38; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AquamarineBolt"); - item.shootSpeed = 9f; - } + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 3; + item.width = 38; + item.height = 38; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AquamarineBolt"); + item.shootSpeed = 9f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(2, 3); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 180; - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(2, 3); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 180; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RubyStaff); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddIngredient(null, "Navystone", 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DiamondStaff); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddIngredient(null, "Navystone", 25); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RubyStaff); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddIngredient(null, "Navystone", 25); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); - } - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DiamondStaff); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddIngredient(null, "Navystone", 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SunkenSea/AquashardShotgun.cs b/Items/Weapons/SunkenSea/AquashardShotgun.cs index c8ba17f836..a9acb315ae 100644 --- a/Items/Weapons/SunkenSea/AquashardShotgun.cs +++ b/Items/Weapons/SunkenSea/AquashardShotgun.cs @@ -6,61 +6,61 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class AquashardShotgun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquashard Shotgun"); - Tooltip.SetDefault("Shoots aquashards which split upon hitting an enemy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquashard Shotgun"); + Tooltip.SetDefault("Shoots aquashards which split upon hitting an enemy"); + } - public override void SetDefaults() - { - item.damage = 12; - item.ranged = true; - item.width = 62; - item.height = 26; - item.crit += 6; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Aquashard"); - item.shootSpeed = 22f; - } + public override void SetDefaults() + { + item.damage = 12; + item.ranged = true; + item.width = 62; + item.height = 26; + item.crit += 6; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Aquashard"); + item.shootSpeed = 22f; + } - public override Vector2? HoldoutOffset() + public override Vector2? HoldoutOffset() { return new Vector2(-10, 0); } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(2, 4); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 200; - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(2, 4); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 200; + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Boomstick); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddIngredient(null, "PrismShard", 5); - recipe.AddIngredient(null, "Navystone", 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Boomstick); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddIngredient(null, "PrismShard", 5); + recipe.AddIngredient(null, "Navystone", 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SunkenSea/ClamCrusher.cs b/Items/Weapons/SunkenSea/ClamCrusher.cs index ee3532a9f2..690cc74c61 100644 --- a/Items/Weapons/SunkenSea/ClamCrusher.cs +++ b/Items/Weapons/SunkenSea/ClamCrusher.cs @@ -5,33 +5,33 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class ClamCrusher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clam Crusher"); - Tooltip.SetDefault("Launches a huge clam that stuns enemies for a short amount of time\n" + - "Starts being affected by gravity and does much more damage after being airborne for a while"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clam Crusher"); + Tooltip.SetDefault("Launches a huge clam that stuns enemies for a short amount of time\n" + + "Starts being affected by gravity and does much more damage after being airborne for a while"); + } - public override void SetDefaults() - { - item.damage = 140; - item.melee = true; - item.width = 40; - item.height = 60; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = 5; - item.noMelee = true; + public override void SetDefaults() + { + item.damage = 140; + item.melee = true; + item.width = 40; + item.height = 60; + item.useTime = 50; + item.useAnimation = 50; + item.useStyle = 5; + item.noMelee = true; item.noUseGraphic = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + item.knockBack = 10f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.channel = true; - item.shoot = mod.ProjectileType("ClamCrusherFlail"); - item.shootSpeed = 18f; - } - } + item.shoot = mod.ProjectileType("ClamCrusherFlail"); + item.shootSpeed = 18f; + } + } } diff --git a/Items/Weapons/SunkenSea/ClamorRifle.cs b/Items/Weapons/SunkenSea/ClamorRifle.cs index a1413499d3..5fcdebb717 100644 --- a/Items/Weapons/SunkenSea/ClamorRifle.cs +++ b/Items/Weapons/SunkenSea/ClamorRifle.cs @@ -5,42 +5,42 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class ClamorRifle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clamor Rifle"); - Tooltip.SetDefault("Shoots homing energy bolts"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clamor Rifle"); + Tooltip.SetDefault("Shoots homing energy bolts"); + } - public override void SetDefaults() - { - item.damage = 32; - item.ranged = true; - item.width = 64; - item.height = 30; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.rare = 5; - item.shoot = mod.ProjectileType("ClamorRifleProj"); - item.shootSpeed = 15f; - item.useAmmo = 97; - } + public override void SetDefaults() + { + item.damage = 32; + item.ranged = true; + item.width = 64; + item.height = 30; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + item.autoReuse = true; + item.rare = 5; + item.shoot = mod.ProjectileType("ClamorRifleProj"); + item.shootSpeed = 15f; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ClamorRifleProj"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ClamorRifleProj"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; - } - } + } + } } diff --git a/Items/Weapons/SunkenSea/EutrophicScimitar.cs b/Items/Weapons/SunkenSea/EutrophicScimitar.cs index 1f77376fe4..2ae5689641 100644 --- a/Items/Weapons/SunkenSea/EutrophicScimitar.cs +++ b/Items/Weapons/SunkenSea/EutrophicScimitar.cs @@ -6,31 +6,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class EutrophicScimitar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eutrophic Scimitar"); - Tooltip.SetDefault("Fires a beam upon swing that stuns enemies"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eutrophic Scimitar"); + Tooltip.SetDefault("Fires a beam upon swing that stuns enemies"); + } - public override void SetDefaults() - { - item.damage = 130; - item.melee = true; - item.width = 46; - item.height = 76; - item.useTime = 38; - item.useAnimation = 38; - item.useStyle = 1; - item.knockBack = 2; - item.shoot = mod.ProjectileType("EutrophicScimitarProj"); - item.shootSpeed = 17; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; - } + public override void SetDefaults() + { + item.damage = 130; + item.melee = true; + item.width = 46; + item.height = 76; + item.useTime = 38; + item.useAnimation = 38; + item.useStyle = 1; + item.knockBack = 2; + item.shoot = mod.ProjectileType("EutrophicScimitarProj"); + item.shootSpeed = 17; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.useTurn = true; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/SunkenSea/EutrophicShank.cs b/Items/Weapons/SunkenSea/EutrophicShank.cs index 56c09471bf..a32c205865 100644 --- a/Items/Weapons/SunkenSea/EutrophicShank.cs +++ b/Items/Weapons/SunkenSea/EutrophicShank.cs @@ -6,51 +6,51 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class EutrophicShank : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eutrophic Shank"); - Tooltip.SetDefault("Shoots electric sparks"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eutrophic Shank"); + Tooltip.SetDefault("Shoots electric sparks"); + } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 14; - item.useTime = 14; - item.width = 42; - item.height = 38; - item.damage = 24; - item.melee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("EutrophicSpark"); - item.shootSpeed = 3f; - } + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 14; + item.useTime = 14; + item.width = 42; + item.height = 38; + item.damage = 24; + item.melee = true; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("EutrophicSpark"); + item.shootSpeed = 3f; + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 206, 0f, 0f, 100, default, 1f); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 206, 0f, 0f, 100, default, 1f); + } + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(1, 2); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(1, 2); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } diff --git a/Items/Weapons/SunkenSea/Poseidon.cs b/Items/Weapons/SunkenSea/Poseidon.cs index e0a9ebcd7b..1bed5797c2 100644 --- a/Items/Weapons/SunkenSea/Poseidon.cs +++ b/Items/Weapons/SunkenSea/Poseidon.cs @@ -5,31 +5,31 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class Poseidon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Poseidon"); - Tooltip.SetDefault("Casts a poseidon typhoon"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Poseidon"); + Tooltip.SetDefault("Casts a poseidon typhoon"); + } - public override void SetDefaults() - { - item.damage = 58; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 32; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item84; - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PoseidonTyphoon"); - item.shootSpeed = 10f; - } - } + public override void SetDefaults() + { + item.damage = 58; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 32; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = SoundID.Item84; + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PoseidonTyphoon"); + item.shootSpeed = 10f; + } + } } diff --git a/Items/Weapons/SunkenSea/SeashineSword.cs b/Items/Weapons/SunkenSea/SeashineSword.cs index dccedbfea0..bfce21eaf9 100644 --- a/Items/Weapons/SunkenSea/SeashineSword.cs +++ b/Items/Weapons/SunkenSea/SeashineSword.cs @@ -6,41 +6,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class SeashineSword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seashine Sword"); - Tooltip.SetDefault("Shoots an aqua sword beam"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seashine Sword"); + Tooltip.SetDefault("Shoots an aqua sword beam"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.EnchantedSword); - item.damage = 26; - item.melee = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.width = 38; - item.height = 38; - item.knockBack = 2; - item.shootSpeed = 11; - item.rare = 2; - item.UseSound = SoundID.Item1; - } + public override void SetDefaults() + { + item.CloneDefaults(ItemID.EnchantedSword); + item.damage = 26; + item.melee = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.width = 38; + item.height = 38; + item.knockBack = 2; + item.shootSpeed = 11; + item.rare = 2; + item.UseSound = SoundID.Item1; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - type = mod.ProjectileType("SeashineSwordProj"); - return base.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack); - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + type = mod.ProjectileType("SeashineSwordProj"); + return base.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SeaPrism", 7); - recipe.AddIngredient(null, "Navystone", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SeaPrism", 7); + recipe.AddIngredient(null, "Navystone", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/SunkenSea/Serpentine.cs b/Items/Weapons/SunkenSea/Serpentine.cs index a87adebf81..c0a531f207 100644 --- a/Items/Weapons/SunkenSea/Serpentine.cs +++ b/Items/Weapons/SunkenSea/Serpentine.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,89 +7,89 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class Serpentine : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Serpentine"); - Tooltip.SetDefault("Casts a serpent that follows the mouse cursor"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Serpentine"); + Tooltip.SetDefault("Casts a serpent that follows the mouse cursor"); + } - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 32; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item20; - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SerpentineHead"); - item.shootSpeed = 10f; - } + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 32; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = SoundID.Item20; + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SerpentineHead"); + item.shootSpeed = 10f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int owner = player.whoAmI; - float num72 = item.shootSpeed; - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = num72; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int owner = player.whoAmI; + float num72 = item.shootSpeed; + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); + Vector2 vector3 = Main.MouseWorld - vector2; + float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) + { + velX = (float)player.direction; + velY = 0f; + dist = num72; + } else - { - dist = num72 / dist; - } - velX *= dist; - velY *= dist; - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - //velX = 0f; - //velY = 0f; - //vector2.X = (float)Main.mouseX + Main.screenPosition.X; - //vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineHead"), damage, knockBack, owner); + { + dist = num72 / dist; + } + velX *= dist; + velY *= dist; + float num77 = Vector2.Dot(value, vector3); + if (num77 > 0f) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + //velX = 0f; + //velY = 0f; + //vector2.X = (float)Main.mouseX + Main.screenPosition.X; + //vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + int curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineHead"), damage, knockBack, owner); - int prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); + int prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); - prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); + prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); - prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); + prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); - prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineTail"), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - return false; - } - } + prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineTail"), damage, knockBack, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + return false; + } + } } diff --git a/Items/Weapons/SunkenSea/ShellfishStaff.cs b/Items/Weapons/SunkenSea/ShellfishStaff.cs index c83015b99c..d62264b5f1 100644 --- a/Items/Weapons/SunkenSea/ShellfishStaff.cs +++ b/Items/Weapons/SunkenSea/ShellfishStaff.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.SunkenSea { DisplayName.SetDefault("Shellfish Staff"); Tooltip.SetDefault("Summons a shellfish to fight for you\n" + - "Takes up 2 minion slots"); + "Takes up 2 minion slots"); } public override void SetDefaults() @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.SunkenSea item.useStyle = 1; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = mod.ProjectileType("Shellfish"); @@ -34,30 +34,30 @@ namespace CalamityMod.Items.Weapons.SunkenSea item.summon = true; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/SunkenSea/Whirlpool.cs b/Items/Weapons/SunkenSea/Whirlpool.cs index f87497e4a4..b92a938cf4 100644 --- a/Items/Weapons/SunkenSea/Whirlpool.cs +++ b/Items/Weapons/SunkenSea/Whirlpool.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.SunkenSea { public class Whirlpool : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Riptide"); - Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Riptide"); + Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions"); + } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 18; - item.width = 30; - item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.knockBack = 1f; - item.channel = true; - item.melee = true; - item.useStyle = 5; - item.useAnimation = 25; - item.useTime = 25; - item.shoot = mod.ProjectileType("WhirlpoolProjectile"); - item.shootSpeed = 18f; - item.UseSound = SoundID.Item1; - ItemID.Sets.Yoyo[item.type] = true; - } + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 18; + item.width = 30; + item.height = 44; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.knockBack = 1f; + item.channel = true; + item.melee = true; + item.useStyle = 5; + item.useAnimation = 25; + item.useTime = 25; + item.shoot = mod.ProjectileType("WhirlpoolProjectile"); + item.shootSpeed = 18f; + item.UseSound = SoundID.Item1; + ItemID.Sets.Yoyo[item.type] = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SeaPrism", 7); - recipe.AddIngredient(null, "Navystone", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SeaPrism", 7); + recipe.AddIngredient(null, "Navystone", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/SuperballBullet.cs b/Items/Weapons/SuperballBullet.cs index 00e687ef76..ee8f4e7dfc 100644 --- a/Items/Weapons/SuperballBullet.cs +++ b/Items/Weapons/SuperballBullet.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class SuperballBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Superball Bullet"); - Tooltip.SetDefault("Bounces at extreme speeds"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Superball Bullet"); + Tooltip.SetDefault("Bounces at extreme speeds"); + } - public override void SetDefaults() - { - item.damage = 6; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 250; - item.rare = 1; - item.shoot = mod.ProjectileType("SuperballBullet"); - item.shootSpeed = 1f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 6; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("SuperballBullet"); + item.shootSpeed = 1f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteorShot, 150); - recipe.AddIngredient(null, "VictoryShard"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteorShot, 150); + recipe.AddIngredient(null, "VictoryShard"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Svantechnical.cs b/Items/Weapons/Svantechnical.cs index 61a65fc8c7..9ab7f61c85 100644 --- a/Items/Weapons/Svantechnical.cs +++ b/Items/Weapons/Svantechnical.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Svantechnical"); - Tooltip.SetDefault("Fires several barrages of bullets"); - } + Tooltip.SetDefault("Fires several barrages of bullets"); + } public override void SetDefaults() { @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 12f; item.shoot = 10; item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/T1000.cs b/Items/Weapons/T1000.cs index e6b3690088..625467934f 100644 --- a/Items/Weapons/T1000.cs +++ b/Items/Weapons/T1000.cs @@ -4,50 +4,50 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class T1000 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("T1000"); - Tooltip.SetDefault("Fires a spread of rainbow lasers"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("T1000"); + Tooltip.SetDefault("Fires a spread of rainbow lasers"); + } - public override void SetDefaults() - { - item.damage = 370; - item.magic = true; - item.mana = 10; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 4f; + public override void SetDefaults() + { + item.damage = 370; + item.magic = true; + item.mana = 10; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 4f; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = mod.ProjectileType("T1000"); - item.shootSpeed = 24f; - item.Calamity().postMoonLordRarity = 14; - } + item.shoot = mod.ProjectileType("T1000"); + item.shootSpeed = 24f; + item.Calamity().postMoonLordRarity = 14; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Purge"); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Purge"); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("T1000"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("T1000"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } diff --git a/Items/Weapons/TemporalFloeSword.cs b/Items/Weapons/TemporalFloeSword.cs index 451cc99bb2..fe55d0dd5c 100644 --- a/Items/Weapons/TemporalFloeSword.cs +++ b/Items/Weapons/TemporalFloeSword.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Temporal Floe Sword"); Tooltip.SetDefault("The iceman cometh...\n" + - "Fires a frozen sword beam"); + "Fires a frozen sword beam"); } public override void SetDefaults() diff --git a/Items/Weapons/TerraArrow.cs b/Items/Weapons/TerraArrow.cs index 0fb1d5ce54..9967a1ae00 100644 --- a/Items/Weapons/TerraArrow.cs +++ b/Items/Weapons/TerraArrow.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TerraArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Arrow"); - Tooltip.SetDefault("Travels incredibly quickly and explodes into more arrows when it hits a certain velocity"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Arrow"); + Tooltip.SetDefault("Travels incredibly quickly and explodes into more arrows when it hits a certain velocity"); + } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 2000; - item.rare = 7; - item.shoot = mod.ProjectileType("TerraArrow"); - item.shootSpeed = 15f; - item.ammo = 40; - } + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 2000; + item.rare = 7; + item.shoot = mod.ProjectileType("TerraArrow"); + item.shootSpeed = 15f; + item.ammo = 40; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddIngredient(ItemID.WoodenArrow, 250); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddIngredient(ItemID.WoodenArrow, 250); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/TerraBullet.cs b/Items/Weapons/TerraBullet.cs index dec86cce64..536408324e 100644 --- a/Items/Weapons/TerraBullet.cs +++ b/Items/Weapons/TerraBullet.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TerraBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Bullet"); - Tooltip.SetDefault("Explodes and splits into homing terra shards on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Bullet"); + Tooltip.SetDefault("Explodes and splits into homing terra shards on death"); + } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 2000; - item.rare = 7; - item.shoot = mod.ProjectileType("TerraBullet"); - item.shootSpeed = 10f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 2000; + item.rare = 7; + item.shoot = mod.ProjectileType("TerraBullet"); + item.shootSpeed = 10f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalBullet, 100); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalBullet, 100); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/TerraEdge.cs b/Items/Weapons/TerraEdge.cs index fd47af0615..69d949b2c9 100644 --- a/Items/Weapons/TerraEdge.cs +++ b/Items/Weapons/TerraEdge.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Terra Edge"); Tooltip.SetDefault("Heals the player on enemy hits\n" + - "Fires a beam that inflicts ichor for a short time"); + "Fires a beam that inflicts ichor for a short time"); } public override void SetDefaults() diff --git a/Items/Weapons/TerraFlameburster.cs b/Items/Weapons/TerraFlameburster.cs index 460583bb68..e2c36e0588 100644 --- a/Items/Weapons/TerraFlameburster.cs +++ b/Items/Weapons/TerraFlameburster.cs @@ -5,49 +5,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TerraFlameburster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Flameburster"); - Tooltip.SetDefault("80% chance to not consume gel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Flameburster"); + Tooltip.SetDefault("80% chance to not consume gel"); + } - public override void SetDefaults() - { - item.damage = 56; - item.ranged = true; - item.width = 68; - item.height = 22; - item.useTime = 3; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 56; + item.ranged = true; + item.width = 68; + item.height = 22; + item.useTime = 3; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraFireGreen"); - item.shootSpeed = 7.5f; - item.useAmmo = 23; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraFireGreen"); + item.shootSpeed = 7.5f; + item.useAmmo = 23; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 80) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 80) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Flamethrower); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Flamethrower); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/TerraLance.cs b/Items/Weapons/TerraLance.cs index ff1a1a7f07..7ed01b3c49 100644 --- a/Items/Weapons/TerraLance.cs +++ b/Items/Weapons/TerraLance.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Lance"); - Tooltip.SetDefault("Fires a lance beam"); - } + Tooltip.SetDefault("Fires a lance beam"); + } public override void SetDefaults() { diff --git a/Items/Weapons/TerraRay.cs b/Items/Weapons/TerraRay.cs index d5454428bb..a267c911a2 100644 --- a/Items/Weapons/TerraRay.cs +++ b/Items/Weapons/TerraRay.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Ray"); - Tooltip.SetDefault("Casts an energy ray that splits if enemies are near it"); - Item.staff[item.type] = true; + Tooltip.SetDefault("Casts an energy ray that splits if enemies are near it"); + Item.staff[item.type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/TerraShiv.cs b/Items/Weapons/TerraShiv.cs index 31d58f9c4d..928fe27f4c 100644 --- a/Items/Weapons/TerraShiv.cs +++ b/Items/Weapons/TerraShiv.cs @@ -33,13 +33,13 @@ namespace CalamityMod.Items.Weapons item.rare = 8; } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "TrueNightsStabber"); diff --git a/Items/Weapons/Terracotta.cs b/Items/Weapons/Terracotta.cs index 24c79d2667..b21afddd39 100644 --- a/Items/Weapons/Terracotta.cs +++ b/Items/Weapons/Terracotta.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,51 +6,51 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Terracotta : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra-cotta"); - Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death\n" + - "Enemies explode on hit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra-cotta"); + Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death\n" + + "Enemies explode on hit"); + } - public override void SetDefaults() - { - item.width = 48; - item.damage = 125; - item.melee = true; - item.useAnimation = 17; - item.useTime = 17; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shootSpeed = 5f; - } + public override void SetDefaults() + { + item.width = 48; + item.damage = 125; + item.melee = true; + item.useAnimation = 17; + item.useTime = 17; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shootSpeed = 5f; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("Terracotta"), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("Terracotta"), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("Terracotta"), 0, 0f, player.whoAmI); - } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("TerracottaExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + float randomSpeedX = (float)Main.rand.Next(3); + float randomSpeedY = (float)Main.rand.Next(3, 5); + Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("Terracotta"), 0, 0f, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("Terracotta"), 0, 0f, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("Terracotta"), 0, 0f, player.whoAmI); + } + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("TerracottaExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); + } + } + } } diff --git a/Items/Weapons/Terratomere.cs b/Items/Weapons/Terratomere.cs index d91c0cefbb..6496bcad0c 100644 --- a/Items/Weapons/Terratomere.cs +++ b/Items/Weapons/Terratomere.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons DisplayName.SetDefault("Terratomere"); Tooltip.SetDefault("Linked to the essence of Terraria\n" + "Heals the player on enemy hits\n" + - "Fires a barrage of homing beams that inflict several debuffs"); + "Fires a barrage of homing beams that inflict several debuffs"); } public override void SetDefaults() @@ -51,23 +51,23 @@ namespace CalamityMod.Items.Weapons public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "XerocsGreatsword"); + recipe.AddIngredient(null, "XerocsGreatsword"); recipe.AddIngredient(null, "Floodtide"); recipe.AddIngredient(null, "Hellkite"); recipe.AddIngredient(null, "TemporalFloeSword"); recipe.AddIngredient(ItemID.TerraBlade); - recipe.AddIngredient(null, "AstralBar", 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(null, "AstralBar", 5); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "XerocsGreatsword"); + recipe.AddIngredient(null, "XerocsGreatsword"); recipe.AddIngredient(null, "Floodtide"); recipe.AddIngredient(null, "Hellkite"); recipe.AddIngredient(null, "TemporalFloeSword"); recipe.AddIngredient(null, "TerraEdge"); - recipe.AddIngredient(null, "AstralBar", 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(null, "AstralBar", 5); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/TheBallista.cs b/Items/Weapons/TheBallista.cs index 56fdfcd04d..1fb5664449 100644 --- a/Items/Weapons/TheBallista.cs +++ b/Items/Weapons/TheBallista.cs @@ -6,48 +6,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TheBallista : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Ballista"); - Tooltip.SetDefault("Shoots greatarrows that crush enemy armor and break into shards on death"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Ballista"); + Tooltip.SetDefault("Shoots greatarrows that crush enemy armor and break into shards on death"); + } - public override void SetDefaults() - { - item.damage = 125; - item.ranged = true; - item.width = 40; - item.height = 70; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BallistaGreatArrow"); - item.shootSpeed = 20f; - item.useAmmo = 40; - } + public override void SetDefaults() + { + item.damage = 125; + item.ranged = true; + item.width = 40; + item.height = 70; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BallistaGreatArrow"); + item.shootSpeed = 20f; + item.useAmmo = 40; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BallistaGreatArrow"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BallistaGreatArrow"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Marrow); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.Ectoplasm, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Marrow); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(ItemID.Ectoplasm, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/TheEmpyrean.cs b/Items/Weapons/TheEmpyrean.cs index 017b39e725..b83447c42a 100644 --- a/Items/Weapons/TheEmpyrean.cs +++ b/Items/Weapons/TheEmpyrean.cs @@ -5,47 +5,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TheEmpyrean : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Empyrean"); - Tooltip.SetDefault("70% chance to not consume gel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Empyrean"); + Tooltip.SetDefault("70% chance to not consume gel"); + } - public override void SetDefaults() - { - item.damage = 92; - item.ranged = true; - item.width = 70; - item.height = 24; - item.useTime = 5; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; + public override void SetDefaults() + { + item.damage = 92; + item.ranged = true; + item.width = 70; + item.height = 24; + item.useTime = 5; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CosmicFire"); - item.shootSpeed = 7.5f; - item.useAmmo = 23; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("CosmicFire"); + item.shootSpeed = 7.5f; + item.useAmmo = 23; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 70) + return false; + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/TheEnforcer.cs b/Items/Weapons/TheEnforcer.cs index 074c68138c..d93c933708 100644 --- a/Items/Weapons/TheEnforcer.cs +++ b/Items/Weapons/TheEnforcer.cs @@ -1,6 +1,6 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("The Enforcer"); - Tooltip.SetDefault("Fires an essence flame burst and spawns essence flames on enemy hits"); - } + Tooltip.SetDefault("Fires an essence flame burst and spawns essence flames on enemy hits"); + } public override void SetDefaults() { @@ -32,16 +32,16 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("EssenceFireball"); item.shootSpeed = 24f; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(50f, 48f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/TheEnforcerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(50f, 48f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/TheEnforcerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); int i = Main.myPlayer; @@ -105,16 +105,16 @@ namespace CalamityMod.Items.Weapons { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "CosmiliteBar", 15); - recipe.AddIngredient(null, "NightmareFuel", 7); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(null, "NightmareFuel", 7); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 15); - recipe.AddIngredient(null, "EndothermicEnergy", 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 15); + recipe.AddIngredient(null, "EndothermicEnergy", 7); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/TheMutilator.cs b/Items/Weapons/TheMutilator.cs index f56387dff4..6b0ed4f666 100644 --- a/Items/Weapons/TheMutilator.cs +++ b/Items/Weapons/TheMutilator.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shootSpeed = 10f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { diff --git a/Items/Weapons/TheStorm.cs b/Items/Weapons/TheStorm.cs index cac863e28c..751530f2ea 100644 --- a/Items/Weapons/TheStorm.cs +++ b/Items/Weapons/TheStorm.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("The Storm"); - Tooltip.SetDefault("Fires a spread of arrows from the sky\n" + - "Wooden arrows are converted to lightning bolts"); - } + Tooltip.SetDefault("Fires a spread of arrows from the sky\n" + + "Wooden arrows are converted to lightning bolts"); + } public override void SetDefaults() { @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("Bolt"); item.shootSpeed = 28f; item.useAmmo = 40; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/TheSwarmer.cs b/Items/Weapons/TheSwarmer.cs index 5503597479..6c454c2cb8 100644 --- a/Items/Weapons/TheSwarmer.cs +++ b/Items/Weapons/TheSwarmer.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -11,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("The Swarmer"); - Tooltip.SetDefault("Fires a swarm of bees and wasps"); - } + Tooltip.SetDefault("Fires a swarm of bees and wasps"); + } public override void SetDefaults() { @@ -57,16 +56,16 @@ namespace CalamityMod.Items.Weapons float SpeedY = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; int wasps = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, 0f, player.whoAmI, 0f, 0f); Main.projectile[wasps].penetrate = 1; - Main.projectile[wasps].Calamity().forceMagic = true; - } + Main.projectile[wasps].Calamity().forceMagic = true; + } for (int i = 0; i <= 3; i++) { float SpeedX2 = speedX + (float)Main.rand.Next(-35, 36) * 0.05f; float SpeedY2 = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; int bees = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, player.beeType(), player.beeDamage(item.damage), player.beeKB(0f), player.whoAmI, 0f, 0f); Main.projectile[bees].penetrate = 1; - Main.projectile[bees].Calamity().forceMagic = true; - } + Main.projectile[bees].Calamity().forceMagic = true; + } return false; } } diff --git a/Items/Weapons/TheWand.cs b/Items/Weapons/TheWand.cs index 694ccecb94..7b3f7e9b6a 100644 --- a/Items/Weapons/TheWand.cs +++ b/Items/Weapons/TheWand.cs @@ -6,51 +6,51 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TheWand : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Wand"); - Tooltip.SetDefault("The ultimate wand"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Wand"); + Tooltip.SetDefault("The ultimate wand"); + } - public override void SetDefaults() - { - item.width = 40; - item.damage = 1; - item.mana = 500; - item.magic = true; - item.noMelee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 0f; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.height = 36; + public override void SetDefaults() + { + item.width = 40; + item.damage = 1; + item.mana = 500; + item.magic = true; + item.noMelee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 0f; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.height = 36; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("SparkInfernal"); - item.shootSpeed = 24f; - item.Calamity().postMoonLordRarity = 15; - } + item.shootSpeed = 24f; + item.Calamity().postMoonLordRarity = 15; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WandofSparking); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + } + } + } } diff --git a/Items/Weapons/TitaniumRailgun.cs b/Items/Weapons/TitaniumRailgun.cs index 42c532c319..519562e00f 100644 --- a/Items/Weapons/TitaniumRailgun.cs +++ b/Items/Weapons/TitaniumRailgun.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Titanium Railgun"); - Tooltip.SetDefault("Fires a laser"); - } + Tooltip.SetDefault("Fires a laser"); + } public override void SetDefaults() { diff --git a/Items/Weapons/TomeofFates.cs b/Items/Weapons/TomeofFates.cs index caee815020..b2ee22110d 100644 --- a/Items/Weapons/TomeofFates.cs +++ b/Items/Weapons/TomeofFates.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Tome of Fates"); Tooltip.SetDefault("Casts cosmic tentacles to spear your enemies\n" + - "Can randomly fire a brimstone tentacle for immense damage"); + "Can randomly fire a brimstone tentacle for immense damage"); } public override void SetDefaults() diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs index 4e76589984..3d2b354d53 100644 --- a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); - Tooltip.SetDefault("Explodes on enemy hits"); - } + Tooltip.SetDefault("Explodes on enemy hits"); + } public override void SetDefaults() { @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.shoot = mod.ProjectileType("TriactisOPHammerMelee"); item.shootSpeed = 25f; - item.Calamity().postMoonLordRarity = 16; - } + item.Calamity().postMoonLordRarity = 16; + } public override void AddRecipes() { diff --git a/Items/Weapons/Trinity.cs b/Items/Weapons/Trinity.cs index aeeddb3790..ab77ac8bbf 100644 --- a/Items/Weapons/Trinity.cs +++ b/Items/Weapons/Trinity.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -11,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Trinity"); - Tooltip.SetDefault("Fires a spread of energy bolts"); - } + Tooltip.SetDefault("Fires a spread of energy bolts"); + } public override void SetDefaults() { @@ -37,18 +36,25 @@ namespace CalamityMod.Items.Weapons { switch (Main.rand.Next(3)) { - case 0: type = 125; break; - case 1: type = 123; break; - case 2: type = 121; break; - default: break; + case 0: + type = 125; + break; + case 1: + type = 123; + break; + case 2: + type = 121; + break; + default: + break; } for (int projectiles = 0; projectiles <= 3; projectiles++) { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6), knockBack, Main.myPlayer, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } + Main.projectile[proj].Calamity().forceMelee = true; + } return false; } diff --git a/Items/Weapons/Triploon.cs b/Items/Weapons/Triploon.cs index f68cc270cc..71577676c4 100644 --- a/Items/Weapons/Triploon.cs +++ b/Items/Weapons/Triploon.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Triploon"); - Tooltip.SetDefault("Launches three harpoons"); - } + Tooltip.SetDefault("Launches three harpoons"); + } public override void SetDefaults() { diff --git a/Items/Weapons/TrueArkoftheAncients.cs b/Items/Weapons/TrueArkoftheAncients.cs index 5737128b69..995cea0da6 100644 --- a/Items/Weapons/TrueArkoftheAncients.cs +++ b/Items/Weapons/TrueArkoftheAncients.cs @@ -1,144 +1,147 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { public class TrueArkoftheAncients : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Ark of the Ancients"); - Tooltip.SetDefault("A heavenly blade forged to vanquish all evil"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Ark of the Ancients"); + Tooltip.SetDefault("A heavenly blade forged to vanquish all evil"); + } - public override void SetDefaults() - { - item.width = 60; - item.damage = 100; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 12f; - } + public override void SetDefaults() + { + item.width = 60; + item.damage = 100; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 12f; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(2)) - { - case 0: type = mod.ProjectileType("EonBeam"); break; - case 1: type = mod.ProjectileType("EonBeamV2"); break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - int i = Main.myPlayer; - float num72 = Main.rand.Next(18, 27); - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 2; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-160, 161) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage / 3, num74, i, 0f, (float)Main.rand.Next(10)); - Main.projectile[proj].Calamity().forceMelee = true; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBall"), damage / 3, num74, i, 0f, (float)Main.rand.Next(5)); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(2)) + { + case 0: + type = mod.ProjectileType("EonBeam"); + break; + case 1: + type = mod.ProjectileType("EonBeamV2"); + break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + int i = Main.myPlayer; + float num72 = Main.rand.Next(18, 27); + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); + Vector2 vector3 = Main.MouseWorld - vector2; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 2; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-160, 161) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage / 3, num74, i, 0f, (float)Main.rand.Next(10)); + Main.projectile[proj].Calamity().forceMelee = true; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBall"), damage / 3, num74, i, 0f, (float)Main.rand.Next(5)); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ArkoftheAncients"); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(null, "LivingShard", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ArkoftheAncients"); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddIngredient(null, "LivingShard", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num249 = Main.rand.Next(3); - if (num249 == 0) - { - num249 = 15; - } - else if (num249 == 1) - { - num249 = 57; - } - else - { - num249 = 58; - } - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default, 1.3f); - Main.dust[num250].velocity *= 0.2f; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num249 = Main.rand.Next(3); + if (num249 == 0) + { + num249 = 15; + } + else if (num249 == 1) + { + num249 = 57; + } + else + { + num249 = 58; + } + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default, 1.3f); + Main.dust[num250].velocity *= 0.2f; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(2)) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(2)) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } + } } diff --git a/Items/Weapons/TrueBloodyEdge.cs b/Items/Weapons/TrueBloodyEdge.cs index 1d453c2c4d..029a4dabe0 100644 --- a/Items/Weapons/TrueBloodyEdge.cs +++ b/Items/Weapons/TrueBloodyEdge.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("True Bloody Edge"); Tooltip.SetDefault("Chance to heal the player on enemy hits\n" + - "Fires a bloody blade"); + "Fires a bloody blade"); } public override void SetDefaults() diff --git a/Items/Weapons/TrueCausticEdge.cs b/Items/Weapons/TrueCausticEdge.cs index de48045f56..25f43ce7af 100644 --- a/Items/Weapons/TrueCausticEdge.cs +++ b/Items/Weapons/TrueCausticEdge.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("True Caustic Edge"); Tooltip.SetDefault("Fires a bouncing caustic beam\n" + - "Inflicts on fire, poison, and venom"); + "Inflicts on fire, poison, and venom"); } public override void SetDefaults() @@ -63,8 +63,8 @@ namespace CalamityMod.Items.Weapons public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Poisoned, 600); - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.OnFire, 300); target.AddBuff(BuffID.Venom, 300); } } diff --git a/Items/Weapons/TrueExcaliburShortsword.cs b/Items/Weapons/TrueExcaliburShortsword.cs index 4216eb82e1..8c81e136e6 100644 --- a/Items/Weapons/TrueExcaliburShortsword.cs +++ b/Items/Weapons/TrueExcaliburShortsword.cs @@ -33,13 +33,13 @@ namespace CalamityMod.Items.Weapons item.rare = 8; } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "ExcaliburShortsword"); diff --git a/Items/Weapons/TrueForbiddenOathblade.cs b/Items/Weapons/TrueForbiddenOathblade.cs index fe021681b1..2ab79d95b9 100644 --- a/Items/Weapons/TrueForbiddenOathblade.cs +++ b/Items/Weapons/TrueForbiddenOathblade.cs @@ -64,57 +64,57 @@ namespace CalamityMod.Items.Weapons } } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 300); - target.AddBuff(BuffID.OnFire, 300); - if (crit) - { - target.AddBuff(BuffID.ShadowFlame, 900); - target.AddBuff(BuffID.OnFire, 900); - player.ApplyDamageToNPC(target, damage * 3, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 4.5f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 3f; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 300); + target.AddBuff(BuffID.OnFire, 300); + if (crit) + { + target.AddBuff(BuffID.ShadowFlame, 900); + target.AddBuff(BuffID.OnFire, 900); + player.ApplyDamageToNPC(target, damage * 3, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 4.5f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 3f; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 1.5f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } + } } diff --git a/Items/Weapons/TrueNightsStabber.cs b/Items/Weapons/TrueNightsStabber.cs index 12b872a781..40e683e3e3 100644 --- a/Items/Weapons/TrueNightsStabber.cs +++ b/Items/Weapons/TrueNightsStabber.cs @@ -33,13 +33,13 @@ namespace CalamityMod.Items.Weapons item.rare = 8; } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "NightsStabber"); diff --git a/Items/Weapons/TruePaladinsHammerMelee.cs b/Items/Weapons/TruePaladinsHammerMelee.cs index d7e72a323c..4243afe853 100644 --- a/Items/Weapons/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/TruePaladinsHammerMelee.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Fallen Paladin's Hammer"); - Tooltip.SetDefault("Explodes on enemy hits"); - } + Tooltip.SetDefault("Explodes on enemy hits"); + } public override void SetDefaults() { diff --git a/Items/Weapons/TrueTyrantYharimsUltisword.cs b/Items/Weapons/TrueTyrantYharimsUltisword.cs index 40d7822b10..dfc49a07dc 100644 --- a/Items/Weapons/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/TrueTyrantYharimsUltisword.cs @@ -6,75 +6,82 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TrueTyrantYharimsUltisword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Tyrant's Ultisword"); - Tooltip.SetDefault("Fires blazing, hyper, and sunlight blades\n" + - "Gives the player the tyrant's fury buff on enemy hits\n" + - "This buff increases melee damage by 30% and melee crit chance by 10%"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Tyrant's Ultisword"); + Tooltip.SetDefault("Fires blazing, hyper, and sunlight blades\n" + + "Gives the player the tyrant's fury buff on enemy hits\n" + + "This buff increases melee damage by 30% and melee crit chance by 10%"); + } - public override void SetDefaults() - { - item.width = 102; - item.damage = 200; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 102; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("BlazingPhantomBlade"); - item.shootSpeed = 12f; - item.Calamity().postMoonLordRarity = 12; - } + public override void SetDefaults() + { + item.width = 102; + item.damage = 200; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 102; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("BlazingPhantomBlade"); + item.shootSpeed = 12f; + item.Calamity().postMoonLordRarity = 12; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("BlazingPhantomBlade"); break; - case 1: type = mod.ProjectileType("HyperBlade"); break; - case 2: type = mod.ProjectileType("SunlightBlade"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(3)) + { + case 0: + type = mod.ProjectileType("BlazingPhantomBlade"); + break; + case 1: + type = mod.ProjectileType("HyperBlade"); + break; + case 2: + type = mod.ProjectileType("SunlightBlade"); + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TyrantYharimsUltisword"); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "UeliaceBar", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TyrantYharimsUltisword"); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "UeliaceBar", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 106); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 106); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - player.AddBuff(mod.BuffType("TyrantsFury"), 300); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.CursedInferno, 300); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + player.AddBuff(mod.BuffType("TyrantsFury"), 300); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } } diff --git a/Items/Weapons/TyrantYharimsUltisword.cs b/Items/Weapons/TyrantYharimsUltisword.cs index 8bf6b03e28..602b9c6a0f 100644 --- a/Items/Weapons/TyrantYharimsUltisword.cs +++ b/Items/Weapons/TyrantYharimsUltisword.cs @@ -6,70 +6,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class TyrantYharimsUltisword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tyrant Yharim's Ultisword"); - Tooltip.SetDefault("Fires homing blazing blades\n" + - "Gives the player the tyrant's fury buff on enemy hits\n" + - "This buff increases melee damage by 30% and melee crit chance by 10%"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tyrant Yharim's Ultisword"); + Tooltip.SetDefault("Fires homing blazing blades\n" + + "Gives the player the tyrant's fury buff on enemy hits\n" + + "This buff increases melee damage by 30% and melee crit chance by 10%"); + } - public override void SetDefaults() - { - item.width = 88; - item.damage = 64; - item.melee = true; - item.useAnimation = 26; - item.useStyle = 1; - item.useTime = 26; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 88; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("BlazingPhantomBlade"); - item.shootSpeed = 12f; - } + public override void SetDefaults() + { + item.width = 88; + item.damage = 64; + item.melee = true; + item.useAnimation = 26; + item.useStyle = 1; + item.useTime = 26; + item.useTurn = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 88; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("BlazingPhantomBlade"); + item.shootSpeed = 12f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueCausticEdge"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ItemID.FlaskofVenom, 5); - recipe.AddIngredient(ItemID.FlaskofCursedFlames, 5); - recipe.AddIngredient(ItemID.ChlorophyteBar, 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueCausticEdge"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ItemID.FlaskofVenom, 5); - recipe.AddIngredient(ItemID.FlaskofIchor, 5); - recipe.AddIngredient(ItemID.ChlorophyteBar, 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueCausticEdge"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddIngredient(ItemID.FlaskofVenom, 5); + recipe.AddIngredient(ItemID.FlaskofCursedFlames, 5); + recipe.AddIngredient(ItemID.ChlorophyteBar, 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueCausticEdge"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddIngredient(ItemID.FlaskofVenom, 5); + recipe.AddIngredient(ItemID.FlaskofIchor, 5); + recipe.AddIngredient(ItemID.ChlorophyteBar, 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 106); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 106); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - player.AddBuff(mod.BuffType("TyrantsFury"), 180); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.CursedInferno, 300); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + player.AddBuff(mod.BuffType("TyrantsFury"), 180); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.CursedInferno, 300); + } + } } diff --git a/Items/Weapons/UltraLiquidator.cs b/Items/Weapons/UltraLiquidator.cs index 1af4946c8b..ec5648e3c7 100644 --- a/Items/Weapons/UltraLiquidator.cs +++ b/Items/Weapons/UltraLiquidator.cs @@ -6,78 +6,78 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class UltraLiquidator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ultra Liquidator"); - Tooltip.SetDefault("Summons liquidation blades that summon more blades on enemy hits\n" + - "The blades inflict ichor, cursed inferno, on fire, and frostburn"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultra Liquidator"); + Tooltip.SetDefault("Summons liquidation blades that summon more blades on enemy hits\n" + + "The blades inflict ichor, cursed inferno, on fire, and frostburn"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 145; - item.magic = true; - item.mana = 25; - item.width = 16; - item.height = 16; - item.useAnimation = 15; - item.useTime = 3; - item.reuseDelay = item.useAnimation; - item.crit = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; + public override void SetDefaults() + { + item.damage = 145; + item.magic = true; + item.mana = 25; + item.width = 16; + item.height = 16; + item.useAnimation = 15; + item.useTime = 3; + item.reuseDelay = item.useAnimation; + item.crit = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LiquidBlade"); - item.shootSpeed = 16f; - item.Calamity().postMoonLordRarity = 12; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("LiquidBlade"); + item.shootSpeed = 16f; + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "InfernalRift"); - recipe.AddIngredient(ItemID.GoldenShower); - recipe.AddIngredient(ItemID.AquaScepter); - recipe.AddIngredient(ItemID.CursedFlames); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "InfernalRift"); + recipe.AddIngredient(ItemID.GoldenShower); + recipe.AddIngredient(ItemID.AquaScepter); + recipe.AddIngredient(ItemID.CursedFlames); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float f = Main.rand.NextFloat() * 6.28318548f; - float value12 = 20f; - float value13 = 60f; - Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - for (int num202 = 0; num202 < 50; num202++) - { - vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) - { - break; - } - f = Main.rand.NextFloat() * 6.28318548f; - } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 vector14 = mouseWorld - vector13; - Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; - vector14 = vector14.SafeNormalize(vector15) * num72; - vector14 = Vector2.Lerp(vector14, vector15, 0.25f); - Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num72 = item.shootSpeed; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float f = Main.rand.NextFloat() * 6.28318548f; + float value12 = 20f; + float value13 = 60f; + Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + for (int num202 = 0; num202 < 50; num202++) + { + vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) + { + break; + } + f = Main.rand.NextFloat() * 6.28318548f; + } + Vector2 mouseWorld = Main.MouseWorld; + Vector2 vector14 = mouseWorld - vector13; + Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; + vector14 = vector14.SafeNormalize(vector15) * num72; + vector14 = Vector2.Lerp(vector14, vector15, 0.25f); + Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/UrchinSpear.cs b/Items/Weapons/UrchinSpear.cs index 5f61f9a084..f6c269549d 100644 --- a/Items/Weapons/UrchinSpear.cs +++ b/Items/Weapons/UrchinSpear.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin Spear"); - Tooltip.SetDefault("Poisons enemies and fires short-range stingers"); - } + Tooltip.SetDefault("Poisons enemies and fires short-range stingers"); + } public override void SetDefaults() { diff --git a/Items/Weapons/VanquisherArrow.cs b/Items/Weapons/VanquisherArrow.cs index f1a7ab24b1..aa9fd6fd3a 100644 --- a/Items/Weapons/VanquisherArrow.cs +++ b/Items/Weapons/VanquisherArrow.cs @@ -1,56 +1,56 @@ -using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class VanquisherArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vanquisher Arrow"); - Tooltip.SetDefault("Pierces through tiles\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vanquisher Arrow"); + Tooltip.SetDefault("Pierces through tiles\n" + "Spawns extra homing arrows as it travels"); - } + } - public override void SetDefaults() - { - item.damage = 33; - item.ranged = true; - item.width = 22; - item.height = 46; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3.5f; - item.value = 2250; - item.shoot = mod.ProjectileType("VanquisherArrow"); - item.shootSpeed = 10f; - item.ammo = 40; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.damage = 33; + item.ranged = true; + item.width = 22; + item.height = 46; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 3.5f; + item.value = 2250; + item.shoot = mod.ProjectileType("VanquisherArrow"); + item.shootSpeed = 10f; + item.ammo = 40; + item.Calamity().postMoonLordRarity = 14; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(11f, 21f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/VanquisherArrowGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(11f, 21f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/VanquisherArrowGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar"); - recipe.AddIngredient(null, "NightmareFuel"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar"); - recipe.AddIngredient(null, "EndothermicEnergy"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar"); + recipe.AddIngredient(null, "NightmareFuel"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar"); + recipe.AddIngredient(null, "EndothermicEnergy"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/VenusianTrident.cs b/Items/Weapons/VenusianTrident.cs index 753680dffb..7d5cb373f8 100644 --- a/Items/Weapons/VenusianTrident.cs +++ b/Items/Weapons/VenusianTrident.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Items.Weapons { public class VenusianTrident : ModItem { - public static int BaseDamage = 450; + public static int BaseDamage = 450; public override void SetStaticDefaults() { @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("VenusianBolt"); item.shootSpeed = 19f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void AddRecipes() { diff --git a/Items/Weapons/Verdant.cs b/Items/Weapons/Verdant.cs index 0c55ddac21..4ddcb4bc06 100644 --- a/Items/Weapons/Verdant.cs +++ b/Items/Weapons/Verdant.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons item.rare = 10; item.autoReuse = true; item.shoot = mod.ProjectileType("VerdantProjectile"); - item.Calamity().postMoonLordRarity = 12; - } + item.Calamity().postMoonLordRarity = 12; + } public override void AddRecipes() { diff --git a/Items/Weapons/VeriumBullet.cs b/Items/Weapons/VeriumBullet.cs index 1a67ea8994..1792000b89 100644 --- a/Items/Weapons/VeriumBullet.cs +++ b/Items/Weapons/VeriumBullet.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class VeriumBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Verium Bullet"); - Tooltip.SetDefault("There is no escape!"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Verium Bullet"); + Tooltip.SetDefault("There is no escape!"); + } - public override void SetDefaults() - { - item.damage = 8; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 500; - item.rare = 3; - item.shoot = mod.ProjectileType("VeriumBullet"); - item.shootSpeed = 16f; - item.ammo = 97; - } + public override void SetDefaults() + { + item.damage = 8; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 500; + item.rare = 3; + item.shoot = mod.ProjectileType("VeriumBullet"); + item.shootSpeed = 16f; + item.ammo = 97; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 100); - recipe.AddIngredient(null, "VerstaltiteBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 100); + recipe.AddIngredient(null, "VerstaltiteBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Vesuvius.cs b/Items/Weapons/Vesuvius.cs index 95e36b4425..e994faf6b0 100644 --- a/Items/Weapons/Vesuvius.cs +++ b/Items/Weapons/Vesuvius.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,125 +7,125 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class Vesuvius : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vesuvius"); - Tooltip.SetDefault("Legendary drop\n" + - "Asteroids give the Molten buff on enemy hits\n" + - "Calls down a swarm of molten asteroids\n" + - "Right click to fire a spread of molten asteroids from the staff\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vesuvius"); + Tooltip.SetDefault("Legendary drop\n" + + "Asteroids give the Molten buff on enemy hits\n" + + "Calls down a swarm of molten asteroids\n" + + "Right click to fire a spread of molten asteroids from the staff\n" + "Revengeance drop"); - Item.staff[item.type] = true; - } + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.width = 62; - item.damage = 75; - item.mana = 6; - item.magic = true; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.useStyle = 5; - item.knockBack = 3f; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.height = 62; + public override void SetDefaults() + { + item.width = 62; + item.damage = 75; + item.mana = 6; + item.magic = true; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.useStyle = 5; + item.knockBack = 3f; + item.UseSound = SoundID.Item88; + item.autoReuse = true; + item.height = 62; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("AsteroidMolten"); - item.Calamity().postMoonLordRarity = 17; - } + item.shoot = mod.ProjectileType("AsteroidMolten"); + item.Calamity().postMoonLordRarity = 17; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.mana = 9; - item.useTime = 20; - item.useAnimation = 20; - } - else - { - item.mana = 6; - item.useTime = 15; - item.useAnimation = 15; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.mana = 9; + item.useTime = 20; + item.useAnimation = 20; + } + else + { + item.mana = 6; + item.useTime = 15; + item.useAnimation = 15; + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - float ai0 = (float)Main.rand.Next(6); - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, ai0, 0.5f + (float)Main.rand.NextDouble() * 0.9f); - } - return false; - } - else - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - for (int num113 = 0; num113 < 4; num113++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float num114 = num78; - float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - float ai0 = (float)Main.rand.Next(6); - Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, type, damage, knockBack, player.whoAmI, ai0, 0.5f + (float)Main.rand.NextDouble() * 0.9f); //0.3 - } - return false; - } - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + int num6 = Main.rand.Next(4, 6); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + float ai0 = (float)Main.rand.Next(6); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, ai0, 0.5f + (float)Main.rand.NextDouble() * 0.9f); + } + return false; + } + else + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + for (int num113 = 0; num113 < 4; num113++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float num114 = num78; + float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + float ai0 = (float)Main.rand.Next(6); + Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, type, damage, knockBack, player.whoAmI, ai0, 0.5f + (float)Main.rand.NextDouble() * 0.9f); //0.3 + } + return false; + } + } + } } diff --git a/Items/Weapons/Viscera.cs b/Items/Weapons/Viscera.cs index 27b0ba6431..d188f2ba8c 100644 --- a/Items/Weapons/Viscera.cs +++ b/Items/Weapons/Viscera.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Viscera"); Tooltip.SetDefault("Fires a blood beam that heals you on enemy hits\n" + - "The more tiles and enemies the beam bounces off of or travels through the more healing the beam does"); + "The more tiles and enemies the beam bounces off of or travels through the more healing the beam does"); Item.staff[item.type] = true; } @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; item.shoot = mod.ProjectileType("Viscera"); item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 13; - } + item.Calamity().postMoonLordRarity = 13; + } public override void AddRecipes() { diff --git a/Items/Weapons/VividClarity.cs b/Items/Weapons/VividClarity.cs index fdb3084fea..ae7f00f00c 100644 --- a/Items/Weapons/VividClarity.cs +++ b/Items/Weapons/VividClarity.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,109 +7,109 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class VividClarity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vivid Clarity"); - Tooltip.SetDefault("Fires 3 beams of elemental energy near the mouse cursor that bounce\n" + - "The beams split when enemies are near\n" + - "The more enemies and tiles the beams hit the more damage they do\n" + - "High IQ required"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vivid Clarity"); + Tooltip.SetDefault("Fires 3 beams of elemental energy near the mouse cursor that bounce\n" + + "The beams split when enemies are near\n" + + "The more enemies and tiles the beams hit the more damage they do\n" + + "High IQ required"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 500; - item.magic = true; - item.mana = 150; - item.width = 90; - item.height = 112; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; + public override void SetDefaults() + { + item.damage = 500; + item.magic = true; + item.mana = 150; + item.width = 90; + item.height = 112; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("VividClarity"); - item.shootSpeed = 6f; - item.Calamity().postMoonLordRarity = 15; - } + item.autoReuse = true; + item.shoot = mod.ProjectileType("VividClarity"); + item.shootSpeed = 6f; + item.Calamity().postMoonLordRarity = 15; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num130 = 3; - for (int num131 = 0; num131 < num130; num131++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num131); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("VividClarity"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num130 = 3; + for (int num131 = 0; num131 < num130; num131++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num131); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("VividClarity"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ElementalRay"); - recipe.AddIngredient(null, "ArchAmaryllis"); - recipe.AddIngredient(null, "AsteroidStaff"); - recipe.AddIngredient(null, "HellwingStaff"); - recipe.AddIngredient(null, "PhantasmalFury"); - recipe.AddIngredient(null, "ShadowboltStaff"); - recipe.AddIngredient(null, "HeliumFlash"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ElementalRay"); + recipe.AddIngredient(null, "ArchAmaryllis"); + recipe.AddIngredient(null, "AsteroidStaff"); + recipe.AddIngredient(null, "HellwingStaff"); + recipe.AddIngredient(null, "PhantasmalFury"); + recipe.AddIngredient(null, "ShadowboltStaff"); + recipe.AddIngredient(null, "HeliumFlash"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); recipe.AddIngredient(null, "DarksunFragment", 5); recipe.AddIngredient(null, "HellcasterFragment", 3); recipe.AddIngredient(null, "Phantoplasm", 5); recipe.AddIngredient(null, "AuricOre", 25); recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Vortexpopper.cs b/Items/Weapons/Vortexpopper.cs index ac39097562..83ca408d0b 100644 --- a/Items/Weapons/Vortexpopper.cs +++ b/Items/Weapons/Vortexpopper.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Vortexpopper"); - Tooltip.SetDefault("Fires bubbles everywhere that pop into bullets"); - } + Tooltip.SetDefault("Fires bubbles everywhere that pop into bullets"); + } public override void SetDefaults() { diff --git a/Items/Weapons/Waraxe.cs b/Items/Weapons/Waraxe.cs index 46bd9e32d2..367bf89a69 100644 --- a/Items/Weapons/Waraxe.cs +++ b/Items/Weapons/Waraxe.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Waraxe"); - Tooltip.SetDefault("Critical hits cleave enemy armor, reducing their defense by 15 and protection by 25%"); - } + Tooltip.SetDefault("Critical hits cleave enemy armor, reducing their defense by 15 and protection by 25%"); + } public override void SetDefaults() { @@ -29,12 +29,12 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (crit) - { - target.AddBuff(mod.BuffType("WarCleave"), 900); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + target.AddBuff(mod.BuffType("WarCleave"), 900); + } + } + } } diff --git a/Items/Weapons/Warblade.cs b/Items/Weapons/Warblade.cs index 16bc07d632..c30d4e4844 100644 --- a/Items/Weapons/Warblade.cs +++ b/Items/Weapons/Warblade.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Warblade"); - Tooltip.SetDefault("Critical hits cleave enemy armor, reducing their defense by 15 and protection by 25%"); - } + Tooltip.SetDefault("Critical hits cleave enemy armor, reducing their defense by 15 and protection by 25%"); + } public override void SetDefaults() { @@ -29,12 +29,12 @@ namespace CalamityMod.Items.Weapons item.autoReuse = true; } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (crit) - { - target.AddBuff(mod.BuffType("WarCleave"), 450); - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + target.AddBuff(mod.BuffType("WarCleave"), 450); + } + } + } } diff --git a/Items/Weapons/WindBlade.cs b/Items/Weapons/WindBlade.cs index 55138c7bad..f18b433c3b 100644 --- a/Items/Weapons/WindBlade.cs +++ b/Items/Weapons/WindBlade.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Wind Blade"); - Tooltip.SetDefault("Fires cyclones that suck enemies in"); - } + Tooltip.SetDefault("Fires cyclones that suck enemies in"); + } public override void SetDefaults() { @@ -28,17 +28,17 @@ namespace CalamityMod.Items.Weapons item.height = 58; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - item.shoot = mod.ProjectileType("Cyclone"); - item.shootSpeed = 3f; - } + item.shoot = mod.ProjectileType("Cyclone"); + item.shootSpeed = 3f; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "AerialiteBar", 9); diff --git a/Items/Weapons/Wingman.cs b/Items/Weapons/Wingman.cs index 684f4ad58e..0724796687 100644 --- a/Items/Weapons/Wingman.cs +++ b/Items/Weapons/Wingman.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Wingman"); - Tooltip.SetDefault("Fires a concentrated laser beam"); - } + Tooltip.SetDefault("Fires a concentrated laser beam"); + } public override void SetDefaults() { diff --git a/Items/Weapons/WrathoftheAncients.cs b/Items/Weapons/WrathoftheAncients.cs index b5e7c5aceb..b5f64de287 100644 --- a/Items/Weapons/WrathoftheAncients.cs +++ b/Items/Weapons/WrathoftheAncients.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Wrath of the Ancients"); - Tooltip.SetDefault("Casts a granite energy pulse"); - } + Tooltip.SetDefault("Casts a granite energy pulse"); + } public override void SetDefaults() { diff --git a/Items/Weapons/WulfrumStaff.cs b/Items/Weapons/WulfrumStaff.cs index 42c84caaf5..78fd10bcd4 100644 --- a/Items/Weapons/WulfrumStaff.cs +++ b/Items/Weapons/WulfrumStaff.cs @@ -5,41 +5,41 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { public class WulfrumStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Staff"); - Tooltip.SetDefault("Casts a wulfrum bolt"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Staff"); + Tooltip.SetDefault("Casts a wulfrum bolt"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 4; - item.width = 44; - item.height = 46; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3; + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 4; + item.width = 44; + item.height = 46; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WulfrumBolt"); - item.shootSpeed = 9f; - } + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WulfrumBolt"); + item.shootSpeed = 9f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/YharimsCrystal.cs b/Items/Weapons/YharimsCrystal.cs index 7b83cf9cce..84ae65c44d 100644 --- a/Items/Weapons/YharimsCrystal.cs +++ b/Items/Weapons/YharimsCrystal.cs @@ -1,73 +1,73 @@ +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.Weapons { public class YharimsCrystal : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharim's Crystal"); - Tooltip.SetDefault("Fires a beam of complete destruction\n" + - "Only those that are worthy can use this item before Yharon is defeated"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharim's Crystal"); + Tooltip.SetDefault("Fires a beam of complete destruction\n" + + "Only those that are worthy can use this item before Yharon is defeated"); + } - public override void SetDefaults() - { - item.damage = 240; - item.magic = true; - item.mana = 100; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = 5; - item.UseSound = SoundID.Item13; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("YharimsCrystal"); - item.shootSpeed = 30f; - item.Calamity().postMoonLordRarity = 17; - } + public override void SetDefaults() + { + item.damage = 240; + item.magic = true; + item.mana = 100; + item.width = 16; + item.height = 16; + item.useTime = 10; + item.useAnimation = 10; + item.reuseDelay = 5; + item.useStyle = 5; + item.UseSound = SoundID.Item13; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 0f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("YharimsCrystal"); + item.shootSpeed = 30f; + item.Calamity().postMoonLordRarity = 17; + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - bool playerName = - player.name == "Fabsol" || - player.name == "Ziggums" || - player.name == "Poly" || - player.name == "Zach" || - player.name == "Grox the Great" || - player.name == "Jenosis" || - player.name == "DM DOKURO" || - player.name == "Uncle Danny" || - player.name == "Phoenix" || - player.name == "MineCat" || - player.name == "Khaelis" || - player.name == "Purple Necromancer" || - player.name == "gamagamer64" || - player.name == "Svante" || - player.name == "Puff" || - player.name == "Leviathan" || - player.name == "Testdude"; - bool yharon = CalamityWorld.downedYharon; - if (playerName || yharon) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YharimsCrystal"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 29, 0, 0f, player.whoAmI, 0f, 0f); - return false; - } - } - } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + bool playerName = + player.name == "Fabsol" || + player.name == "Ziggums" || + player.name == "Poly" || + player.name == "Zach" || + player.name == "Grox the Great" || + player.name == "Jenosis" || + player.name == "DM DOKURO" || + player.name == "Uncle Danny" || + player.name == "Phoenix" || + player.name == "MineCat" || + player.name == "Khaelis" || + player.name == "Purple Necromancer" || + player.name == "gamagamer64" || + player.name == "Svante" || + player.name == "Puff" || + player.name == "Leviathan" || + player.name == "Testdude"; + bool yharon = CalamityWorld.downedYharon; + if (playerName || yharon) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YharimsCrystal"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 29, 0, 0f, player.whoAmI, 0f, 0f); + return false; + } + } + } } diff --git a/Items/Weapons/Yharon/AngryChickenStaff.cs b/Items/Weapons/Yharon/AngryChickenStaff.cs index a6b8227e17..c1bab577bb 100644 --- a/Items/Weapons/Yharon/AngryChickenStaff.cs +++ b/Items/Weapons/Yharon/AngryChickenStaff.cs @@ -32,33 +32,33 @@ namespace CalamityMod.Items.Weapons.Yharon item.shoot = mod.ProjectileType("AngryChicken"); item.shootSpeed = 10f; item.summon = true; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - player.MinionNPCTargetAim(); - } - return base.UseItem(player); - } - } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } diff --git a/Items/Weapons/Yharon/ChickenCannon.cs b/Items/Weapons/Yharon/ChickenCannon.cs index fb19935351..0324a4f326 100644 --- a/Items/Weapons/Yharon/ChickenCannon.cs +++ b/Items/Weapons/Yharon/ChickenCannon.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Yharon item.shootSpeed = 24f; item.shoot = mod.ProjectileType("Chicken"); item.useAmmo = 771; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Yharon/DragonRage.cs b/Items/Weapons/Yharon/DragonRage.cs index 0e8d0b08e9..4ea130b8db 100644 --- a/Items/Weapons/Yharon/DragonRage.cs +++ b/Items/Weapons/Yharon/DragonRage.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Yharon public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Rage"); - Tooltip.SetDefault("Fires a spread of five fire waves"); - } + Tooltip.SetDefault("Fires a spread of five fire waves"); + } public override void SetDefaults() { @@ -30,20 +30,20 @@ namespace CalamityMod.Items.Weapons.Yharon item.rare = 10; item.shoot = mod.ProjectileType("DragonRage"); item.shootSpeed = 14f; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int index = 0; index < 5; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; + for (int index = 0; index < 5; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Yharon/DragonsBreath.cs b/Items/Weapons/Yharon/DragonsBreath.cs index 6c9857ea8b..becb1fd2fc 100644 --- a/Items/Weapons/Yharon/DragonsBreath.cs +++ b/Items/Weapons/Yharon/DragonsBreath.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Yharon { DisplayName.SetDefault("Dragon's Breath"); Tooltip.SetDefault("80% chance to not consume ammo\n" + - "Shoots a spread of exploding fire bullets"); + "Shoots a spread of exploding fire bullets"); } public override void SetDefaults() @@ -32,15 +32,15 @@ namespace CalamityMod.Items.Weapons.Yharon item.shoot = 10; item.shootSpeed = 12f; item.useAmmo = 97; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 10); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 10); + } - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int i = 0; i < 13; i++) { diff --git a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs index a9de9c9364..29e26ce194 100644 --- a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Yharon { DisplayName.SetDefault("Phoenix Flame Barrage"); Tooltip.SetDefault("Baptism by holy fire\n" + - "Casts a barrage of fire from the sky"); + "Casts a barrage of fire from the sky"); Item.staff[item.type] = true; } @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Yharon item.autoReuse = true; item.shoot = mod.ProjectileType("HolyFlame"); item.shootSpeed = 30f; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Yharon/TheBurningSky.cs b/Items/Weapons/Yharon/TheBurningSky.cs index 8c18cfcef6..7b45d3142e 100644 --- a/Items/Weapons/Yharon/TheBurningSky.cs +++ b/Items/Weapons/Yharon/TheBurningSky.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons.Yharon public override void SetStaticDefaults() { DisplayName.SetDefault("The Burning Sky"); - Tooltip.SetDefault("Summons a massive barrage of burning meteors from the sky"); - } + Tooltip.SetDefault("Summons a massive barrage of burning meteors from the sky"); + } public override void SetDefaults() { @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Yharon item.rare = 10; item.shoot = mod.ProjectileType("BurningMeteor"); item.shootSpeed = 35f; - item.Calamity().postMoonLordRarity = 14; - } + item.Calamity().postMoonLordRarity = 14; + } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/YinYo.cs b/Items/Weapons/YinYo.cs index 0731ae61b5..d449bbd098 100644 --- a/Items/Weapons/YinYo.cs +++ b/Items/Weapons/YinYo.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("YinYo"); Tooltip.SetDefault("Fires light or dark shards when enemies are near\n" + - "Light shards fly up and down while dark shards fly left and right"); + "Light shards fly up and down while dark shards fly left and right"); } public override void SetDefaults() diff --git a/Items/Yharon/ChickenEgg.cs b/Items/Yharon/ChickenEgg.cs index 87603d4a81..329f56a298 100644 --- a/Items/Yharon/ChickenEgg.cs +++ b/Items/Yharon/ChickenEgg.cs @@ -1,51 +1,51 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Items.Yharon { public class ChickenEgg : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon Egg"); - Tooltip.SetDefault("Summons the loyal guardian of the tyrant king\n" + - "It yearns for the jungle\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Egg"); + Tooltip.SetDefault("Summons the loyal guardian of the tyrant king\n" + + "It yearns for the jungle\n" + "Not consumable"); - } + } - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.Calamity().postMoonLordRarity = 14; - } + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.Calamity().postMoonLordRarity = 14; + } - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")) && CalamityWorld.downedBossAny; - } + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")) && CalamityWorld.downedBossAny; + } - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Yharon")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Yharon")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EffulgentFeather", 15); - recipe.AddIngredient(null, "BarofLife", 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EffulgentFeather", 15); + recipe.AddIngredient(null, "BarofLife", 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Yharon/YharimsGift.cs b/Items/Yharon/YharimsGift.cs index e20b7d0c46..c436d8970b 100644 --- a/Items/Yharon/YharimsGift.cs +++ b/Items/Yharon/YharimsGift.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -25,13 +25,13 @@ namespace CalamityMod.Items.Yharon item.value = Item.buyPrice(1, 0, 0, 0); item.accessory = true; item.expert = true; - item.rare = 9; - } + item.rare = 9; + } public override void UpdateAccessory(Player player, bool hideVisual) { - player.allDamage += 0.15f; - player.statDefense += 30; + player.allDamage += 0.15f; + player.statDefense += 30; if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) { dragonTimer--; diff --git a/Items/Yharon/YharonBag.cs b/Items/Yharon/YharonBag.cs index b40e575827..990b01f938 100644 --- a/Items/Yharon/YharonBag.cs +++ b/Items/Yharon/YharonBag.cs @@ -1,57 +1,57 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Items.Yharon { - public class YharonBag : ModItem - { - public override int BossBagNPC => mod.NPCType("Yharon"); + public class YharonBag : ModItem + { + public override int BossBagNPC => mod.NPCType("Yharon"); - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - } + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() + { + return true; + } - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); - // Materials + // Materials - // Weapons - DropHelper.DropItemChance(player, mod.ItemType("DragonRage"), 3); - DropHelper.DropItemChance(player, mod.ItemType("TheBurningSky"), 3); - DropHelper.DropItemChance(player, mod.ItemType("DragonsBreath"), 3); - DropHelper.DropItemChance(player, mod.ItemType("ChickenCannon"), 3); - DropHelper.DropItemChance(player, mod.ItemType("PhoenixFlameBarrage"), 3); - DropHelper.DropItemChance(player, mod.ItemType("AngryChickenStaff"), 3); // Yharon Kindle Staff + // Weapons + DropHelper.DropItemChance(player, mod.ItemType("DragonRage"), 3); + DropHelper.DropItemChance(player, mod.ItemType("TheBurningSky"), 3); + DropHelper.DropItemChance(player, mod.ItemType("DragonsBreath"), 3); + DropHelper.DropItemChance(player, mod.ItemType("ChickenCannon"), 3); + DropHelper.DropItemChance(player, mod.ItemType("PhoenixFlameBarrage"), 3); + DropHelper.DropItemChance(player, mod.ItemType("AngryChickenStaff"), 3); // Yharon Kindle Staff DropHelper.DropItemChance(player, mod.ItemType("ProfanedTrident"), 3); // Infernal Spear - // Equipment - DropHelper.DropItem(player, mod.ItemType("YharimsGift")); + // Equipment + DropHelper.DropItem(player, mod.ItemType("YharimsGift")); - // Vanity - DropHelper.DropItemChance(player, mod.ItemType("YharonMask"), 7); - DropHelper.DropItemChance(player, mod.ItemType("ForgottenDragonEgg"), 10); - DropHelper.DropItemCondition(player, mod.ItemType("FoxDrive"), CalamityWorld.revenge); - } - } + // Vanity + DropHelper.DropItemChance(player, mod.ItemType("YharonMask"), 7); + DropHelper.DropItemChance(player, mod.ItemType("ForgottenDragonEgg"), 10); + DropHelper.DropItemCondition(player, mod.ItemType("FoxDrive"), CalamityWorld.revenge); + } + } } diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 99fde856b3..ec8bac23ca 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -2,46 +2,46 @@ namespace CalamityMod.Localization { - public class CalamityLocalization - { - private static string[][] _localizations; + public class CalamityLocalization + { + private static string[][] _localizations; - public static void Load() - { - _localizations = new[] - { - new [] { "SkyOreText", "The ground is glittering with cyan light." }, - new [] { "IceOreText", "The ice caves are crackling with frigid energy." }, - new [] { "PlantOreText", "Energized plant matter has formed in the underground." }, - new [] { "TreeOreText", "Fossilized tree bark is bursting through the jungle's mud." }, - new [] { "AuricOreText", "A godly aura has blessed the world's caverns." }, - new [] { "FutureOreText", "A cold and dark energy has materialized in space." }, + public static void Load() + { + _localizations = new[] + { + new [] { "SkyOreText", "The ground is glittering with cyan light." }, + new [] { "IceOreText", "The ice caves are crackling with frigid energy." }, + new [] { "PlantOreText", "Energized plant matter has formed in the underground." }, + new [] { "TreeOreText", "Fossilized tree bark is bursting through the jungle's mud." }, + new [] { "AuricOreText", "A godly aura has blessed the world's caverns." }, + new [] { "FutureOreText", "A cold and dark energy has materialized in space." }, - new [] { "UglyBossText", "The Sunken Sea trembles..." }, + new [] { "UglyBossText", "The Sunken Sea trembles..." }, - new [] { "SteelSkullBossText", "A blood red inferno lingers in the night..." }, + new [] { "SteelSkullBossText", "A blood red inferno lingers in the night..." }, - new [] { "PlantBossText", "The ocean depths are trembling." }, + new [] { "PlantBossText", "The ocean depths are trembling." }, - new [] { "BabyBossText", "A plague has befallen the Jungle." }, - new [] { "BabyBossText2", "An ancient automaton roams the land." }, + new [] { "BabyBossText", "A plague has befallen the Jungle." }, + new [] { "BabyBossText2", "An ancient automaton roams the land." }, - new [] { "MoonBossText", "The profaned flame blazes fiercely!" }, - new [] { "MoonBossText2", "Cosmic terrors are watching..." }, - new [] { "MoonBossText3", "The bloody moon beckons..." }, + new [] { "MoonBossText", "The profaned flame blazes fiercely!" }, + new [] { "MoonBossText2", "Cosmic terrors are watching..." }, + new [] { "MoonBossText3", "The bloody moon beckons..." }, - new [] { "PlagueBossText", "PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!!" }, - new [] { "PlagueBossText2", "MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!!" }, + new [] { "PlagueBossText", "PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!!" }, + new [] { "PlagueBossText2", "MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!!" }, - new [] { "ProfanedBossText", "The air is burning..." }, - new [] { "ProfanedBossText2", "Shrieks are echoing from the dungeon." }, - new [] { "ProfanedBossText3", "The calamitous beings have been inundated with bloodstone." }, + new [] { "ProfanedBossText", "The air is burning..." }, + new [] { "ProfanedBossText2", "Shrieks are echoing from the dungeon." }, + new [] { "ProfanedBossText3", "The calamitous beings have been inundated with bloodstone." }, - new [] { "GhostBossText", "The abyssal spirits have been disturbed." }, - new [] { "GhostBossText2", "Wails echo through the dilapidated dungeon halls..." }, - new [] { "GhostBossText3", "Long-dead prisoners seek their zealous revenge..." }, + new [] { "GhostBossText", "The abyssal spirits have been disturbed." }, + new [] { "GhostBossText2", "Wails echo through the dilapidated dungeon halls..." }, + new [] { "GhostBossText3", "Long-dead prisoners seek their zealous revenge..." }, - new [] { "SupremeBossText3", "Alright, let's get started. Not sure why you're bothering." }, // start + new [] { "SupremeBossText3", "Alright, let's get started. Not sure why you're bothering." }, // start new [] { "SupremeBossText4", "You seem so confident, even though you are painfully ignorant of what has yet to transpire." }, //75% new [] { "SupremeBossText5", "Everything was going well until you came along." }, //75% new [] { "SupremeBossText6", "Brothers, could you assist me for a moment? This ordeal is growing tiresome." }, //45% @@ -71,103 +71,103 @@ namespace CalamityMod.Localization new [] { "SupremeBossText19", "Third time's the charm. Here's a special reward." }, //die 3 times and win new [] { "EdgyBossText", "Don't get cocky, kid!" }, - new [] { "EdgyBossText2", "You think...you can butcher...ME!?" }, - new [] { "EdgyBossText3", "A fatal mistake!" }, - new [] { "EdgyBossText4", "Good luck recovering from that!" }, - new [] { "EdgyBossText5", "Delicious..." }, - new [] { "EdgyBossText6", "Did that hurt?" }, - new [] { "EdgyBossText7", "Nothing personal, kid." }, - new [] { "EdgyBossText8", "Are you honestly that bad at dodging?" }, - new [] { "EdgyBossText9", "Of all my segments to get hit by..." }, - new [] { "EdgyBossText10", "It's not over yet, kid!" }, - new [] { "EdgyBossText11", "A GOD DOES NOT FEAR DEATH!" }, - new [] { "EdgyBossText12", "You are no god...but I shall feast upon your essence regardless!" }, - new [] { "DoGBossText", "The frigid moon shimmers brightly." }, - new [] { "DoGBossText2", "The harvest moon glows eerily." }, + new [] { "EdgyBossText2", "You think...you can butcher...ME!?" }, + new [] { "EdgyBossText3", "A fatal mistake!" }, + new [] { "EdgyBossText4", "Good luck recovering from that!" }, + new [] { "EdgyBossText5", "Delicious..." }, + new [] { "EdgyBossText6", "Did that hurt?" }, + new [] { "EdgyBossText7", "Nothing personal, kid." }, + new [] { "EdgyBossText8", "Are you honestly that bad at dodging?" }, + new [] { "EdgyBossText9", "Of all my segments to get hit by..." }, + new [] { "EdgyBossText10", "It's not over yet, kid!" }, + new [] { "EdgyBossText11", "A GOD DOES NOT FEAR DEATH!" }, + new [] { "EdgyBossText12", "You are no god...but I shall feast upon your essence regardless!" }, + new [] { "DoGBossText", "The frigid moon shimmers brightly." }, + new [] { "DoGBossText2", "The harvest moon glows eerily." }, - new [] { "AstralText", "A star has fallen from the heavens!" }, - new [] { "AureusBossText", "The astral enemies have been empowered!" }, - new [] { "AureusBossText2", "A faint ethereal click can be heard from the dungeon." }, - new [] { "AstralBossText", "The seal of the stars has been broken! You can now mine Astral Ore." }, - new [] { "DeusText", "A star-spawned horror tunnels through the astral infection." }, - new [] { "DeusText2", "The astral infection trembles..." }, - new [] { "DeusText3", "The god of the stars draws near..." }, + new [] { "AstralText", "A star has fallen from the heavens!" }, + new [] { "AureusBossText", "The astral enemies have been empowered!" }, + new [] { "AureusBossText2", "A faint ethereal click can be heard from the dungeon." }, + new [] { "AstralBossText", "The seal of the stars has been broken! You can now mine Astral Ore." }, + new [] { "DeusText", "A star-spawned horror tunnels through the astral infection." }, + new [] { "DeusText2", "The astral infection trembles..." }, + new [] { "DeusText3", "The god of the stars draws near..." }, - new [] { "CalamitasBossText", "You underestimate my power..." }, - new [] { "CalamitasBossText2", "The brothers have been reborn!" }, - new [] { "CalamitasBossText3", "Impressive child, most impressive..." }, + new [] { "CalamitasBossText", "You underestimate my power..." }, + new [] { "CalamitasBossText2", "The brothers have been reborn!" }, + new [] { "CalamitasBossText3", "Impressive child, most impressive..." }, - new [] { "SandSharkText", "Something stirs in the warm desert sands..." }, - new [] { "SandSharkText2", "An enormous apex predator approaches..." }, + new [] { "SandSharkText", "Something stirs in the warm desert sands..." }, + new [] { "SandSharkText2", "An enormous apex predator approaches..." }, - new [] { "CryogenBossText", "Cryogen is derping out!" }, + new [] { "CryogenBossText", "Cryogen is derping out!" }, - new [] { "BloodMoonText", "The Blood Moon is rising..." }, + new [] { "BloodMoonText", "The Blood Moon is rising..." }, - new [] { "DargonBossText", "The dark sun awaits." }, - new [] { "DargonBossText2", "My dragon deems you an unworthy opponent. You must acquire the power of the dark sun to witness his true power." }, + new [] { "DargonBossText", "The dark sun awaits." }, + new [] { "DargonBossText2", "My dragon deems you an unworthy opponent. You must acquire the power of the dark sun to witness his true power." }, - new [] { "RevengeText", "Revengeance is active." }, - new [] { "RevengeText2", "Revengeance is not active." }, + new [] { "RevengeText", "Revengeance is active." }, + new [] { "RevengeText2", "Revengeance is not active." }, - new [] { "DeathText", "Death is active, enjoy the fun." }, - new [] { "DeathText2", "Death is not active, not fun enough for you?" }, + new [] { "DeathText", "Death is active, enjoy the fun." }, + new [] { "DeathText2", "Death is not active, not fun enough for you?" }, - new [] { "ArmageddonText", "Bosses will now kill you instantly." }, - new [] { "ArmageddonText2", "Bosses will no longer kill you instantly." }, + new [] { "ArmageddonText", "Bosses will now kill you instantly." }, + new [] { "ArmageddonText2", "Bosses will no longer kill you instantly." }, - new [] { "DefiledText", "Your soul is mine..." }, - new [] { "DefiledText2", "Your soul is yours once more..." }, + new [] { "DefiledText", "Your soul is mine..." }, + new [] { "DefiledText2", "Your soul is yours once more..." }, - new [] { "IronHeartText", "Iron Heart is active, don't die." }, - new [] { "IronHeartText2", "Iron Heart is not active, you can die again." }, + new [] { "IronHeartText", "Iron Heart is active, don't die." }, + new [] { "IronHeartText2", "Iron Heart is not active, you can die again." }, - new [] { "FlameText", "The air is getting warmer around you." }, + new [] { "FlameText", "The air is getting warmer around you." }, - new [] { "BossRushStartText", "Hmm? Ah, another contender. Very well, may the ritual commence!" }, - new [] { "BossRushTierOneEndText", "Hmm? Oh, you're still alive. Unexpected, but don't get complacent just yet." }, - new [] { "BossRushTierTwoEndText", "Hmm? Persistent aren't you? Perhaps you have some hope of prosperity, unlike past challengers." }, - new [] { "BossRushTierThreeEndText", "Hmm? Your perseverance is truly a trait to behold. You've come further than even the demigods in such a short time." }, - new [] { "BossRushTierThreeEndText2", "May your skills remain sharp for the last challenges." }, - new [] { "BossRushTierFourEndText", "Hmm? So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods." }, - new [] { "BossRushTierFourEndText2", "Go forth and conquer 'til the ritual's end!" }, - new [] { "BossRushTierFiveEndText", "Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will become apparent in time..." }, + new [] { "BossRushStartText", "Hmm? Ah, another contender. Very well, may the ritual commence!" }, + new [] { "BossRushTierOneEndText", "Hmm? Oh, you're still alive. Unexpected, but don't get complacent just yet." }, + new [] { "BossRushTierTwoEndText", "Hmm? Persistent aren't you? Perhaps you have some hope of prosperity, unlike past challengers." }, + new [] { "BossRushTierThreeEndText", "Hmm? Your perseverance is truly a trait to behold. You've come further than even the demigods in such a short time." }, + new [] { "BossRushTierThreeEndText2", "May your skills remain sharp for the last challenges." }, + new [] { "BossRushTierFourEndText", "Hmm? So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods." }, + new [] { "BossRushTierFourEndText2", "Go forth and conquer 'til the ritual's end!" }, + new [] { "BossRushTierFiveEndText", "Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will become apparent in time..." }, - new [] { "BossSpawnText", "Something is approaching..." }, + new [] { "BossSpawnText", "Something is approaching..." }, - new [] { "MeleeLevelUp", "Melee weapon proficiency level up!" }, - new [] { "MeleeLevelUpFinal", "Melee weapon proficiency maxed out!" }, - new [] { "RangedLevelUp", "Ranged weapon proficiency level up!" }, - new [] { "RangedLevelUpFinal", "Ranged weapon proficiency maxed out!" }, - new [] { "MagicLevelUp", "Magic weapon proficiency level up!" }, - new [] { "MagicLevelUpFinal", "Magic weapon proficiency maxed out!" }, - new [] { "SummonLevelUp", "Summoner weapon proficiency level up!" }, - new [] { "SummonLevelUpFinal", "Summoner weapon proficiency maxed out!" }, - new [] { "RogueLevelUp", "Rogue weapon proficiency level up!" }, - new [] { "RogueLevelUpFinal", "Rogue weapon proficiency maxed out!" }, + new [] { "MeleeLevelUp", "Melee weapon proficiency level up!" }, + new [] { "MeleeLevelUpFinal", "Melee weapon proficiency maxed out!" }, + new [] { "RangedLevelUp", "Ranged weapon proficiency level up!" }, + new [] { "RangedLevelUpFinal", "Ranged weapon proficiency maxed out!" }, + new [] { "MagicLevelUp", "Magic weapon proficiency level up!" }, + new [] { "MagicLevelUpFinal", "Magic weapon proficiency maxed out!" }, + new [] { "SummonLevelUp", "Summoner weapon proficiency level up!" }, + new [] { "SummonLevelUpFinal", "Summoner weapon proficiency maxed out!" }, + new [] { "RogueLevelUp", "Rogue weapon proficiency level up!" }, + new [] { "RogueLevelUpFinal", "Rogue weapon proficiency maxed out!" }, - new [] { "OpenSunkenSea", "The depths of the underground desert are rumbling..." }, - new [] { "SandstormTrigger", "The desert wind is blowing furiously!" }, + new [] { "OpenSunkenSea", "The depths of the underground desert are rumbling..." }, + new [] { "SandstormTrigger", "The desert wind is blowing furiously!" }, - new [] { "AprilFools", "The LORDE is approaching..." } - }; - } + new [] { "AprilFools", "The LORDE is approaching..." } + }; + } - public static void Unload() - { - _localizations = null; - } + public static void Unload() + { + _localizations = null; + } - public static void AddLocalizations() - { - Load(); - foreach (string[] localization in _localizations) - { - ModTranslation text = ModContent.GetInstance().CreateTranslation(localization[0]); - text.SetDefault(localization[1]); - ModContent.GetInstance().AddTranslation(text); - } - Unload(); - } - } + public static void AddLocalizations() + { + Load(); + foreach (string[] localization in _localizations) + { + ModTranslation text = ModContent.GetInstance().CreateTranslation(localization[0]); + text.SetDefault(localization[1]); + ModContent.GetInstance().AddTranslation(text); + } + Unload(); + } + } } diff --git a/MiscImplementation/BezierCurve.cs b/MiscImplementation/BezierCurve.cs index 41655245b4..f37bf51a8f 100644 --- a/MiscImplementation/BezierCurve.cs +++ b/MiscImplementation/BezierCurve.cs @@ -1,6 +1,5 @@ -using System.Collections.Generic; - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System.Collections.Generic; namespace CalamityMod.MiscImplementation { @@ -15,8 +14,10 @@ namespace CalamityMod.MiscImplementation public Vector2 Evaluate(float T) { - if (T < 0f) T = 0f; - if (T > 1f) T = 1f; + if (T < 0f) + T = 0f; + if (T > 1f) + T = 1f; return PrivateEvaluate(ControlPoints, T); } diff --git a/MiscImplementation/Circle.cs b/MiscImplementation/Circle.cs index 64ed69edeb..266a6f3f63 100644 --- a/MiscImplementation/Circle.cs +++ b/MiscImplementation/Circle.cs @@ -1,7 +1,6 @@ -using System; - +using Microsoft.Xna.Framework; +using System; using Terraria; -using Microsoft.Xna.Framework; namespace CalamityMod.MiscImplementation { diff --git a/MiscModSupport/ModCalls.cs b/MiscModSupport/ModCalls.cs index d96501e34d..c310f1658b 100644 --- a/MiscModSupport/ModCalls.cs +++ b/MiscModSupport/ModCalls.cs @@ -1,480 +1,569 @@ +using CalamityMod.CalPlayer; +using CalamityMod.World; using System; - using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.MiscModSupport { - public class ModCalls - { - #region Boss / Event Downed - /// - /// Returns whether the Calamity boss or event corresponding to the given string has been defeated. - /// - /// The boss or event name to check. Many aliases are accepted. - /// Whether the boss or event has been defeated. - public static bool GetBossDowned(string boss) - { - switch (boss.ToLower()) - { - default: return false; + public class ModCalls + { + #region Boss / Event Downed + /// + /// Returns whether the Calamity boss or event corresponding to the given string has been defeated. + /// + /// The boss or event name to check. Many aliases are accepted. + /// Whether the boss or event has been defeated. + public static bool GetBossDowned(string boss) + { + switch (boss.ToLower()) + { + default: + return false; - case "desertscourge": - case "desert scourge": return CalamityWorld.downedDesertScourge; + case "desertscourge": + case "desert scourge": + return CalamityWorld.downedDesertScourge; - case "crabulon": return CalamityWorld.downedCrabulon; + case "crabulon": + return CalamityWorld.downedCrabulon; - case "hivemind": - case "hive mind": - case "thehivemind": - case "the hive mind": return CalamityWorld.downedHiveMind; + case "hivemind": + case "hive mind": + case "thehivemind": + case "the hive mind": + return CalamityWorld.downedHiveMind; - case "perforator": - case "perforators": - case "theperforators": - case "the perforators": - case "perforatorhive": - case "perforator hive": - case "theperforatorhive": - case "the perforator hive": return CalamityWorld.downedPerforator; + case "perforator": + case "perforators": + case "theperforators": + case "the perforators": + case "perforatorhive": + case "perforator hive": + case "theperforatorhive": + case "the perforator hive": + return CalamityWorld.downedPerforator; - case "slimegod": - case "slime god": - case "theslimegod": - case "the slime god": return CalamityWorld.downedSlimeGod; + case "slimegod": + case "slime god": + case "theslimegod": + case "the slime god": + return CalamityWorld.downedSlimeGod; - case "cryogen": return CalamityWorld.downedCryogen; + case "cryogen": + return CalamityWorld.downedCryogen; - case "brimstoneelemental": - case "brimstone elemental": return CalamityWorld.downedBrimstoneElemental; + case "brimstoneelemental": + case "brimstone elemental": + return CalamityWorld.downedBrimstoneElemental; - case "calamitas": - case "clone": - case "calamitasclone": - case "calamitas clone": - case "clonelamitas": - case "calamitasdoppelganger": - case "calamitas doppelganger": return CalamityWorld.downedCalamitas; + case "calamitas": + case "clone": + case "calamitasclone": + case "calamitas clone": + case "clonelamitas": + case "calamitasdoppelganger": + case "calamitas doppelganger": + return CalamityWorld.downedCalamitas; - case "siren": - case "thesiren": - case "the siren": - case "leviathan": - case "theleviathan": - case "the leviathan": - case "sirenleviathan": - case "siren leviathan": - case "sirenandleviathan": - case "siren and leviathan": - case "the siren and the leviathan": return CalamityWorld.downedLeviathan; + case "siren": + case "thesiren": + case "the siren": + case "leviathan": + case "theleviathan": + case "the leviathan": + case "sirenleviathan": + case "siren leviathan": + case "sirenandleviathan": + case "siren and leviathan": + case "the siren and the leviathan": + return CalamityWorld.downedLeviathan; - case "aureus": - case "astrumaureus": - case "astrum aureus": return CalamityWorld.downedAstrageldon; + case "aureus": + case "astrumaureus": + case "astrum aureus": + return CalamityWorld.downedAstrageldon; - case "pbg": - case "plaguebringer": - case "plaguebringergoliath": - case "plaguebringer goliath": - case "theplaguebringergoliath": - case "the plaguebringer goliath": return CalamityWorld.downedPlaguebringer; + case "pbg": + case "plaguebringer": + case "plaguebringergoliath": + case "plaguebringer goliath": + case "theplaguebringergoliath": + case "the plaguebringer goliath": + return CalamityWorld.downedPlaguebringer; - case "ravager": return CalamityWorld.downedScavenger; + case "ravager": + return CalamityWorld.downedScavenger; - case "astrumdeus": - case "astrum deus": return CalamityWorld.downedStarGod; + case "astrumdeus": + case "astrum deus": + return CalamityWorld.downedStarGod; - case "guardians": - case "donuts": - case "profanedguardians": - case "profaned guardians": - case "theprofanedguardians": - case "the profaned guardians": return CalamityWorld.downedGuardians; + case "guardians": + case "donuts": + case "profanedguardians": + case "profaned guardians": + case "theprofanedguardians": + case "the profaned guardians": + return CalamityWorld.downedGuardians; - case "bumblebirb": - case "bumblefuck": return CalamityWorld.downedBumble; + case "bumblebirb": + case "bumblefuck": + return CalamityWorld.downedBumble; - case "providence": - case "providencetheprofanedgoddess": - case "providence the profaned goddess": - case "providence, the profaned goddess": return CalamityWorld.downedProvidence; + case "providence": + case "providencetheprofanedgoddess": + case "providence the profaned goddess": + case "providence, the profaned goddess": + return CalamityWorld.downedProvidence; - case "polterghast": - case "necroghast": - case "necroplasm": return CalamityWorld.downedPolterghast; + case "polterghast": + case "necroghast": + case "necroplasm": + return CalamityWorld.downedPolterghast; - case "sentinel1": // backwards compatibility - case "void": - case "ceaselessvoid": - case "ceaseless void": return CalamityWorld.downedSentinel1; + case "sentinel1": // backwards compatibility + case "void": + case "ceaselessvoid": + case "ceaseless void": + return CalamityWorld.downedSentinel1; - case "sentinel2": // backwards compatibility - case "stormweaver": - case "storm weaver": return CalamityWorld.downedSentinel2; + case "sentinel2": // backwards compatibility + case "stormweaver": + case "storm weaver": + return CalamityWorld.downedSentinel2; - case "sentinel3": // backwards compatibility - case "cosmicwraith": - case "cosmic wraith": - case "signus": - case "signusenvoyofthedevourer": - case "signus envoy of the devourer": - case "signus, envoy of the devourer": return CalamityWorld.downedSentinel3; + case "sentinel3": // backwards compatibility + case "cosmicwraith": + case "cosmic wraith": + case "signus": + case "signusenvoyofthedevourer": + case "signus envoy of the devourer": + case "signus, envoy of the devourer": + return CalamityWorld.downedSentinel3; - case "sentinelany": // backwards compatibility - case "anysentinel": - case "any sentinel": - case "onesentinel": - case "one sentinel": - case "sentinel": return (CalamityWorld.downedSentinel1 || CalamityWorld.downedSentinel2 || CalamityWorld.downedSentinel3); + case "sentinelany": // backwards compatibility + case "anysentinel": + case "any sentinel": + case "onesentinel": + case "one sentinel": + case "sentinel": + return (CalamityWorld.downedSentinel1 || CalamityWorld.downedSentinel2 || CalamityWorld.downedSentinel3); - case "sentinelall": // backwards compatibility - case "sentinels": - case "allsentinel": - case "allsentinels": - case "all sentinels": return (CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3); + case "sentinelall": // backwards compatibility + case "sentinels": + case "allsentinel": + case "allsentinels": + case "all sentinels": + return (CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3); - case "dog": - case "devourerofgods": - case "devourer of gods": - case "thedevourerofgods": - case "the devourer of gods": return CalamityWorld.downedDoG; + case "dog": + case "devourerofgods": + case "devourer of gods": + case "thedevourerofgods": + case "the devourer of gods": + return CalamityWorld.downedDoG; - case "yharon": - case "jungledragonyharon": - case "jungle dragon yharon": - case "jungle dragon, yharon": return CalamityWorld.downedYharon; + case "yharon": + case "jungledragonyharon": + case "jungle dragon yharon": + case "jungle dragon, yharon": + return CalamityWorld.downedYharon; - case "scal": - case "supremecalamitas": - case "supreme calamitas": return CalamityWorld.downedSCal; - } - } - #endregion + case "scal": + case "supremecalamitas": + case "supreme calamitas": + return CalamityWorld.downedSCal; + } + } + #endregion - #region Player in Zone / Area - /// - /// Returns whether the specified player is in the Calamity biome or area corresponding to the given string. - /// - /// The player whose locale is being questioned. - /// The zone or area name to check. Many aliases are accepted. - /// Whether the player is currently in the zone. - public static bool GetInZone(Player p, string zone) - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - CalamityPlayer mp = p.Calamity(); - switch (zone.ToLower()) - { - default: return false; + #region Player in Zone / Area + /// + /// Returns whether the specified player is in the Calamity biome or area corresponding to the given string. + /// + /// The player whose locale is being questioned. + /// The zone or area name to check. Many aliases are accepted. + /// Whether the player is currently in the zone. + public static bool GetInZone(Player p, string zone) + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + CalamityPlayer mp = p.Calamity(); + switch (zone.ToLower()) + { + default: + return false; - case "calamity": // backwards compatibility - case "calamitybiome": - case "calamity biome": - case "crag": - case "crags": + case "calamity": // backwards compatibility + case "calamitybiome": + case "calamity biome": + case "crag": + case "crags": - case "profanedcrag": // remove these four when the actual profaned biome is added - case "profaned crag": - case "profanedcrags": - case "profaned crags": + case "profanedcrag": // remove these four when the actual profaned biome is added + case "profaned crag": + case "profanedcrags": + case "profaned crags": - case "brimstone": - case "brimstonecrag": - case "brimstone crag": - case "brimstonecrags": - case "brimstone crags": return mp.ZoneCalamity; + case "brimstone": + case "brimstonecrag": + case "brimstone crag": + case "brimstonecrags": + case "brimstone crags": + return mp.ZoneCalamity; - case "astral": - case "astralbiome": - case "astral biome": - case "astralinfection": - case "astral infection": return mp.ZoneAstral; + case "astral": + case "astralbiome": + case "astral biome": + case "astralinfection": + case "astral infection": + return mp.ZoneAstral; - case "sunkensea": - case "sunken sea": - case "thesunkensea": - case "the sunken sea": return mp.ZoneSunkenSea; + case "sunkensea": + case "sunken sea": + case "thesunkensea": + case "the sunken sea": + return mp.ZoneSunkenSea; - case "sulfur": - case "sulphur": - case "sulfursea": - case "sulfur sea": - case "sulphursea": - case "sulphur sea": - case "sulfuroussea": - case "sulfurous sea": - case "sulphuroussea": - case "sulphurous sea": return mp.ZoneSulphur; + case "sulfur": + case "sulphur": + case "sulfursea": + case "sulfur sea": + case "sulphursea": + case "sulphur sea": + case "sulfuroussea": + case "sulfurous sea": + case "sulphuroussea": + case "sulphurous sea": + return mp.ZoneSulphur; - case "abyss": - case "theabyss": - case "the abyss": - case "anyabyss": - case "any abyss": - case "abyssany": - case "any abyss layer": return mp.ZoneAbyss; + case "abyss": + case "theabyss": + case "the abyss": + case "anyabyss": + case "any abyss": + case "abyssany": + case "any abyss layer": + return mp.ZoneAbyss; - case "abyss1": - case "abyss 1": - case "abyss_1": - case "layer1": - case "layer 1": - case "layer_1": - case "abysslayer1": - case "abyss layer 1": return mp.ZoneAbyssLayer1; + case "abyss1": + case "abyss 1": + case "abyss_1": + case "layer1": + case "layer 1": + case "layer_1": + case "abysslayer1": + case "abyss layer 1": + return mp.ZoneAbyssLayer1; - case "abyss2": - case "abyss 2": - case "abyss_2": - case "layer2": - case "layer 2": - case "layer_2": - case "abysslayer2": - case "abyss layer 2": return mp.ZoneAbyssLayer2; + case "abyss2": + case "abyss 2": + case "abyss_2": + case "layer2": + case "layer 2": + case "layer_2": + case "abysslayer2": + case "abyss layer 2": + return mp.ZoneAbyssLayer2; - case "abyss3": - case "abyss 3": - case "abyss_3": - case "layer3": - case "layer 3": - case "layer_3": - case "abysslayer3": - case "abyss layer 3": return mp.ZoneAbyssLayer3; + case "abyss3": + case "abyss 3": + case "abyss_3": + case "layer3": + case "layer 3": + case "layer_3": + case "abysslayer3": + case "abyss layer 3": + return mp.ZoneAbyssLayer3; - case "abyss4": - case "abyss 4": - case "abyss_4": - case "layer4": - case "layer 4": - case "layer_4": - case "abysslayer4": - case "abyss layer 4": return mp.ZoneAbyssLayer4; - } - } - #endregion + case "abyss4": + case "abyss 4": + case "abyss_4": + case "layer4": + case "layer 4": + case "layer_4": + case "abysslayer4": + case "abyss layer 4": + return mp.ZoneAbyssLayer4; + } + } + #endregion - #region Difficulty Modes - /// - /// Returns whether the Calamity difficulty modifier corresponding to the given string is currently active. - /// - /// The difficulty modifier to check for. - /// Whether the difficulty is currently active. - public static bool GetDifficultyActive(string difficulty) - { - switch (difficulty.ToLower()) - { - default: return false; + #region Difficulty Modes + /// + /// Returns whether the Calamity difficulty modifier corresponding to the given string is currently active. + /// + /// The difficulty modifier to check for. + /// Whether the difficulty is currently active. + public static bool GetDifficultyActive(string difficulty) + { + switch (difficulty.ToLower()) + { + default: + return false; - case "revengeance": - case "rev": - case "revengeancemode": - case "revengeance mode": return CalamityWorld.revenge; + case "revengeance": + case "rev": + case "revengeancemode": + case "revengeance mode": + return CalamityWorld.revenge; - case "death": - case "deathmode": - case "death mode": return CalamityWorld.death; + case "death": + case "deathmode": + case "death mode": + return CalamityWorld.death; - case "defiled": - case "defiledrune": - case "defiled rune": - case "defiledmode": - case "defiled mode": return CalamityWorld.defiled; + case "defiled": + case "defiledrune": + case "defiled rune": + case "defiledmode": + case "defiled mode": + return CalamityWorld.defiled; - case "armageddon": - case "arma": - case "instakill": - case "instagib": - case "armageddonmode": - case "armageddon mode": return CalamityWorld.armageddon; + case "armageddon": + case "arma": + case "instakill": + case "instagib": + case "armageddonmode": + case "armageddon mode": + return CalamityWorld.armageddon; - case "ironheart": - case "iron heart": - case "steelsoul": - case "steel soul": - case "permadeath": return CalamityWorld.ironHeart; - } - } - #endregion + case "ironheart": + case "iron heart": + case "steelsoul": + case "steel soul": + case "permadeath": + return CalamityWorld.ironHeart; + } + } + #endregion - #region Player Armor Set Bonuses - /// - /// Returns whether the specified player has the set bonus corresponding to the given string. - /// - /// The player whose set bonuses are being questioned. - /// The set bonus to check for. - /// Whether the player currently has the set bonus. - public static bool GetSetBonus(Player p, string setBonus) - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - CalamityPlayer mp = p.Calamity(); + #region Player Armor Set Bonuses + /// + /// Returns whether the specified player has the set bonus corresponding to the given string. + /// + /// The player whose set bonuses are being questioned. + /// The set bonus to check for. + /// Whether the player currently has the set bonus. + public static bool GetSetBonus(Player p, string setBonus) + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + CalamityPlayer mp = p.Calamity(); - setBonus = setBonus.ToLower(); + setBonus = setBonus.ToLower(); - // Victide - if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) - return mp.victideSet; + // Victide + if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) + return mp.victideSet; - // Aerospec - if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) - return mp.aeroSet; + // Aerospec + if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) + return mp.aeroSet; - // Statigel - if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) - return mp.statigelSet; + // Statigel + if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) + return mp.statigelSet; - // Mollusk - if (setBonus == "mollusk") - return mp.molluskSet; + // Mollusk + if (setBonus == "mollusk") + return mp.molluskSet; - // Daedalus - switch (setBonus) - { - default: break; - case "daedalus": return mp.daedalusReflect || mp.daedalusShard || mp.daedalusAbsorb || mp.daedalusCrystal || mp.daedalusSplit; - case "daedalus_melee": - case "daedalus melee": return mp.daedalusReflect; - case "daedalus_ranged": - case "daedalus ranged": return mp.daedalusShard; - case "daedalus_magic": - case "daedalus magic": return mp.daedalusAbsorb; - case "daedalus_summon": - case "daedalus summon": return mp.daedalusCrystal; - case "daedalus_rogue": - case "daedalus rogue": return mp.daedalusSplit; - } + // Daedalus + switch (setBonus) + { + default: + break; + case "daedalus": + return mp.daedalusReflect || mp.daedalusShard || mp.daedalusAbsorb || mp.daedalusCrystal || mp.daedalusSplit; + case "daedalus_melee": + case "daedalus melee": + return mp.daedalusReflect; + case "daedalus_ranged": + case "daedalus ranged": + return mp.daedalusShard; + case "daedalus_magic": + case "daedalus magic": + return mp.daedalusAbsorb; + case "daedalus_summon": + case "daedalus summon": + return mp.daedalusCrystal; + case "daedalus_rogue": + case "daedalus rogue": + return mp.daedalusSplit; + } - // Reaver - switch (setBonus) - { - default: break; - case "reaver": return mp.reaverBlast || mp.reaverDoubleTap || mp.reaverBurst || mp.reaverOrb || mp.reaverSpore; - case "reaver_melee": - case "reaver melee": return mp.reaverBlast; - case "reaver_ranged": - case "reaver ranged": return mp.reaverDoubleTap; - case "reaver_magic": - case "reaver magic": return mp.reaverBurst; - case "reaver_summon": - case "reaver summon": return mp.reaverOrb; - case "reaver_rogue": - case "reaver rogue": return mp.reaverSpore; - } + // Reaver + switch (setBonus) + { + default: + break; + case "reaver": + return mp.reaverBlast || mp.reaverDoubleTap || mp.reaverBurst || mp.reaverOrb || mp.reaverSpore; + case "reaver_melee": + case "reaver melee": + return mp.reaverBlast; + case "reaver_ranged": + case "reaver ranged": + return mp.reaverDoubleTap; + case "reaver_magic": + case "reaver magic": + return mp.reaverBurst; + case "reaver_summon": + case "reaver summon": + return mp.reaverOrb; + case "reaver_rogue": + case "reaver rogue": + return mp.reaverSpore; + } - // Ataxia - switch (setBonus) - { - default: break; - case "ataxia": return mp.ataxiaBlaze; - case "ataxia_melee": - case "ataxia melee": return mp.ataxiaGeyser; - case "ataxia_ranged": - case "ataxia ranged": return mp.ataxiaBolt; - case "ataxia_magic": - case "ataxia magic": return mp.ataxiaMage; - case "ataxia_summon": - case "ataxia summon": return mp.chaosSpirit; - case "ataxia_rogue": - case "ataxia rogue": return mp.ataxiaVolley; - } + // Ataxia + switch (setBonus) + { + default: + break; + case "ataxia": + return mp.ataxiaBlaze; + case "ataxia_melee": + case "ataxia melee": + return mp.ataxiaGeyser; + case "ataxia_ranged": + case "ataxia ranged": + return mp.ataxiaBolt; + case "ataxia_magic": + case "ataxia magic": + return mp.ataxiaMage; + case "ataxia_summon": + case "ataxia summon": + return mp.chaosSpirit; + case "ataxia_rogue": + case "ataxia rogue": + return mp.ataxiaVolley; + } - // Astral - if (setBonus == "astral") - return mp.astralStarRain; + // Astral + if (setBonus == "astral") + return mp.astralStarRain; - // Xeroc - if (setBonus == "xeroc") - return mp.xerocSet; + // Xeroc + if (setBonus == "xeroc") + return mp.xerocSet; - // Tarragon - switch (setBonus) - { - default: break; - case "tarragon": return mp.tarraSet; - case "tarragon_melee": - case "tarragon melee": return mp.tarraMelee; - case "tarragon_ranged": - case "tarragon ranged": return mp.tarraRanged; - case "tarragon_magic": - case "tarragon magic": return mp.tarraMage; - case "tarragon_summon": - case "tarragon summon": return mp.tarraSummon; - case "tarragon_rogue": - case "tarragon rogue": return mp.tarraThrowing; - } + // Tarragon + switch (setBonus) + { + default: + break; + case "tarragon": + return mp.tarraSet; + case "tarragon_melee": + case "tarragon melee": + return mp.tarraMelee; + case "tarragon_ranged": + case "tarragon ranged": + return mp.tarraRanged; + case "tarragon_magic": + case "tarragon magic": + return mp.tarraMage; + case "tarragon_summon": + case "tarragon summon": + return mp.tarraSummon; + case "tarragon_rogue": + case "tarragon rogue": + return mp.tarraThrowing; + } - // Bloodflare - switch (setBonus) - { - default: break; - case "bloodflare": return mp.bloodflareSet; - case "bloodflare_melee": - case "bloodflare melee": return mp.bloodflareMelee; - case "bloodflare_ranged": - case "bloodflare ranged": return mp.bloodflareRanged; - case "bloodflare_magic": - case "bloodflare magic": return mp.bloodflareMage; - case "bloodflare_summon": - case "bloodflare summon": return mp.bloodflareSummon; - case "bloodflare_rogue": - case "bloodflare rogue": return mp.bloodflareThrowing; - } + // Bloodflare + switch (setBonus) + { + default: + break; + case "bloodflare": + return mp.bloodflareSet; + case "bloodflare_melee": + case "bloodflare melee": + return mp.bloodflareMelee; + case "bloodflare_ranged": + case "bloodflare ranged": + return mp.bloodflareRanged; + case "bloodflare_magic": + case "bloodflare magic": + return mp.bloodflareMage; + case "bloodflare_summon": + case "bloodflare summon": + return mp.bloodflareSummon; + case "bloodflare_rogue": + case "bloodflare rogue": + return mp.bloodflareThrowing; + } - // Omega Blue - if (setBonus == "omegablue" || setBonus == "omega blue") - return mp.omegaBlueSet; + // Omega Blue + if (setBonus == "omegablue" || setBonus == "omega blue") + return mp.omegaBlueSet; - // God Slayer - switch (setBonus) - { - default: break; - case "godslayer": - case "god slayer": return mp.godSlayer; - case "godslayer_melee": - case "godslayer melee": - case "god slayer melee": return mp.godSlayerDamage; // melee helm's unique damage reducing property - case "godslayer_ranged": - case "godslayer ranged": - case "god slayer ranged": return mp.godSlayerRanged; - case "godslayer_magic": - case "godslayer magic": - case "god slayer magic": return mp.godSlayerMage; - case "godslayer_summon": - case "godslayer summon": - case "god slayer summon": return mp.godSlayerSummon; - case "godslayer_rogue": - case "godslayer rogue": - case "god slayer rogue": return mp.godSlayerThrowing; - } + // God Slayer + switch (setBonus) + { + default: + break; + case "godslayer": + case "god slayer": + return mp.godSlayer; + case "godslayer_melee": + case "godslayer melee": + case "god slayer melee": + return mp.godSlayerDamage; // melee helm's unique damage reducing property + case "godslayer_ranged": + case "godslayer ranged": + case "god slayer ranged": + return mp.godSlayerRanged; + case "godslayer_magic": + case "godslayer magic": + case "god slayer magic": + return mp.godSlayerMage; + case "godslayer_summon": + case "godslayer summon": + case "god slayer summon": + return mp.godSlayerSummon; + case "godslayer_rogue": + case "godslayer rogue": + case "god slayer rogue": + return mp.godSlayerThrowing; + } - // Silva - switch (setBonus) - { - default: break; - case "silva": return mp.silvaSet; - case "silva_melee": - case "silva melee": return mp.silvaMelee; - case "silva_ranged": - case "silva ranged": return mp.silvaRanged; - case "silva_magic": - case "silva magic": return mp.silvaMage; - case "silva_summon": - case "silva summon": return mp.silvaSummon; - case "silva_rogue": - case "silva rogue": return mp.silvaThrowing; - } + // Silva + switch (setBonus) + { + default: + break; + case "silva": + return mp.silvaSet; + case "silva_melee": + case "silva melee": + return mp.silvaMelee; + case "silva_ranged": + case "silva ranged": + return mp.silvaRanged; + case "silva_magic": + case "silva magic": + return mp.silvaMage; + case "silva_summon": + case "silva summon": + return mp.silvaSummon; + case "silva_rogue": + case "silva rogue": + return mp.silvaThrowing; + } - // Auric Tesla - if (setBonus == "auric" || setBonus == "aurictesla" || setBonus == "auric tesla") - return mp.auricSet; + // Auric Tesla + if (setBonus == "auric" || setBonus == "aurictesla" || setBonus == "auric tesla") + return mp.auricSet; - // Demonshade - if (setBonus == "demonshade") - return mp.dsSetBonus; + // Demonshade + if (setBonus == "demonshade") + return mp.dsSetBonus; - return false; - } + return false; + } #endregion #region Set Damage Reduction @@ -490,80 +579,98 @@ namespace CalamityMod.MiscModSupport #region Call public static object Call(params object[] args) - { - if (args is null || args.Length <= 0) return new ArgumentNullException("ERROR: No function name specified. First argument must be a function name."); - if (!(args[0] is string)) return new ArgumentException("ERROR: First argument must be a string function name."); + { + if (args is null || args.Length <= 0) + return new ArgumentNullException("ERROR: No function name specified. First argument must be a function name."); + if (!(args[0] is string)) + return new ArgumentException("ERROR: First argument must be a string function name."); - string methodName = args[0].ToString(); - Player p = null; - switch (methodName) - { - case "Downed": - case "GetDowned": - case "BossDowned": - case "GetBossDowned": - if (args.Length < 2) return new ArgumentNullException("ERROR: Must specify a boss or event name as a string."); - if (!(args[1] is string)) return new ArgumentException("ERROR: The argument to \"Downed\" must be a string."); - return GetBossDowned(args[1].ToString()); + string methodName = args[0].ToString(); + Player p = null; + switch (methodName) + { + case "Downed": + case "GetDowned": + case "BossDowned": + case "GetBossDowned": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a boss or event name as a string."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The argument to \"Downed\" must be a string."); + return GetBossDowned(args[1].ToString()); - case "Zone": - case "GetZone": - case "InZone": - case "GetInZone": - if (args.Length < 2) return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a zone name as a string."); - if (args.Length < 3) return new ArgumentNullException("ERROR: Must specify a zone name as a string."); - if (!(args[2] is string)) return new ArgumentException("ERROR: The second argument to \"InZone\" must be a string."); - if (!(args[1] is int) || !(args[1] is Player)) return new ArgumentException("ERROR: The first argument to \"InZone\" must be a Player or an int."); + case "Zone": + case "GetZone": + case "InZone": + case "GetInZone": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a zone name as a string."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify a zone name as a string."); + if (!(args[2] is string)) + return new ArgumentException("ERROR: The second argument to \"InZone\" must be a string."); + if (!(args[1] is int) || !(args[1] is Player)) + return new ArgumentException("ERROR: The first argument to \"InZone\" must be a Player or an int."); - // If the argument is an int, get the corresponding player - if (args[1] is int) - p = Main.player[(int)args[1]]; - else if (args[1] is Player) - p = (Player)args[1]; - return GetInZone(p, args[2].ToString()); + // If the argument is an int, get the corresponding player + if (args[1] is int) + p = Main.player[(int)args[1]]; + else if (args[1] is Player) + p = (Player)args[1]; + return GetInZone(p, args[2].ToString()); - case "Difficulty": - case "GetDifficulty": - case "DifficultyActive": - case "GetDifficultyActive": - if (args.Length < 2) return new ArgumentNullException("ERROR: Must specify a difficulty modifier name as a string."); - if (!(args[1] is string)) return new ArgumentException("ERROR: The argument to \"Difficulty\" must be a string."); - return GetDifficultyActive(args[1].ToString()); + case "Difficulty": + case "GetDifficulty": + case "DifficultyActive": + case "GetDifficultyActive": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a difficulty modifier name as a string."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The argument to \"Difficulty\" must be a string."); + return GetDifficultyActive(args[1].ToString()); - case "SetBonus": - case "SetBonusActive": - case "HasSetBonus": - case "GetSetBonus": - case "GetSetBonusActive": - if (args.Length < 2) return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a set bonus name as a string."); - if (args.Length < 3) return new ArgumentNullException("ERROR: Must specify a set bonus name as a string."); - if (!(args[2] is string)) return new ArgumentException("ERROR: The second argument to \"SetBonus\" must be a string."); - if (!(args[1] is int) || !(args[1] is Player)) return new ArgumentException("ERROR: The first argument to \"SetBonus\" must be a Player or an int."); + case "SetBonus": + case "SetBonusActive": + case "HasSetBonus": + case "GetSetBonus": + case "GetSetBonusActive": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a set bonus name as a string."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify a set bonus name as a string."); + if (!(args[2] is string)) + return new ArgumentException("ERROR: The second argument to \"SetBonus\" must be a string."); + if (!(args[1] is int) || !(args[1] is Player)) + return new ArgumentException("ERROR: The first argument to \"SetBonus\" must be a Player or an int."); - // If the argument is an int, get the corresponding player - if (args[1] is int) - p = Main.player[(int)args[1]]; - else if (args[1] is Player) - p = (Player)args[1]; - return GetSetBonus(p, args[2].ToString()); + // If the argument is an int, get the corresponding player + if (args[1] is int) + p = Main.player[(int)args[1]]; + else if (args[1] is Player) + p = (Player)args[1]; + return GetSetBonus(p, args[2].ToString()); case "DR": case "DamageReduction": case "SetDR": case "SetDamageReduction": - if (args.Length < 2) return new ArgumentNullException("ERROR: Must specify both NPC ID as an int and damage reduction as a float or double."); - if (args.Length < 3) return new ArgumentNullException("ERROR: Must specify damage reduction as a float or double."); - if (!(args[2] is float) && !(args[2] is double)) return new ArgumentException("ERROR: The second argument to \"SetDamageReduction\" must be a float or a double."); - if (!(args[1] is string)) return new ArgumentException("ERROR: The first argument to \"SetDamageReduction\" must be an int."); + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both NPC ID as an int and damage reduction as a float or double."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify damage reduction as a float or double."); + if (!(args[2] is float) && !(args[2] is double)) + return new ArgumentException("ERROR: The second argument to \"SetDamageReduction\" must be a float or a double."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The first argument to \"SetDamageReduction\" must be an int."); int npcID = (int)args[1]; float DR = (float)args[2]; return SetDamageReduction(npcID, DR); default: - return new ArgumentException("ERROR: Invalid method name."); - } - } - #endregion - } + return new ArgumentException("ERROR: Invalid method name."); + } + } + #endregion + } } diff --git a/MiscModSupport/WeakReferenceSupport.cs b/MiscModSupport/WeakReferenceSupport.cs index a74b980e18..425ff830de 100644 --- a/MiscModSupport/WeakReferenceSupport.cs +++ b/MiscModSupport/WeakReferenceSupport.cs @@ -1,65 +1,64 @@ -using System; -using Terraria.ModLoader; +using CalamityMod.World; +using System; using Terraria.ID; - -using CalamityMod.World; +using Terraria.ModLoader; namespace CalamityMod.MiscModSupport { internal class WeakReferenceSupport - { - public static void Setup() - { - BossChecklistSupport(); - CensusSupport(); - } + { + public static void Setup() + { + BossChecklistSupport(); + CensusSupport(); + } - private static void BossChecklistSupport() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Mod bossChecklist = ModLoader.GetMod("BossChecklist"); + private static void BossChecklistSupport() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Mod bossChecklist = ModLoader.GetMod("BossChecklist"); - if (bossChecklist != null) - { - // 14 is moonlord, 12 is duke fishron - bossChecklist.Call("AddBossWithInfo", "Desert Scourge", 1.5f, (Func)(() => CalamityWorld.downedDesertScourge), "Use a [i:" + mod.ItemType("DriedSeafood") + "] in the Desert Biome"); //1 - bossChecklist.Call("AddBossWithInfo", "Crabulon", 2.5f, (Func)(() => CalamityWorld.downedCrabulon), "Use a [i:" + mod.ItemType("DecapoditaSprout") + "] in the Mushroom Biome"); //1.5 - bossChecklist.Call("AddBossWithInfo", "Hive Mind / Perforator", 3.5f, (Func)(() => (CalamityWorld.downedPerforator || CalamityWorld.downedHiveMind)), "By killing a Cyst in the World's Evil Biome"); //2 - bossChecklist.Call("AddBossWithInfo", "Slime God", 5.5f, (Func)(() => CalamityWorld.downedSlimeGod), "Use an [i:" + mod.ItemType("OverloadedSludge") + "]"); //4 - bossChecklist.Call("AddBossWithInfo", "Cryogen", 6.5f, (Func)(() => CalamityWorld.downedCryogen), "Use a [i:" + mod.ItemType("CryoKey") + "] in the Snow Biome"); //5 - bossChecklist.Call("AddBossWithInfo", "Brimstone Elemental", 7.5f, (Func)(() => CalamityWorld.downedBrimstoneElemental), "Use a [i:" + mod.ItemType("CharredIdol") + "] in the Hell Crag"); //6 - bossChecklist.Call("AddBossWithInfo", "Aquatic Scourge", 8.5f, (Func)(() => CalamityWorld.downedAquaticScourge), "Use a [i:" + mod.ItemType("Seafood") + "] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"); //6 - bossChecklist.Call("AddBossWithInfo", "Calamitas", 9.7f, (Func)(() => CalamityWorld.downedCalamitas), "Use an [i:" + mod.ItemType("BlightedEyeball") + "] at Night"); //7 - bossChecklist.Call("AddBossWithInfo", "Leviathan", 10.5f, (Func)(() => CalamityWorld.downedLeviathan), "By killing an unknown entity in the Ocean Biome"); //8 - bossChecklist.Call("AddBossWithInfo", "Astrum Aureus", 10.6f, (Func)(() => CalamityWorld.downedAstrageldon), "Use an [i:" + mod.ItemType("AstralChunk") + "] at Night"); //8.5 - bossChecklist.Call("AddBossWithInfo", "Plaguebringer Goliath", 11.5f, (Func)(() => CalamityWorld.downedPlaguebringer), "Use an [i:" + mod.ItemType("Abomination") + "] in the Jungle Biome"); //9 - bossChecklist.Call("AddBossWithInfo", "Ravager", 12.5f, (Func)(() => CalamityWorld.downedScavenger), "Use an [i:" + mod.ItemType("AncientMedallion") + "]"); //9.5 - bossChecklist.Call("AddBossWithInfo", "Astrum Deus", 13.5f, (Func)(() => CalamityWorld.downedStarGod), "Use a [i:" + mod.ItemType("Starcore") + "] at Night or defeat 3 empowered astral titans"); //9.6 - //bossChecklist.Call("AddBossWithInfo", "The Old Duke", 13.6f, (Func)(() => CalamityWorld.downedOldDuke), "Fishing with some type of bait in the Sulphuric Sea"); //9.7 - bossChecklist.Call("AddBossWithInfo", "Profaned Guardians", 14.5f, (Func)(() => CalamityWorld.downedGuardians), "Use a [i:" + mod.ItemType("ProfanedShard") + "] in the Hallow or Underworld Biomes"); //10 - bossChecklist.Call("AddBossWithInfo", "Bumblebirb", 14.6f, (Func)(() => CalamityWorld.downedBumble), "Use [i:" + mod.ItemType("BirbPheromones") + "] in the Jungle Biome"); //16 - bossChecklist.Call("AddBossWithInfo", "Providence", 15f, (Func)(() => CalamityWorld.downedProvidence), "Use a [i:" + mod.ItemType("ProfanedCore") + "] in the Hallow or Underworld Biomes"); //11 - bossChecklist.Call("AddBossWithInfo", "Ceaseless Void", 15.1f, (Func)(() => CalamityWorld.downedSentinel1), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Dungeon"); //12 - bossChecklist.Call("AddBossWithInfo", "Storm Weaver", 15.2f, (Func)(() => CalamityWorld.downedSentinel2), "Use a [i:" + mod.ItemType("RuneofCos") + "] in Space"); //13 - bossChecklist.Call("AddBossWithInfo", "Signus", 15.3f, (Func)(() => CalamityWorld.downedSentinel3), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Underworld"); //14 - bossChecklist.Call("AddBossWithInfo", "Polterghast", 15.5f, (Func)(() => CalamityWorld.downedPolterghast), "Use a [i:" + mod.ItemType("NecroplasmicBeacon") + "] in the Dungeon or kill 30 phantom spirits"); //11 - bossChecklist.Call("AddBossWithInfo", "Devourer of Gods", 16f, (Func)(() => CalamityWorld.downedDoG), "Use a [i:" + mod.ItemType("CosmicWorm") + "]"); //15 - bossChecklist.Call("AddBossWithInfo", "Yharon", 17f, (Func)(() => CalamityWorld.downedYharon), "Use a [i:" + mod.ItemType("ChickenEgg") + "] in the Jungle Biome"); //17 - bossChecklist.Call("AddBossWithInfo", "Supreme Calamitas", 18f, (Func)(() => CalamityWorld.downedSCal), "Use an [i:" + mod.ItemType("EyeofExtinction") + "]"); //18 - } - } + if (bossChecklist != null) + { + // 14 is moonlord, 12 is duke fishron + bossChecklist.Call("AddBossWithInfo", "Desert Scourge", 1.5f, (Func)(() => CalamityWorld.downedDesertScourge), "Use a [i:" + mod.ItemType("DriedSeafood") + "] in the Desert Biome"); //1 + bossChecklist.Call("AddBossWithInfo", "Crabulon", 2.5f, (Func)(() => CalamityWorld.downedCrabulon), "Use a [i:" + mod.ItemType("DecapoditaSprout") + "] in the Mushroom Biome"); //1.5 + bossChecklist.Call("AddBossWithInfo", "Hive Mind / Perforator", 3.5f, (Func)(() => (CalamityWorld.downedPerforator || CalamityWorld.downedHiveMind)), "By killing a Cyst in the World's Evil Biome"); //2 + bossChecklist.Call("AddBossWithInfo", "Slime God", 5.5f, (Func)(() => CalamityWorld.downedSlimeGod), "Use an [i:" + mod.ItemType("OverloadedSludge") + "]"); //4 + bossChecklist.Call("AddBossWithInfo", "Cryogen", 6.5f, (Func)(() => CalamityWorld.downedCryogen), "Use a [i:" + mod.ItemType("CryoKey") + "] in the Snow Biome"); //5 + bossChecklist.Call("AddBossWithInfo", "Brimstone Elemental", 7.5f, (Func)(() => CalamityWorld.downedBrimstoneElemental), "Use a [i:" + mod.ItemType("CharredIdol") + "] in the Hell Crag"); //6 + bossChecklist.Call("AddBossWithInfo", "Aquatic Scourge", 8.5f, (Func)(() => CalamityWorld.downedAquaticScourge), "Use a [i:" + mod.ItemType("Seafood") + "] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"); //6 + bossChecklist.Call("AddBossWithInfo", "Calamitas", 9.7f, (Func)(() => CalamityWorld.downedCalamitas), "Use an [i:" + mod.ItemType("BlightedEyeball") + "] at Night"); //7 + bossChecklist.Call("AddBossWithInfo", "Leviathan", 10.5f, (Func)(() => CalamityWorld.downedLeviathan), "By killing an unknown entity in the Ocean Biome"); //8 + bossChecklist.Call("AddBossWithInfo", "Astrum Aureus", 10.6f, (Func)(() => CalamityWorld.downedAstrageldon), "Use an [i:" + mod.ItemType("AstralChunk") + "] at Night"); //8.5 + bossChecklist.Call("AddBossWithInfo", "Plaguebringer Goliath", 11.5f, (Func)(() => CalamityWorld.downedPlaguebringer), "Use an [i:" + mod.ItemType("Abomination") + "] in the Jungle Biome"); //9 + bossChecklist.Call("AddBossWithInfo", "Ravager", 12.5f, (Func)(() => CalamityWorld.downedScavenger), "Use an [i:" + mod.ItemType("AncientMedallion") + "]"); //9.5 + bossChecklist.Call("AddBossWithInfo", "Astrum Deus", 13.5f, (Func)(() => CalamityWorld.downedStarGod), "Use a [i:" + mod.ItemType("Starcore") + "] at Night or defeat 3 empowered astral titans"); //9.6 + //bossChecklist.Call("AddBossWithInfo", "The Old Duke", 13.6f, (Func)(() => CalamityWorld.downedOldDuke), "Fishing with some type of bait in the Sulphuric Sea"); //9.7 + bossChecklist.Call("AddBossWithInfo", "Profaned Guardians", 14.5f, (Func)(() => CalamityWorld.downedGuardians), "Use a [i:" + mod.ItemType("ProfanedShard") + "] in the Hallow or Underworld Biomes"); //10 + bossChecklist.Call("AddBossWithInfo", "Bumblebirb", 14.6f, (Func)(() => CalamityWorld.downedBumble), "Use [i:" + mod.ItemType("BirbPheromones") + "] in the Jungle Biome"); //16 + bossChecklist.Call("AddBossWithInfo", "Providence", 15f, (Func)(() => CalamityWorld.downedProvidence), "Use a [i:" + mod.ItemType("ProfanedCore") + "] in the Hallow or Underworld Biomes"); //11 + bossChecklist.Call("AddBossWithInfo", "Ceaseless Void", 15.1f, (Func)(() => CalamityWorld.downedSentinel1), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Dungeon"); //12 + bossChecklist.Call("AddBossWithInfo", "Storm Weaver", 15.2f, (Func)(() => CalamityWorld.downedSentinel2), "Use a [i:" + mod.ItemType("RuneofCos") + "] in Space"); //13 + bossChecklist.Call("AddBossWithInfo", "Signus", 15.3f, (Func)(() => CalamityWorld.downedSentinel3), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Underworld"); //14 + bossChecklist.Call("AddBossWithInfo", "Polterghast", 15.5f, (Func)(() => CalamityWorld.downedPolterghast), "Use a [i:" + mod.ItemType("NecroplasmicBeacon") + "] in the Dungeon or kill 30 phantom spirits"); //11 + bossChecklist.Call("AddBossWithInfo", "Devourer of Gods", 16f, (Func)(() => CalamityWorld.downedDoG), "Use a [i:" + mod.ItemType("CosmicWorm") + "]"); //15 + bossChecklist.Call("AddBossWithInfo", "Yharon", 17f, (Func)(() => CalamityWorld.downedYharon), "Use a [i:" + mod.ItemType("ChickenEgg") + "] in the Jungle Biome"); //17 + bossChecklist.Call("AddBossWithInfo", "Supreme Calamitas", 18f, (Func)(() => CalamityWorld.downedSCal), "Use an [i:" + mod.ItemType("EyeofExtinction") + "]"); //18 + } + } - private static void CensusSupport() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Mod censusMod = ModLoader.GetMod("Census"); - if (censusMod != null) - { - censusMod.Call("TownNPCCondition", mod.NPCType("SEAHOE"), "Defeat a Giant Clam"); - censusMod.Call("TownNPCCondition", mod.NPCType("Bandit"), "Have a [i:" + ItemID.PlatinumCoin + "] in your inventory after defeating Skeletron"); - censusMod.Call("TownNPCCondition", mod.NPCType("FAP"), "Have [i:" + mod.ItemType("FabsolsVodka") + "] in your inventory in Hardmode"); - censusMod.Call("TownNPCCondition", mod.NPCType("DILF"), "Defeat Cryogen"); - } - } - } + private static void CensusSupport() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Mod censusMod = ModLoader.GetMod("Census"); + if (censusMod != null) + { + censusMod.Call("TownNPCCondition", mod.NPCType("SEAHOE"), "Defeat a Giant Clam"); + censusMod.Call("TownNPCCondition", mod.NPCType("Bandit"), "Have a [i:" + ItemID.PlatinumCoin + "] in your inventory after defeating Skeletron"); + censusMod.Call("TownNPCCondition", mod.NPCType("FAP"), "Have [i:" + mod.ItemType("FabsolsVodka") + "] in your inventory in Hardmode"); + censusMod.Call("TownNPCCondition", mod.NPCType("DILF"), "Defeat Cryogen"); + } + } + } } diff --git a/NPCs/AbyssNPCs/AquaticParasite.cs b/NPCs/AbyssNPCs/AquaticParasite.cs index 5e7b507c5b..4bcbf22d21 100644 --- a/NPCs/AbyssNPCs/AquaticParasite.cs +++ b/NPCs/AbyssNPCs/AquaticParasite.cs @@ -7,213 +7,213 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticParasite : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Parasite"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Parasite"); + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 15; - npc.width = 28; - npc.height = 28; - npc.defense = 5; + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 15; + npc.width = 28; + npc.height = 28; + npc.defense = 5; npc.LifeMaxNERD(30, bossRush: 30000); - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 60); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("AquaticParasiteBanner"); - } + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 60); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("AquaticParasiteBanner"); + } - public override void AI() - { - bool flag15 = false; - if (npc.wet && npc.ai[1] == 1f) - { - flag15 = true; - } - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (flag15) - { - return; - } - if (!npc.wet) - { - npc.rotation += npc.velocity.X * 0.1f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - return; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - bool flag16 = false; - if (!Main.player[npc.target].dead) - { - flag16 = true; - } - if (flag16) - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - npc.velocity *= 0.975f; - float num263 = 2f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 12f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - } - } - } + public override void AI() + { + bool flag15 = false; + if (npc.wet && npc.ai[1] == 1f) + { + flag15 = true; + } + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (flag15) + { + return; + } + if (!npc.wet) + { + npc.rotation += npc.velocity.X * 0.1f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + return; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + bool flag16 = false; + if (!Main.player[npc.target].dead) + { + flag16 = true; + } + if (flag16) + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.velocity *= 0.975f; + float num263 = 2f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 12f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.4f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + } + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.InSulphur() && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.InSulphur() && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite2"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite2"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.cs b/NPCs/AbyssNPCs/AquaticScourgeBody.cs index 7b5bfca24f..b19308a3ec 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBody.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBody.cs @@ -1,211 +1,210 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticScourgeBody : ModNPC - { + { private bool detectsPlayer = false; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } + { + DisplayName.SetDefault("Aquatic Scourge"); + } - public override void SetDefaults() - { - npc.damage = 65; - npc.width = 32; - npc.height = 32; - npc.defense = 20; + public override void SetDefaults() + { + npc.damage = 65; + npc.width = 32; + npc.height = 32; + npc.defense = 20; npc.Calamity().RevPlusDR(0.05f); npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; npc.LifeMaxNERD(73000, 85000, 100000, 4000000, 4300000); - double HPBoost = Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) + double HPBoost = Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; + npc.noGravity = true; + npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; - npc.dontCountMe = true; + npc.dontCountMe = true; npc.chaseable = false; - npc.canGhostHeal = false; - if (Main.expertMode) + npc.canGhostHeal = false; + if (Main.expertMode) { npc.scale = 1.15f; } } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if ((double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99) - { - detectsPlayer = true; - npc.damage = npc.defDamage; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - else - music = MusicID.Boss2; - } - else - { - npc.damage = 0; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) - { - npc.active = false; - } - if (Main.netMode != NetmodeID.MultiplayerClient && detectsPlayer) - { - int num = (Main.expertMode || CalamityWorld.bossRushActive) ? 4 : 3; - npc.localAI[0] += (float)Main.rand.Next(num); - if (npc.localAI[0] >= (float)Main.rand.Next(700, 10000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 17); - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - int projectileType = mod.ProjectileType("SandTooth"); - int damage = Main.expertMode ? 25 : 30; - float num941 = CalamityWorld.bossRushActive ? 7.5f : 5f; - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + if ((double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99) + { + detectsPlayer = true; + npc.damage = npc.defDamage; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + else + music = MusicID.Boss2; + } + else + { + npc.damage = 0; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) + { + npc.active = false; + } + if (Main.netMode != NetmodeID.MultiplayerClient && detectsPlayer) + { + int num = (Main.expertMode || CalamityWorld.bossRushActive) ? 4 : 3; + npc.localAI[0] += (float)Main.rand.Next(num); + if (npc.localAI[0] >= (float)Main.rand.Next(700, 10000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 17); + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + int projectileType = mod.ProjectileType("SandTooth"); + int damage = Main.expertMode ? 25 : 30; + float num941 = CalamityWorld.bossRushActive ? 7.5f : 5f; + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + damage = (int)((double)damage * 0.5); + } - public override bool? CanBeHitByProjectile(Projectile projectile) + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) { @@ -220,9 +219,9 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { @@ -231,7 +230,7 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void HitEffect(int hitDirection, double damage) - { + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -242,11 +241,11 @@ namespace CalamityMod.NPCs.AbyssNPCs { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody4"), 1f); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody4"), 1f); + } } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs index 9aea741fad..092eb07ba7 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs @@ -9,74 +9,74 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticScourgeBodyAlt : ModNPC - { + { private bool detectsPlayer = false; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } + { + DisplayName.SetDefault("Aquatic Scourge"); + } - public override void SetDefaults() - { - npc.damage = 55; - npc.width = 32; - npc.height = 32; - npc.defense = 15; + public override void SetDefaults() + { + npc.damage = 55; + npc.width = 32; + npc.height = 32; + npc.defense = 15; npc.Calamity().RevPlusDR(0.05f); npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; if (CalamityWorld.death) { npc.lifeMax = 100000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; + npc.noGravity = true; + npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; - npc.dontCountMe = true; + npc.dontCountMe = true; npc.chaseable = false; - npc.canGhostHeal = false; - if (Main.expertMode) + npc.canGhostHeal = false; + if (Main.expertMode) { npc.scale = 1.15f; } } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if ((double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99) - { + public override void AI() + { + if ((double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99) + { detectsPlayer = true; npc.damage = npc.defDamage; npc.boss = true; @@ -181,8 +181,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -205,13 +204,13 @@ namespace CalamityMod.NPCs.AbyssNPCs } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + damage = (int)((double)damage * 0.5); + } - public override bool? CanBeHitByProjectile(Projectile projectile) + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) { @@ -226,9 +225,9 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { @@ -237,7 +236,7 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void HitEffect(int hitDirection, double damage) - { + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -248,10 +247,10 @@ namespace CalamityMod.NPCs.AbyssNPCs { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt3"), 1f); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt3"), 1f); + } } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs index 10d6c9c9e3..679748e38f 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeHead.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -1,568 +1,570 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.AbyssNPCs { [AutoloadBossHead] - public class AquaticScourgeHead : ModNPC - { - private bool detectsPlayer = false; - private const int minLength = 30; - private const int maxLength = 31; - private float speed = 5f; //10 - private float turnSpeed = 0.08f; //0.15 - private bool TailSpawned = false; - private bool despawning = false; - private bool charging = false; + public class AquaticScourgeHead : ModNPC + { + private bool detectsPlayer = false; + private const int minLength = 30; + private const int maxLength = 31; + private float speed = 5f; //10 + private float turnSpeed = 0.08f; //0.15 + private bool TailSpawned = false; + private bool despawning = false; + private bool charging = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + } - public override void SetDefaults() - { - npc.npcSlots = 16f; - npc.damage = 80; - npc.width = 100; - npc.height = 90; - npc.defense = 10; + public override void SetDefaults() + { + npc.npcSlots = 16f; + npc.damage = 80; + npc.width = 100; + npc.height = 90; + npc.defense = 10; npc.Calamity().RevPlusDR(0.1f); - npc.aiStyle = -1; - aiType = -1; - npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 12, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - bossBag = mod.ItemType("AquaticScourgeBag"); - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + npc.aiStyle = -1; + aiType = -1; + npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; + if (CalamityWorld.death) + { + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 12, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + bossBag = mod.ItemType("AquaticScourgeBag"); + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(despawning); - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - writer.Write(charging); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(despawning); + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + writer.Write(charging); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - despawning = reader.ReadBoolean(); - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - charging = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + despawning = reader.ReadBoolean(); + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + charging = reader.ReadBoolean(); + } - public override void AI() - { - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.99 || CalamityWorld.bossRushActive) - { - detectsPlayer = true; - npc.damage = npc.defDamage; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - else - music = MusicID.Boss2; - } - else - { - npc.damage = 0; - } - npc.chaseable = detectsPlayer; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBodyAlt"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeTail"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 120f : 180f)) - { - int npcPoxX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int npcPoxY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 300f && - !Main.tile[npcPoxX, npcPoxY].active()) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int random = Main.rand.Next(3); - Main.PlaySound(3, (int)npc.Center.X, (int)npc.Center.Y, 8); - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - if (random == 0 && NPC.CountNPCS(mod.NPCType("AquaticSeekerHead")) < 1) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticSeekerHead")); - } - else if (random == 1 && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 3) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticUrchin")); - } - else if (NPC.CountNPCS(mod.NPCType("AquaticParasite")) < 8) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticParasite")); - } - } - } - npc.localAI[1] += 1f; - if (Main.player[npc.target].gravDir == -1f) - { - npc.localAI[1] += 2f; - } - if (npc.localAI[1] >= (CalamityWorld.bossRushActive ? 270f : 390f)) - { - int npcPoxX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int npcPoxY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (!Main.tile[npcPoxX, npcPoxY].active() && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 300f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - BarfShitUp(); - } - } - } - } - bool notOcean = Main.player[npc.target].position.Y < 800f || - (double)Main.player[npc.target].position.Y > Main.worldSurface * 16.0 || - (Main.player[npc.target].position.X > 6400f && Main.player[npc.target].position.X < (float)(Main.maxTilesX * 16 - 6400)); - if (Main.player[npc.target].dead || (notOcean && !CalamityWorld.bossRushActive)) - { - despawning = true; - npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y + 2f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 2f; - } - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].aiStyle == npc.aiStyle) - { - Main.npc[a].active = false; - } - } - } - } - else - { - despawning = false; - } - 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 (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeTail"))) - { - npc.active = false; - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 + (notOcean ? 800 : 400)); //800 - if (!detectsPlayer) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < (notOcean ? 500f : 400f)) //500 - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + (notOcean ? 600f : 480f); //600 - } - else - { - num191 = Main.player[npc.target].Center.X - (notOcean ? 600f : 480f); //600 - } - } - } - } - if (detectsPlayer) - { - num188 = CalamityWorld.revenge ? 15f : 13f; - num189 = 0.16f; - if (notOcean) - { - num188 = 17f; - num189 = 0.18f; - } - if (Main.player[npc.target].gravDir == -1f) - { - num188 = 20f; - num189 = 0.2f; - } - if (CalamityWorld.bossRushActive) - { - num188 = 22f; - num189 = 0.24f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.99 || CalamityWorld.bossRushActive) + { + detectsPlayer = true; + npc.damage = npc.defDamage; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + else + music = MusicID.Boss2; + } + else + { + npc.damage = 0; + } + npc.chaseable = detectsPlayer; + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBodyAlt"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeTail"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + if (detectsPlayer) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 120f : 180f)) + { + int npcPoxX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int npcPoxY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 300f && + !Main.tile[npcPoxX, npcPoxY].active()) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int random = Main.rand.Next(3); + Main.PlaySound(3, (int)npc.Center.X, (int)npc.Center.Y, 8); + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + if (random == 0 && NPC.CountNPCS(mod.NPCType("AquaticSeekerHead")) < 1) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticSeekerHead")); + } + else if (random == 1 && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 3) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticUrchin")); + } + else if (NPC.CountNPCS(mod.NPCType("AquaticParasite")) < 8) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticParasite")); + } + } + } + npc.localAI[1] += 1f; + if (Main.player[npc.target].gravDir == -1f) + { + npc.localAI[1] += 2f; + } + if (npc.localAI[1] >= (CalamityWorld.bossRushActive ? 270f : 390f)) + { + int npcPoxX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int npcPoxY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (!Main.tile[npcPoxX, npcPoxY].active() && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 300f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + BarfShitUp(); + } + } + } + } + bool notOcean = Main.player[npc.target].position.Y < 800f || + (double)Main.player[npc.target].position.Y > Main.worldSurface * 16.0 || + (Main.player[npc.target].position.X > 6400f && Main.player[npc.target].position.X < (float)(Main.maxTilesX * 16 - 6400)); + if (Main.player[npc.target].dead || (notOcean && !CalamityWorld.bossRushActive)) + { + despawning = true; + npc.TargetClosest(false); + npc.velocity.Y = npc.velocity.Y + 2f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 2f; + } + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].aiStyle == npc.aiStyle) + { + Main.npc[a].active = false; + } + } + } + } + else + { + despawning = false; + } + 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 (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeTail"))) + { + npc.active = false; + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 + (notOcean ? 800 : 400)); //800 + if (!detectsPlayer) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < (notOcean ? 500f : 400f)) //500 + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + (notOcean ? 600f : 480f); //600 + } + else + { + num191 = Main.player[npc.target].Center.X - (notOcean ? 600f : 480f); //600 + } + } + } + } + if (detectsPlayer) + { + num188 = CalamityWorld.revenge ? 15f : 13f; + num189 = 0.16f; + if (notOcean) + { + num188 = 17f; + num189 = 0.18f; + } + if (Main.player[npc.target].gravDir == -1f) + { + num188 = 20f; + num189 = 0.2f; + } + if (CalamityWorld.bossRushActive) + { + num188 = 22f; + num189 = 0.24f; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - public void BarfShitUp() - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 13); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - int damageBoom = Main.expertMode ? 23 : 28; - float velocity = CalamityWorld.revenge ? 7.5f : 6.5f; - if (CalamityWorld.bossRushActive) - velocity = 11f; + public void BarfShitUp() + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 13); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = Main.expertMode ? 23 : 28; + float velocity = CalamityWorld.revenge ? 7.5f : 6.5f; + if (CalamityWorld.bossRushActive) + velocity = 11f; - for (iBoom = 0; iBoom < 15; iBoom++) - { - int projectileType = (Main.rand.NextBool(2) ? mod.ProjectileType("SandTooth") : mod.ProjectileType("SandBlast")); - if (projectileType == mod.ProjectileType("SandTooth")) - { - damageBoom = Main.expertMode ? 25 : 30; - } - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocity), (float)(Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocity), (float)(-Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - damageBoom = Main.expertMode ? 28 : 33; - int num320 = Main.rand.Next(5, 9); - int num3; - for (int num321 = 0; num321 < num320; num321 = num3 + 1) - { - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SandPoisonCloud"), damageBoom, 0f, Main.myPlayer, 0f, (float)Main.rand.Next(-45, 1)); - num3 = num321; - } - } - } + for (iBoom = 0; iBoom < 15; iBoom++) + { + int projectileType = (Main.rand.NextBool(2) ? mod.ProjectileType("SandTooth") : mod.ProjectileType("SandBlast")); + if (projectileType == mod.ProjectileType("SandTooth")) + { + damageBoom = Main.expertMode ? 25 : 30; + } + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocity), (float)(Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocity), (float)(-Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + damageBoom = Main.expertMode ? 28 : 33; + int num320 = Main.rand.Next(5, 9); + int num3; + for (int num321 = 0; num321 < num320; num321 = num3 + 1) + { + Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= (float)Main.rand.Next(50, 401) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SandPoisonCloud"), damageBoom, 0f, Main.myPlayer, 0f, (float)Main.rand.Next(-45, 1)); + num3 = num321; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - Rectangle targetHitbox = target.Hitbox; + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; - return minDist <= 50f; - } + return minDist <= 50f; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) damage = (int)((double)damage * 0.5); } public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) - { - if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) - return 0.01f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + { + if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) + return 0.01f; + } + return 0f; + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("SulphurousSand"); - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("SulphurousSand"); + } - public override bool SpecialNPCLoot() - { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, - mod.NPCType("AquaticScourgeHead"), - mod.NPCType("AquaticScourgeBody"), + public override bool SpecialNPCLoot() + { + int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + mod.NPCType("AquaticScourgeHead"), + mod.NPCType("AquaticScourgeBody"), mod.NPCType("AquaticScourgeBodyAlt"), - mod.NPCType("AquaticScourgeTail")); - npc.position = Main.npc[closestSegmentID].position; + mod.NPCType("AquaticScourgeTail")); + npc.position = Main.npc[closestSegmentID].position; return false; - } + } public override void NPCLoot() { @@ -619,59 +621,59 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), 1f); + } + } - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead && !despawning) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } + public override bool CheckActive() + { + if (detectsPlayer && !Main.player[npc.target].dead && !despawning) + { + return false; + } + if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == NetmodeID.Server) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 360, true); - player.AddBuff(BuffID.Venom, 360, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 360, true); + player.AddBuff(BuffID.Venom, 360, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } + } } diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.cs b/NPCs/AbyssNPCs/AquaticScourgeTail.cs index 137f69f196..82695ec768 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeTail.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeTail.cs @@ -1,81 +1,81 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticScourgeTail : ModNPC - { + { public bool detectsPlayer = false; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } + { + DisplayName.SetDefault("Aquatic Scourge"); + } - public override void SetDefaults() - { - npc.damage = 45; - npc.width = 30; - npc.height = 50; - npc.defense = 25; + public override void SetDefaults() + { + npc.damage = 45; + npc.width = 30; + npc.height = 50; + npc.defense = 25; npc.Calamity().RevPlusDR(0.15f); npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; if (CalamityWorld.death) { npc.lifeMax = 100000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; npc.chaseable = false; - npc.canGhostHeal = false; - if (Main.expertMode) + npc.canGhostHeal = false; + if (Main.expertMode) { npc.scale = 1.15f; } } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if ((double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99) - { + public override void AI() + { + if ((double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99) + { detectsPlayer = true; npc.damage = npc.defDamage; npc.boss = true; @@ -126,13 +126,13 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } if (Main.player[npc.target].dead) { npc.TargetClosest(false); @@ -154,8 +154,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -178,13 +177,13 @@ namespace CalamityMod.NPCs.AbyssNPCs } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + damage = (int)((double)damage * 0.5); + } - public override bool? CanBeHitByProjectile(Projectile projectile) + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) { @@ -199,9 +198,9 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { @@ -210,7 +209,7 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void HitEffect(int hitDirection, double damage) - { + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -221,9 +220,9 @@ namespace CalamityMod.NPCs.AbyssNPCs { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail2"), 1f); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail2"), 1f); + } } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AbyssNPCs/AquaticSeekerBody.cs b/NPCs/AbyssNPCs/AquaticSeekerBody.cs index c5fb011643..0c19df8037 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerBody.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerBody.cs @@ -1,24 +1,24 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticSeekerBody : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Seeker"); - } + { + DisplayName.SetDefault("Aquatic Seeker"); + } - public override void SetDefaults() - { - npc.damage = 15; //70 - npc.width = 16; //28 - npc.height = 16; //28 - npc.defense = 10; + public override void SetDefaults() + { + npc.damage = 15; //70 + npc.width = 16; //28 + npc.height = 16; //28 + npc.defense = 10; npc.lifeMax = 60; if (CalamityWorld.bossRushActive) { @@ -26,30 +26,30 @@ namespace CalamityMod.NPCs.AbyssNPCs } npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("AquaticSeekerHead"); - bannerItem = mod.ItemType("AquaticSeekerBanner"); - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("AquaticSeekerHead"); + bannerItem = mod.ItemType("AquaticSeekerBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -108,35 +108,34 @@ namespace CalamityMod.NPCs.AbyssNPCs num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = 1; - } - else if (num191 > 0f) - { - npc.spriteDirection = -1; - } - } + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = 1; + } + else if (num191 > 0f) + { + npc.spriteDirection = -1; + } + } } public override bool CheckActive() @@ -145,12 +144,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -161,8 +160,8 @@ namespace CalamityMod.NPCs.AbyssNPCs { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerBody"), 1f); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerBody"), 1f); + } } - } + } } diff --git a/NPCs/AbyssNPCs/AquaticSeekerHead.cs b/NPCs/AbyssNPCs/AquaticSeekerHead.cs index f37883dbdf..8fd2b9a694 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerHead.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerHead.cs @@ -1,374 +1,373 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticSeekerHead : ModNPC - { - public const int minLength = 3; - public const int maxLength = 4; - public float speed = 3f; //10 - public float turnSpeed = 0.05f; //0.15 - bool TailSpawned = false; + { + public const int minLength = 3; + public const int maxLength = 4; + public float speed = 3f; //10 + public float turnSpeed = 0.05f; //0.15 + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Seeker"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Seeker"); + } - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 22; //36 - npc.height = 28; //20 - npc.defense = 5; - npc.lifeMax = 60; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 60000; - } - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("AquaticSeekerBanner"); - } + public override void SetDefaults() + { + npc.damage = 20; + npc.width = 22; //36 + npc.height = 28; //20 + npc.defense = 5; + npc.lifeMax = 60; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 60000; + } + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("AquaticSeekerBanner"); + } - public override void AI() - { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerTail"), 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(23, -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.AnyNPCs(mod.NPCType("AquaticSeekerTail"))) - { - npc.active = false; - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 200); //800 - if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 300f; - } - else - { - num191 = Main.player[npc.target].Center.X - 300f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerTail"), 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(23, -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.AnyNPCs(mod.NPCType("AquaticSeekerTail"))) + { + npc.active = false; + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 200); //800 + if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 300f; + } + else + { + num191 = Main.player[npc.target].Center.X - 300f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) - { - if (!NPC.AnyNPCs(mod.NPCType("AquaticSeekerHead"))) - return 0.01f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + { + if (!NPC.AnyNPCs(mod.NPCType("AquaticSeekerHead"))) + return 0.01f; + } + return 0f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerHead"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerHead"), 1f); + } + } - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } + public override bool CheckActive() + { + if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == NetmodeID.Server) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 60); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(BuffID.Venom, 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 60); + } + } + } } diff --git a/NPCs/AbyssNPCs/AquaticSeekerTail.cs b/NPCs/AbyssNPCs/AquaticSeekerTail.cs index e2d9664513..ea67efbe22 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerTail.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerTail.cs @@ -1,24 +1,24 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticSeekerTail : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Seeker"); - } + { + DisplayName.SetDefault("Aquatic Seeker"); + } - public override void SetDefaults() - { - npc.damage = 5; //70 - npc.width = 16; //28 - npc.height = 22; //28 - npc.defense = 20; + public override void SetDefaults() + { + npc.damage = 5; //70 + npc.width = 16; //28 + npc.height = 22; //28 + npc.defense = 20; npc.lifeMax = 60; if (CalamityWorld.bossRushActive) { @@ -26,30 +26,30 @@ namespace CalamityMod.NPCs.AbyssNPCs } npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("AquaticSeekerHead"); - bannerItem = mod.ItemType("AquaticSeekerBanner"); - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("AquaticSeekerHead"); + bannerItem = mod.ItemType("AquaticSeekerBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -87,13 +87,13 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } if (Main.player[npc.target].dead) { npc.TargetClosest(false); @@ -108,35 +108,34 @@ namespace CalamityMod.NPCs.AbyssNPCs num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = 1; - } - else if (num191 > 0f) - { - npc.spriteDirection = -1; - } - } + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = 1; + } + else if (num191 > 0f) + { + npc.spriteDirection = -1; + } + } } public override bool CheckActive() @@ -145,12 +144,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -161,8 +160,8 @@ namespace CalamityMod.NPCs.AbyssNPCs { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerTail"), 1f); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerTail"), 1f); + } } - } + } } diff --git a/NPCs/AbyssNPCs/AquaticUrchin.cs b/NPCs/AbyssNPCs/AquaticUrchin.cs index f691cecf50..7243532f28 100644 --- a/NPCs/AbyssNPCs/AquaticUrchin.cs +++ b/NPCs/AbyssNPCs/AquaticUrchin.cs @@ -1,29 +1,28 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class AquaticUrchin : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Urchin"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Urchin"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 25; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 10; - npc.lifeMax = 50; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 25; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 10; + npc.lifeMax = 50; if (CalamityWorld.bossRushActive) { npc.lifeMax = 50000; @@ -34,292 +33,292 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.buffImmune[k] = true; } npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - banner = npc.type; - bannerItem = mod.ItemType("AquaticUrchinBanner"); - } + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath15; + npc.behindTiles = true; + banner = npc.type; + bannerItem = mod.ItemType("AquaticUrchinBanner"); + } - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - (npc.wet ? 12f : 4f); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default, 1f); - } - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = (npc.wet ? 7f : 3f); - float num8 = (npc.wet ? 0.12f : 0.05f); - if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = (npc.wet ? -16f : -7.5f); - npc.netUpdate = true; - } - else - { - npc.velocity.Y = (npc.wet ? -14f : -6.5f); - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = (npc.wet ? -13f : -6f); - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = (npc.wet ? -12f : -5f); - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = (npc.wet ? -15f : -7f); - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - (npc.wet ? 12f : 4f); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default, 1f); + } + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = (npc.wet ? 7f : 3f); + float num8 = (npc.wet ? 0.12f : 0.05f); + if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = (npc.wet ? -16f : -7.5f); + npc.netUpdate = true; + } + else + { + npc.velocity.Y = (npc.wet ? -14f : -6.5f); + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = (npc.wet ? -13f : -6f); + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = (npc.wet ? -12f : -5f); + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = (npc.wet ? -15f : -7f); + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { + public override void OnHitPlayer(Player player, int damage, bool crit) + { player.AddBuff(BuffID.Venom, 120, true); } @@ -337,26 +336,26 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); - } + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin3"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin3"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/Bloatfish.cs b/NPCs/AbyssNPCs/Bloatfish.cs index 0f9344a463..db02f995fe 100644 --- a/NPCs/AbyssNPCs/Bloatfish.cs +++ b/NPCs/AbyssNPCs/Bloatfish.cs @@ -1,226 +1,224 @@ -using System; -using Microsoft.Xna.Framework; +using CalamityMod.World; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Bloatfish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloatfish"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloatfish"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 5; - npc.width = 74; - npc.height = 94; - npc.defense = 100; - npc.lifeMax = 12000; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.9f; - banner = npc.type; - bannerItem = mod.ItemType("BloatfishBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 5; + npc.width = 74; + npc.height = 94; + npc.defense = 100; + npc.lifeMax = 12000; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 30, 0); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.9f; + banner = npc.type; + bannerItem = mod.ItemType("BloatfishBanner"); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - npc.TargetClosest(false); - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + npc.TargetClosest(false); + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - projectile.penetrate = 1; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 900, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 900, true); + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(mod.NPCType("Bloatfish")) < 3) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(mod.NPCType("Bloatfish")) < 3) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(10, 21)); - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(10, 21)); + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - if (npc.scale < 2f) - { - npc.scale += 0.05f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + if (npc.scale < 2f) + { + npc.scale += 0.05f; + } + } + } } diff --git a/NPCs/AbyssNPCs/BobbitWormHead.cs b/NPCs/AbyssNPCs/BobbitWormHead.cs index 309ebadb57..b61c5354af 100644 --- a/NPCs/AbyssNPCs/BobbitWormHead.cs +++ b/NPCs/AbyssNPCs/BobbitWormHead.cs @@ -1,276 +1,275 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class BobbitWormHead : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bobbit Worm"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bobbit Worm"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 150; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 150; + npc.width = 80; //324 + npc.height = 40; //216 + npc.defense = 50; npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = 10000; - npc.knockBackResist = 0f; - aiType = -1; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("BobbitWormBanner"); - } + npc.knockBackResist = 0f; + aiType = -1; + npc.noGravity = true; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("BobbitWormBanner"); + } - public override void AI() - { - if (CalamityGlobalNPC.bobbitWormBottom < 0 || !Main.npc[CalamityGlobalNPC.bobbitWormBottom].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = true; - float num659 = 14f; - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector79.Y; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 11f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) - { - npc.TargetClosest(true); + public override void AI() + { + if (CalamityGlobalNPC.bobbitWormBottom < 0 || !Main.npc[CalamityGlobalNPC.bobbitWormBottom].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.ai[0] == 0f) + { + npc.noTileCollide = true; + float num659 = 14f; + Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + float num660 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector79.Y; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 11f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) + { + npc.TargetClosest(true); //if (npc.Center.Y + ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && if (npc.Center.Y + Main.player[npc.target].Calamity().GetAbyssAggro(100f, 50f) > Main.player[npc.target].Center.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - return; - } - npc.ai[1] = 0f; - return; - } - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - } - else if (npc.ai[0] == 1f) - { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; - float num663 = 11f; - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); - num666 = num663 / num666; - npc.velocity.X = num664 * num666; - npc.velocity.Y = num665 * num666; - npc.ai[0] = 2f; - npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)) - 1.57f; - } - else if (npc.ai[0] == 2f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) - { - npc.noTileCollide = false; - } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) - { - npc.noTileCollide = false; - } - } - else - { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) - { - npc.noTileCollide = false; - } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) - { - npc.noTileCollide = false; - } - } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector81.Y; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if (num669 > 700f || npc.collideX || npc.collideY) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - return; - } - } - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - float num671 = 11f; - float num672 = 0.25f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (npc.velocity.X < num673) - { - npc.velocity.X = npc.velocity.X + num672; - if (npc.velocity.X < 0f && num673 > 0f) - { - npc.velocity.X = npc.velocity.X + num672 * 2f; - } - } - else if (npc.velocity.X > num673) - { - npc.velocity.X = npc.velocity.X - num672; - if (npc.velocity.X > 0f && num673 < 0f) - { - npc.velocity.X = npc.velocity.X - num672 * 2f; - } - } - if (npc.velocity.Y < num674) - { - npc.velocity.Y = npc.velocity.Y + num672; - if (npc.velocity.Y < 0f && num674 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num672 * 2f; - } - } - else if (npc.velocity.Y > num674) - { - npc.velocity.Y = npc.velocity.Y - num672; - if (npc.velocity.Y > 0f && num674 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num672 * 2f; - } - } - npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); - } - } + npc.ai[1] = 0f; + npc.ai[0] = 1f; + return; + } + npc.ai[1] = 0f; + return; + } + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + } + else if (npc.ai[0] == 1f) + { + npc.noTileCollide = true; + npc.collideX = false; + npc.collideY = false; + float num663 = 11f; + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num664 = Main.player[npc.target].Center.X - vector80.X; + float num665 = Main.player[npc.target].Center.Y - vector80.Y; + float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + num666 = num663 / num666; + npc.velocity.X = num664 * num666; + npc.velocity.Y = num665 * num666; + npc.ai[0] = 2f; + npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)) - 1.57f; + } + else if (npc.ai[0] == 2f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + { + npc.noTileCollide = false; + } + if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + { + npc.noTileCollide = false; + } + } + else + { + if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + { + npc.noTileCollide = false; + } + if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + { + npc.noTileCollide = false; + } + } + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + float num667 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector81.X; + float num668 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector81.Y; + float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); + if (num669 > 700f || npc.collideX || npc.collideY) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + return; + } + } + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + float num671 = 11f; + float num672 = 0.25f; + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); + float num673 = Main.player[npc.target].Center.X - vector82.X; + float num674 = Main.player[npc.target].Center.Y - vector82.Y; + float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); + num675 = num671 / num675; + num673 *= num675; + num674 *= num675; + if (npc.velocity.X < num673) + { + npc.velocity.X = npc.velocity.X + num672; + if (npc.velocity.X < 0f && num673 > 0f) + { + npc.velocity.X = npc.velocity.X + num672 * 2f; + } + } + else if (npc.velocity.X > num673) + { + npc.velocity.X = npc.velocity.X - num672; + if (npc.velocity.X > 0f && num673 < 0f) + { + npc.velocity.X = npc.velocity.X - num672 * 2f; + } + } + if (npc.velocity.Y < num674) + { + npc.velocity.Y = npc.velocity.Y + num672; + if (npc.velocity.Y < 0f && num674 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num672 * 2f; + } + } + else if (npc.velocity.Y > num674) + { + npc.velocity.Y = npc.velocity.Y - num672; + if (npc.velocity.Y > 0f && num674 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num672 * 2f; + } + } + npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; - float drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; - bool draw = true; - while (draw) - { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); - if (totalDrawDistance < 16f) - { - draw = false; - } - else - { - totalDrawDistance = 16f / totalDrawDistance; - drawPositionX *= totalDrawDistance; - drawPositionY *= totalDrawDistance; - center.X += drawPositionX; - center.Y += drawPositionY; - drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; - drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; - drawPositionY += 4f; - Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Width, mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height)), color, rotation, - new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Width * 0.5f, (float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); - } - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; + float drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; + float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + bool draw = true; + while (draw) + { + float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + if (totalDrawDistance < 16f) + { + draw = false; + } + else + { + totalDrawDistance = 16f / totalDrawDistance; + drawPositionX *= totalDrawDistance; + drawPositionY *= totalDrawDistance; + center.X += drawPositionX; + center.Y += drawPositionY; + drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; + drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; + drawPositionY += 4f; + Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Width, mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height)), color, rotation, + new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Width * 0.5f, (float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); + } + } + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(mod.BuffType("CrushDepth"), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 300); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 300, true); + player.AddBuff(mod.BuffType("CrushDepth"), 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 300); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm4"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm4"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/BobbitWormSegment.cs b/NPCs/AbyssNPCs/BobbitWormSegment.cs index 6ad9c11672..44889a13dc 100644 --- a/NPCs/AbyssNPCs/BobbitWormSegment.cs +++ b/NPCs/AbyssNPCs/BobbitWormSegment.cs @@ -1,65 +1,64 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class BobbitWormSegment : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bobbit Worm"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bobbit Worm"); + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 0; - npc.alpha = 255; - npc.width = 26; //324 - npc.height = 26; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.knockBackResist = 0f; - aiType = -1; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 0; + npc.alpha = 255; + npc.width = 26; //324 + npc.height = 26; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.knockBackResist = 0f; + aiType = -1; + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } - public override void AI() - { - CalamityGlobalNPC.bobbitWormBottom = npc.whoAmI; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("BobbitWormHead"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - if (!NPC.AnyNPCs(mod.NPCType("BobbitWormHead"))) - { - npc.active = false; - npc.netUpdate = true; - } - } + public override void AI() + { + CalamityGlobalNPC.bobbitWormBottom = npc.whoAmI; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("BobbitWormHead"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + if (!NPC.AnyNPCs(mod.NPCType("BobbitWormHead"))) + { + npc.active = false; + npc.netUpdate = true; + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) - { - if (!NPC.AnyNPCs(mod.NPCType("BobbitWormSegment"))) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) + { + if (!NPC.AnyNPCs(mod.NPCType("BobbitWormSegment"))) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } - public override bool CheckActive() - { - return false; - } - } + public override bool CheckActive() + { + return false; + } + } } diff --git a/NPCs/AbyssNPCs/BoxJellyfish.cs b/NPCs/AbyssNPCs/BoxJellyfish.cs index 551022681b..c877b5ccb3 100644 --- a/NPCs/AbyssNPCs/BoxJellyfish.cs +++ b/NPCs/AbyssNPCs/BoxJellyfish.cs @@ -1,212 +1,211 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class BoxJellyfish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Box Jellyfish"); - Main.npcFrameCount[npc.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Box Jellyfish"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 22; - npc.width = 30; - npc.height = 30; - npc.defense = 5; - npc.lifeMax = 45; - npc.alpha = 20; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("BoxJellyfishBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 22; + npc.width = 30; + npc.height = 30; + npc.defense = 5; + npc.lifeMax = 45; + npc.alpha = 20; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("BoxJellyfishBanner"); + } - public override void AI() - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (!npc.wet) - { - npc.rotation += npc.velocity.X * 0.1f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - return; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - bool flag16 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) - { - flag16 = true; - } - if (flag16) - { - npc.localAI[2] = 1f; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - npc.velocity *= 0.975f; - float num263 = 0.8f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 8f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - return; - } - } - else - { - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - } - } - } + public override void AI() + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (!npc.wet) + { + npc.rotation += npc.velocity.X * 0.1f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + return; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + bool flag16 = false; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + { + flag16 = true; + } + if (flag16) + { + npc.localAI[2] = 1f; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.velocity *= 0.975f; + float num263 = 0.8f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 8f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + return; + } + } + else + { + npc.localAI[2] = 0f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.4f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + } + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return SpawnCondition.OceanMonster.Chance * 0.1f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return SpawnCondition.OceanMonster.Chance * 0.1f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/Catfish.cs b/NPCs/AbyssNPCs/Catfish.cs index 87055dedc3..506e815331 100644 --- a/NPCs/AbyssNPCs/Catfish.cs +++ b/NPCs/AbyssNPCs/Catfish.cs @@ -1,276 +1,274 @@ using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Catfish : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catfish"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catfish"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 30; - npc.width = 98; - npc.height = 40; - npc.defense = 12; - npc.lifeMax = 120; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath40; - npc.knockBackResist = 0.8f; - banner = npc.type; - bannerItem = mod.ItemType("CatfishBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 30; + npc.width = 98; + npc.height = 40; + npc.defense = 12; + npc.lifeMax = 120; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath40; + npc.knockBackResist = 0.8f; + banner = npc.type; + bannerItem = mod.ItemType("CatfishBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - npc.chaseable = hasBeenHit; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - (Main.player[npc.target].Center - npc.Center).Length() < 200f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - flag14 = true; - } - if (Main.player[npc.target].dead && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.25f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - if (npc.velocity.Y > 6f) - { - npc.velocity.Y = 6f; - } - if (npc.velocity.Y < -6f) - { - npc.velocity.Y = -6f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + npc.chaseable = hasBeenHit; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + if (npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + (Main.player[npc.target].Center - npc.Center).Length() < 200f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + flag14 = true; + } + if (Main.player[npc.target].dead && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.25f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + if (npc.velocity.Y > 6f) + { + npc.velocity.Y = 6f; + } + if (npc.velocity.Y < -6f) + { + npc.velocity.Y = -6f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 180, true); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(25)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(25)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/ChaoticPuffer.cs b/NPCs/AbyssNPCs/ChaoticPuffer.cs index 0f264a693c..4598f3d00e 100644 --- a/NPCs/AbyssNPCs/ChaoticPuffer.cs +++ b/NPCs/AbyssNPCs/ChaoticPuffer.cs @@ -1,258 +1,257 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class ChaoticPuffer : ModNPC - { - public bool puffedUp = false; - public bool puffing = false; - public bool unpuffing = false; - public int puffTimer = 0; - public int puffingTimer = 0; + { + public bool puffedUp = false; + public bool puffing = false; + public bool unpuffing = false; + public int puffTimer = 0; + public int puffingTimer = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotic Puffer"); - Main.npcFrameCount[npc.type] = 11; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotic Puffer"); + Main.npcFrameCount[npc.type] = 11; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.width = 78; - npc.height = 70; - npc.defense = 25; - npc.lifeMax = 7500; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("ChaoticPufferBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.width = 78; + npc.height = 70; + npc.defense = 25; + npc.lifeMax = 7500; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 30, 0); + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("ChaoticPufferBanner"); + } - public override void AI() - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.03f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.03f; + public override void AI() + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.03f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.03f; - npc.damage = puffedUp ? (Main.expertMode ? 230 : 115) : 0; + npc.damage = puffedUp ? (Main.expertMode ? 230 : 115) : 0; - if (!puffing || !unpuffing) - { - ++puffTimer; - } + if (!puffing || !unpuffing) + { + ++puffTimer; + } - if (puffTimer >= 300) - { + if (puffTimer >= 300) + { - if (!puffedUp) - { - puffing = true; - } - else - { - unpuffing = true; - } + if (!puffedUp) + { + puffing = true; + } + else + { + unpuffing = true; + } - puffTimer = 0; + puffTimer = 0; - } - else if (puffing || unpuffing) - { + } + else if (puffing || unpuffing) + { - ++puffingTimer; + ++puffingTimer; - if (puffingTimer > 16 && puffing) - { + if (puffingTimer > 16 && puffing) + { - puffing = false; - puffedUp = true; - puffingTimer = 0; + puffing = false; + puffedUp = true; + puffingTimer = 0; - } - else if (puffingTimer > 16 && unpuffing) - { + } + else if (puffingTimer > 16 && unpuffing) + { - unpuffing = false; - puffedUp = false; - puffingTimer = 0; + unpuffing = false; + puffedUp = false; + puffingTimer = 0; - } + } - } + } - if (npc.velocity.X >= 1 || npc.velocity.X <= -1) - { + if (npc.velocity.X >= 1 || npc.velocity.X <= -1) + { - npc.velocity.X = npc.velocity.X * 0.97f; + npc.velocity.X = npc.velocity.X * 0.97f; - } + } - if (npc.velocity.Y >= 1 || npc.velocity.Y <= -1) - { + if (npc.velocity.Y >= 1 || npc.velocity.Y <= -1) + { - npc.velocity.Y = npc.velocity.Y * 0.97f; + npc.velocity.Y = npc.velocity.Y * 0.97f; - } + } - npc.rotation += npc.velocity.X * 0.05f; + npc.rotation += npc.velocity.X * 0.05f; - } + } - public void Boom() - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 14); - if (Main.netMode != NetmodeID.MultiplayerClient && puffedUp) - { - int damageBoom = 100; - int projectileType = mod.ProjectileType("PufferExplosion"); - int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - npc.netUpdate = true; - } + public void Boom() + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 14); + if (Main.netMode != NetmodeID.MultiplayerClient && puffedUp) + { + int damageBoom = 100; + int projectileType = mod.ProjectileType("PufferExplosion"); + int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + npc.netUpdate = true; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - if (!unpuffing) - { - npc.frame.Y = npc.frame.Y + frameHeight; - } - else - { - npc.frame.Y = npc.frame.Y - frameHeight; - } - } - if (puffing) - { - if (npc.frame.Y < frameHeight * 3) - { - npc.frame.Y = frameHeight * 3; - } - if (npc.frame.Y > frameHeight * 6) - { - npc.frame.Y = frameHeight * 3; - } - } - else if (unpuffing) - { - if (npc.frame.Y > frameHeight * 6) - { - npc.frame.Y = frameHeight * 6; - } - if (npc.frame.Y < frameHeight * 3) - { - npc.frame.Y = frameHeight * 6; - } - } - else if (!puffedUp) - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frame.Y < frameHeight * 7) - { - npc.frame.Y = frameHeight * 7; - } - if (npc.frame.Y > frameHeight * 10) - { - npc.frame.Y = frameHeight * 7; - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + if (!unpuffing) + { + npc.frame.Y = npc.frame.Y + frameHeight; + } + else + { + npc.frame.Y = npc.frame.Y - frameHeight; + } + } + if (puffing) + { + if (npc.frame.Y < frameHeight * 3) + { + npc.frame.Y = frameHeight * 3; + } + if (npc.frame.Y > frameHeight * 6) + { + npc.frame.Y = frameHeight * 3; + } + } + else if (unpuffing) + { + if (npc.frame.Y > frameHeight * 6) + { + npc.frame.Y = frameHeight * 6; + } + if (npc.frame.Y < frameHeight * 3) + { + npc.frame.Y = frameHeight * 6; + } + } + else if (!puffedUp) + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frame.Y < frameHeight * 7) + { + npc.frame.Y = frameHeight * 7; + } + if (npc.frame.Y > frameHeight * 10) + { + npc.frame.Y = frameHeight * 7; + } + } - } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedGolemBoss) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChaoticOre"), Main.rand.Next(10, 27)); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedGolemBoss) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChaoticOre"), Main.rand.Next(10, 27)); + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (puffedUp) - { - Boom(); - npc.active = false; - } - } + if (puffedUp) + { + Boom(); + npc.active = false; + } + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - npc.velocity.X = projectile.velocity.X; - npc.velocity.Y = projectile.velocity.Y; - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + npc.velocity.X = projectile.velocity.X; + npc.velocity.Y = projectile.velocity.Y; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Boom(); + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Boom(); - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/ColossalSquid.cs b/NPCs/AbyssNPCs/ColossalSquid.cs index 6109f93018..71404e7769 100644 --- a/NPCs/AbyssNPCs/ColossalSquid.cs +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -1,601 +1,600 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class ColossalSquid : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Colossal Squid"); - Main.npcFrameCount[npc.type] = 11; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Colossal Squid"); + Main.npcFrameCount[npc.type] = 11; + } - public override void SetDefaults() - { - npc.npcSlots = 9f; - npc.noGravity = true; - npc.damage = 150; - npc.width = 180; - npc.height = 180; - npc.defense = 50; + public override void SetDefaults() + { + npc.npcSlots = 9f; + npc.noGravity = true; + npc.damage = 150; + npc.width = 180; + npc.height = 180; + npc.defense = 50; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = 220000; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.timeLeft = NPC.activeTime * 30; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit20; - npc.DeathSound = SoundID.NPCDeath23; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("ColossalSquidBanner"); - } + npc.lifeMax = 220000; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.timeLeft = NPC.activeTime * 30; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit20; + npc.DeathSound = SoundID.NPCDeath23; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("ColossalSquidBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); + } - public override void AI() - { - if (npc.localAI[1] == 1f) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 180f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - if (Main.rand.NextBool(300)) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); - } - npc.noTileCollide = false; - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 1f; - } - else - { - Vector2 value29 = Main.player[npc.target].Center - npc.Center; - value29.Y -= (float)(Main.player[npc.target].height / 4); - float num1310 = value29.Length(); - if (num1310 > 800f) - { - npc.ai[0] = 2f; - } - else - { - Vector2 center26 = npc.Center; - center26.X = Main.player[npc.target].Center.X; - Vector2 vector230 = center26 - npc.Center; - if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center26.X; - npc.ai[2] = center26.Y; - Vector2 center27 = npc.Center; - center27.Y = Main.player[npc.target].Center.Y; - if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center27, 1, 1) && Collision.CanHit(center27, 1, 1, Main.player[npc.target].position, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center27.X; - npc.ai[2] = center27.Y; - } - } - else - { - center26 = npc.Center; - center26.Y = Main.player[npc.target].Center.Y; - if ((center26 - npc.Center).Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center26.X; - npc.ai[2] = center26.Y; - } - } - if (npc.ai[0] == 0f) - { - npc.localAI[0] = 0f; - value29.Normalize(); - value29 *= 0.5f; - npc.velocity += value29; - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - } - } - } - else if (npc.ai[0] == 1f) - { - npc.rotation += (float)npc.direction * 0.1f; - Vector2 value30 = Main.player[npc.target].Center - npc.Center; - value30 = Main.player[npc.target].Top - npc.Center; - float num1311 = value30.Length(); - float num1312 = 5.5f; - num1312 += num1311 / 100f; - int num1313 = 50; - value30.Normalize(); - value30 *= num1312; - npc.velocity = (npc.velocity * (float)(num1313 - 1) + value30) / (float)num1313; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - } - if (num1311 < 160f && Main.player[npc.target].active && !Main.player[npc.target].dead) - { - npc.Center = Main.player[npc.target].Top; - npc.velocity = Vector2.Zero; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.rotation = npc.velocity.X * 0.05f; - npc.noTileCollide = true; - Vector2 value31 = Main.player[npc.target].Center - npc.Center; - float num1315 = value31.Length(); - float scaleFactor11 = 3f; - int num1316 = 3; - value31.Normalize(); - value31 *= scaleFactor11; - npc.velocity = (npc.velocity * (float)(num1316 - 1) + value31) / (float)num1316; - if (num1315 < 600f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.rotation = npc.velocity.X * 0.05f; - Vector2 value32 = new Vector2(npc.ai[1], npc.ai[2]); - Vector2 value33 = value32 - npc.Center; - float num1317 = value33.Length(); - float num1318 = 2f; - float num1319 = 3f; - value33.Normalize(); - value33 *= num1318; - npc.velocity = (npc.velocity * (num1319 - 1f) + value33) / num1319; - if (npc.collideX || npc.collideY) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - if (num1317 < num1318 || num1317 > 800f || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - npc.rotation = npc.velocity.X * 0.05f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -0.8f; - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * -0.8f; - } - Vector2 value34; - if (npc.velocity.X == 0f && npc.velocity.Y == 0f) - { - value34 = Main.player[npc.target].Center - npc.Center; - value34.Y -= (float)(Main.player[npc.target].height / 4); - value34.Normalize(); - npc.velocity = value34 * 0.1f; - } - float scaleFactor12 = 2f; - float num1320 = 20f; - value34 = npc.velocity; - value34.Normalize(); - value34 *= scaleFactor12; - npc.velocity = (npc.velocity * (num1320 - 1f) + value34) / num1320; - npc.ai[1] += 1f; - if (npc.ai[1] > 180f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - } - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - } - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 5f && !Collision.SolidCollision(npc.position - new Vector2(10f, 10f), npc.width + 20, npc.height + 20)) - { - npc.localAI[0] = 0f; - Vector2 center28 = npc.Center; - center28.X = Main.player[npc.target].Center.X; - if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center28.X; - npc.ai[2] = center28.Y; - } - else - { - center28 = npc.Center; - center28.Y = Main.player[npc.target].Center.Y; - if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center28.X; - npc.ai[2] = center28.Y; - } - } - } - } - else if (npc.ai[0] == 5f) - { - Player player7 = Main.player[npc.target]; - if (!player7.active || player7.dead) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - else - { - npc.Center = ((player7.gravDir == 1f) ? player7.Top : player7.Bottom) + new Vector2((float)(player7.direction * 4), 0f); - npc.gfxOffY = player7.gfxOffY; - npc.velocity = Vector2.Zero; - player7.AddBuff(163, 59, true); - } - } - npc.rotation = npc.velocity.X * 0.05f; - } - else - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (!npc.noTileCollide) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - npc.TargetClosest(false); - if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + public override void AI() + { + if (npc.localAI[1] == 1f) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 180f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + if (Main.rand.NextBool(300)) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); + } + npc.noTileCollide = false; + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 1f; + } + else + { + Vector2 value29 = Main.player[npc.target].Center - npc.Center; + value29.Y -= (float)(Main.player[npc.target].height / 4); + float num1310 = value29.Length(); + if (num1310 > 800f) + { + npc.ai[0] = 2f; + } + else + { + Vector2 center26 = npc.Center; + center26.X = Main.player[npc.target].Center.X; + Vector2 vector230 = center26 - npc.Center; + if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center26.X; + npc.ai[2] = center26.Y; + Vector2 center27 = npc.Center; + center27.Y = Main.player[npc.target].Center.Y; + if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center27, 1, 1) && Collision.CanHit(center27, 1, 1, Main.player[npc.target].position, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center27.X; + npc.ai[2] = center27.Y; + } + } + else + { + center26 = npc.Center; + center26.Y = Main.player[npc.target].Center.Y; + if ((center26 - npc.Center).Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center26.X; + npc.ai[2] = center26.Y; + } + } + if (npc.ai[0] == 0f) + { + npc.localAI[0] = 0f; + value29.Normalize(); + value29 *= 0.5f; + npc.velocity += value29; + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } + } + else if (npc.ai[0] == 1f) + { + npc.rotation += (float)npc.direction * 0.1f; + Vector2 value30 = Main.player[npc.target].Center - npc.Center; + value30 = Main.player[npc.target].Top - npc.Center; + float num1311 = value30.Length(); + float num1312 = 5.5f; + num1312 += num1311 / 100f; + int num1313 = 50; + value30.Normalize(); + value30 *= num1312; + npc.velocity = (npc.velocity * (float)(num1313 - 1) + value30) / (float)num1313; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + } + if (num1311 < 160f && Main.player[npc.target].active && !Main.player[npc.target].dead) + { + npc.Center = Main.player[npc.target].Top; + npc.velocity = Vector2.Zero; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.rotation = npc.velocity.X * 0.05f; + npc.noTileCollide = true; + Vector2 value31 = Main.player[npc.target].Center - npc.Center; + float num1315 = value31.Length(); + float scaleFactor11 = 3f; + int num1316 = 3; + value31.Normalize(); + value31 *= scaleFactor11; + npc.velocity = (npc.velocity * (float)(num1316 - 1) + value31) / (float)num1316; + if (num1315 < 600f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.rotation = npc.velocity.X * 0.05f; + Vector2 value32 = new Vector2(npc.ai[1], npc.ai[2]); + Vector2 value33 = value32 - npc.Center; + float num1317 = value33.Length(); + float num1318 = 2f; + float num1319 = 3f; + value33.Normalize(); + value33 *= num1318; + npc.velocity = (npc.velocity * (num1319 - 1f) + value33) / num1319; + if (npc.collideX || npc.collideY) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + if (num1317 < num1318 || num1317 > 800f || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + npc.rotation = npc.velocity.X * 0.05f; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -0.8f; + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * -0.8f; + } + Vector2 value34; + if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + { + value34 = Main.player[npc.target].Center - npc.Center; + value34.Y -= (float)(Main.player[npc.target].height / 4); + value34.Normalize(); + npc.velocity = value34 * 0.1f; + } + float scaleFactor12 = 2f; + float num1320 = 20f; + value34 = npc.velocity; + value34.Normalize(); + value34 *= scaleFactor12; + npc.velocity = (npc.velocity * (num1320 - 1f) + value34) / num1320; + npc.ai[1] += 1f; + if (npc.ai[1] > 180f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + } + if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + } + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 5f && !Collision.SolidCollision(npc.position - new Vector2(10f, 10f), npc.width + 20, npc.height + 20)) + { + npc.localAI[0] = 0f; + Vector2 center28 = npc.Center; + center28.X = Main.player[npc.target].Center.X; + if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center28.X; + npc.ai[2] = center28.Y; + } + else + { + center28 = npc.Center; + center28.Y = Main.player[npc.target].Center.Y; + if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center28.X; + npc.ai[2] = center28.Y; + } + } + } + } + else if (npc.ai[0] == 5f) + { + Player player7 = Main.player[npc.target]; + if (!player7.active || player7.dead) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else + { + npc.Center = ((player7.gravDir == 1f) ? player7.Top : player7.Bottom) + new Vector2((float)(player7.direction * 4), 0f); + npc.gfxOffY = player7.gfxOffY; + npc.velocity = Vector2.Zero; + player7.AddBuff(163, 59, true); + } + } + npc.rotation = npc.velocity.X * 0.05f; + } + else + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (!npc.noTileCollide) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + npc.TargetClosest(false); + if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 300f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(300f, 150f)) || npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (hasBeenHit) - { - if (Main.rand.NextBool(300)) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); - } - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[3] == 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 120f) - { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.ai[3] == 0f) - { - npc.noTileCollide = false; - } - else - { - npc.noTileCollide = true; - } - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 420f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.localAI[0] = 0f; - npc.localAI[1] = 1f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - npc.localAI[2] = 1f; - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 150f) - { - npc.localAI[0] = 0f; - npc.netUpdate = true; - int damage = 70; - if (Main.expertMode) - { - damage = 55; - } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 111); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 60, 0f, 2f, mod.ProjectileType("InkBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - } - npc.rotation = npc.velocity.X * 0.05f; - npc.velocity *= 0.975f; - float num263 = 2.5f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 20f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - return; - } - } - else - { - if (Main.rand.NextBool(300)) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); - } - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.2f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - return; - } - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) - { - npc.active = false; - } - } + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (hasBeenHit) + { + if (Main.rand.NextBool(300)) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); + } + if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[3] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[3] == 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 120f) + { + npc.ai[3] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.ai[3] == 0f) + { + npc.noTileCollide = false; + } + else + { + npc.noTileCollide = true; + } + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 420f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.localAI[0] = 0f; + npc.localAI[1] = 1f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + npc.localAI[2] = 1f; + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 150f) + { + npc.localAI[0] = 0f; + npc.netUpdate = true; + int damage = 70; + if (Main.expertMode) + { + damage = 55; + } + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 111); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 60, 0f, 2f, mod.ProjectileType("InkBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + } + npc.rotation = npc.velocity.X * 0.05f; + npc.velocity *= 0.975f; + float num263 = 2.5f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 20f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + return; + } + } + else + { + if (Main.rand.NextBool(300)) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); + } + npc.localAI[2] = 0f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.2f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + return; + } + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) + { + npc.active = false; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.ai[0] == 5f) - { - return false; - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.ai[0] == 5f) + { + return false; + } + return true; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.ai[0] == 5f) - { - Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, - (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Player player = Main.player[npc.target]; - player.invis = true; - player.aggro = -750; - if (player.gravDir == -1f) - { - spriteEffects |= SpriteEffects.FlipVertically; - } - Main.spriteBatch.Draw(Main.npcTexture[npc.type], - new Vector2((float)(player.direction * 4), player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - Main.screenPosition, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), npc.GetAlpha(color), npc.rotation, npc.frame.Size() / 2f, npc.scale, spriteEffects, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.ai[0] == 5f) + { + Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, + (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Player player = Main.player[npc.target]; + player.invis = true; + player.aggro = -750; + if (player.gravDir == -1f) + { + spriteEffects |= SpriteEffects.FlipVertically; + } + Main.spriteBatch.Draw(Main.npcTexture[npc.type], + new Vector2((float)(player.direction * 4), player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - Main.screenPosition, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), npc.GetAlpha(color), npc.rotation, npc.frame.Size() / 2f, npc.scale, spriteEffects, 0f); + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("ColossalSquid"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("ColossalSquid"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 600, true); - player.AddBuff(BuffID.Darkness, 600, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 300); - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 600, true); + player.AddBuff(BuffID.Darkness, 600, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 300); + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackInk, Main.rand.Next(3, 6)); - if (Main.rand.NextBool(10000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamarisLament")); - } - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(26, 39)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackInk, Main.rand.Next(3, 6)); + if (Main.rand.NextBool(10000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (CalamityWorld.downedPolterghast) + { + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamarisLament")); + } + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(26, 39)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid4"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid4"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/Cuttlefish.cs b/NPCs/AbyssNPCs/Cuttlefish.cs index 9b3023c736..b98eefd9c3 100644 --- a/NPCs/AbyssNPCs/Cuttlefish.cs +++ b/NPCs/AbyssNPCs/Cuttlefish.cs @@ -1,343 +1,342 @@ -using System; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.AbyssNPCs { public class Cuttlefish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cuttlefish"); - Main.npcFrameCount[npc.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cuttlefish"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.chaseable = false; - npc.damage = 17; - npc.width = 50; - npc.height = 28; - npc.defense = 12; - npc.lifeMax = 55; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath28; - npc.knockBackResist = 0.3f; - banner = npc.type; - bannerItem = mod.ItemType("CuttlefishBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.chaseable = false; + npc.damage = 17; + npc.width = 50; + npc.height = 28; + npc.defense = 12; + npc.lifeMax = 55; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath28; + npc.knockBackResist = 0.3f; + banner = npc.type; + bannerItem = mod.ItemType("CuttlefishBanner"); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.localAI[0] += 1f; - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - if (npc.ai[2] == 1f) - { - npc.chaseable = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet || npc.noTileCollide) - { - bool flag14 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) - { - flag14 = true; - } - if (!flag14) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[3] == 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 150f) - { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.ai[3] == 0f) - { - npc.alpha = 0; - npc.noTileCollide = false; - } - else - { - npc.alpha = 200; - npc.noTileCollide = true; - } - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; - if (npc.velocity.X > 9f) - { - npc.velocity.X = 9f; - } - if (npc.velocity.X < -9f) - { - npc.velocity.X = -9f; - } - if (npc.velocity.Y > 7f) - { - npc.velocity.Y = 7f; - } - if (npc.velocity.Y < -7f) - { - npc.velocity.Y = -7f; - } - } - else - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.25f; - if (npc.velocity.Y > 7f) - { - npc.velocity.Y = 7f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.localAI[0] += 1f; + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + if (npc.ai[2] == 1f) + { + npc.chaseable = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet || npc.noTileCollide) + { + bool flag14 = false; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + { + flag14 = true; + } + if (!flag14) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[3] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[3] == 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 150f) + { + npc.ai[3] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.ai[3] == 0f) + { + npc.alpha = 0; + npc.noTileCollide = false; + } + else + { + npc.alpha = 200; + npc.noTileCollide = true; + } + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; + if (npc.velocity.X > 9f) + { + npc.velocity.X = 9f; + } + if (npc.velocity.X < -9f) + { + npc.velocity.X = -9f; + } + if (npc.velocity.Y > 7f) + { + npc.velocity.Y = 7f; + } + if (npc.velocity.Y < -7f) + { + npc.velocity.Y = -7f; + } + } + else + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.25f; + if (npc.velocity.Y > 7f) + { + npc.velocity.Y = 7f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet && !npc.noTileCollide) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet && !npc.noTileCollide) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Darkness, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 60, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Darkness, 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 60, true); + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); } int inkBombDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 50 : 100; DropHelper.DropItemChance(npc, mod.ItemType("InkBomb"), inkBombDropRate, 1, 1); } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/DevilFish.cs b/NPCs/AbyssNPCs/DevilFish.cs index c45b063d5d..922e9ba692 100644 --- a/NPCs/AbyssNPCs/DevilFish.cs +++ b/NPCs/AbyssNPCs/DevilFish.cs @@ -1,359 +1,358 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class DevilFish : ModNPC - { - public bool hasBeenHit = false; - public bool brokenMask = false; - public int hitCounter = 0; + { + public bool hasBeenHit = false; + public bool brokenMask = false; + public int hitCounter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devil Fish"); - Main.npcFrameCount[npc.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devil Fish"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 60; - npc.width = 126; - npc.height = 66; - npc.defense = 999999; - npc.lifeMax = 200; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; - bannerItem = mod.ItemType("DevilFishBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 60; + npc.width = 126; + npc.height = 66; + npc.defense = 999999; + npc.lifeMax = 200; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.85f; + banner = npc.type; + bannerItem = mod.ItemType("DevilFishBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(brokenMask); - writer.Write(hitCounter); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(brokenMask); + writer.Write(hitCounter); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - brokenMask = reader.ReadBoolean(); - hitCounter = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + brokenMask = reader.ReadBoolean(); + hitCounter = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - Player player = Main.player[npc.target]; - float speedBoost = brokenMask ? 1.5f : 1; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - npc.chaseable = hasBeenHit; + public override void AI() + { + Player player = Main.player[npc.target]; + float speedBoost = brokenMask ? 1.5f : 1; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + npc.chaseable = hasBeenHit; - if (hitCounter >= 5 && !brokenMask) - { - brokenMask = true; - npc.HitSound = SoundID.NPCHit1; - npc.defense = 15; - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask3"), 1f); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); - } + if (hitCounter >= 5 && !brokenMask) + { + brokenMask = true; + npc.HitSound = SoundID.NPCHit1; + npc.defense = 15; + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask3"), 1f); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); + } - if (npc.wet) - { - bool flag14 = brokenMask; - npc.TargetClosest(false); - if (player.statLife <= player.statLifeMax2 / 4) - { - flag14 = true; - } - if ((!player.wet || player.dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.25f * speedBoost; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f * speedBoost; - if (npc.velocity.X > 6f * speedBoost) - { - npc.velocity.X = 6f * speedBoost; - } - if (npc.velocity.X < -6f * speedBoost) - { - npc.velocity.X = -6f * speedBoost; - } - if (npc.velocity.Y > 6f * speedBoost) - { - npc.velocity.Y = 6f * speedBoost; - } - if (npc.velocity.Y < -6f * speedBoost) - { - npc.velocity.Y = -6f * speedBoost; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } + if (npc.wet) + { + bool flag14 = brokenMask; + npc.TargetClosest(false); + if (player.statLife <= player.statLifeMax2 / 4) + { + flag14 = true; + } + if ((!player.wet || player.dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.25f * speedBoost; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f * speedBoost; + if (npc.velocity.X > 6f * speedBoost) + { + npc.velocity.X = 6f * speedBoost; + } + if (npc.velocity.X < -6f * speedBoost) + { + npc.velocity.X = -6f * speedBoost; + } + if (npc.velocity.Y > 6f * speedBoost) + { + npc.velocity.Y = 6f * speedBoost; + } + if (npc.velocity.Y < -6f * speedBoost) + { + npc.velocity.Y = -6f * speedBoost; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (!brokenMask) - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frame.Y < frameHeight * 4) - { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y > frameHeight * 7) - { - npc.frame.Y = frameHeight * 4; - } - } - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (!brokenMask) + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frame.Y < frameHeight * 4) + { + npc.frame.Y = frameHeight * 4; + } + if (npc.frame.Y > frameHeight * 7) + { + npc.frame.Y = frameHeight * 4; + } + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); - } - } - if (NPC.downedGolemBoss) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChaoticOre"), Main.rand.Next(3, 10)); - if (Main.rand.NextBool(200)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Hellborn")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); + } + } + if (NPC.downedGolemBoss) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChaoticOre"), Main.rand.Next(3, 10)); + if (Main.rand.NextBool(200)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Hellborn")); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } - if (hitCounter <= 5) - { - ++hitCounter; - } - } - } + if (hitCounter <= 5) + { + ++hitCounter; + } + } + } } diff --git a/NPCs/AbyssNPCs/EidolonWyrmBody.cs b/NPCs/AbyssNPCs/EidolonWyrmBody.cs index 8d83ac19be..8bb7f59c6b 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBody.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBody.cs @@ -7,45 +7,45 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmBody : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 48; //36 - npc.height = 58; - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 48; //36 + npc.height = 58; + npc.defense = 0; npc.lifeMax = 160000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; + npc.noGravity = true; + npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.netAlways = true; - npc.dontCountMe = true; + npc.dontCountMe = true; npc.dontTakeDamage = true; npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { npc.damage = 0; if (npc.ai[3] > 0f) { @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs index 48dc68d3f7..c61e092eab 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs @@ -7,45 +7,45 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmBodyAlt : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 48; //36 - npc.height = 58; - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 48; //36 + npc.height = 58; + npc.defense = 0; npc.lifeMax = 160000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; + npc.noGravity = true; + npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.netAlways = true; - npc.dontCountMe = true; + npc.dontCountMe = true; npc.dontTakeDamage = true; npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { npc.damage = 0; if (npc.ai[3] > 0f) { @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs index 3aab62a478..f9f085d12c 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs @@ -7,45 +7,45 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmBodyAltHuge : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 60; //36 - npc.height = 88; - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 60; //36 + npc.height = 88; + npc.defense = 0; npc.lifeMax = 1000000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; + npc.noGravity = true; + npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.netAlways = true; - npc.dontCountMe = true; + npc.dontCountMe = true; npc.dontTakeDamage = true; npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { npc.damage = 0; if (npc.ai[3] > 0f) { @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs index 35bf4ee544..3dd78ffd6e 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs @@ -7,45 +7,45 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmBodyHuge : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 60; //36 - npc.height = 88; - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 60; //36 + npc.height = 88; + npc.defense = 0; npc.lifeMax = 1000000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; + npc.noGravity = true; + npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.netAlways = true; - npc.dontCountMe = true; + npc.dontCountMe = true; npc.dontTakeDamage = true; npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { npc.damage = 0; if (npc.ai[3] > 0f) { @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs index 59aac6497a..5c8c66ec7c 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHead.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -1,562 +1,561 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmHead : ModNPC - { - public bool detectsPlayer = false; - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 5f; //10 - public float turnSpeed = 0.1f; //0.15 - bool TailSpawned = false; + { + public bool detectsPlayer = false; + public const int minLength = 40; + public const int maxLength = 41; + public float speed = 5f; //10 + public float turnSpeed = 0.1f; //0.15 + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.npcSlots = 8f; - npc.damage = 170; - npc.width = 126; //36 - npc.height = 76; //20 - npc.defense = 300; + public override void SetDefaults() + { + npc.npcSlots = 8f; + npc.damage = 170; + npc.width = 126; //36 + npc.height = 76; //20 + npc.defense = 300; npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 160000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("EidolonWyrmJuvenileBanner"); - } + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("EidolonWyrmJuvenileBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) - { - detectsPlayer = true; - npc.damage = Main.expertMode ? 340 : 170; - } - else - { - npc.damage = 0; - } - npc.chaseable = detectsPlayer; - if (detectsPlayer) - { - if (npc.soundDelay <= 0) - { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); - } - } - else - { - if (Main.rand.NextBool(900)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAlt"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTail"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int damage = 80; - if (Main.expertMode) - { - damage = 60; - } - float xPos = (Main.rand.NextBool(2) ? npc.position.X + 200f : npc.position.X - 200f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); - int random = Main.rand.Next(3); - if (random == 0) - { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (random == 1) - { - Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - else - { - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 0.6f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 0.2f; - } - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) - { - Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 1.5f; - } - if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 1.5f; - } - } - } - } - } - } - 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) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTail")) || !Main.player[npc.target].Calamity().ZoneAbyss) - { - npc.active = false; - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 600); //800 - if (!detectsPlayer) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 500f; //600 - } - else - { - num191 = Main.player[npc.target].Center.X - 500f; //600 - } - } - } - } - if (detectsPlayer) - { - num188 = 7.5f; - num189 = 0.125f; - if (!Main.player[npc.target].wet) - { - num188 = 15f; - num189 = 0.25f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) + { + detectsPlayer = true; + npc.damage = Main.expertMode ? 340 : 170; + } + else + { + npc.damage = 0; + } + npc.chaseable = detectsPlayer; + if (detectsPlayer) + { + if (npc.soundDelay <= 0) + { + npc.soundDelay = 420; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); + } + } + else + { + if (Main.rand.NextBool(900)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); + } + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAlt"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTail"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + if (detectsPlayer) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int damage = 80; + if (Main.expertMode) + { + damage = 60; + } + float xPos = (Main.rand.NextBool(2) ? npc.position.X + 200f : npc.position.X - 200f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); + int random = Main.rand.Next(3); + if (random == 0) + { + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (random == 1) + { + Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); + if (vec.HasNaNs()) + { + vec = new Vector2((float)npc.direction, 0f); + } + for (int n = 0; n < 1; n++) + { + Vector2 vector4 = vec * 4f; + Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else + { + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 0.6f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 0.2f; + } + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) + { + Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 1.5f; + } + if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 1.5f; + } + } + } + } + } + } + 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) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTail")) || !Main.player[npc.target].Calamity().ZoneAbyss) + { + npc.active = false; + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 600); //800 + if (!detectsPlayer) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 500f; //600 + } + else + { + num191 = Main.player[npc.target].Center.X - 500f; //600 + } + } + } + } + if (detectsPlayer) + { + num188 = 7.5f; + num189 = 0.125f; + if (!Main.player[npc.target].wet) + { + num188 = 15f; + num189 = 0.25f; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && - !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && + !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(30, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticHood); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticRobe); - if (Main.rand.NextBool(10000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); - } - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); - } - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(8, 13)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(6, 9)); - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(2, 4)); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(30, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticHood); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticRobe); + if (Main.rand.NextBool(10000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (CalamityWorld.downedPolterghast) + { + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); + } + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); + } + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(8, 13)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(6, 9)); + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(2, 4)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm"), 1f); + } + } - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } + public override bool CheckActive() + { + if (detectsPlayer && !Main.player[npc.target].dead) + { + return false; + } + if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == NetmodeID.Server) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 600); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 600); + } + } + } } diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs index fe7a1d0df9..6eb795961d 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -1,544 +1,543 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmHeadHuge : ModNPC - { - public bool detectsPlayer = false; - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 7.5f; //10 - public float turnSpeed = 0.15f; //0.15 - bool TailSpawned = false; + { + public bool detectsPlayer = false; + public const int minLength = 40; + public const int maxLength = 41; + public float speed = 7.5f; //10 + public float turnSpeed = 0.15f; //0.15 + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.npcSlots = 24f; - npc.damage = 1500; - npc.width = 254; //36 - npc.height = 138; //20 - npc.defense = 3000; + public override void SetDefaults() + { + npc.npcSlots = 24f; + npc.damage = 1500; + npc.width = 254; //36 + npc.height = 138; //20 + npc.defense = 3000; npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = 1000000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(10, 0, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - } + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(10, 0, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) - { - detectsPlayer = true; - npc.damage = 1500; - } - else - { - npc.damage = 0; - } - npc.chaseable = detectsPlayer; - if (detectsPlayer) - { - if (npc.soundDelay <= 0) - { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - } - else - { - if (Main.rand.NextBool(900)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyHuge"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAltHuge"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTailHuge"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int damage = Main.expertMode ? 300 : 400; - float xPos = (Main.rand.NextBool(2) ? npc.position.X + 200f : npc.position.X - 200f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); - int random = Main.rand.Next(3); - if (random == 0) - { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (random == 1) - { - Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, -vector4.X, -vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - else - { - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 0.6f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 0.2f; - } - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) - { - Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 2f; - } - if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 2f; - } - } - } - } - } - } - 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) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTailHuge"))) - { - npc.active = false; - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 600); //800 - if (!detectsPlayer) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 500f; //600 - } - else - { - num191 = Main.player[npc.target].Center.X - 500f; //600 - } - } - } - } - if (detectsPlayer) - { - num188 = 10f; - num189 = 0.175f; - if (!Main.player[npc.target].wet) - { - num188 = 20f; - num189 = 0.25f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) + { + detectsPlayer = true; + npc.damage = 1500; + } + else + { + npc.damage = 0; + } + npc.chaseable = detectsPlayer; + if (detectsPlayer) + { + if (npc.soundDelay <= 0) + { + npc.soundDelay = 420; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + } + } + else + { + if (Main.rand.NextBool(900)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + } + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyHuge"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAltHuge"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTailHuge"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + if (detectsPlayer) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int damage = Main.expertMode ? 300 : 400; + float xPos = (Main.rand.NextBool(2) ? npc.position.X + 200f : npc.position.X - 200f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); + int random = Main.rand.Next(3); + if (random == 0) + { + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(-vector2.X, -vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (random == 1) + { + Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); + if (vec.HasNaNs()) + { + vec = new Vector2((float)npc.direction, 0f); + } + for (int n = 0; n < 1; n++) + { + Vector2 vector4 = vec * 4f; + Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(-vector2.X, -vector2.Y, -vector4.X, -vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else + { + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 0.6f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 0.2f; + } + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) + { + Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 2f; + } + if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 2f; + } + } + } + } + } + } + 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) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTailHuge"))) + { + npc.active = false; + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 600); //800 + if (!detectsPlayer) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 500f; //600 + } + else + { + num191 = Main.player[npc.target].Center.X - 500f; //600 + } + } + } + } + if (detectsPlayer) + { + num188 = 10f; + num189 = 0.175f; + if (!Main.player[npc.target].wet) + { + num188 = 20f; + num189 = 0.25f; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && CalamityWorld.downedPolterghast) - { - return SpawnCondition.CaveJellyfish.Chance * 0.012f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && CalamityWorld.downedPolterghast) + { + return SpawnCondition.CaveJellyfish.Chance * 0.012f; + } + return 0f; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(80, 101)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(21, 33)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(50, 109)); - if (CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(15, 28)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(80, 101)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(21, 33)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(50, 109)); + if (CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(15, 28)); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); + } + } - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } + public override bool CheckActive() + { + if (detectsPlayer && !Main.player[npc.target].dead) + { + return false; + } + if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == NetmodeID.Server) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 1200, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 1200); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 1200, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 1200); + } + } + } } diff --git a/NPCs/AbyssNPCs/EidolonWyrmTail.cs b/NPCs/AbyssNPCs/EidolonWyrmTail.cs index d272e811f3..ca8546450e 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmTail.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmTail.cs @@ -7,45 +7,45 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmTail : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 46; //28 - npc.height = 66; //28 - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 46; //28 + npc.height = 66; //28 + npc.defense = 0; npc.lifeMax = 160000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; npc.dontTakeDamage = true; npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { npc.damage = 0; if (npc.ai[3] > 0f) { @@ -84,13 +84,13 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } if (Main.player[npc.target].dead) { npc.TargetClosest(false); @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs index 7732f85f1b..65ff51fc35 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs @@ -7,45 +7,45 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class EidolonWyrmTailHuge : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } + { + DisplayName.SetDefault("Eidolon Wyrm"); + } - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 86; //28 - npc.height = 120; //28 - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 86; //28 + npc.height = 120; //28 + npc.defense = 0; npc.lifeMax = 1000000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; npc.dontTakeDamage = true; npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { npc.damage = 0; if (npc.ai[3] > 0f) { @@ -84,13 +84,13 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } if (Main.player[npc.target].dead) { npc.TargetClosest(false); @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/Flounder.cs b/NPCs/AbyssNPCs/Flounder.cs index 45f0f61e4c..8cc302a4f3 100644 --- a/NPCs/AbyssNPCs/Flounder.cs +++ b/NPCs/AbyssNPCs/Flounder.cs @@ -1,304 +1,303 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Flounder : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flounder"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flounder"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.chaseable = false; - npc.damage = 10; - npc.width = 42; - npc.height = 32; - npc.defense = 15; - npc.lifeMax = 40; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath53; - npc.knockBackResist = 0.35f; - banner = npc.type; - bannerItem = mod.ItemType("FlounderBanner"); - } + public override void SetDefaults() + { + npc.chaseable = false; + npc.damage = 10; + npc.width = 42; + npc.height = 32; + npc.defense = 15; + npc.lifeMax = 40; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = SoundID.NPCDeath53; + npc.knockBackResist = 0.35f; + banner = npc.type; + bannerItem = mod.ItemType("FlounderBanner"); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - npc.alpha = 0; - if (npc.ai[2] == 1f) - { - npc.chaseable = true; - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - bool flag14 = false; - npc.TargetClosest(false); - if (!Main.player[npc.target].dead) - { - flag14 = true; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 2f) - { - npc.velocity.X = 2f; - } - if (npc.velocity.X < -2f) - { - npc.velocity.X = -2f; - } - if (npc.velocity.Y > 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < -1f) - { - npc.velocity.Y = -1f; - } - if ((Main.player[npc.target].Center - npc.Center).Length() < 350f) - { - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 4f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 25; - if (Main.expertMode) - { - damage = 19; - } - int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 5f) - { - npc.velocity.Y = 5f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + npc.alpha = 0; + if (npc.ai[2] == 1f) + { + npc.chaseable = true; + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + bool flag14 = false; + npc.TargetClosest(false); + if (!Main.player[npc.target].dead) + { + flag14 = true; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 2f) + { + npc.velocity.X = 2f; + } + if (npc.velocity.X < -2f) + { + npc.velocity.X = -2f; + } + if (npc.velocity.Y > 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < -1f) + { + npc.velocity.Y = -1f; + } + if ((Main.player[npc.target].Center - npc.Center).Length() < 350f) + { + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 4f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 25; + if (Main.expertMode) + { + damage = 19; + } + int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 5f) + { + npc.velocity.Y = 5f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/Frogfish.cs b/NPCs/AbyssNPCs/Frogfish.cs index 6581ac46a5..73b1b3c9b9 100644 --- a/NPCs/AbyssNPCs/Frogfish.cs +++ b/NPCs/AbyssNPCs/Frogfish.cs @@ -1,272 +1,270 @@ using System; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Frogfish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frogfish"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frogfish"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.chaseable = false; - npc.damage = 25; - npc.width = 60; - npc.height = 50; - npc.defense = 10; - npc.lifeMax = 80; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; - banner = npc.type; - bannerItem = mod.ItemType("FrogfishBanner"); - } + public override void SetDefaults() + { + npc.chaseable = false; + npc.damage = 25; + npc.width = 60; + npc.height = 50; + npc.defense = 10; + npc.lifeMax = 80; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.5f; + banner = npc.type; + bannerItem = mod.ItemType("FrogfishBanner"); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - npc.alpha = 0; - if (npc.ai[2] == 1f) - { - npc.chaseable = true; - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - bool flag14 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) - { - flag14 = true; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 3.5f) - { - npc.velocity.X = 3.5f; - } - if (npc.velocity.X < -3.5f) - { - npc.velocity.X = -3.5f; - } - if (npc.velocity.Y > 1.5f) - { - npc.velocity.Y = 1.5f; - } - if (npc.velocity.Y < -1.5f) - { - npc.velocity.Y = -1.5f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 5f) - { - npc.velocity.Y = 5f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + npc.alpha = 0; + if (npc.ai[2] == 1f) + { + npc.chaseable = true; + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + bool flag14 = false; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + { + flag14 = true; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 3.5f) + { + npc.velocity.X = 3.5f; + } + if (npc.velocity.X < -3.5f) + { + npc.velocity.X = -3.5f; + } + if (npc.velocity.Y > 1.5f) + { + npc.velocity.Y = 1.5f; + } + if (npc.velocity.Y < -1.5f) + { + npc.velocity.Y = -1.5f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 5f) + { + npc.velocity.Y = 5f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 180, true); + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OceanMonster.Chance * 0.2f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OceanMonster.Chance * 0.2f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/GiantSquid.cs b/NPCs/AbyssNPCs/GiantSquid.cs index ca3f08daa0..12576c46a6 100644 --- a/NPCs/AbyssNPCs/GiantSquid.cs +++ b/NPCs/AbyssNPCs/GiantSquid.cs @@ -1,292 +1,291 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class GiantSquid : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Squid"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Squid"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 80; - npc.width = 50; - npc.height = 220; - npc.defense = 25; - npc.lifeMax = 400; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("GiantSquidBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 80; + npc.width = 50; + npc.height = 220; + npc.defense = 25; + npc.lifeMax = 400; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 15, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("GiantSquidBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (!npc.wet) - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - return; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - npc.TargetClosest(false); - if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + public override void AI() + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (!npc.wet) + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + return; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + npc.TargetClosest(false); + if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(500f, 300f)) || npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - npc.rotation = npc.velocity.X * 0.02f; - if (hasBeenHit) - { - npc.localAI[2] = 1f; - npc.velocity *= 0.975f; - float num263 = 1.6f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 16f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - return; - } - } - else - { - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - return; - } - } - } + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + npc.rotation = npc.velocity.X * 0.02f; + if (hasBeenHit) + { + npc.localAI[2] = 1f; + npc.velocity *= 0.975f; + float num263 = 1.6f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 16f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + return; + } + } + else + { + npc.localAI[2] = 0f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + return; + } + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Cyan); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Cyan); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 5)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 5)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid4"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid4"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/Gnasher.cs b/NPCs/AbyssNPCs/Gnasher.cs index 23a62d2ce5..181fbb4b6c 100644 --- a/NPCs/AbyssNPCs/Gnasher.cs +++ b/NPCs/AbyssNPCs/Gnasher.cs @@ -1,40 +1,38 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Gnasher : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gnasher"); - Main.npcFrameCount[npc.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gnasher"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.damage = 25; - npc.width = 50; - npc.height = 36; - npc.defense = 30; + public override void SetDefaults() + { + npc.damage = 25; + npc.width = 50; + npc.height = 36; + npc.defense = 30; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 35; + npc.lifeMax = 35; npc.knockBackResist = 0.25f; npc.aiStyle = 3; - aiType = 67; - npc.value = Item.buyPrice(0, 0, 0, 60); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath54; + aiType = 67; + npc.value = Item.buyPrice(0, 0, 0, 60); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = SoundID.NPCDeath54; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } - banner = npc.type; - bannerItem = mod.ItemType("GnasherBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("GnasherBanner"); + } public override void AI() { @@ -116,20 +114,20 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher2"), 1f); } - } - } + } + } } diff --git a/NPCs/AbyssNPCs/GulperEelBody.cs b/NPCs/AbyssNPCs/GulperEelBody.cs index f0e47e93aa..6f492a3315 100644 --- a/NPCs/AbyssNPCs/GulperEelBody.cs +++ b/NPCs/AbyssNPCs/GulperEelBody.cs @@ -7,46 +7,46 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class GulperEelBody : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } + { + DisplayName.SetDefault("Gulper Eel"); + } - public override void SetDefaults() - { - npc.damage = 90; //70 - npc.width = 56; //36 - npc.height = 36; - npc.defense = 80; + public override void SetDefaults() + { + npc.damage = 90; //70 + npc.width = 56; //36 + npc.height = 36; + npc.defense = 80; npc.lifeMax = 80000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + npc.dontCountMe = true; npc.chaseable = false; - banner = mod.NPCType("GulperEelHead"); - bannerItem = mod.ItemType("GulperEelBanner"); - } + banner = mod.NPCType("GulperEelHead"); + bannerItem = mod.ItemType("GulperEelBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/GulperEelBodyAlt.cs b/NPCs/AbyssNPCs/GulperEelBodyAlt.cs index a35467243f..b4a7ebf84d 100644 --- a/NPCs/AbyssNPCs/GulperEelBodyAlt.cs +++ b/NPCs/AbyssNPCs/GulperEelBodyAlt.cs @@ -7,46 +7,46 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class GulperEelBodyAlt : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } + { + DisplayName.SetDefault("Gulper Eel"); + } - public override void SetDefaults() - { - npc.damage = 90; //70 - npc.width = 36; //36 - npc.height = 36; - npc.defense = 80; + public override void SetDefaults() + { + npc.damage = 90; //70 + npc.width = 36; //36 + npc.height = 36; + npc.defense = 80; npc.lifeMax = 80000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + npc.dontCountMe = true; npc.chaseable = false; - banner = mod.NPCType("GulperEelHead"); - bannerItem = mod.ItemType("GulperEelBanner"); - } + banner = mod.NPCType("GulperEelHead"); + bannerItem = mod.ItemType("GulperEelBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs index 4c7d9c680f..5b7997a770 100644 --- a/NPCs/AbyssNPCs/GulperEelHead.cs +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -1,17 +1,16 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class GulperEelHead : ModNPC - { + { public bool detectsPlayer = false; public const int minLength = 20; public const int maxLength = 21; @@ -20,322 +19,322 @@ namespace CalamityMod.NPCs.AbyssNPCs bool TailSpawned = false; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } + { + DisplayName.SetDefault("Gulper Eel"); + } - public override void SetDefaults() - { - npc.damage = 135; - npc.width = 66; //36 - npc.height = 86; //20 - npc.defense = 50; - npc.lifeMax = 80000; - npc.aiStyle = -1; + public override void SetDefaults() + { + npc.damage = 135; + npc.width = 66; //36 + npc.height = 86; //20 + npc.defense = 50; + npc.lifeMax = 80000; + npc.aiStyle = -1; aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("GulperEelBanner"); - } + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("GulperEelBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { + public override void AI() + { //if ((Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 100f : 600f) * - // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) || + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 100f : 600f) * + // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) || if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(600f, 100f) || - npc.justHit) - { - detectsPlayer = true; - } - npc.chaseable = detectsPlayer; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBodyAlt"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelTail"), 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(23, -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.AnyNPCs(mod.NPCType("GulperEelTail"))) - { - npc.active = false; - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 400); //800 - if (!detectsPlayer) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 300f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 400f; - } - else - { - num191 = Main.player[npc.target].Center.X - 400f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + npc.justHit) + { + detectsPlayer = true; + } + npc.chaseable = detectsPlayer; + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBodyAlt"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelTail"), 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(23, -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.AnyNPCs(mod.NPCType("GulperEelTail"))) + { + npc.active = false; + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 400); //800 + if (!detectsPlayer) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 300f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 400f; + } + else + { + num191 = Main.player[npc.target].Center.X - 400f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } public override bool? CanBeHitByProjectile(Projectile projectile) { @@ -367,12 +366,12 @@ namespace CalamityMod.NPCs.AbyssNPCs { if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } return 0f; } @@ -404,20 +403,20 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel"), 1f); } - } + } public override bool CheckActive() { @@ -450,5 +449,5 @@ namespace CalamityMod.NPCs.AbyssNPCs player.AddBuff(mod.BuffType("Horror"), 180, true); } } - } + } } diff --git a/NPCs/AbyssNPCs/GulperEelTail.cs b/NPCs/AbyssNPCs/GulperEelTail.cs index dbc6c227cf..301715ce56 100644 --- a/NPCs/AbyssNPCs/GulperEelTail.cs +++ b/NPCs/AbyssNPCs/GulperEelTail.cs @@ -7,46 +7,46 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class GulperEelTail : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } + { + DisplayName.SetDefault("Gulper Eel"); + } - public override void SetDefaults() - { - npc.damage = 65; //70 - npc.width = 54; //28 - npc.height = 76; //28 - npc.defense = 100; + public override void SetDefaults() + { + npc.damage = 65; //70 + npc.width = 54; //28 + npc.height = 76; //28 + npc.defense = 100; npc.lifeMax = 80000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + npc.dontCountMe = true; npc.chaseable = false; - banner = mod.NPCType("GulperEelHead"); - bannerItem = mod.ItemType("GulperEelBanner"); - } + banner = mod.NPCType("GulperEelHead"); + bannerItem = mod.ItemType("GulperEelBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -84,13 +84,13 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } if (Main.player[npc.target].dead) { npc.TargetClosest(false); @@ -112,8 +112,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -159,12 +158,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/AbyssNPCs/Laserfish.cs b/NPCs/AbyssNPCs/Laserfish.cs index a916dc37f6..a4a9e7e0b2 100644 --- a/NPCs/AbyssNPCs/Laserfish.cs +++ b/NPCs/AbyssNPCs/Laserfish.cs @@ -1,322 +1,321 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Laserfish : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laserfish"); - Main.npcFrameCount[npc.type] = 12; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laserfish"); + Main.npcFrameCount[npc.type] = 12; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 20; - npc.width = 60; - npc.height = 26; - npc.defense = 25; - npc.lifeMax = 240; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath26; - npc.knockBackResist = 0.65f; - banner = npc.type; - bannerItem = mod.ItemType("LaserfishBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 20; + npc.width = 60; + npc.height = 26; + npc.defense = 25; + npc.lifeMax = 240; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit51; + npc.DeathSound = SoundID.NPCDeath26; + npc.knockBackResist = 0.65f; + banner = npc.type; + bannerItem = mod.ItemType("LaserfishBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 400f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(400f, 200f)) { - flag14 = true; - } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 40; - if (Main.expertMode) - { - damage = 30; - } - int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 15f : -15f), npc.Center.Y, num6, num7, 259, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].tileCollide = true; - } - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.1) - { - npc.rotation = -0.1f; - } - if ((double)npc.rotation > 0.1) - { - npc.rotation = 0.1f; - return; - } - } + flag14 = true; + } + if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 4f) + { + npc.velocity.X = 4f; + } + if (npc.velocity.X < -4f) + { + npc.velocity.X = -4f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 40; + if (Main.expertMode) + { + damage = 30; + } + int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 15f : -15f), npc.Center.Y, num6, num7, 259, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].tileCollide = true; + } + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.1) + { + npc.rotation = -0.1f; + } + if ((double)npc.rotation > 0.1) + { + npc.rotation = 0.1f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish3"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish3"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/LuminousCorvina.cs b/NPCs/AbyssNPCs/LuminousCorvina.cs index 585fe49ffa..c673ac2a3e 100644 --- a/NPCs/AbyssNPCs/LuminousCorvina.cs +++ b/NPCs/AbyssNPCs/LuminousCorvina.cs @@ -1,321 +1,320 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class LuminousCorvina : ModNPC - { - private bool hasBeenHit = false; - private int screamTimer = 0; + { + private bool hasBeenHit = false; + private int screamTimer = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Luminous Corvina"); - Main.npcFrameCount[npc.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Luminous Corvina"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 10; - npc.width = 74; - npc.height = 56; - npc.defense = 20; - npc.lifeMax = 800; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; - bannerItem = mod.ItemType("LuminousCorvinaBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 10; + npc.width = 74; + npc.height = 56; + npc.defense = 20; + npc.lifeMax = 800; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 15, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.85f; + banner = npc.type; + bannerItem = mod.ItemType("LuminousCorvinaBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(screamTimer); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(screamTimer); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - screamTimer = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + screamTimer = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height) && ((npc.Center.X - 15f < Main.player[npc.target].Center.X && - npc.direction == 1) || (npc.Center.X + 15f > Main.player[npc.target].Center.X && npc.direction == -1))) || - (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height) && flag14)) - { - ++screamTimer; + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if ((Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height) && ((npc.Center.X - 15f < Main.player[npc.target].Center.X && + npc.direction == 1) || (npc.Center.X + 15f > Main.player[npc.target].Center.X && npc.direction == -1))) || + (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height) && flag14)) + { + ++screamTimer; - if (screamTimer >= 300) - { - if (screamTimer == 300) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CorvinaScream"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("FishAlert"), 360, true); - } - } - } - if (screamTimer >= 360) - { - screamTimer = 0; - } - return; - } - } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } + if (screamTimer >= 300) + { + if (screamTimer == 300) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CorvinaScream"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].AddBuff(mod.BuffType("FishAlert"), 360, true); + } + } + } + if (screamTimer >= 360) + { + screamTimer = 0; + } + return; + } + } + if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (screamTimer <= 300) - { - if (npc.frame.Y > frameHeight * 5) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frame.Y < frameHeight * 6) - { - npc.frame.Y = frameHeight * 6; - } - if (npc.frame.Y > frameHeight * 7) - { - npc.frame.Y = frameHeight * 6; - } - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (screamTimer <= 300) + { + if (npc.frame.Y > frameHeight * 5) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frame.Y < frameHeight * 6) + { + npc.frame.Y = frameHeight * 6; + } + if (npc.frame.Y > frameHeight * 7) + { + npc.frame.Y = frameHeight * 6; + } + } - } + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 180, true); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(8, 16)); - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(8, 16)); + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/MantisShrimp.cs b/NPCs/AbyssNPCs/MantisShrimp.cs index 7e0f112d6e..a2e7555230 100644 --- a/NPCs/AbyssNPCs/MantisShrimp.cs +++ b/NPCs/AbyssNPCs/MantisShrimp.cs @@ -1,36 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class MantisShrimp : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mantis Shrimp"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mantis Shrimp"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 200; - npc.width = 40; - npc.height = 24; - npc.defense = 10; + public override void SetDefaults() + { + npc.damage = 200; + npc.width = 40; + npc.height = 24; + npc.defense = 10; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 30; + npc.lifeMax = 30; npc.aiStyle = 3; - aiType = 67; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + aiType = 67; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; npc.buffImmune[189] = true; - banner = npc.type; - bannerItem = mod.ItemType("MantisShrimpBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("MantisShrimpBanner"); + } public override void AI() { @@ -110,18 +108,18 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/Mauler.cs b/NPCs/AbyssNPCs/Mauler.cs index 554d4476a3..005ac0c286 100644 --- a/NPCs/AbyssNPCs/Mauler.cs +++ b/NPCs/AbyssNPCs/Mauler.cs @@ -1,403 +1,402 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Mauler : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mauler"); - Main.npcFrameCount[npc.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mauler"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 135; - npc.width = 180; - npc.height = 90; - npc.defense = 50; + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 135; + npc.width = 180; + npc.height = 90; + npc.defense = 50; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = 165000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("MaulerBanner"); - } + npc.lifeMax = 165000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath60; + npc.knockBackResist = 0f; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("MaulerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < 300f) - { - flag14 = true; - } - if (Main.player[npc.target].dead && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] += 1f; - } - else - { - if (npc.localAI[1] > 0f) - { - npc.localAI[1] -= 1f; - } - } - npc.localAI[2] += 1f; - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.5f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.25f; - if (npc.velocity.X > 22f) - { - npc.velocity.X = 22f; - } - if (npc.velocity.X < -22f) - { - npc.velocity.X = -22f; - } - if (npc.velocity.Y > 13f) - { - npc.velocity.Y = 13f; - } - if (npc.velocity.Y < -13f) - { - npc.velocity.Y = -13f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - if (npc.velocity.X < -4f || npc.velocity.X > 4f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - npc.localAI[1] += 1f; - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 30f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 12f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 50; - if (Main.expertMode) - { - damage = 45; - } - int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 60f : -60f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (npc.velocity.Y == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.velocity.Y = (float)Main.rand.Next(-200, -150) * 0.1f; //50 20 - npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; //20 20 - npc.netUpdate = true; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; //0.4 - if (npc.velocity.Y > 16f) - { - npc.velocity.Y = 16f; - } - npc.ai[0] = 1f; - } - if (hasBeenHit) - { - if (Main.rand.NextBool(300)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.localAI[1] >= 255f || npc.localAI[2] >= 600f) - { - npc.localAI[2] = 0f; - BlowUp(); - return; - } - else if (npc.localAI[1] > 0f) - { - for (int k = 0; k < (int)((double)npc.localAI[1] * 0.05); k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 0, default, 1f); - } - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < 300f) + { + flag14 = true; + } + if (Main.player[npc.target].dead && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] += 1f; + } + else + { + if (npc.localAI[1] > 0f) + { + npc.localAI[1] -= 1f; + } + } + npc.localAI[2] += 1f; + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.5f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.25f; + if (npc.velocity.X > 22f) + { + npc.velocity.X = 22f; + } + if (npc.velocity.X < -22f) + { + npc.velocity.X = -22f; + } + if (npc.velocity.Y > 13f) + { + npc.velocity.Y = 13f; + } + if (npc.velocity.Y < -13f) + { + npc.velocity.Y = -13f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + if (npc.velocity.X < -4f || npc.velocity.X > 4f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + npc.localAI[1] += 1f; + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 30f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 12f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 50; + if (Main.expertMode) + { + damage = 45; + } + int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 60f : -60f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (npc.velocity.Y == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.velocity.Y = (float)Main.rand.Next(-200, -150) * 0.1f; //50 20 + npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; //20 20 + npc.netUpdate = true; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; //0.4 + if (npc.velocity.Y > 16f) + { + npc.velocity.Y = 16f; + } + npc.ai[0] = 1f; + } + if (hasBeenHit) + { + if (Main.rand.NextBool(300)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)npc.position.X, (int)npc.position.Y); + } + } + if (npc.localAI[1] >= 255f || npc.localAI[2] >= 600f) + { + npc.localAI[2] = 0f; + BlowUp(); + return; + } + else if (npc.localAI[1] > 0f) + { + for (int k = 0; k < (int)((double)npc.localAI[1] * 0.05); k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 0, default, 1f); + } + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public void BlowUp() - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 60); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - int damageBoom = (npc.localAI[1] >= 255f ? 200 : 50); - for (iBoom = 0; iBoom < 25; iBoom++) - { - int projectileType = (Main.rand.NextBool(2) ? mod.ProjectileType("SulphuricAcidMist") : mod.ProjectileType("SulphuricAcidCannon")); - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - } - for (int num621 = 0; num621 < 25; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - Main.dust[num622].noGravity = true; - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - if (npc.localAI[1] >= 255f) - { - npc.active = false; - } - npc.netUpdate = true; - } + public void BlowUp() + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 60); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = (npc.localAI[1] >= 255f ? 200 : 50); + for (iBoom = 0; iBoom < 25; iBoom++) + { + int projectileType = (Main.rand.NextBool(2) ? mod.ProjectileType("SulphuricAcidMist") : mod.ProjectileType("SulphuricAcidCannon")); + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + for (int num621 = 0; num621 < 25; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + if (npc.localAI[1] >= 255f) + { + npc.active = false; + } + npc.netUpdate = true; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Venom, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 300, true); + player.AddBuff(BuffID.Venom, 300, true); + player.AddBuff(BuffID.Rabies, 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } - public override void NPCLoot() - { - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SulphuricAcidCannon")); - } - } - int item = Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); - Main.item[item].color = new Color(151, 115, 57, 255); - NetMessage.SendData(88, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); - } + public override void NPCLoot() + { + if (CalamityWorld.downedPolterghast) + { + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SulphuricAcidCannon")); + } + } + int item = Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); + Main.item[item].color = new Color(151, 115, 57, 255); + NetMessage.SendData(88, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Mauler")) && - !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) - { - if (!Main.hardMode) - { - return 0.001f; - } - if (!NPC.downedMoonlord) - { - return 0.01f; - } - return 0.1f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Mauler")) && + !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) + { + if (!Main.hardMode) + { + return 0.001f; + } + if (!NPC.downedMoonlord) + { + return 0.01f; + } + return 0.1f; + } + return 0f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler5"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler5"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/MirageJelly.cs b/NPCs/AbyssNPCs/MirageJelly.cs index f18893cc4a..011c117244 100644 --- a/NPCs/AbyssNPCs/MirageJelly.cs +++ b/NPCs/AbyssNPCs/MirageJelly.cs @@ -1,260 +1,260 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class MirageJelly : ModNPC - { - private bool teleporting = false; - private bool rephasing = false; - private bool hasBeenHit = false; + { + private bool teleporting = false; + private bool rephasing = false; + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mirage Jelly"); - Main.npcFrameCount[npc.type] = 7; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mirage Jelly"); + Main.npcFrameCount[npc.type] = 7; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.damage = 80; - npc.width = 70; - npc.height = 162; - npc.defense = 10; - npc.lifeMax = 6000; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("MirageJellyBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.damage = 80; + npc.width = 70; + npc.height = 162; + npc.defense = 10; + npc.lifeMax = 6000; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("MirageJellyBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(teleporting); - writer.Write(rephasing); - writer.Write(npc.chaseable); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(teleporting); + writer.Write(rephasing); + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - teleporting = reader.ReadBoolean(); - rephasing = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + teleporting = reader.ReadBoolean(); + rephasing = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - npc.velocity *= 0.985f; - if (npc.velocity.Y > -0.3f) - { - npc.velocity.Y = -3f; - } - if (npc.justHit) - { - if (Main.rand.NextBool(10)) - { - teleporting = true; - } - hasBeenHit = true; - } - if (npc.ai[0] == 0f) - { - npc.chaseable = true; - npc.dontTakeDamage = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (teleporting) - { - teleporting = false; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; + public override void AI() + { + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + npc.velocity *= 0.985f; + if (npc.velocity.Y > -0.3f) + { + npc.velocity.Y = -3f; + } + if (npc.justHit) + { + if (Main.rand.NextBool(10)) + { + teleporting = true; + } + hasBeenHit = true; + } + if (npc.ai[0] == 0f) + { + npc.chaseable = true; + npc.dontTakeDamage = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (teleporting) + { + teleporting = false; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)player.Center.X / 16; + num1251 = (int)player.Center.Y / 16; - int min = 9; - int max = 16; + int min = 9; + int max = 16; - if (Main.rand.NextBool(2)) - num1250 += Main.rand.Next(min, max); - else - num1250 -= Main.rand.Next(min, max); + if (Main.rand.NextBool(2)) + num1250 += Main.rand.Next(min, max); + else + num1250 -= Main.rand.Next(min, max); - num1251 += Main.rand.Next(min, max); + num1251 += Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height) && - Main.tile[num1250, num1251].liquid > 204) - { - break; - } - if (num1249 > 100) - { - goto Block; - } - } - npc.ai[0] = 1f; - npc.ai[1] = (float)num1250; - npc.ai[2] = (float)num1251; - npc.netUpdate = true; - Block:; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.alpha += 5; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= 5; - if (npc.alpha <= 0) - { - npc.damage = Main.expertMode ? 160 : 80; - npc.chaseable = true; - npc.dontTakeDamage = false; - npc.alpha = 0; - npc.ai[0] = 0f; - npc.netUpdate = true; - } - } - } + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height) && + Main.tile[num1250, num1251].liquid > 204) + { + break; + } + if (num1249 > 100) + { + goto Block; + } + } + npc.ai[0] = 1f; + npc.ai[1] = (float)num1250; + npc.ai[2] = (float)num1251; + npc.netUpdate = true; + Block: + ; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.alpha += 5; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= 5; + if (npc.alpha <= 0) + { + npc.damage = Main.expertMode ? 160 : 80; + npc.chaseable = true; + npc.dontTakeDamage = false; + npc.alpha = 0; + npc.ai[0] = 0f; + npc.netUpdate = true; + } + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Purple); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Purple); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.1f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.1f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - } - if (Main.expertMode) - { - if (Main.rand.NextBool(5)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); - } - if (Main.rand.NextBool(5)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - if (Main.rand.NextBool(5)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); - } - } - else - { - if (Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); - } - if (Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - if (Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + } + if (Main.expertMode) + { + if (Main.rand.NextBool(5)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); + } + if (Main.rand.NextBool(5)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + if (Main.rand.NextBool(5)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); + } + } + else + { + if (Main.rand.NextBool(7)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); + } + if (Main.rand.NextBool(7)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + if (Main.rand.NextBool(7)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 240, true); - player.AddBuff(BuffID.Electrified, 60, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 240, true); + player.AddBuff(BuffID.Electrified, 60, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/MorayEel.cs b/NPCs/AbyssNPCs/MorayEel.cs index 23b61864f5..890890a53c 100644 --- a/NPCs/AbyssNPCs/MorayEel.cs +++ b/NPCs/AbyssNPCs/MorayEel.cs @@ -1,289 +1,288 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class MorayEel : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moray Eel"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moray Eel"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 45; - npc.width = 136; - npc.height = 40; - npc.defense = 8; - npc.lifeMax = 180; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.75f; - banner = npc.type; - bannerItem = mod.ItemType("MorayEelBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 45; + npc.width = 136; + npc.height = 40; + npc.defense = 8; + npc.lifeMax = 180; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.75f; + banner = npc.type; + bannerItem = mod.ItemType("MorayEelBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 250f : 300f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(300f, 250f)) { - flag14 = true; - } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 6f) - { - npc.velocity.X = 6f; - } - if (npc.velocity.X < -6f) - { - npc.velocity.X = -6f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2f || npc.velocity.X > 2f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } + flag14 = true; + } + if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 6f) + { + npc.velocity.X = 6f; + } + if (npc.velocity.X < -6f) + { + npc.velocity.X = -6f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2f || npc.velocity.X > 2f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 90, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 90, true); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return SpawnCondition.OceanMonster.Chance * 0.1f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return SpawnCondition.OceanMonster.Chance * 0.1f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(25)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Flipper); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(25)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Flipper); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/OarfishBody.cs b/NPCs/AbyssNPCs/OarfishBody.cs index a461949851..c7ba5db3fa 100644 --- a/NPCs/AbyssNPCs/OarfishBody.cs +++ b/NPCs/AbyssNPCs/OarfishBody.cs @@ -6,46 +6,46 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class OarfishBody : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oarfish"); - } + { + DisplayName.SetDefault("Oarfish"); + } - public override void SetDefaults() - { - npc.damage = 20; //70 - npc.width = 16; //28 - npc.height = 16; //28 - npc.defense = 20; + public override void SetDefaults() + { + npc.damage = 20; //70 + npc.width = 16; //28 + npc.height = 16; //28 + npc.defense = 20; npc.lifeMax = 2000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = 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 = mod.NPCType("OarfishHead"); - bannerItem = mod.ItemType("OarfishBanner"); - } + banner = mod.NPCType("OarfishHead"); + bannerItem = mod.ItemType("OarfishBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -111,8 +111,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -141,12 +140,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -159,5 +158,5 @@ namespace CalamityMod.NPCs.AbyssNPCs } } } - } + } } diff --git a/NPCs/AbyssNPCs/OarfishHead.cs b/NPCs/AbyssNPCs/OarfishHead.cs index 7e6a84958d..207542ff18 100644 --- a/NPCs/AbyssNPCs/OarfishHead.cs +++ b/NPCs/AbyssNPCs/OarfishHead.cs @@ -1,393 +1,392 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class OarfishHead : ModNPC - { - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 3f; //10 - public float turnSpeed = 0.05f; //0.15 - bool TailSpawned = false; + { + public const int minLength = 40; + public const int maxLength = 41; + public float speed = 3f; //10 + public float turnSpeed = 0.05f; //0.15 + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oarfish"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oarfish"); + } - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 16; //36 - npc.height = 16; //20 - npc.defense = 10; - npc.lifeMax = 2000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 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 = mod.ItemType("OarfishBanner"); - } + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 16; //36 + npc.height = 16; //20 + npc.defense = 10; + npc.lifeMax = 2000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 10, 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 = mod.ItemType("OarfishBanner"); + } - public override void AI() - { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishTail"), 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(23, -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.AnyNPCs(mod.NPCType("OarfishTail"))) - { - npc.active = false; - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 200); //800 - //if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * - // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + public override void AI() + { + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishTail"), 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(23, -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.AnyNPCs(mod.NPCType("OarfishTail"))) + { + npc.active = false; + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 200); //800 + //if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * + // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(250f, 150f)) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 300f; - } - else - { - num191 = Main.player[npc.target].Center.X - 300f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 300f; + } + else + { + num191 = Main.player[npc.target].Center.X - 300f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } //if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * - // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * + // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(250f, 150f)) { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(3, 6)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(3, 6)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } + public override bool CheckActive() + { + if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == NetmodeID.Server) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 90); - player.AddBuff(mod.BuffType("Horror"), 90, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 90); + player.AddBuff(mod.BuffType("Horror"), 90, true); + } + } + } } diff --git a/NPCs/AbyssNPCs/OarfishTail.cs b/NPCs/AbyssNPCs/OarfishTail.cs index 924a26dea2..f84208b6ec 100644 --- a/NPCs/AbyssNPCs/OarfishTail.cs +++ b/NPCs/AbyssNPCs/OarfishTail.cs @@ -6,46 +6,46 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AbyssNPCs { public class OarfishTail : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oarfish"); - } + { + DisplayName.SetDefault("Oarfish"); + } - public override void SetDefaults() - { - npc.damage = 10; //70 - npc.width = 14; //28 - npc.height = 16; //28 - npc.defense = 30; + public override void SetDefaults() + { + npc.damage = 10; //70 + npc.width = 14; //28 + npc.height = 16; //28 + npc.defense = 30; npc.lifeMax = 2000; npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = 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 = mod.NPCType("OarfishHead"); - bannerItem = mod.ItemType("OarfishBanner"); - } + banner = mod.NPCType("OarfishHead"); + bannerItem = mod.ItemType("OarfishBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -83,13 +83,13 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } if (Main.player[npc.target].dead) { npc.TargetClosest(false); @@ -111,8 +111,7 @@ namespace CalamityMod.NPCs.AbyssNPCs vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch + } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; @@ -141,12 +140,12 @@ namespace CalamityMod.NPCs.AbyssNPCs } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -159,5 +158,5 @@ namespace CalamityMod.NPCs.AbyssNPCs } } } - } + } } diff --git a/NPCs/AbyssNPCs/Reaper.cs b/NPCs/AbyssNPCs/Reaper.cs index 00fe508500..3811c70135 100644 --- a/NPCs/AbyssNPCs/Reaper.cs +++ b/NPCs/AbyssNPCs/Reaper.cs @@ -1,154 +1,153 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Reaper : ModNPC - { - public bool hasBeenHit = false; - public bool reset = false; - public bool reset2 = false; + { + public bool hasBeenHit = false; + public bool reset = false; + public bool reset2 = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaper Shark"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaper Shark"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 6f; - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 160; - npc.width = 280; - npc.height = 150; - npc.defense = 70; - npc.lifeMax = 190000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.timeLeft = NPC.activeTime * 30; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("ReaperSharkBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 6f; + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 160; + npc.width = 280; + npc.height = 150; + npc.defense = 70; + npc.lifeMax = 190000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.timeLeft = NPC.activeTime * 30; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + npc.knockBackResist = 0f; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("ReaperSharkBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(reset); - writer.Write(reset2); - writer.Write(hasBeenHit); - writer.Write(npc.localAI[0]); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(reset); + writer.Write(reset2); + writer.Write(hasBeenHit); + writer.Write(npc.localAI[0]); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - reset = reader.ReadBoolean(); - reset2 = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + reset = reader.ReadBoolean(); + reset2 = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - bool phase1 = (double)npc.life > (double)npc.lifeMax * 0.5; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.1; - npc.chaseable = hasBeenHit; - if (npc.soundDelay <= 0) - { - npc.soundDelay = 360; - if (hasBeenHit) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); - } - else - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (phase3 || phase1) - { - if (!reset2 && phase3) - { - npc.damage /= 2; - npc.noTileCollide = true; - npc.netAlways = true; - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = -16f; - npc.ai[3] = 0f; - reset2 = true; - npc.netUpdate = true; - } - npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.localAI[0] += 1f; - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - if (npc.ai[2] == 1f) - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet || npc.noTileCollide) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((!Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + public override void AI() + { + bool phase1 = (double)npc.life > (double)npc.lifeMax * 0.5; + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.1; + npc.chaseable = hasBeenHit; + if (npc.soundDelay <= 0) + { + npc.soundDelay = 360; + if (hasBeenHit) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); + } + else + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)npc.position.X, (int)npc.position.Y); + } + } + if (phase3 || phase1) + { + if (!reset2 && phase3) + { + npc.damage /= 2; + npc.noTileCollide = true; + npc.netAlways = true; + npc.localAI[0] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = -16f; + npc.ai[3] = 0f; + reset2 = true; + npc.netUpdate = true; + } + npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.localAI[0] += 1f; + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + if (npc.ai[2] == 1f) + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet || npc.noTileCollide) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if ((!Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) @@ -157,560 +156,560 @@ namespace CalamityMod.NPCs.AbyssNPCs { hasBeenHit = true; - } - if (!flag14) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[3] == 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 90f) - { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.ai[3] == 0f) - { - npc.noTileCollide = false; - } - else - { - npc.noTileCollide = true; - } - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.3f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; - float speedX = (phase3 ? 3f : 12f); - float speedY = (phase3 ? 2.25f : 9f); - if (npc.velocity.X > speedX) - { - npc.velocity.X = speedX; - } - if (npc.velocity.X < -speedX) - { - npc.velocity.X = -speedX; - } - if (npc.velocity.Y > speedY) - { - npc.velocity.Y = speedY; - } - if (npc.velocity.Y < -speedY) - { - npc.velocity.Y = -speedY; - } - } - else - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - if (npc.velocity.X < -4f || npc.velocity.X > 4f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.velocity.Y = (float)Main.rand.Next(-250, -180) * 0.1f; //50 20 - npc.velocity.X = (float)Main.rand.Next(-50, 50) * 0.1f; //20 20 - npc.netUpdate = true; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.velocity.Y > 16f) - { - npc.velocity.Y = 16f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } - else if (phase2) - { - if (!reset) - { - npc.noTileCollide = true; - npc.netAlways = true; - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - reset = true; - npc.netUpdate = true; - } - bool expertMode = Main.expertMode; - int num2 = 30; - float num3 = expertMode ? 0.4f : 0.35f; - float scaleFactor = expertMode ? 6f : 5.5f; - int num4 = expertMode ? 28 : 30; - float num5 = expertMode ? 12f : 11f; - int num9 = 90; - int num16 = 75; - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - npc.ai[0] = 0f; - npc.ai[2] = 0f; - } - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); - if (npc.spriteDirection == 1) - { - num17 += 3.14159274f; - } - if (num17 < 0f) - { - num17 += 6.28318548f; - } - if (num17 > 6.28318548f) - { - num17 -= 6.28318548f; - } - if (npc.ai[0] == -1f) - { - num17 = 0f; - } - float num18 = 0.04f; - if (npc.ai[0] == 1f) - { - num18 = 0f; - } - if (npc.rotation < num17) - { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) - { - npc.rotation -= num18; - } - else - { - npc.rotation += num18; - } - } - if (npc.rotation > num17) - { - if ((double)(npc.rotation - num17) > 3.1415926535897931) - { - npc.rotation += num18; - } - else - { - npc.rotation -= num18; - } - } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - { - npc.rotation = num17; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.28318548f; - } - if (npc.rotation > 6.28318548f) - { - npc.rotation -= 6.28318548f; - } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - { - npc.rotation = num17; - } - if (npc.ai[0] != -1f) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.alpha += 15; - } - else - { - npc.alpha -= 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[0] == -1f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - int num19 = Math.Sign(player.Center.X - vector.X); - if (num19 != 0) - { - npc.direction = num19; - npc.spriteDirection = -npc.direction; - } - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.alpha += 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[2] == (float)(num9 - 30)) - { - int num20 = 36; - for (int i = 0; i < num20; i++) - { - Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + npc.Center; - Vector2 vector2 = expr_80F - npc.Center; - int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); - Main.dust[num21].noGravity = true; - Main.dust[num21].noLight = true; - Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; - } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num16) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 0f && !player.dead) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - } - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X = npc.velocity.X + num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - { - npc.velocity.X = npc.velocity.X + num3; - } - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X = npc.velocity.X - num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - { - npc.velocity.X = npc.velocity.X - num3; - } - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y = npc.velocity.Y + num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num3; - } - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y = npc.velocity.Y - num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num3; - } - } - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) - { - if (npc.ai[2] == 0f && num22 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num22; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vector) * num5; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num22 != 0) - { - npc.direction = num22; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 1f) - { - int num24 = 7; - for (int j = 0; j < num24; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) - { - npc.active = false; - } - } + } + if (!flag14) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[3] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[3] == 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 90f) + { + npc.ai[3] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.ai[3] == 0f) + { + npc.noTileCollide = false; + } + else + { + npc.noTileCollide = true; + } + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.3f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; + float speedX = (phase3 ? 3f : 12f); + float speedY = (phase3 ? 2.25f : 9f); + if (npc.velocity.X > speedX) + { + npc.velocity.X = speedX; + } + if (npc.velocity.X < -speedX) + { + npc.velocity.X = -speedX; + } + if (npc.velocity.Y > speedY) + { + npc.velocity.Y = speedY; + } + if (npc.velocity.Y < -speedY) + { + npc.velocity.Y = -speedY; + } + } + else + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + if (npc.velocity.X < -4f || npc.velocity.X > 4f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.velocity.Y = (float)Main.rand.Next(-250, -180) * 0.1f; //50 20 + npc.velocity.X = (float)Main.rand.Next(-50, 50) * 0.1f; //20 20 + npc.netUpdate = true; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.velocity.Y > 16f) + { + npc.velocity.Y = 16f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } + else if (phase2) + { + if (!reset) + { + npc.noTileCollide = true; + npc.netAlways = true; + npc.localAI[0] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + reset = true; + npc.netUpdate = true; + } + bool expertMode = Main.expertMode; + int num2 = 30; + float num3 = expertMode ? 0.4f : 0.35f; + float scaleFactor = expertMode ? 6f : 5.5f; + int num4 = expertMode ? 28 : 30; + float num5 = expertMode ? 12f : 11f; + int num9 = 90; + int num16 = 75; + Vector2 vector = npc.Center; + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + npc.ai[0] = 0f; + npc.ai[2] = 0f; + } + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + if (npc.spriteDirection == 1) + { + num17 += 3.14159274f; + } + if (num17 < 0f) + { + num17 += 6.28318548f; + } + if (num17 > 6.28318548f) + { + num17 -= 6.28318548f; + } + if (npc.ai[0] == -1f) + { + num17 = 0f; + } + float num18 = 0.04f; + if (npc.ai[0] == 1f) + { + num18 = 0f; + } + if (npc.rotation < num17) + { + if ((double)(num17 - npc.rotation) > 3.1415926535897931) + { + npc.rotation -= num18; + } + else + { + npc.rotation += num18; + } + } + if (npc.rotation > num17) + { + if ((double)(npc.rotation - num17) > 3.1415926535897931) + { + npc.rotation += num18; + } + else + { + npc.rotation -= num18; + } + } + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + { + npc.rotation = num17; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.28318548f; + } + if (npc.rotation > 6.28318548f) + { + npc.rotation -= 6.28318548f; + } + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + { + npc.rotation = num17; + } + if (npc.ai[0] != -1f) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.alpha += 15; + } + else + { + npc.alpha -= 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[0] == -1f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + int num19 = Math.Sign(player.Center.X - vector.X); + if (num19 != 0) + { + npc.direction = num19; + npc.spriteDirection = -npc.direction; + } + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.alpha += 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[2] == (float)(num9 - 30)) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + npc.Center; + Vector2 vector2 = expr_80F - npc.Center; + int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num16) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 0f && !player.dead) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + } + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector3.X) + { + npc.velocity.X = npc.velocity.X + num3; + if (npc.velocity.X < 0f && vector3.X > 0f) + { + npc.velocity.X = npc.velocity.X + num3; + } + } + else if (npc.velocity.X > vector3.X) + { + npc.velocity.X = npc.velocity.X - num3; + if (npc.velocity.X > 0f && vector3.X < 0f) + { + npc.velocity.X = npc.velocity.X - num3; + } + } + if (npc.velocity.Y < vector3.Y) + { + npc.velocity.Y = npc.velocity.Y + num3; + if (npc.velocity.Y < 0f && vector3.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num3; + } + } + else if (npc.velocity.Y > vector3.Y) + { + npc.velocity.Y = npc.velocity.Y - num3; + if (npc.velocity.Y > 0f && vector3.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num3; + } + } + int num22 = Math.Sign(player.Center.X - vector.X); + if (num22 != 0) + { + if (npc.ai[2] == 0f && num22 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num22; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vector) * num5; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num22 != 0) + { + npc.direction = num22; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 1f) + { + int num24 = 7; + for (int j = 0; j < num24; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity /= 4f; + Main.dust[num25].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num4) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) + { + npc.active = false; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Darkness, 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - player.AddBuff(mod.BuffType("CrushDepth"), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Darkness, 300, true); + player.AddBuff(BuffID.Bleeding, 300, true); + player.AddBuff(BuffID.Rabies, 300, true); + player.AddBuff(mod.BuffType("CrushDepth"), 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && - !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper"))) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && + !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper"))) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(40, 51)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland"), Main.rand.Next(2, 4)); - if (Main.rand.NextBool(10000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (CalamityWorld.downedPolterghast) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ReaperTooth"), Main.rand.Next(3, 5)); - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeepSeaDumbbell")); - } - if (Main.rand.NextBool(3)) - { - if (Main.rand.NextBool(33)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheReaper")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Valediction")); - } - } - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(10, 18)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(4, 6)); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(40, 51)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland"), Main.rand.Next(2, 4)); + if (Main.rand.NextBool(10000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (CalamityWorld.downedPolterghast) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ReaperTooth"), Main.rand.Next(3, 5)); + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeepSeaDumbbell")); + } + if (Main.rand.NextBool(3)) + { + if (Main.rand.NextBool(33)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheReaper")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Valediction")); + } + } + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(10, 18)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(4, 6)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/SeaUrchin.cs b/NPCs/AbyssNPCs/SeaUrchin.cs index 89c658390d..af5c03726c 100644 --- a/NPCs/AbyssNPCs/SeaUrchin.cs +++ b/NPCs/AbyssNPCs/SeaUrchin.cs @@ -1,320 +1,319 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class SeaUrchin : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Urchin"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Urchin"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 20; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 10; - npc.lifeMax = 30; - npc.knockBackResist = 0.8f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - banner = npc.type; - bannerItem = mod.ItemType("SeaUrchinBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 20; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 10; + npc.lifeMax = 30; + npc.knockBackResist = 0.8f; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath15; + npc.behindTiles = true; + banner = npc.type; + bannerItem = mod.ItemType("SeaUrchinBanner"); + } - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - (npc.wet ? 9f : 3f); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default, 1f); - } - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = (npc.wet ? 5.5f : 2.2f); - float num8 = (npc.wet ? 0.09f : 0.04f); - if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = (npc.wet ? -14f : -6.5f); - npc.netUpdate = true; - } - else - { - npc.velocity.Y = (npc.wet ? -12f : -6f); - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = (npc.wet ? -11f : -5f); - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = (npc.wet ? -10f : -4f); - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = (npc.wet ? -13f : -6f); - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - (npc.wet ? 9f : 3f); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default, 1f); + } + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = (npc.wet ? 5.5f : 2.2f); + float num8 = (npc.wet ? 0.09f : 0.04f); + if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = (npc.wet ? -14f : -6.5f); + npc.netUpdate = true; + } + else + { + npc.velocity.Y = (npc.wet ? -12f : -6f); + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = (npc.wet ? -11f : -5f); + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = (npc.wet ? -10f : -4f); + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = (npc.wet ? -13f : -6f); + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { + public override void OnHitPlayer(Player player, int damage, bool crit) + { player.AddBuff(BuffID.Venom, 120, true); } - public override float SpawnChance(NPCSpawnInfo spawnInfo) + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) { @@ -323,24 +322,24 @@ namespace CalamityMod.NPCs.AbyssNPCs return SpawnCondition.OceanMonster.Chance * 0.2f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/ToxicMinnow.cs b/NPCs/AbyssNPCs/ToxicMinnow.cs index 68e52a9dc2..48a1563485 100644 --- a/NPCs/AbyssNPCs/ToxicMinnow.cs +++ b/NPCs/AbyssNPCs/ToxicMinnow.cs @@ -1,294 +1,293 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class ToxicMinnow : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Toxic Minnow"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxic Minnow"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 20; - npc.width = 80; - npc.height = 40; - npc.defense = 20; - npc.lifeMax = 240; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.15f; - banner = npc.type; - bannerItem = mod.ItemType("ToxicMinnowBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 20; + npc.width = 80; + npc.height = 40; + npc.defense = 20; + npc.lifeMax = 240; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.15f; + banner = npc.type; + bannerItem = mod.ItemType("ToxicMinnowBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - npc.TargetClosest(false); - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + npc.TargetClosest(false); + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override bool CheckDead() - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = (npc.height = 40); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - int damageBoom = 30; - for (iBoom = 0; iBoom < 5; iBoom++) - { - int projectileType = mod.ProjectileType("ToxicMinnowCloud"); - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.netUpdate = true; - return true; - } + public override bool CheckDead() + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 14); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = (npc.height = 40); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = 30; + for (iBoom = 0; iBoom < 5; iBoom++) + { + int projectileType = mod.ProjectileType("ToxicMinnowCloud"); + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.netUpdate = true; + return true; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightGreen); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightGreen); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 120, true); + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 40, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 40, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 40, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 40, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/AbyssNPCs/Trasher.cs b/NPCs/AbyssNPCs/Trasher.cs index 7571bae7e1..f7599ea4bf 100644 --- a/NPCs/AbyssNPCs/Trasher.cs +++ b/NPCs/AbyssNPCs/Trasher.cs @@ -1,385 +1,384 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Trasher : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trasher"); - Main.npcFrameCount[npc.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trasher"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 50; - npc.width = 150; - npc.height = 40; - npc.defense = 22; - npc.lifeMax = 200; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - npc.knockBackResist = 0f; - banner = npc.type; - bannerItem = mod.ItemType("TrasherBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 50; + npc.width = 150; + npc.height = 40; + npc.defense = 22; + npc.lifeMax = 200; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 3, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath5; + npc.knockBackResist = 0f; + banner = npc.type; + bannerItem = mod.ItemType("TrasherBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); - npc.chaseable = hasBeenHit; - if (npc.justHit) - { - hasBeenHit = true; - } - if (npc.wet) - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - npc.noTileCollide = false; - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < 200f) - { - flag14 = true; - } - if (Main.player[npc.target].dead && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.3f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 10f) - { - npc.velocity.X = 10f; - } - if (npc.velocity.X < -10f) - { - npc.velocity.X = -10f; - } - if (npc.velocity.Y > 5f) - { - npc.velocity.Y = 5f; - } - if (npc.velocity.Y < -5f) - { - npc.velocity.Y = -5f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (Collision.WetCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - npc.netUpdate = true; - return; - } - npc.noTileCollide = true; - float num823 = 1f; - npc.TargetClosest(true); - bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num823 = 1.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num823 = 2.5f; - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 20f) - { - flag51 = true; - } - if (flag51) - { - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - } - else - { - if (npc.direction > 0) - { - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; - } - if (npc.direction < 0) - { - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; - } - } - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); - bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) - { - flag52 = true; - } - if (flag52) - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y > -0.2) - { - npc.velocity.Y = npc.velocity.Y - 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = npc.velocity.Y + 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.05f; - if ((double)npc.rotation < -0.1) - { - npc.rotation = -0.1f; - } - if ((double)npc.rotation > 0.1) - { - npc.rotation = 0.1f; - return; - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); + npc.chaseable = hasBeenHit; + if (npc.justHit) + { + hasBeenHit = true; + } + if (npc.wet) + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + npc.noTileCollide = false; + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < 200f) + { + flag14 = true; + } + if (Main.player[npc.target].dead && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.3f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 10f) + { + npc.velocity.X = 10f; + } + if (npc.velocity.X < -10f) + { + npc.velocity.X = -10f; + } + if (npc.velocity.Y > 5f) + { + npc.velocity.Y = 5f; + } + if (npc.velocity.Y < -5f) + { + npc.velocity.Y = -5f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (Collision.WetCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + npc.netUpdate = true; + return; + } + npc.noTileCollide = true; + float num823 = 1f; + npc.TargetClosest(true); + bool flag51 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num823 = 1.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num823 = 2.5f; + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 20f) + { + flag51 = true; + } + if (flag51) + { + npc.velocity.X = npc.velocity.X * 0.9f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + } + else + { + if (npc.direction > 0) + { + npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + } + if (npc.direction < 0) + { + npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + } + } + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + bool flag52 = false; + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) + { + flag52 = true; + } + if (flag52) + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y > -0.2) + { + npc.velocity.Y = npc.velocity.Y - 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = npc.velocity.Y + 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.05f; + if ((double)npc.rotation < -0.1) + { + npc.rotation = -0.1f; + } + if ((double)npc.rotation > 0.1) + { + npc.rotation = 0.1f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 1.25 : 1.0); - if (npc.frameCounter < 6.0) - { - npc.frame.Y = 0; - } - else if (npc.frameCounter < 12.0) - { - npc.frame.Y = frameHeight; - } - else if (npc.frameCounter < 18.0) - { - npc.frame.Y = frameHeight * 2; - } - else if (npc.frameCounter < 24.0) - { - npc.frame.Y = frameHeight * 3; - } - else - { - npc.frameCounter = 0.0; - npc.frame.Y = 0; - } - if (!npc.wet) - { - npc.frame.Y = npc.frame.Y + frameHeight * 4; - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 1.25 : 1.0); + if (npc.frameCounter < 6.0) + { + npc.frame.Y = 0; + } + else if (npc.frameCounter < 12.0) + { + npc.frame.Y = frameHeight; + } + else if (npc.frameCounter < 18.0) + { + npc.frame.Y = frameHeight * 2; + } + else if (npc.frameCounter < 24.0) + { + npc.frame.Y = frameHeight * 3; + } + else + { + npc.frameCounter = 0.0; + npc.frame.Y = 0; + } + if (!npc.wet) + { + npc.frame.Y = npc.frame.Y + frameHeight * 4; + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 180, true); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneSulphur || (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water)) - { - return 0.1f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneSulphur || (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water)) + { + return 0.1f; + } + return 0f; + } - public override void NPCLoot() - { - if (!NPC.savedAngler && !NPC.AnyNPCs(NPCID.Angler) && !NPC.AnyNPCs(NPCID.SleepingAngler) && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255); - NPC.savedAngler = true; - } - if (Main.rand.NextBool(25)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); - } - if (Main.rand.NextBool(20)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrashmanTrashcan")); - } - if (Main.rand.NextBool(10) && Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gatligator); - } - } + public override void NPCLoot() + { + if (!NPC.savedAngler && !NPC.AnyNPCs(NPCID.Angler) && !NPC.AnyNPCs(NPCID.SleepingAngler) && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255); + NPC.savedAngler = true; + } + if (Main.rand.NextBool(25)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); + } + if (Main.rand.NextBool(20)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrashmanTrashcan")); + } + if (Main.rand.NextBool(10) && Main.hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gatligator); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher2"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher2"), 1f); + } + } + } } diff --git a/NPCs/AbyssNPCs/Viperfish.cs b/NPCs/AbyssNPCs/Viperfish.cs index 7dcf128aab..aaee4411e2 100644 --- a/NPCs/AbyssNPCs/Viperfish.cs +++ b/NPCs/AbyssNPCs/Viperfish.cs @@ -1,75 +1,74 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AbyssNPCs { public class Viperfish : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viperfish"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viperfish"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 60; - npc.width = 72; - npc.height = 30; - npc.defense = 15; - npc.lifeMax = 160; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; - bannerItem = mod.ItemType("ViperfishBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 60; + npc.width = 72; + npc.height = 30; + npc.defense = 15; + npc.lifeMax = 160; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.85f; + banner = npc.type; + bannerItem = mod.ItemType("ViperfishBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 600f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) * @@ -77,243 +76,243 @@ namespace CalamityMod.NPCs.AbyssNPCs // (Main.player[npc.target].GetCalamityPlayer().eclipseMirror ? 0.3f : 1f)) (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(600f, 200f)) { - flag14 = true; - } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.25f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 6f) - { - npc.velocity.X = 6f; - } - if (npc.velocity.X < -6f) - { - npc.velocity.X = -6f; - } - if (npc.velocity.Y > 6f) - { - npc.velocity.Y = 6f; - } - if (npc.velocity.Y < -6f) - { - npc.velocity.Y = -6f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } + flag14 = true; + } + if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.25f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 6f) + { + npc.velocity.X = 6f; + } + if (npc.velocity.X < -6f) + { + npc.velocity.X = -6f; + } + if (npc.velocity.Y > 6f) + { + npc.velocity.Y = 6f; + } + if (npc.velocity.Y < -6f) + { + npc.velocity.Y = -6f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(mod.BuffType("CrushDepth"), 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 90); - player.AddBuff(mod.BuffType("Horror"), 90, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(mod.BuffType("CrushDepth"), 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 90); + player.AddBuff(mod.BuffType("Horror"), 90, true); + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish2"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish2"), 1f); + } + } + } } diff --git a/NPCs/Astrageldon/Astrageldon.cs b/NPCs/Astrageldon/Astrageldon.cs index fa25d519c5..5a8eef3ca9 100644 --- a/NPCs/Astrageldon/Astrageldon.cs +++ b/NPCs/Astrageldon/Astrageldon.cs @@ -1,300 +1,300 @@ -using System.IO; -using System.Threading; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System.Threading; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Astrageldon { [AutoloadBossHead] - public class Astrageldon : ModNPC - { - private bool stomping = false; + public class Astrageldon : ModNPC + { + private bool stomping = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.npcSlots = 15f; - npc.damage = 80; - npc.width = 400; - npc.height = 280; - npc.defense = 50; + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.npcSlots = 15f; + npc.damage = 80; + npc.width = 400; + npc.height = 280; + npc.defense = 50; npc.Calamity().RevPlusDR(0.15f); npc.LifeMaxNERD(96000, NPC.downedMoonlord ? 440000 : 122000, 187000, 1400000, 1600000); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 15, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.boss = true; - npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("AstrageldonBag"); - if (NPC.downedMoonlord && CalamityWorld.revenge) - { - npc.value = Item.buyPrice(0, 35, 0, 0); - } - double HPBoost = Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 15, 0, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.boss = true; + npc.DeathSound = SoundID.NPCDeath14; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("AstrageldonBag"); + if (NPC.downedMoonlord && CalamityWorld.revenge) + { + npc.value = Item.buyPrice(0, 35, 0, 0); + } + double HPBoost = Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(stomping); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(stomping); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - stomping = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + stomping = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - CalamityAI.AstrumAureusAI(npc, mod); - } + public override void AI() + { + CalamityAI.AstrumAureusAI(npc, mod); + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return (npc.alpha == 0 && npc.ai[0] > 1f); - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return (npc.alpha == 0 && npc.ai[0] > 1f); + } - public override void FindFrame(int frameHeight) - { - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - { - if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump - { - if (stomping) - { - stomping = false; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //prepare to jump and then jump - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - else //stomping - { - if (!stomping) - { - stomping = true; - npc.frameCounter = 0.0; - npc.frame.Y = 0; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - } - else if (npc.ai[0] >= 5f) - { - if (stomping) - { - stomping = false; - } - if (npc.velocity.Y == 0f) //idle before teleport - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - else //in-air - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - } - else - { - if (stomping) - { - stomping = false; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - } + public override void FindFrame(int frameHeight) + { + if (npc.ai[0] == 3f || npc.ai[0] == 4f) + { + if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump + { + if (stomping) + { + stomping = false; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //prepare to jump and then jump + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + else //stomping + { + if (!stomping) + { + stomping = true; + npc.frameCounter = 0.0; + npc.frame.Y = 0; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + } + else if (npc.ai[0] >= 5f) + { + if (stomping) + { + stomping = false; + } + if (npc.velocity.Y == 0f) //idle before teleport + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + else //in-air + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + } + else + { + if (stomping) + { + stomping = false; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D NPCTexture = Main.npcTexture[npc.type]; - Texture2D GlowMaskTexture = Main.npcTexture[npc.type]; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D NPCTexture = Main.npcTexture[npc.type]; + Texture2D GlowMaskTexture = Main.npcTexture[npc.type]; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } - if (npc.ai[0] == 0f) - { - NPCTexture = Main.npcTexture[npc.type]; - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); - } - else if (npc.ai[0] == 1f) //nothing special done here - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonRecharge"); - } - else if (npc.ai[0] == 2f) //nothing special done here - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalk"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalkGlow"); - } - else if (npc.ai[0] == 3f || npc.ai[0] == 4f) //needs to have an in-air frame - { - if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump - { - NPCTexture = Main.npcTexture[npc.type]; //idle frames - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); - } - else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //jump frames if flying upward or if about to jump - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); - } - else //stomping - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStomp"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStompGlow"); - } - } - else if (npc.ai[0] >= 5f) //needs to have an in-air frame - { - if (npc.velocity.Y == 0f) //idle before teleport - { - NPCTexture = Main.npcTexture[npc.type]; //idle frames - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); - } - else //in-air frames - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); - } - } + if (npc.ai[0] == 0f) + { + NPCTexture = Main.npcTexture[npc.type]; + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); + } + else if (npc.ai[0] == 1f) //nothing special done here + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonRecharge"); + } + else if (npc.ai[0] == 2f) //nothing special done here + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalk"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalkGlow"); + } + else if (npc.ai[0] == 3f || npc.ai[0] == 4f) //needs to have an in-air frame + { + if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump + { + NPCTexture = Main.npcTexture[npc.type]; //idle frames + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); + } + else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //jump frames if flying upward or if about to jump + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); + } + else //stomping + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStomp"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStompGlow"); + } + } + else if (npc.ai[0] >= 5f) //needs to have an in-air frame + { + if (npc.velocity.Y == 0f) //idle before teleport + { + NPCTexture = Main.npcTexture[npc.type]; //idle frames + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); + } + else //in-air frames + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); + } + } - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - int frameCount = Main.npcFrameCount[npc.type]; - Microsoft.Xna.Framework.Rectangle frame = npc.frame; - float scale = npc.scale; - float rotation = npc.rotation; - float offsetY = npc.gfxOffY; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + int frameCount = Main.npcFrameCount[npc.type]; + Microsoft.Xna.Framework.Rectangle frame = npc.frame; + float scale = npc.scale; + float rotation = npc.rotation; + float offsetY = npc.gfxOffY; - Main.spriteBatch.Draw(NPCTexture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * scale + 0f + offsetY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(drawColor), - rotation, - vector11, - scale, - spriteEffects, - 0f); + Main.spriteBatch.Draw(NPCTexture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * scale + 0f + offsetY), + new Microsoft.Xna.Framework.Rectangle?(frame), + npc.GetAlpha(drawColor), + rotation, + vector11, + scale, + spriteEffects, + 0f); - if (npc.ai[0] != 1) //draw only if not recharging - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y - 46f); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)GlowMaskTexture.Width, (float)(GlowMaskTexture.Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + offsetY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); + if (npc.ai[0] != 1) //draw only if not recharging + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y - 46f); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)GlowMaskTexture.Width, (float)(GlowMaskTexture.Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + offsetY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); - Main.spriteBatch.Draw(GlowMaskTexture, vector, - new Microsoft.Xna.Framework.Rectangle?(frame), color, rotation, vector11, 1f, spriteEffects, 0f); - } - return false; - } + Main.spriteBatch.Draw(GlowMaskTexture, vector, + new Microsoft.Xna.Framework.Rectangle?(frame), color, rotation, vector11, 1f, spriteEffects, 0f); + } + return false; + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } - public override void NPCLoot() - { + public override void NPCLoot() + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("AstrageldonTrophy"), 10); @@ -303,7 +303,7 @@ namespace CalamityMod.NPCs.Astrageldon // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Materials DropHelper.DropItemSpray(npc, mod.ItemType("Stardust"), 20, 30); DropHelper.DropItemSpray(npc, ItemID.FallenStar, 25, 40); @@ -317,7 +317,7 @@ namespace CalamityMod.NPCs.Astrageldon // Other DropHelper.DropItem(npc, mod.ItemType("AstralJelly"), 9, 12); DropHelper.DropItemChance(npc, ItemID.HallowedKey, 5); - } + } // Drop a large spray of all 4 lunar fragments if ML has been defeated if (NPC.downedMoonlord) @@ -330,11 +330,11 @@ namespace CalamityMod.NPCs.Astrageldon DropHelper.DropItemSpray(npc, ItemID.FragmentStardust, minFragments, maxFragments); } - // Drop an Astral Meteor if applicable - ThreadPool.QueueUserWorkItem(WorldGenerationMethods.AstralMeteorThreadWrapper); + // Drop an Astral Meteor if applicable + ThreadPool.QueueUserWorkItem(WorldGenerationMethods.AstralMeteorThreadWrapper); - // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops - if (!CalamityWorld.downedAstrageldon) + // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops + if (!CalamityWorld.downedAstrageldon) { string key = "Mods.CalamityMod.AureusBossText"; string key2 = "Mods.CalamityMod.AureusBossText2"; @@ -357,56 +357,56 @@ namespace CalamityMod.NPCs.Astrageldon CalamityMod.UpdateServerBoolean(); } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 20; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), npc.Center); - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 20; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), npc.Center); + } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 150; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 50; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 100; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 150; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 50; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 100; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 240, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 240, true); + } + } } diff --git a/NPCs/Astrageldon/AstrageldonSlime.cs b/NPCs/Astrageldon/AstrageldonSlime.cs index 70ccf5066d..659261b3f0 100644 --- a/NPCs/Astrageldon/AstrageldonSlime.cs +++ b/NPCs/Astrageldon/AstrageldonSlime.cs @@ -1,274 +1,274 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Astrageldon { public class AstrageldonSlime : ModNPC - { + { // TODO -- This value is never set, but is read and written by the network. Remove it? private bool boostDR = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aureus Spawn"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aureus Spawn"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 90; - npc.height = 60; - npc.alpha = 255; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 90; + npc.height = 60; + npc.alpha = 255; npc.defense = 0; npc.takenDamageMultiplier = 1E-6f; - npc.lifeMax = Main.expertMode ? 1007 : 1012; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.lifeMax = 1002; - } - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } + npc.lifeMax = Main.expertMode ? 1007 : 1012; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.lifeMax = 1002; + } + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(boostDR); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(boostDR); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - boostDR = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + boostDR = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.alpha > 0) - { - npc.alpha -= 5; - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default, 0.8f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - num = num245; - } - } - npc.TargetClosest(true); - if (npc.life <= 1000 || Main.dayTime) - { - npc.dontTakeDamage = true; - Vector2 vector = Main.player[npc.target].Center - npc.Center; - Point point15 = npc.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = (tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !Main.tileSolidTop[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]); - if (vector.Length() < 60f || flag121) - { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; - } - float num1372 = CalamityWorld.bossRushActive ? 24f : 18f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - return; - } - float num1446 = CalamityWorld.bossRushActive ? 10f : 7f; - int num1447 = 480; - float num244; - if (npc.localAI[1] == 1f) - { - npc.localAI[1] = 0f; - if (Main.rand.NextBool(4)) - { - npc.ai[0] = (float)num1447; - } - } - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) - { - Main.PlaySound(SoundID.Item8, npc.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 20; - int num1454 = 3; - int num1455 = 10; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].lava()) - { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; - break; - } - } - } - npc.netUpdate = true; - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.alpha > 0) + { + npc.alpha -= 5; + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default, 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + num = num245; + } + } + npc.TargetClosest(true); + if (npc.life <= 1000 || Main.dayTime) + { + npc.dontTakeDamage = true; + Vector2 vector = Main.player[npc.target].Center - npc.Center; + Point point15 = npc.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point15); + bool flag121 = (tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !Main.tileSolidTop[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]); + if (vector.Length() < 60f || flag121) + { + npc.dontTakeDamage = false; + CheckDead(); + npc.life = 0; + return; + } + float num1372 = CalamityWorld.bossRushActive ? 24f : 18f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; + float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + return; + } + float num1446 = CalamityWorld.bossRushActive ? 10f : 7f; + int num1447 = 480; + float num244; + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 0f; + if (Main.rand.NextBool(4)) + { + npc.ai[0] = (float)num1447; + } + } + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (vector251.Length() > 400f || !flag104) + { + Vector2 value54 = vector251; + if (value54.Length() > num1446) + { + value54.Normalize(); + value54 *= num1446; + } + int num1448 = 30; + npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) + { + Main.PlaySound(SoundID.Item8, npc.Center); + int num; + for (int num1449 = 0; num1449 < 20; num1449 = num + 1) + { + int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); + Dust dust = Main.dust[num1452]; + dust.velocity *= 3f; + Main.dust[num1452].noGravity = true; + Main.dust[num1452].scale = 2.5f; + num = num1451; + } + } + float[] var_9_48E3C_cp_0 = npc.ai; + int var_9_48E3C_cp_1 = 0; + num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; + var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; + if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = 0f; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 20; + int num1454 = 3; + int num1455 = 10; + int num1456 = 1; + int num1457 = 0; + bool flag106 = false; + if (vector251.Length() > 2000f) + { + flag106 = true; + } + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + bool flag107 = true; + if (flag107 && Main.tile[num1458, num1459].lava()) + { + flag107 = false; + } + if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) + { + flag107 = false; + } + if (flag107) + { + npc.ai[2] = (float)num1458; + npc.ai[3] = (float)num1459; + break; + } + } + } + npc.netUpdate = true; + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, npc.alpha); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, npc.alpha); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override bool CheckDead() - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.damage = 150; - npc.width = (npc.height = 216); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - Main.dust[num622].noGravity = true; - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return true; - } - } + public override bool CheckDead() + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.damage = 150; + npc.width = (npc.height = 216); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + return true; + } + } } diff --git a/NPCs/AstralBiomeNPCs/Aries.cs b/NPCs/AstralBiomeNPCs/Aries.cs index 9b4599b18e..540450209a 100644 --- a/NPCs/AstralBiomeNPCs/Aries.cs +++ b/NPCs/AstralBiomeNPCs/Aries.cs @@ -1,12 +1,10 @@  +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class Aries : ModNPC @@ -33,16 +31,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.6f; npc.value = Item.buyPrice(0, 0, 10, 0); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - banner = npc.type; - bannerItem = mod.ItemType("AriesBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 85; - npc.defense = 24; - npc.knockBackResist = 0.5f; - npc.lifeMax = 450; - } - } + banner = npc.type; + bannerItem = mod.ItemType("AriesBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 85; + npc.defense = 24; + npc.knockBackResist = 0.5f; + npc.lifeMax = 450; + } + } public override void FindFrame(int frameHeight) { @@ -106,12 +104,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { if (Main.rand.NextBool(2)) { @@ -121,10 +119,10 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StellarKnife")); - } - } + if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StellarKnife")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.cs b/NPCs/AstralBiomeNPCs/AstralProbe.cs index 8318aa125f..3b44298980 100644 --- a/NPCs/AstralBiomeNPCs/AstralProbe.cs +++ b/NPCs/AstralBiomeNPCs/AstralProbe.cs @@ -1,211 +1,210 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AstralBiomeNPCs { public class AstralProbe : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Probe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Probe"); + } - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 10; + public override void SetDefaults() + { + npc.damage = 20; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 10; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 50; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0.95f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; - bannerItem = mod.ItemType("AstralProbeBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 30; - npc.defense = 20; - npc.knockBackResist = 0.85f; - npc.lifeMax = 70; - } - } + npc.lifeMax = 50; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0.95f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.DeathSound = SoundID.NPCDeath14; + banner = npc.type; + bannerItem = mod.ItemType("AstralProbeBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 30; + npc.defense = 20; + npc.knockBackResist = 0.85f; + npc.lifeMax = 70; + } + } - public override void AI() - { - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = 5f; - float num2 = 0.05f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; - if (npc.justHit) - { - npc.localAI[0] = 0f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 200f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - int num8 = Main.expertMode ? 14 : 18; - if (CalamityWorld.downedAstrageldon) - num8 += 6; + public override void AI() + { + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = 5f; + float num2 = 0.05f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + npc.localAI[0] += 1f; + if (npc.justHit) + { + npc.localAI[0] = 0f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 200f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + int num8 = Main.expertMode ? 14 : 18; + if (CalamityWorld.downedAstrageldon) + num8 += 6; - int num9 = 84; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); - } - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + int num9 = 84; + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); + } + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { if (npc.soundDelay == 0) { npc.soundDelay = 15; @@ -224,90 +223,90 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs } if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } - - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return (spawnInfo.player.Calamity().ZoneAstral && !spawnInfo.player.ZoneTowerStardust && !spawnInfo.player.ZoneTowerSolar && !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula) ? 0.1f : 0f; + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(1, 3)); + } + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return (spawnInfo.player.Calamity().ZoneAstral && !spawnInfo.player.ZoneTowerStardust && !spawnInfo.player.ZoneTowerSolar && !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula) ? 0.1f : 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } + } } diff --git a/NPCs/AstralBiomeNPCs/AstralSlime.cs b/NPCs/AstralBiomeNPCs/AstralSlime.cs index 6b170abf9d..6ea0cbeab9 100644 --- a/NPCs/AstralBiomeNPCs/AstralSlime.cs +++ b/NPCs/AstralBiomeNPCs/AstralSlime.cs @@ -1,14 +1,11 @@  +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; - using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class AstralSlime : ModNPC @@ -33,15 +30,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; animationType = NPCID.BlueSlime; - banner = npc.type; - bannerItem = mod.ItemType("AstralSlimeBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 65; - npc.defense = 18; - npc.lifeMax = 310; - } - } + banner = npc.type; + bannerItem = mod.ItemType("AstralSlimeBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 65; + npc.defense = 18; + npc.lifeMax = 310; + } + } public override void FindFrame(int frameHeight) { @@ -67,16 +64,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() - { - int oreMin = Main.expertMode ? 11 : 8; - int oreMax = Main.expertMode ? 16 : 12; - DropHelper.DropItemCondition(npc, mod.ItemType("AstralOre"), CalamityWorld.downedStarGod, oreMin, oreMax); - } - } + public override void NPCLoot() + { + int oreMin = Main.expertMode ? 11 : 8; + int oreMax = Main.expertMode ? 16 : 12; + DropHelper.DropItemCondition(npc, mod.ItemType("AstralOre"), CalamityWorld.downedStarGod, oreMin, oreMax); + } + } } diff --git a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs index 88a4ffce24..b23f41c23c 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs @@ -1,11 +1,10 @@ -using System; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AstralBiomeNPCs { @@ -41,16 +40,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.buffImmune[31] = false; npc.timeLeft = NPC.activeTime * 2; animationType = NPCID.WallCreeper; - banner = npc.type; - bannerItem = mod.ItemType("AstralachneaBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 30; - npc.knockBackResist = 0.28f; - npc.lifeMax = 750; - } - } + banner = npc.type; + bannerItem = mod.ItemType("AstralachneaBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 30; + npc.knockBackResist = 0.28f; + npc.lifeMax = 750; + } + } public override void AI() { @@ -150,12 +149,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); if (Main.expertMode) diff --git a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs index 335e684fe6..584332bf9a 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs @@ -1,11 +1,10 @@ -using System; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AstralBiomeNPCs { @@ -42,15 +41,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.buffImmune[31] = false; npc.timeLeft = NPC.activeTime * 2; animationType = NPCID.BlackRecluseWall; - banner = mod.NPCType("AstralachneaGround"); - bannerItem = mod.ItemType("AstralachneaBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 30; - npc.lifeMax = 750; - } - } + banner = mod.NPCType("AstralachneaGround"); + bannerItem = mod.ItemType("AstralachneaBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 30; + npc.lifeMax = 750; + } + } public override void AI() { @@ -127,12 +126,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition - new Vector2(0, 8f), npc.frame, Color.White * 0.6f, npc.rotation, origin, 1f, SpriteEffects.None, 0); } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); if (Main.expertMode) diff --git a/NPCs/AstralBiomeNPCs/Atlas.cs b/NPCs/AstralBiomeNPCs/Atlas.cs index 75feffcff4..95d1104480 100644 --- a/NPCs/AstralBiomeNPCs/Atlas.cs +++ b/NPCs/AstralBiomeNPCs/Atlas.cs @@ -1,12 +1,11 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.DataStructures; +using System; using System.IO; -using CalamityMod.World; -using CalamityMod.CalPlayer; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; namespace CalamityMod.NPCs.AstralBiomeNPCs { @@ -98,8 +97,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetDefaults() { - npc.lavaImmune = true; - npc.width = 78; + npc.lavaImmune = true; + npc.width = 78; npc.height = 88; npc.damage = 70; npc.defense = 40; @@ -109,23 +108,23 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.value = Item.buyPrice(0, 1, 0, 0); npc.aiStyle = -1; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AtlasDeath"); - banner = npc.type; - bannerItem = mod.ItemType("AtlasBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 100; - npc.defense = 50; - npc.knockBackResist = 0.04f; - npc.lifeMax = 1600; - } - if (NPC.downedAncientCultist) - { - npc.damage = 150; - npc.defense = 75; - npc.knockBackResist = 0f; - npc.lifeMax = 2400; - } - } + banner = npc.type; + bannerItem = mod.ItemType("AtlasBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 100; + npc.defense = 50; + npc.knockBackResist = 0.04f; + npc.lifeMax = 1600; + } + if (NPC.downedAncientCultist) + { + npc.damage = 150; + npc.defense = 75; + npc.knockBackResist = 0f; + npc.lifeMax = 2400; + } + } public override void SendExtraAI(BinaryWriter writer) { @@ -565,7 +564,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { int x = 0; int y = 0; - switch(npc.frame.Y) + switch (npc.frame.Y) { case 0: x = 45; @@ -608,12 +607,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(6, 9)); if (Main.expertMode) diff --git a/NPCs/AstralBiomeNPCs/BigSightseer.cs b/NPCs/AstralBiomeNPCs/BigSightseer.cs index 1bec2cc999..2da4cde9e4 100644 --- a/NPCs/AstralBiomeNPCs/BigSightseer.cs +++ b/NPCs/AstralBiomeNPCs/BigSightseer.cs @@ -1,15 +1,11 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class BigSightseer : ModNPC @@ -37,16 +33,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.8f; npc.value = Item.buyPrice(0, 0, 20, 0); npc.aiStyle = -1; - banner = npc.type; - bannerItem = mod.ItemType("BigSightseerBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 85; - npc.defense = 30; - npc.knockBackResist = 0.7f; - npc.lifeMax = 640; - } - } + banner = npc.type; + bannerItem = mod.ItemType("BigSightseerBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 85; + npc.defense = 30; + npc.knockBackResist = 0.7f; + npc.lifeMax = 640; + } + } public override void FindFrame(int frameHeight) { @@ -154,12 +150,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); if (Main.expertMode) @@ -191,11 +187,11 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.noTileCollide = true; npc.alpha = 80; npc.aiStyle = -1; - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 75; - } - } + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 75; + } + } public override void AI() { @@ -243,12 +239,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return false; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - private void DoKillDust() + private void DoKillDust() { int numDust = Main.rand.Next(17, 25); float rotPerIter = MathHelper.TwoPi / numDust; diff --git a/NPCs/AstralBiomeNPCs/FusionFeeder.cs b/NPCs/AstralBiomeNPCs/FusionFeeder.cs index 7751b463ff..09617d4ff2 100644 --- a/NPCs/AstralBiomeNPCs/FusionFeeder.cs +++ b/NPCs/AstralBiomeNPCs/FusionFeeder.cs @@ -1,15 +1,11 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class FusionFeeder : ModNPC @@ -39,16 +35,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.behindTiles = true; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); animationType = NPCID.SandShark; - banner = npc.type; - bannerItem = mod.ItemType("FusionFeederBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 65; - npc.defense = 22; - npc.knockBackResist = 0.7f; - npc.lifeMax = 600; - } - } + banner = npc.type; + bannerItem = mod.ItemType("FusionFeederBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 65; + npc.defense = 22; + npc.knockBackResist = 0.7f; + npc.lifeMax = 600; + } + } public override void FindFrame(int frameHeight) { @@ -115,12 +111,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); if (Main.expertMode) diff --git a/NPCs/AstralBiomeNPCs/Hadarian.cs b/NPCs/AstralBiomeNPCs/Hadarian.cs index 372f95dca8..b1d470bd21 100644 --- a/NPCs/AstralBiomeNPCs/Hadarian.cs +++ b/NPCs/AstralBiomeNPCs/Hadarian.cs @@ -1,15 +1,11 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class Hadarian : ModNPC @@ -36,16 +32,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.75f; npc.value = Item.buyPrice(0, 0, 15, 0); - banner = npc.type; - bannerItem = mod.ItemType("HadarianBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 80; - npc.defense = 18; - npc.knockBackResist = 0.65f; - npc.lifeMax = 490; - } - } + banner = npc.type; + bannerItem = mod.ItemType("HadarianBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 80; + npc.defense = 18; + npc.knockBackResist = 0.65f; + npc.lifeMax = 490; + } + } public override void AI() { @@ -188,22 +184,22 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); if (Main.expertMode) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HadarianMembrane"), Main.rand.Next(1, 3)); - } - } + if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HadarianMembrane"), Main.rand.Next(1, 3)); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/Hive.cs b/NPCs/AstralBiomeNPCs/Hive.cs index ee3c257f50..b0e50ca02e 100644 --- a/NPCs/AstralBiomeNPCs/Hive.cs +++ b/NPCs/AstralBiomeNPCs/Hive.cs @@ -1,152 +1,149 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class Hive : ModNPC - { - private static Texture2D glowmask; + { + private static Texture2D glowmask; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HiveGlow"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HiveGlow"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.width = 38; - npc.height = 60; - npc.aiStyle = -1; - npc.damage = 55; - npc.defense = 15; + public override void SetDefaults() + { + npc.width = 38; + npc.height = 60; + npc.aiStyle = -1; + npc.damage = 55; + npc.defense = 15; npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 470; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 15, 0); - banner = npc.type; - bannerItem = mod.ItemType("HiveBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 25; - npc.lifeMax = 700; - } - } + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 15, 0); + banner = npc.type; + bannerItem = mod.ItemType("HiveBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 25; + npc.lifeMax = 700; + } + } - public override void AI() - { - npc.ai[0]++; - if (npc.ai[0] > 180) - { - if (Main.rand.NextBool(100)) - { - npc.ai[0] = 0; + public override void AI() + { + npc.ai[0]++; + if (npc.ai[0] > 180) + { + if (Main.rand.NextBool(100)) + { + npc.ai[0] = 0; - //spawn hiveling, it's ai[0] is the hive npc index. - int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Hiveling"), 0, npc.whoAmI); - Main.npc[n].velocity.X = Main.rand.NextFloat(-0.4f, 0.4f); - Main.npc[n].velocity.Y = Main.rand.NextFloat(-0.5f, -0.05f); - } - } - } + //spawn hiveling, it's ai[0] is the hive npc index. + int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Hiveling"), 0, npc.whoAmI); + Main.npc[n].velocity.X = Main.rand.NextFloat(-0.4f, 0.4f); + Main.npc[n].velocity.Y = Main.rand.NextFloat(-0.5f, -0.05f); + } + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter++; - if (npc.frameCounter > 10) - { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > frameHeight * 4) - { - npc.frame.Y = 0; - } - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter > 10) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y > frameHeight * 4) + { + npc.frame.Y = 0; + } + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(19, 30), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + //draw glowmask + spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(19, 30), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - switch (Main.rand.Next(3)) - { - case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); - break; - case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); - break; - case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); - break; - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + switch (Main.rand.Next(3)) + { + case 0: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + break; + case 1: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + break; + case 2: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + break; + } + } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); - //if dead do gores - if (npc.life <= 0) - { - int type = mod.NPCType("Hiveling"); - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].type == type) - { - Main.npc[i].ai[0] = -1f; - } - } - } - } + //if dead do gores + if (npc.life <= 0) + { + int type = mod.NPCType("Hiveling"); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].type == type) + { + Main.npc[i].ai[0] = -1f; + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - //only 1 hive possible. - bool anyHives = NPC.CountNPCS(npc.type) > 0; - if (anyHives) return 0f; + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + //only 1 hive possible. + bool anyHives = NPC.CountNPCS(npc.type) > 0; + if (anyHives) + return 0f; - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.Calamity().ZoneAstral && (spawnInfo.player.ZoneDirtLayerHeight || spawnInfo.player.ZoneRockLayerHeight)) - { - return 0.17f; - } - return 0f; - } + Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; + if (spawnInfo.player.Calamity().ZoneAstral && (spawnInfo.player.ZoneDirtLayerHeight || spawnInfo.player.ZoneRockLayerHeight)) + { + return 0.17f; + } + return 0f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HivePod")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HivePod")); + } + } + } } diff --git a/NPCs/AstralBiomeNPCs/Hiveling.cs b/NPCs/AstralBiomeNPCs/Hiveling.cs index 07f81f7f95..1a3aae7fb0 100644 --- a/NPCs/AstralBiomeNPCs/Hiveling.cs +++ b/NPCs/AstralBiomeNPCs/Hiveling.cs @@ -1,129 +1,126 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class Hiveling : ModNPC - { - private static Texture2D glowmask; + { + private static Texture2D glowmask; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hiveling"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HivelingGlow"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hiveling"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HivelingGlow"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.width = 50; - npc.height = 40; - npc.aiStyle = -1; - npc.damage = 30; - npc.defense = 0; - npc.lifeMax = 150; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0.5f; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 0, 5, 0); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 50; - npc.defense = 8; - npc.knockBackResist = 0.4f; - npc.lifeMax = 220; - } - } + public override void SetDefaults() + { + npc.width = 50; + npc.height = 40; + npc.aiStyle = -1; + npc.damage = 30; + npc.defense = 0; + npc.lifeMax = 150; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + npc.knockBackResist = 0.5f; + npc.noGravity = true; + npc.value = Item.buyPrice(0, 0, 5, 0); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 50; + npc.defense = 8; + npc.knockBackResist = 0.4f; + npc.lifeMax = 220; + } + } - public override void AI() - { - if (npc.ai[1] == 0f) - { - npc.velocity *= 0.97f; + public override void AI() + { + if (npc.ai[1] == 0f) + { + npc.velocity *= 0.97f; - npc.TargetClosest(false); - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Player targ = Main.player[npc.target]; + npc.TargetClosest(false); + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Player targ = Main.player[npc.target]; - if (Collision.CanHit(npc.position, npc.width, npc.height, targ.position, targ.width, targ.height) || Vector2.Distance(npc.Center, targ.MountedCenter) < 320f) - { - npc.ai[1] = 1f; - } - } - else - { - CalamityGlobalNPC.DoFlyingAI(npc, 3f, 0.05f, 200f); - } - } + if (Collision.CanHit(npc.position, npc.width, npc.height, targ.position, targ.width, targ.height) || Vector2.Distance(npc.Center, targ.MountedCenter) < 320f) + { + npc.ai[1] = 1f; + } + } + else + { + CalamityGlobalNPC.DoFlyingAI(npc, 3f, 0.05f, 200f); + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.05f + npc.velocity.Length() * 0.667f; - if (npc.frameCounter >= 8) - { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > npc.height * 2) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.05f + npc.velocity.Length() * 0.667f; + if (npc.frameCounter >= 8) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y > npc.height * 2) + { + npc.frame.Y = 0; + } + } - //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 30, frameHeight, mod.DustType("AstralOrange"), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.3f, true); - if (d != null) - { - d.customData = 0.04f; - } - } + //DO DUST + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 30, frameHeight, mod.DustType("AstralOrange"), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.3f, true); + if (d != null) + { + d.customData = 0.04f; + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + new Vector2(0, 12), npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(15, 10), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + //draw glowmask + spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + new Vector2(0, 12), npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(15, 10), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - switch (Main.rand.Next(3)) - { - case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); - break; - case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); - break; - case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); - break; - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + switch (Main.rand.Next(3)) + { + case 0: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + break; + case 1: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + break; + case 2: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + break; + } + } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); - } + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return 0f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 60, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 60, true); + } + } } diff --git a/NPCs/AstralBiomeNPCs/Mantis.cs b/NPCs/AstralBiomeNPCs/Mantis.cs index 6719c85896..9e2a0ce5da 100644 --- a/NPCs/AstralBiomeNPCs/Mantis.cs +++ b/NPCs/AstralBiomeNPCs/Mantis.cs @@ -1,13 +1,10 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class Mantis : ModNPC @@ -34,16 +31,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.2f; npc.value = Item.buyPrice(0, 0, 15, 0); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - banner = npc.type; - bannerItem = mod.ItemType("MantisBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 85; - npc.defense = 16; - npc.knockBackResist = 0.1f; - npc.lifeMax = 510; - } - } + banner = npc.type; + bannerItem = mod.ItemType("MantisBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 85; + npc.defense = 16; + npc.knockBackResist = 0.1f; + npc.lifeMax = 510; + } + } public override void AI() { @@ -111,7 +108,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs } - if (npc.ai[1] < 0) npc.ai[1] = 0f; + if (npc.ai[1] < 0) + npc.ai[1] = 0f; } else { @@ -122,7 +120,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 71); Vector2 vector = Main.player[npc.target].Center - npc.Center; vector.Normalize(); - int damage = CalamityWorld.downedAstrageldon ? 45 : 55; + int damage = CalamityWorld.downedAstrageldon ? 45 : 55; Projectile.NewProjectile(npc.Center + (npc.Center.X < target.Center.X ? -14f : 14f) * Vector2.UnitX, vector * 7f, mod.ProjectileType("MantisRing"), damage, 0f); } } @@ -231,12 +229,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); if (Main.expertMode) diff --git a/NPCs/AstralBiomeNPCs/Nova.cs b/NPCs/AstralBiomeNPCs/Nova.cs index 6d947ac5d3..ecaaf321b0 100644 --- a/NPCs/AstralBiomeNPCs/Nova.cs +++ b/NPCs/AstralBiomeNPCs/Nova.cs @@ -1,15 +1,11 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; - -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.AstralBiomeNPCs { @@ -45,16 +41,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.5f; npc.value = Item.buyPrice(0, 0, 20, 0); npc.aiStyle = -1; - banner = npc.type; - bannerItem = mod.ItemType("NovaBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 75; - npc.defense = 25; - npc.knockBackResist = 0.4f; - npc.lifeMax = 350; - } - } + banner = npc.type; + bannerItem = mod.ItemType("NovaBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 75; + npc.defense = 25; + npc.knockBackResist = 0.4f; + npc.lifeMax = 350; + } + } public override void FindFrame(int frameHeight) { @@ -261,12 +257,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); if (Main.expertMode) diff --git a/NPCs/AstralBiomeNPCs/SmallSightseer.cs b/NPCs/AstralBiomeNPCs/SmallSightseer.cs index 91429c0fdb..436ba9336e 100644 --- a/NPCs/AstralBiomeNPCs/SmallSightseer.cs +++ b/NPCs/AstralBiomeNPCs/SmallSightseer.cs @@ -1,14 +1,10 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class SmallSightseer : ModNPC @@ -37,16 +33,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.58f; npc.value = Item.buyPrice(0, 0, 10, 0); npc.aiStyle = -1; - banner = npc.type; - bannerItem = mod.ItemType("SmallSightseerBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 58; - npc.defense = 26; - npc.knockBackResist = 0.48f; - npc.lifeMax = 460; - } - } + banner = npc.type; + bannerItem = mod.ItemType("SmallSightseerBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 58; + npc.defense = 26; + npc.knockBackResist = 0.48f; + npc.lifeMax = 460; + } + } public override void FindFrame(int frameHeight) { @@ -116,17 +112,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; if (spawnInfo.player.Calamity().ZoneAstral && (spawnInfo.player.ZoneOverworldHeight || spawnInfo.player.ZoneDirtLayerHeight)) { - return spawnInfo.player.ZoneDesert ? 0.16f : (spawnInfo.player.ZoneRockLayerHeight ? 0.08f : 0.2f); + return spawnInfo.player.ZoneDesert ? 0.16f : (spawnInfo.player.ZoneRockLayerHeight ? 0.08f : 0.2f); } return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 60, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 60, true); + } - public override void NPCLoot() + public override void NPCLoot() { if (Main.rand.NextBool(2)) { diff --git a/NPCs/AstralBiomeNPCs/StellarCulex.cs b/NPCs/AstralBiomeNPCs/StellarCulex.cs index 9c22bd6778..c1a02c0254 100644 --- a/NPCs/AstralBiomeNPCs/StellarCulex.cs +++ b/NPCs/AstralBiomeNPCs/StellarCulex.cs @@ -1,15 +1,11 @@ -using System; - +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; - namespace CalamityMod.NPCs.AstralBiomeNPCs { public class StellarCulex : ModNPC @@ -39,16 +35,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.buffImmune[31] = false; animationType = NPCID.GiantFlyingFox; - banner = npc.type; - bannerItem = mod.ItemType("StellarCulexBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 28; - npc.knockBackResist = 0.55f; - npc.lifeMax = 320; - } - } + banner = npc.type; + bannerItem = mod.ItemType("StellarCulexBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 28; + npc.knockBackResist = 0.55f; + npc.lifeMax = 320; + } + } public override void FindFrame(int frameHeight) { @@ -107,12 +103,12 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void NPCLoot() + public override void NPCLoot() { if (Main.rand.NextBool(2)) { diff --git a/NPCs/AstralBiomeNPCs/Twinkler.cs b/NPCs/AstralBiomeNPCs/Twinkler.cs index 87e4a7062c..0af7b706b3 100644 --- a/NPCs/AstralBiomeNPCs/Twinkler.cs +++ b/NPCs/AstralBiomeNPCs/Twinkler.cs @@ -1,13 +1,6 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using MonoMod.Cil; -using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs.AstralBiomeNPCs { @@ -17,45 +10,52 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { DisplayName.SetDefault("Twinkler"); Main.npcFrameCount[npc.type] = 8; - Main.npcCatchable[npc.type] = true; + Main.npcCatchable[npc.type] = true; } public override void SetDefaults() { - npc.CloneDefaults(NPCID.LightningBug); //ID is 358 - npc.width = 7; - npc.height = 5; - aiType = NPCID.LightningBug; - animationType = NPCID.LightningBug; - npc.catchItem = (short)mod.ItemType("TwinklerItem"); - npc.friendly = true; // We have to add this and CanBeHitByItem/CanBeHitByProjectile because of reasons. - //banner = npc.type; - //bannerItem = mod.ItemType("TwinklerBanner"); - } + npc.CloneDefaults(NPCID.LightningBug); //ID is 358 + npc.width = 7; + npc.height = 5; + aiType = NPCID.LightningBug; + animationType = NPCID.LightningBug; + npc.catchItem = (short)mod.ItemType("TwinklerItem"); + npc.friendly = true; // We have to add this and CanBeHitByItem/CanBeHitByProjectile because of reasons. + //banner = npc.type; + //bannerItem = mod.ItemType("TwinklerBanner"); + } - public override bool? CanBeHitByItem(Player player, Item item) { - return true; - } + public override bool? CanBeHitByItem(Player player, Item item) + { + return true; + } - public override bool? CanBeHitByProjectile(Projectile projectile) { - return true; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + return true; + } - public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) { - for (int i = 0; i < 6; i++) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 2 * hitDirection, -2f); - if (Main.rand.NextBool(2)) { - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.2f * npc.scale; - } - else { - Main.dust[dust].scale = 0.7f * npc.scale; - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int i = 0; i < 6; i++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 2 * hitDirection, -2f); + if (Main.rand.NextBool(2)) + { + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.2f * npc.scale; + } + else + { + Main.dust[dust].scale = 0.7f * npc.scale; + } + } + } + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { @@ -66,50 +66,49 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void OnCatchNPC(Player player, Item item) - { - try - { - var npcCenter = npc.Center.ToTileCoordinates(); - if (!WorldGen.SolidTile(npcCenter.X, npcCenter.Y) && Main.tile[npcCenter.X, npcCenter.Y].liquid == 0) - { - Main.tile[npcCenter.X, npcCenter.Y].liquid = (byte)Main.rand.Next(50, 150); - Main.tile[npcCenter.X, npcCenter.Y].lava(true); - Main.tile[npcCenter.X, npcCenter.Y].honey(false); - WorldGen.SquareTileFrame(npcCenter.X, npcCenter.Y, true); - } - } - catch - { - return; - } - } - } + public override void OnCatchNPC(Player player, Item item) + { + try + { + var npcCenter = npc.Center.ToTileCoordinates(); + if (!WorldGen.SolidTile(npcCenter.X, npcCenter.Y) && Main.tile[npcCenter.X, npcCenter.Y].liquid == 0) + { + Main.tile[npcCenter.X, npcCenter.Y].liquid = (byte)Main.rand.Next(50, 150); + Main.tile[npcCenter.X, npcCenter.Y].lava(true); + Main.tile[npcCenter.X, npcCenter.Y].honey(false); + WorldGen.SquareTileFrame(npcCenter.X, npcCenter.Y, true); + } + } catch + { + return; + } + } + } - internal class TwinklerItem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Twinkler"); - } + internal class TwinklerItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Twinkler"); + } - public override void SetDefaults() - { - item.useStyle = 1; - item.autoReuse = true; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.maxStack = 999; - item.consumable = true; - item.noUseGraphic = true; - item.value = Item.buyPrice(0, 0, 40, 0); - //item.CloneDefaults(2004); //Lightning Bug item - item.width = 26; - item.height = 24; - item.bait = 40; - item.makeNPC = (short)mod.NPCType("Twinkler"); - item.rare = 2; - } + public override void SetDefaults() + { + item.useStyle = 1; + item.autoReuse = true; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.maxStack = 999; + item.consumable = true; + item.noUseGraphic = true; + item.value = Item.buyPrice(0, 0, 40, 0); + //item.CloneDefaults(2004); //Lightning Bug item + item.width = 26; + item.height = 24; + item.bait = 40; + item.makeNPC = (short)mod.NPCType("Twinkler"); + item.rare = 2; + } } } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index d32588b7c7..5d7cf95944 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -1,265 +1,265 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { public class AstrumDeusBody : ModNPC - { - private int spawn = 0; + { + private int spawn = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } - public override void SetDefaults() - { - npc.damage = 85; - npc.npcSlots = 5f; - npc.width = 38; - npc.height = 44; - npc.defense = 40; + public override void SetDefaults() + { + npc.damage = 85; + npc.npcSlots = 5f; + npc.width = 38; + npc.height = 44; + npc.defense = 40; npc.Calamity().RevPlusDR(0.1f); npc.LifeMaxNERD(12000, 18000, 29100, 360000, 420000); - double HPBoost = Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + double HPBoost = Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = 6; + aiType = -1; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawn); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(npc.localAI[3]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawn); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + writer.Write(npc.localAI[3]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - spawn = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.localAI[3] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + spawn = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.localAI[3] = reader.ReadSingle(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - } - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shootTime = 4; - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) - { - shootTime += 2; - } - npc.localAI[0] += (float)Main.rand.Next(shootTime); - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num941 = revenge ? 13f : 12f; - if (CalamityWorld.death) - { - num941 = 15f; - } - if (CalamityWorld.bossRushActive) - { - num941 = 20f; - } - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 38 : 45; - int num946 = mod.ProjectileType("AstralShot2"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - } + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + } + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (!Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shootTime = 4; + if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) + { + shootTime += 2; + } + npc.localAI[0] += (float)Main.rand.Next(shootTime); + if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num941 = revenge ? 13f : 12f; + if (CalamityWorld.death) + { + num941 = 15f; + } + if (CalamityWorld.bossRushActive) + { + num941 = 20f; + } + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + int num945 = expertMode ? 38 : 45; + int num946 = mod.ProjectileType("AstralShot2"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Color lightColor = new Color(125, 75, Main.DiscoB, npc.alpha); //250 150 Disco - Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); - Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAlt"); - CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, newColor); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Color lightColor = new Color(125, 75, Main.DiscoB, npc.alpha); //250 150 Disco + Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); + Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAlt"); + CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, newColor); + return false; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } - if (projectile.penetrate == -1 && !projectile.minion) - { - if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) - damage = (int)((double)damage * 0.3); - else - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) - { - damage /= projectile.penetrate; - } - } + if (projectile.penetrate == -1 && !projectile.minion) + { + if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) + damage = (int)((double)damage * 0.3); + else + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) + { + damage /= projectile.penetrate; + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 3 && CalamityWorld.revenge) - { - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(25)) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server && num660 < 200) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 3 && CalamityWorld.revenge) + { + if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(25)) + { + spawn = 1; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server && num660 < 200) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index 3925a025d1..9702e40d8c 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -1,386 +1,385 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { public class AstrumDeusBodySpectral : ModNPC - { - private int spawn = 0; + { + private int spawn = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 38; - npc.height = 44; - npc.defense = 50; - npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 80700; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; - } + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 5f; + npc.width = 38; + npc.height = 44; + npc.defense = 50; + npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 80700; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawn); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawn); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - spawn = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + spawn = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shootTime = 4; - if ((double)npc.life <= (double)npc.lifeMax * 0.65 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) - { - shootTime += CalamityWorld.death ? 4 : 2; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) - { - shootTime += CalamityWorld.death ? 6 : 2; - } - npc.localAI[0] += (float)Main.rand.Next(shootTime); - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num941 = revenge ? 14f : 13f; - if (CalamityWorld.death) - { - num941 = 16f; - } - if (CalamityWorld.bossRushActive) - { - num941 = 24f; - } - if (Main.player[npc.target].gravDir == -1f) - { - num941 *= 2f; - } - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 38 : 45; - int num946 = mod.ProjectileType("AstralShot2"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shootTime = 4; + if ((double)npc.life <= (double)npc.lifeMax * 0.65 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) + { + shootTime += CalamityWorld.death ? 4 : 2; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) + { + shootTime += CalamityWorld.death ? 6 : 2; + } + npc.localAI[0] += (float)Main.rand.Next(shootTime); + if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num941 = revenge ? 14f : 13f; + if (CalamityWorld.death) + { + num941 = 16f; + } + if (CalamityWorld.bossRushActive) + { + num941 = 24f; + } + if (Main.player[npc.target].gravDir == -1f) + { + num941 *= 2f; + } + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + int num945 = expertMode ? 38 : 45; + int num946 = mod.ProjectileType("AstralShot2"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAltSpectral"); - SpriteEffects spriteEffects = SpriteEffects.None; - Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - CalamityMod.DrawTexture(spriteBatch, texture2D3, 0, npc, newColor); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAltSpectral"); + SpriteEffects spriteEffects = SpriteEffects.None; + Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + CalamityMod.DrawTexture(spriteBatch, texture2D3, 0, npc, newColor); + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } - if (projectile.penetrate == -1 && !projectile.minion) - { - if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) - damage = (int)((double)damage * 0.3); - else - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) - { - damage /= projectile.penetrate; - } - } + if (projectile.penetrate == -1 && !projectile.minion) + { + if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) + damage = (int)((double)damage * 0.3); + else + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) + { + damage /= projectile.penetrate; + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 6 && CalamityWorld.revenge) - { - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(25)) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server && num660 < 200) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 6 && CalamityWorld.revenge) + { + if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(25)) + { + spawn = 1; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server && num660 < 200) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index a26640646a..e2d001669e 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -1,640 +1,640 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { [AutoloadBossHead] - public class AstrumDeusHead : ModNPC - { - private bool flies = false; - private const int minLength = 4; - private const int maxLength = 5; - private int addOrbiter = 0; - private int addOrbiter2 = 0; - private float speed = 0.15f; - private float turnSpeed = 0.1f; - private bool tailSpawned = false; - private bool secondStage = false; - private bool thirdStage = false; + public class AstrumDeusHead : ModNPC + { + private bool flies = false; + private const int minLength = 4; + private const int maxLength = 5; + private int addOrbiter = 0; + private int addOrbiter2 = 0; + private float speed = 0.15f; + private float turnSpeed = 0.1f; + private bool tailSpawned = false; + private bool secondStage = false; + private bool thirdStage = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 56; - npc.height = 56; - npc.defense = 20; + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 5f; + npc.width = 56; + npc.height = 56; + npc.defense = 20; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; - if (CalamityWorld.death) - { - npc.lifeMax = 29100; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 420000 : 360000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; - } + npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; + if (CalamityWorld.death) + { + npc.lifeMax = 29100; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 420000 : 360000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; + aiType = -1; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + else + music = MusicID.Boss3; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(addOrbiter); - writer.Write(addOrbiter2); - writer.Write(secondStage); - writer.Write(thirdStage); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(addOrbiter); + writer.Write(addOrbiter2); + writer.Write(secondStage); + writer.Write(thirdStage); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - addOrbiter = reader.ReadInt32(); - addOrbiter2 = reader.ReadInt32(); - secondStage = reader.ReadBoolean(); - thirdStage = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + addOrbiter = reader.ReadInt32(); + addOrbiter2 = reader.ReadInt32(); + secondStage = reader.ReadBoolean(); + thirdStage = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - } - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - if ((npc.life <= npc.lifeMax * 0.9f)) - { - if (secondStage == false && Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 3; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; - } - secondStage = true; - } - } - if ((npc.life <= npc.lifeMax * 0.8f)) - { - if (thirdStage == false && Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - Eye.ai[3] = I * 72; - } - thirdStage = true; - } - } - } - else - { - if ((npc.life <= npc.lifeMax * 0.65f)) - { - if (secondStage == false && Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 3; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; - } - secondStage = true; - } - } - if ((npc.life <= npc.lifeMax * 0.3f)) - { - if (thirdStage == false && Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - Eye.ai[3] = I * 72; - } - thirdStage = true; - } - } - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - float speedMult = expertMode ? 1.8f : 1.6f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speedMult = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 3f : 2.5f); - } - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - float newSpeed = speed * (speedMult - (life / totalLife)); - float newTurnSpeed = turnSpeed * (speedMult - (life / totalLife)); - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!tailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTail"), npc.whoAmI); - } - if (num36 % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - } - 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; - Previous = lol; - } - tailSpawned = true; - } - if (!npc.active && Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int rectX = 300; - int rectY = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200); - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - rectX, (int)Main.player[num955].position.Y - rectY, rectX * 2, rectY * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - float maxSpeed = 20f; - if (Main.dayTime || Main.player[npc.target].dead || CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - flag94 = true; - npc.velocity.Y = npc.velocity.Y - 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 2f; - maxSpeed = 40f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - float num188 = newSpeed; - float num189 = newTurnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > maxSpeed) - { - npc.velocity.Y = maxSpeed; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num188 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num188 * 1.1f; - } - } - else if (npc.velocity.Y == maxSpeed) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num188; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num188; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num188 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num188 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = maxSpeed / num193; - num191 *= num198; - num192 *= num198; - if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num188; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num188; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num188; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num188; - } - } - if ((double)System.Math.Abs(num192) < (double)maxSpeed * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num188 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num188 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)maxSpeed * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num188 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num188 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num188 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num188 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num188; - } - else - { - npc.velocity.Y = npc.velocity.Y - num188; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num188 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num188 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num188; - } - else - { - npc.velocity.X = npc.velocity.X - num188; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - } + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + } + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + if ((npc.life <= npc.lifeMax * 0.9f)) + { + if (secondStage == false && Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 3; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 120; + Eye.ai[3] = I * 120; + } + secondStage = true; + } + } + if ((npc.life <= npc.lifeMax * 0.8f)) + { + if (thirdStage == false && Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 5; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 72; + Eye.ai[3] = I * 72; + } + thirdStage = true; + } + } + } + else + { + if ((npc.life <= npc.lifeMax * 0.65f)) + { + if (secondStage == false && Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 3; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 120; + Eye.ai[3] = I * 120; + } + secondStage = true; + } + } + if ((npc.life <= npc.lifeMax * 0.3f)) + { + if (thirdStage == false && Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 5; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 72; + Eye.ai[3] = I * 72; + } + thirdStage = true; + } + } + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + float speedMult = expertMode ? 1.8f : 1.6f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + speedMult = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 3f : 2.5f); + } + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + float newSpeed = speed * (speedMult - (life / totalLife)); + float newTurnSpeed = turnSpeed * (speedMult - (life / totalLife)); + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTail"), npc.whoAmI); + } + if (num36 % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + } + 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; + Previous = lol; + } + tailSpawned = true; + } + if (!npc.active && Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int rectX = 300; + int rectY = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200); + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - rectX, (int)Main.player[num955].position.Y - rectY, rectX * 2, rectY * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + float maxSpeed = 20f; + if (Main.dayTime || Main.player[npc.target].dead || CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + flag94 = true; + npc.velocity.Y = npc.velocity.Y - 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 2f; + maxSpeed = 40f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + float num188 = newSpeed; + float num189 = newTurnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + 0.15f; + if (npc.velocity.Y > maxSpeed) + { + npc.velocity.Y = maxSpeed; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num188 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num188 * 1.1f; + } + } + else if (npc.velocity.Y == maxSpeed) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num188; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num188; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num188 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num188 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = maxSpeed / num193; + num191 *= num198; + num192 *= num198; + if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num188; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num188; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num188; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num188; + } + } + if ((double)System.Math.Abs(num192) < (double)maxSpeed * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num188 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num188 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)maxSpeed * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num188 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num188 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num188 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num188 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num188; + } + else + { + npc.velocity.Y = npc.velocity.Y - num188; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num188 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num188 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num188; + } + else + { + npc.velocity.X = npc.velocity.X - num188; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } - public override Color? GetAlpha(Color drawColor) - { - if (npc.dontTakeDamage) - return new Color(125, 75, Main.DiscoB, npc.alpha); - return null; - } + public override Color? GetAlpha(Color drawColor) + { + if (npc.dontTakeDamage) + return new Color(125, 75, Main.DiscoB, npc.alpha); + return null; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } - if (projectile.penetrate == -1 && !projectile.minion) - { - if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) - damage = (int)((double)damage * 0.3); - else - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) - { - damage /= projectile.penetrate; - } - } + if (projectile.penetrate == -1 && !projectile.minion) + { + if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) + damage = (int)((double)damage * 0.3); + else + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) + { + damage /= projectile.penetrate; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 240, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 240, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 51d1a9ae8e..4ddf11b394 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -1,535 +1,535 @@ -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.AstrumDeus { [AutoloadBossHead] - public class AstrumDeusHeadSpectral : ModNPC - { - private bool colorChange = false; - private const int minLength = 12; - private const int maxLength = 13; - private float speed = 10f; - private float turnSpeed = 0.2f; - private bool tailSpawned = false; - private int deusHeadCount = 0; - private int astrumDeusTotalHPMax = 0; + public class AstrumDeusHeadSpectral : ModNPC + { + private bool colorChange = false; + private const int minLength = 12; + private const int maxLength = 13; + private float speed = 10f; + private float turnSpeed = 0.2f; + private bool tailSpawned = false; + private int deusHeadCount = 0; + private int astrumDeusTotalHPMax = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } - public override void SetDefaults() - { - npc.damage = 120; - npc.npcSlots = 5f; - npc.width = 56; - npc.height = 56; - npc.defense = 25; - npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 80700; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.boss = true; - npc.value = Item.buyPrice(0, 20, 0, 0); - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("AstrumDeusBag"); - } + public override void SetDefaults() + { + npc.damage = 120; + npc.npcSlots = 5f; + npc.width = 56; + npc.height = 56; + npc.defense = 25; + npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 80700; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + npc.boss = true; + npc.value = Item.buyPrice(0, 20, 0, 0); + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("AstrumDeusBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(deusHeadCount); - writer.Write(astrumDeusTotalHPMax); - writer.Write(colorChange); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(deusHeadCount); + writer.Write(astrumDeusTotalHPMax); + writer.Write(colorChange); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - deusHeadCount = reader.ReadInt32(); - astrumDeusTotalHPMax = reader.ReadInt32(); - colorChange = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + deusHeadCount = reader.ReadInt32(); + astrumDeusTotalHPMax = reader.ReadInt32(); + colorChange = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI; - colorChange = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - int astrumDeusTotalHP = 0; - double astrumDeusHPRatio = 0; - double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax; - if (colorChange) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].type == mod.NPCType("AstrumDeusHead")) - { - astrumDeusTotalHP += Main.npc[i].life; - if (deusHeadCount < 10) - { - deusHeadCount++; - astrumDeusTotalHPMax += Main.npc[i].lifeMax; - } - } - } - astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)astrumDeusTotalHPMax; - if (astrumDeusHPRatio < 0.33) - { - if (mainDeusHPRatio > 0.33) - colorChange = false; - } - else if (astrumDeusHPRatio < 0.66) - { - if (mainDeusHPRatio > 0.66) - colorChange = false; - } - } - npc.dontTakeDamage = colorChange; - npc.chaseable = !colorChange; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedLimit = CalamityWorld.revenge ? 7f : 6f; - float turnSpeedLimit = CalamityWorld.revenge ? 0.11f : 0.1f; - if (CalamityWorld.death) - { - speedLimit = 8f; - turnSpeedLimit = 0.12f; - } - if (CalamityWorld.bossRushActive) - { - speedLimit *= 1.5f; - turnSpeedLimit *= 1.5f; - } - float speedBoost = speedLimit * (1f - (float)mainDeusHPRatio); - float turnSpeedBoost = turnSpeedLimit * (1f - (float)mainDeusHPRatio); - if (Main.player[npc.target].gravDir == -1f) - { - speedBoost = speedLimit; - turnSpeedBoost = turnSpeedLimit; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!tailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBodySpectral"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTailSpectral"), npc.whoAmI); - } - if (num36 % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - } - 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - tailSpawned = true; - } - } - if (Main.player[npc.target].dead || Main.dayTime) - { - npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 3f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - 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); - } - float num188 = speed + speedBoost; - float num189 = turnSpeed + turnSpeedBoost; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI; + colorChange = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + int astrumDeusTotalHP = 0; + double astrumDeusHPRatio = 0; + double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax; + if (colorChange) + { + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].type == mod.NPCType("AstrumDeusHead")) + { + astrumDeusTotalHP += Main.npc[i].life; + if (deusHeadCount < 10) + { + deusHeadCount++; + astrumDeusTotalHPMax += Main.npc[i].lifeMax; + } + } + } + astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)astrumDeusTotalHPMax; + if (astrumDeusHPRatio < 0.33) + { + if (mainDeusHPRatio > 0.33) + colorChange = false; + } + else if (astrumDeusHPRatio < 0.66) + { + if (mainDeusHPRatio > 0.66) + colorChange = false; + } + } + npc.dontTakeDamage = colorChange; + npc.chaseable = !colorChange; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedLimit = CalamityWorld.revenge ? 7f : 6f; + float turnSpeedLimit = CalamityWorld.revenge ? 0.11f : 0.1f; + if (CalamityWorld.death) + { + speedLimit = 8f; + turnSpeedLimit = 0.12f; + } + if (CalamityWorld.bossRushActive) + { + speedLimit *= 1.5f; + turnSpeedLimit *= 1.5f; + } + float speedBoost = speedLimit * (1f - (float)mainDeusHPRatio); + float turnSpeedBoost = turnSpeedLimit * (1f - (float)mainDeusHPRatio); + if (Main.player[npc.target].gravDir == -1f) + { + speedBoost = speedLimit; + turnSpeedBoost = turnSpeedLimit; + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBodySpectral"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTailSpectral"), npc.whoAmI); + } + if (num36 % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + } + 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + tailSpawned = true; + } + } + if (Main.player[npc.target].dead || Main.dayTime) + { + npc.TargetClosest(false); + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 3f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + 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); + } + float num188 = speed + speedBoost; + float num189 = turnSpeed + turnSpeedBoost; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); - Color newColor = (colorChange ? lightColor : drawColor); - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - if (colorChange && Main.player[npc.target].gravDir != -1f) - { - return false; - } - return true; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } - - if (projectile.penetrate == -1 && !projectile.minion) - { - if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) - damage = (int)((double)damage * 0.3); - else - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) - { - damage /= projectile.penetrate; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("Stardust"); - } - - public override bool SpecialNPCLoot() - { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, - mod.NPCType("AstrumDeusHeadSpectral"), - mod.NPCType("AstrumDeusBodySpectral"), - mod.NPCType("AstrumDeusTailSpectral")); - npc.position = Main.npc[closestSegmentID].position; + public override bool CheckActive() + { return false; - } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); + Color newColor = (colorChange ? lightColor : drawColor); + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + if (colorChange && Main.player[npc.target].gravDir != -1f) + { + return false; + } + return true; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } + + if (projectile.penetrate == -1 && !projectile.minion) + { + if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) + damage = (int)((double)damage * 0.3); + else + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) + { + damage /= projectile.penetrate; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("Stardust"); + } + + public override bool SpecialNPCLoot() + { + int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + mod.NPCType("AstrumDeusHeadSpectral"), + mod.NPCType("AstrumDeusBodySpectral"), + mod.NPCType("AstrumDeusTailSpectral")); + npc.position = Main.npc[closestSegmentID].position; + return false; + } public override void NPCLoot() { @@ -582,13 +582,13 @@ namespace CalamityMod.NPCs.AstrumDeus } public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 240, true); - } + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 240, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusProbe.cs b/NPCs/AstrumDeus/AstrumDeusProbe.cs index 8ead0ad363..48877a1994 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe.cs @@ -1,140 +1,140 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { - public class AstrumDeusProbe : ModNPC - { - private bool start = true; + public class AstrumDeusProbe : ModNPC + { + private bool start = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Probe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Probe"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 30; - npc.height = 30; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.damage = 0; - npc.lifeMax = 100; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 30; + npc.height = 30; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.damage = 0; + npc.lifeMax = 100; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override bool PreAI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (start) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= (CalamityWorld.bossRushActive ? 13f : 9f); - npc.rotation = direction.ToRotation(); - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 720f) - { - npc.localAI[0] = 0f; - int num8 = expertMode ? 45 : 60; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); - } - bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); - NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 75; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } + public override bool PreAI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + if (start) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= (CalamityWorld.bossRushActive ? 13f : 9f); + npc.rotation = direction.ToRotation(); + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 720f) + { + npc.localAI[0] = 0f; + int num8 = expertMode ? 45 : 60; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); + } + bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); + NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 75; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 2f; + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusProbe2.cs b/NPCs/AstrumDeus/AstrumDeusProbe2.cs index 08a01e85a8..033e4bc307 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe2.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe2.cs @@ -1,141 +1,141 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { - public class AstrumDeusProbe2 : ModNPC - { - public int timer = 0; - public bool start = true; + public class AstrumDeusProbe2 : ModNPC + { + public int timer = 0; + public bool start = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Probe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Probe"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 30; - npc.height = 30; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.damage = 0; - npc.lifeMax = 100; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 30; + npc.height = 30; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.damage = 0; + npc.lifeMax = 100; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override bool PreAI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (start) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 40f; - npc.rotation = direction.ToRotation(); - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 360f) - { - npc.localAI[0] = 0f; - int num8 = expertMode ? 45 : 60; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); - } - bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); - NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 150; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } + public override bool PreAI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + if (start) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 40f; + npc.rotation = direction.ToRotation(); + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 360f) + { + npc.localAI[0] = 0f; + int num8 = expertMode ? 45 : 60; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); + } + bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); + NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 150; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 2f; + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index 6156673e32..a6d9227ad5 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -1,311 +1,311 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { public class AstrumDeusProbe3 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Probe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Probe"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 2f; - npc.damage = 0; - npc.width = 30; - npc.height = 30; - npc.defense = 30; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.npcSlots = 2f; + npc.damage = 0; + npc.width = 30; + npc.height = 30; + npc.defense = 30; npc.Calamity().RevPlusDR(0.2f); npc.lifeMax = 1400; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 120000; - } - npc.knockBackResist = 0.95f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[24] = true; - } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 120000; + } + npc.knockBackResist = 0.95f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.DeathSound = SoundID.NPCDeath14; + npc.buffImmune[24] = true; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 6f : 5f; - float num2 = revenge ? 0.07f : 0.065f; - if (CalamityWorld.death) - { - num = 8f; - num2 = 0.08f; - } - if (CalamityWorld.bossRushActive) - { - num *= 1.5f; - num2 *= 1.5f; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - int num8 = Main.expertMode ? 38 : 45; - int num9 = 84; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); - } - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 6f : 5f; + float num2 = revenge ? 0.07f : 0.065f; + if (CalamityWorld.death) + { + num = 8f; + num2 = 0.08f; + } + if (CalamityWorld.bossRushActive) + { + num *= 1.5f; + num2 *= 1.5f; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + int num8 = Main.expertMode ? 38 : 45; + int num9 = 84; + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); + } + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - switch (Main.rand.Next(3)) - { - case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); - break; - case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); - break; - case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); - break; - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + switch (Main.rand.Next(3)) + { + case 0: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + break; + case 1: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + break; + case 2: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + break; + } + } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index dff51f17fc..21a10340e4 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -1,208 +1,208 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { public class AstrumDeusTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 5f; - npc.width = 52; - npc.height = 68; - npc.defense = 60; + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 5f; + npc.width = 52; + npc.height = 68; + npc.defense = 60; npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; - if (CalamityWorld.death) - { - npc.lifeMax = 29100; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 420000 : 360000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + if (CalamityWorld.death) + { + npc.lifeMax = 29100; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 420000 : 360000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; + aiType = -1; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (!Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } - public override Color? GetAlpha(Color drawColor) - { - if (npc.dontTakeDamage) - return new Color(125, 75, Main.DiscoB, npc.alpha); - return null; - } + public override Color? GetAlpha(Color drawColor) + { + if (npc.dontTakeDamage) + return new Color(125, 75, Main.DiscoB, npc.alpha); + return null; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } - if (projectile.penetrate == -1 && !projectile.minion) - { - if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) - damage = (int)((double)damage * 0.3); - else - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) - { - damage /= projectile.penetrate; - } - } + if (projectile.penetrate == -1 && !projectile.minion) + { + if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) + damage = (int)((double)damage * 0.3); + else + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) + { + damage /= projectile.penetrate; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 505eb91dbf..2faa2933b5 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -1,318 +1,317 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.AstrumDeus { public class AstrumDeusTailSpectral : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } - public override void SetDefaults() - { - npc.damage = 80; - npc.npcSlots = 5f; - npc.width = 52; - npc.height = 68; - npc.defense = 75; - npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 80700; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; - } + public override void SetDefaults() + { + npc.damage = 80; + npc.npcSlots = 5f; + npc.width = 52; + npc.height = 68; + npc.defense = 75; + npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 80700; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); - Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); + Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2") || projectile.type == mod.ProjectileType("MalachiteBolt")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } - if (projectile.penetrate == -1 && !projectile.minion) - { - if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) - damage = (int)((double)damage * 0.3); - else - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) - { - damage /= projectile.penetrate; - } - } + if (projectile.penetrate == -1 && !projectile.minion) + { + if (projectile.type == mod.ProjectileType("CosmicFire") || projectile.type == mod.ProjectileType("BigNuke")) + damage = (int)((double)damage * 0.3); + else + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1 && projectile.type != mod.ProjectileType("BrinySpout")) + { + damage /= projectile.penetrate; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/BrimstoneWaifu/Brimling.cs b/NPCs/BrimstoneWaifu/Brimling.cs index bb7073c1a2..526cce64b4 100644 --- a/NPCs/BrimstoneWaifu/Brimling.cs +++ b/NPCs/BrimstoneWaifu/Brimling.cs @@ -1,285 +1,285 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.BrimstoneWaifu { public class Brimling : ModNPC - { - private bool boostDR = false; + { + private bool boostDR = false; public static float normalDR = 0.2f; public static float boostedDR = 0.8f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimling"); - Main.npcFrameCount[npc.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimling"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 60; - npc.height = 60; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 60; + npc.height = 60; npc.defense = 0; npc.Calamity().DR = normalDR; - npc.lifeMax = 4000; - if (CalamityWorld.death) - { - npc.lifeMax = 6000; - } - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; - if (CalamityWorld.downedProvidence) - { - npc.lifeMax = 40000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - } + npc.lifeMax = 4000; + if (CalamityWorld.death) + { + npc.lifeMax = 6000; + } + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath39; + if (CalamityWorld.downedProvidence) + { + npc.lifeMax = 40000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(boostDR); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(boostDR); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - boostDR = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + boostDR = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); - if (CalamityGlobalNPC.brimstoneElemental < 0 || !Main.npc[CalamityGlobalNPC.brimstoneElemental].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - bool goIntoShell = (double)npc.life <= (double)npc.lifeMax * 0.1; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) - { - boostDR = true; - npc.chaseable = false; - } - else - { - boostDR = false; - npc.chaseable = true; - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + if (CalamityGlobalNPC.brimstoneElemental < 0 || !Main.npc[CalamityGlobalNPC.brimstoneElemental].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + bool goIntoShell = (double)npc.life <= (double)npc.lifeMax * 0.1; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) + { + boostDR = true; + npc.chaseable = false; + } + else + { + boostDR = false; + npc.chaseable = true; + } // Set DR based on boost status npc.Calamity().DR = boostDR ? boostedDR : normalDR; - float num1446 = goIntoShell ? 1f : (CalamityWorld.bossRushActive ? 12f : 6f); - int num1447 = 480; - float num244; - if (npc.localAI[1] == 1f) - { - npc.localAI[1] = 0f; - if (Main.rand.NextBool(4)) - { - npc.ai[0] = (float)num1447; - } - } - npc.TargetClosest(true); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = CalamityWorld.bossRushActive ? 7.5f : 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int projectileDamage = Main.expertMode ? 28 : 35; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("BrimstoneHellfireball"), projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) - { - Main.PlaySound(SoundID.Item8, npc.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[0] > 260f) - { - npc.localAI[0] -= 60f; - } - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 20; - int num1454 = 3; - int num1455 = 10; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].lava()) - { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; - break; - } - } - } - npc.netUpdate = true; - } - } + float num1446 = goIntoShell ? 1f : (CalamityWorld.bossRushActive ? 12f : 6f); + int num1447 = 480; + float num244; + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 0f; + if (Main.rand.NextBool(4)) + { + npc.ai[0] = (float)num1447; + } + } + npc.TargetClosest(true); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = CalamityWorld.bossRushActive ? 7.5f : 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int projectileDamage = Main.expertMode ? 28 : 35; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("BrimstoneHellfireball"), projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + if (vector251.Length() > 400f || !flag104) + { + Vector2 value54 = vector251; + if (value54.Length() > num1446) + { + value54.Normalize(); + value54 *= num1446; + } + int num1448 = 30; + npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) + { + Main.PlaySound(SoundID.Item8, npc.Center); + int num; + for (int num1449 = 0; num1449 < 20; num1449 = num + 1) + { + int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1452]; + dust.velocity *= 3f; + Main.dust[num1452].noGravity = true; + Main.dust[num1452].scale = 2.5f; + num = num1451; + } + } + float[] var_9_48E3C_cp_0 = npc.ai; + int var_9_48E3C_cp_1 = 0; + num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; + var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; + if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[0] > 260f) + { + npc.localAI[0] -= 60f; + } + npc.ai[0] = 0f; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 20; + int num1454 = 3; + int num1455 = 10; + int num1456 = 1; + int num1457 = 0; + bool flag106 = false; + if (vector251.Length() > 2000f) + { + flag106 = true; + } + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + bool flag107 = true; + if (flag107 && Main.tile[num1458, num1459].lava()) + { + flag107 = false; + } + if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) + { + flag107 = false; + } + if (flag107) + { + npc.ai[2] = (float)num1458; + npc.ai[3] = (float)num1459; + break; + } + } + } + npc.netUpdate = true; + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (!boostDR) - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 4) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y < frameHeight * 4) - { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y >= frameHeight * 8) - { - npc.frame.Y = frameHeight * 4; - } - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (!boostDR) + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 4) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y < frameHeight * 4) + { + npc.frame.Y = frameHeight * 4; + } + if (npc.frame.Y >= frameHeight * 8) + { + npc.frame.Y = frameHeight * 4; + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs index 76b4fd400a..68d5cf8547 100644 --- a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs +++ b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs @@ -1,637 +1,637 @@ -using System; -using System.IO; +using CalamityMod.CalPlayer; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.BrimstoneWaifu { - [AutoloadBossHead] - public class BrimstoneElemental : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Main.npcFrameCount[npc.type] = 12; - } + [AutoloadBossHead] + public class BrimstoneElemental : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental"); + Main.npcFrameCount[npc.type] = 12; + } - public override void SetDefaults() - { - npc.npcSlots = 64f; - npc.damage = 60; - npc.width = 100; - npc.height = 150; - npc.defense = 15; - npc.lifeMax = CalamityWorld.revenge ? 35708 : 26000; - if (CalamityWorld.death) - { - npc.lifeMax = 54050; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 12, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); - else - music = MusicID.Boss4; - bossBag = mod.ItemType("BrimstoneWaifuBag"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 210; - npc.defense = 120; - npc.lifeMax = 300000; - npc.value = Item.buyPrice(0, 35, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + public override void SetDefaults() + { + npc.npcSlots = 64f; + npc.damage = 60; + npc.width = 100; + npc.height = 150; + npc.defense = 15; + npc.lifeMax = CalamityWorld.revenge ? 35708 : 26000; + if (CalamityWorld.death) + { + npc.lifeMax = 54050; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 12, 0, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath39; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); + else + music = MusicID.Boss4; + bossBag = mod.ItemType("BrimstoneWaifuBag"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 210; + npc.defense = 120; + npc.lifeMax = 300000; + npc.value = Item.buyPrice(0, 35, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; + public override void AI() + { + CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2f, 0f, 0f); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2f, 0f, 0f); - npc.TargetClosest(true); + npc.TargetClosest(true); - Player player = Main.player[npc.target]; - CalamityPlayer modPlayer = player.Calamity(); + Player player = Main.player[npc.target]; + CalamityPlayer modPlayer = player.Calamity(); - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool calamity = modPlayer.ZoneCalamity; + bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool calamity = modPlayer.ZoneCalamity; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vectorCenter = npc.Center; - float xDistance = player.Center.X - center.X; - float yDistance = player.Center.Y - center.Y; - float totalDistance = (float)Math.Sqrt((double)(xDistance * xDistance + yDistance * yDistance)); + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vectorCenter = npc.Center; + float xDistance = player.Center.X - center.X; + float yDistance = player.Center.Y - center.Y; + float totalDistance = (float)Math.Sqrt((double)(xDistance * xDistance + yDistance * yDistance)); - int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; - int size = (npc.ai[0] == 2f) ? 50 : 35; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < dustAmt) - { - int dust = Dust.NewDust(npc.Center - new Vector2((float)size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].fadeIn = 1f; - } - } + int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; + int size = (npc.ai[0] == 2f) ? 50 : 35; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < dustAmt) + { + int dust = Dust.NewDust(npc.Center - new Vector2((float)size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].fadeIn = 1f; + } + } - if (Vector2.Distance(player.Center, vectorCenter) > 5600f) - { - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - else if (npc.timeLeft > 1800) - npc.timeLeft = 1800; + if (Vector2.Distance(player.Center, vectorCenter) > 5600f) + { + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + else if (npc.timeLeft > 1800) + npc.timeLeft = 1800; - float speed = expertMode ? 5f : 4.5f; - if (CalamityWorld.bossRushActive) - speed = 12f; - else if (!calamity) - speed = 7f; - else if (CalamityWorld.death) - speed = 6f; - else if (revenge) - speed = 5.5f; - speed += 2f * (1f - lifeRatio); + float speed = expertMode ? 5f : 4.5f; + if (CalamityWorld.bossRushActive) + speed = 12f; + else if (!calamity) + speed = 7f; + else if (CalamityWorld.death) + speed = 6f; + else if (revenge) + speed = 5.5f; + speed += 2f * (1f - lifeRatio); - if (npc.ai[0] <= 2f) - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - totalDistance = speed / totalDistance; - xDistance *= totalDistance; - yDistance *= totalDistance; - npc.velocity.X = (npc.velocity.X * 50f + xDistance) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + yDistance) / 51f; - } + if (npc.ai[0] <= 2f) + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + totalDistance = speed / totalDistance; + xDistance *= totalDistance; + yDistance *= totalDistance; + npc.velocity.X = (npc.velocity.X * 50f + xDistance) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + yDistance) / 51f; + } - if (npc.ai[0] == 0f) - { - npc.defense = provy ? 120 : 20; - npc.chaseable = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (CalamityWorld.bossRushActive ? 90f : 180f)) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int timer = 0; - int playerPosX; - int playerPosY; - while (true) - { - timer++; - playerPosX = (int)player.Center.X / 16; - playerPosY = (int)player.Center.Y / 16; + if (npc.ai[0] == 0f) + { + npc.defense = provy ? 120 : 20; + npc.chaseable = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= (CalamityWorld.bossRushActive ? 90f : 180f)) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int timer = 0; + int playerPosX; + int playerPosY; + while (true) + { + timer++; + playerPosX = (int)player.Center.X / 16; + playerPosY = (int)player.Center.Y / 16; - int min = 19; - int max = 22; + int min = 19; + int max = 22; - if (Main.rand.NextBool(2)) - playerPosX += Main.rand.Next(min, max); - else - playerPosX -= Main.rand.Next(min, max); + if (Main.rand.NextBool(2)) + playerPosX += Main.rand.Next(min, max); + else + playerPosX -= Main.rand.Next(min, max); - if (Main.rand.NextBool(2)) - playerPosY += Main.rand.Next(min, max); - else - playerPosY -= Main.rand.Next(min, max); + if (Main.rand.NextBool(2)) + playerPosY += Main.rand.Next(min, max); + else + playerPosY -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(playerPosX, playerPosY)) - break; + if (!WorldGen.SolidTile(playerPosX, playerPosY)) + break; - if (timer > 100) - return; - } - npc.ai[0] = 1f; - npc.ai[1] = (float)playerPosX; - npc.ai[2] = (float)playerPosY; - npc.netUpdate = true; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.defense = provy ? 120 : 20; - npc.chaseable = true; - npc.alpha += 25; - if (npc.alpha >= 255) - { - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("Brimling")) < 2 && revenge) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Brimling"), 0, 0f, 0f, 0f, 0f, 255); - } - Main.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= 25; - if (npc.alpha <= 0) - { - npc.defense = provy ? 120 : 20; - npc.chaseable = true; - npc.ai[3] += 1f; - npc.alpha = 0; - if (npc.ai[3] >= 2f) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[0] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - npc.defense = provy ? 120 : 20; - npc.chaseable = true; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - Vector2 shootFromVector = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); - npc.ai[1] += 1f; + if (timer > 100) + return; + } + npc.ai[0] = 1f; + npc.ai[1] = (float)playerPosX; + npc.ai[2] = (float)playerPosY; + npc.netUpdate = true; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.defense = provy ? 120 : 20; + npc.chaseable = true; + npc.alpha += 25; + if (npc.alpha >= 255) + { + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("Brimling")) < 2 && revenge) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Brimling"), 0, 0f, 0f, 0f, 0f, 255); + } + Main.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= 25; + if (npc.alpha <= 0) + { + npc.defense = provy ? 120 : 20; + npc.chaseable = true; + npc.ai[3] += 1f; + npc.alpha = 0; + if (npc.ai[3] >= 2f) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else + { + npc.ai[0] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.defense = provy ? 120 : 20; + npc.chaseable = true; + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + Vector2 shootFromVector = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); + npc.ai[1] += 1f; - bool shootProjectile = false; - if (lifeRatio < 0.1f || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 30f == 29f) - shootProjectile = true; - } - else if (lifeRatio < 0.5f || CalamityWorld.death) - { - if (npc.ai[1] % 35f == 34f) - shootProjectile = true; - } - else if (npc.ai[1] % 40f == 39f) - shootProjectile = true; + bool shootProjectile = false; + if (lifeRatio < 0.1f || CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 30f == 29f) + shootProjectile = true; + } + else if (lifeRatio < 0.5f || CalamityWorld.death) + { + if (npc.ai[1] % 35f == 34f) + shootProjectile = true; + } + else if (npc.ai[1] % 40f == 39f) + shootProjectile = true; - if (shootProjectile) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float projectileSpeed = CalamityWorld.bossRushActive ? 7f : 5f; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - projectileSpeed += 4f; - if (revenge) - projectileSpeed += 1f; - if (!calamity) - projectileSpeed += 2f; - projectileSpeed += 3f * (1f - lifeRatio); + if (shootProjectile) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileSpeed = CalamityWorld.bossRushActive ? 7f : 5f; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + projectileSpeed += 4f; + if (revenge) + projectileSpeed += 1f; + if (!calamity) + projectileSpeed += 2f; + projectileSpeed += 3f * (1f - lifeRatio); - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); - float num742 = CalamityWorld.bossRushActive ? 6f : 4f; - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); + float num742 = CalamityWorld.bossRushActive ? 6f : 4f; + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; - int damage = expertMode ? 25 : 30; - int numProj = 4; - int spread = 45; - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; - double deltaAngle = rotation / (float)numProj; - double offsetAngle; + int damage = expertMode ? 25 : 30; + int numProj = 4; + int spread = 45; + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / (float)numProj; + double offsetAngle; - for (int i = 0; i < numProj; i++) - { - offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjectileType("BrimstoneBarrage"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); - } + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjectileType("BrimstoneBarrage"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + } - float relativeSpeedX = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - float relativeSpeedY = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; - float totalRelativeSpeed = (float)Math.Sqrt((double)(relativeSpeedX * relativeSpeedX + relativeSpeedY * relativeSpeedY)); - totalRelativeSpeed = projectileSpeed / totalRelativeSpeed; - relativeSpeedX *= totalRelativeSpeed; - relativeSpeedY *= totalRelativeSpeed; - shootFromVector.X += relativeSpeedX * 3f; - shootFromVector.Y += relativeSpeedY * 3f; - int projectileDamage = expertMode ? 28 : 35; - int projectileType = mod.ProjectileType("BrimstoneHellfireball"); - int projectileShot = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, relativeSpeedX, relativeSpeedY, projectileType, projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectileShot].timeLeft = 240; - } - } + float relativeSpeedX = player.position.X + (float)player.width * 0.5f - shootFromVector.X; + float relativeSpeedY = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; + float totalRelativeSpeed = (float)Math.Sqrt((double)(relativeSpeedX * relativeSpeedX + relativeSpeedY * relativeSpeedY)); + totalRelativeSpeed = projectileSpeed / totalRelativeSpeed; + relativeSpeedX *= totalRelativeSpeed; + relativeSpeedY *= totalRelativeSpeed; + shootFromVector.X += relativeSpeedX * 3f; + shootFromVector.Y += relativeSpeedY * 3f; + int projectileDamage = expertMode ? 28 : 35; + int projectileType = mod.ProjectileType("BrimstoneHellfireball"); + int projectileShot = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, relativeSpeedX, relativeSpeedY, projectileType, projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectileShot].timeLeft = 240; + } + } - if (npc.position.Y > player.position.Y - 150f) //200 - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + if (npc.position.Y > player.position.Y - 150f) //200 + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - } - else if (npc.position.Y < player.position.Y - 350f) //500 - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + } + else if (npc.position.Y < player.position.Y - 350f) //500 + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 150f) //100 - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.985f; + if (npc.velocity.Y < -3f) + npc.velocity.Y = -3f; + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 150f) //100 + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X * 0.985f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 150f) //100 - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.985f; + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 150f) //100 + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X * 0.985f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } - if (npc.ai[1] >= 300f) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - npc.defense = 99999; - npc.chaseable = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f + 2f * (1f - lifeRatio); - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - npc.localAI[0] += 2f; - if (CalamityWorld.death || !calamity) - npc.localAI[0] += 1f; + if (npc.ai[1] >= 300f) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + npc.defense = 99999; + npc.chaseable = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f + 2f * (1f - lifeRatio); + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + npc.localAI[0] += 2f; + if (CalamityWorld.death || !calamity) + npc.localAI[0] += 1f; - if (npc.localAI[0] >= 140f) - { - npc.localAI[0] = 0f; + if (npc.localAI[0] >= 140f) + { + npc.localAI[0] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(true); - float projectileSpeed = revenge ? 8f : 6f; - if (CalamityWorld.bossRushActive) - projectileSpeed = 12f; + float projectileSpeed = revenge ? 8f : 6f; + if (CalamityWorld.bossRushActive) + projectileSpeed = 12f; - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = projectileSpeed / num183; - num180 *= num183; - num182 *= num183; + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = projectileSpeed / num183; + num180 *= num183; + num182 *= num183; - int num184 = expertMode ? 25 : 30; - int num185 = mod.ProjectileType("BrimstoneHellblast"); - shootFromVector.X += num180; - shootFromVector.Y += num182; + int num184 = expertMode ? 25 : 30; + int num185 = mod.ProjectileType("BrimstoneHellblast"); + shootFromVector.X += num180; + shootFromVector.Y += num182; - for (int num186 = 0; num186 < 6; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = projectileSpeed / num183; - num180 += (float)Main.rand.Next(-80, 81); - num182 += (float)Main.rand.Next(-80, 81); - num180 *= num183; - num182 *= num183; - int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, num180, num182, num185, num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); - Main.projectile[projectile].timeLeft = 300; - Main.projectile[projectile].tileCollide = false; - } + for (int num186 = 0; num186 < 6; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; + num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = projectileSpeed / num183; + num180 += (float)Main.rand.Next(-80, 81); + num182 += (float)Main.rand.Next(-80, 81); + num180 *= num183; + num182 *= num183; + int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, num180, num182, num185, num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Main.projectile[projectile].timeLeft = 300; + Main.projectile[projectile].tileCollide = false; + } - int totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 9f : 6f; + int totalProjectiles = 12; + float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 + double offsetAngle; + float velocity = CalamityWorld.bossRushActive ? 9f : 6f; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("BrimstoneBarrage"), num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("BrimstoneBarrage"), num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); - } - } - } + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("BrimstoneBarrage"), num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("BrimstoneBarrage"), num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + } + } + } - npc.TargetClosest(true); + npc.TargetClosest(true); - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.velocity *= 0.95f; + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - } + npc.ai[1] += 1f; + if (npc.ai[1] >= 300f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } - public override void FindFrame(int frameHeight) //9 total frames - { - npc.frameCounter += 1.0; - if (npc.ai[0] <= 2f) - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 4) - { - npc.frame.Y = 0; - } - } - else if (npc.ai[0] == 3f) - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y < frameHeight * 4) - { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y >= frameHeight * 8) - { - npc.frame.Y = frameHeight * 4; - } - } - else - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y < frameHeight * 8) - { - npc.frame.Y = frameHeight * 8; - } - if (npc.frame.Y >= frameHeight * 12) - { - npc.frame.Y = frameHeight * 8; - } - } - } + public override void FindFrame(int frameHeight) //9 total frames + { + npc.frameCounter += 1.0; + if (npc.ai[0] <= 2f) + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 4) + { + npc.frame.Y = 0; + } + } + else if (npc.ai[0] == 3f) + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y < frameHeight * 4) + { + npc.frame.Y = frameHeight * 4; + } + if (npc.frame.Y >= frameHeight * 8) + { + npc.frame.Y = frameHeight * 4; + } + } + else + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y < frameHeight * 8) + { + npc.frame.Y = frameHeight * 8; + } + if (npc.frame.Y >= frameHeight * 12) + { + npc.frame.Y = frameHeight * 8; + } + } + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } - public override void NPCLoot() - { - // redo the rest of this drop code later - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneElementalTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - if (CalamityWorld.downedProvidence) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(20, 31)); - } - if (Main.rand.NextBool(10)) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("RoseStone"), 1, true); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofFright, Main.rand.Next(20, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 9)); - switch (Main.rand.Next(3)) - { - case 0: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Abaddon")); - break; - case 1: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Brimlance")); - break; - case 2: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeethingDischarge")); - break; - } - } + public override void NPCLoot() + { + // redo the rest of this drop code later + if (Main.rand.NextBool(10)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneElementalTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + if (CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(20, 31)); + } + if (Main.rand.NextBool(10)) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("RoseStone"), 1, true); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofFright, Main.rand.Next(20, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 9)); + switch (Main.rand.Next(3)) + { + case 0: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Abaddon")); + break; + case 1: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Brimlance")); + break; + case 2: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeethingDischarge")); + break; + } + } - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBrimstoneElemental, 4, 2, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBrimstoneCrag"), true, !CalamityWorld.downedBrimstoneElemental); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBrimstoneElemental"), true, !CalamityWorld.downedBrimstoneElemental); + DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBrimstoneElemental, 4, 2, 1); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBrimstoneCrag"), true, !CalamityWorld.downedBrimstoneElemental); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBrimstoneElemental"), true, !CalamityWorld.downedBrimstoneElemental); - // if prime hasn't been killed and this is the first time killing brimmy, do the message - string key = "Mods.CalamityMod.SteelSkullBossText"; - Color messageColor = Color.Crimson; - if (!NPC.downedMechBoss3 && !CalamityWorld.downedBrimstoneElemental) - { - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + // if prime hasn't been killed and this is the first time killing brimmy, do the message + string key = "Mods.CalamityMod.SteelSkullBossText"; + Color messageColor = Color.Crimson; + if (!NPC.downedMechBoss3 && !CalamityWorld.downedBrimstoneElemental) + { + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } - // mark brimmy as dead - CalamityWorld.downedBrimstoneElemental = true; + // mark brimmy as dead + CalamityWorld.downedBrimstoneElemental = true; CalamityMod.UpdateServerBoolean(); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 150; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore4"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 150; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore4"), 1f); + } + } + } } diff --git a/NPCs/Bumblefuck/Bumblefuck.cs b/NPCs/Bumblefuck/Bumblefuck.cs index cb301ec737..de7c17d81c 100644 --- a/NPCs/Bumblefuck/Bumblefuck.cs +++ b/NPCs/Bumblefuck/Bumblefuck.cs @@ -1,597 +1,597 @@ -using System; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Bumblefuck { [AutoloadBossHead] - public class Bumblefuck : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bumblebirb"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.npcSlots = 32f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 160; - npc.width = 80; - npc.height = 80; - npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 252500 : 227500; - if (CalamityWorld.death) - { - npc.lifeMax = 302500; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1000000 : 900000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); - else - music = MusicID.Boss4; - npc.lavaImmune = true; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 30, 0, 0); - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; - bossBag = mod.ItemType("BumblebirbBag"); - } - - public override void AI() - { - // Variables - Player player = Main.player[npc.target]; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - Vector2 vector = npc.Center; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases - float mult = 1f + - (revenge ? 0.25f : 0f) + - ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.25f : 0f); - bool phase2 = lifeRatio < 0.5f * mult; - bool phase3 = lifeRatio < 0.1f * mult; - - // Max spawn amount - int num1305 = revenge ? 4 : 3; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num1305 = 5; - if (phase2) - num1305 = 2; - - // Don't collide with tiles, disable gravity - npc.noTileCollide = false; - npc.noGravity = true; - - // Reset damage - npc.damage = npc.defDamage; - - // Despawn - if (Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - - // Fly to target if target is too far away and not in idle or switch phase - Vector2 vector205 = player.Center - npc.Center; - if (npc.ai[0] > 1f && vector205.Length() > 3600f) - npc.ai[0] = 1f; - - // Phase switch - if (npc.ai[0] == 0f) - { - // Target - npc.TargetClosest(true); - - if (npc.Center.X < player.Center.X - 2f) - npc.direction = 1; - if (npc.Center.X > player.Center.X + 2f) - npc.direction = -1; - - // Direction and rotation - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - - // Slow down if colliding with tiles - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - - // Fly to target if target is too far away, otherwise get close to target and then slow down - Vector2 value51 = player.Center - npc.Center; - value51.Y -= 200f; - if (value51.Length() > 2800f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value51.Length() > 240f) - { - float scaleFactor15 = 12f; - float num1306 = 30f; - value51.Normalize(); - value51 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - // Phase switch - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - while (npc.ai[0] == 0f) - { - int damage = Main.expertMode ? 50 : 60; - - int num1307 = (phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3)); - if (phase3) - num1307 = 1; - - if (num1307 == 0 && Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - npc.ai[0] = 2f; - else if (num1307 == 1) - { - npc.ai[0] = 3f; - if (phase2) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-2, 3), -4f, mod.ProjectileType("RedLightningFeather"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305) - { - npc.ai[0] = 4f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); - int featherAmt = phase2 ? 3 : 6; - for (int num186 = 0; num186 < featherAmt; num186++) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-4, 5), -3f, mod.ProjectileType("RedLightningFeather"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - else - { - // Fly to target - if (npc.ai[0] == 1f) - { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - - if (npc.target < 0 || !player.active || player.dead) - npc.TargetClosest(true); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; - - Vector2 value52 = player.Center - npc.Center; - if (value52.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - float scaleFactor16 = 14f + value52.Length() / 100f; //7 - float num1308 = 25f; - value52.Normalize(); - value52 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; - return; - } - - // Fly towards target quickly - if (npc.ai[0] == 2f) - { - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - if (player.Center.X - 10f < npc.Center.X) - npc.direction = -1; - else if (player.Center.X + 10f > npc.Center.X) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.05f) / 5f; - - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - - Vector2 value53 = player.Center - npc.Center; - value53.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (Main.expertMode) - npc.ai[2] += 0.0166666675f; - - float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4 - float num1309 = 20f; - value53.Normalize(); - value53 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; - - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else - { - // Variable for charging - float chargeDistance = 600f; - if (phase2) - chargeDistance -= 50f; - if (phase3) - chargeDistance -= 50f; - - // Line up charge - if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - - Vector2 value54 = player.Center - npc.Center; - value54.Y -= 12f; - if (npc.Center.X > player.Center.X) - value54.X += chargeDistance; - else - value54.X -= chargeDistance; - - if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < (phase3 ? 100f : 20f)) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - } - - npc.ai[1] += 0.0333333351f; - float scaleFactor18 = 18f + npc.ai[1]; - float num1310 = 4f; - value54.Normalize(); - value54 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; - return; - } - - // Prepare to charge - if (npc.ai[0] == 3.1f) - { - npc.noTileCollide = true; - - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - - Vector2 vector206 = player.Center - npc.Center; - vector206.Y -= 12f; - float scaleFactor19 = 32f; //16 - float num1311 = 8f; - vector206.Normalize(); - vector206 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = vector206; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 3.2f; - npc.ai[1] = 0f; - npc.ai[1] = (float)npc.direction; - } - } - else - { - // Charge - if (npc.ai[0] == 3.2f) - { - npc.damage = (int)((double)npc.defDamage * 1.5); - - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - - npc.ai[2] += 0.0333333351f; - npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; - - if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - return; - } - - // Find tile coordinates for birb spawn - if (npc.ai[0] == 4f) - { - npc.ai[0] = 0f; - - npc.TargetClosest(true); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = -1f; - npc.ai[2] = -1f; - - for (int num1312 = 0; num1312 < 1000; num1312++) - { - int num1313 = (int)player.Center.X / 16; - int num1314 = (int)player.Center.Y / 16; - - int num1315 = 30 + num1312 / 50; - int num1316 = 20 + num1312 / 75; - - num1313 += Main.rand.Next(-num1315, num1315 + 1); - num1314 += Main.rand.Next(-num1316, num1316 + 1); - - if (!WorldGen.SolidTile(num1313, num1314)) - { - while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface) - num1314++; - - if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 3600f) - { - npc.ai[0] = 4.1f; - npc.ai[1] = (float)num1313; - npc.ai[2] = (float)num1314; - break; - } - } - } - } - - npc.netUpdate = true; - return; - } - - // Move to birb spawn location - if (npc.ai[0] == 4.1f) - { - if (npc.velocity.X < -2f) - npc.direction = -1; - else if (npc.velocity.X > 2f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - - npc.noTileCollide = true; - - int num1317 = (int)npc.ai[1]; - int num1318 = (int)npc.ai[2]; - - float x2 = (float)(num1317 * 16 + 8); - float y2 = (float)(num1318 * 16 - 20); - - Vector2 vector207 = new Vector2(x2, y2); - vector207 -= npc.Center; - float num1319 = 12f + vector207.Length() / 150f; - if (num1319 > 20f) - num1319 = 20f; - - float num1320 = 10f; - if (vector207.Length() < 10f) - npc.ai[0] = 4.2f; - - vector207.Normalize(); - vector207 *= num1319; - npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320; - return; - } - - // Spawn birbs - if (npc.ai[0] == 4.2f) - { - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - - npc.noTileCollide = true; - - int num1321 = (int)npc.ai[1]; - int num1322 = (int)npc.ai[2]; - - float x3 = (float)(num1321 * 16 + 8); - float y3 = (float)(num1322 * 16 - 20); - - Vector2 vector208 = new Vector2(x3, y3); - vector208 -= npc.Center; - - float num1323 = 4f; //4 - float num1324 = 2f; //2 - - if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 4f) - { - int num1325 = 10; - if (Main.expertMode) - num1325 = (int)((double)num1325 * 0.75); - - npc.ai[3] += 1f; - if (npc.ai[3] == (float)num1325) - NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, mod.NPCType("Bumblefuck2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - else if (npc.ai[3] == (float)(num1325 * 2)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305 && Main.rand.Next(5) != 0) - npc.ai[0] = 4f; - else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 1f; - } - } - - if (vector208.Length() > num1323) - { - vector208.Normalize(); - vector208 *= num1323; - } - - npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324; - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (double)(npc.velocity.Length() / 4f); - npc.frameCounter += 1.0; - if (npc.ai[0] < 4f) - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 4) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 9) - { - npc.frame.Y = frameHeight * 5; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "A Bumblebirb"; - potionType = ItemID.SuperHealingPotion; - } + public class Bumblefuck : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bumblebirb"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.npcSlots = 32f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 160; + npc.width = 80; + npc.height = 80; + npc.defense = 40; + npc.lifeMax = CalamityWorld.revenge ? 252500 : 227500; + if (CalamityWorld.death) + { + npc.lifeMax = 302500; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 900000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("ExoFreeze")] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); + else + music = MusicID.Boss4; + npc.lavaImmune = true; + npc.noGravity = true; + npc.value = Item.buyPrice(0, 30, 0, 0); + npc.HitSound = SoundID.NPCHit51; + npc.DeathSound = SoundID.NPCDeath46; + bossBag = mod.ItemType("BumblebirbBag"); + } + + public override void AI() + { + // Variables + Player player = Main.player[npc.target]; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + Vector2 vector = npc.Center; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + float mult = 1f + + (revenge ? 0.25f : 0f) + + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.25f : 0f); + bool phase2 = lifeRatio < 0.5f * mult; + bool phase3 = lifeRatio < 0.1f * mult; + + // Max spawn amount + int num1305 = revenge ? 4 : 3; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + num1305 = 5; + if (phase2) + num1305 = 2; + + // Don't collide with tiles, disable gravity + npc.noTileCollide = false; + npc.noGravity = true; + + // Reset damage + npc.damage = npc.defDamage; + + // Despawn + if (Vector2.Distance(player.Center, vector) > 5600f) + { + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + + // Fly to target if target is too far away and not in idle or switch phase + Vector2 vector205 = player.Center - npc.Center; + if (npc.ai[0] > 1f && vector205.Length() > 3600f) + npc.ai[0] = 1f; + + // Phase switch + if (npc.ai[0] == 0f) + { + // Target + npc.TargetClosest(true); + + if (npc.Center.X < player.Center.X - 2f) + npc.direction = 1; + if (npc.Center.X > player.Center.X + 2f) + npc.direction = -1; + + // Direction and rotation + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + + // Slow down if colliding with tiles + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > 4f) + npc.velocity.X = 4f; + if (npc.velocity.X < -4f) + npc.velocity.X = -4f; + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + + // Fly to target if target is too far away, otherwise get close to target and then slow down + Vector2 value51 = player.Center - npc.Center; + value51.Y -= 200f; + if (value51.Length() > 2800f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (value51.Length() > 240f) + { + float scaleFactor15 = 12f; + float num1306 = 30f; + value51.Normalize(); + value51 *= scaleFactor15; + npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; + } + else if (npc.velocity.Length() > 2f) + npc.velocity *= 0.95f; + else if (npc.velocity.Length() < 1f) + npc.velocity *= 1.05f; + + // Phase switch + npc.ai[1] += 1f; + if (npc.ai[1] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + while (npc.ai[0] == 0f) + { + int damage = Main.expertMode ? 50 : 60; + + int num1307 = (phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3)); + if (phase3) + num1307 = 1; + + if (num1307 == 0 && Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + npc.ai[0] = 2f; + else if (num1307 == 1) + { + npc.ai[0] = 3f; + if (phase2) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-2, 3), -4f, mod.ProjectileType("RedLightningFeather"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305) + { + npc.ai[0] = 4f; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); + int featherAmt = phase2 ? 3 : 6; + for (int num186 = 0; num186 < featherAmt; num186++) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-4, 5), -3f, mod.ProjectileType("RedLightningFeather"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + else + { + // Fly to target + if (npc.ai[0] == 1f) + { + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + + if (npc.target < 0 || !player.active || player.dead) + npc.TargetClosest(true); + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; + + Vector2 value52 = player.Center - npc.Center; + if (value52.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + float scaleFactor16 = 14f + value52.Length() / 100f; //7 + float num1308 = 25f; + value52.Normalize(); + value52 *= scaleFactor16; + npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; + return; + } + + // Fly towards target quickly + if (npc.ai[0] == 2f) + { + if (npc.target < 0 || !player.active || player.dead) + { + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + if (player.Center.X - 10f < npc.Center.X) + npc.direction = -1; + else if (player.Center.X + 10f > npc.Center.X) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.05f) / 5f; + + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > 4f) + npc.velocity.X = 4f; + if (npc.velocity.X < -4f) + npc.velocity.X = -4f; + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + + Vector2 value53 = player.Center - npc.Center; + value53.Y -= 20f; + npc.ai[2] += 0.0222222228f; + if (Main.expertMode) + npc.ai[2] += 0.0166666675f; + + float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4 + float num1309 = 20f; + value53.Normalize(); + value53 *= scaleFactor17; + npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; + + npc.ai[1] += 1f; + if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else + { + // Variable for charging + float chargeDistance = 600f; + if (phase2) + chargeDistance -= 50f; + if (phase3) + chargeDistance -= 50f; + + // Line up charge + if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; + + Vector2 value54 = player.Center - npc.Center; + value54.Y -= 12f; + if (npc.Center.X > player.Center.X) + value54.X += chargeDistance; + else + value54.X -= chargeDistance; + + if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < (phase3 ? 100f : 20f)) + { + npc.ai[0] = 3.1f; + npc.ai[1] = 0f; + } + + npc.ai[1] += 0.0333333351f; + float scaleFactor18 = 18f + npc.ai[1]; + float num1310 = 4f; + value54.Normalize(); + value54 *= scaleFactor18; + npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; + return; + } + + // Prepare to charge + if (npc.ai[0] == 3.1f) + { + npc.noTileCollide = true; + + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; + + Vector2 vector206 = player.Center - npc.Center; + vector206.Y -= 12f; + float scaleFactor19 = 32f; //16 + float num1311 = 8f; + vector206.Normalize(); + vector206 *= scaleFactor19; + npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.velocity = vector206; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.ai[0] = 3.2f; + npc.ai[1] = 0f; + npc.ai[1] = (float)npc.direction; + } + } + else + { + // Charge + if (npc.ai[0] == 3.2f) + { + npc.damage = (int)((double)npc.defDamage * 1.5); + + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + + npc.ai[2] += 0.0333333351f; + npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; + + if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; + return; + } + + // Find tile coordinates for birb spawn + if (npc.ai[0] == 4f) + { + npc.ai[0] = 0f; + + npc.TargetClosest(true); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = -1f; + npc.ai[2] = -1f; + + for (int num1312 = 0; num1312 < 1000; num1312++) + { + int num1313 = (int)player.Center.X / 16; + int num1314 = (int)player.Center.Y / 16; + + int num1315 = 30 + num1312 / 50; + int num1316 = 20 + num1312 / 75; + + num1313 += Main.rand.Next(-num1315, num1315 + 1); + num1314 += Main.rand.Next(-num1316, num1316 + 1); + + if (!WorldGen.SolidTile(num1313, num1314)) + { + while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface) + num1314++; + + if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 3600f) + { + npc.ai[0] = 4.1f; + npc.ai[1] = (float)num1313; + npc.ai[2] = (float)num1314; + break; + } + } + } + } + + npc.netUpdate = true; + return; + } + + // Move to birb spawn location + if (npc.ai[0] == 4.1f) + { + if (npc.velocity.X < -2f) + npc.direction = -1; + else if (npc.velocity.X > 2f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + + npc.noTileCollide = true; + + int num1317 = (int)npc.ai[1]; + int num1318 = (int)npc.ai[2]; + + float x2 = (float)(num1317 * 16 + 8); + float y2 = (float)(num1318 * 16 - 20); + + Vector2 vector207 = new Vector2(x2, y2); + vector207 -= npc.Center; + float num1319 = 12f + vector207.Length() / 150f; + if (num1319 > 20f) + num1319 = 20f; + + float num1320 = 10f; + if (vector207.Length() < 10f) + npc.ai[0] = 4.2f; + + vector207.Normalize(); + vector207 *= num1319; + npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320; + return; + } + + // Spawn birbs + if (npc.ai[0] == 4.2f) + { + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + + npc.noTileCollide = true; + + int num1321 = (int)npc.ai[1]; + int num1322 = (int)npc.ai[2]; + + float x3 = (float)(num1321 * 16 + 8); + float y3 = (float)(num1322 * 16 - 20); + + Vector2 vector208 = new Vector2(x3, y3); + vector208 -= npc.Center; + + float num1323 = 4f; //4 + float num1324 = 2f; //2 + + if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 4f) + { + int num1325 = 10; + if (Main.expertMode) + num1325 = (int)((double)num1325 * 0.75); + + npc.ai[3] += 1f; + if (npc.ai[3] == (float)num1325) + NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, mod.NPCType("Bumblefuck2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + else if (npc.ai[3] == (float)(num1325 * 2)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305 && Main.rand.Next(5) != 0) + npc.ai[0] = 4f; + else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.ai[0] = 1f; + } + } + + if (vector208.Length() > num1323) + { + vector208.Normalize(); + vector208 *= num1323; + } + + npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324; + } + } + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (double)(npc.velocity.Length() / 4f); + npc.frameCounter += 1.0; + if (npc.ai[0] < 4f) + { + if (npc.frameCounter >= 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y / frameHeight > 4) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter >= 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y / frameHeight > 9) + { + npc.frame.Y = frameHeight * 5; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "A Bumblebirb"; + potionType = ItemID.SuperHealingPotion; + } public override void NPCLoot() { @@ -618,36 +618,36 @@ namespace CalamityMod.NPCs.Bumblefuck } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleHead"), 1f); - for (int wing = 0; wing < 2; wing++) - { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleWing"), 1f); - } - for (int leg = 0; leg < 4; leg++) - { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleLeg"), 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleHead"), 1f); + for (int wing = 0; wing < 2; wing++) + { + randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleWing"), 1f); + } + for (int leg = 0; leg < 4; leg++) + { + randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleLeg"), 1f); + } + } + } + } } diff --git a/NPCs/Bumblefuck/Bumblefuck2.cs b/NPCs/Bumblefuck/Bumblefuck2.cs index 670ef2ec8d..bc32b3ff54 100644 --- a/NPCs/Bumblefuck/Bumblefuck2.cs +++ b/NPCs/Bumblefuck/Bumblefuck2.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Bumblefuck { public class Bumblefuck2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bumblebirb"); - Main.npcFrameCount[npc.type] = 10; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bumblebirb"); + Main.npcFrameCount[npc.type] = 10; + } - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 110; - npc.width = 80; - npc.height = 80; - npc.scale = 0.66f; - npc.defense = 20; - npc.lifeMax = 25000; + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 110; + npc.width = 80; + npc.height = 80; + npc.scale = 0.66f; + npc.defense = 20; + npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { npc.lifeMax = 60000; } npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; - npc.lavaImmune = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; - } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("ExoFreeze")] = false; + npc.lavaImmune = true; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit51; + npc.DeathSound = SoundID.NPCDeath46; + } public override void AI() { @@ -247,8 +247,8 @@ namespace CalamityMod.NPCs.Bumblefuck } else if (npc.ai[0] == 2.1f) { - npc.damage = (int)((double)npc.defDamage * 1.5); - if (npc.velocity.X < 0f) + npc.damage = (int)((double)npc.defDamage * 1.5); + if (npc.velocity.X < 0f) { npc.direction = -1; } @@ -286,49 +286,49 @@ namespace CalamityMod.NPCs.Bumblefuck return false; } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += (double)(npc.velocity.Length() / 4f); - npc.frameCounter += 1.0; - if (npc.ai[0] < 4f) - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 4) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 9) - { - npc.frame.Y = frameHeight * 5; - } - } + npc.frameCounter += 1.0; + if (npc.ai[0] < 4f) + { + if (npc.frameCounter >= 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y / frameHeight > 4) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter >= 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y / frameHeight > 9) + { + npc.frame.Y = frameHeight * 5; + } + } } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Calamitas/CalScreenShaderData.cs b/NPCs/Calamitas/CalScreenShaderData.cs index e2e8a841ba..d4e665b055 100644 --- a/NPCs/Calamitas/CalScreenShaderData.cs +++ b/NPCs/Calamitas/CalScreenShaderData.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Calamitas { - public class CalScreenShaderData : ScreenShaderData - { - private int CalIndex; + public class CalScreenShaderData : ScreenShaderData + { + private int CalIndex; - public CalScreenShaderData(string passName) - : base(passName) - { - } + public CalScreenShaderData(string passName) + : base(passName) + { + } - private void UpdateCalIndex() - { - int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); - if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) - { - return; - } - CalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == CalType) - { - CalIndex = i; - break; - } - } - } + private void UpdateCalIndex() + { + int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) + { + return; + } + CalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == CalType) + { + CalIndex = i; + break; + } + } + } - public override void Apply() - { - UpdateCalIndex(); - if (CalIndex != -1) - { - UseTargetPosition(Main.npc[CalIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdateCalIndex(); + if (CalIndex != -1) + { + UseTargetPosition(Main.npc[CalIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/Calamitas/CalSky.cs b/NPCs/Calamitas/CalSky.cs index 067ee0c6e8..631732fe27 100644 --- a/NPCs/Calamitas/CalSky.cs +++ b/NPCs/Calamitas/CalSky.cs @@ -6,96 +6,96 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Calamitas { - public class CalSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int CalIndex = -1; + public class CalSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int CalIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdateCalIndex()) - { - float x = 0f; - if (this.CalIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } + private float GetIntensity() + { + if (this.UpdateCalIndex()) + { + float x = 0f; + if (this.CalIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdateCalIndex() - { - int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); - if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) - { - return true; - } - CalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == CalType) - { - CalIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return CalIndex != -1; - } + private bool UpdateCalIndex() + { + int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) + { + return true; + } + CalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == CalType) + { + CalIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return CalIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index 0519e566b5..855a62f3d4 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -1,429 +1,429 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria.Localization; +using System; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Calamitas { [AutoloadBossHead] - public class Calamitas : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Main.npcFrameCount[npc.type] = 6; - } + public class Calamitas : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 55; - npc.npcSlots = 14f; - npc.width = 120; - npc.height = 120; - npc.defense = 15; + public override void SetDefaults() + { + npc.damage = 55; + npc.npcSlots = 14f; + npc.width = 120; + npc.height = 120; + npc.defense = 15; npc.Calamity().RevPlusDR(0.15f); - npc.value = 0f; - npc.lifeMax = CalamityWorld.revenge ? 51750 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 82750; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - music = MusicID.Boss2; - if (CalamityWorld.downedProvidence) - { - npc.damage = 150; - npc.defense = 130; - npc.lifeMax *= 3; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4600000 : 4100000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.value = 0f; + npc.lifeMax = CalamityWorld.revenge ? 51750 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 82750; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + music = MusicID.Boss2; + if (CalamityWorld.downedProvidence) + { + npc.damage = 150; + npc.defense = 130; + npc.lifeMax *= 3; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4600000 : 4100000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() - { - if ((double)npc.life <= (double)npc.lifeMax * 0.75 && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun3"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - string key = "Mods.CalamityMod.CalamitasBossText"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - npc.active = false; - npc.netUpdate = true; - return; - } + public override void AI() + { + if ((double)npc.life <= (double)npc.lifeMax * 0.75 && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun3"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + string key = "Mods.CalamityMod.CalamitasBossText"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + npc.active = false; + npc.netUpdate = true; + return; + } - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; + bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); - Player player = Main.player[npc.target]; + Player player = Main.player[npc.target]; - float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; - if (num803 < 0f) - num803 += 6.283f; - else if ((double)num803 > 6.283) - num803 -= 6.283f; + float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; + if (num803 < 0f) + num803 += 6.283f; + else if ((double)num803 > 6.283) + num803 -= 6.283f; - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((double)(num803 - npc.rotation) > 3.1415) - npc.rotation -= num804; - else - npc.rotation += num804; - } - else if (npc.rotation > num803) - { - if ((double)(npc.rotation - num803) > 3.1415) - npc.rotation += num804; - else - npc.rotation -= num804; - } + float num804 = 0.1f; + if (npc.rotation < num803) + { + if ((double)(num803 - npc.rotation) > 3.1415) + npc.rotation -= num804; + else + npc.rotation += num804; + } + else if (npc.rotation > num803) + { + if ((double)(npc.rotation - num803) > 3.1415) + npc.rotation += num804; + else + npc.rotation -= num804; + } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; - if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + npc.rotation = num803; + if (npc.rotation < 0f) + npc.rotation += 6.283f; + else if ((double)npc.rotation > 6.283) + npc.rotation -= 6.283f; + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + npc.rotation = num803; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - npc.timeLeft = 150; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + npc.timeLeft = 150; - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + return; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; - if (npc.ai[1] == 0f) - { - float num823 = expertMode ? 9.5f : 8f; - float num824 = expertMode ? 0.175f : 0.15f; - if (CalamityWorld.bossRushActive) - { - num823 *= 1.5f; - num824 *= 1.5f; - } + if (npc.ai[1] == 0f) + { + float num823 = expertMode ? 9.5f : 8f; + float num824 = expertMode ? 0.175f : 0.15f; + if (CalamityWorld.bossRushActive) + { + num823 *= 1.5f; + num824 *= 1.5f; + } - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - (CalamityWorld.bossRushActive ? 400f : 300f) - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - (CalamityWorld.bossRushActive ? 400f : 300f) - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - npc.velocity.X = npc.velocity.X + num824; - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - npc.velocity.X = npc.velocity.X - num824; - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - npc.velocity.Y = npc.velocity.Y + num824; - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - npc.velocity.Y = npc.velocity.Y - num824; - } + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + npc.velocity.X = npc.velocity.X + num824; + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + npc.velocity.X = npc.velocity.X - num824; + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + npc.velocity.Y = npc.velocity.Y + num824; + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + npc.velocity.Y = npc.velocity.Y - num824; + } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (revenge) - npc.localAI[1] += 0.5f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (revenge) + npc.localAI[1] += 0.5f; - if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 13f : 10.5f); - int num829 = expertMode ? 28 : 35; - int num830 = mod.ProjectileType("BrimstoneLaser"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 12f; - vector82.Y += num826 * 12f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - else - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - num831 = -1; + if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 13f : 10.5f); + int num829 = expertMode ? 28 : 35; + int num830 = mod.ProjectileType("BrimstoneLaser"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 12f; + vector82.Y += num826 * 12f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + else + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + num831 = -1; - float num832 = expertMode ? 9.5f : 8f; - float num833 = expertMode ? 0.25f : 0.2f; - if (CalamityWorld.bossRushActive) - { - num832 *= 1.5f; - num833 *= 1.5f; - } + float num832 = expertMode ? 9.5f : 8f; + float num833 = expertMode ? 0.25f : 0.2f; + if (CalamityWorld.bossRushActive) + { + num832 *= 1.5f; + num833 *= 1.5f; + } - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * (CalamityWorld.bossRushActive ? 460 : 360)) - vector83.X; - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * (CalamityWorld.bossRushActive ? 460 : 360)) - vector83.X; + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - npc.velocity.X = npc.velocity.X + num833; - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - npc.velocity.X = npc.velocity.X - num833; - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - npc.velocity.Y = npc.velocity.Y + num833; - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - npc.velocity.Y = npc.velocity.Y - num833; - } + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + npc.velocity.X = npc.velocity.X + num833; + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + npc.velocity.X = npc.velocity.X - num833; + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + npc.velocity.Y = npc.velocity.Y + num833; + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + npc.velocity.Y = npc.velocity.Y - num833; + } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (revenge) - npc.localAI[1] += 0.5f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (revenge) + npc.localAI[1] += 0.5f; - if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num837 = CalamityWorld.bossRushActive ? 14f : 10.5f; - int num838 = expertMode ? 20 : 24; - int num839 = mod.ProjectileType("BrimstoneLaser"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 12f; - vector83.Y += num835 * 12f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } + if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num837 = CalamityWorld.bossRushActive ? 14f : 10.5f; + int num838 = expertMode ? 20 : 24; + int num839 = mod.ProjectileType("BrimstoneLaser"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 12f; + vector83.Y += num835 * 12f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - } + npc.ai[2] += 1f; + if (npc.ai[2] >= 180f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - } - else - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + } + else + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } } diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 32d737e185..cf14ed599c 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -1,528 +1,528 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Calamitas { [AutoloadBossHead] - public class CalamitasRun : ModNPC - { - private bool canDespawn = false; + public class CalamitasRun : ModNPC + { + private bool canDespawn = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 60; - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; - npc.defense = 10; + public override void SetDefaults() + { + npc.damage = 60; + npc.npcSlots = 5f; + npc.width = 120; + npc.height = 120; + npc.defense = 10; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = CalamityWorld.revenge ? 13200 : 9000; - if (CalamityWorld.death) - { - npc.lifeMax = 15000; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; - if (CalamityWorld.downedProvidence) - { - npc.damage = 170; - npc.defense = 80; - npc.lifeMax *= 3; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = CalamityWorld.revenge ? 13200 : 9000; + if (CalamityWorld.death) + { + npc.lifeMax = 15000; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + else + music = MusicID.Boss2; + if (CalamityWorld.downedProvidence) + { + npc.damage = 170; + npc.defense = 80; + npc.lifeMax *= 3; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(canDespawn); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(canDespawn); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - canDespawn = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + canDespawn = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() - { - CalamityGlobalNPC.cataclysm = npc.whoAmI; + public override void AI() + { + CalamityGlobalNPC.cataclysm = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + Player player = Main.player[npc.target]; - float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; - if (num842 < 0f) - { - num842 += 6.283f; - } - else if ((double)num842 > 6.283) - { - num842 -= 6.283f; - } + float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; + if (num842 < 0f) + { + num842 += 6.283f; + } + else if ((double)num842 > 6.283) + { + num842 -= 6.283f; + } - float num843 = 0.15f; - if (npc.rotation < num842) - { - if ((double)(num842 - npc.rotation) > 3.1415) - { - npc.rotation -= num843; - } - else - { - npc.rotation += num843; - } - } - else if (npc.rotation > num842) - { - if ((double)(npc.rotation - num842) > 3.1415) - { - npc.rotation += num843; - } - else - { - npc.rotation -= num843; - } - } + float num843 = 0.15f; + if (npc.rotation < num842) + { + if ((double)(num842 - npc.rotation) > 3.1415) + { + npc.rotation -= num843; + } + else + { + npc.rotation += num843; + } + } + else if (npc.rotation > num842) + { + if ((double)(npc.rotation - num842) > 3.1415) + { + npc.rotation += num843; + } + else + { + npc.rotation -= num843; + } + } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.velocity = new Vector2(0f, -10f); - canDespawn = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - canDespawn = false; - } + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.velocity = new Vector2(0f, -10f); + canDespawn = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + canDespawn = false; + } - if (npc.ai[1] == 0f) - { - float num861 = 5f; - float num862 = 0.1f; - if (CalamityWorld.bossRushActive) - { - num861 *= 1.5f; - num862 *= 1.5f; - } + if (npc.ai[1] == 0f) + { + float num861 = 5f; + float num862 = 0.1f; + if (CalamityWorld.bossRushActive) + { + num861 *= 1.5f; + num862 *= 1.5f; + } - int num863 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num863 = -1; - } - Vector2 vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num864 = player.position.X + (float)(player.width / 2) + (float)(num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; - float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; - float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - if (expertMode) - { - if (num866 > 300f) - { - num861 += 0.5f; - } - if (num866 > 400f) - { - num861 += 0.5f; - } - if (num866 > 500f) - { - num861 += 0.55f; - } - if (num866 > 600f) - { - num861 += 0.55f; - } - if (num866 > 700f) - { - num861 += 0.6f; - } - if (num866 > 800f) - { - num861 += 0.6f; - } - } + int num863 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num863 = -1; + } + Vector2 vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num864 = player.position.X + (float)(player.width / 2) + (float)(num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; + float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; + float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + if (expertMode) + { + if (num866 > 300f) + { + num861 += 0.5f; + } + if (num866 > 400f) + { + num861 += 0.5f; + } + if (num866 > 500f) + { + num861 += 0.55f; + } + if (num866 > 600f) + { + num861 += 0.55f; + } + if (num866 > 700f) + { + num861 += 0.6f; + } + if (num866 > 800f) + { + num861 += 0.6f; + } + } - num866 = num861 / num866; - num864 *= num866; - num865 *= num866; + num866 = num861 / num866; + num864 *= num866; + num865 *= num866; - if (npc.velocity.X < num864) - { - npc.velocity.X = npc.velocity.X + num862; - if (npc.velocity.X < 0f && num864 > 0f) - { - npc.velocity.X = npc.velocity.X + num862; - } - } - else if (npc.velocity.X > num864) - { - npc.velocity.X = npc.velocity.X - num862; - if (npc.velocity.X > 0f && num864 < 0f) - { - npc.velocity.X = npc.velocity.X - num862; - } - } - if (npc.velocity.Y < num865) - { - npc.velocity.Y = npc.velocity.Y + num862; - if (npc.velocity.Y < 0f && num865 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num862; - } - } - else if (npc.velocity.Y > num865) - { - npc.velocity.Y = npc.velocity.Y - num862; - if (npc.velocity.Y > 0f && num865 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num862; - } - } + if (npc.velocity.X < num864) + { + npc.velocity.X = npc.velocity.X + num862; + if (npc.velocity.X < 0f && num864 > 0f) + { + npc.velocity.X = npc.velocity.X + num862; + } + } + else if (npc.velocity.X > num864) + { + npc.velocity.X = npc.velocity.X - num862; + if (npc.velocity.X > 0f && num864 < 0f) + { + npc.velocity.X = npc.velocity.X - num862; + } + } + if (npc.velocity.Y < num865) + { + npc.velocity.Y = npc.velocity.Y + num862; + if (npc.velocity.Y < 0f && num865 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num862; + } + } + else if (npc.velocity.Y > num865) + { + npc.velocity.Y = npc.velocity.Y - num862; + if (npc.velocity.Y > 0f && num865 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num862; + } + } - npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); - if (npc.ai[2] >= 240f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } + npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); + if (npc.ai[2] >= 240f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } - bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 22f) - { - npc.localAI[2] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); - } + bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 22f) + { + npc.localAI[2] = 0f; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (revenge) - npc.localAI[1] += 0.5f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (revenge) + npc.localAI[1] += 0.5f; - if (npc.localAI[1] > 12f) - { - npc.localAI[1] = 0f; - float num867 = CalamityWorld.bossRushActive ? 9f : 6f; - int num868 = expertMode ? 30 : 38; - int num869 = mod.ProjectileType("BrimstoneFire"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = player.position.X + (float)(player.width / 2) - vector86.X; - num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; - num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += npc.velocity.Y * 0.5f; - num864 += npc.velocity.X * 0.5f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - npc.rotation = num842; - float num870 = 14f; - if (expertMode) - { - num870 += 2.5f; - } - if (revenge) - { - num870 += 2.5f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num870 += 4f; - } - if (CalamityWorld.bossRushActive) - { - num870 *= 1.25f; - } + if (npc.localAI[1] > 12f) + { + npc.localAI[1] = 0f; + float num867 = CalamityWorld.bossRushActive ? 9f : 6f; + int num868 = expertMode ? 30 : 38; + int num869 = mod.ProjectileType("BrimstoneFire"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = player.position.X + (float)(player.width / 2) - vector86.X; + num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; + num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + num866 = num867 / num866; + num864 *= num866; + num865 *= num866; + num865 += npc.velocity.Y * 0.5f; + num864 += npc.velocity.X * 0.5f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + npc.rotation = num842; + float num870 = 14f; + if (expertMode) + { + num870 += 2.5f; + } + if (revenge) + { + num870 += 2.5f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num870 += 4f; + } + if (CalamityWorld.bossRushActive) + { + num870 *= 1.25f; + } - Vector2 vector87 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num871 = player.position.X + (float)(player.width / 2) - vector87.X; - float num872 = player.position.Y + (float)(player.height / 2) - vector87.Y; - float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); - num873 = num870 / num873; - npc.velocity.X = num871 * num873; - npc.velocity.Y = num872 * num873; - npc.ai[1] = 2f; - return; - } - if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (expertMode) - { - npc.ai[2] += 0.5f; - } - if (revenge) - { - npc.ai[2] += 0.5f; - } - if (CalamityWorld.bossRushActive) - { - npc.ai[2] += 0.25f; - } + Vector2 vector87 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num871 = player.position.X + (float)(player.width / 2) - vector87.X; + float num872 = player.position.Y + (float)(player.height / 2) - vector87.Y; + float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); + num873 = num870 / num873; + npc.velocity.X = num871 * num873; + npc.velocity.Y = num872 * num873; + npc.ai[1] = 2f; + return; + } + if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (expertMode) + { + npc.ai[2] += 0.5f; + } + if (revenge) + { + npc.ai[2] += 0.5f; + } + if (CalamityWorld.bossRushActive) + { + npc.ai[2] += 0.25f; + } - if (npc.ai[2] >= 75f) - { - npc.velocity.X = npc.velocity.X * 0.93f; - npc.velocity.Y = npc.velocity.Y * 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } + if (npc.ai[2] >= 75f) + { + npc.velocity.X = npc.velocity.X * 0.93f; + npc.velocity.Y = npc.velocity.Y * 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } - if (npc.ai[2] >= 105f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num842; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } + if (npc.ai[2] >= 105f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num842; + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CheckActive() - { - return canDespawn; - } + public override bool CheckActive() + { + return canDespawn; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CataclysmTrophy")); - } - if (Main.expertMode) - { - if (Main.rand.NextBool(10)) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); - } - else if (Main.rand.NextBool(12)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); - } - if (Main.expertMode) - { - if (Main.rand.NextBool(10)) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlameblaster")); - } - else if (Main.rand.NextBool(12)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlameblaster")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(10)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CataclysmTrophy")); + } + if (Main.expertMode) + { + if (Main.rand.NextBool(10)) + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); + } + else if (Main.rand.NextBool(12)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); + } + if (Main.expertMode) + { + if (Main.rand.NextBool(10)) + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlameblaster")); + } + else if (Main.rand.NextBool(12)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlameblaster")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } } diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index cdc6f3cafd..84c2853ef7 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -1,520 +1,520 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Calamitas { [AutoloadBossHead] - public class CalamitasRun2 : ModNPC - { - private bool canDespawn = false; + public class CalamitasRun2 : ModNPC + { + private bool canDespawn = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 65; - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; - npc.defense = 10; + public override void SetDefaults() + { + npc.damage = 65; + npc.npcSlots = 5f; + npc.width = 120; + npc.height = 120; + npc.defense = 10; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = CalamityWorld.revenge ? 11025 : 7500; - if (CalamityWorld.death) - { - npc.lifeMax = 13200; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; - if (CalamityWorld.downedProvidence) - { - npc.damage = 200; - npc.defense = 95; - npc.lifeMax *= 3; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 800000 : 700000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = CalamityWorld.revenge ? 11025 : 7500; + if (CalamityWorld.death) + { + npc.lifeMax = 13200; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + else + music = MusicID.Boss2; + if (CalamityWorld.downedProvidence) + { + npc.damage = 200; + npc.defense = 95; + npc.lifeMax *= 3; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 800000 : 700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(canDespawn); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(canDespawn); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - canDespawn = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + canDespawn = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() - { - CalamityGlobalNPC.catastrophe = npc.whoAmI; + public override void AI() + { + CalamityGlobalNPC.catastrophe = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + Player player = Main.player[npc.target]; - float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; - if (num842 < 0f) - { - num842 += 6.283f; - } - else if ((double)num842 > 6.283) - { - num842 -= 6.283f; - } + float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; + if (num842 < 0f) + { + num842 += 6.283f; + } + else if ((double)num842 > 6.283) + { + num842 -= 6.283f; + } - float num843 = 0.15f; - if (npc.rotation < num842) - { - if ((double)(num842 - npc.rotation) > 3.1415) - { - npc.rotation -= num843; - } - else - { - npc.rotation += num843; - } - } - else if (npc.rotation > num842) - { - if ((double)(npc.rotation - num842) > 3.1415) - { - npc.rotation += num843; - } - else - { - npc.rotation -= num843; - } - } + float num843 = 0.15f; + if (npc.rotation < num842) + { + if ((double)(num842 - npc.rotation) > 3.1415) + { + npc.rotation -= num843; + } + else + { + npc.rotation += num843; + } + } + else if (npc.rotation > num842) + { + if ((double)(npc.rotation - num842) > 3.1415) + { + npc.rotation += num843; + } + else + { + npc.rotation -= num843; + } + } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.velocity = new Vector2(0f, -10f); - canDespawn = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - canDespawn = false; - } + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.velocity = new Vector2(0f, -10f); + canDespawn = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + canDespawn = false; + } - if (npc.ai[1] == 0f) - { - float num861 = 4.5f; - float num862 = 0.2f; - if (CalamityWorld.bossRushActive) - { - num861 *= 1.5f; - num862 *= 1.5f; - } + if (npc.ai[1] == 0f) + { + float num861 = 4.5f; + float num862 = 0.2f; + if (CalamityWorld.bossRushActive) + { + num861 *= 1.5f; + num862 *= 1.5f; + } - int num863 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num863 = -1; - } + int num863 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num863 = -1; + } - Vector2 vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num864 = player.position.X + (float)(player.width / 2) + (float)(num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; - float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; - float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - if (expertMode) - { - if (num866 > 300f) - { - num861 += 0.5f; - } - if (num866 > 400f) - { - num861 += 0.5f; - } - if (num866 > 500f) - { - num861 += 0.55f; - } - if (num866 > 600f) - { - num861 += 0.55f; - } - if (num866 > 700f) - { - num861 += 0.6f; - } - if (num866 > 800f) - { - num861 += 0.6f; - } - } + Vector2 vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num864 = player.position.X + (float)(player.width / 2) + (float)(num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; + float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; + float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + if (expertMode) + { + if (num866 > 300f) + { + num861 += 0.5f; + } + if (num866 > 400f) + { + num861 += 0.5f; + } + if (num866 > 500f) + { + num861 += 0.55f; + } + if (num866 > 600f) + { + num861 += 0.55f; + } + if (num866 > 700f) + { + num861 += 0.6f; + } + if (num866 > 800f) + { + num861 += 0.6f; + } + } - num866 = num861 / num866; - num864 *= num866; - num865 *= num866; + num866 = num861 / num866; + num864 *= num866; + num865 *= num866; - if (npc.velocity.X < num864) - { - npc.velocity.X = npc.velocity.X + num862; - if (npc.velocity.X < 0f && num864 > 0f) - { - npc.velocity.X = npc.velocity.X + num862; - } - } - else if (npc.velocity.X > num864) - { - npc.velocity.X = npc.velocity.X - num862; - if (npc.velocity.X > 0f && num864 < 0f) - { - npc.velocity.X = npc.velocity.X - num862; - } - } - if (npc.velocity.Y < num865) - { - npc.velocity.Y = npc.velocity.Y + num862; - if (npc.velocity.Y < 0f && num865 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num862; - } - } - else if (npc.velocity.Y > num865) - { - npc.velocity.Y = npc.velocity.Y - num862; - if (npc.velocity.Y > 0f && num865 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num862; - } - } + if (npc.velocity.X < num864) + { + npc.velocity.X = npc.velocity.X + num862; + if (npc.velocity.X < 0f && num864 > 0f) + { + npc.velocity.X = npc.velocity.X + num862; + } + } + else if (npc.velocity.X > num864) + { + npc.velocity.X = npc.velocity.X - num862; + if (npc.velocity.X > 0f && num864 < 0f) + { + npc.velocity.X = npc.velocity.X - num862; + } + } + if (npc.velocity.Y < num865) + { + npc.velocity.Y = npc.velocity.Y + num862; + if (npc.velocity.Y < 0f && num865 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num862; + } + } + else if (npc.velocity.Y > num865) + { + npc.velocity.Y = npc.velocity.Y - num862; + if (npc.velocity.Y > 0f && num865 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num862; + } + } - npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); - if (npc.ai[2] >= 180f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } + npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); + if (npc.ai[2] >= 180f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } - bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 36f) - { - npc.localAI[2] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); - } + bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 36f) + { + npc.localAI[2] = 0f; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (revenge) - npc.localAI[1] += 0.5f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (revenge) + npc.localAI[1] += 0.5f; - if (npc.localAI[1] > 50f) - { - npc.localAI[1] = 0f; - float num867 = CalamityWorld.bossRushActive ? 18f : 12f; - int num868 = expertMode ? 29 : 36; - int num869 = mod.ProjectileType("BrimstoneBall"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = player.position.X + (float)(player.width / 2) - vector86.X; - num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; - num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += npc.velocity.Y * 0.5f; - num864 += npc.velocity.X * 0.5f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - npc.rotation = num842; - float num870 = 16f; - if (expertMode) - { - num870 += 2.5f; - } - if (revenge) - { - num870 += 2.5f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num870 += 4f; - } - if (CalamityWorld.bossRushActive) - { - num870 *= 1.25f; - } + if (npc.localAI[1] > 50f) + { + npc.localAI[1] = 0f; + float num867 = CalamityWorld.bossRushActive ? 18f : 12f; + int num868 = expertMode ? 29 : 36; + int num869 = mod.ProjectileType("BrimstoneBall"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = player.position.X + (float)(player.width / 2) - vector86.X; + num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; + num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + num866 = num867 / num866; + num864 *= num866; + num865 *= num866; + num865 += npc.velocity.Y * 0.5f; + num864 += npc.velocity.X * 0.5f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + npc.rotation = num842; + float num870 = 16f; + if (expertMode) + { + num870 += 2.5f; + } + if (revenge) + { + num870 += 2.5f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num870 += 4f; + } + if (CalamityWorld.bossRushActive) + { + num870 *= 1.25f; + } - Vector2 vector87 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num871 = player.position.X + (float)(player.width / 2) - vector87.X; - float num872 = player.position.Y + (float)(player.height / 2) - vector87.Y; - float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); - num873 = num870 / num873; - npc.velocity.X = num871 * num873; - npc.velocity.Y = num872 * num873; - npc.ai[1] = 2f; - return; - } - if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (expertMode) - { - npc.ai[2] += 0.5f; - } - if (revenge) - { - npc.ai[2] += 0.5f; - } - if (CalamityWorld.bossRushActive) - { - npc.ai[2] += 0.25f; - } + Vector2 vector87 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num871 = player.position.X + (float)(player.width / 2) - vector87.X; + float num872 = player.position.Y + (float)(player.height / 2) - vector87.Y; + float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); + num873 = num870 / num873; + npc.velocity.X = num871 * num873; + npc.velocity.Y = num872 * num873; + npc.ai[1] = 2f; + return; + } + if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (expertMode) + { + npc.ai[2] += 0.5f; + } + if (revenge) + { + npc.ai[2] += 0.5f; + } + if (CalamityWorld.bossRushActive) + { + npc.ai[2] += 0.25f; + } - if (npc.ai[2] >= 60f) //50 - { - npc.velocity.X = npc.velocity.X * 0.93f; - npc.velocity.Y = npc.velocity.Y * 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } + if (npc.ai[2] >= 60f) //50 + { + npc.velocity.X = npc.velocity.X * 0.93f; + npc.velocity.Y = npc.velocity.Y * 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } - if (npc.ai[2] >= 90f) //80 - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num842; - if (npc.ai[3] >= 4f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } + if (npc.ai[2] >= 90f) //80 + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num842; + if (npc.ai[3] >= 4f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CheckActive() - { - return canDespawn; - } + public override bool CheckActive() + { + return canDespawn; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CatastropheTrophy")); - } - if (Main.expertMode) - { - if (Main.rand.NextBool(10)) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrushsawCrasher")); - } - else if (Main.rand.NextBool(15)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrushsawCrasher")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(10)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CatastropheTrophy")); + } + if (Main.expertMode) + { + if (Main.rand.NextBool(10)) + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrushsawCrasher")); + } + else if (Main.rand.NextBool(15)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrushsawCrasher")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } } diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index c486e5dc23..2220598643 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -1,624 +1,624 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Calamitas { [AutoloadBossHead] - public class CalamitasRun3 : ModNPC - { - private float bossLife; - private bool halfLife = false; - private bool secondStage = false; + public class CalamitasRun3 : ModNPC + { + private float bossLife; + private bool halfLife = false; + private bool secondStage = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 14f; - npc.width = 120; - npc.height = 120; - npc.defense = 25; + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 14f; + npc.width = 120; + npc.height = 120; + npc.defense = 25; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = CalamityWorld.revenge ? 38812 : 28125; - if (CalamityWorld.death) - { - npc.lifeMax = 62062; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 15, 0, 0); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; - bossBag = mod.ItemType("CalamitasBag"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 160; - npc.defense = 150; - npc.lifeMax *= 3; - npc.value = Item.buyPrice(0, 35, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 3450000 : 3075000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = CalamityWorld.revenge ? 38812 : 28125; + if (CalamityWorld.death) + { + npc.lifeMax = 62062; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 15, 0, 0); + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + else + music = MusicID.Boss2; + bossBag = mod.ItemType("CalamitasBag"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 160; + npc.defense = 150; + npc.lifeMax *= 3; + npc.value = Item.buyPrice(0, 35, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 3450000 : 3075000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(secondStage); - writer.Write(halfLife); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(secondStage); + writer.Write(halfLife); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - secondStage = reader.ReadBoolean(); - halfLife = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + secondStage = reader.ReadBoolean(); + halfLife = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() - { - CalamityGlobalNPC.calamitas = npc.whoAmI; + public override void AI() + { + CalamityGlobalNPC.calamitas = npc.whoAmI; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; + bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - if (!halfLife && npc.life <= npc.lifeMax / 2) - { - if (!secondStage && Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("SoulSeeker"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - Eye.ai[3] = I * 72; - } - secondStage = true; - } + if (!halfLife && npc.life <= npc.lifeMax / 2) + { + if (!secondStage && Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 5; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("SoulSeeker"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 72; + Eye.ai[3] = I * 72; + } + secondStage = true; + } - string key = "Mods.CalamityMod.CalamitasBossText3"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.CalamitasBossText3"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - halfLife = true; - } + halfLife = true; + } - if (bossLife == 0f && npc.life > 0) - bossLife = (float)npc.lifeMax; + if (bossLife == 0f && npc.life > 0) + bossLife = (float)npc.lifeMax; - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.3); //70%, 40%, and 10% - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - if (bossLife <= (float)npc.lifeMax * 0.1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.3); //70%, 40%, and 10% + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + if (bossLife <= (float)npc.lifeMax * 0.1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - string key = "Mods.CalamityMod.CalamitasBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - else if (bossLife <= (float)npc.lifeMax * 0.4) - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - else - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } + string key = "Mods.CalamityMod.CalamitasBossText2"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + else if (bossLife <= (float)npc.lifeMax * 0.4) + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + else + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } - bool flag100 = false; - int num568 = 0; - if (expertMode) - { - if (CalamityGlobalNPC.cataclysm != -1) - { - if (Main.npc[CalamityGlobalNPC.cataclysm].active) - { - flag100 = true; - num568 += 255; - } - } - if (CalamityGlobalNPC.catastrophe != -1) - { - if (Main.npc[CalamityGlobalNPC.catastrophe].active) - { - flag100 = true; - num568 += 255; - } - } - npc.defense += num568 * 50; - if (!flag100) - npc.defense = provy ? 150 : 25; - } + bool flag100 = false; + int num568 = 0; + if (expertMode) + { + if (CalamityGlobalNPC.cataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.cataclysm].active) + { + flag100 = true; + num568 += 255; + } + } + if (CalamityGlobalNPC.catastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.catastrophe].active) + { + flag100 = true; + num568 += 255; + } + } + npc.defense += num568 * 50; + if (!flag100) + npc.defense = provy ? 150 : 25; + } - npc.chaseable = !flag100; + npc.chaseable = !flag100; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); - Player player = Main.player[npc.target]; + Player player = Main.player[npc.target]; - float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; - if (num803 < 0f) - num803 += 6.283f; - else if ((double)num803 > 6.283) - num803 -= 6.283f; + float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; + if (num803 < 0f) + num803 += 6.283f; + else if ((double)num803 > 6.283) + num803 -= 6.283f; - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((double)(num803 - npc.rotation) > 3.1415) - npc.rotation -= num804; - else - npc.rotation += num804; - } - else if (npc.rotation > num803) - { - if ((double)(npc.rotation - num803) > 3.1415) - npc.rotation += num804; - else - npc.rotation -= num804; - } + float num804 = 0.1f; + if (npc.rotation < num803) + { + if ((double)(num803 - npc.rotation) > 3.1415) + npc.rotation -= num804; + else + npc.rotation += num804; + } + else if (npc.rotation > num803) + { + if ((double)(npc.rotation - num803) > 3.1415) + npc.rotation += num804; + else + npc.rotation -= num804; + } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; - if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + npc.rotation = num803; + if (npc.rotation < 0f) + npc.rotation += 6.283f; + else if ((double)npc.rotation > 6.283) + npc.rotation -= 6.283f; + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + npc.rotation = num803; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - npc.timeLeft = 150; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + npc.timeLeft = 150; - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + return; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; - if (npc.ai[1] == 0f) - { - float num823 = expertMode ? 10f : 8.5f; - float num824 = expertMode ? 0.18f : 0.155f; - if (CalamityWorld.bossRushActive) - { - num823 *= 1.5f; - num824 *= 1.5f; - } + if (npc.ai[1] == 0f) + { + float num823 = expertMode ? 10f : 8.5f; + float num824 = expertMode ? 0.18f : 0.155f; + if (CalamityWorld.bossRushActive) + { + num823 *= 1.5f; + num824 *= 1.5f; + } - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - (CalamityWorld.bossRushActive ? 460f : 360f) - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - (CalamityWorld.bossRushActive ? 460f : 360f) - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - npc.velocity.X = npc.velocity.X + num824; - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - npc.velocity.X = npc.velocity.X - num824; - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - npc.velocity.Y = npc.velocity.Y + num824; - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - npc.velocity.Y = npc.velocity.Y - num824; - } + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + npc.velocity.X = npc.velocity.X + num824; + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + npc.velocity.X = npc.velocity.X - num824; + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + npc.velocity.Y = npc.velocity.Y + num824; + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + npc.velocity.Y = npc.velocity.Y - num824; + } - npc.ai[2] += 1f; - if (npc.ai[2] >= 200f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } + npc.ai[2] += 1f; + if (npc.ai[2] >= 200f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!flag100) - { - npc.localAI[1] += 1f * (1f - lifeRatio); - if (revenge) - npc.localAI[1] += 0.5f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - npc.localAI[1] += 0.5f; - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (!flag100) + { + npc.localAI[1] += 1f * (1f - lifeRatio); + if (revenge) + npc.localAI[1] += 0.5f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.localAI[1] += 0.5f; + } - if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 14f : 12.5f); - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num828 += 5f; + if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 14f : 12.5f); + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num828 += 5f; - int num829 = expertMode ? 34 : 42; - int num830 = mod.ProjectileType("BrimstoneHellfireball"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 12f; - vector82.Y += num826 * 12f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - else - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - num831 = -1; + int num829 = expertMode ? 34 : 42; + int num830 = mod.ProjectileType("BrimstoneHellfireball"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 12f; + vector82.Y += num826 * 12f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + else + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + num831 = -1; - float num832 = expertMode ? 10f : 8.5f; - float num833 = expertMode ? 0.255f : 0.205f; - if (CalamityWorld.bossRushActive) - { - num832 *= 1.5f; - num833 *= 1.5f; - } + float num832 = expertMode ? 10f : 8.5f; + float num833 = expertMode ? 0.255f : 0.205f; + if (CalamityWorld.bossRushActive) + { + num832 *= 1.5f; + num833 *= 1.5f; + } - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * (CalamityWorld.bossRushActive ? 460 : 360)) - vector83.X; - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * (CalamityWorld.bossRushActive ? 460 : 360)) - vector83.X; + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - npc.velocity.X = npc.velocity.X + num833; - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - npc.velocity.X = npc.velocity.X - num833; - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - npc.velocity.Y = npc.velocity.Y + num833; - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - npc.velocity.Y = npc.velocity.Y - num833; - } + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + npc.velocity.X = npc.velocity.X + num833; + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + npc.velocity.X = npc.velocity.X - num833; + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + npc.velocity.Y = npc.velocity.Y + num833; + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + npc.velocity.Y = npc.velocity.Y - num833; + } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!flag100) - { - if (revenge) - npc.localAI[1] += 0.5f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - npc.localAI[1] += 0.5f; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - npc.localAI[1] += 0.5f; - if (expertMode) - npc.localAI[1] += 0.5f; - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (!flag100) + { + if (revenge) + npc.localAI[1] += 0.5f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.localAI[1] += 0.5f; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + npc.localAI[1] += 0.5f; + if (expertMode) + npc.localAI[1] += 0.5f; + } - if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num837 = CalamityWorld.bossRushActive ? 15f : 11f; - int num838 = expertMode ? 28 : 35; - int num839 = mod.ProjectileType("BrimstoneLaser"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 12f; - vector83.Y += num835 * 12f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } + if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num837 = CalamityWorld.bossRushActive ? 15f : 11f; + int num838 = expertMode ? 28 : 35; + int num839 = mod.ProjectileType("BrimstoneLaser"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 12f; + vector83.Y += num835 * 12f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } - npc.ai[2] += 1f; - if (npc.ai[2] >= 120f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - } + npc.ai[2] += 1f; + if (npc.ai[2] >= 120f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 9)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamityDust"), Main.rand.Next(9, 15)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens"), Main.rand.Next(1, 3)); - if (CalamityWorld.downedProvidence) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(30, 41)); - } - if (Main.rand.NextBool(10)) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ChaosStone"), 1, true); - } - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasInferno")); - } - if (Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasMask")); - } - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheEyeofCalamitas")); - } - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedEyeStaff")); - } - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Animosity")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(10)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 9)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamityDust"), Main.rand.Next(9, 15)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens"), Main.rand.Next(1, 3)); + if (CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(30, 41)); + } + if (Main.rand.NextBool(10)) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ChaosStone"), 1, true); + } + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasInferno")); + } + if (Main.rand.NextBool(7)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasMask")); + } + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheEyeofCalamitas")); + } + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedEyeStaff")); + } + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Animosity")); + } + } - DropHelper.DropItem(npc, ItemID.BrokenHeroSword, true); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeCalamitasClone"), !CalamityWorld.downedCalamitas); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedCalamitas, 4, 2, 1); + DropHelper.DropItem(npc, ItemID.BrokenHeroSword, true); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeCalamitasClone"), !CalamityWorld.downedCalamitas); + DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedCalamitas, 4, 2, 1); - // Abyss awakens after killing Calamitas OR Plantera - string key = "Mods.CalamityMod.PlantBossText"; - Color messageColor = Color.RoyalBlue; + // Abyss awakens after killing Calamitas OR Plantera + string key = "Mods.CalamityMod.PlantBossText"; + Color messageColor = Color.RoyalBlue; - if (!CalamityWorld.downedCalamitas && !NPC.downedPlantBoss) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + if (!CalamityWorld.downedCalamitas && !NPC.downedPlantBoss) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } - // Mark Calamitas as dead - CalamityWorld.downedCalamitas = true; + // Mark Calamitas as dead + CalamityWorld.downedCalamitas = true; CalamityMod.UpdateServerBoolean(); } - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Calamitas Clone"; - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Calamitas Clone"; + potionType = ItemID.GreaterHealingPotion; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas6"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas6"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.damage = (int)(npc.damage * 0.8f); - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.damage = (int)(npc.damage * 0.8f); + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } } diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index 6e55559613..5654778547 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -1,68 +1,67 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Calamitas { public class LifeSeeker : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Life Seeker"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Life Seeker"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 44; - npc.height = 30; - npc.defense = 8; - npc.lifeMax = 200; + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 44; + npc.height = 30; + npc.defense = 8; + npc.lifeMax = 200; if (CalamityWorld.bossRushActive) { npc.lifeMax = 30000; } npc.aiStyle = 5; - aiType = 139; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.25f; - animationType = 2; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[24] = true; - } + aiType = 139; + npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.25f; + animationType = 2; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.buffImmune[24] = true; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker3"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker3"), 1f); + } + } + } } diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index dcc0fea2bf..4940796623 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -1,168 +1,168 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Calamitas { - public class SoulSeeker : ModNPC - { - private int timer = 0; - private bool start = true; + public class SoulSeeker : ModNPC + { + private int timer = 0; + private bool start = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Seeker"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Seeker"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 40; - npc.height = 40; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 40; - npc.defense = 10; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 40; + npc.height = 40; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.damage = 40; + npc.defense = 10; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 2500; + npc.lifeMax = 2500; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 200000 : 150000; } for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override bool PreAI() - { - bool expertMode = Main.expertMode; - if (start) - { - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= (CalamityWorld.bossRushActive ? 14f : 9f); - npc.rotation = direction.ToRotation(); - timer++; - if (timer > 60) - { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10)) - { - if (NPC.CountNPCS(mod.NPCType("LifeSeeker")) < 10) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 25)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 25)); - int num663 = mod.NPCType("LifeSeeker"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - } - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - } - int damage = expertMode ? 25 : 30; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("BrimstoneBarrage"), damage, 1f, npc.target); - } - timer = 0; - } - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - npc.active = false; + public override bool PreAI() + { + bool expertMode = Main.expertMode; + if (start) + { + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= (CalamityWorld.bossRushActive ? 14f : 9f); + npc.rotation = direction.ToRotation(); + timer++; + if (timer > 60) + { + if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10)) + { + if (NPC.CountNPCS(mod.NPCType("LifeSeeker")) < 10) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 25)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 25)); + int num663 = mod.NPCType("LifeSeeker"); + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + } + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + } + int damage = expertMode ? 25 : 30; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("BrimstoneBarrage"), damage, 1f, npc.target); + } + timer = 0; + } + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + npc.active = false; npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("CalamitasRun3"))]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 150; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } + return false; + } + Player player = Main.player[npc.target]; + NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("CalamitasRun3"))]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 150; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 2f; + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 7d20665b21..1e6a5f7dc8 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1,489 +1,490 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.NPCs { - public class CalamityAI - { - #region Astrum Aureus - public static void AstrumAureusAI(NPC npc, Mod mod) - { - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + public class CalamityAI + { + #region Astrum Aureus + public static void AstrumAureusAI(NPC npc, Mod mod) + { + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Phases - bool phase2 = lifeRatio < 0.75f || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.5f || CalamityWorld.bossRushActive; + // Phases + bool phase2 = lifeRatio < 0.75f || CalamityWorld.bossRushActive; + bool phase3 = lifeRatio < 0.5f || CalamityWorld.bossRushActive; - // Variables - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - int shootBuff = (int)(2f * (1f - lifeRatio)); - float shootTimer = 1f + ((float)shootBuff); - bool dayTime = Main.dayTime; - Player player = Main.player[npc.target]; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + // Variables + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + int shootBuff = (int)(2f * (1f - lifeRatio)); + float shootTimer = 1f + ((float)shootBuff); + bool dayTime = Main.dayTime; + Player player = Main.player[npc.target]; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - // Despawn - if (!player.active || player.dead || dayTime) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; + // Despawn + if (!player.active || player.dead || dayTime) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.noTileCollide = true; - npc.velocity = new Vector2(0f, 10f); + if (!player.active || player.dead) + { + npc.noTileCollide = true; + npc.velocity = new Vector2(0f, 10f); - if (npc.timeLeft > 150) - npc.timeLeft = 150; + if (npc.timeLeft > 150) + npc.timeLeft = 150; - return; - } - } - else - { - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - } + return; + } + } + else + { + if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + } - // Emit light when not Idle - if (npc.ai[0] != 1f) - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2.55f, 1f, 0f); + // Emit light when not Idle + if (npc.ai[0] != 1f) + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2.55f, 1f, 0f); - // Fire projectiles while walking, teleporting, or falling - if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || - npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += ((npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer); - if (npc.localAI[0] >= 180f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); - int laserDamage = expertMode ? 32 : 37; - if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) - laserDamage *= 3; + // Fire projectiles while walking, teleporting, or falling + if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || + npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += ((npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer); + if (npc.localAI[0] >= 180f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); + int laserDamage = expertMode ? 32 : 37; + if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) + laserDamage *= 3; - // Fire astral flames while teleporting - if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - float velocity = CalamityWorld.bossRushActive ? 10f : 7f; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), - (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), - (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } + // Fire astral flames while teleporting + if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + float velocity = CalamityWorld.bossRushActive ? 10f : 7f; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), + (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), + (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } - // Fire astral lasers while falling or walking - else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) - { - float num179 = CalamityWorld.bossRushActive ? 24f : 18.5f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num185 = mod.ProjectileType("AstralLaser"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 5; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-60, 61); - num182 += (float)Main.rand.Next(-60, 61); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + // Fire astral lasers while falling or walking + else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) + { + float num179 = CalamityWorld.bossRushActive ? 24f : 18.5f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num185 = mod.ProjectileType("AstralLaser"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 5; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-60, 61); + num182 += (float)Main.rand.Next(-60, 61); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } - // Start up - if (npc.ai[0] == 0f) - { - // If hit or after two seconds start Idle phase - npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 120f) - { - // Set AI to next phase (Idle) and reset other AI - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } + // Start up + if (npc.ai[0] == 0f) + { + // If hit or after two seconds start Idle phase + npc.ai[1] += 1f; + if (npc.justHit || npc.ai[1] >= 120f) + { + // Set AI to next phase (Idle) and reset other AI + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } - // Idle - else if (npc.ai[0] == 1f) - { - // Decrease defense - npc.defense = 0; + // Idle + else if (npc.ai[0] == 1f) + { + // Decrease defense + npc.defense = 0; - // Slow down - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; + // Slow down + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; - // Stay vulnerable for a maximum of 1.5 or 2.5 seconds - npc.ai[1] += 1f; - if (npc.ai[1] >= ((phase3 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) - { - // Increase defense - npc.defense = 70; + // Stay vulnerable for a maximum of 1.5 or 2.5 seconds + npc.ai[1] += 1f; + if (npc.ai[1] >= ((phase3 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) + { + // Increase defense + npc.defense = 70; - // Stop colliding with tiles - npc.noGravity = true; - npc.noTileCollide = true; + // Stop colliding with tiles + npc.noGravity = true; + npc.noTileCollide = true; - // Set AI to next phase (Walk) and reset other AI - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } + // Set AI to next phase (Walk) and reset other AI + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } - // Walk - else if (npc.ai[0] == 2f) - { - // Set walking speed - float num823 = (CalamityWorld.bossRushActive ? 8f : 5f) + (3f * (1f - lifeRatio)); + // Walk + else if (npc.ai[0] == 2f) + { + // Set walking speed + float num823 = (CalamityWorld.bossRushActive ? 8f : 5f) + (3f * (1f - lifeRatio)); - // Set walking direction - if (Math.Abs(npc.Center.X - player.Center.X) < 200f) - { - npc.velocity.X *= 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); + // Set walking direction + if (Math.Abs(npc.Center.X - player.Center.X) < 200f) + { + npc.velocity.X *= 0.9f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + } + else + { + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); - if (npc.direction > 0) - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; - if (npc.direction < 0) - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; - } + if (npc.direction > 0) + npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + if (npc.direction < 0) + npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + } - // Walk through tiles if colliding with tiles and player is out of reach - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + // Walk through tiles if colliding with tiles and player is out of reach + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); - bool flag52 = false; - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y + (float)player.height - 16f) - flag52 = true; + bool flag52 = false; + if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y + (float)player.height - 16f) + flag52 = true; - if (flag52) - npc.velocity.Y += 0.5f; - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; + if (flag52) + npc.velocity.Y += 0.5f; + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = 0f; - if ((double)npc.velocity.Y > -0.2) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; + if ((double)npc.velocity.Y > -0.2) + npc.velocity.Y -= 0.025f; + else + npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - else - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + else + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = 0f; - if ((double)npc.velocity.Y < 0.1) - npc.velocity.Y += 0.025f; - else - npc.velocity.Y += 0.5f; - } + if ((double)npc.velocity.Y < 0.1) + npc.velocity.Y += 0.025f; + else + npc.velocity.Y += 0.5f; + } - // Walk for a maximum of 6 seconds - npc.ai[1] += 1f; - if (npc.ai[1] >= 360f) - { - // Collide with tiles again - npc.noGravity = false; - npc.noTileCollide = false; + // Walk for a maximum of 6 seconds + npc.ai[1] += 1f; + if (npc.ai[1] >= 360f) + { + // Collide with tiles again + npc.noGravity = false; + npc.noTileCollide = false; - // Set AI to next phase (Jump) and reset other AI - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } + // Set AI to next phase (Jump) and reset other AI + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } - // Limit downward velocity - if (npc.velocity.Y > 10f) - npc.velocity.Y = 10f; - } + // Limit downward velocity + if (npc.velocity.Y > 10f) + npc.velocity.Y = 10f; + } - // Jump - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = false; - if (npc.velocity.Y == 0f) - { - // Slow down - npc.velocity.X *= 0.8f; + // Jump + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = false; + if (npc.velocity.Y == 0f) + { + // Slow down + npc.velocity.X *= 0.8f; - // Half second delay before jumping - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - npc.ai[1] = -20f; - else if (npc.ai[1] == -1f) - { - // Set jump velocity, reset and set AI to next phase (Stomp) - npc.TargetClosest(true); + // Half second delay before jumping + npc.ai[1] += 1f; + if (npc.ai[1] >= 30f) + npc.ai[1] = -20f; + else if (npc.ai[1] == -1f) + { + // Set jump velocity, reset and set AI to next phase (Stomp) + npc.TargetClosest(true); - float velocityX = (CalamityWorld.bossRushActive ? 9f : 6f) + (6f * (1f - lifeRatio)); - npc.velocity.X = velocityX * (float)npc.direction; + float velocityX = (CalamityWorld.bossRushActive ? 9f : 6f) + (6f * (1f - lifeRatio)); + npc.velocity.X = velocityX * (float)npc.direction; - if (revenge) - { - if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) - npc.velocity.Y = -14.5f; - else - npc.velocity.Y = 1f; + if (revenge) + { + if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) + npc.velocity.Y = -14.5f; + else + npc.velocity.Y = 1f; - npc.noTileCollide = true; - } - else - npc.velocity.Y = -14.5f; + npc.noTileCollide = true; + } + else + npc.velocity.Y = -14.5f; - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - } - } + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } - // Stomp - else if (npc.ai[0] == 4f) - { - if (npc.velocity.Y == 0f) - { - // Play stomp sound - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LegStomp"), (int)npc.position.X, (int)npc.position.Y); + // Stomp + else if (npc.ai[0] == 4f) + { + if (npc.velocity.Y == 0f) + { + // Play stomp sound + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LegStomp"), (int)npc.position.X, (int)npc.position.Y); - // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) - npc.ai[2] += 1f; - if (npc.ai[2] >= 3f) - { - npc.ai[0] = ((phase2 || revenge) ? 5f : 1f); - npc.ai[2] = 0f; - } - else - npc.ai[0] = 3f; + // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) + npc.ai[2] += 1f; + if (npc.ai[2] >= 3f) + { + npc.ai[0] = ((phase2 || revenge) ? 5f : 1f); + npc.ai[2] = 0f; + } + else + npc.ai[0] = 3f; - // Spawn dust for visual effect - for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) - { - for (int num623 = 0; num623 < 4; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); - Main.dust[num624].velocity *= 0.2f; - } - } - } - else - { - // Set velocities while falling, this happens before the stomp - npc.TargetClosest(true); + // Spawn dust for visual effect + for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + { + for (int num623 = 0; num623 < 4; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); + Main.dust[num624].velocity *= 0.2f; + } + } + } + else + { + // Set velocities while falling, this happens before the stomp + npc.TargetClosest(true); - // Fall through - if (npc.target >= 0 && revenge && ((player.position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (player.position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f))) - npc.noTileCollide = true; - else - npc.noTileCollide = false; + // Fall through + if (npc.target >= 0 && revenge && ((player.position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (player.position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f))) + npc.noTileCollide = true; + else + npc.noTileCollide = false; - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) - { - npc.velocity.X *= 0.9f; + if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) + { + npc.velocity.X *= 0.9f; - if (player.position.Y > npc.position.Y + (float)npc.height) - { - float fallSpeed = 0.8f + (0.8f * (1f - lifeRatio)); - npc.velocity.Y += fallSpeed; - } - } - else - { - if (npc.direction < 0) - npc.velocity.X -= 0.2f; - else if (npc.direction > 0) - npc.velocity.X += 0.2f; + if (player.position.Y > npc.position.Y + (float)npc.height) + { + float fallSpeed = 0.8f + (0.8f * (1f - lifeRatio)); + npc.velocity.Y += fallSpeed; + } + } + else + { + if (npc.direction < 0) + npc.velocity.X -= 0.2f; + else if (npc.direction > 0) + npc.velocity.X += 0.2f; - float num626 = (CalamityWorld.bossRushActive ? 12f : 9f) + (6f * (1f - lifeRatio)); - if (npc.velocity.X < -num626) - npc.velocity.X = -num626; - if (npc.velocity.X > num626) - npc.velocity.X = num626; - } - } - } + float num626 = (CalamityWorld.bossRushActive ? 12f : 9f) + (6f * (1f - lifeRatio)); + if (npc.velocity.X < -num626) + npc.velocity.X = -num626; + if (npc.velocity.X > num626) + npc.velocity.X = num626; + } + } + } - // Teleport - else if (npc.ai[0] == 5f) - { - // Slow down - npc.velocity *= 0.95f; + // Teleport + else if (npc.ai[0] == 5f) + { + // Slow down + npc.velocity *= 0.95f; - // Spawn slimes and start teleport - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - npc.localAI[1] += 5f; + // Spawn slimes and start teleport + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + npc.localAI[1] += 5f; - if (npc.localAI[1] >= 240f) - { - // Spawn slimes - bool spawnFlag = revenge; - if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) - spawnFlag = false; - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); + if (npc.localAI[1] >= 240f) + { + // Spawn slimes + bool spawnFlag = revenge; + if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) + spawnFlag = false; + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); - // Reset localAI and find a teleport destination - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; + // Reset localAI and find a teleport destination + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; - while (true) - { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; - num1250 += Main.rand.Next(-30, 31); - num1251 += Main.rand.Next(-30, 31); + while (true) + { + num1249++; + num1250 = (int)player.Center.X / 16; + num1251 = (int)player.Center.Y / 16; + num1250 += Main.rand.Next(-30, 31); + num1251 += Main.rand.Next(-30, 31); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) - break; + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) + break; - if (num1249 > 100) - goto Block; - } + if (num1249 > 100) + goto Block; + } - // Set AI to next phase (Mid-teleport), set AI 2 and 3 to teleport coordinates X and Y respectively - npc.ai[0] = 6f; - npc.ai[2] = (float)num1250; - npc.ai[3] = (float)num1251; - npc.netUpdate = true; - Block:; - } - } - } + // Set AI to next phase (Mid-teleport), set AI 2 and 3 to teleport coordinates X and Y respectively + npc.ai[0] = 6f; + npc.ai[2] = (float)num1250; + npc.ai[3] = (float)num1251; + npc.netUpdate = true; + Block: + ; + } + } + } - // Mid-teleport - else if (npc.ai[0] == 6f) - { - // Become immune - npc.chaseable = false; - npc.dontTakeDamage = true; + // Mid-teleport + else if (npc.ai[0] == 6f) + { + // Become immune + npc.chaseable = false; + npc.dontTakeDamage = true; - // Turn invisible - npc.alpha += 10; - if (npc.alpha >= 255) - { - // Set position to teleport destination - npc.position.X = npc.ai[2] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[3] * 16f - (float)(npc.height / 2); + // Turn invisible + npc.alpha += 10; + if (npc.alpha >= 255) + { + // Set position to teleport destination + npc.position.X = npc.ai[2] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[3] * 16f - (float)(npc.height / 2); - // Reset alpha and set AI to next phase (End of teleport) - npc.alpha = 255; - npc.ai[0] = 7f; - npc.netUpdate = true; - } + // Reset alpha and set AI to next phase (End of teleport) + npc.alpha = 255; + npc.ai[0] = 7f; + npc.netUpdate = true; + } - // Play sound for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } + // Play sound for cool effect + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } - // Emit dust to make the teleport pretty - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - num = num245; - } - } + // Emit dust to make the teleport pretty + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default, 2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + num = num245; + } + } - // End of teleport - else if (npc.ai[0] == 7f) - { - // Turn visible - npc.alpha -= 10; - if (npc.alpha <= 0) - { - // Spawn slimes - bool spawnFlag = revenge; - if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) - spawnFlag = false; - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); + // End of teleport + else if (npc.ai[0] == 7f) + { + // Turn visible + npc.alpha -= 10; + if (npc.alpha <= 0) + { + // Spawn slimes + bool spawnFlag = revenge; + if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) + spawnFlag = false; + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); - // Become vulnerable - npc.chaseable = true; - npc.dontTakeDamage = false; + // Become vulnerable + npc.chaseable = true; + npc.dontTakeDamage = false; - // Reset alpha and set AI to next phase (Idle) - npc.alpha = 0; - npc.ai[0] = 1f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } + // Reset alpha and set AI to next phase (Idle) + npc.alpha = 0; + npc.ai[0] = 1f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } - // Play sound at teleport destination for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } + // Play sound at teleport destination for cool effect + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } - // Emit dust to make the teleport pretty - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - num = num245; - } - } - } - #endregion - } + // Emit dust to make the teleport pretty + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default, 2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + num = num245; + } + } + } + #endregion + } } diff --git a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs index c712c2d6e0..6351e543f4 100644 --- a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs +++ b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs @@ -1,84 +1,82 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.CalamityBiomeNPCs { public class CultistAssassin : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cultist Assassin"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = 3; - npc.damage = 50; - npc.width = 18; //324 - npc.height = 40; //216 - npc.defense = 25; - npc.lifeMax = 80; - npc.knockBackResist = 0.5f; - animationType = 331; - aiType = NPCID.ChaosElemental; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath50; - if (CalamityWorld.downedProvidence) - { - npc.damage = 250; - npc.defense = 130; - npc.lifeMax = 5000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("CultistAssassinBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + public override void SetStaticDefaults() { - return (spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; + DisplayName.SetDefault("Cultist Assassin"); + Main.npcFrameCount[npc.type] = 4; } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = 3; + npc.damage = 50; + npc.width = 18; //324 + npc.height = 40; //216 + npc.defense = 25; + npc.lifeMax = 80; + npc.knockBackResist = 0.5f; + animationType = 331; + aiType = NPCID.ChaosElemental; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath50; + if (CalamityWorld.downedProvidence) + { + npc.damage = 250; + npc.defense = 130; + npc.lifeMax = 5000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("CultistAssassinBanner"); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return (spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; + } - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + } } diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.cs b/NPCs/CalamityBiomeNPCs/DespairStone.cs index 9fd62483a3..6bf627925b 100644 --- a/NPCs/CalamityBiomeNPCs/DespairStone.cs +++ b/NPCs/CalamityBiomeNPCs/DespairStone.cs @@ -1,372 +1,371 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.CalamityBiomeNPCs { public class DespairStone : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Despair Stone"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 40; - npc.width = 72; //324 - npc.height = 72; //216 - npc.defense = 38; - npc.Calamity().RevPlusDR(0.35f); - npc.lifeMax = 120; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - npc.behindTiles = true; - npc.lavaImmune = true; - if (CalamityWorld.downedProvidence) - { - npc.damage = 190; - npc.defense = 185; - npc.lifeMax = 5000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("DespairStoneBanner"); - } - - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - 4f; - Main.PlaySound(2, npc.Center, 14); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, -1f, 0, default, 1f); - } - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); - if (!Main.player[npc.target].ZoneSandstorm) - { - num9 = 0f; - } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.2f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - bool flag6 = npc.type == 410 || npc.type == 423; - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = -8.5f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7.5f; - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + public override void SetStaticDefaults() { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + DisplayName.SetDefault("Despair Stone"); } - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 40; + npc.width = 72; //324 + npc.height = 72; //216 + npc.defense = 38; + npc.Calamity().RevPlusDR(0.35f); + npc.lifeMax = 120; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + npc.behindTiles = true; + npc.lavaImmune = true; + if (CalamityWorld.downedProvidence) + { + npc.damage = 190; + npc.defense = 185; + npc.lifeMax = 5000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("DespairStoneBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - 4f; + Main.PlaySound(2, npc.Center, 14); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, -1f, 0, default, 1f); + } + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); + if (!Main.player[npc.target].ZoneSandstorm) + { + num9 = 0f; + } + num7 = 5f + num9 * (float)npc.direction * 4f; + num8 = 0.2f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + bool flag6 = npc.type == 410 || npc.type == 423; + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = -8.5f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7.5f; + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/CalamityBiomeNPCs/Scryllar.cs b/NPCs/CalamityBiomeNPCs/Scryllar.cs index b753f83a73..da14d6cacf 100644 --- a/NPCs/CalamityBiomeNPCs/Scryllar.cs +++ b/NPCs/CalamityBiomeNPCs/Scryllar.cs @@ -1,288 +1,286 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.CalamityBiomeNPCs { public class Scryllar : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scryllar"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 50; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 18; - npc.lifeMax = 90; - npc.alpha = 100; - npc.knockBackResist = 0.7f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - npc.noGravity = true; - npc.noTileCollide = true; - npc.lavaImmune = true; - if (CalamityWorld.downedProvidence) - { - npc.damage = 260; - npc.defense = 90; - npc.lifeMax = 4000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("ScryllarBanner"); - } - - public override void AI() - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - bool flag19 = false; - if (npc.justHit) - { - npc.ai[2] = 0f; - } - if (npc.ai[2] >= 0f) - { - int num282 = 16; - bool flag21 = false; - bool flag22 = false; - if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) - { - flag21 = true; - } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) - { - flag21 = true; - } - num282 += 24; - if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) - { - flag22 = true; - } - if (flag21 && flag22) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 30f && num282 == 16) - { - flag19 = true; - } - if (npc.ai[2] >= 60f) - { - npc.ai[2] = -200f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; - } - } - else - { - npc.ai[0] = npc.position.X; - npc.ai[1] = npc.position.Y; - npc.ai[2] = 0f; - } - npc.TargetClosest(true); - } - else - { - npc.TargetClosest(true); - npc.ai[2] += 2f; - } - int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; - int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); - bool flag23 = true; - int num285 = 3; - for (int num308 = num284; num308 < num284 + num285; num308++) - { - if (Main.tile[num283, num308] == null) - { - Main.tile[num283, num308] = new Tile(); - } - if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) - { - flag23 = false; - break; - } - } - if (Main.player[npc.target].npcTypeNoAggro[npc.type]) - { - bool flag25 = false; - for (int num309 = num284; num309 < num284 + num285 - 2; num309++) - { - if (Main.tile[num283, num309] == null) - { - Main.tile[num283, num309] = new Tile(); - } - if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) - { - flag25 = true; - break; - } - } - npc.directionY = (!flag25).ToDirectionInt(); - } - if (flag19) - { - flag23 = true; - } - if (flag23) - { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - } - else - { - if (npc.directionY < 0 && npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - if (npc.collideX) - { - npc.velocity.X = npc.oldVelocity.X * -0.4f; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.oldVelocity.Y * -0.25f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) - { - npc.velocity.Y = -1f; - } - } - float num311 = 4f; - if (npc.direction == -1 && npc.velocity.X > -num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - } - else if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.velocity.X < -num311) - { - npc.velocity.X = -num311; - } - } - else if (npc.direction == 1 && npc.velocity.X < num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - } - else if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - if (npc.velocity.X > num311) - { - npc.velocity.X = num311; - } - } - num311 = 1.5f; - if (npc.directionY == -1 && npc.velocity.Y > -num311) - { - npc.velocity.Y = npc.velocity.Y - 0.04f; - if (npc.velocity.Y > num311) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.03f; - } - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = -num311; - } - } - else if (npc.directionY == 1 && npc.velocity.Y < num311) - { - npc.velocity.Y = npc.velocity.Y + 0.04f; - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.03f; - } - if (npc.velocity.Y > num311) - { - npc.velocity.Y = num311; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + public override void SetStaticDefaults() { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + DisplayName.SetDefault("Scryllar"); } - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 50; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 18; + npc.lifeMax = 90; + npc.alpha = 100; + npc.knockBackResist = 0.7f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit49; + npc.DeathSound = SoundID.NPCDeath51; + npc.noGravity = true; + npc.noTileCollide = true; + npc.lavaImmune = true; + if (CalamityWorld.downedProvidence) + { + npc.damage = 260; + npc.defense = 90; + npc.lifeMax = 4000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("ScryllarBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void AI() + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + bool flag19 = false; + if (npc.justHit) + { + npc.ai[2] = 0f; + } + if (npc.ai[2] >= 0f) + { + int num282 = 16; + bool flag21 = false; + bool flag22 = false; + if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) + { + flag21 = true; + } + else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + { + flag21 = true; + } + num282 += 24; + if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) + { + flag22 = true; + } + if (flag21 && flag22) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 30f && num282 == 16) + { + flag19 = true; + } + if (npc.ai[2] >= 60f) + { + npc.ai[2] = -200f; + npc.direction *= -1; + npc.velocity.X = npc.velocity.X * -1f; + npc.collideX = false; + } + } + else + { + npc.ai[0] = npc.position.X; + npc.ai[1] = npc.position.Y; + npc.ai[2] = 0f; + } + npc.TargetClosest(true); + } + else + { + npc.TargetClosest(true); + npc.ai[2] += 2f; + } + int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; + int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); + bool flag23 = true; + int num285 = 3; + for (int num308 = num284; num308 < num284 + num285; num308++) + { + if (Main.tile[num283, num308] == null) + { + Main.tile[num283, num308] = new Tile(); + } + if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) + { + flag23 = false; + break; + } + } + if (Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + bool flag25 = false; + for (int num309 = num284; num309 < num284 + num285 - 2; num309++) + { + if (Main.tile[num283, num309] == null) + { + Main.tile[num283, num309] = new Tile(); + } + if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) + { + flag25 = true; + break; + } + } + npc.directionY = (!flag25).ToDirectionInt(); + } + if (flag19) + { + flag23 = true; + } + if (flag23) + { + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + } + else + { + if (npc.directionY < 0 && npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + if (npc.collideX) + { + npc.velocity.X = npc.oldVelocity.X * -0.4f; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.oldVelocity.Y * -0.25f; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + { + npc.velocity.Y = -1f; + } + } + float num311 = 4f; + if (npc.direction == -1 && npc.velocity.X > -num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + } + else if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.velocity.X < -num311) + { + npc.velocity.X = -num311; + } + } + else if (npc.direction == 1 && npc.velocity.X < num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + } + else if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + if (npc.velocity.X > num311) + { + npc.velocity.X = num311; + } + } + num311 = 1.5f; + if (npc.directionY == -1 && npc.velocity.Y > -num311) + { + npc.velocity.Y = npc.velocity.Y - 0.04f; + if (npc.velocity.Y > num311) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.03f; + } + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = -num311; + } + } + else if (npc.directionY == 1 && npc.velocity.Y < num311) + { + npc.velocity.Y = npc.velocity.Y + 0.04f; + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.03f; + } + if (npc.velocity.Y > num311) + { + npc.velocity.Y = num311; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs index fda4d50343..5149ff43a7 100644 --- a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs +++ b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs @@ -1,288 +1,286 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.CalamityBiomeNPCs { public class ScryllarRage : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scryllar"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 65; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 10; - npc.lifeMax = 50; - npc.alpha = 100; - npc.knockBackResist = 0.9f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - npc.noGravity = true; - npc.noTileCollide = true; - npc.lavaImmune = true; - if (CalamityWorld.downedProvidence) - { - npc.damage = 320; - npc.defense = 80; - npc.lifeMax = 2300; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = mod.NPCType("Scryllar"); - bannerItem = mod.ItemType("ScryllarBanner"); - } - - public override void AI() - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - bool flag19 = false; - if (npc.justHit) - { - npc.ai[2] = 0f; - } - if (npc.ai[2] >= 0f) - { - int num282 = 16; - bool flag21 = false; - bool flag22 = false; - if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) - { - flag21 = true; - } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) - { - flag21 = true; - } - num282 += 24; - if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) - { - flag22 = true; - } - if (flag21 && flag22) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 30f && num282 == 16) - { - flag19 = true; - } - if (npc.ai[2] >= 60f) - { - npc.ai[2] = -200f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; - } - } - else - { - npc.ai[0] = npc.position.X; - npc.ai[1] = npc.position.Y; - npc.ai[2] = 0f; - } - npc.TargetClosest(true); - } - else - { - npc.TargetClosest(true); - npc.ai[2] += 2f; - } - int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; - int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); - bool flag23 = true; - int num285 = 3; - for (int num308 = num284; num308 < num284 + num285; num308++) - { - if (Main.tile[num283, num308] == null) - { - Main.tile[num283, num308] = new Tile(); - } - if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) - { - flag23 = false; - break; - } - } - if (Main.player[npc.target].npcTypeNoAggro[npc.type]) - { - bool flag25 = false; - for (int num309 = num284; num309 < num284 + num285 - 2; num309++) - { - if (Main.tile[num283, num309] == null) - { - Main.tile[num283, num309] = new Tile(); - } - if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) - { - flag25 = true; - break; - } - } - npc.directionY = (!flag25).ToDirectionInt(); - } - if (flag19) - { - flag23 = true; - } - if (flag23) - { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - } - else - { - if (npc.directionY < 0 && npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - if (npc.collideX) - { - npc.velocity.X = npc.oldVelocity.X * -0.4f; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.oldVelocity.Y * -0.25f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) - { - npc.velocity.Y = -1f; - } - } - float num311 = 7f; - if (npc.direction == -1 && npc.velocity.X > -num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - } - else if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.velocity.X < -num311) - { - npc.velocity.X = -num311; - } - } - else if (npc.direction == 1 && npc.velocity.X < num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - } - else if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - if (npc.velocity.X > num311) - { - npc.velocity.X = num311; - } - } - num311 = 1.5f; - if (npc.directionY == -1 && npc.velocity.Y > -num311) - { - npc.velocity.Y = npc.velocity.Y - 0.04f; - if (npc.velocity.Y > num311) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.03f; - } - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = -num311; - } - } - else if (npc.directionY == 1 && npc.velocity.Y < num311) - { - npc.velocity.Y = npc.velocity.Y + 0.04f; - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.03f; - } - if (npc.velocity.Y > num311) - { - npc.velocity.Y = num311; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + public override void SetStaticDefaults() { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; + DisplayName.SetDefault("Scryllar"); } - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 65; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 10; + npc.lifeMax = 50; + npc.alpha = 100; + npc.knockBackResist = 0.9f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit49; + npc.DeathSound = SoundID.NPCDeath51; + npc.noGravity = true; + npc.noTileCollide = true; + npc.lavaImmune = true; + if (CalamityWorld.downedProvidence) + { + npc.damage = 320; + npc.defense = 80; + npc.lifeMax = 2300; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = mod.NPCType("Scryllar"); + bannerItem = mod.ItemType("ScryllarBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void AI() + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + bool flag19 = false; + if (npc.justHit) + { + npc.ai[2] = 0f; + } + if (npc.ai[2] >= 0f) + { + int num282 = 16; + bool flag21 = false; + bool flag22 = false; + if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) + { + flag21 = true; + } + else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + { + flag21 = true; + } + num282 += 24; + if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) + { + flag22 = true; + } + if (flag21 && flag22) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 30f && num282 == 16) + { + flag19 = true; + } + if (npc.ai[2] >= 60f) + { + npc.ai[2] = -200f; + npc.direction *= -1; + npc.velocity.X = npc.velocity.X * -1f; + npc.collideX = false; + } + } + else + { + npc.ai[0] = npc.position.X; + npc.ai[1] = npc.position.Y; + npc.ai[2] = 0f; + } + npc.TargetClosest(true); + } + else + { + npc.TargetClosest(true); + npc.ai[2] += 2f; + } + int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; + int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); + bool flag23 = true; + int num285 = 3; + for (int num308 = num284; num308 < num284 + num285; num308++) + { + if (Main.tile[num283, num308] == null) + { + Main.tile[num283, num308] = new Tile(); + } + if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) + { + flag23 = false; + break; + } + } + if (Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + bool flag25 = false; + for (int num309 = num284; num309 < num284 + num285 - 2; num309++) + { + if (Main.tile[num283, num309] == null) + { + Main.tile[num283, num309] = new Tile(); + } + if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) + { + flag25 = true; + break; + } + } + npc.directionY = (!flag25).ToDirectionInt(); + } + if (flag19) + { + flag23 = true; + } + if (flag23) + { + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + } + else + { + if (npc.directionY < 0 && npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + if (npc.collideX) + { + npc.velocity.X = npc.oldVelocity.X * -0.4f; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.oldVelocity.Y * -0.25f; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + { + npc.velocity.Y = -1f; + } + } + float num311 = 7f; + if (npc.direction == -1 && npc.velocity.X > -num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + } + else if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.velocity.X < -num311) + { + npc.velocity.X = -num311; + } + } + else if (npc.direction == 1 && npc.velocity.X < num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + } + else if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + if (npc.velocity.X > num311) + { + npc.velocity.X = num311; + } + } + num311 = 1.5f; + if (npc.directionY == -1 && npc.velocity.Y > -num311) + { + npc.velocity.Y = npc.velocity.Y - 0.04f; + if (npc.velocity.Y > num311) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.03f; + } + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = -num311; + } + } + else if (npc.directionY == 1 && npc.velocity.Y < num311) + { + npc.velocity.Y = npc.velocity.Y + 0.04f; + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.03f; + } + if (npc.velocity.Y > num311) + { + npc.velocity.Y = num311; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs index f8736d7c78..32386195ad 100644 --- a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs +++ b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs @@ -1,275 +1,274 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.CalamityBiomeNPCs { public class SoulSlurper : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Slurper"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 1f; - npc.damage = 30; - npc.width = 60; //324 - npc.height = 40; //216 - npc.defense = 40; - npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 60; - npc.knockBackResist = 0.65f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.noGravity = true; - npc.lavaImmune = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.damage = 170; - npc.defense = 200; - npc.lifeMax = 3000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("SoulSlurperBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + public override void SetStaticDefaults() { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + DisplayName.SetDefault("Soul Slurper"); } - public override void AI() - { - bool provy = CalamityWorld.downedProvidence; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = 5f; - float num2 = 0.07f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; - if (npc.justHit) - { - npc.localAI[0] = 0f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - int num8 = 30; - if (Main.expertMode) - { - num8 = 22; - } - int num9 = mod.ProjectileType("BrimstoneLaser"); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.75f, 0f, 0f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.npcSlots = 1f; + npc.damage = 30; + npc.width = 60; //324 + npc.height = 40; //216 + npc.defense = 40; + npc.Calamity().RevPlusDR(0.15f); + npc.lifeMax = 60; + npc.knockBackResist = 0.65f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.noGravity = true; + npc.lavaImmune = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.damage = 170; + npc.defense = 200; + npc.lifeMax = 3000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("SoulSlurperBanner"); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + } - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } + public override void AI() + { + bool provy = CalamityWorld.downedProvidence; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = 5f; + float num2 = 0.07f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + npc.localAI[0] += 1f; + if (npc.justHit) + { + npc.localAI[0] = 0f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + int num8 = 30; + if (Main.expertMode) + { + num8 = 22; + } + int num9 = mod.ProjectileType("BrimstoneLaser"); + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.75f, 0f, 0f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 3b3853aa8c..955e8c0408 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -1,13950 +1,13947 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.GameContent.Events; -using CalamityMod.World; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.NPCs { public class CalamityGlobalAI - { - #region Queen Bee Lore AI Changes - public static void QueenBeeLoreEffect(NPC npc) - { - npc.damage = 0; + { + #region Queen Bee Lore AI Changes + public static void QueenBeeLoreEffect(NPC npc) + { + npc.damage = 0; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + npc.TargetClosest(true); - float num = 5f; - float num2 = 0.1f; - npc.localAI[0] += 1f; + float num = 5f; + float num2 = 0.1f; + npc.localAI[0] += 1f; - float num3 = (npc.localAI[0] - 60f) / 60f; - if (num3 > 1f) - num3 = 1f; - else - { - if (npc.velocity.X > 6f) - npc.velocity.X = 6f; - if (npc.velocity.X < -6f) - npc.velocity.X = -6f; - if (npc.velocity.Y > 6f) - npc.velocity.Y = 6f; - if (npc.velocity.Y < -6f) - npc.velocity.Y = -6f; - } + float num3 = (npc.localAI[0] - 60f) / 60f; + if (num3 > 1f) + num3 = 1f; + else + { + if (npc.velocity.X > 6f) + npc.velocity.X = 6f; + if (npc.velocity.X < -6f) + npc.velocity.X = -6f; + if (npc.velocity.Y > 6f) + npc.velocity.Y = 6f; + if (npc.velocity.Y < -6f) + npc.velocity.Y = -6f; + } - num2 *= num3; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = (float)npc.direction * num / 2f; - float num5 = -num / 2f; + num2 *= num3; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = (float)npc.direction * num / 2f; + float num5 = -num / 2f; - if (npc.velocity.X < num4) - { - npc.velocity.X += num2; - if (npc.velocity.X < 0f && num4 > 0f) - npc.velocity.X += num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X -= num2; - if (npc.velocity.X > 0f && num4 < 0f) - npc.velocity.X -= num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y += num2; - if (npc.velocity.Y < 0f && num5 > 0f) - npc.velocity.Y += num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y -= num2; - if (npc.velocity.Y > 0f && num5 < 0f) - npc.velocity.Y -= num2; - } + if (npc.velocity.X < num4) + { + npc.velocity.X += num2; + if (npc.velocity.X < 0f && num4 > 0f) + npc.velocity.X += num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X -= num2; + if (npc.velocity.X > 0f && num4 < 0f) + npc.velocity.X -= num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y += num2; + if (npc.velocity.Y < 0f && num5 > 0f) + npc.velocity.Y += num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y -= num2; + if (npc.velocity.Y > 0f && num5 < 0f) + npc.velocity.Y -= num2; + } - if (npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall) - { - if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; + if (npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall) + { + if (npc.velocity.X > 0f) + npc.spriteDirection = 1; + if (npc.velocity.X < 0f) + npc.spriteDirection = -1; - npc.rotation = npc.velocity.X * 0.1f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + npc.rotation = npc.velocity.X * 0.1f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - float num11 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num11; + float num11 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num11; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - npc.velocity.X = 2f; - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - npc.velocity.X = -2f; - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num11; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + npc.velocity.X = 2f; + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + npc.velocity.X = -2f; + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num11; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - npc.velocity.Y = 2f; - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - npc.velocity.Y = -2f; - } + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + npc.velocity.Y = 2f; + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + npc.velocity.Y = -2f; + } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - } - #endregion + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + } + #endregion - #region Buffed King Slime AI - public static bool BuffedKingSlimeAI(NPC npc, Mod mod) - { - // Variables - float num234 = 1f; - bool flag8 = false; - bool flag9 = false; - npc.aiAction = 0; + #region Buffed King Slime AI + public static bool BuffedKingSlimeAI(NPC npc, Mod mod) + { + // Variables + float num234 = 1f; + bool flag8 = false; + bool flag9 = false; + npc.aiAction = 0; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Phases based on life percentage - bool phase2 = lifeRatio < 0.5f || CalamityWorld.death || CalamityWorld.bossRushActive; + // Phases based on life percentage + bool phase2 = lifeRatio < 0.5f || CalamityWorld.death || CalamityWorld.bossRushActive; - // Spawn crystal in phase 2 - if (phase2 && !NPC.AnyNPCs(mod.NPCType("KingSlimeJewel"))) - { - Vector2 vector = npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(vector, npc.width / 2, npc.height / 2, 90, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 2f; - Main.dust[num622].noGravity = true; + // Spawn crystal in phase 2 + if (phase2 && !NPC.AnyNPCs(mod.NPCType("KingSlimeJewel"))) + { + Vector2 vector = npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(vector, npc.width / 2, npc.height / 2, 90, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 2f; + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 38); - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("KingSlimeJewel")); - } + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 38); + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("KingSlimeJewel")); + } - // Set up health value for spawning slimes - if (npc.ai[3] == 0f && npc.life > 0) - npc.ai[3] = (float)npc.lifeMax; + // Set up health value for spawning slimes + if (npc.ai[3] == 0f && npc.life > 0) + npc.ai[3] = (float)npc.lifeMax; - // Spawn with attack delay - if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -100f; - npc.localAI[3] = 1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } + // Spawn with attack delay + if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -100f; + npc.localAI[3] = 1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } - // Despawn - if (Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - { - npc.timeLeft = 0; - if (Main.player[npc.target].Center.X < npc.Center.X) - npc.direction = 1; - else - npc.direction = -1; - } - } + // Despawn + if (Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + { + npc.timeLeft = 0; + if (Main.player[npc.target].Center.X < npc.Center.X) + npc.direction = 1; + else + npc.direction = -1; + } + } - // Faster fall - if (npc.velocity.Y > 0f && CalamityWorld.bossRushActive) - npc.velocity.Y += 0.1f; + // Faster fall + if (npc.velocity.Y > 0f && CalamityWorld.bossRushActive) + npc.velocity.Y += 0.1f; - // Activate teleport - if (!Main.player[npc.target].dead && npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f) && npc.ai[1] < 5f && npc.velocity.Y == 0f) - { - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 5f; + // Activate teleport + if (!Main.player[npc.target].dead && npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f) && npc.ai[1] < 5f && npc.velocity.Y == 0f) + { + npc.ai[2] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 5f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(false); - Point point3 = npc.Center.ToTileCoordinates(); - Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector30 = Main.player[npc.target].Center - npc.Center; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(false); + Point point3 = npc.Center.ToTileCoordinates(); + Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 vector30 = Main.player[npc.target].Center - npc.Center; - int num235 = 10; - int num236 = 0; - int num237 = 7; - int num238 = 0; - bool flag10 = false; - if (vector30.Length() > 2000f) - { - flag10 = true; - num238 = 100; - } + int num235 = 10; + int num236 = 0; + int num237 = 7; + int num238 = 0; + bool flag10 = false; + if (vector30.Length() > 2000f) + { + flag10 = true; + num238 = 100; + } - while (!flag10 && num238 < 100) - { - num238++; - int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); - int num240 = Main.rand.Next(point4.Y - num235, point4.Y + 1); + while (!flag10 && num238 < 100) + { + num238++; + int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); + int num240 = Main.rand.Next(point4.Y - num235, point4.Y + 1); - if ((num240 < point4.Y - num237 || num240 > point4.Y + num237 || num239 < point4.X - num237 || num239 > point4.X + num237) && - (num240 < point3.Y - num236 || num240 > point3.Y + num236 || num239 < point3.X - num236 || num239 > point3.X + num236) && - !Main.tile[num239, num240].nactive()) - { - int num241 = num240; - int num242 = 0; + if ((num240 < point4.Y - num237 || num240 > point4.Y + num237 || num239 < point4.X - num237 || num239 > point4.X + num237) && + (num240 < point3.Y - num236 || num240 > point3.Y + num236 || num239 < point3.X - num236 || num239 > point3.X + num236) && + !Main.tile[num239, num240].nactive()) + { + int num241 = num240; + int num242 = 0; - bool flag11 = Main.tile[num239, num241].nactive() && Main.tileSolid[(int)Main.tile[num239, num241].type] && !Main.tileSolidTop[(int)Main.tile[num239, num241].type]; - if (flag11) - { - num242 = 1; - } - else - { - while (num242 < 150 && num241 + num242 < Main.maxTilesY) - { - int num243 = num241 + num242; - bool flag12 = Main.tile[num239, num243].nactive() && Main.tileSolid[(int)Main.tile[num239, num243].type] && !Main.tileSolidTop[(int)Main.tile[num239, num243].type]; - if (flag12) - { - num242--; - break; - } - int num = num242; - num242 = num + 1; - } - } - num240 += num242; + bool flag11 = Main.tile[num239, num241].nactive() && Main.tileSolid[(int)Main.tile[num239, num241].type] && !Main.tileSolidTop[(int)Main.tile[num239, num241].type]; + if (flag11) + { + num242 = 1; + } + else + { + while (num242 < 150 && num241 + num242 < Main.maxTilesY) + { + int num243 = num241 + num242; + bool flag12 = Main.tile[num239, num243].nactive() && Main.tileSolid[(int)Main.tile[num239, num243].type] && !Main.tileSolidTop[(int)Main.tile[num239, num243].type]; + if (flag12) + { + num242--; + break; + } + int num = num242; + num242 = num + 1; + } + } + num240 += num242; - bool flag13 = true; - if (flag13 && Main.tile[num239, num240].lava()) - flag13 = false; - if (flag13 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - flag13 = false; + bool flag13 = true; + if (flag13 && Main.tile[num239, num240].lava()) + flag13 = false; + if (flag13 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + flag13 = false; - if (flag13) - { - npc.localAI[1] = (float)(num239 * 16 + 8); - npc.localAI[2] = (float)(num240 * 16 + 16); - break; - } - } - } + if (flag13) + { + npc.localAI[1] = (float)(num239 * 16 + 8); + npc.localAI[2] = (float)(num240 * 16 + 16); + break; + } + } + } - if (num238 >= 100) - { - Vector2 bottom = Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - } - } - } + if (num238 >= 100) + { + Vector2 bottom = Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.localAI[1] = bottom.X; + npc.localAI[2] = bottom.Y; + } + } + } - // Get closer to activating teleport - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - npc.ai[2] += 1f; - if (Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) - npc.ai[2] += 1f; + // Get closer to activating teleport + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + npc.ai[2] += 1f; + if (Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) + npc.ai[2] += 1f; - // Dust variable - Dust dust; + // Dust variable + Dust dust; - // Teleport - if (npc.ai[1] == 5f) - { - flag8 = true; - npc.aiAction = 1; - npc.ai[0] += 1f; - num234 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); - num234 = 0.5f + num234 * 0.5f; + // Teleport + if (npc.ai[1] == 5f) + { + flag8 = true; + npc.aiAction = 1; + npc.ai[0] += 1f; + num234 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); + num234 = 0.5f + num234 * 0.5f; - if (npc.ai[0] >= 60f) - flag9 = true; + if (npc.ai[0] >= 60f) + flag9 = true; - if (npc.ai[0] == 60f) - Gore.NewGore(npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)), npc.velocity, 734, 1f); + if (npc.ai[0] == 60f) + Gore.NewGore(npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)), npc.velocity, 734, 1f); - if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[1] = 6f; - npc.ai[0] = 0f; - npc.netUpdate = true; - } + if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); + npc.ai[1] = 6f; + npc.ai[0] = 0f; + npc.netUpdate = true; + } - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 120f) - { - npc.ai[1] = 6f; - npc.ai[0] = 0f; - } + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 120f) + { + npc.ai[1] = 6f; + npc.ai[0] = 0f; + } - if (!flag9) - { - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int num246 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num246].noGravity = true; - dust = Main.dust[num246]; - dust.velocity *= 0.5f; - num = num245; - } - } - } + if (!flag9) + { + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num246 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[num246].noGravity = true; + dust = Main.dust[num246]; + dust.velocity *= 0.5f; + num = num245; + } + } + } - // Post-teleport - else if (npc.ai[1] == 6f) - { - flag8 = true; - npc.aiAction = 0; - npc.ai[0] += 1f; - num234 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); - num234 = 0.5f + num234 * 0.5f; + // Post-teleport + else if (npc.ai[1] == 6f) + { + flag8 = true; + npc.aiAction = 0; + npc.ai[0] += 1f; + num234 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); + num234 = 0.5f + num234 * 0.5f; - if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - npc.netUpdate = true; - npc.TargetClosest(true); - } + if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + npc.netUpdate = true; + npc.TargetClosest(true); + } - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - npc.TargetClosest(true); - } + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + npc.TargetClosest(true); + } - int num; - for (int num247 = 0; num247 < 10; num247 = num + 1) - { - int num248 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num248].noGravity = true; - dust = Main.dust[num248]; - dust.velocity *= 2f; - num = num247; - } - } + int num; + for (int num247 = 0; num247 < 10; num247 = num + 1) + { + int num248 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[num248].noGravity = true; + dust = Main.dust[num248]; + dust.velocity *= 2f; + num = num247; + } + } - // Don't take damage while teleporting - npc.dontTakeDamage = (npc.hide = flag9); + // Don't take damage while teleporting + npc.dontTakeDamage = (npc.hide = flag9); - // Jump - if (npc.velocity.Y == 0f) - { - npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; + // Jump + if (npc.velocity.Y == 0f) + { + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; - if (!flag8) - { - npc.ai[0] += 2f; - if (CalamityWorld.bossRushActive) - npc.ai[0] += 9f; - else if (CalamityWorld.death) - npc.ai[0] += 4f; - else - { - if ((double)npc.life < (double)npc.lifeMax * 0.8) - npc.ai[0] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.6) - npc.ai[0] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.4) - npc.ai[0] += 2f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.2 || CalamityWorld.bossRushActive) - npc.ai[0] += 3f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - npc.ai[0] += 4f; + if (!flag8) + { + npc.ai[0] += 2f; + if (CalamityWorld.bossRushActive) + npc.ai[0] += 9f; + else if (CalamityWorld.death) + npc.ai[0] += 4f; + else + { + if ((double)npc.life < (double)npc.lifeMax * 0.8) + npc.ai[0] += 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.6) + npc.ai[0] += 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.4) + npc.ai[0] += 2f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.2 || CalamityWorld.bossRushActive) + npc.ai[0] += 3f; + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + npc.ai[0] += 4f; - if (npc.ai[0] >= 0f) - { - npc.netUpdate = true; - npc.TargetClosest(true); + if (npc.ai[0] >= 0f) + { + npc.netUpdate = true; + npc.TargetClosest(true); - float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += (distanceBelowTarget) * 0.002f; + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += (distanceBelowTarget) * 0.002f; - if (speedMult > 2f) - speedMult = 2f; + if (speedMult > 2f) + speedMult = 2f; - // Jump type - if (npc.ai[1] == 3f) - { - npc.velocity.Y = -13f * speedMult; - npc.velocity.X += (phase2 ? 4f : 3.5f) * (float)npc.direction; - if (CalamityWorld.bossRushActive) - npc.velocity.X *= 2f; + // Jump type + if (npc.ai[1] == 3f) + { + npc.velocity.Y = -13f * speedMult; + npc.velocity.X += (phase2 ? 4f : 3.5f) * (float)npc.direction; + if (CalamityWorld.bossRushActive) + npc.velocity.X *= 2f; - npc.ai[0] = -200f; - npc.ai[1] = 0f; - } - else if (npc.ai[1] == 2f) - { - npc.velocity.Y = -6f * speedMult; - npc.velocity.X += (phase2 ? 5f : 4.5f) * (float)npc.direction; - if (CalamityWorld.bossRushActive) - npc.velocity.X *= 2f; + npc.ai[0] = -200f; + npc.ai[1] = 0f; + } + else if (npc.ai[1] == 2f) + { + npc.velocity.Y = -6f * speedMult; + npc.velocity.X += (phase2 ? 5f : 4.5f) * (float)npc.direction; + if (CalamityWorld.bossRushActive) + npc.velocity.X *= 2f; - npc.ai[0] = -120f; - npc.ai[1] += 1f; - } - else - { - npc.velocity.Y = -8f * speedMult; - npc.velocity.X += (phase2 ? 4.5f : 4f) * (float)npc.direction; - if (CalamityWorld.bossRushActive) - npc.velocity.X *= 2f; + npc.ai[0] = -120f; + npc.ai[1] += 1f; + } + else + { + npc.velocity.Y = -8f * speedMult; + npc.velocity.X += (phase2 ? 4.5f : 4f) * (float)npc.direction; + if (CalamityWorld.bossRushActive) + npc.velocity.X *= 2f; - npc.ai[0] = -120f; - npc.ai[1] += 1f; - } - } - else if (npc.ai[0] >= -30f) - npc.aiAction = 1; - } - } + npc.ai[0] = -120f; + npc.ai[1] += 1f; + } + } + else if (npc.ai[0] >= -30f) + npc.aiAction = 1; + } + } - // Change jump velocity - else if (npc.target < 255 && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) - { - if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.4f : 0.2f) * (float)npc.direction; - else - npc.velocity.X *= (CalamityWorld.bossRushActive ? 0.9f : 0.93f); - } + // Change jump velocity + else if (npc.target < 255 && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) + { + if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.4f : 0.2f) * (float)npc.direction; + else + npc.velocity.X *= (CalamityWorld.bossRushActive ? 0.9f : 0.93f); + } - // Spawn dust - int num249 = Dust.NewDust(npc.position, npc.width, npc.height, 4, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num249].noGravity = true; - dust = Main.dust[num249]; - dust.velocity *= 0.5f; + // Spawn dust + int num249 = Dust.NewDust(npc.position, npc.width, npc.height, 4, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[num249].noGravity = true; + dust = Main.dust[num249]; + dust.velocity *= 0.5f; - if (npc.life > 0) - { - // Adjust size npcd on HP - lifeRatio = lifeRatio * 0.5f + 0.75f; - lifeRatio *= num234; - if (lifeRatio != npc.scale) - { - npc.position.X += (float)(npc.width / 2); - npc.position.Y += (float)npc.height; - npc.scale = lifeRatio; - npc.width = (int)(98f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X -= (float)(npc.width / 2); - npc.position.Y -= (float)npc.height; - } + if (npc.life > 0) + { + // Adjust size npcd on HP + lifeRatio = lifeRatio * 0.5f + 0.75f; + lifeRatio *= num234; + if (lifeRatio != npc.scale) + { + npc.position.X += (float)(npc.width / 2); + npc.position.Y += (float)npc.height; + npc.scale = lifeRatio; + npc.width = (int)(98f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X -= (float)(npc.width / 2); + npc.position.Y -= (float)npc.height; + } - // Slime spawning - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num251 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num251) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - int num252 = Main.rand.Next(2, 4); - int num; - for (int num253 = 0; num253 < num252; num253 = num + 1) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + // Slime spawning + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num251 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num251) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + int num252 = Main.rand.Next(2, 4); + int num; + for (int num253 = 0; num253 < num252; num253 = num + 1) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int random = phase2 ? 10 : 8; - int npcType = Main.rand.Next(random); - switch (npcType) - { - case 0: - npcType = NPCID.BlueSlime; - break; - case 1: - npcType = NPCID.YellowSlime; - break; - case 2: - npcType = NPCID.RedSlime; - break; - case 3: - npcType = NPCID.PurpleSlime; - break; - case 4: - npcType = NPCID.GreenSlime; - break; - case 5: - npcType = NPCID.IceSlime; - break; - case 6: - case 7: - case 8: - case 9: - npcType = NPCID.SlimeSpiked; - break; - default: - break; - } + int random = phase2 ? 10 : 8; + int npcType = Main.rand.Next(random); + switch (npcType) + { + case 0: + npcType = NPCID.BlueSlime; + break; + case 1: + npcType = NPCID.YellowSlime; + break; + case 2: + npcType = NPCID.RedSlime; + break; + case 3: + npcType = NPCID.PurpleSlime; + break; + case 4: + npcType = NPCID.GreenSlime; + break; + case 5: + npcType = NPCID.IceSlime; + break; + case 6: + case 7: + case 8: + case 9: + npcType = NPCID.SlimeSpiked; + break; + default: + break; + } if ((Main.raining || CalamityWorld.bossRushActive) && Main.rand.NextBool(10)) { - npcType = NPCID.UmbrellaSlime; + npcType = NPCID.UmbrellaSlime; if (Main.rand.NextBool(5)) npcType = NPCID.RainbowSlime; - } + } if (Main.rand.NextBool(250)) npcType = NPCID.Pinky; - int num255 = NPC.NewNPC(x, y, npcType, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num255].SetDefaults(npcType, -1f); - Main.npc[num255].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num255].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num255].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num255].ai[1] = 0f; + int num255 = NPC.NewNPC(x, y, npcType, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num255].SetDefaults(npcType, -1f); + Main.npc[num255].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num255].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num255].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num255].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num255 < 200) - NetMessage.SendData(23, -1, -1, null, num255, 0f, 0f, 0f, 0, 0, 0); + if (Main.netMode == NetmodeID.Server && num255 < 200) + NetMessage.SendData(23, -1, -1, null, num255, 0f, 0f, 0f, 0, 0, 0); - num = num253; - } - } - } - } + num = num253; + } + } + } + } - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - return false; - } - #endregion + return false; + } + #endregion - #region Buffed Eye of Cthulhu AI - public static bool BuffedEyeofCthulhuAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - float num5 = 20f; + #region Buffed Eye of Cthulhu AI + public static bool BuffedEyeofCthulhuAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + float num5 = 20f; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - bool phase2 = lifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.75f); - bool phase4 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8f : 0.65f); - bool phase5 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.7f : 0.5f); + bool phase2 = lifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase3 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.75f); + bool phase4 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8f : 0.65f); + bool phase5 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.7f : 0.5f); - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); - bool dead = Main.player[npc.target].dead; - float num6 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num7 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num8 = (float)Math.Atan2((double)num7, (double)num6) + 1.57f; + bool dead = Main.player[npc.target].dead; + float num6 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); + float num7 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); + float num8 = (float)Math.Atan2((double)num7, (double)num6) + 1.57f; - if (num8 < 0f) - num8 += 6.283f; - else if ((double)num8 > 6.283) - num8 -= 6.283f; + if (num8 < 0f) + num8 += 6.283f; + else if ((double)num8 > 6.283) + num8 -= 6.283f; - float num9 = 0f; - if (npc.ai[0] == 0f && npc.ai[1] == 0f) - num9 = 0.02f; - if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num9 = 0.05f; - if (npc.ai[0] == 3f && npc.ai[1] == 0f) - num9 = 0.05f; - if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num9 = 0.08f; - if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num5) - num9 = 0.15f; - if (npc.ai[0] == 3f && npc.ai[1] == 5f) - num9 = 0.05f; - num9 *= 1.5f; + float num9 = 0f; + if (npc.ai[0] == 0f && npc.ai[1] == 0f) + num9 = 0.02f; + if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) + num9 = 0.05f; + if (npc.ai[0] == 3f && npc.ai[1] == 0f) + num9 = 0.05f; + if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) + num9 = 0.08f; + if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num5) + num9 = 0.15f; + if (npc.ai[0] == 3f && npc.ai[1] == 5f) + num9 = 0.05f; + num9 *= 1.5f; - if (npc.rotation < num8) - { - if ((double)(num8 - npc.rotation) > 3.1415) - npc.rotation -= num9; - else - npc.rotation += num9; - } - else if (npc.rotation > num8) - { - if ((double)(npc.rotation - num8) > 3.1415) - npc.rotation += num9; - else - npc.rotation -= num9; - } + if (npc.rotation < num8) + { + if ((double)(num8 - npc.rotation) > 3.1415) + npc.rotation -= num9; + else + npc.rotation += num9; + } + else if (npc.rotation > num8) + { + if ((double)(npc.rotation - num8) > 3.1415) + npc.rotation += num9; + else + npc.rotation -= num9; + } - if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) - npc.rotation = num8; - if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; - if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) - npc.rotation = num8; + if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) + npc.rotation = num8; + if (npc.rotation < 0f) + npc.rotation += 6.283f; + else if ((double)npc.rotation > 6.283) + npc.rotation -= 6.283f; + if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) + npc.rotation = num8; if (Main.rand.NextBool(5)) { - int num10 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust var_9_825_cp_0_cp_0 = Main.dust[num10]; - var_9_825_cp_0_cp_0.velocity.X *= 0.5f; - Dust var_9_845_cp_0_cp_0 = Main.dust[num10]; - var_9_845_cp_0_cp_0.velocity.Y *= 0.1f; - } - - if (Main.dayTime | dead) - { - npc.velocity.Y -= 0.04f; - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - - else if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - float num11 = 7f; - float num12 = 0.15f; - - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num13 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; - float num14 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector.Y; - float num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - float num16 = num15; - - num15 = num11 / num15; - num13 *= num15; - num14 *= num15; - - if (npc.velocity.X < num13) - { - npc.velocity.X += num12; - if (npc.velocity.X < 0f && num13 > 0f) - npc.velocity.X += num12; - } - else if (npc.velocity.X > num13) - { - npc.velocity.X -= num12; - if (npc.velocity.X > 0f && num13 < 0f) - npc.velocity.X -= num12; - } - if (npc.velocity.Y < num14) - { - npc.velocity.Y += num12; - if (npc.velocity.Y < 0f && num14 > 0f) - npc.velocity.Y += num12; - } - else if (npc.velocity.Y > num14) - { - npc.velocity.Y -= num12; - if (npc.velocity.Y > 0f && num14 < 0f) - npc.velocity.Y -= num12; - } - - npc.ai[2] += 1f; - float num17 = 180f; - if (npc.ai[2] >= num17) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - else if (num16 < 500f) - { - if (!Main.player[npc.target].dead) - npc.ai[3] += 1f; - - if (npc.ai[3] >= 40f) - { - npc.ai[3] = 0f; - npc.rotation = num8; - - float num19 = 6f; - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - - num22 = num19 / num22; - Vector2 vector2 = vector; - Vector2 vector3; - vector3.X = num20 * num22; - vector3.Y = num21 * num22; - vector2.X += vector3.X * 10f; - vector2.Y += vector3.Y * 10f; - - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.ServantofCthulhu) < 12) - { - int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num23].velocity.X = vector3.X; - Main.npc[num23].velocity.Y = vector3.Y; - - if (Main.netMode == NetmodeID.Server && num23 < 200) - NetMessage.SendData(23, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); - } - - Main.PlaySound(3, (int)vector2.X, (int)vector2.Y, 1, 1f, 0f); - - int num; - for (int m = 0; m < 10; m = num + 1) - { - Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, default, 1f); - num = m; - } - } - } - } - else if (npc.ai[1] == 1f) - { - npc.rotation = num8; - float num24 = 7.25f; - - Vector2 vector4 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num25 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector4.X; - float num26 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector4.Y; - float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); - - num27 = num24 / num27; - npc.velocity.X = num25 * num27; - npc.velocity.Y = num26 * num27; - - npc.ai[1] = 2f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 40f) - { - npc.velocity *= 0.975f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - int num28 = 90; - if (npc.ai[2] >= (float)num28) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num8; - - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - if (phase2) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] % 20f == 0f) - { - Vector2 vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num31 = (float)Main.rand.Next(-200, 200); - float num32 = (float)Main.rand.Next(-200, 200); - float num33 = (float)Math.Sqrt((double)(num31 * num31 + num32 * num32)); - - num33 = 8f / num33; - Vector2 vector6 = vector5; - Vector2 vector7; - vector7.X = num31 * num33; - vector7.Y = num32 * num33; - vector6.X += vector7.X * 10f; - vector6.Y += vector7.Y * 10f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num34 = NPC.NewNPC((int)vector6.X, (int)vector6.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num34].velocity.X = vector7.X; - Main.npc[num34].velocity.Y = vector7.Y; - - if (Main.netMode == NetmodeID.Server && num34 < 200) - NetMessage.SendData(23, -1, -1, null, num34, 0f, 0f, 0f, 0, 0, 0); - } - - int num; - for (int n = 0; n < 10; n = num + 1) - { - Dust.NewDust(vector6, 20, 20, 5, vector7.X * 0.4f, vector7.Y * 0.4f, 0, default, 1f); - num = n; - } - } - - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - - if (npc.ai[0] == 3f) - npc.ai[2] = 0f; - else - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - - int num; - for (int num35 = 0; num35 < 2; num35 = num + 1) - { - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); - num = num35; - } - - for (int num36 = 0; num36 < 20; num36 = num + 1) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - num = num36; - } - - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - } - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - - else - { - npc.defense = 6; - npc.damage = (int)((float)npc.defDamage * (phase5 ? 1.4f : 1.2f)); - - if (npc.ai[1] == 0f & phase5) - npc.ai[1] = 5f; - - if (npc.ai[1] == 0f) - { - float num37 = ((enraged || configBossRushBoost) ? 8f : 5.5f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (0.85f - lifeRatio); - float num38 = ((enraged || configBossRushBoost) ? 0.09f : 0.06f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.04f : 0.025f) * (0.85f - lifeRatio); - if (CalamityWorld.bossRushActive) - { - num37 *= 2f; - num38 *= 2f; - } - - Vector2 vector8 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num39 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector8.X; - float num40 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 120f - vector8.Y; - float num41 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); - - if (num41 > 400f) - { - num37 += 1.25f; - num38 += 0.075f; - if (num41 > 600f) - { - num37 += 1.25f; - num38 += 0.075f; - if (num41 > 800f) - { - num37 += 1.25f; - num38 += 0.075f; - } - } - } - - num41 = num37 / num41; - num39 *= num41; - num40 *= num41; - - if (npc.velocity.X < num39) - { - npc.velocity.X += num38; - if (npc.velocity.X < 0f && num39 > 0f) - npc.velocity.X += num38; - } - else if (npc.velocity.X > num39) - { - npc.velocity.X -= num38; - if (npc.velocity.X > 0f && num39 < 0f) - npc.velocity.X -= num38; - } - if (npc.velocity.Y < num40) - { - npc.velocity.Y += num38; - if (npc.velocity.Y < 0f && num40 > 0f) - npc.velocity.Y += num38; - } - else if (npc.velocity.Y > num40) - { - npc.velocity.Y -= num38; - if (npc.velocity.Y > 0f && num40 < 0f) - npc.velocity.Y -= num38; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= 200f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (phase4) - npc.ai[1] = 3f; - - npc.target = 255; - npc.netUpdate = true; - } - } - - else if (npc.ai[1] == 1f) - { - Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - npc.rotation = num8; - - float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.85f - lifeRatio); - if (npc.ai[3] == 1f) - num42 *= 1.15f; - if (npc.ai[3] == 2f) - num42 *= 1.3f; - if (CalamityWorld.bossRushActive) - num42 *= 2f; - - Vector2 vector9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num43 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector9.X; - float num44 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector9.Y; - float num45 = (float)Math.Sqrt((double)(num43 * num43 + num44 * num44)); - - num45 = num42 / num45; - npc.velocity.X = num43 * num45; - npc.velocity.Y = num44 * num45; - npc.ai[1] = 2f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - - else if (npc.ai[1] == 2f) - { - float num46 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 70f : 60f; - - npc.ai[2] += 1f; - if (npc.ai[2] >= num46) - { - npc.velocity *= 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - int num47 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 70 : 80; - if (npc.ai[2] >= (float)num47) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num8; - - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && phase3) - { - npc.ai[1] = 3f; - npc.ai[3] += (float)Main.rand.Next(1, 4); - } - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - else - npc.ai[1] = 1f; - } - } - - else if (npc.ai[1] == 3f) - { - if ((npc.ai[3] == 4f & phase5) && npc.Center.Y > Main.player[npc.target].Center.Y) - { - npc.TargetClosest(true); - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(true); - float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (0.7f - lifeRatio); - if (CalamityWorld.bossRushActive) - num48 *= 1.5f; - - Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num49 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector10.X; - float num50 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector10.Y; - float num51 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; - num51 += 10f - num51; - - if (num51 < 5f) - num51 = 5f; - if (num51 > 15f) - num51 = 15f; - - if (npc.ai[2] == -1f) - { - num51 *= 4f; - num48 *= 1.3f; - } - - num49 -= Main.player[npc.target].velocity.X * num51; - num50 -= Main.player[npc.target].velocity.Y * num51 / 4f; - num49 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num50 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - - float num52 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); - float num53 = num52; - - num52 = num48 / num52; - npc.velocity.X = num49 * num52; - npc.velocity.Y = num50 * num52; - npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; - - if (num53 < 100f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num56 = Math.Abs(npc.velocity.X); - float num57 = Math.Abs(npc.velocity.Y); - - if (npc.Center.X > Main.player[npc.target].Center.X) - num57 *= -1f; - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num56 *= -1f; - - npc.velocity.X = num57; - npc.velocity.Y = num56; - } - } - else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num58 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; - float num59 = num58; - - if (npc.Center.X > Main.player[npc.target].Center.X) - num59 *= -1f; - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num58 *= -1f; - - npc.velocity.X = num59; - npc.velocity.Y = num58; - } - npc.ai[1] = 4f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - else if (npc.ai[1] == 4f) - { - if (npc.ai[2] == 0f) - Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); - - float num60 = num5; - npc.ai[2] += 1f; - - if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) - npc.ai[2] -= 1f; - - if (npc.ai[2] >= num60) - { - npc.velocity *= 0.95f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - float num61 = num60 + 13f; - if (npc.ai[2] >= num61) - { - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - - npc.ai[3] += 1f; - npc.ai[2] = 0f; - - if (npc.ai[3] >= 5f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 3f; - } - } - - else if (npc.ai[1] == 5f) - { - float num62 = 600f; - float num63 = ((enraged || configBossRushBoost) ? 12f : 8f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.4f - lifeRatio); - float num64 = ((enraged || configBossRushBoost) ? 0.4f : 0.25f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.15f : 0.1f) * (0.4f - lifeRatio); - if (CalamityWorld.bossRushActive) - { - num63 *= 2f; - num64 *= 2f; - } - - Vector2 vector11 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector11.X; - float num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) + num62 - vector11.Y; - - bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; - if (horizontalCharge) - { - num62 = (calamityGlobalNPC.newAI[0] == 1f ? -500f : 500f); - num63 *= 1.5f; - num64 *= 1.5f; - - num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + num62 - vector11.X; - num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector11.Y; - } - - float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); - num67 = num63 / num67; - num65 *= num67; - num66 *= num67; - - if (npc.velocity.X < num65) - { - npc.velocity.X += num64; - if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X += num64; - } - else if (npc.velocity.X > num65) - { - npc.velocity.X -= num64; - if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X -= num64; - } - if (npc.velocity.Y < num66) - { - npc.velocity.Y += num64; - if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y += num64; - } - else if (npc.velocity.Y > num66) - { - npc.velocity.Y -= num64; - if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y -= num64; - } - - npc.ai[2] += 1f; - - if (npc.ai[2] % 45f == 0f) - { - float num19 = CalamityWorld.bossRushActive ? 9f : 6f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - - num22 = num19 / num22; - Vector2 vector2 = vector; - Vector2 vector3; - vector3.X = num20 * num22; - vector3.Y = num21 * num22; - vector2.X += vector3.X * 10f; - vector2.Y += vector3.Y * 10f; - - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.ServantofCthulhu) < 4) - { - int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num23].velocity.X = vector3.X; - Main.npc[num23].velocity.Y = vector3.Y; - - if (Main.netMode == NetmodeID.Server && num23 < 200) - NetMessage.SendData(23, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); - } - - Main.PlaySound(SoundID.NPCDeath13, npc.position); - - int num; - for (int m = 0; m < 10; m = num + 1) - { - Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, default, 1f); - num = m; - } - } - - if (npc.ai[2] >= (horizontalCharge ? 100f : 70f)) - { - npc.TargetClosest(true); - - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: // Normal Eye behavior - npc.ai[1] = 3f; - npc.ai[2] = -1f; - npc.ai[3] = -1f; - break; - case 1: // Charge from the left - npc.ai[1] = 6f; - npc.ai[2] = 0f; - break; - case 2: // Normal Eye behavior - npc.ai[1] = 3f; - npc.ai[2] = -1f; - break; - case 3: // Charge from the right - npc.ai[1] = 6f; - npc.ai[2] = 0f; - break; - default: - break; - } - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > 3f) - calamityGlobalNPC.newAI[0] = 0f; - - npc.netUpdate = true; - } - } - - else if (npc.ai[1] == 6f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(true); - float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.4f - lifeRatio); - if (CalamityWorld.bossRushActive) - num48 *= 1.5f; - - Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num49 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector10.X; - float num50 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector10.Y; - float num51 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); - - num51 = num48 / num51; - npc.velocity.X = num49 * num51; - npc.velocity.Y = num50 * num51; - - npc.ai[1] = 7f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - else if (npc.ai[1] == 7f) - { - if (npc.ai[2] == 0f) - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - - float num60 = num5 * 2.5f; - npc.ai[2] += 1f; - - if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) - npc.ai[2] -= 1f; - - if (npc.ai[2] >= num60) - { - npc.velocity *= 0.95f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - float num61 = num60 + 13f; - if (npc.ai[2] >= num61) - { - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - - npc.ai[2] = 0f; - npc.ai[1] = 0f; - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Eater of Worlds AI - public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - // Total body segments - float totalSegments = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 73f : 63f; - - // Count segments remaining - float segmentCount = (float)(NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail)); // 2f to 65f - - // Percent segments remaining, add two to total for head and tail - float lifeRatio = segmentCount / (totalSegments + 2); - - // Phases - bool phase2 = lifeRatio < 0.9f || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.75f || CalamityWorld.bossRushActive; - bool phase4 = lifeRatio < 0.4f || CalamityWorld.bossRushActive; - bool phase5 = lifeRatio < 0.1f; - - // Damage - if (phase4 && npc.type == NPCID.EaterofWorldsHead) - npc.damage = (int)((float)npc.defDamage * (phase5 ? 1.2f : 1.1f)); - - // Fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient && !phase5) - { - // Vile spit - if (npc.type == NPCID.EaterofWorldsBody) - { - if (Main.rand.NextBool(900) && phase2) - { - npc.TargetClosest(true); - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), NPCID.VileSpit, 0, 0f, 1f, 0f, 0f, 255); - } - } - - // Cursed flames - else if (npc.type == NPCID.EaterofWorldsHead) - { - calamityGlobalNPC.newAI[0] += 1f; - float timer = 90f; - timer += lifeRatio * 180f; - - if (calamityGlobalNPC.newAI[0] >= timer && phase3) - { - calamityGlobalNPC.newAI[0] = 0f; - - npc.TargetClosest(true); - - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - - num349 *= num351; - num350 *= num351; - - float num418 = CalamityWorld.bossRushActive ? 18f : 12f; - int num419 = 15; - int num420 = ProjectileID.CursedFlameHostile; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num418 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349 * 3f; - vector34.Y += num350 * 3f; - - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - // Worm variable - npc.realLife = -1; - - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); - - // Despawn - if (Main.player[npc.target].dead) - { - if (npc.timeLeft > 300) - npc.timeLeft = 300; - } - - // Spawn segments - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) - { - // Spawn entire worm - if (npc.type == NPCID.EaterofWorldsHead) - { - // Length - npc.ai[2] = totalSegments; - - // Body spawn - npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) - { - // Body spawn - npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else - { - // Tail spawn - npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - - // Worm shit - Main.npc[(int)npc.ai[0]].ai[1] = (float)npc.whoAmI; - Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; - npc.netUpdate = true; - } - - // Splitting effect - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsHead; - int whoAmI = npc.whoAmI; - float num25 = (float)npc.life / (float)npc.lifeMax; - float num26 = npc.ai[0]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num25); - npc.ai[0] = num26; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI; - } - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) - { - int whoAmI2 = npc.whoAmI; - float num27 = (float)npc.life / (float)npc.lifeMax; - float num28 = npc.ai[1]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num27); - npc.ai[1] = num28; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI2; - } - - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - - // Movement - int num29 = (int)(npc.position.X / 16f) - 1; - int num30 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num31 = (int)(npc.position.Y / 16f) - 1; - int num32 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num29 < 0) - num29 = 0; - if (num30 > Main.maxTilesX) - num30 = Main.maxTilesX; - if (num31 < 0) - num31 = 0; - if (num32 > Main.maxTilesY) - num32 = Main.maxTilesY; - - // Fly or not - bool flag2 = false; - if (!flag2) - { - for (int num33 = num29; num33 < num30; num33++) - { - for (int num34 = num31; num34 < num32; num34++) - { - if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[(int)Main.tile[num33, num34].type] || (Main.tileSolidTop[(int)Main.tile[num33, num34].type] && Main.tile[num33, num34].frameY == 0))) || Main.tile[num33, num34].liquid > 64)) - { - Vector2 vector; - vector.X = (float)(num33 * 16); - vector.Y = (float)(num34 * 16); - if (npc.position.X + (float)npc.width > vector.X && npc.position.X < vector.X + 16f && npc.position.Y + (float)npc.height > vector.Y && npc.position.Y < vector.Y + 16f) - { - flag2 = true; + int num10 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); + Dust var_9_825_cp_0_cp_0 = Main.dust[num10]; + var_9_825_cp_0_cp_0.velocity.X *= 0.5f; + Dust var_9_845_cp_0_cp_0 = Main.dust[num10]; + var_9_845_cp_0_cp_0.velocity.Y *= 0.1f; + } + + if (Main.dayTime | dead) + { + npc.velocity.Y -= 0.04f; + + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + + else if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + float num11 = 7f; + float num12 = 0.15f; + + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num13 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; + float num14 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector.Y; + float num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + float num16 = num15; + + num15 = num11 / num15; + num13 *= num15; + num14 *= num15; + + if (npc.velocity.X < num13) + { + npc.velocity.X += num12; + if (npc.velocity.X < 0f && num13 > 0f) + npc.velocity.X += num12; + } + else if (npc.velocity.X > num13) + { + npc.velocity.X -= num12; + if (npc.velocity.X > 0f && num13 < 0f) + npc.velocity.X -= num12; + } + if (npc.velocity.Y < num14) + { + npc.velocity.Y += num12; + if (npc.velocity.Y < 0f && num14 > 0f) + npc.velocity.Y += num12; + } + else if (npc.velocity.Y > num14) + { + npc.velocity.Y -= num12; + if (npc.velocity.Y > 0f && num14 < 0f) + npc.velocity.Y -= num12; + } + + npc.ai[2] += 1f; + float num17 = 180f; + if (npc.ai[2] >= num17) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + else if (num16 < 500f) + { + if (!Main.player[npc.target].dead) + npc.ai[3] += 1f; + + if (npc.ai[3] >= 40f) + { + npc.ai[3] = 0f; + npc.rotation = num8; + + float num19 = 6f; + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + + num22 = num19 / num22; + Vector2 vector2 = vector; + Vector2 vector3; + vector3.X = num20 * num22; + vector3.Y = num21 * num22; + vector2.X += vector3.X * 10f; + vector2.Y += vector3.Y * 10f; + + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.ServantofCthulhu) < 12) + { + int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num23].velocity.X = vector3.X; + Main.npc[num23].velocity.Y = vector3.Y; + + if (Main.netMode == NetmodeID.Server && num23 < 200) + NetMessage.SendData(23, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); + } + + Main.PlaySound(3, (int)vector2.X, (int)vector2.Y, 1, 1f, 0f); + + int num; + for (int m = 0; m < 10; m = num + 1) + { + Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, default, 1f); + num = m; + } + } + } + } + else if (npc.ai[1] == 1f) + { + npc.rotation = num8; + float num24 = 7.25f; + + Vector2 vector4 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num25 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector4.X; + float num26 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector4.Y; + float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); + + num27 = num24 / num27; + npc.velocity.X = num25 * num27; + npc.velocity.Y = num26 * num27; + + npc.ai[1] = 2f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 40f) + { + npc.velocity *= 0.975f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + int num28 = 90; + if (npc.ai[2] >= (float)num28) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num8; + + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + if (phase2) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + npc.rotation += npc.ai[2]; + npc.ai[1] += 1f; + if (npc.ai[1] % 20f == 0f) + { + Vector2 vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num31 = (float)Main.rand.Next(-200, 200); + float num32 = (float)Main.rand.Next(-200, 200); + float num33 = (float)Math.Sqrt((double)(num31 * num31 + num32 * num32)); + + num33 = 8f / num33; + Vector2 vector6 = vector5; + Vector2 vector7; + vector7.X = num31 * num33; + vector7.Y = num32 * num33; + vector6.X += vector7.X * 10f; + vector6.Y += vector7.Y * 10f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num34 = NPC.NewNPC((int)vector6.X, (int)vector6.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num34].velocity.X = vector7.X; + Main.npc[num34].velocity.Y = vector7.Y; + + if (Main.netMode == NetmodeID.Server && num34 < 200) + NetMessage.SendData(23, -1, -1, null, num34, 0f, 0f, 0f, 0, 0, 0); + } + + int num; + for (int n = 0; n < 10; n = num + 1) + { + Dust.NewDust(vector6, 20, 20, 5, vector7.X * 0.4f, vector7.Y * 0.4f, 0, default, 1f); + num = n; + } + } + + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + + if (npc.ai[0] == 3f) + npc.ai[2] = 0f; + else + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + + int num; + for (int num35 = 0; num35 < 2; num35 = num + 1) + { + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); + num = num35; + } + + for (int num36 = 0; num36 < 20; num36 = num + 1) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + num = num36; + } + + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + } + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; + + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + + else + { + npc.defense = 6; + npc.damage = (int)((float)npc.defDamage * (phase5 ? 1.4f : 1.2f)); + + if (npc.ai[1] == 0f & phase5) + npc.ai[1] = 5f; + + if (npc.ai[1] == 0f) + { + float num37 = ((enraged || configBossRushBoost) ? 8f : 5.5f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (0.85f - lifeRatio); + float num38 = ((enraged || configBossRushBoost) ? 0.09f : 0.06f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.04f : 0.025f) * (0.85f - lifeRatio); + if (CalamityWorld.bossRushActive) + { + num37 *= 2f; + num38 *= 2f; + } + + Vector2 vector8 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num39 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector8.X; + float num40 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 120f - vector8.Y; + float num41 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); + + if (num41 > 400f) + { + num37 += 1.25f; + num38 += 0.075f; + if (num41 > 600f) + { + num37 += 1.25f; + num38 += 0.075f; + if (num41 > 800f) + { + num37 += 1.25f; + num38 += 0.075f; + } + } + } + + num41 = num37 / num41; + num39 *= num41; + num40 *= num41; + + if (npc.velocity.X < num39) + { + npc.velocity.X += num38; + if (npc.velocity.X < 0f && num39 > 0f) + npc.velocity.X += num38; + } + else if (npc.velocity.X > num39) + { + npc.velocity.X -= num38; + if (npc.velocity.X > 0f && num39 < 0f) + npc.velocity.X -= num38; + } + if (npc.velocity.Y < num40) + { + npc.velocity.Y += num38; + if (npc.velocity.Y < 0f && num40 > 0f) + npc.velocity.Y += num38; + } + else if (npc.velocity.Y > num40) + { + npc.velocity.Y -= num38; + if (npc.velocity.Y > 0f && num40 < 0f) + npc.velocity.Y -= num38; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= 200f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + if (phase4) + npc.ai[1] = 3f; + + npc.target = 255; + npc.netUpdate = true; + } + } + + else if (npc.ai[1] == 1f) + { + Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + npc.rotation = num8; + + float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.85f - lifeRatio); + if (npc.ai[3] == 1f) + num42 *= 1.15f; + if (npc.ai[3] == 2f) + num42 *= 1.3f; + if (CalamityWorld.bossRushActive) + num42 *= 2f; + + Vector2 vector9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num43 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector9.X; + float num44 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector9.Y; + float num45 = (float)Math.Sqrt((double)(num43 * num43 + num44 * num44)); + + num45 = num42 / num45; + npc.velocity.X = num43 * num45; + npc.velocity.Y = num44 * num45; + npc.ai[1] = 2f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + + else if (npc.ai[1] == 2f) + { + float num46 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 70f : 60f; + + npc.ai[2] += 1f; + if (npc.ai[2] >= num46) + { + npc.velocity *= 0.96f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + int num47 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 70 : 80; + if (npc.ai[2] >= (float)num47) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num8; + + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient && phase3) + { + npc.ai[1] = 3f; + npc.ai[3] += (float)Main.rand.Next(1, 4); + } + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else + npc.ai[1] = 1f; + } + } + + else if (npc.ai[1] == 3f) + { + if ((npc.ai[3] == 4f & phase5) && npc.Center.Y > Main.player[npc.target].Center.Y) + { + npc.TargetClosest(true); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(true); + float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (0.7f - lifeRatio); + if (CalamityWorld.bossRushActive) + num48 *= 1.5f; + + Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num49 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector10.X; + float num50 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector10.Y; + float num51 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; + num51 += 10f - num51; + + if (num51 < 5f) + num51 = 5f; + if (num51 > 15f) + num51 = 15f; + + if (npc.ai[2] == -1f) + { + num51 *= 4f; + num48 *= 1.3f; + } + + num49 -= Main.player[npc.target].velocity.X * num51; + num50 -= Main.player[npc.target].velocity.Y * num51 / 4f; + num49 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + num50 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + + float num52 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); + float num53 = num52; + + num52 = num48 / num52; + npc.velocity.X = num49 * num52; + npc.velocity.Y = num50 * num52; + npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; + npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; + + if (num53 < 100f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float num56 = Math.Abs(npc.velocity.X); + float num57 = Math.Abs(npc.velocity.Y); + + if (npc.Center.X > Main.player[npc.target].Center.X) + num57 *= -1f; + if (npc.Center.Y > Main.player[npc.target].Center.Y) + num56 *= -1f; + + npc.velocity.X = num57; + npc.velocity.Y = num56; + } + } + else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float num58 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; + float num59 = num58; + + if (npc.Center.X > Main.player[npc.target].Center.X) + num59 *= -1f; + if (npc.Center.Y > Main.player[npc.target].Center.Y) + num58 *= -1f; + + npc.velocity.X = num59; + npc.velocity.Y = num58; + } + npc.ai[1] = 4f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + else if (npc.ai[1] == 4f) + { + if (npc.ai[2] == 0f) + Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); + + float num60 = num5; + npc.ai[2] += 1f; + + if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + npc.ai[2] -= 1f; + + if (npc.ai[2] >= num60) + { + npc.velocity *= 0.95f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + float num61 = num60 + 13f; + if (npc.ai[2] >= num61) + { + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + + npc.ai[3] += 1f; + npc.ai[2] = 0f; + + if (npc.ai[3] >= 5f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 3f; + } + } + + else if (npc.ai[1] == 5f) + { + float num62 = 600f; + float num63 = ((enraged || configBossRushBoost) ? 12f : 8f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.4f - lifeRatio); + float num64 = ((enraged || configBossRushBoost) ? 0.4f : 0.25f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.15f : 0.1f) * (0.4f - lifeRatio); + if (CalamityWorld.bossRushActive) + { + num63 *= 2f; + num64 *= 2f; + } + + Vector2 vector11 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector11.X; + float num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) + num62 - vector11.Y; + + bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; + if (horizontalCharge) + { + num62 = (calamityGlobalNPC.newAI[0] == 1f ? -500f : 500f); + num63 *= 1.5f; + num64 *= 1.5f; + + num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + num62 - vector11.X; + num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector11.Y; + } + + float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); + num67 = num63 / num67; + num65 *= num67; + num66 *= num67; + + if (npc.velocity.X < num65) + { + npc.velocity.X += num64; + if (npc.velocity.X < 0f && num65 > 0f) + npc.velocity.X += num64; + } + else if (npc.velocity.X > num65) + { + npc.velocity.X -= num64; + if (npc.velocity.X > 0f && num65 < 0f) + npc.velocity.X -= num64; + } + if (npc.velocity.Y < num66) + { + npc.velocity.Y += num64; + if (npc.velocity.Y < 0f && num66 > 0f) + npc.velocity.Y += num64; + } + else if (npc.velocity.Y > num66) + { + npc.velocity.Y -= num64; + if (npc.velocity.Y > 0f && num66 < 0f) + npc.velocity.Y -= num64; + } + + npc.ai[2] += 1f; + + if (npc.ai[2] % 45f == 0f) + { + float num19 = CalamityWorld.bossRushActive ? 9f : 6f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + + num22 = num19 / num22; + Vector2 vector2 = vector; + Vector2 vector3; + vector3.X = num20 * num22; + vector3.Y = num21 * num22; + vector2.X += vector3.X * 10f; + vector2.Y += vector3.Y * 10f; + + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.ServantofCthulhu) < 4) + { + int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num23].velocity.X = vector3.X; + Main.npc[num23].velocity.Y = vector3.Y; + + if (Main.netMode == NetmodeID.Server && num23 < 200) + NetMessage.SendData(23, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); + } + + Main.PlaySound(SoundID.NPCDeath13, npc.position); + + int num; + for (int m = 0; m < 10; m = num + 1) + { + Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, default, 1f); + num = m; + } + } + + if (npc.ai[2] >= (horizontalCharge ? 100f : 70f)) + { + npc.TargetClosest(true); + + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: // Normal Eye behavior + npc.ai[1] = 3f; + npc.ai[2] = -1f; + npc.ai[3] = -1f; + break; + case 1: // Charge from the left + npc.ai[1] = 6f; + npc.ai[2] = 0f; + break; + case 2: // Normal Eye behavior + npc.ai[1] = 3f; + npc.ai[2] = -1f; + break; + case 3: // Charge from the right + npc.ai[1] = 6f; + npc.ai[2] = 0f; + break; + default: + break; + } + + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] > 3f) + calamityGlobalNPC.newAI[0] = 0f; + + npc.netUpdate = true; + } + } + + else if (npc.ai[1] == 6f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(true); + float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.4f - lifeRatio); + if (CalamityWorld.bossRushActive) + num48 *= 1.5f; + + Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num49 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector10.X; + float num50 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector10.Y; + float num51 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); + + num51 = num48 / num51; + npc.velocity.X = num49 * num51; + npc.velocity.Y = num50 * num51; + + npc.ai[1] = 7f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + else if (npc.ai[1] == 7f) + { + if (npc.ai[2] == 0f) + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + + float num60 = num5 * 2.5f; + npc.ai[2] += 1f; + + if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + npc.ai[2] -= 1f; + + if (npc.ai[2] >= num60) + { + npc.velocity *= 0.95f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + float num61 = num60 + 13f; + if (npc.ai[2] >= num61) + { + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + + npc.ai[2] = 0f; + npc.ai[1] = 0f; + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Eater of Worlds AI + public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + // Total body segments + float totalSegments = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 73f : 63f; + + // Count segments remaining + float segmentCount = (float)(NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail)); // 2f to 65f + + // Percent segments remaining, add two to total for head and tail + float lifeRatio = segmentCount / (totalSegments + 2); + + // Phases + bool phase2 = lifeRatio < 0.9f || CalamityWorld.bossRushActive; + bool phase3 = lifeRatio < 0.75f || CalamityWorld.bossRushActive; + bool phase4 = lifeRatio < 0.4f || CalamityWorld.bossRushActive; + bool phase5 = lifeRatio < 0.1f; + + // Damage + if (phase4 && npc.type == NPCID.EaterofWorldsHead) + npc.damage = (int)((float)npc.defDamage * (phase5 ? 1.2f : 1.1f)); + + // Fire projectiles + if (Main.netMode != NetmodeID.MultiplayerClient && !phase5) + { + // Vile spit + if (npc.type == NPCID.EaterofWorldsBody) + { + if (Main.rand.NextBool(900) && phase2) + { + npc.TargetClosest(true); + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), NPCID.VileSpit, 0, 0f, 1f, 0f, 0f, 255); + } + } + + // Cursed flames + else if (npc.type == NPCID.EaterofWorldsHead) + { + calamityGlobalNPC.newAI[0] += 1f; + float timer = 90f; + timer += lifeRatio * 180f; + + if (calamityGlobalNPC.newAI[0] >= timer && phase3) + { + calamityGlobalNPC.newAI[0] = 0f; + + npc.TargetClosest(true); + + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + + num349 *= num351; + num350 *= num351; + + float num418 = CalamityWorld.bossRushActive ? 18f : 12f; + int num419 = 15; + int num420 = ProjectileID.CursedFlameHostile; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num418 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349 * 3f; + vector34.Y += num350 * 3f; + + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + + // Worm variable + npc.realLife = -1; + + // Target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + npc.TargetClosest(true); + + // Despawn + if (Main.player[npc.target].dead) + { + if (npc.timeLeft > 300) + npc.timeLeft = 300; + } + + // Spawn segments + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) + { + // Spawn entire worm + if (npc.type == NPCID.EaterofWorldsHead) + { + // Length + npc.ai[2] = totalSegments; + + // Body spawn + npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) + { + // Body spawn + npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else + { + // Tail spawn + npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + + // Worm shit + Main.npc[(int)npc.ai[0]].ai[1] = (float)npc.whoAmI; + Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; + npc.netUpdate = true; + } + + // Splitting effect + if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsHead; + int whoAmI = npc.whoAmI; + float num25 = (float)npc.life / (float)npc.lifeMax; + float num26 = npc.ai[0]; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)((float)npc.lifeMax * num25); + npc.ai[0] = num26; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI; + } + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) + { + int whoAmI2 = npc.whoAmI; + float num27 = (float)npc.life / (float)npc.lifeMax; + float num28 = npc.ai[1]; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)((float)npc.lifeMax * num27); + npc.ai[1] = num28; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI2; + } + + if (!npc.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + + // Movement + int num29 = (int)(npc.position.X / 16f) - 1; + int num30 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num31 = (int)(npc.position.Y / 16f) - 1; + int num32 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num29 < 0) + num29 = 0; + if (num30 > Main.maxTilesX) + num30 = Main.maxTilesX; + if (num31 < 0) + num31 = 0; + if (num32 > Main.maxTilesY) + num32 = Main.maxTilesY; + + // Fly or not + bool flag2 = false; + if (!flag2) + { + for (int num33 = num29; num33 < num30; num33++) + { + for (int num34 = num31; num34 < num32; num34++) + { + if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[(int)Main.tile[num33, num34].type] || (Main.tileSolidTop[(int)Main.tile[num33, num34].type] && Main.tile[num33, num34].frameY == 0))) || Main.tile[num33, num34].liquid > 64)) + { + Vector2 vector; + vector.X = (float)(num33 * 16); + vector.Y = (float)(num34 * 16); + if (npc.position.X + (float)npc.width > vector.X && npc.position.X < vector.X + 16f && npc.position.Y + (float)npc.height > vector.Y && npc.position.Y < vector.Y + 16f) + { + flag2 = true; if (Main.rand.NextBool(100) && Main.tile[num33, num34].nactive()) { - WorldGen.KillTile(num33, num34, true, true, false); - } - } - } - } - } - } - if (!flag2 && npc.type == NPCID.EaterofWorldsHead) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num35 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 750 : 850); - if (CalamityWorld.bossRushActive) - num35 /= 2; - - bool flag3 = true; - for (int num36 = 0; num36 < 255; num36++) - { - if (Main.player[num36].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[num36].position.X - num35, (int)Main.player[num36].position.Y - num35, num35 * 2, num35 * 2); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - if (flag3) - flag2 = true; - } - - // Velocity and acceleration - float num37 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 13f : 12f) + 2.4f * (1f - lifeRatio); - float num38 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.16f : 0.15f) + 0.03f * (1f - lifeRatio); - - if (phase5) - { - num37 += 2.4f; - num38 += 0.03f; - } - else if (phase4) - { - num37 += 1.2f; - num38 += 0.015f; - } - - Vector2 vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num39 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num40 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - - num39 = (float)((int)(num39 / 16f) * 16); - num40 = (float)((int)(num40 / 16f) * 16); - vector2.X = (float)((int)(vector2.X / 16f) * 16); - vector2.Y = (float)((int)(vector2.Y / 16f) * 16); - num39 -= vector2.X; - num40 -= vector2.Y; - float num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); - - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num39 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector2.X; - num40 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector2.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2((double)num40, (double)num39) + 1.57f; - num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); - int num53 = npc.width; - num53 = (int)((float)num53 * npc.scale); - num52 = (num52 - (float)num53) / num52; - num39 *= num52; - num40 *= num52; - npc.velocity = Vector2.Zero; - npc.position.X += num39; - npc.position.Y += num40; - } - else - { - // Prevent new heads from being slowed when they spawn - if (calamityGlobalNPC.newAI[1] < 3f) - { - calamityGlobalNPC.newAI[1] += 1f; - - // Set velocity for when a new head spawns - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (num37 * (CalamityWorld.bossRushActive ? 0.8f : 0.4f)); - } - - if (!flag2) - { - npc.TargetClosest(true); - - npc.velocity.Y += 0.11f; - if (npc.velocity.Y > num37) - npc.velocity.Y = num37; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= num38 * 1.1f; - else - npc.velocity.X += num38 * 1.1f; - } - else if (npc.velocity.Y == num37) - { - if (npc.velocity.X < num39) - npc.velocity.X += num38; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38; - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - npc.velocity.X += num38 * 0.9f; - else - npc.velocity.X -= num38 * 0.9f; - } - } - else - { - // Sound - if (npc.soundDelay == 0) - { - float num54 = num52 / 40f; - if (num54 < 10f) - num54 = 10f; - if (num54 > 20f) - num54 = 20f; - - npc.soundDelay = (int)num54; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - } - - num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); - float num55 = Math.Abs(num39); - float num56 = Math.Abs(num40); - float num57 = num37 / num52; - num39 *= num57; - num40 *= num57; - - // Despawn - bool flag4 = npc.type == NPCID.EaterofWorldsHead && ((!Main.player[npc.target].ZoneCorrupt && !Main.player[npc.target].ZoneCrimson) || Main.player[npc.target].dead); - if (flag4 && !CalamityWorld.bossRushActive) - { - bool flag5 = true; - for (int num58 = 0; num58 < 255; num58++) - { - if (Main.player[num58].active && !Main.player[num58].dead && Main.player[num58].ZoneCorrupt) - flag5 = false; - } - - if (flag5) - { - if (Main.netMode != NetmodeID.MultiplayerClient && (double)(npc.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) - { - npc.active = false; - int num59 = (int)npc.ai[0]; - - while (num59 > 0 && num59 < 200 && Main.npc[num59].active && Main.npc[num59].aiStyle == npc.aiStyle) - { - int arg_2853_0 = (int)Main.npc[num59].ai[0]; - Main.npc[num59].active = false; - npc.life = 0; - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(23, -1, -1, null, num59, 0f, 0f, 0f, 0, 0, 0); - - num59 = arg_2853_0; - } - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - num39 = 0f; - num40 = num37; - } - } - - if ((npc.velocity.X > 0f && num39 > 0f) || (npc.velocity.X < 0f && num39 < 0f) || (npc.velocity.Y > 0f && num40 > 0f) || (npc.velocity.Y < 0f && num40 < 0f)) - { - if (npc.velocity.X < num39) - npc.velocity.X += num38; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38; - if (npc.velocity.Y < num40) - npc.velocity.Y += num38; - else if (npc.velocity.Y > num40) - npc.velocity.Y -= num38; - - if ((double)Math.Abs(num40) < (double)num37 * 0.2 && ((npc.velocity.X > 0f && num39 < 0f) || (npc.velocity.X < 0f && num39 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num38 * 2f; - else - npc.velocity.Y -= num38 * 2f; - } - - if ((double)Math.Abs(num39) < (double)num37 * 0.2 && ((npc.velocity.Y > 0f && num40 < 0f) || (npc.velocity.Y < 0f && num40 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num38 * 2f; - else - npc.velocity.X -= num38 * 2f; - } - } - else if (num55 > num56) - { - if (npc.velocity.X < num39) - npc.velocity.X += num38 * 1.1f; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num38; - else - npc.velocity.Y -= num38; - } - } - else - { - if (npc.velocity.Y < num40) - npc.velocity.Y += num38 * 1.1f; - else if (npc.velocity.Y > num40) - npc.velocity.Y -= num38 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num38; - else - npc.velocity.X -= num38; - } - } - } - - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - - if (npc.type == NPCID.EaterofWorldsHead) - { - if (flag2) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Brain of Cthulhu AI - public static bool BuffedBrainofCthulhuAI(NPC npc, bool enraged, Mod mod) - { - // whoAmI variable - NPC.crimsonBoss = npc.whoAmI; - - // Spawn Creepers - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - for (int num789 = 0; num789 < 20; num789++) - { - float num790 = npc.Center.X; - float num791 = npc.Center.Y; - num790 += (float)Main.rand.Next(-npc.width, npc.width); - num791 += (float)Main.rand.Next(-npc.height, npc.height); - - int num792 = NPC.NewNPC((int)num790, (int)num791, NPCID.Creeper, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num792].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); - Main.npc[num792].netUpdate = true; - } - } - - // Despawn - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(true); - - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6000f) - { - npc.active = false; - npc.life = 0; - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - - // Phase 2 - if (npc.ai[0] < 0f) - { - // Spawn gore - if (npc.localAI[2] == 0f) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - - npc.localAI[2] = 1f; - - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395, 1f); - - for (int num794 = 0; num794 < 20; num794++) - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases based on HP - bool phase2 = lifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.7f); - bool phase4 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.7f : 0.5f); - bool phase5 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.5f : 0.3f); - bool spinning = npc.ai[0] == -4f; - - // Gain defense while spinning - npc.defense = npc.defDefense + (spinning ? 7 : 0); - - // Take damage - npc.dontTakeDamage = false; - - // Deal no damage while spinning - npc.damage = (spinning ? 0 : (int)((float)npc.defDamage * (phase5 ? 1.2f : 1f))); - - // Move towards target - npc.TargetClosest(true); - - // Target distance X - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - - // Charge - if (!spinning) - { - // Not charging - if (npc.ai[0] != -6f) - { - // Rubber band movement - Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); - float num795 = Main.player[npc.target].Center.X - vector98.X; - float num796 = Main.player[npc.target].Center.Y - vector98.Y; - float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); - float num798 = 8f + (2f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - num798 *= 2f; - - if (phase2 && !phase3) - num798 *= 0.9f; - - num797 = num798 / num797; - num795 *= num797; - num796 *= num797; - npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; - } - - // Charge, -6 - else - { - npc.ai[1] += 1f; - - // Teleport - if (npc.ai[1] >= 115f) - { - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); - - npc.ai[0] = -7f; - npc.ai[1] = 0f; - npc.localAI[1] = 120f; - npc.netUpdate = true; - } - - // Charge sound and velocity - else if (npc.ai[1] == 10f) - { - // Sound - Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); - - // Velocity - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (CalamityWorld.bossRushActive ? 21f : 14f); - } - } - - // Rubber band movement, -5 - if (npc.ai[0] == -5f) - { - // Spin or teleport - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) - { - bool spin = (phase4 ? Main.rand.Next(4) > 0 : Main.rand.NextBool()); - if (phase5) - spin = true; - - // Velocity and knockback - if (spin) - { - npc.knockBackResist = 0f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; - } - else - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); - - npc.ai[0] = (!spin ? -7f : -4f); - npc.ai[1] = (!spin ? 0f : (playerLocation < 0 ? 1f : -1f)); - npc.ai[2] = 0f; - npc.ai[3] = (!spin ? 0f : (float)Main.rand.Next(61)); - npc.localAI[1] = (!spin ? 120f : 0f); - npc.netUpdate = true; - } - } - } - - // Circle around, -4 - if (spinning) - { - // Charge sound - if (npc.ai[2] == 0f) - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - - // Velocity - int var = 120; - float velocity = 6.28318548f / ((float)var * 0.75f); - npc.velocity = npc.velocity.RotatedBy((double)(-(double)velocity * npc.ai[1]), default); - - npc.ai[2] += 1f; - - float timer = 60f + npc.ai[3]; - - if (npc.ai[2] >= timer - 5f) - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 400f) // 25 tile distance - { - npc.ai[2] -= 1f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (CalamityWorld.bossRushActive ? -12f : -6f); - } - } - - // Charge at target and spit blood, -6 is straight line movement, -5 is rubber band movement - if (npc.ai[2] >= timer) - { - // Complete stop - npc.velocity *= 0f; - - // Blood spurt - if (phase5) - { - // Blood dust - for (int num621 = 0; num621 < 6; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + WorldGen.KillTile(num33, num34, true, true, false); + } + } + } + } + } + } + if (!flag2 && npc.type == NPCID.EaterofWorldsHead) + { + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num35 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 750 : 850); + if (CalamityWorld.bossRushActive) + num35 /= 2; + + bool flag3 = true; + for (int num36 = 0; num36 < 255; num36++) + { + if (Main.player[num36].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[num36].position.X - num35, (int)Main.player[num36].position.Y - num35, num35 * 2, num35 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + flag2 = true; + } + + // Velocity and acceleration + float num37 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 13f : 12f) + 2.4f * (1f - lifeRatio); + float num38 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.16f : 0.15f) + 0.03f * (1f - lifeRatio); + + if (phase5) + { + num37 += 2.4f; + num38 += 0.03f; + } + else if (phase4) + { + num37 += 1.2f; + num38 += 0.015f; + } + + Vector2 vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num39 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num40 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + + num39 = (float)((int)(num39 / 16f) * 16); + num40 = (float)((int)(num40 / 16f) * 16); + vector2.X = (float)((int)(vector2.X / 16f) * 16); + vector2.Y = (float)((int)(vector2.Y / 16f) * 16); + num39 -= vector2.X; + num40 -= vector2.Y; + float num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); + + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num39 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector2.X; + num40 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector2.Y; + } catch + { + } + + npc.rotation = (float)Math.Atan2((double)num40, (double)num39) + 1.57f; + num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); + int num53 = npc.width; + num53 = (int)((float)num53 * npc.scale); + num52 = (num52 - (float)num53) / num52; + num39 *= num52; + num40 *= num52; + npc.velocity = Vector2.Zero; + npc.position.X += num39; + npc.position.Y += num40; + } + else + { + // Prevent new heads from being slowed when they spawn + if (calamityGlobalNPC.newAI[1] < 3f) + { + calamityGlobalNPC.newAI[1] += 1f; + + // Set velocity for when a new head spawns + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (num37 * (CalamityWorld.bossRushActive ? 0.8f : 0.4f)); + } + + if (!flag2) + { + npc.TargetClosest(true); + + npc.velocity.Y += 0.11f; + if (npc.velocity.Y > num37) + npc.velocity.Y = num37; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= num38 * 1.1f; + else + npc.velocity.X += num38 * 1.1f; + } + else if (npc.velocity.Y == num37) + { + if (npc.velocity.X < num39) + npc.velocity.X += num38; + else if (npc.velocity.X > num39) + npc.velocity.X -= num38; + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + npc.velocity.X += num38 * 0.9f; + else + npc.velocity.X -= num38 * 0.9f; + } + } + else + { + // Sound + if (npc.soundDelay == 0) + { + float num54 = num52 / 40f; + if (num54 < 10f) + num54 = 10f; + if (num54 > 20f) + num54 = 20f; + + npc.soundDelay = (int)num54; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } + + num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); + float num55 = Math.Abs(num39); + float num56 = Math.Abs(num40); + float num57 = num37 / num52; + num39 *= num57; + num40 *= num57; + + // Despawn + bool flag4 = npc.type == NPCID.EaterofWorldsHead && ((!Main.player[npc.target].ZoneCorrupt && !Main.player[npc.target].ZoneCrimson) || Main.player[npc.target].dead); + if (flag4 && !CalamityWorld.bossRushActive) + { + bool flag5 = true; + for (int num58 = 0; num58 < 255; num58++) + { + if (Main.player[num58].active && !Main.player[num58].dead && Main.player[num58].ZoneCorrupt) + flag5 = false; + } + + if (flag5) + { + if (Main.netMode != NetmodeID.MultiplayerClient && (double)(npc.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) + { + npc.active = false; + int num59 = (int)npc.ai[0]; + + while (num59 > 0 && num59 < 200 && Main.npc[num59].active && Main.npc[num59].aiStyle == npc.aiStyle) + { + int arg_2853_0 = (int)Main.npc[num59].ai[0]; + Main.npc[num59].active = false; + npc.life = 0; + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(23, -1, -1, null, num59, 0f, 0f, 0f, 0, 0, 0); + + num59 = arg_2853_0; + } + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + num39 = 0f; + num40 = num37; + } + } + + if ((npc.velocity.X > 0f && num39 > 0f) || (npc.velocity.X < 0f && num39 < 0f) || (npc.velocity.Y > 0f && num40 > 0f) || (npc.velocity.Y < 0f && num40 < 0f)) + { + if (npc.velocity.X < num39) + npc.velocity.X += num38; + else if (npc.velocity.X > num39) + npc.velocity.X -= num38; + if (npc.velocity.Y < num40) + npc.velocity.Y += num38; + else if (npc.velocity.Y > num40) + npc.velocity.Y -= num38; + + if ((double)Math.Abs(num40) < (double)num37 * 0.2 && ((npc.velocity.X > 0f && num39 < 0f) || (npc.velocity.X < 0f && num39 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num38 * 2f; + else + npc.velocity.Y -= num38 * 2f; + } + + if ((double)Math.Abs(num39) < (double)num37 * 0.2 && ((npc.velocity.Y > 0f && num40 < 0f) || (npc.velocity.Y < 0f && num40 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num38 * 2f; + else + npc.velocity.X -= num38 * 2f; + } + } + else if (num55 > num56) + { + if (npc.velocity.X < num39) + npc.velocity.X += num38 * 1.1f; + else if (npc.velocity.X > num39) + npc.velocity.X -= num38 * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num38; + else + npc.velocity.Y -= num38; + } + } + else + { + if (npc.velocity.Y < num40) + npc.velocity.Y += num38 * 1.1f; + else if (npc.velocity.Y > num40) + npc.velocity.Y -= num38 * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num37 * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num38; + else + npc.velocity.X -= num38; + } + } + } + + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + + if (npc.type == NPCID.EaterofWorldsHead) + { + if (flag2) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Brain of Cthulhu AI + public static bool BuffedBrainofCthulhuAI(NPC npc, bool enraged, Mod mod) + { + // whoAmI variable + NPC.crimsonBoss = npc.whoAmI; + + // Spawn Creepers + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + for (int num789 = 0; num789 < 20; num789++) + { + float num790 = npc.Center.X; + float num791 = npc.Center.Y; + num790 += (float)Main.rand.Next(-npc.width, npc.width); + num791 += (float)Main.rand.Next(-npc.height, npc.height); + + int num792 = NPC.NewNPC((int)num790, (int)num791, NPCID.Creeper, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num792].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); + Main.npc[num792].netUpdate = true; + } + } + + // Despawn + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(true); + + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6000f) + { + npc.active = false; + npc.life = 0; + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + + // Phase 2 + if (npc.ai[0] < 0f) + { + // Spawn gore + if (npc.localAI[2] == 0f) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + + npc.localAI[2] = 1f; + + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395, 1f); + + for (int num794 = 0; num794 < 20; num794++) + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases based on HP + bool phase2 = lifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase3 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.7f); + bool phase4 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.7f : 0.5f); + bool phase5 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.5f : 0.3f); + bool spinning = npc.ai[0] == -4f; + + // Gain defense while spinning + npc.defense = npc.defDefense + (spinning ? 7 : 0); + + // Take damage + npc.dontTakeDamage = false; + + // Deal no damage while spinning + npc.damage = (spinning ? 0 : (int)((float)npc.defDamage * (phase5 ? 1.2f : 1f))); + + // Move towards target + npc.TargetClosest(true); + + // Target distance X + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + + // Charge + if (!spinning) + { + // Not charging + if (npc.ai[0] != -6f) + { + // Rubber band movement + Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); + float num795 = Main.player[npc.target].Center.X - vector98.X; + float num796 = Main.player[npc.target].Center.Y - vector98.Y; + float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); + float num798 = 8f + (2f * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) + num798 *= 2f; + + if (phase2 && !phase3) + num798 *= 0.9f; + + num797 = num798 / num797; + num795 *= num797; + num796 *= num797; + npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; + } + + // Charge, -6 + else + { + npc.ai[1] += 1f; + + // Teleport + if (npc.ai[1] >= 115f) + { + npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + + npc.ai[0] = -7f; + npc.ai[1] = 0f; + npc.localAI[1] = 120f; + npc.netUpdate = true; + } + + // Charge sound and velocity + else if (npc.ai[1] == 10f) + { + // Sound + Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); + + // Velocity + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (CalamityWorld.bossRushActive ? 21f : 14f); + } + } + + // Rubber band movement, -5 + if (npc.ai[0] == -5f) + { + // Spin or teleport + npc.ai[2] += 1f; + if (npc.ai[2] >= 180f) + { + bool spin = (phase4 ? Main.rand.Next(4) > 0 : Main.rand.NextBool()); + if (phase5) + spin = true; + + // Velocity and knockback + if (spin) + { + npc.knockBackResist = 0f; + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; + } + else + npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + + npc.ai[0] = (!spin ? -7f : -4f); + npc.ai[1] = (!spin ? 0f : (playerLocation < 0 ? 1f : -1f)); + npc.ai[2] = 0f; + npc.ai[3] = (!spin ? 0f : (float)Main.rand.Next(61)); + npc.localAI[1] = (!spin ? 120f : 0f); + npc.netUpdate = true; + } + } + } + + // Circle around, -4 + if (spinning) + { + // Charge sound + if (npc.ai[2] == 0f) + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + + // Velocity + int var = 120; + float velocity = 6.28318548f / ((float)var * 0.75f); + npc.velocity = npc.velocity.RotatedBy((double)(-(double)velocity * npc.ai[1]), default); + + npc.ai[2] += 1f; + + float timer = 60f + npc.ai[3]; + + if (npc.ai[2] >= timer - 5f) + { + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 400f) // 25 tile distance + { + npc.ai[2] -= 1f; + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (CalamityWorld.bossRushActive ? -12f : -6f); + } + } + + // Charge at target and spit blood, -6 is straight line movement, -5 is rubber band movement + if (npc.ai[2] >= timer) + { + // Complete stop + npc.velocity *= 0f; + + // Blood spurt + if (phase5) + { + // Blood dust + for (int num621 = 0; num621 < 6; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 12; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } + Main.dust[num622].scale = 0.25f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 12; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } - // Projectile speed and spread - float num179 = 8f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; + // Projectile speed and spread + float num179 = 8f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; - // Fire 10 projectiles in an arc - for (int num186 = 0; num186 < 5; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-120, 121); - num180 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, mod.ProjectileType("BloodGeyser"), 12, 0f, Main.myPlayer, 0f, 0f); - } - } + // Fire 10 projectiles in an arc + for (int num186 = 0; num186 < 5; num186++) + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-120, 121); + num180 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, mod.ProjectileType("BloodGeyser"), 12, 0f, Main.myPlayer, 0f, 0f); + } + } - bool charge = (phase4 ? Main.rand.Next(4) > 0 : Main.rand.NextBool()); - if (phase5) - charge = true; + bool charge = (phase4 ? Main.rand.Next(4) > 0 : Main.rand.NextBool()); + if (phase5) + charge = true; - // Adjust knockback - if (charge) - npc.knockBackResist = 0f; - else - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + // Adjust knockback + if (charge) + npc.knockBackResist = 0f; + else + npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); - npc.ai[0] = (charge ? -6f : -5f); - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } + npc.ai[0] = (charge ? -6f : -5f); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } - // Pick teleport location - else if (npc.ai[0] == -1f || npc.ai[0] == -7f) - { - // Adjust knockback - if (npc.ai[0] == -1f) - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + // Pick teleport location + else if (npc.ai[0] == -1f || npc.ai[0] == -7f) + { + // Adjust knockback + if (npc.ai[0] == -1f) + npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Go to phase 3 - if (phase3 && npc.ai[0] == -1f) - { - npc.ai[0] = -5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Go to phase 3 + if (phase3 && npc.ai[0] == -1f) + { + npc.ai[0] = -5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.localAI[1] = 0f; + npc.alpha = 0; + npc.netUpdate = true; + } - npc.localAI[1] += 1f; + npc.localAI[1] += 1f; - int random = 5 - (int)(5f * (1f - lifeRatio)); - if (npc.justHit) - npc.localAI[1] -= (float)Main.rand.Next(random); + int random = 5 - (int)(5f * (1f - lifeRatio)); + if (npc.justHit) + npc.localAI[1] -= (float)Main.rand.Next(random); - float num799 = ((phase2 && !phase3) ? 60f : 90f); - if (CalamityWorld.bossRushActive) - num799 = 30f; + float num799 = ((phase2 && !phase3) ? 60f : 90f); + if (CalamityWorld.bossRushActive) + num799 = 30f; - if (npc.localAI[1] >= num799) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num800 = 0; - int num801; - int num802; - while (true) - { - num800++; - num801 = (int)Main.player[npc.target].Center.X / 16; - num802 = (int)Main.player[npc.target].Center.Y / 16; + if (npc.localAI[1] >= num799) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num800 = 0; + int num801; + int num802; + while (true) + { + num800++; + num801 = (int)Main.player[npc.target].Center.X / 16; + num802 = (int)Main.player[npc.target].Center.Y / 16; - int min = 9; - int max = ((phase2 && !phase3) ? 11 : 15); + int min = 9; + int max = ((phase2 && !phase3) ? 11 : 15); - if (phase3) - { - min = 17; - max = 20; - } + if (phase3) + { + min = 17; + max = 20; + } if (Main.rand.NextBool(2)) num801 += Main.rand.Next(min, max); - else - num801 -= Main.rand.Next(min, max); + else + num801 -= Main.rand.Next(min, max); if (Main.rand.NextBool(2)) num802 += Main.rand.Next(min, max); - else - num802 -= Main.rand.Next(min, max); + else + num802 -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num801, num802)) - break; + if (!WorldGen.SolidTile(num801, num802)) + break; - if (num800 > 100) - goto Block_2784; - } - npc.ai[3] = 0f; - npc.ai[0] = (npc.ai[0] == -7f ? -8f : -2f); - npc.ai[1] = (float)num801; - npc.ai[2] = (float)num802; - npc.netUpdate = true; - npc.netSpam = 0; - Block_2784:; - } - } - } + if (num800 > 100) + goto Block_2784; + } + npc.ai[3] = 0f; + npc.ai[0] = (npc.ai[0] == -7f ? -8f : -2f); + npc.ai[1] = (float)num801; + npc.ai[2] = (float)num802; + npc.netUpdate = true; + npc.netSpam = 0; + Block_2784: + ; + } + } + } - // Teleport and turn invisible - else if (npc.ai[0] == -2f || npc.ai[0] == -8f) - { - npc.velocity *= 0.9f; + // Teleport and turn invisible + else if (npc.ai[0] == -2f || npc.ai[0] == -8f) + { + npc.velocity *= 0.9f; - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] += 15f; - else - npc.ai[3] += 25f; + if (Main.netMode != NetmodeID.SinglePlayer) + npc.ai[3] += 15f; + else + npc.ai[3] += 25f; - if (npc.ai[3] >= 255f) - { - npc.ai[3] = 255f; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - Main.PlaySound(SoundID.Item8, npc.Center); - npc.ai[0] = (npc.ai[0] == -8f ? -9f : -3f); - npc.netUpdate = true; - npc.netSpam = 0; - } + if (npc.ai[3] >= 255f) + { + npc.ai[3] = 255f; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + Main.PlaySound(SoundID.Item8, npc.Center); + npc.ai[0] = (npc.ai[0] == -8f ? -9f : -3f); + npc.netUpdate = true; + npc.netSpam = 0; + } - npc.alpha = (int)npc.ai[3]; - } + npc.alpha = (int)npc.ai[3]; + } - // Become visible - else if (npc.ai[0] == -3f || npc.ai[0] == -9f) - { - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] -= 15f; - else - npc.ai[3] -= 25f; + // Become visible + else if (npc.ai[0] == -3f || npc.ai[0] == -9f) + { + if (Main.netMode != NetmodeID.SinglePlayer) + npc.ai[3] -= 15f; + else + npc.ai[3] -= 25f; - if (npc.ai[3] <= 0f) - { - bool spin = (phase4 ? (Main.rand.NextBool() && npc.ai[0] == -9f) : false); - if (phase5 && npc.ai[0] == -9f) - spin = true; + if (npc.ai[3] <= 0f) + { + bool spin = (phase4 ? (Main.rand.NextBool() && npc.ai[0] == -9f) : false); + if (phase5 && npc.ai[0] == -9f) + spin = true; - if (spin) - { - // Adjust knockback - npc.knockBackResist = 0f; + if (spin) + { + // Adjust knockback + npc.knockBackResist = 0f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; - npc.ai[0] = -4f; - npc.ai[1] = (playerLocation < 0 ? 1f : -1f); - npc.ai[2] = 0f; - npc.ai[3] = (float)Main.rand.Next(61); - } - else - { - npc.ai[3] = 0f; - npc.ai[2] = 0f; - npc.ai[1] = 0f; - npc.ai[0] = (npc.ai[0] == -9f ? -5f : -1f); - } - npc.netUpdate = true; - npc.netSpam = 0; - } + npc.ai[0] = -4f; + npc.ai[1] = (playerLocation < 0 ? 1f : -1f); + npc.ai[2] = 0f; + npc.ai[3] = (float)Main.rand.Next(61); + } + else + { + npc.ai[3] = 0f; + npc.ai[2] = 0f; + npc.ai[1] = 0f; + npc.ai[0] = (npc.ai[0] == -9f ? -5f : -1f); + } + npc.netUpdate = true; + npc.netSpam = 0; + } - npc.alpha = (int)npc.ai[3]; - } - } + npc.alpha = (int)npc.ai[3]; + } + } - // Phase 1 - else - { - // Creeper count - int creeperCount = NPC.CountNPCS(NPCID.Creeper); - int creeperScale = 21 - creeperCount; // 1 to 20 - bool phase2 = creeperCount <= 0; + // Phase 1 + else + { + // Creeper count + int creeperCount = NPC.CountNPCS(NPCID.Creeper); + int creeperScale = 21 - creeperCount; // 1 to 20 + bool phase2 = creeperCount <= 0; - // Move towards target - npc.TargetClosest(true); - Vector2 vector99 = new Vector2(npc.Center.X, npc.Center.Y); - float num803 = Main.player[npc.target].Center.X - vector99.X; - float num804 = Main.player[npc.target].Center.Y - vector99.Y; - float num805 = (float)Math.Sqrt((double)(num803 * num803 + num804 * num804)); - float num806 = (CalamityWorld.bossRushActive ? 5f : 1f) + ((float)creeperScale * 0.1f); - if (CalamityWorld.bossRushActive) - num806 *= 1.5f; + // Move towards target + npc.TargetClosest(true); + Vector2 vector99 = new Vector2(npc.Center.X, npc.Center.Y); + float num803 = Main.player[npc.target].Center.X - vector99.X; + float num804 = Main.player[npc.target].Center.Y - vector99.Y; + float num805 = (float)Math.Sqrt((double)(num803 * num803 + num804 * num804)); + float num806 = (CalamityWorld.bossRushActive ? 5f : 1f) + ((float)creeperScale * 0.1f); + if (CalamityWorld.bossRushActive) + num806 *= 1.5f; - if (num805 < num806) - { - npc.velocity.X = num803; - npc.velocity.Y = num804; - } - else - { - num805 = num806 / num805; - npc.velocity.X = num803 * num805; - npc.velocity.Y = num804 * num805; - } + if (num805 < num806) + { + npc.velocity.X = num803; + npc.velocity.Y = num804; + } + else + { + num805 = num806 / num805; + npc.velocity.X = num803 * num805; + npc.velocity.Y = num804 * num805; + } - // Pick a teleport location - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Go to phase 2 - if (phase2) - { - npc.ai[0] = -1f; - npc.localAI[1] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } + // Pick a teleport location + if (npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Go to phase 2 + if (phase2) + { + npc.ai[0] = -1f; + npc.localAI[1] = 0f; + npc.alpha = 0; + npc.netUpdate = true; + } - // Teleport location - npc.localAI[1] += 1f + ((float)creeperScale * 0.1f); - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f)) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num809 = 0; - int num810; - int num811; - while (true) - { - num809++; - num810 = (int)Main.player[npc.target].Center.X / 16; - num811 = (int)Main.player[npc.target].Center.Y / 16; + // Teleport location + npc.localAI[1] += 1f + ((float)creeperScale * 0.1f); + if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f)) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num809 = 0; + int num810; + int num811; + while (true) + { + num809++; + num810 = (int)Main.player[npc.target].Center.X / 16; + num811 = (int)Main.player[npc.target].Center.Y / 16; - int min = 18; - int max = 26; + int min = 18; + int max = 26; if (Main.rand.NextBool(2)) num810 += Main.rand.Next(min, max); - else - num810 -= Main.rand.Next(min, max); + else + num810 -= Main.rand.Next(min, max); if (Main.rand.NextBool(2)) num811 += Main.rand.Next(min, max); - else - num811 -= Main.rand.Next(min, max); - - if (!WorldGen.SolidTile(num810, num811) && Collision.CanHit(new Vector2((float)(num810 * 16), (float)(num811 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - break; - } - if (num809 > 100) - { - goto Block_2801; - } - } - npc.ai[0] = 1f; - npc.ai[1] = (float)num810; - npc.ai[2] = (float)num811; - npc.netUpdate = true; - Block_2801:; - } - } - } - - // Turn invisible and teleport - else if (npc.ai[0] == 1f) - { - npc.alpha += 25; - if (npc.alpha >= 255) - { - Main.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - } - } - - // Become visible - else if (npc.ai[0] == 2f) - { - npc.alpha -= 25; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[0] = 0f; - } - } - } - - // Despawn - if ((Main.player[npc.target].dead || (!Main.player[npc.target].ZoneCrimson && !Main.player[npc.target].ZoneCorrupt)) && !CalamityWorld.bossRushActive) - { - if (npc.localAI[3] < 120f) - npc.localAI[3] += 1f; - - if (npc.localAI[3] > 60f) - npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; - - npc.ai[0] = 2f; - npc.alpha = 10; - return false; - } - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedCreeperAI(NPC npc, bool enraged, Mod mod) - { - // Despawn if Brain is gone - if (NPC.crimsonBoss < 0) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - - // Creeper count, 0 to 20 - int creeperCount = NPC.CountNPCS(NPCID.Creeper); - bool phase2 = creeperCount <= 5; - - // Adjust knockback - if (phase2) - npc.knockBackResist = 0f; - - // Stay near Brain - if (npc.ai[0] == 0f) - { - Vector2 vector100 = new Vector2(npc.Center.X, npc.Center.Y); - float num812 = Main.npc[NPC.crimsonBoss].Center.X - vector100.X; - float num813 = Main.npc[NPC.crimsonBoss].Center.Y - vector100.Y; - float num814 = (float)Math.Sqrt((double)(num812 * num812 + num813 * num813)); - float velocity = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 10f : 9f; - if (CalamityWorld.bossRushActive) - velocity *= 2f; - - // Max distance from Brain - if (num814 > 90f) - { - num814 = velocity / num814; - num812 *= num814; - num813 *= num814; - npc.velocity.X = (npc.velocity.X * 15f + num812) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num813) / 16f; - return false; - } - - // Increase speed - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < velocity) - { - npc.velocity.Y *= 1.05f; - npc.velocity.X *= 1.05f; - } - - // Charge at target - int creeperScale = 21 - creeperCount; // 1 to 20 - npc.ai[1] += 0.5f + ((float)creeperScale * 0.25f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240f) - { - npc.ai[1] = 0f; - npc.TargetClosest(true); - vector100 = new Vector2(npc.Center.X, npc.Center.Y); - num812 = Main.player[npc.target].Center.X - vector100.X; - num813 = Main.player[npc.target].Center.Y - vector100.Y; - num814 = (float)Math.Sqrt((double)(num812 * num812 + num813 * num813)); - num814 = velocity / num814; - npc.velocity.X = num812 * num814; - npc.velocity.Y = num813 * num814; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - } - - // Charge - else - { - Vector2 value2 = Main.player[npc.target].Center - npc.Center; - value2.Normalize(); - value2 *= 9f; - npc.velocity = (npc.velocity * 99f + value2) / 100f; - - Vector2 vector101 = new Vector2(npc.Center.X, npc.Center.Y); - float num815 = Main.npc[NPC.crimsonBoss].Center.X - vector101.X; - float num816 = Main.npc[NPC.crimsonBoss].Center.Y - vector101.Y; - float num817 = (float)Math.Sqrt((double)(num815 * num815 + num816 * num816)); - - // Return to Brain - if (num817 > 700f || (npc.justHit && !phase2)) - npc.ai[0] = 0f; - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Queen Bee AI - public static bool BuffedQueenBeeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Increase bee spawn rate during bee spawning phase based on number of players near the boss - int playerNearBoss = 0; - int num; - for (int num593 = 0; num593 < 255; num593 = num + 1) - { - if (Main.player[num593].active && !Main.player[num593].dead && (npc.Center - Main.player[num593].Center).Length() < 1000f) - playerNearBoss++; - - num = num593; - } - - bool enrage = false; - if (CalamityWorld.bossRushActive || !Main.player[npc.target].ZoneJungle || (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) - enrage = true; - - // Boost defense and damage as health decreases - int statBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + statBoost; - npc.damage = npc.defDamage + statBoost; - - // Get a target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); - - // Despawn - if (Main.player[npc.target].dead) - { - if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) - npc.velocity.Y += 0.04f; - if (npc.position.X < (float)(Main.maxTilesX * 8)) - npc.velocity.X -= 0.04f; - else - npc.velocity.X += 0.04f; - - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return false; - } - } - - // Pick a random phase - else if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num595 = npc.ai[1]; - int phase; - do - { - if (enrage) - { - phase = Main.rand.Next(2); - if (phase == 1) - phase = 3; - } - else - { - phase = Main.rand.Next(3); - if (phase == 1) - phase = 2; - else if (phase == 2) - phase = 3; - } - } - while ((float)phase == num595); - npc.ai[0] = (float)phase; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - - // Charging phase - else if (npc.ai[0] == 0f) - { - // Number of charges - int chargeAmt = 2; - if (npc.life < npc.lifeMax / 3) - chargeAmt++; - - // Switch to a random phase if chargeAmt has been exceeded - if (npc.ai[1] > (float)(2 * chargeAmt) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - if (npc.ai[1] % 2f == 0f) - { - // Get target and charge - npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) - { - // Set AI variables and speed - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float speed = 16f; - if (CalamityWorld.bossRushActive) - speed += 12f; - else if (CalamityWorld.death) - speed += 6f; - else - { - if ((double)npc.life < (double)npc.lifeMax * 0.75) - speed += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - speed += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - speed += 2f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - speed += 2f; - - // Get target location - Vector2 vector74 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num599 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector74.X; - float num600 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector74.Y; - float num601 = (float)Math.Sqrt((double)(num599 * num599 + num600 * num600)); - num601 = speed / num601; - npc.velocity.X = num599 * num601; - npc.velocity.Y = num600 * num601; - - // Face the correct direction and play charge sound - npc.spriteDirection = npc.direction; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - return false; - } - - // Velocity variables - npc.localAI[0] = 0f; - float num602 = 12f; - float num603 = 0.15f; - if (CalamityWorld.bossRushActive) - { - num602 *= 1.5f; - num603 *= 1.5f; - } - else if (CalamityWorld.death) - { - num602 += 4f; - num603 += 0.15f; - } - else - { - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num602 += 1f; - num603 += 0.05f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num602 += 1f; - num603 += 0.05f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num602 += 2f; - num603 += 0.05f; - } - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num602 += 2f; - num603 += 0.1f; - } - - // Velocity calculations - if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) - npc.velocity.Y += num603; - else - npc.velocity.Y -= num603; - - if (npc.velocity.Y < -12f) - npc.velocity.Y = -num602; - if (npc.velocity.Y > 12f) - npc.velocity.Y = num602; - - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - npc.velocity.X += 0.15f * (float)npc.direction; - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X -= 0.15f * (float)npc.direction; - else - npc.velocity.X *= 0.8f; - - // Limit velocity - if (npc.velocity.X < -16f) - npc.velocity.X = -16f; - if (npc.velocity.X > 16f) - npc.velocity.X = 16f; - - // Face the correct direction - npc.spriteDirection = npc.direction; - } - else - { - // Face the correct direction - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - npc.spriteDirection = npc.direction; - - // Charging distance from player - int num604 = 500; - if (enrage) - num604 = 250; - else if ((double)npc.life < (double)npc.lifeMax * 0.33) - num604 = 300; - else if ((double)npc.life < (double)npc.lifeMax * 0.66) - num604 = 450; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num604 -= 25; - - // Get which side of the player the boss is on - int num605 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - num605 = -1; - - // If boss is in correct position, slow down, if not, reset - if (npc.direction == num605 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num604) - npc.ai[2] = 1f; - if (npc.ai[2] != 1f) - { - npc.localAI[0] = 1f; - return false; - } - - // Get target, face correct direction, and slow down - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - npc.velocity *= 0.9f; - float num606 = 0.1f; - if (npc.life < npc.lifeMax / 2 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num606 += 0.05f; - } - if (npc.life < npc.lifeMax / 3 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num606 += 0.05f; - } - if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num606 += 0.05f; - } - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num606) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - - // Fly above target before bee spawning phase - else if (npc.ai[0] == 2f) - { - // Get target and face the correct direction - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - - // Get target location - float num608 = 0.1f; - Vector2 vector75 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num609 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector75.X; - float num610 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector75.Y; - float num611 = (float)Math.Sqrt((double)(num609 * num609 + num610 * num610)); - - // Go to bee spawn phase - if (num611 < (CalamityWorld.death ? 400f : 300f)) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return false; - } - - // Velocity calculations - if (npc.velocity.X < num609) - { - npc.velocity.X += num608; - if (npc.velocity.X < 0f && num609 > 0f) - npc.velocity.X += num608; - } - else if (npc.velocity.X > num609) - { - npc.velocity.X -= num608; - if (npc.velocity.X > 0f && num609 < 0f) - npc.velocity.X -= num608; - } - if (npc.velocity.Y < num610) - { - npc.velocity.Y += num608; - if (npc.velocity.Y < 0f && num610 > 0f) - npc.velocity.Y += num608; - } - else if (npc.velocity.Y > num610) - { - npc.velocity.Y -= num608; - if (npc.velocity.Y > 0f && num610 < 0f) - npc.velocity.Y -= num608; - } - } - - // Bee spawn phase - else if (npc.ai[0] == 1f) - { - // Reset localAI and get target - npc.localAI[0] = 0f; - npc.TargetClosest(true); - - // Get target location and spawn bees from ass - Vector2 vector76 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector77 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; - float num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; - float num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); - - // Bee spawn timer - npc.ai[1] += 1f; - npc.ai[1] += (float)(playerNearBoss / 2); - if ((double)npc.life < (double)npc.lifeMax * 0.75) - npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - npc.ai[1] += 0.25f; - - bool spawnBee = false; - if (npc.ai[1] > 15f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - spawnBee = true; - } - - // Spawn bees or hornets - if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int hornetAmt = CalamityMod.hornetList.Count; - int spawnType = Main.rand.Next(210, 212); - if (npc.life < (double)npc.lifeMax * 0.66 || CalamityWorld.death) - spawnType = 210; - - int random = CalamityWorld.death ? 5 : 6; - if (Main.rand.Next(random) == 0) - spawnType = CalamityMod.hornetList[Main.rand.Next(hornetAmt)]; - - int spawn = NPC.NewNPC((int)vector76.X, (int)vector76.Y, spawnType, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[spawn].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; - Main.npc[spawn].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; - - if (!CalamityMod.hornetList.Contains(spawnType)) - Main.npc[spawn].localAI[0] = 60f; - - Main.npc[spawn].netUpdate = true; - } - } - - // Velocity calculations if target is too far away - if (num614 > 400f || !Collision.CanHit(new Vector2(vector76.X, vector76.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num617 = 14f; - float num618 = 0.1f; - vector77 = vector76; - num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; - num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; - num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); - num614 = num617 / num614; - - if (npc.velocity.X < num612) - { - npc.velocity.X += num618; - if (npc.velocity.X < 0f && num612 > 0f) - npc.velocity.X += num618; - } - else if (npc.velocity.X > num612) - { - npc.velocity.X -= num618; - if (npc.velocity.X > 0f && num612 < 0f) - npc.velocity.X -= num618; - } - if (npc.velocity.Y < num613) - { - npc.velocity.Y += num618; - if (npc.velocity.Y < 0f && num613 > 0f) - npc.velocity.Y += num618; - } - else if (npc.velocity.Y > num613) - { - npc.velocity.Y -= num618; - if (npc.velocity.Y > 0f && num613 < 0f) - npc.velocity.Y -= num618; - } - } - else - npc.velocity *= 0.9f; - - // Face the correct direction - npc.spriteDirection = npc.direction; - - // Go to a random phase - if (npc.ai[2] > 3f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - - // Stinger phase - else if (npc.ai[0] == 3f) - { - // Get target location and shoot from ass - Vector2 vector78 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector79 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; - float num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector79.Y; - float num623 = (float)Math.Sqrt((double)(num621 * num621 + num622 * num622)); - - // Stinger fire counter - npc.ai[1] += 1f; - bool shoot = false; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || enrage) - { - if (npc.ai[1] % 15f == 14f) - shoot = true; - } - else if (npc.life < (double)npc.lifeMax * 0.66 || CalamityWorld.death) - { - if (npc.ai[1] % 25f == 24f) - shoot = true; - } - else if (npc.ai[1] % 30f == 29f) - shoot = true; - - // Fire stingers - if (shoot && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(SoundID.Item17, npc.position); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num624 = CalamityWorld.bossRushActive ? 16f : 12f; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || CalamityWorld.bossRushActive) - num624 += 3f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num624 += 1f; - - float num625 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector78.X; - float num626 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector78.Y; - float num627 = (float)Math.Sqrt((double)(num625 * num625 + num626 * num626)); - num627 = num624 / num627; - num625 *= num627; - num626 *= num627; - - int damage = Main.player[npc.target].buffImmune[BuffID.Poisoned] ? 18 : 14; - int type = ProjectileID.Stinger; - int projectile = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].timeLeft = 300; - } - } - - // Movement calculations - float num620 = CalamityWorld.bossRushActive ? 0.1f : 0.075f; - if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - num620 = CalamityWorld.bossRushActive ? 0.125f : 0.1f; - vector79 = vector78; - num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; - num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector79.Y; - - if (npc.velocity.X < num621) - { - npc.velocity.X += num620; - if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X += num620; - } - else if (npc.velocity.X > num621) - { - npc.velocity.X -= num620; - if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X -= num620; - } - if (npc.velocity.Y < num622) - { - npc.velocity.Y += num620; - if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y += num620; - } - else if (npc.velocity.Y > num622) - { - npc.velocity.Y -= num620; - if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y -= num620; - } - } - else if (num623 > 100f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - if (npc.velocity.X < num621) - { - npc.velocity.X += num620; - if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X += num620 * 2f; - } - else if (npc.velocity.X > num621) - { - npc.velocity.X -= num620; - if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X -= num620 * 2f; - } - if (npc.velocity.Y < num622) - { - npc.velocity.Y += num620; - if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y += num620 * 2f; - } - else if (npc.velocity.Y > num622) - { - npc.velocity.Y -= num620; - if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y -= num620 * 2f; - } - } - - // Go to a random phase - if (npc.ai[1] > (CalamityWorld.bossRushActive ? 240f : 400f)) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Skeletron AI - public static bool BuffedSkeletronAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.33f; - - // Set defense - npc.defense = npc.defDefense; - - // Spawn hands - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - npc.ai[0] = 1f; - - int num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = -1f; - Main.npc[num155].ai[1] = (float)npc.whoAmI; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; - - num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = 1f; - Main.npc[num155].ai[1] = (float)npc.whoAmI; - Main.npc[num155].ai[3] = 150f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; - } - - // Respawn hands - if (phase2 && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) - { - npc.TargetClosest(true); - calamityGlobalNPC.newAI[0] = 1f; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, -0.25f); - - int num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = -1f; - Main.npc[num155].ai[1] = (float)npc.whoAmI; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; - - num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = 1f; - Main.npc[num155].ai[1] = (float)npc.whoAmI; - Main.npc[num155].ai[3] = 150f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; - } - } - - // Distance from target - float distance = Vector2.Distance(Main.player[npc.target].Center, npc.Center); - - // Despawn - if (Main.player[npc.target].dead || distance > (CalamityWorld.bossRushActive ? 6000f : 2000f)) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead || distance > (CalamityWorld.bossRushActive ? 6000f : 2000f)) - npc.ai[1] = 3f; - } - - // Daytime enrage - if (Main.dayTime && !CalamityWorld.bossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - npc.ai[1] = 2f; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - - // Hand immunity - int num156 = 0; - for (int num157 = 0; num157 < 200; num157++) - { - if (Main.npc[num157].active && Main.npc[num157].type == npc.type + 1) - num156++; - } - bool handsDead = num156 == 0; - npc.chaseable = handsDead; - npc.defense += num156 * (CalamityWorld.bossRushActive ? 2500 : 250); - - // Teleport - if (handsDead || phase2) - { - // Post-teleport - if (npc.ai[3] == -60f) - { - npc.ai[3] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 66, 1f, -0.25f); - Main.PlaySound(SoundID.Item66, npc.position); - - Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - - // Fire magic bolt after teleport - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num151 = 2f + (distance * (CalamityWorld.bossRushActive ? 0.015f : 0.005f)); - if (CalamityWorld.bossRushActive) - { - if (num151 > 10f) - num151 = 10f; - } - else if (num151 > 5f) - num151 = 5f; - - int num152 = 19; - int num153 = ProjectileID.Shadowflames; - - Vector2 value19 = Main.player[npc.target].Center - npc.Center; - value19.Normalize(); - value19 *= num151; - int numProj = 2; - float rotation = MathHelper.ToRadians(15); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num153, num152, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 600; - } - } - - // Teleport dust - for (int m = 0; m < 60; m++) - { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[num39].noGravity = true; - Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; - } - } - - // Teleport after a certain time - // If hands are dead: 7 seconds in rev, 5.6 seconds in death - // If hands are not dead: 14 seconds in rev, 9.3 seconds in death - // If hands are dead in phase 2: 4.7 seconds in rev, 4 seconds in death - npc.ai[3] += (((CalamityWorld.death || CalamityWorld.bossRushActive) ? 1.25f : 1f) + ((phase2 && handsDead) ? 0.5f : 0f)) - (handsDead ? 0f : 0.5f); - - // Dust to show teleport - int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 - bool emitDust = false; - - if (ai3 >= 300 && calamityGlobalNPC.newAI[2] == 0f && calamityGlobalNPC.newAI[3] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 34; - int num1454 = 4; - int num1455 = 30; - int num1457 = 0; - - bool flag106 = false; - if (vector251.Length() > 2000f) - flag106 = true; - - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - // New location params - calamityGlobalNPC.newAI[2] = (float)(num1458 * 16 - npc.width / 2); - calamityGlobalNPC.newAI[3] = (float)(num1459 * 16 - npc.height); - break; - } - } - } - } - - if (calamityGlobalNPC.newAI[2] != 0f && calamityGlobalNPC.newAI[3] != 0f) - { - for (int m = 0; m < 10; m++) - { - Vector2 position = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); - int num39 = Dust.NewDust(position, npc.width, npc.height, 27, 0f, 0f, 200, default, 1f); - Main.dust[num39].noGravity = true; - Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; - } - } - - if (ai3 >= 390) - emitDust = true; - else if (ai3 >= 330) - { - if (Main.rand.Next(310, ai3 + 1) >= 325) - emitDust = true; - } - if (emitDust) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 2f; - } - - // Teleport - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= 420f) - { - // Teleport dust - for (int m = 0; m < 60; m++) - { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[num39].noGravity = true; - Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; - } - - // New location - npc.Center = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); - npc.velocity = Vector2.Zero; - npc.ai[3] = -60f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.netUpdate = true; - } - } - else - npc.ai[3] = 0f; - - // Skull shooting - if ((num156 < 2 || lifeRatio < 0.66f) && npc.ai[1] == 0f) - { - float num158 = 120f; - if (handsDead) - num158 /= 2f; - - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % num158 == 0f) - { - Vector2 vector18 = npc.Center; - float num159 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector18.X; - float num160 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector18.Y; - float num161 = (float)Math.Sqrt((double)(num159 * num159 + num160 * num160)); - if (Collision.CanHit(vector18, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num162 = 3f; - if (handsDead) - num162 += 2f; - if (CalamityWorld.bossRushActive) - num162 *= 1.5f; - - float num163 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X + (float)Main.rand.Next(-20, 21); - float num164 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector18.Y + (float)Main.rand.Next(-20, 21); - float num165 = (float)Math.Sqrt((double)(num163 * num163 + num164 * num164)); - num165 = num162 / num165; - num163 *= num165; - num164 *= num165; - Vector2 vector19 = new Vector2(num163 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num164 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); - vector19.Normalize(); - vector19 *= num162; - vector19 += npc.velocity; - num163 = vector19.X; - num164 = vector19.Y; - int num166 = 21; - int num167 = ProjectileID.Skull; - vector18 += vector19 * 5f; - int num168 = Projectile.NewProjectile(vector18.X, vector18.Y, num163, num164, num167, num166, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num168].timeLeft = 300; - } - } - } - - // Float above target - if (npc.ai[1] == 0f) - { - npc.damage = npc.defDamage; - - calamityGlobalNPC.newAI[1] += 1f; - npc.ai[2] += 1f + (3f * (1f - lifeRatio)); - if (npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 510f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - calamityGlobalNPC.newAI[1] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - - npc.rotation = npc.velocity.X / 15f; - - float num169 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.05f : 0.04f; - float num170 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5.5f : 5f; - float num171 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.1f : 0.08f; - float num172 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 11f : 10f; - if (CalamityWorld.bossRushActive) - { - num169 *= 1.5f; - num170 *= 1.2f; - num171 *= 1.5f; - num172 *= 1.2f; - } - - if (npc.position.Y > Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= num169; - if (npc.velocity.Y > num170) - npc.velocity.Y = num170; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += num169; - if (npc.velocity.Y < -num170) - npc.velocity.Y = -num170; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X -= num171; - if (npc.velocity.X > num172) - npc.velocity.X = num172; - } - - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X += num171; - if (npc.velocity.X < -num172) - npc.velocity.X = -num172; - } - } - - // Spin charge - else if (npc.ai[1] == 1f) - { - npc.defense -= 10; - - npc.ai[2] += 1f + (0.5f * (1f - lifeRatio)); - - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] == 2f) - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - - if (npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f)) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - } - - npc.rotation += (float)npc.direction * 0.3f; - Vector2 vector20 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num173 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector20.X; - float num174 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector20.Y; - float num175 = (float)Math.Sqrt((double)(num173 * num173 + num174 * num174)); - - // Increase speed while charging - npc.damage = (int)((double)npc.defDamage * 1.3); - float num176 = (CalamityWorld.bossRushActive ? 12f : 4.5f) + (1f * (1f - lifeRatio)); - if (enraged || configBossRushBoost) - num176 += 3f; - - if (num175 > 150f || CalamityWorld.death || CalamityWorld.bossRushActive) - num176 *= 1.05f; - if (num175 > 200f) - num176 *= 1.1f; - if (num175 > 250f) - num176 *= 1.1f; - if (num175 > 300f) - num176 *= 1.1f; - if (num175 > 350f) - num176 *= 1.15f; - if (num175 > 400f) - num176 *= 1.15f; - if (num175 > 450f) - num176 *= 1.15f; - if (num175 > 500f) - num176 *= 1.2f; - if (num175 > 550f) - num176 *= 1.2f; - if (num175 > 600f) - num176 *= 1.2f; - - num175 = num176 / num175; - npc.velocity.X = num173 * num175; - npc.velocity.Y = num174 * num175; - } - - // Daytime enrage - else if (npc.ai[1] == 2f) - { - npc.damage = 1000; - npc.defense = 9999; - npc.rotation += (float)npc.direction * 0.3f; - Vector2 vector21 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num177 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector21.X; - float num178 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector21.Y; - float num179 = (float)Math.Sqrt((double)(num177 * num177 + num178 * num178)); - num179 = 8f / num179; - npc.velocity.X = num177 * num179; - npc.velocity.Y = num178 * num179; - } - - // Despawn - else if (npc.ai[1] == 3f) - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - npc.velocity.X *= 0.95f; - if (npc.timeLeft > 50) - npc.timeLeft = 50; - } - - // Emit dust - if (npc.ai[1] != 2f && npc.ai[1] != 3f && num156 != 0) - { - int num180 = Dust.NewDust(new Vector2(npc.position.X + (float)(npc.width / 2) - 15f - npc.velocity.X * 5f, npc.position.Y + (float)npc.height - 2f), 30, 10, 5, -npc.velocity.X * 0.2f, 3f, 0, default, 2f); - Main.dust[num180].noGravity = true; - Main.dust[num180].velocity.X = Main.dust[num180].velocity.X * 1.3f; - Main.dust[num180].velocity.X = Main.dust[num180].velocity.X + npc.velocity.X * 0.4f; - Main.dust[num180].velocity.Y = Main.dust[num180].velocity.Y + (2f + npc.velocity.Y); - for (int num181 = 0; num181 < 2; num181++) - { - num180 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, 5, npc.velocity.X, npc.velocity.Y, 0, default, 2f); - Main.dust[num180].noGravity = true; - Main.dust[num180].velocity -= npc.velocity; - Main.dust[num180].velocity.Y = Main.dust[num180].velocity.Y + 5f; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedSkeletronHandAI(NPC npc, bool enraged, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 11) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float maxX = CalamityWorld.bossRushActive ? 10f : 8f; - float maxY = CalamityWorld.bossRushActive ? 7.5f : 6f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); - if (npc.velocity.Y > maxY) - npc.velocity.Y = maxY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); - if (npc.velocity.Y < -maxY) - npc.velocity.Y = -maxY; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > maxX) - npc.velocity.X = maxX; - } - - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -maxX) - npc.velocity.X = -maxX; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 120f) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float maxX = CalamityWorld.bossRushActive ? 10f : 8f; - float maxY = CalamityWorld.bossRushActive ? 4f : 3f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); - if (npc.velocity.Y > maxY) - npc.velocity.Y = maxY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); - if (npc.velocity.Y < -maxY) - npc.velocity.Y = -maxY; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); - if (npc.velocity.X > maxX) - npc.velocity.X = maxX; - } - - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); - if (npc.velocity.X < -maxX) - npc.velocity.X = -maxX; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); - if (npc.velocity.Y > maxY) - npc.velocity.Y = maxY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); - if (npc.velocity.Y < -maxY) - npc.velocity.Y = -maxY; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); - if (npc.velocity.X > maxX) - npc.velocity.X = maxX; - } - - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); - if (npc.velocity.X < -maxX) - npc.velocity.X = -maxX; - } - } - - Vector2 vector22 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num182 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector22.X; - float num183 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector22.Y; - float num184 = (float)Math.Sqrt((double)(num182 * num182 + num183 * num183)); - npc.rotation = (float)Math.Atan2((double)num183, (double)num182) + 1.57f; - return false; - } - if (npc.ai[2] == 1f) - { - Vector2 vector23 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num185 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector23.X; - float num186 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector23.Y; - float num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186)); - npc.rotation = (float)Math.Atan2((double)num186, (double)num185) + 1.57f; - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.1f; - - npc.velocity.Y -= 0.06f; - if (npc.velocity.Y < -15f) - npc.velocity.Y = -15f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - npc.TargetClosest(true); - npc.ai[2] = 2f; - vector23 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num185 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector23.X; - num186 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector23.Y; - num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186)); - - num187 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 25f : 23f) / num187; - if (CalamityWorld.bossRushActive) - num187 *= 1.5f; - - npc.velocity.X = num185 * num187; - npc.velocity.Y = num186 * num187; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - npc.ai[2] = 3f; - } - else if (npc.ai[2] == 4f) - { - Vector2 vector24 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num188 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector24.X; - float num189 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector24.Y; - float num190 = (float)Math.Sqrt((double)(num188 * num188 + num189 * num189)); - npc.rotation = (float)Math.Atan2((double)num189, (double)num188) + 1.57f; - npc.velocity.Y *= 0.95f; - npc.velocity.X += 0.1f * -npc.ai[0]; - - npc.velocity.X += 0.07f * -npc.ai[0]; - if (npc.velocity.X < -14f) - npc.velocity.X = -14f; - else if (npc.velocity.X > 14f) - npc.velocity.X = 14f; - - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) - { - npc.TargetClosest(true); - npc.ai[2] = 5f; - vector24 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num188 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector24.X; - num189 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector24.Y; - num190 = (float)Math.Sqrt((double)(num188 * num188 + num189 * num189)); - - num190 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 26f : 24f) / num190; - if (CalamityWorld.bossRushActive) - num190 *= 1.5f; - - npc.velocity.X = num188 * num190; - npc.velocity.Y = num189 * num190; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)))) - npc.ai[2] = 0f; - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Wall of Flesh AI - public static bool BuffedWallofFleshAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - // Despawn - if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16)) - npc.active = false; - - // Set Wall of Flesh variables - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - Main.wofB = -1; - Main.wofT = -1; - } - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases based on HP - bool phase2 = lifeRatio < 0.66f || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.33f || CalamityWorld.bossRushActive; - - // Start leech spawning based on HP - npc.ai[1] += 1f; - if (npc.ai[2] == 0f) - { - if (phase2) - npc.ai[1] += 1f; - if (phase3) - npc.ai[1] += 1f; - - if (npc.ai[1] > 2700f) - npc.ai[2] = 1f; - } - - // Leech spawn - if (npc.ai[2] > 0f && npc.ai[1] > 60f) - { - int num330 = phase3 ? 3 : 2; - - npc.ai[2] += 1f; - npc.ai[1] = 0f; - if (npc.ai[2] > (float)num330) - npc.ai[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num331 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)(npc.height / 2) + 20f), NPCID.LeechHead, 1, 0f, 0f, 0f, 0f, 255); - Main.npc[num331].velocity.X = (float)(npc.direction * 9); - } - } - - // Play sound - npc.localAI[3] += 1f; - if (npc.localAI[3] >= (float)(600 + Main.rand.Next(1000))) - { - npc.localAI[3] = (float)(-(float)Main.rand.Next(200)); - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 10, 1f, 0f); - } - - // Set whoAmI variable - Main.wof = npc.whoAmI; - - // Set eye positions - int num332 = (int)(npc.position.X / 16f); - int num333 = (int)((npc.position.X + (float)npc.width) / 16f); - int num334 = (int)((npc.position.Y + (float)(npc.height / 2)) / 16f); - int num335 = 0; - int num336 = num334 + 7; - while (num335 < 15 && num336 > Main.maxTilesY - 200) - { - num336++; - int num; - for (int num337 = num332; num337 <= num333; num337 = num + 1) - { - try - { - if (WorldGen.SolidTile(num337, num336) || Main.tile[num337, num336].liquid > 0) - num335++; - } - catch - { num335 += 15; } - - num = num337; - } - } - num336 += 4; - if (Main.wofB == -1) - Main.wofB = num336 * 16; - else if (Main.wofB > num336 * 16) - { - Main.wofB--; - if (Main.wofB < num336 * 16) - Main.wofB = num336 * 16; - } - else if (Main.wofB < num336 * 16) - { - Main.wofB++; - if (Main.wofB > num336 * 16) - Main.wofB = num336 * 16; - } - - num335 = 0; - num336 = num334 - 7; - while (num335 < 15 && num336 < Main.maxTilesY - 10) - { - num336--; - int num; - for (int num338 = num332; num338 <= num333; num338 = num + 1) - { - try - { - if (WorldGen.SolidTile(num338, num336) || Main.tile[num338, num336].liquid > 0) - num335++; - } - catch - { num335 += 15; } - - num = num338; - } - } - num336 -= 4; - if (Main.wofT == -1) - Main.wofT = num336 * 16; - else if (Main.wofT > num336 * 16) - { - Main.wofT--; - if (Main.wofT < num336 * 16) - Main.wofT = num336 * 16; - } - else if (Main.wofT < num336 * 16) - { - Main.wofT++; - if (Main.wofT > num336 * 16) - Main.wofT = num336 * 16; - } - - // Set Y velocity and position - float num339 = (float)((Main.wofB + Main.wofT) / 2 - npc.height / 2); - - if (npc.position.Y > num339 + 1f) - npc.velocity.Y = -1f; - else if (npc.position.Y < num339 - 1f) - npc.velocity.Y = 1f; - npc.velocity.Y = 0f; - - int num340 = (Main.maxTilesY - 180) * 16; - if (num339 < (float)num340) - num339 = (float)num340; - npc.position.Y = num339; - - // Speed up if target is too far or if they're hiding behind tiles, slow down if too close - float distanceFromTarget = 0f; - float targetPosition = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float npcPosition = npc.position.X + (float)(npc.width / 2); - if (npc.velocity.X < 0f) - distanceFromTarget = npcPosition - targetPosition; - else - distanceFromTarget = targetPosition - npcPosition; - - float halfAverageScreenWidth = 960f; - float distanceBeforeSlowingDown = 400f; - float timeBeforeEnrage = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 420f : 600f; - float speedMult = 1f; - - if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage) - { - if (distanceFromTarget > halfAverageScreenWidth || - !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - speedMult += (distanceFromTarget - halfAverageScreenWidth) * 0.001f; - calamityGlobalNPC.newAI[0] += 1f; - - // Enrage after 10 seconds of target being off screen - if (calamityGlobalNPC.newAI[0] >= timeBeforeEnrage) - { - calamityGlobalNPC.newAI[1] = 1f; - - // Tell eyes to stop firing lasers - npc.ai[3] = 1f; - - // Play roar sound on players nearby - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) - Main.PlaySound(4, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 10, 1f, -0.25f); - } - } - else if (distanceFromTarget < distanceBeforeSlowingDown) - speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; - - if (distanceFromTarget < halfAverageScreenWidth && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - if (calamityGlobalNPC.newAI[0] > 0f) - calamityGlobalNPC.newAI[0] -= 1f; - } - - if (speedMult > 2f) - speedMult = 2f; - if (speedMult < 0.75f) - speedMult = 0.75f; - } - - // Enrage if target is off screen for too long - if (calamityGlobalNPC.newAI[1] == 1f) - { - // Triple speed - speedMult = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3.5f : 3.25f; - - // Return to normal if very close to target - if (distanceFromTarget < distanceBeforeSlowingDown) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.ai[3] = 0f; - } - } - - if (enraged || configBossRushBoost) - speedMult += 0.7f; - else if (CalamityWorld.death || CalamityWorld.bossRushActive) - speedMult += 0.18f; - - // NOTE: Max velocity is 8 in expert mode - float velocityX = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 2.2f : 2f) + (4f * (1f - lifeRatio)); - velocityX *= speedMult; - if (CalamityWorld.bossRushActive) - velocityX *= 1.5f; - // NOTE: Values below are based on Rev Mode only! - // Max velocity without enrage is 12 - // Min velocity is 1.5 - // Max velocity with enrage is 18 - - // Set X velocity - if (npc.velocity.X == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = (float)npc.direction; - } - if (npc.velocity.X < 0f) - { - npc.velocity.X = -velocityX; - npc.direction = -1; - } - else - { - npc.velocity.X = velocityX; - npc.direction = 1; - } - - // Direction - npc.spriteDirection = npc.direction; - Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num342 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector37.X; - float num343 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector37.Y; - float num344 = (float)Math.Sqrt((double)(num342 * num342 + num343 * num343)); - num342 *= num344; - num343 *= num344; - - // Rotation based on direction - if (npc.direction > 0) - { - if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2)) - npc.rotation = (float)Math.Atan2((double)(-(double)num343), (double)(-(double)num342)) + 3.14f; - else - npc.rotation = 0f; - } - else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2)) - npc.rotation = (float)Math.Atan2((double)num343, (double)num342) + 3.14f; - else - npc.rotation = 0f; - - // Expert hungry respawn over time - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Range of 1 to 11 - int chance = (int)(1f + lifeRatio * 10f); - - // Range of 1 to 121 - chance *= chance; - - // Range of 20 to 134 - chance = (chance * 19 + 400) / 20; - - // Range of 30 to 59 - if (chance < 60) - chance = (chance * 3 + 60) / 4; - - // Range of 60 to 268 - chance = (int)((double)chance * 2D); - - if (Main.rand.Next(chance) == 0) - { - int num346 = 0; - float[] array = new float[10]; - int num; - for (int num347 = 0; num347 < 200; num347 = num + 1) - { - if (num346 < 10 && Main.npc[num347].active && Main.npc[num347].type == NPCID.TheHungry) - { - array[num346] = Main.npc[num347].ai[0]; - num346++; - } - num = num347; - } - - int maxValue = 1 + num346 * 2; - if (num346 < 10 && Main.rand.Next(maxValue) <= 1) - { - int num348 = -1; - for (int num349 = 0; num349 < 1000; num349 = num + 1) - { - int num350 = Main.rand.Next(10); - float num351 = (float)num350 * 0.1f - 0.05f; - bool flag29 = true; - for (int num352 = 0; num352 < num346; num352 = num + 1) - { - if (num351 == array[num352]) - { - flag29 = false; - break; - } - num = num352; - } - if (flag29) - { - num348 = num350; - break; - } - num = num349; - } - if (num348 >= 0) - { - int num353 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num353].ai[0] = (float)num348 * 0.1f - 0.05f; - } - } - } - } - - // Spawn eyes and hungries - if (npc.localAI[0] == 1f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 2f; - - num339 = (float)((Main.wofB + Main.wofT) / 2); - num339 = (num339 + (float)Main.wofT) / 2f; - int num354 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num354].ai[0] = 1f; - - num339 = (float)((Main.wofB + Main.wofT) / 2); - num339 = (num339 + (float)Main.wofB) / 2f; - num354 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num354].ai[0] = -1f; - - num339 = (float)((Main.wofB + Main.wofT) / 2); - num339 = (num339 + (float)Main.wofB) / 2f; - - int num; - for (int num355 = 0; num355 < 11; num355 = num + 1) - { - num354 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num354].ai[0] = (float)num355 * 0.1f - 0.05f; - num = num355; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedWallofFleshEyeAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - // Despawn - if (Main.wof < 0) - { - npc.active = false; - return false; - } - - // Stupid worm variable but for wall of flesh npc time - npc.realLife = Main.wof; - - // Life and target - if (Main.npc[Main.wof].life > 0) - npc.life = Main.npc[Main.wof].life; - npc.TargetClosest(true); - - // Velocity, direction, and position - npc.position.X = Main.npc[Main.wof].position.X; - npc.direction = Main.npc[Main.wof].direction; - npc.spriteDirection = npc.direction; - - float num356 = (float)((Main.wofB + Main.wofT) / 2); - if (npc.ai[0] > 0f) - num356 = (num356 + (float)Main.wofT) / 2f; - else - num356 = (num356 + (float)Main.wofB) / 2f; - num356 -= (float)(npc.height / 2); - - if (npc.position.Y > num356 + 1f) - npc.velocity.Y = -1f; - else if (npc.position.Y < num356 - 1f) - npc.velocity.Y = 1f; - else - { - npc.velocity.Y = 0f; - npc.position.Y = num356; - } - - if (npc.velocity.Y > 5f) - npc.velocity.Y = 5f; - if (npc.velocity.Y < -5f) - npc.velocity.Y = -5f; - - Vector2 vector38 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num357 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector38.X; - float num358 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector38.Y; - float num359 = (float)Math.Sqrt((double)(num357 * num357 + num358 * num358)); - num357 *= num359; - num358 *= num359; - - // Rotation based on direction and whether to fire lasers or not - bool flag30 = true; - if (npc.direction > 0) - { - if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2)) - npc.rotation = (float)Math.Atan2((double)(-(double)num358), (double)(-(double)num357)) + 3.14f; - else - { - npc.rotation = 0f; - flag30 = false; - } - } - else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2)) - npc.rotation = (float)Math.Atan2((double)num358, (double)num357) + 3.14f; - else - { - npc.rotation = 0f; - flag30 = false; - } - - // Fire lasers - if (Main.netMode != NetmodeID.MultiplayerClient && Main.npc[Main.wof].ai[3] == 0f) - { - // Percent life remaining - float lifeRatio = (float)Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax; - - npc.localAI[1] += 1f + (4f * (1f - lifeRatio)); - - if (npc.localAI[2] == 0f) - { - if (npc.localAI[1] > 400f) - { - npc.localAI[2] = 1f; - npc.localAI[1] = 0f; - } - } - else if (npc.localAI[1] > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 39f : 45f) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] = 0f; - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 4f) - npc.localAI[2] = 0f; - - if (flag30) - { - bool phase2 = lifeRatio < 0.5 || CalamityWorld.bossRushActive; - float velocity = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 10f : 9f) + (4f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - velocity *= 1.5f; - - int damage = (phase2 ? 22 : 17); - int projectileType = (phase2 ? ProjectileID.DeathLaser : ProjectileID.EyeLaser); - - vector38 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num357 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector38.X; - num358 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector38.Y; - num359 = (float)Math.Sqrt((double)(num357 * num357 + num358 * num358)); - num359 = velocity / num359; - num357 *= num359; - num358 *= num359; - vector38.X += num357; - vector38.Y += num358; - Projectile.NewProjectile(vector38.X, vector38.Y, num357, num358, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Destroyer AI - public static bool BuffedDestroyerAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - // 8 seconds of reistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 480f) - calamityGlobalNPC.newAI[1] += 1f; - - // Enrage variable if player is flying upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases based on life percentage - bool phase2 = lifeRatio < 0.66f; - bool phase3 = lifeRatio < 0.33f; - - // Set worm variable for worms - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - - // Get a target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); - - // Velocity - npc.velocity.Length(); - - // Dust on spawn and alpha effects - if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) - { - if (npc.alpha != 0) - { - for (int i = 0; i < 2; i++) - { - int num = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num].noGravity = true; - Main.dust[num].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - // Check if other segments are still alive, if not, die - if (npc.type > NPCID.TheDestroyer) - { - bool flag = false; - if (npc.ai[1] <= 0f) - flag = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - flag = true; - - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - } - - if (npc.type == NPCID.TheDestroyerBody) - { - // Gain more defense as health lowers with a max of 30, lose defense if probe has been launched - if (npc.ai[2] == 0f) - { - int defenseUp = (int)(30f * (1f - lifeRatio)); - npc.defense = npc.defDefense + defenseUp; - } - else - npc.defense = npc.defDefense - 10; - - // Enrage, fire more homing lasers - if (targetFloatingUp) - { - if (calamityGlobalNPC.newAI[2] < 480f) - calamityGlobalNPC.newAI[2] += 1f; - } - else - { - if (calamityGlobalNPC.newAI[2] > 0f) - calamityGlobalNPC.newAI[2] -= 1f; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Spawn segments from head - if (npc.ai[0] == 0f && npc.type == NPCID.TheDestroyer) - { - npc.ai[3] = (float)npc.whoAmI; - npc.realLife = npc.whoAmI; - int num2 = npc.whoAmI; - - int num3 = 80; - for (int j = 0; j <= num3; j++) - { - int num4 = NPCID.TheDestroyerBody; - if (j == num3) - num4 = NPCID.TheDestroyerTail; - - int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num5].ai[3] = (float)npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; - Main.npc[num5].ai[1] = (float)num2; - Main.npc[num2].ai[0] = (float)num5; - NetMessage.SendData(23, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); - num2 = num5; - } - } - - // Fire lasers - if (npc.type == NPCID.TheDestroyerBody) - { - // Laser rate of fire - int shootTime = 1 + (int)Math.Ceiling((((enraged || configBossRushBoost) ? 7D : 3D) * (double)lifeRatio)); - if (CalamityWorld.bossRushActive) - shootTime += 1; - - calamityGlobalNPC.newAI[0] += (float)Main.rand.Next(shootTime); - int randomCount = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? Main.rand.Next(1260, 23400) : Main.rand.Next(1330, 24700)); - - if (calamityGlobalNPC.newAI[0] >= (float)randomCount) - { - calamityGlobalNPC.newAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - // Base laser speed on player movement speed - float laserSpeedBoost = Math.Abs(Main.player[npc.target].velocity.X); - if (Math.Abs(Main.player[npc.target].velocity.X) < Math.Abs(Main.player[npc.target].velocity.Y)) - laserSpeedBoost = Math.Abs(Main.player[npc.target].velocity.Y); - - // Put limits on laser speed - float projectileSpeed = 2f + laserSpeedBoost; - if (projectileSpeed < 7f) - projectileSpeed = 7f; - if (projectileSpeed > 10f) - projectileSpeed = 10f; - - // Increase laser speed as health drops - if (phase2 || CalamityWorld.bossRushActive) - projectileSpeed += (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.25f; - if (phase3 || CalamityWorld.bossRushActive) - projectileSpeed += (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.25f; - if (CalamityWorld.bossRushActive) - projectileSpeed *= 1.25f; - - // Set projectile damage and type, set projectile to saucer scrap if probe has been launched - int damage = 23; - int projectileType = ProjectileID.DeathLaser; + else + num811 -= Main.rand.Next(min, max); + + if (!WorldGen.SolidTile(num810, num811) && Collision.CanHit(new Vector2((float)(num810 * 16), (float)(num811 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + break; + } + if (num809 > 100) + { + goto Block_2801; + } + } + npc.ai[0] = 1f; + npc.ai[1] = (float)num810; + npc.ai[2] = (float)num811; + npc.netUpdate = true; + Block_2801: + ; + } + } + } + + // Turn invisible and teleport + else if (npc.ai[0] == 1f) + { + npc.alpha += 25; + if (npc.alpha >= 255) + { + Main.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + } + } + + // Become visible + else if (npc.ai[0] == 2f) + { + npc.alpha -= 25; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[0] = 0f; + } + } + } + + // Despawn + if ((Main.player[npc.target].dead || (!Main.player[npc.target].ZoneCrimson && !Main.player[npc.target].ZoneCorrupt)) && !CalamityWorld.bossRushActive) + { + if (npc.localAI[3] < 120f) + npc.localAI[3] += 1f; + + if (npc.localAI[3] > 60f) + npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; + + npc.ai[0] = 2f; + npc.alpha = 10; + return false; + } + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedCreeperAI(NPC npc, bool enraged, Mod mod) + { + // Despawn if Brain is gone + if (NPC.crimsonBoss < 0) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + + // Creeper count, 0 to 20 + int creeperCount = NPC.CountNPCS(NPCID.Creeper); + bool phase2 = creeperCount <= 5; + + // Adjust knockback + if (phase2) + npc.knockBackResist = 0f; + + // Stay near Brain + if (npc.ai[0] == 0f) + { + Vector2 vector100 = new Vector2(npc.Center.X, npc.Center.Y); + float num812 = Main.npc[NPC.crimsonBoss].Center.X - vector100.X; + float num813 = Main.npc[NPC.crimsonBoss].Center.Y - vector100.Y; + float num814 = (float)Math.Sqrt((double)(num812 * num812 + num813 * num813)); + float velocity = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 10f : 9f; + if (CalamityWorld.bossRushActive) + velocity *= 2f; + + // Max distance from Brain + if (num814 > 90f) + { + num814 = velocity / num814; + num812 *= num814; + num813 *= num814; + npc.velocity.X = (npc.velocity.X * 15f + num812) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num813) / 16f; + return false; + } + + // Increase speed + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < velocity) + { + npc.velocity.Y *= 1.05f; + npc.velocity.X *= 1.05f; + } + + // Charge at target + int creeperScale = 21 - creeperCount; // 1 to 20 + npc.ai[1] += 0.5f + ((float)creeperScale * 0.25f); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240f) + { + npc.ai[1] = 0f; + npc.TargetClosest(true); + vector100 = new Vector2(npc.Center.X, npc.Center.Y); + num812 = Main.player[npc.target].Center.X - vector100.X; + num813 = Main.player[npc.target].Center.Y - vector100.Y; + num814 = (float)Math.Sqrt((double)(num812 * num812 + num813 * num813)); + num814 = velocity / num814; + npc.velocity.X = num812 * num814; + npc.velocity.Y = num813 * num814; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + } + + // Charge + else + { + Vector2 value2 = Main.player[npc.target].Center - npc.Center; + value2.Normalize(); + value2 *= 9f; + npc.velocity = (npc.velocity * 99f + value2) / 100f; + + Vector2 vector101 = new Vector2(npc.Center.X, npc.Center.Y); + float num815 = Main.npc[NPC.crimsonBoss].Center.X - vector101.X; + float num816 = Main.npc[NPC.crimsonBoss].Center.Y - vector101.Y; + float num817 = (float)Math.Sqrt((double)(num815 * num815 + num816 * num816)); + + // Return to Brain + if (num817 > 700f || (npc.justHit && !phase2)) + npc.ai[0] = 0f; + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Queen Bee AI + public static bool BuffedQueenBeeAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Increase bee spawn rate during bee spawning phase based on number of players near the boss + int playerNearBoss = 0; + int num; + for (int num593 = 0; num593 < 255; num593 = num + 1) + { + if (Main.player[num593].active && !Main.player[num593].dead && (npc.Center - Main.player[num593].Center).Length() < 1000f) + playerNearBoss++; + + num = num593; + } + + bool enrage = false; + if (CalamityWorld.bossRushActive || !Main.player[npc.target].ZoneJungle || (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) + enrage = true; + + // Boost defense and damage as health decreases + int statBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense + statBoost; + npc.damage = npc.defDamage + statBoost; + + // Get a target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); + + // Despawn + if (Main.player[npc.target].dead) + { + if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) + npc.velocity.Y += 0.04f; + if (npc.position.X < (float)(Main.maxTilesX * 8)) + npc.velocity.X -= 0.04f; + else + npc.velocity.X += 0.04f; + + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return false; + } + } + + // Pick a random phase + else if (npc.ai[0] == -1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num595 = npc.ai[1]; + int phase; + do + { + if (enrage) + { + phase = Main.rand.Next(2); + if (phase == 1) + phase = 3; + } + else + { + phase = Main.rand.Next(3); + if (phase == 1) + phase = 2; + else if (phase == 2) + phase = 3; + } + } + while ((float)phase == num595); + npc.ai[0] = (float)phase; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + + // Charging phase + else if (npc.ai[0] == 0f) + { + // Number of charges + int chargeAmt = 2; + if (npc.life < npc.lifeMax / 3) + chargeAmt++; + + // Switch to a random phase if chargeAmt has been exceeded + if (npc.ai[1] > (float)(2 * chargeAmt) && npc.ai[1] % 2f == 0f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + if (npc.ai[1] % 2f == 0f) + { + // Get target and charge + npc.TargetClosest(true); + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) + { + // Set AI variables and speed + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float speed = 16f; + if (CalamityWorld.bossRushActive) + speed += 12f; + else if (CalamityWorld.death) + speed += 6f; + else + { + if ((double)npc.life < (double)npc.lifeMax * 0.75) + speed += 2f; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + speed += 2f; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + speed += 2f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + speed += 2f; + + // Get target location + Vector2 vector74 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num599 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector74.X; + float num600 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector74.Y; + float num601 = (float)Math.Sqrt((double)(num599 * num599 + num600 * num600)); + num601 = speed / num601; + npc.velocity.X = num599 * num601; + npc.velocity.Y = num600 * num601; + + // Face the correct direction and play charge sound + npc.spriteDirection = npc.direction; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + return false; + } + + // Velocity variables + npc.localAI[0] = 0f; + float num602 = 12f; + float num603 = 0.15f; + if (CalamityWorld.bossRushActive) + { + num602 *= 1.5f; + num603 *= 1.5f; + } + else if (CalamityWorld.death) + { + num602 += 4f; + num603 += 0.15f; + } + else + { + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num602 += 1f; + num603 += 0.05f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num602 += 1f; + num603 += 0.05f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num602 += 2f; + num603 += 0.05f; + } + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num602 += 2f; + num603 += 0.1f; + } + + // Velocity calculations + if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) + npc.velocity.Y += num603; + else + npc.velocity.Y -= num603; + + if (npc.velocity.Y < -12f) + npc.velocity.Y = -num602; + if (npc.velocity.Y > 12f) + npc.velocity.Y = num602; + + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + npc.velocity.X += 0.15f * (float)npc.direction; + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + npc.velocity.X -= 0.15f * (float)npc.direction; + else + npc.velocity.X *= 0.8f; + + // Limit velocity + if (npc.velocity.X < -16f) + npc.velocity.X = -16f; + if (npc.velocity.X > 16f) + npc.velocity.X = 16f; + + // Face the correct direction + npc.spriteDirection = npc.direction; + } + else + { + // Face the correct direction + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + npc.spriteDirection = npc.direction; + + // Charging distance from player + int num604 = 500; + if (enrage) + num604 = 250; + else if ((double)npc.life < (double)npc.lifeMax * 0.33) + num604 = 300; + else if ((double)npc.life < (double)npc.lifeMax * 0.66) + num604 = 450; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + num604 -= 25; + + // Get which side of the player the boss is on + int num605 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + num605 = -1; + + // If boss is in correct position, slow down, if not, reset + if (npc.direction == num605 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num604) + npc.ai[2] = 1f; + if (npc.ai[2] != 1f) + { + npc.localAI[0] = 1f; + return false; + } + + // Get target, face correct direction, and slow down + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + npc.velocity *= 0.9f; + float num606 = 0.1f; + if (npc.life < npc.lifeMax / 2 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num606 += 0.05f; + } + if (npc.life < npc.lifeMax / 3 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num606 += 0.05f; + } + if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num606 += 0.05f; + } + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num606) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + + // Fly above target before bee spawning phase + else if (npc.ai[0] == 2f) + { + // Get target and face the correct direction + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + + // Get target location + float num608 = 0.1f; + Vector2 vector75 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num609 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector75.X; + float num610 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector75.Y; + float num611 = (float)Math.Sqrt((double)(num609 * num609 + num610 * num610)); + + // Go to bee spawn phase + if (num611 < (CalamityWorld.death ? 400f : 300f)) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return false; + } + + // Velocity calculations + if (npc.velocity.X < num609) + { + npc.velocity.X += num608; + if (npc.velocity.X < 0f && num609 > 0f) + npc.velocity.X += num608; + } + else if (npc.velocity.X > num609) + { + npc.velocity.X -= num608; + if (npc.velocity.X > 0f && num609 < 0f) + npc.velocity.X -= num608; + } + if (npc.velocity.Y < num610) + { + npc.velocity.Y += num608; + if (npc.velocity.Y < 0f && num610 > 0f) + npc.velocity.Y += num608; + } + else if (npc.velocity.Y > num610) + { + npc.velocity.Y -= num608; + if (npc.velocity.Y > 0f && num610 < 0f) + npc.velocity.Y -= num608; + } + } + + // Bee spawn phase + else if (npc.ai[0] == 1f) + { + // Reset localAI and get target + npc.localAI[0] = 0f; + npc.TargetClosest(true); + + // Get target location and spawn bees from ass + Vector2 vector76 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector77 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; + float num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; + float num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); + + // Bee spawn timer + npc.ai[1] += 1f; + npc.ai[1] += (float)(playerNearBoss / 2); + if ((double)npc.life < (double)npc.lifeMax * 0.75) + npc.ai[1] += 0.25f; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + npc.ai[1] += 0.25f; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + npc.ai[1] += 0.25f; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + npc.ai[1] += 0.25f; + + bool spawnBee = false; + if (npc.ai[1] > 15f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + spawnBee = true; + } + + // Spawn bees or hornets + if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int hornetAmt = CalamityMod.hornetList.Count; + int spawnType = Main.rand.Next(210, 212); + if (npc.life < (double)npc.lifeMax * 0.66 || CalamityWorld.death) + spawnType = 210; + + int random = CalamityWorld.death ? 5 : 6; + if (Main.rand.Next(random) == 0) + spawnType = CalamityMod.hornetList[Main.rand.Next(hornetAmt)]; + + int spawn = NPC.NewNPC((int)vector76.X, (int)vector76.Y, spawnType, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[spawn].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; + Main.npc[spawn].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; + + if (!CalamityMod.hornetList.Contains(spawnType)) + Main.npc[spawn].localAI[0] = 60f; + + Main.npc[spawn].netUpdate = true; + } + } + + // Velocity calculations if target is too far away + if (num614 > 400f || !Collision.CanHit(new Vector2(vector76.X, vector76.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num617 = 14f; + float num618 = 0.1f; + vector77 = vector76; + num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; + num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; + num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); + num614 = num617 / num614; + + if (npc.velocity.X < num612) + { + npc.velocity.X += num618; + if (npc.velocity.X < 0f && num612 > 0f) + npc.velocity.X += num618; + } + else if (npc.velocity.X > num612) + { + npc.velocity.X -= num618; + if (npc.velocity.X > 0f && num612 < 0f) + npc.velocity.X -= num618; + } + if (npc.velocity.Y < num613) + { + npc.velocity.Y += num618; + if (npc.velocity.Y < 0f && num613 > 0f) + npc.velocity.Y += num618; + } + else if (npc.velocity.Y > num613) + { + npc.velocity.Y -= num618; + if (npc.velocity.Y > 0f && num613 < 0f) + npc.velocity.Y -= num618; + } + } + else + npc.velocity *= 0.9f; + + // Face the correct direction + npc.spriteDirection = npc.direction; + + // Go to a random phase + if (npc.ai[2] > 3f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + + // Stinger phase + else if (npc.ai[0] == 3f) + { + // Get target location and shoot from ass + Vector2 vector78 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector79 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; + float num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector79.Y; + float num623 = (float)Math.Sqrt((double)(num621 * num621 + num622 * num622)); + + // Stinger fire counter + npc.ai[1] += 1f; + bool shoot = false; + if ((double)npc.life < (double)npc.lifeMax * 0.33 || enrage) + { + if (npc.ai[1] % 15f == 14f) + shoot = true; + } + else if (npc.life < (double)npc.lifeMax * 0.66 || CalamityWorld.death) + { + if (npc.ai[1] % 25f == 24f) + shoot = true; + } + else if (npc.ai[1] % 30f == 29f) + shoot = true; + + // Fire stingers + if (shoot && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(SoundID.Item17, npc.position); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num624 = CalamityWorld.bossRushActive ? 16f : 12f; + if ((double)npc.life < (double)npc.lifeMax * 0.33 || CalamityWorld.bossRushActive) + num624 += 3f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + num624 += 1f; + + float num625 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector78.X; + float num626 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector78.Y; + float num627 = (float)Math.Sqrt((double)(num625 * num625 + num626 * num626)); + num627 = num624 / num627; + num625 *= num627; + num626 *= num627; + + int damage = Main.player[npc.target].buffImmune[BuffID.Poisoned] ? 18 : 14; + int type = ProjectileID.Stinger; + int projectile = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].timeLeft = 300; + } + } + + // Movement calculations + float num620 = CalamityWorld.bossRushActive ? 0.1f : 0.075f; + if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + num620 = CalamityWorld.bossRushActive ? 0.125f : 0.1f; + vector79 = vector78; + num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; + num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector79.Y; + + if (npc.velocity.X < num621) + { + npc.velocity.X += num620; + if (npc.velocity.X < 0f && num621 > 0f) + npc.velocity.X += num620; + } + else if (npc.velocity.X > num621) + { + npc.velocity.X -= num620; + if (npc.velocity.X > 0f && num621 < 0f) + npc.velocity.X -= num620; + } + if (npc.velocity.Y < num622) + { + npc.velocity.Y += num620; + if (npc.velocity.Y < 0f && num622 > 0f) + npc.velocity.Y += num620; + } + else if (npc.velocity.Y > num622) + { + npc.velocity.Y -= num620; + if (npc.velocity.Y > 0f && num622 < 0f) + npc.velocity.Y -= num620; + } + } + else if (num623 > 100f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + if (npc.velocity.X < num621) + { + npc.velocity.X += num620; + if (npc.velocity.X < 0f && num621 > 0f) + npc.velocity.X += num620 * 2f; + } + else if (npc.velocity.X > num621) + { + npc.velocity.X -= num620; + if (npc.velocity.X > 0f && num621 < 0f) + npc.velocity.X -= num620 * 2f; + } + if (npc.velocity.Y < num622) + { + npc.velocity.Y += num620; + if (npc.velocity.Y < 0f && num622 > 0f) + npc.velocity.Y += num620 * 2f; + } + else if (npc.velocity.Y > num622) + { + npc.velocity.Y -= num620; + if (npc.velocity.Y > 0f && num622 < 0f) + npc.velocity.Y -= num620 * 2f; + } + } + + // Go to a random phase + if (npc.ai[1] > (CalamityWorld.bossRushActive ? 240f : 400f)) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Skeletron AI + public static bool BuffedSkeletronAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.33f; + + // Set defense + npc.defense = npc.defDefense; + + // Spawn hands + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + npc.ai[0] = 1f; + + int num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num155].ai[0] = -1f; + Main.npc[num155].ai[1] = (float)npc.whoAmI; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + + num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num155].ai[0] = 1f; + Main.npc[num155].ai[1] = (float)npc.whoAmI; + Main.npc[num155].ai[3] = 150f; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + } + + // Respawn hands + if (phase2 && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + { + npc.TargetClosest(true); + calamityGlobalNPC.newAI[0] = 1f; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, -0.25f); + + int num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num155].ai[0] = -1f; + Main.npc[num155].ai[1] = (float)npc.whoAmI; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + + num155 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num155].ai[0] = 1f; + Main.npc[num155].ai[1] = (float)npc.whoAmI; + Main.npc[num155].ai[3] = 150f; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + } + } + + // Distance from target + float distance = Vector2.Distance(Main.player[npc.target].Center, npc.Center); + + // Despawn + if (Main.player[npc.target].dead || distance > (CalamityWorld.bossRushActive ? 6000f : 2000f)) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead || distance > (CalamityWorld.bossRushActive ? 6000f : 2000f)) + npc.ai[1] = 3f; + } + + // Daytime enrage + if (Main.dayTime && !CalamityWorld.bossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) + { + npc.ai[1] = 2f; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + + // Hand immunity + int num156 = 0; + for (int num157 = 0; num157 < 200; num157++) + { + if (Main.npc[num157].active && Main.npc[num157].type == npc.type + 1) + num156++; + } + bool handsDead = num156 == 0; + npc.chaseable = handsDead; + npc.defense += num156 * (CalamityWorld.bossRushActive ? 2500 : 250); + + // Teleport + if (handsDead || phase2) + { + // Post-teleport + if (npc.ai[3] == -60f) + { + npc.ai[3] = 0f; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 66, 1f, -0.25f); + Main.PlaySound(SoundID.Item66, npc.position); + + Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + + // Fire magic bolt after teleport + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num151 = 2f + (distance * (CalamityWorld.bossRushActive ? 0.015f : 0.005f)); + if (CalamityWorld.bossRushActive) + { + if (num151 > 10f) + num151 = 10f; + } + else if (num151 > 5f) + num151 = 5f; + + int num152 = 19; + int num153 = ProjectileID.Shadowflames; + + Vector2 value19 = Main.player[npc.target].Center - npc.Center; + value19.Normalize(); + value19 *= num151; + int numProj = 2; + float rotation = MathHelper.ToRadians(15); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num153, num152, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 600; + } + } + + // Teleport dust + for (int m = 0; m < 60; m++) + { + int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); + Main.dust[num39].noGravity = true; + Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; + } + } + + // Teleport after a certain time + // If hands are dead: 7 seconds in rev, 5.6 seconds in death + // If hands are not dead: 14 seconds in rev, 9.3 seconds in death + // If hands are dead in phase 2: 4.7 seconds in rev, 4 seconds in death + npc.ai[3] += (((CalamityWorld.death || CalamityWorld.bossRushActive) ? 1.25f : 1f) + ((phase2 && handsDead) ? 0.5f : 0f)) - (handsDead ? 0f : 0.5f); + + // Dust to show teleport + int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 + bool emitDust = false; + + if (ai3 >= 300 && calamityGlobalNPC.newAI[2] == 0f && calamityGlobalNPC.newAI[3] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 34; + int num1454 = 4; + int num1455 = 30; + int num1457 = 0; + + bool flag106 = false; + if (vector251.Length() > 2000f) + flag106 = true; + + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + // New location params + calamityGlobalNPC.newAI[2] = (float)(num1458 * 16 - npc.width / 2); + calamityGlobalNPC.newAI[3] = (float)(num1459 * 16 - npc.height); + break; + } + } + } + } + + if (calamityGlobalNPC.newAI[2] != 0f && calamityGlobalNPC.newAI[3] != 0f) + { + for (int m = 0; m < 10; m++) + { + Vector2 position = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); + int num39 = Dust.NewDust(position, npc.width, npc.height, 27, 0f, 0f, 200, default, 1f); + Main.dust[num39].noGravity = true; + Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; + } + } + + if (ai3 >= 390) + emitDust = true; + else if (ai3 >= 330) + { + if (Main.rand.Next(310, ai3 + 1) >= 325) + emitDust = true; + } + if (emitDust) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 2f; + } + + // Teleport + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= 420f) + { + // Teleport dust + for (int m = 0; m < 60; m++) + { + int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); + Main.dust[num39].noGravity = true; + Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; + } + + // New location + npc.Center = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); + npc.velocity = Vector2.Zero; + npc.ai[3] = -60f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.netUpdate = true; + } + } + else + npc.ai[3] = 0f; + + // Skull shooting + if ((num156 < 2 || lifeRatio < 0.66f) && npc.ai[1] == 0f) + { + float num158 = 120f; + if (handsDead) + num158 /= 2f; + + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % num158 == 0f) + { + Vector2 vector18 = npc.Center; + float num159 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector18.X; + float num160 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector18.Y; + float num161 = (float)Math.Sqrt((double)(num159 * num159 + num160 * num160)); + if (Collision.CanHit(vector18, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num162 = 3f; + if (handsDead) + num162 += 2f; + if (CalamityWorld.bossRushActive) + num162 *= 1.5f; + + float num163 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X + (float)Main.rand.Next(-20, 21); + float num164 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector18.Y + (float)Main.rand.Next(-20, 21); + float num165 = (float)Math.Sqrt((double)(num163 * num163 + num164 * num164)); + num165 = num162 / num165; + num163 *= num165; + num164 *= num165; + Vector2 vector19 = new Vector2(num163 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num164 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); + vector19.Normalize(); + vector19 *= num162; + vector19 += npc.velocity; + num163 = vector19.X; + num164 = vector19.Y; + int num166 = 21; + int num167 = ProjectileID.Skull; + vector18 += vector19 * 5f; + int num168 = Projectile.NewProjectile(vector18.X, vector18.Y, num163, num164, num167, num166, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num168].timeLeft = 300; + } + } + } + + // Float above target + if (npc.ai[1] == 0f) + { + npc.damage = npc.defDamage; + + calamityGlobalNPC.newAI[1] += 1f; + npc.ai[2] += 1f + (3f * (1f - lifeRatio)); + if (npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 510f : 600f)) + { + npc.ai[2] = 0f; + npc.ai[1] = 1f; + calamityGlobalNPC.newAI[1] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + + npc.rotation = npc.velocity.X / 15f; + + float num169 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.05f : 0.04f; + float num170 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5.5f : 5f; + float num171 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.1f : 0.08f; + float num172 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 11f : 10f; + if (CalamityWorld.bossRushActive) + { + num169 *= 1.5f; + num170 *= 1.2f; + num171 *= 1.5f; + num172 *= 1.2f; + } + + if (npc.position.Y > Main.player[npc.target].position.Y - 250f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.98f; + npc.velocity.Y -= num169; + if (npc.velocity.Y > num170) + npc.velocity.Y = num170; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.98f; + npc.velocity.Y += num169; + if (npc.velocity.Y < -num170) + npc.velocity.Y = -num170; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.98f; + npc.velocity.X -= num171; + if (npc.velocity.X > num172) + npc.velocity.X = num172; + } + + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.98f; + npc.velocity.X += num171; + if (npc.velocity.X < -num172) + npc.velocity.X = -num172; + } + } + + // Spin charge + else if (npc.ai[1] == 1f) + { + npc.defense -= 10; + + npc.ai[2] += 1f + (0.5f * (1f - lifeRatio)); + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] == 2f) + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + + if (npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f)) + { + npc.ai[2] = 0f; + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + } + + npc.rotation += (float)npc.direction * 0.3f; + Vector2 vector20 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num173 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector20.X; + float num174 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector20.Y; + float num175 = (float)Math.Sqrt((double)(num173 * num173 + num174 * num174)); + + // Increase speed while charging + npc.damage = (int)((double)npc.defDamage * 1.3); + float num176 = (CalamityWorld.bossRushActive ? 12f : 4.5f) + (1f * (1f - lifeRatio)); + if (enraged || configBossRushBoost) + num176 += 3f; + + if (num175 > 150f || CalamityWorld.death || CalamityWorld.bossRushActive) + num176 *= 1.05f; + if (num175 > 200f) + num176 *= 1.1f; + if (num175 > 250f) + num176 *= 1.1f; + if (num175 > 300f) + num176 *= 1.1f; + if (num175 > 350f) + num176 *= 1.15f; + if (num175 > 400f) + num176 *= 1.15f; + if (num175 > 450f) + num176 *= 1.15f; + if (num175 > 500f) + num176 *= 1.2f; + if (num175 > 550f) + num176 *= 1.2f; + if (num175 > 600f) + num176 *= 1.2f; + + num175 = num176 / num175; + npc.velocity.X = num173 * num175; + npc.velocity.Y = num174 * num175; + } + + // Daytime enrage + else if (npc.ai[1] == 2f) + { + npc.damage = 1000; + npc.defense = 9999; + npc.rotation += (float)npc.direction * 0.3f; + Vector2 vector21 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num177 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector21.X; + float num178 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector21.Y; + float num179 = (float)Math.Sqrt((double)(num177 * num177 + num178 * num178)); + num179 = 8f / num179; + npc.velocity.X = num177 * num179; + npc.velocity.Y = num178 * num179; + } + + // Despawn + else if (npc.ai[1] == 3f) + { + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + npc.velocity.X *= 0.95f; + if (npc.timeLeft > 50) + npc.timeLeft = 50; + } + + // Emit dust + if (npc.ai[1] != 2f && npc.ai[1] != 3f && num156 != 0) + { + int num180 = Dust.NewDust(new Vector2(npc.position.X + (float)(npc.width / 2) - 15f - npc.velocity.X * 5f, npc.position.Y + (float)npc.height - 2f), 30, 10, 5, -npc.velocity.X * 0.2f, 3f, 0, default, 2f); + Main.dust[num180].noGravity = true; + Main.dust[num180].velocity.X = Main.dust[num180].velocity.X * 1.3f; + Main.dust[num180].velocity.X = Main.dust[num180].velocity.X + npc.velocity.X * 0.4f; + Main.dust[num180].velocity.Y = Main.dust[num180].velocity.Y + (2f + npc.velocity.Y); + for (int num181 = 0; num181 < 2; num181++) + { + num180 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, 5, npc.velocity.X, npc.velocity.Y, 0, default, 2f); + Main.dust[num180].noGravity = true; + Main.dust[num180].velocity -= npc.velocity; + Main.dust[num180].velocity.Y = Main.dust[num180].velocity.Y + 5f; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedSkeletronHandAI(NPC npc, bool enraged, Mod mod) + { + npc.spriteDirection = -(int)npc.ai[0]; + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 11) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) + { + float maxX = CalamityWorld.bossRushActive ? 10f : 8f; + float maxY = CalamityWorld.bossRushActive ? 7.5f : 6f; + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + if (npc.velocity.Y > maxY) + npc.velocity.Y = maxY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + if (npc.velocity.Y < -maxY) + npc.velocity.Y = -maxY; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X > maxX) + npc.velocity.X = maxX; + } + + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X < -maxX) + npc.velocity.X = -maxX; + } + } + else + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 120f) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + float maxX = CalamityWorld.bossRushActive ? 10f : 8f; + float maxY = CalamityWorld.bossRushActive ? 4f : 3f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + if (npc.velocity.Y > maxY) + npc.velocity.Y = maxY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + if (npc.velocity.Y < -maxY) + npc.velocity.Y = -maxY; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + if (npc.velocity.X > maxX) + npc.velocity.X = maxX; + } + + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + if (npc.velocity.X < -maxX) + npc.velocity.X = -maxX; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + if (npc.velocity.Y > maxY) + npc.velocity.Y = maxY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + if (npc.velocity.Y < -maxY) + npc.velocity.Y = -maxY; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + if (npc.velocity.X > maxX) + npc.velocity.X = maxX; + } + + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.11f : 0.07f); + if (npc.velocity.X < -maxX) + npc.velocity.X = -maxX; + } + } + + Vector2 vector22 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num182 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector22.X; + float num183 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector22.Y; + float num184 = (float)Math.Sqrt((double)(num182 * num182 + num183 * num183)); + npc.rotation = (float)Math.Atan2((double)num183, (double)num182) + 1.57f; + return false; + } + if (npc.ai[2] == 1f) + { + Vector2 vector23 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num185 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector23.X; + float num186 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector23.Y; + float num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186)); + npc.rotation = (float)Math.Atan2((double)num186, (double)num185) + 1.57f; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.1f; + + npc.velocity.Y -= 0.06f; + if (npc.velocity.Y < -15f) + npc.velocity.Y = -15f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + npc.TargetClosest(true); + npc.ai[2] = 2f; + vector23 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num185 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector23.X; + num186 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector23.Y; + num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186)); + + num187 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 25f : 23f) / num187; + if (CalamityWorld.bossRushActive) + num187 *= 1.5f; + + npc.velocity.X = num185 * num187; + npc.velocity.Y = num186 * num187; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + npc.ai[2] = 3f; + } + else if (npc.ai[2] == 4f) + { + Vector2 vector24 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num188 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector24.X; + float num189 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector24.Y; + float num190 = (float)Math.Sqrt((double)(num188 * num188 + num189 * num189)); + npc.rotation = (float)Math.Atan2((double)num189, (double)num188) + 1.57f; + npc.velocity.Y *= 0.95f; + npc.velocity.X += 0.1f * -npc.ai[0]; + + npc.velocity.X += 0.07f * -npc.ai[0]; + if (npc.velocity.X < -14f) + npc.velocity.X = -14f; + else if (npc.velocity.X > 14f) + npc.velocity.X = 14f; + + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) + { + npc.TargetClosest(true); + npc.ai[2] = 5f; + vector24 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num188 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector24.X; + num189 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector24.Y; + num190 = (float)Math.Sqrt((double)(num188 * num188 + num189 * num189)); + + num190 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 26f : 24f) / num190; + if (CalamityWorld.bossRushActive) + num190 *= 1.5f; + + npc.velocity.X = num188 * num190; + npc.velocity.Y = num189 * num190; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)))) + npc.ai[2] = 0f; + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Wall of Flesh AI + public static bool BuffedWallofFleshAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + // Despawn + if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16)) + npc.active = false; + + // Set Wall of Flesh variables + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + Main.wofB = -1; + Main.wofT = -1; + } + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases based on HP + bool phase2 = lifeRatio < 0.66f || CalamityWorld.bossRushActive; + bool phase3 = lifeRatio < 0.33f || CalamityWorld.bossRushActive; + + // Start leech spawning based on HP + npc.ai[1] += 1f; + if (npc.ai[2] == 0f) + { + if (phase2) + npc.ai[1] += 1f; + if (phase3) + npc.ai[1] += 1f; + + if (npc.ai[1] > 2700f) + npc.ai[2] = 1f; + } + + // Leech spawn + if (npc.ai[2] > 0f && npc.ai[1] > 60f) + { + int num330 = phase3 ? 3 : 2; + + npc.ai[2] += 1f; + npc.ai[1] = 0f; + if (npc.ai[2] > (float)num330) + npc.ai[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num331 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)(npc.height / 2) + 20f), NPCID.LeechHead, 1, 0f, 0f, 0f, 0f, 255); + Main.npc[num331].velocity.X = (float)(npc.direction * 9); + } + } + + // Play sound + npc.localAI[3] += 1f; + if (npc.localAI[3] >= (float)(600 + Main.rand.Next(1000))) + { + npc.localAI[3] = (float)(-(float)Main.rand.Next(200)); + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 10, 1f, 0f); + } + + // Set whoAmI variable + Main.wof = npc.whoAmI; + + // Set eye positions + int num332 = (int)(npc.position.X / 16f); + int num333 = (int)((npc.position.X + (float)npc.width) / 16f); + int num334 = (int)((npc.position.Y + (float)(npc.height / 2)) / 16f); + int num335 = 0; + int num336 = num334 + 7; + while (num335 < 15 && num336 > Main.maxTilesY - 200) + { + num336++; + int num; + for (int num337 = num332; num337 <= num333; num337 = num + 1) + { + try + { + if (WorldGen.SolidTile(num337, num336) || Main.tile[num337, num336].liquid > 0) + num335++; + } catch + { num335 += 15; } + + num = num337; + } + } + num336 += 4; + if (Main.wofB == -1) + Main.wofB = num336 * 16; + else if (Main.wofB > num336 * 16) + { + Main.wofB--; + if (Main.wofB < num336 * 16) + Main.wofB = num336 * 16; + } + else if (Main.wofB < num336 * 16) + { + Main.wofB++; + if (Main.wofB > num336 * 16) + Main.wofB = num336 * 16; + } + + num335 = 0; + num336 = num334 - 7; + while (num335 < 15 && num336 < Main.maxTilesY - 10) + { + num336--; + int num; + for (int num338 = num332; num338 <= num333; num338 = num + 1) + { + try + { + if (WorldGen.SolidTile(num338, num336) || Main.tile[num338, num336].liquid > 0) + num335++; + } catch + { num335 += 15; } + + num = num338; + } + } + num336 -= 4; + if (Main.wofT == -1) + Main.wofT = num336 * 16; + else if (Main.wofT > num336 * 16) + { + Main.wofT--; + if (Main.wofT < num336 * 16) + Main.wofT = num336 * 16; + } + else if (Main.wofT < num336 * 16) + { + Main.wofT++; + if (Main.wofT > num336 * 16) + Main.wofT = num336 * 16; + } + + // Set Y velocity and position + float num339 = (float)((Main.wofB + Main.wofT) / 2 - npc.height / 2); + + if (npc.position.Y > num339 + 1f) + npc.velocity.Y = -1f; + else if (npc.position.Y < num339 - 1f) + npc.velocity.Y = 1f; + npc.velocity.Y = 0f; + + int num340 = (Main.maxTilesY - 180) * 16; + if (num339 < (float)num340) + num339 = (float)num340; + npc.position.Y = num339; + + // Speed up if target is too far or if they're hiding behind tiles, slow down if too close + float distanceFromTarget = 0f; + float targetPosition = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float npcPosition = npc.position.X + (float)(npc.width / 2); + if (npc.velocity.X < 0f) + distanceFromTarget = npcPosition - targetPosition; + else + distanceFromTarget = targetPosition - npcPosition; + + float halfAverageScreenWidth = 960f; + float distanceBeforeSlowingDown = 400f; + float timeBeforeEnrage = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 420f : 600f; + float speedMult = 1f; + + if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage) + { + if (distanceFromTarget > halfAverageScreenWidth || + !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + speedMult += (distanceFromTarget - halfAverageScreenWidth) * 0.001f; + calamityGlobalNPC.newAI[0] += 1f; + + // Enrage after 10 seconds of target being off screen + if (calamityGlobalNPC.newAI[0] >= timeBeforeEnrage) + { + calamityGlobalNPC.newAI[1] = 1f; + + // Tell eyes to stop firing lasers + npc.ai[3] = 1f; + + // Play roar sound on players nearby + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) + Main.PlaySound(4, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 10, 1f, -0.25f); + } + } + else if (distanceFromTarget < distanceBeforeSlowingDown) + speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; + + if (distanceFromTarget < halfAverageScreenWidth && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + if (calamityGlobalNPC.newAI[0] > 0f) + calamityGlobalNPC.newAI[0] -= 1f; + } + + if (speedMult > 2f) + speedMult = 2f; + if (speedMult < 0.75f) + speedMult = 0.75f; + } + + // Enrage if target is off screen for too long + if (calamityGlobalNPC.newAI[1] == 1f) + { + // Triple speed + speedMult = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3.5f : 3.25f; + + // Return to normal if very close to target + if (distanceFromTarget < distanceBeforeSlowingDown) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + npc.ai[3] = 0f; + } + } + + if (enraged || configBossRushBoost) + speedMult += 0.7f; + else if (CalamityWorld.death || CalamityWorld.bossRushActive) + speedMult += 0.18f; + + // NOTE: Max velocity is 8 in expert mode + float velocityX = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 2.2f : 2f) + (4f * (1f - lifeRatio)); + velocityX *= speedMult; + if (CalamityWorld.bossRushActive) + velocityX *= 1.5f; + // NOTE: Values below are based on Rev Mode only! + // Max velocity without enrage is 12 + // Min velocity is 1.5 + // Max velocity with enrage is 18 + + // Set X velocity + if (npc.velocity.X == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = (float)npc.direction; + } + if (npc.velocity.X < 0f) + { + npc.velocity.X = -velocityX; + npc.direction = -1; + } + else + { + npc.velocity.X = velocityX; + npc.direction = 1; + } + + // Direction + npc.spriteDirection = npc.direction; + Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num342 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector37.X; + float num343 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector37.Y; + float num344 = (float)Math.Sqrt((double)(num342 * num342 + num343 * num343)); + num342 *= num344; + num343 *= num344; + + // Rotation based on direction + if (npc.direction > 0) + { + if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2)) + npc.rotation = (float)Math.Atan2((double)(-(double)num343), (double)(-(double)num342)) + 3.14f; + else + npc.rotation = 0f; + } + else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2)) + npc.rotation = (float)Math.Atan2((double)num343, (double)num342) + 3.14f; + else + npc.rotation = 0f; + + // Expert hungry respawn over time + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Range of 1 to 11 + int chance = (int)(1f + lifeRatio * 10f); + + // Range of 1 to 121 + chance *= chance; + + // Range of 20 to 134 + chance = (chance * 19 + 400) / 20; + + // Range of 30 to 59 + if (chance < 60) + chance = (chance * 3 + 60) / 4; + + // Range of 60 to 268 + chance = (int)((double)chance * 2D); + + if (Main.rand.Next(chance) == 0) + { + int num346 = 0; + float[] array = new float[10]; + int num; + for (int num347 = 0; num347 < 200; num347 = num + 1) + { + if (num346 < 10 && Main.npc[num347].active && Main.npc[num347].type == NPCID.TheHungry) + { + array[num346] = Main.npc[num347].ai[0]; + num346++; + } + num = num347; + } + + int maxValue = 1 + num346 * 2; + if (num346 < 10 && Main.rand.Next(maxValue) <= 1) + { + int num348 = -1; + for (int num349 = 0; num349 < 1000; num349 = num + 1) + { + int num350 = Main.rand.Next(10); + float num351 = (float)num350 * 0.1f - 0.05f; + bool flag29 = true; + for (int num352 = 0; num352 < num346; num352 = num + 1) + { + if (num351 == array[num352]) + { + flag29 = false; + break; + } + num = num352; + } + if (flag29) + { + num348 = num350; + break; + } + num = num349; + } + if (num348 >= 0) + { + int num353 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num353].ai[0] = (float)num348 * 0.1f - 0.05f; + } + } + } + } + + // Spawn eyes and hungries + if (npc.localAI[0] == 1f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 2f; + + num339 = (float)((Main.wofB + Main.wofT) / 2); + num339 = (num339 + (float)Main.wofT) / 2f; + int num354 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num354].ai[0] = 1f; + + num339 = (float)((Main.wofB + Main.wofT) / 2); + num339 = (num339 + (float)Main.wofB) / 2f; + num354 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num354].ai[0] = -1f; + + num339 = (float)((Main.wofB + Main.wofT) / 2); + num339 = (num339 + (float)Main.wofB) / 2f; + + int num; + for (int num355 = 0; num355 < 11; num355 = num + 1) + { + num354 = NPC.NewNPC((int)npc.position.X, (int)num339, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num354].ai[0] = (float)num355 * 0.1f - 0.05f; + num = num355; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedWallofFleshEyeAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + // Despawn + if (Main.wof < 0) + { + npc.active = false; + return false; + } + + // Stupid worm variable but for wall of flesh npc time + npc.realLife = Main.wof; + + // Life and target + if (Main.npc[Main.wof].life > 0) + npc.life = Main.npc[Main.wof].life; + npc.TargetClosest(true); + + // Velocity, direction, and position + npc.position.X = Main.npc[Main.wof].position.X; + npc.direction = Main.npc[Main.wof].direction; + npc.spriteDirection = npc.direction; + + float num356 = (float)((Main.wofB + Main.wofT) / 2); + if (npc.ai[0] > 0f) + num356 = (num356 + (float)Main.wofT) / 2f; + else + num356 = (num356 + (float)Main.wofB) / 2f; + num356 -= (float)(npc.height / 2); + + if (npc.position.Y > num356 + 1f) + npc.velocity.Y = -1f; + else if (npc.position.Y < num356 - 1f) + npc.velocity.Y = 1f; + else + { + npc.velocity.Y = 0f; + npc.position.Y = num356; + } + + if (npc.velocity.Y > 5f) + npc.velocity.Y = 5f; + if (npc.velocity.Y < -5f) + npc.velocity.Y = -5f; + + Vector2 vector38 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num357 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector38.X; + float num358 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector38.Y; + float num359 = (float)Math.Sqrt((double)(num357 * num357 + num358 * num358)); + num357 *= num359; + num358 *= num359; + + // Rotation based on direction and whether to fire lasers or not + bool flag30 = true; + if (npc.direction > 0) + { + if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2)) + npc.rotation = (float)Math.Atan2((double)(-(double)num358), (double)(-(double)num357)) + 3.14f; + else + { + npc.rotation = 0f; + flag30 = false; + } + } + else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2)) + npc.rotation = (float)Math.Atan2((double)num358, (double)num357) + 3.14f; + else + { + npc.rotation = 0f; + flag30 = false; + } + + // Fire lasers + if (Main.netMode != NetmodeID.MultiplayerClient && Main.npc[Main.wof].ai[3] == 0f) + { + // Percent life remaining + float lifeRatio = (float)Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax; + + npc.localAI[1] += 1f + (4f * (1f - lifeRatio)); + + if (npc.localAI[2] == 0f) + { + if (npc.localAI[1] > 400f) + { + npc.localAI[2] = 1f; + npc.localAI[1] = 0f; + } + } + else if (npc.localAI[1] > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 39f : 45f) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 4f) + npc.localAI[2] = 0f; + + if (flag30) + { + bool phase2 = lifeRatio < 0.5 || CalamityWorld.bossRushActive; + float velocity = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 10f : 9f) + (4f * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) + velocity *= 1.5f; + + int damage = (phase2 ? 22 : 17); + int projectileType = (phase2 ? ProjectileID.DeathLaser : ProjectileID.EyeLaser); + + vector38 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num357 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector38.X; + num358 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector38.Y; + num359 = (float)Math.Sqrt((double)(num357 * num357 + num358 * num358)); + num359 = velocity / num359; + num357 *= num359; + num358 *= num359; + vector38.X += num357; + vector38.Y += num358; + Projectile.NewProjectile(vector38.X, vector38.Y, num357, num358, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Destroyer AI + public static bool BuffedDestroyerAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + // 8 seconds of reistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 480f) + calamityGlobalNPC.newAI[1] += 1f; + + // Enrage variable if player is flying upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases based on life percentage + bool phase2 = lifeRatio < 0.66f; + bool phase3 = lifeRatio < 0.33f; + + // Set worm variable for worms + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + + // Get a target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + npc.TargetClosest(true); + + // Velocity + npc.velocity.Length(); + + // Dust on spawn and alpha effects + if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) + { + if (npc.alpha != 0) + { + for (int i = 0; i < 2; i++) + { + int num = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num].noGravity = true; + Main.dust[num].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + // Check if other segments are still alive, if not, die + if (npc.type > NPCID.TheDestroyer) + { + bool flag = false; + if (npc.ai[1] <= 0f) + flag = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + flag = true; + + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + } + + if (npc.type == NPCID.TheDestroyerBody) + { + // Gain more defense as health lowers with a max of 30, lose defense if probe has been launched + if (npc.ai[2] == 0f) + { + int defenseUp = (int)(30f * (1f - lifeRatio)); + npc.defense = npc.defDefense + defenseUp; + } + else + npc.defense = npc.defDefense - 10; + + // Enrage, fire more homing lasers + if (targetFloatingUp) + { + if (calamityGlobalNPC.newAI[2] < 480f) + calamityGlobalNPC.newAI[2] += 1f; + } + else + { + if (calamityGlobalNPC.newAI[2] > 0f) + calamityGlobalNPC.newAI[2] -= 1f; + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Spawn segments from head + if (npc.ai[0] == 0f && npc.type == NPCID.TheDestroyer) + { + npc.ai[3] = (float)npc.whoAmI; + npc.realLife = npc.whoAmI; + int num2 = npc.whoAmI; + + int num3 = 80; + for (int j = 0; j <= num3; j++) + { + int num4 = NPCID.TheDestroyerBody; + if (j == num3) + num4 = NPCID.TheDestroyerTail; + + int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num5].ai[3] = (float)npc.whoAmI; + Main.npc[num5].realLife = npc.whoAmI; + Main.npc[num5].ai[1] = (float)num2; + Main.npc[num2].ai[0] = (float)num5; + NetMessage.SendData(23, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); + num2 = num5; + } + } + + // Fire lasers + if (npc.type == NPCID.TheDestroyerBody) + { + // Laser rate of fire + int shootTime = 1 + (int)Math.Ceiling((((enraged || configBossRushBoost) ? 7D : 3D) * (double)lifeRatio)); + if (CalamityWorld.bossRushActive) + shootTime += 1; + + calamityGlobalNPC.newAI[0] += (float)Main.rand.Next(shootTime); + int randomCount = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? Main.rand.Next(1260, 23400) : Main.rand.Next(1330, 24700)); + + if (calamityGlobalNPC.newAI[0] >= (float)randomCount) + { + calamityGlobalNPC.newAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + // Base laser speed on player movement speed + float laserSpeedBoost = Math.Abs(Main.player[npc.target].velocity.X); + if (Math.Abs(Main.player[npc.target].velocity.X) < Math.Abs(Main.player[npc.target].velocity.Y)) + laserSpeedBoost = Math.Abs(Main.player[npc.target].velocity.Y); + + // Put limits on laser speed + float projectileSpeed = 2f + laserSpeedBoost; + if (projectileSpeed < 7f) + projectileSpeed = 7f; + if (projectileSpeed > 10f) + projectileSpeed = 10f; + + // Increase laser speed as health drops + if (phase2 || CalamityWorld.bossRushActive) + projectileSpeed += (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.25f; + if (phase3 || CalamityWorld.bossRushActive) + projectileSpeed += (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.25f; + if (CalamityWorld.bossRushActive) + projectileSpeed *= 1.25f; + + // Set projectile damage and type, set projectile to saucer scrap if probe has been launched + int damage = 23; + int projectileType = ProjectileID.DeathLaser; if (npc.ai[2] == 0f || Main.rand.NextBool(2)) { - if (phase3 || calamityGlobalNPC.newAI[2] > 0f) - { - damage += 4; - projectileType = mod.ProjectileType("DestroyerHomingLaser"); - } - else if (phase2) - { - damage += 2; - projectileType = ProjectileID.FrostBeam; - } - } - else - projectileType = ProjectileID.SaucerScrap; + if (phase3 || calamityGlobalNPC.newAI[2] > 0f) + { + damage += 4; + projectileType = mod.ProjectileType("DestroyerHomingLaser"); + } + else if (phase2) + { + damage += 2; + projectileType = ProjectileID.FrostBeam; + } + } + else + projectileType = ProjectileID.SaucerScrap; - // Get target vector - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = projectileSpeed / num8; - num6 *= num8; - num7 *= num8; - vector.X += num6 * 5f; - vector.Y += num7 * 5f; + // Get target vector + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = projectileSpeed / num8; + num6 *= num8; + num7 *= num8; + vector.X += num6 * 5f; + vector.Y += num7 * 5f; - // Shoot projectile and set timeLeft if not a homing laser/metal scrap so lasers don't last for too long - int proj = Projectile.NewProjectile(vector.X, vector.Y, num6, num7, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - if (projectileType != mod.ProjectileType("DestroyerHomingLaser") && projectileType != ProjectileID.SaucerScrap) - Main.projectile[proj].timeLeft = 300; + // Shoot projectile and set timeLeft if not a homing laser/metal scrap so lasers don't last for too long + int proj = Projectile.NewProjectile(vector.X, vector.Y, num6, num7, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + if (projectileType != mod.ProjectileType("DestroyerHomingLaser") && projectileType != ProjectileID.SaucerScrap) + Main.projectile[proj].timeLeft = 300; - npc.netUpdate = true; - } - } - } - } + npc.netUpdate = true; + } + } + } + } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num12 = (int)(npc.position.X / 16f) - 1; + int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num14 = (int)(npc.position.Y / 16f) - 1; + int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num12 < 0) - num12 = 0; - if (num13 > Main.maxTilesX) - num13 = Main.maxTilesX; - if (num14 < 0) - num14 = 0; - if (num15 > Main.maxTilesY) - num15 = Main.maxTilesY; + if (num12 < 0) + num12 = 0; + if (num13 > Main.maxTilesX) + num13 = Main.maxTilesX; + if (num14 < 0) + num14 = 0; + if (num15 > Main.maxTilesY) + num15 = Main.maxTilesY; - // Fly or not - bool flag2 = false; - if (!flag2) - { - for (int k = num12; k < num13; k++) - { - for (int l = num14; l < num15; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) - { - Vector2 vector2; - vector2.X = (float)(k * 16); - vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - break; - } - } - } - } - } + // Fly or not + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + for (int l = num14; l < num15; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + { + Vector2 vector2; + vector2.X = (float)(k * 16); + vector2.Y = (float)(l * 16); + if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + flag2 = true; + break; + } + } + } + } + } - // Start flying if target is not within a certain distance - if (!flag2) - { - if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); + // Start flying if target is not within a certain distance + if (!flag2) + { + if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); - npc.localAI[1] = 1f; + npc.localAI[1] = 1f; - if (npc.type == NPCID.TheDestroyer) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num16 = targetFloatingUp ? 50 : 1000; - int height = 2000 - (int)((targetFloatingUp ? 850f : 700f) * (1f - lifeRatio)); - bool flag3 = true; + if (npc.type == NPCID.TheDestroyer) + { + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num16 = targetFloatingUp ? 50 : 1000; + int height = 2000 - (int)((targetFloatingUp ? 850f : 700f) * (1f - lifeRatio)); + bool flag3 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int m = 0; m < 255; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, height); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - if (flag3) - flag2 = true; - } - } - } - else - npc.localAI[1] = 0f; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, height); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + flag2 = true; + } + } + } + else + npc.localAI[1] = 0f; - // Despawn - float fallSpeed = 16f; - if (Main.dayTime || Main.player[npc.target].dead) - { - flag2 = false; - npc.velocity.Y += 1f; + // Despawn + float fallSpeed = 16f; + if (Main.dayTime || Main.player[npc.target].dead) + { + flag2 = false; + npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y += 1f; - fallSpeed = 32f; - } + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y += 1f; + fallSpeed = 32f; + } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int n = 0; n < 200; n++) - { - if (Main.npc[n].aiStyle == npc.aiStyle) - Main.npc[n].active = false; - } - } - } - fallSpeed += ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (1f - lifeRatio); + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int n = 0; n < 200; n++) + { + if (Main.npc[n].aiStyle == npc.aiStyle) + Main.npc[n].active = false; + } + } + } + fallSpeed += ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (1f - lifeRatio); - // Speed and movement - float speed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.11f : 0.1f) + ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); - float turnSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.165f : 0.15f) + ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - { - speed *= 1.5f; - turnSpeed *= 1.5f; - } + // Speed and movement + float speed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.11f : 0.1f) + ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); + float turnSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.165f : 0.15f) + ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) + { + speed *= 1.5f; + turnSpeed *= 1.5f; + } - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; - } - catch - { - } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); - num22 = (num22 - (float)num23) / num22; - num20 *= num22; - num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X += num20; - npc.position.Y += num21; - return false; - } + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + } catch + { + } + npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + int num23 = (int)(44f * npc.scale); + num22 = (num22 - (float)num23) / num22; + num20 *= num22; + num21 *= num22; + npc.velocity = Vector2.Zero; + npc.position.X += num20; + npc.position.Y += num21; + return false; + } - if (!flag2) - { - npc.TargetClosest(true); - npc.velocity.Y += 0.15f; + if (!flag2) + { + npc.TargetClosest(true); + npc.velocity.Y += 0.15f; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; + if (npc.velocity.Y > fallSpeed) + npc.velocity.Y = fallSpeed; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= speed * 1.1f; - else - npc.velocity.X += speed * 1.1f; - } - else if (npc.velocity.Y == fallSpeed) - { - if (npc.velocity.X < num20) - npc.velocity.X += speed; - else if (npc.velocity.X > num20) - npc.velocity.X -= speed; - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - npc.velocity.X += speed * 0.9f; - else - npc.velocity.X -= speed * 0.9f; - } - } - else - { - if (npc.soundDelay == 0) - { - float num24 = num22 / 40f; - if (num24 < 10f) - num24 = 10f; - if (num24 > 20f) - num24 = 20f; + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= speed * 1.1f; + else + npc.velocity.X += speed * 1.1f; + } + else if (npc.velocity.Y == fallSpeed) + { + if (npc.velocity.X < num20) + npc.velocity.X += speed; + else if (npc.velocity.X > num20) + npc.velocity.X -= speed; + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + npc.velocity.X += speed * 0.9f; + else + npc.velocity.X -= speed * 0.9f; + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + num24 = 10f; + if (num24 > 20f) + num24 = 20f; - npc.soundDelay = (int)num24; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - } + npc.soundDelay = (int)num24; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = fallSpeed / num22; - num20 *= num27; - num21 *= num27; + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = fallSpeed / num22; + num20 *= num27; + num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) - { - if (npc.velocity.X < num20) - npc.velocity.X += turnSpeed; - else if (npc.velocity.X > num20) - npc.velocity.X -= turnSpeed; - if (npc.velocity.Y < num21) - npc.velocity.Y += turnSpeed; - else if (npc.velocity.Y > num21) - npc.velocity.Y -= turnSpeed; - } + if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + { + if (npc.velocity.X < num20) + npc.velocity.X += turnSpeed; + else if (npc.velocity.X > num20) + npc.velocity.X -= turnSpeed; + if (npc.velocity.Y < num21) + npc.velocity.Y += turnSpeed; + else if (npc.velocity.Y > num21) + npc.velocity.Y -= turnSpeed; + } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) - { - if (npc.velocity.X < num20) - npc.velocity.X += speed; - else if (npc.velocity.X > num20) - npc.velocity.X -= speed; - if (npc.velocity.Y < num21) - npc.velocity.Y += speed; - else if (npc.velocity.Y > num21) - npc.velocity.Y -= speed; + if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + { + if (npc.velocity.X < num20) + npc.velocity.X += speed; + else if (npc.velocity.X > num20) + npc.velocity.X -= speed; + if (npc.velocity.Y < num21) + npc.velocity.Y += speed; + else if (npc.velocity.Y > num21) + npc.velocity.Y -= speed; - if ((double)Math.Abs(num21) < (double)fallSpeed * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed * 2f; - else - npc.velocity.Y -= speed * 2f; - } - if ((double)Math.Abs(num20) < (double)fallSpeed * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed * 2f; - else - npc.velocity.X -= speed * 2f; - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num20) - npc.velocity.X += speed * 1.1f; - else if (npc.velocity.X > num20) - npc.velocity.X -= speed * 1.1f; + if ((double)Math.Abs(num21) < (double)fallSpeed * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed * 2f; + else + npc.velocity.Y -= speed * 2f; + } + if ((double)Math.Abs(num20) < (double)fallSpeed * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed * 2f; + else + npc.velocity.X -= speed * 2f; + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + npc.velocity.X += speed * 1.1f; + else if (npc.velocity.X > num20) + npc.velocity.X -= speed * 1.1f; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed; - else - npc.velocity.Y -= speed; - } - } - else - { - if (npc.velocity.Y < num21) - npc.velocity.Y += speed * 1.1f; - else if (npc.velocity.Y > num21) - npc.velocity.Y -= speed * 1.1f; + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed; + else + npc.velocity.Y -= speed; + } + } + else + { + if (npc.velocity.Y < num21) + npc.velocity.Y += speed * 1.1f; + else if (npc.velocity.Y > num21) + npc.velocity.Y -= speed * 1.1f; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed; - else - npc.velocity.X -= speed; - } - } - } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed; + else + npc.velocity.X -= speed; + } + } + } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (npc.type == NPCID.TheDestroyer) - { - if (flag2) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; + if (npc.type == NPCID.TheDestroyer) + { + if (flag2) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; - npc.localAI[0] = 0f; - } + npc.localAI[0] = 0f; + } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + } - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - return false; - } - #endregion + return false; + } + #endregion - #region Buffed Twins AI - public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + #region Buffed Twins AI + public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - // Enrage variable if player is floating upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + // Enrage variable if player is floating upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; - // Easier to send info to Spazmatism - CalamityGlobalNPC.laserEye = npc.whoAmI; + // Easier to send info to Spazmatism + CalamityGlobalNPC.laserEye = npc.whoAmI; - // Check for Spazmatism - bool spazAlive = false; - if (CalamityGlobalNPC.fireEye != -1) - spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; + // Check for Spazmatism + bool spazAlive = false; + if (CalamityGlobalNPC.fireEye != -1) + spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; - bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive; + bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive; - // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); - float num376 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num377 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); + float num376 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); + float num377 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num378 = (float)Math.Atan2((double)num377, (double)num376) + 1.57f; - if (num378 < 0f) - num378 += 6.283f; - else if ((double)num378 > 6.283) - num378 -= 6.283f; + float num378 = (float)Math.Atan2((double)num377, (double)num376) + 1.57f; + if (num378 < 0f) + num378 += 6.283f; + else if ((double)num378 > 6.283) + num378 -= 6.283f; - float num379 = 0.1f; - if (npc.rotation < num378) - { - if ((double)(num378 - npc.rotation) > 3.1415) - npc.rotation -= num379; - else - npc.rotation += num379; - } - else if (npc.rotation > num378) - { - if ((double)(npc.rotation - num378) > 3.1415) - npc.rotation += num379; - else - npc.rotation -= num379; - } + float num379 = 0.1f; + if (npc.rotation < num378) + { + if ((double)(num378 - npc.rotation) > 3.1415) + npc.rotation -= num379; + else + npc.rotation += num379; + } + else if (npc.rotation > num378) + { + if ((double)(npc.rotation - num378) > 3.1415) + npc.rotation += num379; + else + npc.rotation -= num379; + } - if (npc.rotation > num378 - num379 && npc.rotation < num378 + num379) - npc.rotation = num378; + if (npc.rotation > num378 - num379 && npc.rotation < num378 + num379) + npc.rotation = num378; - if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; + if (npc.rotation < 0f) + npc.rotation += 6.283f; + else if ((double)npc.rotation > 6.283) + npc.rotation -= 6.283f; - if (npc.rotation > num378 - num379 && npc.rotation < num378 + num379) - npc.rotation = num378; + if (npc.rotation > num378 - num379 && npc.rotation < num378 + num379) + npc.rotation = num378; if (Main.rand.NextBool(5)) { - int num380 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust var_9_131D1_cp_0_cp_0 = Main.dust[num380]; - var_9_131D1_cp_0_cp_0.velocity.X *= 0.5f; - Dust var_9_131F5_cp_0_cp_0 = Main.dust[num380]; - var_9_131F5_cp_0_cp_0.velocity.Y *= 0.1f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) - { - int num; - for (int num381 = 0; num381 < 200; num381 = num + 1) - { - if (num381 != npc.whoAmI && Main.npc[num381].active && (Main.npc[num381].type == NPCID.Retinazer || Main.npc[num381].type == NPCID.Spazmatism) && Main.npc[num381].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[num381].timeLeft - 1; - - num = num381; - } - } - - if (Main.dayTime | Main.player[npc.target].dead) - { - npc.velocity.Y -= 0.04f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return false; - } - } - - else if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - float num382 = 8.25f; - float num383 = 0.115f; - if (CalamityWorld.bossRushActive) - { - num382 *= 1.5f; - num383 *= 1.5f; - } - - int num384 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num384 = -1; - - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num385 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num384 * 300) - vector40.X; - float num386 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector40.Y; - float num387 = (float)Math.Sqrt((double)(num385 * num385 + num386 * num386)); - float num388 = num387; - - num387 = num382 / num387; - num385 *= num387; - num386 *= num387; - - if (npc.velocity.X < num385) - { - npc.velocity.X += num383; - if (npc.velocity.X < 0f && num385 > 0f) - npc.velocity.X += num383; - } - else if (npc.velocity.X > num385) - { - npc.velocity.X -= num383; - if (npc.velocity.X > 0f && num385 < 0f) - npc.velocity.X -= num383; - } - if (npc.velocity.Y < num386) - { - npc.velocity.Y += num383; - if (npc.velocity.Y < 0f && num386 > 0f) - npc.velocity.Y += num383; - } - else if (npc.velocity.Y > num386) - { - npc.velocity.Y -= num383; - if (npc.velocity.Y > 0f && num386 < 0f) - npc.velocity.Y -= num383; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= 450f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - - else if (npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num388 < 400f) - { - if (!Main.player[npc.target].dead) - npc.ai[3] += 1f; - - if (npc.ai[3] >= 30f) - { - npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num385 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector40.X; - num386 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector40.Y; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num389 = CalamityWorld.bossRushActive ? 12f : 10.5f; - int num390 = 23; - int num391 = ProjectileID.EyeLaser; - - num387 = (float)Math.Sqrt((double)(num385 * num385 + num386 * num386)); - num387 = num389 / num387; - num385 *= num387; - num386 *= num387; - vector40.X += num385 * 15f; - vector40.Y += num386 * 15f; - - Projectile.NewProjectile(vector40.X, vector40.Y, num385, num386, num391, num390, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - else if (npc.ai[1] == 1f) - { - npc.rotation = num378; - float num393 = CalamityWorld.bossRushActive ? 22.5f : 15f; - Vector2 vector41 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num394 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector41.X; - float num395 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector41.Y; - float num396 = (float)Math.Sqrt((double)(num394 * num394 + num395 * num395)); - num396 = num393 / num396; - npc.velocity.X = num394 * num396; - npc.velocity.Y = num395 * num396; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) - { - npc.velocity.X *= 0.96f; - npc.velocity.Y *= 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num378; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - // Enter phase 2 earlier - double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.85 : 0.7); - if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - npc.ai[2] = 0f; - else - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - - int num; - for (int num397 = 0; num397 < 2; num397 = num + 1) - { - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 143, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); - num = num397; - } - - for (int num398 = 0; num398 < 20; num398 = num + 1) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - num = num398; - } - - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - { - // If in phase 2 but Spaz isn't - bool spazInPhase1 = false; - if (CalamityGlobalNPC.fireEye != -1) - { - if (Main.npc[CalamityGlobalNPC.fireEye].active) - spazInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f; - } - int defenseGain = spazInPhase1 ? 9999 : 20; - npc.chaseable = !spazInPhase1; - - npc.damage = (int)((double)npc.defDamage * 1.5); - npc.defense = npc.defDefense + defenseGain; - - npc.HitSound = SoundID.NPCHit4; - - if (npc.ai[1] == 0f) - { - float num399 = 9.5f; - float num400 = 0.175f; - if (CalamityWorld.bossRushActive) - { - num399 *= 1.5f; - num400 *= 1.5f; - } - - Vector2 vector42 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num401 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector42.X; - float num402 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector42.Y; - float num403 = (float)Math.Sqrt((double)(num401 * num401 + num402 * num402)); - num403 = num399 / num403; - num401 *= num403; - num402 *= num403; - - if (npc.velocity.X < num401) - { - npc.velocity.X += num400; - if (npc.velocity.X < 0f && num401 > 0f) - npc.velocity.X += num400; - } - else if (npc.velocity.X > num401) - { - npc.velocity.X -= num400; - if (npc.velocity.X > 0f && num401 < 0f) - npc.velocity.X -= num400; - } - if (npc.velocity.Y < num402) - { - npc.velocity.Y += num400; - if (npc.velocity.Y < 0f && num402 > 0f) - npc.velocity.Y += num400; - } - else if (npc.velocity.Y > num402) - { - npc.velocity.Y -= num400; - if (npc.velocity.Y > 0f && num402 < 0f) - npc.velocity.Y -= num400; - } - - npc.ai[2] += (spazAlive ? 1f : 1.25f); - - // Enrage - if (targetFloatingUp) - { - npc.ai[2] += 1f; - npc.localAI[1] += 2f; - } - - if (npc.ai[2] >= 300f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - - vector42 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num401 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector42.X; - num402 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector42.Y; - npc.rotation = (float)Math.Atan2((double)num402, (double)num401) - 1.57f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (spazAlive ? 72f : 24f)) - { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || enrage) - { - npc.localAI[1] = 0f; - float num404 = CalamityWorld.bossRushActive ? 12f : 10f; - int num405 = 28; - int num406 = ProjectileID.DeathLaser; - - num403 = (float)Math.Sqrt((double)(num401 * num401 + num402 * num402)); - num403 = num404 / num403; - num401 *= num403; - num402 *= num403; - vector42.X += num401 * 15f; - vector42.Y += num402 * 15f; - - if (canHit) - Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, num406, num405, 0f, Main.myPlayer, 0f, 0f); - else - { - int proj = Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, num406, num405, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - int num408 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num408 = -1; - - float num409 = 9.5f; - float num410 = 0.25f; - if (CalamityWorld.bossRushActive) - { - num409 *= 1.5f; - num410 *= 1.5f; - } - - Vector2 vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num411 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num408 * 340) - vector43.X; - float num412 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector43.Y; - float num413 = (float)Math.Sqrt((double)(num411 * num411 + num412 * num412)); - num413 = num409 / num413; - num411 *= num413; - num412 *= num413; - - if (npc.velocity.X < num411) - { - npc.velocity.X += num410; - if (npc.velocity.X < 0f && num411 > 0f) - npc.velocity.X += num410; - } - else if (npc.velocity.X > num411) - { - npc.velocity.X -= num410; - if (npc.velocity.X > 0f && num411 < 0f) - npc.velocity.X -= num410; - } - if (npc.velocity.Y < num412) - { - npc.velocity.Y += num410; - if (npc.velocity.Y < 0f && num412 > 0f) - npc.velocity.Y += num410; - } - else if (npc.velocity.Y > num412) - { - npc.velocity.Y -= num410; - if (npc.velocity.Y > 0f && num412 < 0f) - npc.velocity.Y -= num410; - } - - vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num411 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector43.X; - num412 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector43.Y; - npc.rotation = (float)Math.Atan2((double)num412, (double)num411) - 1.57f; - - // Enrage - if (targetFloatingUp) - { - npc.ai[2] += 1f; - npc.localAI[1] += 2f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] > (spazAlive ? 24f : 8f)) - { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || enrage) - { - npc.localAI[1] = 0f; - float num414 = CalamityWorld.bossRushActive ? 11f : 9f; - int num415 = 21; - int num416 = ProjectileID.DeathLaser; - - num413 = (float)Math.Sqrt((double)(num411 * num411 + num412 * num412)); - num413 = num414 / num413; - num411 *= num413; - num412 *= num413; - vector43.X += num411 * 15f; - vector43.Y += num412 * 15f; - - if (canHit) - Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, num416, num415, 0f, Main.myPlayer, 0f, 0f); - else - { - int proj = Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, num416, num415, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } - } - } - } - - npc.ai[2] += (spazAlive ? 1f : 1.5f); - if (npc.ai[2] >= 180f) - { - npc.ai[1] = ((!spazAlive || enrage) ? 4f : 0f); - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[1] == 2f) - { - // Set rotation and velocity - npc.rotation = num378; - float num450 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 24f : 22f); - - if (!spazAlive) - num450 += 2f; - - // Enrage - if (targetFloatingUp) - num450 += 2f; - - if (CalamityWorld.bossRushActive) - num450 *= 1.5f; - - Vector2 vector47 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num451 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector47.X; - float num452 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector47.Y; - float num453 = (float)Math.Sqrt((double)(num451 * num451 + num452 * num452)); - num453 = num450 / num453; - npc.velocity.X = num451 * num453; - npc.velocity.Y = num452 * num453; - npc.ai[1] = 3f; - } - - else if (npc.ai[1] == 3f) - { - npc.ai[2] += 1f; - - float chargeTime = (spazAlive ? 110f : 75f); - if (CalamityWorld.bossRushActive) - chargeTime *= 0.8f; - - // Slow down - if (npc.ai[2] >= chargeTime) - { - npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - float fireRate = (spazAlive ? 13f : 9f); - if (CalamityWorld.bossRushActive) - fireRate = 7f; - - if (npc.ai[2] % fireRate == 0f) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(SoundID.Item33, npc.position); - - float num353 = 6f; - int num354 = 30; - int num355 = mod.ProjectileType("ScavengerLaser"); - - vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num349 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector34.X; - num350 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; - - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num355, num354, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - // Charge once - if (npc.ai[2] >= chargeTime + 30f) - { - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num378; - npc.ai[1] = 1f; - } - } - - // Get in position for charge - else if (npc.ai[1] == 4f) - { - int num62 = (spazAlive ? 600 : 500); - float num63 = ((enraged || configBossRushBoost) ? 18f : 12f); - float num64 = ((enraged || configBossRushBoost) ? 0.45f : 0.3f); - - if (spazAlive) - { - num63 *= 0.75f; - num64 *= 0.75f; - } - - if (CalamityWorld.bossRushActive) - { - num63 *= 1.5f; - num64 *= 1.5f; - } - - int num408 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num408 = -1; - - Vector2 vector11 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num62 * num408) - vector11.X; - float num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector11.Y; - float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); - - num67 = num63 / num67; - num65 *= num67; - num66 *= num67; - - if (npc.velocity.X < num65) - { - npc.velocity.X += num64; - if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X += num64; - } - else if (npc.velocity.X > num65) - { - npc.velocity.X -= num64; - if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X -= num64; - } - if (npc.velocity.Y < num66) - { - npc.velocity.Y += num64; - if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y += num64; - } - else if (npc.velocity.Y > num66) - { - npc.velocity.Y -= num64; - if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y -= num64; - } - - // Take 1.25 or 1 second to get in position, then charge - npc.ai[2] += 1f; - if (npc.ai[2] >= (spazAlive ? 75f : 60f)) - { - npc.TargetClosest(true); - npc.ai[1] = 2f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedSpazmatismAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - // Enrage variable if player is floating upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; - - // Easier to send info to Retinazer - CalamityGlobalNPC.fireEye = npc.whoAmI; - - // Check for Retinazer - bool retAlive = false; - if (CalamityGlobalNPC.laserEye != -1) - retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; - - bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive; - - // Get a target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); - - // Rotation - float num418 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num419 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - - float num420 = (float)Math.Atan2((double)num419, (double)num418) + 1.57f; - if (num420 < 0f) - num420 += 6.283f; - else if ((double)num420 > 6.283) - num420 -= 6.283f; - - float num421 = 0.15f; - if (npc.rotation < num420) - { - if ((double)(num420 - npc.rotation) > 3.1415) - npc.rotation -= num421; - else - npc.rotation += num421; - } - else if (npc.rotation > num420) - { - if ((double)(npc.rotation - num420) > 3.1415) - npc.rotation += num421; - else - npc.rotation -= num421; - } - - if (npc.rotation > num420 - num421 && npc.rotation < num420 + num421) - npc.rotation = num420; - - if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; - - if (npc.rotation > num420 - num421 && npc.rotation < num420 + num421) - npc.rotation = num420; + int num380 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); + Dust var_9_131D1_cp_0_cp_0 = Main.dust[num380]; + var_9_131D1_cp_0_cp_0.velocity.X *= 0.5f; + Dust var_9_131F5_cp_0_cp_0 = Main.dust[num380]; + var_9_131F5_cp_0_cp_0.velocity.Y *= 0.1f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + { + int num; + for (int num381 = 0; num381 < 200; num381 = num + 1) + { + if (num381 != npc.whoAmI && Main.npc[num381].active && (Main.npc[num381].type == NPCID.Retinazer || Main.npc[num381].type == NPCID.Spazmatism) && Main.npc[num381].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[num381].timeLeft - 1; + + num = num381; + } + } + + if (Main.dayTime | Main.player[npc.target].dead) + { + npc.velocity.Y -= 0.04f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return false; + } + } + + else if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + float num382 = 8.25f; + float num383 = 0.115f; + if (CalamityWorld.bossRushActive) + { + num382 *= 1.5f; + num383 *= 1.5f; + } + + int num384 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num384 = -1; + + Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num385 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num384 * 300) - vector40.X; + float num386 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector40.Y; + float num387 = (float)Math.Sqrt((double)(num385 * num385 + num386 * num386)); + float num388 = num387; + + num387 = num382 / num387; + num385 *= num387; + num386 *= num387; + + if (npc.velocity.X < num385) + { + npc.velocity.X += num383; + if (npc.velocity.X < 0f && num385 > 0f) + npc.velocity.X += num383; + } + else if (npc.velocity.X > num385) + { + npc.velocity.X -= num383; + if (npc.velocity.X > 0f && num385 < 0f) + npc.velocity.X -= num383; + } + if (npc.velocity.Y < num386) + { + npc.velocity.Y += num383; + if (npc.velocity.Y < 0f && num386 > 0f) + npc.velocity.Y += num383; + } + else if (npc.velocity.Y > num386) + { + npc.velocity.Y -= num383; + if (npc.velocity.Y > 0f && num386 < 0f) + npc.velocity.Y -= num383; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= 450f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + + else if (npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num388 < 400f) + { + if (!Main.player[npc.target].dead) + npc.ai[3] += 1f; + + if (npc.ai[3] >= 30f) + { + npc.ai[3] = 0f; + vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num385 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector40.X; + num386 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector40.Y; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num389 = CalamityWorld.bossRushActive ? 12f : 10.5f; + int num390 = 23; + int num391 = ProjectileID.EyeLaser; + + num387 = (float)Math.Sqrt((double)(num385 * num385 + num386 * num386)); + num387 = num389 / num387; + num385 *= num387; + num386 *= num387; + vector40.X += num385 * 15f; + vector40.Y += num386 * 15f; + + Projectile.NewProjectile(vector40.X, vector40.Y, num385, num386, num391, num390, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + + else if (npc.ai[1] == 1f) + { + npc.rotation = num378; + float num393 = CalamityWorld.bossRushActive ? 22.5f : 15f; + Vector2 vector41 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num394 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector41.X; + float num395 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector41.Y; + float num396 = (float)Math.Sqrt((double)(num394 * num394 + num395 * num395)); + num396 = num393 / num396; + npc.velocity.X = num394 * num396; + npc.velocity.Y = num395 * num396; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 25f) + { + npc.velocity.X *= 0.96f; + npc.velocity.Y *= 0.96f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + if (npc.ai[2] >= 70f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num378; + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + // Enter phase 2 earlier + double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.85 : 0.7); + if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + npc.rotation += npc.ai[2]; + npc.ai[1] += 1f; + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + npc.ai[2] = 0f; + else + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + + int num; + for (int num397 = 0; num397 < 2; num397 = num + 1) + { + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 143, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); + num = num397; + } + + for (int num398 = 0; num398 < 20; num398 = num + 1) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + num = num398; + } + + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; + + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + { + // If in phase 2 but Spaz isn't + bool spazInPhase1 = false; + if (CalamityGlobalNPC.fireEye != -1) + { + if (Main.npc[CalamityGlobalNPC.fireEye].active) + spazInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f; + } + int defenseGain = spazInPhase1 ? 9999 : 20; + npc.chaseable = !spazInPhase1; + + npc.damage = (int)((double)npc.defDamage * 1.5); + npc.defense = npc.defDefense + defenseGain; + + npc.HitSound = SoundID.NPCHit4; + + if (npc.ai[1] == 0f) + { + float num399 = 9.5f; + float num400 = 0.175f; + if (CalamityWorld.bossRushActive) + { + num399 *= 1.5f; + num400 *= 1.5f; + } + + Vector2 vector42 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num401 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector42.X; + float num402 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector42.Y; + float num403 = (float)Math.Sqrt((double)(num401 * num401 + num402 * num402)); + num403 = num399 / num403; + num401 *= num403; + num402 *= num403; + + if (npc.velocity.X < num401) + { + npc.velocity.X += num400; + if (npc.velocity.X < 0f && num401 > 0f) + npc.velocity.X += num400; + } + else if (npc.velocity.X > num401) + { + npc.velocity.X -= num400; + if (npc.velocity.X > 0f && num401 < 0f) + npc.velocity.X -= num400; + } + if (npc.velocity.Y < num402) + { + npc.velocity.Y += num400; + if (npc.velocity.Y < 0f && num402 > 0f) + npc.velocity.Y += num400; + } + else if (npc.velocity.Y > num402) + { + npc.velocity.Y -= num400; + if (npc.velocity.Y > 0f && num402 < 0f) + npc.velocity.Y -= num400; + } + + npc.ai[2] += (spazAlive ? 1f : 1.25f); + + // Enrage + if (targetFloatingUp) + { + npc.ai[2] += 1f; + npc.localAI[1] += 2f; + } + + if (npc.ai[2] >= 300f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + + vector42 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num401 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector42.X; + num402 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector42.Y; + npc.rotation = (float)Math.Atan2((double)num402, (double)num401) - 1.57f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= (spazAlive ? 72f : 24f)) + { + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (canHit || !spazAlive || enrage) + { + npc.localAI[1] = 0f; + float num404 = CalamityWorld.bossRushActive ? 12f : 10f; + int num405 = 28; + int num406 = ProjectileID.DeathLaser; + + num403 = (float)Math.Sqrt((double)(num401 * num401 + num402 * num402)); + num403 = num404 / num403; + num401 *= num403; + num402 *= num403; + vector42.X += num401 * 15f; + vector42.Y += num402 * 15f; + + if (canHit) + Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, num406, num405, 0f, Main.myPlayer, 0f, 0f); + else + { + int proj = Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, num406, num405, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = 300; + } + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + int num408 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num408 = -1; + + float num409 = 9.5f; + float num410 = 0.25f; + if (CalamityWorld.bossRushActive) + { + num409 *= 1.5f; + num410 *= 1.5f; + } + + Vector2 vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num411 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num408 * 340) - vector43.X; + float num412 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector43.Y; + float num413 = (float)Math.Sqrt((double)(num411 * num411 + num412 * num412)); + num413 = num409 / num413; + num411 *= num413; + num412 *= num413; + + if (npc.velocity.X < num411) + { + npc.velocity.X += num410; + if (npc.velocity.X < 0f && num411 > 0f) + npc.velocity.X += num410; + } + else if (npc.velocity.X > num411) + { + npc.velocity.X -= num410; + if (npc.velocity.X > 0f && num411 < 0f) + npc.velocity.X -= num410; + } + if (npc.velocity.Y < num412) + { + npc.velocity.Y += num410; + if (npc.velocity.Y < 0f && num412 > 0f) + npc.velocity.Y += num410; + } + else if (npc.velocity.Y > num412) + { + npc.velocity.Y -= num410; + if (npc.velocity.Y > 0f && num412 < 0f) + npc.velocity.Y -= num410; + } + + vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num411 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector43.X; + num412 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector43.Y; + npc.rotation = (float)Math.Atan2((double)num412, (double)num411) - 1.57f; + + // Enrage + if (targetFloatingUp) + { + npc.ai[2] += 1f; + npc.localAI[1] += 2f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] > (spazAlive ? 24f : 8f)) + { + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (canHit || !spazAlive || enrage) + { + npc.localAI[1] = 0f; + float num414 = CalamityWorld.bossRushActive ? 11f : 9f; + int num415 = 21; + int num416 = ProjectileID.DeathLaser; + + num413 = (float)Math.Sqrt((double)(num411 * num411 + num412 * num412)); + num413 = num414 / num413; + num411 *= num413; + num412 *= num413; + vector43.X += num411 * 15f; + vector43.Y += num412 * 15f; + + if (canHit) + Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, num416, num415, 0f, Main.myPlayer, 0f, 0f); + else + { + int proj = Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, num416, num415, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = 300; + } + } + } + } + + npc.ai[2] += (spazAlive ? 1f : 1.5f); + if (npc.ai[2] >= 180f) + { + npc.ai[1] = ((!spazAlive || enrage) ? 4f : 0f); + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[1] == 2f) + { + // Set rotation and velocity + npc.rotation = num378; + float num450 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 24f : 22f); + + if (!spazAlive) + num450 += 2f; + + // Enrage + if (targetFloatingUp) + num450 += 2f; + + if (CalamityWorld.bossRushActive) + num450 *= 1.5f; + + Vector2 vector47 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num451 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector47.X; + float num452 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector47.Y; + float num453 = (float)Math.Sqrt((double)(num451 * num451 + num452 * num452)); + num453 = num450 / num453; + npc.velocity.X = num451 * num453; + npc.velocity.Y = num452 * num453; + npc.ai[1] = 3f; + } + + else if (npc.ai[1] == 3f) + { + npc.ai[2] += 1f; + + float chargeTime = (spazAlive ? 110f : 75f); + if (CalamityWorld.bossRushActive) + chargeTime *= 0.8f; + + // Slow down + if (npc.ai[2] >= chargeTime) + { + npc.velocity *= 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + float fireRate = (spazAlive ? 13f : 9f); + if (CalamityWorld.bossRushActive) + fireRate = 7f; + + if (npc.ai[2] % fireRate == 0f) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(SoundID.Item33, npc.position); + + float num353 = 6f; + int num354 = 30; + int num355 = mod.ProjectileType("ScavengerLaser"); + + vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num349 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector34.X; + num350 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num353 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349; + vector34.Y += num350; + + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num355, num354, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + // Charge once + if (npc.ai[2] >= chargeTime + 30f) + { + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num378; + npc.ai[1] = 1f; + } + } + + // Get in position for charge + else if (npc.ai[1] == 4f) + { + int num62 = (spazAlive ? 600 : 500); + float num63 = ((enraged || configBossRushBoost) ? 18f : 12f); + float num64 = ((enraged || configBossRushBoost) ? 0.45f : 0.3f); + + if (spazAlive) + { + num63 *= 0.75f; + num64 *= 0.75f; + } + + if (CalamityWorld.bossRushActive) + { + num63 *= 1.5f; + num64 *= 1.5f; + } + + int num408 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num408 = -1; + + Vector2 vector11 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num62 * num408) - vector11.X; + float num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector11.Y; + float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); + + num67 = num63 / num67; + num65 *= num67; + num66 *= num67; + + if (npc.velocity.X < num65) + { + npc.velocity.X += num64; + if (npc.velocity.X < 0f && num65 > 0f) + npc.velocity.X += num64; + } + else if (npc.velocity.X > num65) + { + npc.velocity.X -= num64; + if (npc.velocity.X > 0f && num65 < 0f) + npc.velocity.X -= num64; + } + if (npc.velocity.Y < num66) + { + npc.velocity.Y += num64; + if (npc.velocity.Y < 0f && num66 > 0f) + npc.velocity.Y += num64; + } + else if (npc.velocity.Y > num66) + { + npc.velocity.Y -= num64; + if (npc.velocity.Y > 0f && num66 < 0f) + npc.velocity.Y -= num64; + } + + // Take 1.25 or 1 second to get in position, then charge + npc.ai[2] += 1f; + if (npc.ai[2] >= (spazAlive ? 75f : 60f)) + { + npc.TargetClosest(true); + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedSpazmatismAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + // Enrage variable if player is floating upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + + // Easier to send info to Retinazer + CalamityGlobalNPC.fireEye = npc.whoAmI; + + // Check for Retinazer + bool retAlive = false; + if (CalamityGlobalNPC.laserEye != -1) + retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; + + bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive; + + // Get a target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); + + // Rotation + float num418 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); + float num419 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); + + float num420 = (float)Math.Atan2((double)num419, (double)num418) + 1.57f; + if (num420 < 0f) + num420 += 6.283f; + else if ((double)num420 > 6.283) + num420 -= 6.283f; + + float num421 = 0.15f; + if (npc.rotation < num420) + { + if ((double)(num420 - npc.rotation) > 3.1415) + npc.rotation -= num421; + else + npc.rotation += num421; + } + else if (npc.rotation > num420) + { + if ((double)(npc.rotation - num420) > 3.1415) + npc.rotation += num421; + else + npc.rotation -= num421; + } + + if (npc.rotation > num420 - num421 && npc.rotation < num420 + num421) + npc.rotation = num420; + + if (npc.rotation < 0f) + npc.rotation += 6.283f; + else if ((double)npc.rotation > 6.283) + npc.rotation -= 6.283f; + + if (npc.rotation > num420 - num421 && npc.rotation < num420 + num421) + npc.rotation = num420; // Dust if (Main.rand.NextBool(5)) { - int num422 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[num422]; - dust.velocity.X *= 0.5f; - dust.velocity.Y *= 0.1f; - } - - // Despawn Twins at the same time - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) - { - int num; - for (int num423 = 0; num423 < 200; num423 = num + 1) - { - if (num423 != npc.whoAmI && Main.npc[num423].active && (Main.npc[num423].type == NPCID.Retinazer || Main.npc[num423].type == NPCID.Spazmatism) && Main.npc[num423].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[num423].timeLeft - 1; - - num = num423; - } - } - - // Despawn - if (Main.dayTime | Main.player[npc.target].dead) - { - npc.velocity.Y -= 0.04f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return false; - } - } - - // Phase 1 - else if (npc.ai[0] == 0f) - { - // Cursed fireball phase - if (npc.ai[1] == 0f) - { - // New target - npc.TargetClosest(true); - - // Velocity - float num424 = 12f; - float num425 = 0.4f; - if (CalamityWorld.bossRushActive) - { - num424 *= 1.5f; - num425 *= 1.5f; - } - - int num426 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num426 = -1; - - Vector2 vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num426 * 400) - vector44.X; - float num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; - float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); - - num429 = num424 / num429; - num427 *= num429; - num428 *= num429; - - if (npc.velocity.X < num427) - { - npc.velocity.X += num425; - if (npc.velocity.X < 0f && num427 > 0f) - npc.velocity.X += num425; - } - else if (npc.velocity.X > num427) - { - npc.velocity.X -= num425; - if (npc.velocity.X > 0f && num427 < 0f) - npc.velocity.X -= num425; - } - if (npc.velocity.Y < num428) - { - npc.velocity.Y += num425; - if (npc.velocity.Y < 0f && num428 > 0f) - npc.velocity.Y += num425; - } - else if (npc.velocity.Y > num428) - { - npc.velocity.Y -= num425; - if (npc.velocity.Y > 0f && num428 < 0f) - npc.velocity.Y -= num425; - } - - // Fire cursed flames for 5 seconds - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - // Reset AI array and go to charging phase - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - else - { - // Fire cursed flame every half second - if (!Main.player[npc.target].dead) - npc.ai[3] += 1f; - - if (npc.ai[3] >= 30f) - { - npc.ai[3] = 0f; - vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector44.X; - num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num430 = CalamityWorld.bossRushActive ? 20f : 15f; - int num431 = 27; - int num432 = ProjectileID.CursedFlameHostile; - - num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - num427 += (float)Main.rand.Next(-10, 11) * 0.05f; - num428 += (float)Main.rand.Next(-10, 11) * 0.05f; - vector44.X += num427 * 4f; - vector44.Y += num428 * 4f; - - Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, num431, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - // Charging phase - else if (npc.ai[1] == 1f) - { - // Rotation and velocity - npc.rotation = num420; - float num434 = CalamityWorld.bossRushActive ? 24f : 16f; - Vector2 vector45 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num435 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector45.X; - float num436 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector45.Y; - float num437 = (float)Math.Sqrt((double)(num435 * num435 + num436 * num436)); - num437 = num434 / num437; - npc.velocity.X = num435 * num437; - npc.velocity.Y = num436 * num437; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - - float timeBeforeSlowDown = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 15f : 12f; - if (npc.ai[2] >= timeBeforeSlowDown) - { - // Slow down - npc.velocity.X *= 0.9f; - npc.velocity.Y *= 0.9f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - // Charge 8 times - float chargeTime = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 35f : 38f; - if (npc.ai[2] >= chargeTime) - { - // Reset AI array and go to cursed fireball phase - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num420; - if (npc.ai[3] >= 8f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - // Enter phase 2 earlier - double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.85 : 0.7); - if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) - { - // Reset AI array and go to transition phase - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - - // Transition phase - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - // AI timer for rotation - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - // Spin around like a moron while flinging blood and gore everywhere - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - - if (npc.ai[0] == 3f) - npc.ai[2] = 0f; - else - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - - int num; - for (int num438 = 0; num438 < 2; num438 = num + 1) - { - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 144, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); - num = num438; - } - - for (int num439 = 0; num439 < 20; num439 = num + 1) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - num = num439; - } - - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - - // Phase 2 - else - { - // If in phase 2 but Ret isn't - bool retInPhase1 = false; - if (CalamityGlobalNPC.laserEye != -1) - { - if (Main.npc[CalamityGlobalNPC.laserEye].active) - retInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f; - } - int defenseGain = retInPhase1 ? 9999 : 30; - npc.chaseable = !retInPhase1; - - // Increase defense and damage - npc.damage = (int)((double)npc.defDamage * 1.5); - npc.defense = npc.defDefense + defenseGain; - - // Change hit sound to metal - npc.HitSound = SoundID.NPCHit4; - - // Shadowflamethrower phase - if (npc.ai[1] == 0f) - { - float num440 = 6.2f; - float num441 = 0.1f; - if (CalamityWorld.bossRushActive) - { - num440 *= 1.5f; - num441 *= 1.5f; - } - - int num442 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num442 = -1; - - Vector2 vector46 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num443 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num442 * 180) - vector46.X; - float num444 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector46.Y; - float num445 = (float)Math.Sqrt((double)(num443 * num443 + num444 * num444)); - - // Boost speed if too far from target - if (num445 > 300f) - num440 += 0.5f; - if (num445 > 400f) - num440 += 0.5f; - - // Enrage - if (targetFloatingUp) - num440 += 2f; - - // Speed increase - if (enraged || configBossRushBoost) - num440 += 2f; - - num445 = num440 / num445; - num443 *= num445; - num444 *= num445; - - if (npc.velocity.X < num443) - { - npc.velocity.X += num441; - if (npc.velocity.X < 0f && num443 > 0f) - npc.velocity.X += num441; - } - else if (npc.velocity.X > num443) - { - npc.velocity.X -= num441; - if (npc.velocity.X > 0f && num443 < 0f) - npc.velocity.X -= num441; - } - if (npc.velocity.Y < num444) - { - npc.velocity.Y += num441; - if (npc.velocity.Y < 0f && num444 > 0f) - npc.velocity.Y += num441; - } - else if (npc.velocity.Y > num444) - { - npc.velocity.Y -= num441; - if (npc.velocity.Y > 0f && num444 < 0f) - npc.velocity.Y -= num441; - } - - // Fire flamethrower for x seconds - npc.ai[2] += (retAlive ? 1f : 2f); - if (npc.ai[2] >= 180f) - { - npc.ai[1] = ((!retAlive || enrage) ? 5f : 1f); - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - - // Fire fireballs and flamethrower - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !retAlive || enrage) - { - // Play flame sound on timer - npc.localAI[2] += 1f; - if (npc.localAI[2] > 22f) - { - npc.localAI[2] = 0f; - Main.PlaySound(SoundID.Item34, npc.position); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] > 2f) - { - npc.localAI[1] = 0f; - - float num446 = CalamityWorld.bossRushActive ? 9f : 6f; - - int num447 = 33; - int num448 = mod.ProjectileType("Shadowflamethrower"); - - vector46 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num443 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector46.X; - num444 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector46.Y; - num445 = (float)Math.Sqrt((double)(num443 * num443 + num444 * num444)); - num445 = num446 / num445; - num443 *= num445; - num444 *= num445; - num444 += (float)Main.rand.Next(-10, 11) * 0.01f; - num443 += (float)Main.rand.Next(-10, 11) * 0.01f; - num444 += npc.velocity.Y * 0.5f; - num443 += npc.velocity.X * 0.5f; - vector46.X -= num443 * 1f; - vector46.Y -= num444 * 1f; - - if (canHit) - Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, num448, num447, 0f, Main.myPlayer, 0f, 0f); - else - { - int proj = Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, num448, num447, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].tileCollide = false; - } - } - } - } - } - - // Charging phase - else - { - // Charge - if (npc.ai[1] == 1f) - { - // Play charge sound - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - - // Set rotation and velocity - npc.rotation = num420; - float num450 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 17f : 16.75f); - - // Enrage - if (targetFloatingUp) - num450 += 2f; - - if (CalamityWorld.bossRushActive) - num450 *= 1.5f; - - Vector2 vector47 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num451 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector47.X; - float num452 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector47.Y; - float num453 = (float)Math.Sqrt((double)(num451 * num451 + num452 * num452)); - num453 = num450 / num453; - npc.velocity.X = num451 * num453; - npc.velocity.Y = num452 * num453; - npc.ai[1] = 2f; - return false; - } - - if (npc.ai[1] == 2f) - { - npc.ai[2] += (retAlive ? 1f : 1.25f); - - // Enrage - if (targetFloatingUp) - npc.ai[2] += 0.25f; - - if (CalamityWorld.bossRushActive) - npc.ai[2] += 0.4f; - - float chargeTime = 50f; - - // Slow down - if (npc.ai[2] >= chargeTime) - { - npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - // Charges 5 times - if (npc.ai[2] >= chargeTime + 30f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num420; - if (npc.ai[3] >= 5f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return false; - } - npc.ai[1] = 1f; - } - } - - // Crazy charge - else if (npc.ai[1] == 3f) - { - // Reset AI array and go to shadowflamethrower phase or fireball phase if ret is dead - float secondFastCharge = 4f; - if (npc.ai[3] >= (retAlive ? secondFastCharge : secondFastCharge + 1f)) - { - npc.TargetClosest(true); - npc.ai[1] = (retAlive ? 0f : 5f); - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (npc.ai[1] == 0f) - npc.localAI[1] = -20f; - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - - // Set charging velocity - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Get a target - npc.TargetClosest(true); - - // Velocity - float num48 = ((enraged || configBossRushBoost) ? 30f : 20f); - if (CalamityWorld.bossRushActive) - num48 *= 1.5f; - if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) - num48 *= 1.3f; - - Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num49 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector10.X; - float num50 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector10.Y; - float num51 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); - float num52 = num51; - - num51 = num48 / num51; - npc.velocity.X = num49 * num51; - npc.velocity.Y = num50 * num51; - - if (retAlive) - { - if (num52 < 100f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num56 = Math.Abs(npc.velocity.X); - float num57 = Math.Abs(npc.velocity.Y); - - if (npc.Center.X > Main.player[npc.target].Center.X) - num57 *= -1f; - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num56 *= -1f; - - npc.velocity.X = num57; - npc.velocity.Y = num56; - } - } - } - - npc.ai[1] = 4f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - // Crazy charge - else if (npc.ai[1] == 4f) - { - if (npc.ai[2] == 0f) - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - - float num60 = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f); - if (CalamityWorld.bossRushActive) - num60 *= 0.8f; - - npc.ai[2] += 1f; - - if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < (retAlive ? 200f : 150f)) - npc.ai[2] -= 1f; - - // Slow down - if (npc.ai[2] >= num60) - { - npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - - // Charge 3 times - float num61 = num60 + 25f; - if (npc.ai[2] >= num61) - { - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.ai[1] = 3f; - } - } - - // Get in position for charge - else if (npc.ai[1] == 5f) - { - float num62 = (retAlive ? 600f : 500f); - float num63 = ((enraged || configBossRushBoost) ? 24f : 16f); - float num64 = ((enraged || configBossRushBoost) ? 0.6f : 0.4f); - - if (retAlive) - { - num63 *= 0.75f; - num64 *= 0.75f; - } - - if (CalamityWorld.bossRushActive) - { - num63 *= 1.5f; - num64 *= 1.5f; - } - - Vector2 vector11 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector11.X; - float num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) + num62 - vector11.Y; - float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); - - num67 = num63 / num67; - num65 *= num67; - num66 *= num67; - - if (npc.velocity.X < num65) - { - npc.velocity.X += num64; - if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X += num64; - } - else if (npc.velocity.X > num65) - { - npc.velocity.X -= num64; - if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X -= num64; - } - if (npc.velocity.Y < num66) - { - npc.velocity.Y += num64; - if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y += num64; - } - else if (npc.velocity.Y > num66) - { - npc.velocity.Y -= num64; - if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y -= num64; - } - - npc.ai[2] += 1f; - - // Fire shadowflames - float fireRate = (retAlive ? 30f : 20f); - if (npc.ai[2] % fireRate == 0f) - { - Vector2 vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector44.X; - float num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num430 = 16f; - int num431 = 31; - int num432 = mod.ProjectileType("Shadowflame"); - - float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - vector44.X += num427 * 4f; - vector44.Y += num428 * 4f; - - Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, num431, 0f, Main.myPlayer, 0f, (retAlive ? 0f : 1f)); - } - } - - // Take 3 seconds to get in position, then charge - if (npc.ai[2] >= (retAlive ? 180f : 135f)) - { - npc.TargetClosest(true); - npc.ai[1] = 3f; - npc.ai[2] = -1f; - npc.netUpdate = true; - } - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Skeletron Prime AI - public static bool BuffedSkeletronPrimeAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - // Enrage variable if player is floating upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; - - // Spawn arms - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(true); - npc.ai[0] = 1f; - - int arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeCannon, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = (float)npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeSaw, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = (float)npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeVice, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = (float)npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].ai[3] = 150f; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeLaser, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = (float)npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - Main.npc[arm].ai[3] = 150f; - } - - // Check if arms are alive - bool cannonAlive = false; - bool laserAlive = false; - bool viceAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive; - npc.chaseable = allArmsDead; - - // Set stats - if (npc.ai[1] == 5f) - npc.damage = 0; - else if (allArmsDead) - { - npc.damage = npc.defDamage; - npc.defense = npc.defDefense; - } - else - npc.defense = 9999; - - // Phases - bool phase2 = (double)npc.life < (double)npc.lifeMax * 0.66; - bool phase3 = (double)npc.life < (double)npc.lifeMax * 0.33; - - // Despawn - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - npc.ai[1] = 3f; - } - - // Activate daytime enrage - if (Main.dayTime && !CalamityWorld.bossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - // Heal - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = npc.life - 300; - if (healAmt < 0) - { - int absHeal = Math.Abs(healAmt); - npc.life += absHeal; - npc.HealEffect(absHeal, true); - npc.netUpdate = true; - } - } - - npc.ai[1] = 2f; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - - // Float near player - if (npc.ai[1] == 0f || npc.ai[1] == 4f) - { - // Start other phases if arms are dead, start with spinning phase - if (allArmsDead) - { - // Start spin phase after 5 seconds - npc.ai[2] += (phase3 ? 1.25f : 1f); - if (npc.ai[2] >= 300f) - { - bool shouldSpinAroundTarget = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 400f && - Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; - - if (shouldSpinAroundTarget || npc.ai[1] != 4f) - { - if (shouldSpinAroundTarget) - npc.ai[3] = Vector2.Distance(Main.player[npc.target].Center, npc.Center); - - npc.ai[2] = 0f; - npc.ai[1] = (shouldSpinAroundTarget ? 5f : 1f); - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Ring of lasers if laser is dead - if (!laserAlive) - { - npc.localAI[1] += (allArmsDead ? 2f : 1f); - if (phase3) - npc.localAI[1] += 1f; - - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 450f : 480f)) - { - npc.localAI[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - int totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; - int damage = 31; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 - int proj = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - int proj2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj2].timeLeft = 300; - } - } - } - - // Spread of rockets if cannon is dead - if (!cannonAlive) - { - npc.localAI[2] += (allArmsDead ? 2f : 1f); - if (phase3) - npc.localAI[2] += 1f; - - if (npc.localAI[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 215f : 240f)) - { - npc.localAI[2] = 0f; - float num502 = CalamityWorld.bossRushActive ? 12f : 8f; - int num503 = 33; - int num504 = ProjectileID.RocketSkeleton; - Vector2 value19 = Main.player[npc.target].Center - npc.Center; - value19.Normalize(); - value19 *= num502; - int numProj = 2; - float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num504, num503, 0f, Main.myPlayer, 0f, 1f); - } - } - } - } - - npc.rotation = npc.velocity.X / 15f; - - float velocity2 = CalamityWorld.bossRushActive ? 4f : 2f; - float acceleration = CalamityWorld.bossRushActive ? 0.2f : 0.1f; - if (!cannonAlive) - { - velocity2 += 1f; - acceleration += 0.025f; - } - if (!laserAlive) - { - velocity2 += 1f; - acceleration += 0.025f; - } - if (!viceAlive) - { - velocity2 += 1f; - acceleration += 0.025f; - } - if (!sawAlive) - { - velocity2 += 1f; - acceleration += 0.025f; - } - - if (npc.position.Y > Main.player[npc.target].position.Y - 350f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocity2) - npc.velocity.Y = velocity2; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 500f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocity2) - npc.velocity.Y = -velocity2; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 150f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 150f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - } - - else - { - // Spinning - if (npc.ai[1] == 1f) - { - npc.defense *= 2; - npc.damage *= 2; - - if (phase2) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 39f : 45f)) - { - npc.localAI[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - int totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; - int damage = 31; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 - int proj = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - int proj2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj2].timeLeft = 300; - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] == 2f) - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - - // Spin for 3 seconds then return to floating phase - float phaseTimer = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 150f : 180f); - if (phase2 && !phase3) - phaseTimer += 120f; - - if (npc.ai[2] >= phaseTimer) - { - npc.ai[2] = 0f; - npc.ai[1] = 4f; - } - - npc.rotation += (float)npc.direction * 0.3f; - Vector2 vector48 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num455 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector48.X; - float num456 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector48.Y; - float num457 = (float)Math.Sqrt((double)(num455 * num455 + num456 * num456)); - - float speed = CalamityWorld.bossRushActive ? 7f : 3f; - if (phase2 || CalamityWorld.bossRushActive) - speed += 1f; - if (phase3 || CalamityWorld.bossRushActive) - speed += 1f; - if (enraged || configBossRushBoost) - speed += 3f; - if (targetFloatingUp) - speed += 5f; - - float speedBuff = 3f + (3f * (1f - (float)npc.life / (float)npc.lifeMax)); - float speedBuff2 = 8f + (8f * (1f - (float)npc.life / (float)npc.lifeMax)); - - speed += num457 / 100f; - if (speed < speedBuff) - speed = speedBuff; - if (speed > speedBuff2) - speed = speedBuff2; - - num457 = speed / num457; - npc.velocity.X = num455 * num457; - npc.velocity.Y = num456 * num457; - } - - // Daytime enrage - if (npc.ai[1] == 2f) - { - npc.damage = 1000; - npc.defense = 9999; - - npc.rotation += (float)npc.direction * 0.3f; - - Vector2 vector49 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num458 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector49.X; - float num459 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector49.Y; - float num460 = (float)Math.Sqrt((double)(num458 * num458 + num459 * num459)); - - float num461 = 10f; - num461 += num460 / 100f; - if (num461 < 8f) - num461 = 8f; - if (num461 > 32f) - num461 = 32f; - - num460 = num461 / num460; - npc.velocity.X = num458 * num460; - npc.velocity.Y = num459 * num460; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 54f : 60f)) - { - npc.localAI[0] = 0f; - Vector2 vector16 = npc.Center; - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num159 = 7f; - float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - - Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - value += npc.velocity; - num160 = value.X; - num161 = value.Y; - - int num163 = 250; - int num164 = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; - } - } - } - } - - // Despawning - if (npc.ai[1] == 3f) - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - - if (npc.timeLeft > 500) - npc.timeLeft = 500; - } - - // Fly around target in a circle and spawn probes - if (npc.ai[1] == 5f) - { - npc.ai[2] += 1f; - - npc.rotation = npc.velocity.X / 30f; - - // Spin for 3 seconds - float spinVelocity = 45f; - if (npc.ai[2] == 2f) - { - // Play angry noise - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - - // Set spin direction - if (Main.player[npc.target].velocity.X > 0) - calamityGlobalNPC.newAI[0] = 1f; - else if (Main.player[npc.target].velocity.X < 0) - calamityGlobalNPC.newAI[0] = -1f; - else - calamityGlobalNPC.newAI[0] = (float)Main.player[npc.target].direction; - - // Set spin velocity - npc.velocity.X = 3.14159265f * npc.ai[3] / spinVelocity; - npc.velocity *= -calamityGlobalNPC.newAI[0]; - npc.netUpdate = true; - } - - // Spawn 6 Probes and maintain velocity, or spit skulls if probes are alive - else - { - npc.velocity = npc.velocity.RotatedBy(3.14159265 / spinVelocity * -calamityGlobalNPC.newAI[0]); - if (npc.ai[2] % 30f == 0f) - { - calamityGlobalNPC.newAI[1] += 1f; - - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 64f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (NPC.CountNPCS(NPCID.Probe) < 6) - NPC.NewNPC((int)npc.Center.X, (int)(npc.Center.Y + 4f), NPCID.Probe); - else - { - Vector2 vector16 = npc.Center; - float num159 = CalamityWorld.bossRushActive ? 6f : 4f; - float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - - Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - num160 = value.X; - num161 = value.Y; - - int num163 = 28; - int num164 = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 180; - Main.projectile[num165].tileCollide = false; - } - } - } - - // Go to floating phase, or spinning phase if in phase 2 - if (calamityGlobalNPC.newAI[1] >= 6f) - { - npc.velocity.Normalize(); - - // Fly overhead and spit missiles if on low health - npc.ai[1] = (phase3 ? 6f : 1f); - npc.ai[2] = 0f; - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - npc.netUpdate = true; - } - } - } - } - - // Fly overhead and spit missiles - if (npc.ai[1] == 6f) - { - npc.ai[2] += 1f; - - npc.rotation = npc.velocity.X / 15f; - - float flightVelocity = CalamityWorld.bossRushActive ? 15f : 10f; - float fligthAcceleration = CalamityWorld.bossRushActive ? 0.18f : 0.12f; - - // Spit homing missiles and then go to floating phase - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float posX = Main.player[npc.target].Center.X - center.X; - float posY = Main.player[npc.target].Center.Y - center.Y - 500f; - - float distance = (float)Math.Sqrt((double)(posX * posX + posY * posY)); - if (distance < 20f) - { - posX = npc.velocity.X; - posY = npc.velocity.Y; - } - else - { - distance = flightVelocity / distance; - posX *= distance; - posY *= distance; - } - - if (npc.velocity.X < posX) - { - npc.velocity.X += fligthAcceleration; - if (npc.velocity.X < 0f && posX > 0f) - npc.velocity.X += fligthAcceleration; - } - else if (npc.velocity.X > posX) - { - npc.velocity.X -= fligthAcceleration; - if (npc.velocity.X > 0f && posX < 0f) - npc.velocity.X -= fligthAcceleration; - } - if (npc.velocity.Y < posY) - { - npc.velocity.Y += fligthAcceleration; - if (npc.velocity.Y < 0f && posY > 0f) - npc.velocity.Y += fligthAcceleration; - } - else if (npc.velocity.Y > posY) - { - npc.velocity.Y -= fligthAcceleration; - if (npc.velocity.Y > 0f && posY < 0f) - npc.velocity.Y -= fligthAcceleration; - } - - if (npc.ai[2] % 12f == 0f) - { - calamityGlobalNPC.newAI[1] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); - velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default); - velocity *= (CalamityWorld.bossRushActive ? 7.5f : 5f); - int damage = 33; - float delayBeforeHoming = CalamityWorld.bossRushActive ? 30f : 45f; - Projectile.NewProjectile(npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, ProjectileID.SaucerMissile, damage, 0f, Main.myPlayer, 0f, delayBeforeHoming); - } - - Main.PlaySound(SoundID.Item39, npc.Center); - - if (calamityGlobalNPC.newAI[1] >= 10f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.localAI[1] = -90f; - npc.localAI[2] = -90f; - npc.netUpdate = true; - } - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) - { - // Set direction - npc.spriteDirection = -(int)npc.ai[0]; - - // Despawn if head is gone - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeLaser = npc.whoAmI; - - // Check if arms are alive - bool cannonAlive = false; - bool viceAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - - // Phase 1 - if (npc.ai[2] == 0f) - { - // Despawn if head is despawning - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - // Go to other phase after 13.3 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!cannonAlive) - npc.ai[3] += 1f; - if (!viceAlive) - npc.ai[3] += 1f; - if (!sawAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 680f : 800f)) - { - npc.localAI[0] = 0f; - npc.ai[2] = 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.21f : 0.14f); - - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.21f : 0.14f); - - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - - npc.TargetClosest(true); - Vector2 vector62 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num506 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector62.X; - float num507 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector62.Y; - float num508 = (float)Math.Sqrt((double)(num506 * num506 + num507 * num507)); - npc.rotation = (float)Math.Atan2((double)num507, (double)num506) - 1.57f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!cannonAlive) - npc.localAI[0] += 1f; - if (!viceAlive) - npc.localAI[0] += 1f; - if (!sawAlive) - npc.localAI[0] += 1f; - - if (npc.localAI[0] >= 90f) - { - npc.localAI[0] = 0f; - float num509 = CalamityWorld.bossRushActive ? 13f : 11f; - int num510 = 31; - int num511 = ProjectileID.DeathLaser; - num508 = num509 / num508; - num506 *= num508; - num507 *= num508; - vector62.X += num506 * 8f; - vector62.Y += num507 * 8f; - Projectile.NewProjectile(vector62.X, vector62.Y, num506, num507, num511, num510, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - // Other phase, get closer to the player and fire ring of lasers - else if (npc.ai[2] == 1f) - { - // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) - npc.ai[3] += 1f; - - float timeLimit = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 150f : 135f); - float timeMult = 1.882075f; - if (!cannonAlive) - timeLimit *= timeMult; - if (!viceAlive) - timeLimit *= timeMult; - if (!sawAlive) - timeLimit *= timeMult; - - if (npc.ai[3] >= timeLimit) - { - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - Vector2 vector63 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num513 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 350f - vector63.X; - float num514 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 120f - vector63.Y; // Used to be 20f - float num515 = (float)Math.Sqrt((double)(num513 * num513 + num514 * num514)); - num515 = (CalamityWorld.bossRushActive ? 10f : 7f) / num515; - num513 *= num515; - num514 *= num515; - - if (npc.velocity.X > num513) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - } - if (npc.velocity.X < num513) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - } - if (npc.velocity.Y > num514) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.09f : 0.06f); - } - if (npc.velocity.Y < num514) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.09f : 0.06f); - } - - npc.TargetClosest(true); - vector63 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num513 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector63.X; - num514 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector63.Y; - num515 = (float)Math.Sqrt((double)(num513 * num513 + num514 * num514)); - npc.rotation = (float)Math.Atan2((double)num514, (double)num513) - 1.57f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!cannonAlive) - npc.localAI[0] += 0.5f; - if (!viceAlive) - npc.localAI[0] += 0.5f; - if (!sawAlive) - npc.localAI[0] += 0.5f; - - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - int totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; - int damage = 31; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeCannon = npc.whoAmI; - - // Check if arms are alive - bool laserAlive = false; - bool viceAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - - bool fireSlower = false; - if (laserAlive) - { - // If laser is firing ring of lasers - if (Main.npc[CalamityGlobalNPC.primeLaser].ai[2] == 1f) - fireSlower = true; - } - else - { - fireSlower = npc.ai[2] == 0f; - - if (fireSlower) - { - // Go to other phase after 13.33 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!laserAlive) - npc.ai[3] += 1f; - if (!viceAlive) - npc.ai[3] += 1f; - if (!sawAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 680f : 800f)) - { - npc.localAI[0] = 0f; - npc.ai[2] = 1f; - fireSlower = false; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else - { - // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) - npc.ai[3] += 1f; - - float timeLimit = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 145f : 120f); - float timeMult = 1.882075f; - if (!laserAlive) - timeLimit *= timeMult; - if (!viceAlive) - timeLimit *= timeMult; - if (!sawAlive) - timeLimit *= timeMult; - - if (npc.ai[3] >= timeLimit) - { - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - fireSlower = true; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - } - - if (fireSlower) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); - - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 200f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.3f : 0.2f); - - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 160f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.3f : 0.2f); - - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - - Vector2 vector60 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num492 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector60.X; - float num493 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector60.Y; - float num494 = (float)Math.Sqrt((double)(num492 * num492 + num493 * num493)); - npc.rotation = (float)Math.Atan2((double)num493, (double)num492) - 1.57f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Fire rocket every 2 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!laserAlive) - npc.localAI[0] += 1f; - if (!viceAlive) - npc.localAI[0] += 1f; - if (!sawAlive) - npc.localAI[0] += 1f; - - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - float num495 = CalamityWorld.bossRushActive ? 12f : 8f; - int num496 = 33; - int num497 = ProjectileID.RocketSkeleton; - num494 = num495 / num494; - num492 *= num494; - num493 *= num494; - vector60.X += num492 * 5f; - vector60.Y += num493 * 5f; - Projectile.NewProjectile(vector60.X, vector60.Y, num492, num493, num497, num496, 0f, Main.myPlayer, 0f, 1f); - } - } - } - - else - { - Vector2 vector61 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num499 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector61.X; - float num500 = Main.npc[(int)npc.ai[1]].position.Y - vector61.Y; - num500 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 80f - vector61.Y; - float num501 = (float)Math.Sqrt((double)(num499 * num499 + num500 * num500)); - num501 = (CalamityWorld.bossRushActive ? 10f : 7f) / num501; - num499 *= num501; - num500 *= num501; - - if (npc.velocity.X > num499) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); - } - if (npc.velocity.X < num499) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); - } - if (npc.velocity.Y > num500) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); - } - if (npc.velocity.Y < num500) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); - } - - npc.TargetClosest(true); - vector61 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num499 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector61.X; - num500 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector61.Y; - num501 = (float)Math.Sqrt((double)(num499 * num499 + num500 * num500)); - npc.rotation = (float)Math.Atan2((double)num500, (double)num499) - 1.57f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Fire rockets every 2 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!laserAlive) - npc.localAI[0] += 0.5f; - if (!viceAlive) - npc.localAI[0] += 0.5f; - if (!sawAlive) - npc.localAI[0] += 0.5f; - - if (npc.localAI[0] >= 180f) - { - npc.localAI[0] = 0f; - float num502 = CalamityWorld.bossRushActive ? 12f : 8f; - int num503 = 33; - int num504 = ProjectileID.RocketSkeleton; - Vector2 value19 = Main.player[npc.target].Center - npc.Center; - value19.Normalize(); - value19 *= num502; - int numProj = 2; - float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num504, num503, 0f, Main.myPlayer, 0f, 1f); - } - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedPrimeViceAI(NPC npc, Mod mod) - { - // Direction - npc.spriteDirection = -(int)npc.ai[0]; - - // Where the vice should be in relation to the head - Vector2 vector55 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num477 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector55.X; - float num478 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector55.Y; - float num479 = (float)Math.Sqrt((double)(num477 * num477 + num478 * num478)); - - // Return the vice to its proper location in relation to the head if it's too far away - if (npc.ai[2] != 99f) - { - if (num479 > 800f) - npc.ai[2] = 99f; - } - else if (num479 < 400f) - npc.ai[2] = 0f; - - // Despawn if head is gone - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeVice = npc.whoAmI; - - // Check if arms are alive - bool cannonAlive = false; - bool laserAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - - // Return to the head - if (npc.ai[2] == 99f) - { - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y > 8f) - npc.velocity.Y = 8f; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.75f : 0.5f); - - if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.75f : 0.5f); - - if (npc.velocity.X < -12f) - npc.velocity.X = -12f; - } - } - - // Other phases - else - { - // Stay near the head - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - // Despawn if head is despawning - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - // Start charging after 10 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!cannonAlive) - npc.ai[3] += 1f; - if (!laserAlive) - npc.ai[3] += 1f; - if (!sawAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 540f : 600f)) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 250f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.94f; - - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.45f : 0.3f); - - if (npc.velocity.X > 9f) - npc.velocity.X = 9f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.94f; - - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.3f : 0.2f); - - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - - Vector2 vector57 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num483 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector57.X; - float num484 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector57.Y; - float num485 = (float)Math.Sqrt((double)(num483 * num483 + num484 * num484)); - npc.rotation = (float)Math.Atan2((double)num484, (double)num483) + 1.57f; - return false; - } - - // Charge towards the player - if (npc.ai[2] == 1f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - Vector2 vector58 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num486 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 280f * npc.ai[0] - vector58.X; - float num487 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector58.Y; - float num488 = (float)Math.Sqrt((double)(num486 * num486 + num487 * num487)); - npc.rotation = (float)Math.Atan2((double)num487, (double)num486) + 1.57f; - - npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; - npc.velocity.X += 0.5f; - - npc.velocity.Y -= 0.5f; - if (npc.velocity.Y < -9f) - npc.velocity.Y = -9f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) - { - float chargeVelocity = CalamityWorld.bossRushActive ? 24f : 16f; - if (!cannonAlive) - chargeVelocity += 1.5f; - if (!laserAlive) - chargeVelocity += 1.5f; - if (!sawAlive) - chargeVelocity += 1.5f; - - npc.TargetClosest(true); - npc.ai[2] = 2f; - vector58 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num486 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector58.X; - num487 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector58.Y; - num488 = (float)Math.Sqrt((double)(num486 * num486 + num487 * num487)); - num488 = chargeVelocity / num488; - npc.velocity.X = num486 * num488; - npc.velocity.Y = num487 * num488; - npc.netUpdate = true; - } - } - - // Charge 4 times (more if arms are dead) - else if (npc.ai[2] == 2f) - { - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - { - float chargeAmt = 4f; - if (!cannonAlive) - chargeAmt += 1f; - if (!laserAlive) - chargeAmt += 1f; - if (!sawAlive) - chargeAmt += 1f; - - if (npc.ai[3] >= chargeAmt) - { - // Return to head - npc.ai[2] = 3f; - npc.ai[3] = 0f; - return false; - } - - npc.ai[2] = 1f; - npc.ai[3] += 1f; - } - } - - // Different type of charge - else if (npc.ai[2] == 4f) - { - Vector2 vector59 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num489 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector59.X; - float num490 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector59.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - npc.rotation = (float)Math.Atan2((double)num490, (double)num489) + 1.57f; - - npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; - - npc.velocity.X += 0.5f; - if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) - { - float chargeVelocity = CalamityWorld.bossRushActive ? 21f : 14f; - if (!cannonAlive) - chargeVelocity += 1.15f; - if (!laserAlive) - chargeVelocity += 1.15f; - if (!sawAlive) - chargeVelocity += 1.15f; - - npc.TargetClosest(true); - npc.ai[2] = 5f; - vector59 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num489 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector59.X; - num490 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector59.Y; - num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - num491 = chargeVelocity / num491; - npc.velocity.X = num489 * num491; - npc.velocity.Y = num490 * num491; - npc.netUpdate = true; - } - } - - // Charge 4 times (more if arms are dead) - else if (npc.ai[2] == 5f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) - { - float chargeAmt = 4f; - if (!cannonAlive) - chargeAmt += 1f; - if (!laserAlive) - chargeAmt += 1f; - if (!sawAlive) - chargeAmt += 1f; - - if (npc.ai[3] >= chargeAmt) - { - // Return to head - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return false; - } - - npc.ai[2] = 4f; - npc.ai[3] += 1f; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedPrimeSawAI(NPC npc, Mod mod) - { - Vector2 vector50 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num462 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector50.X; - float num463 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector50.Y; - float num464 = (float)Math.Sqrt((double)(num462 * num462 + num463 * num463)); - - if (npc.ai[2] != 99f) - { - if (num464 > 800f) - npc.ai[2] = 99f; - } - else if (num464 < 400f) - npc.ai[2] = 0f; - - npc.spriteDirection = -(int)npc.ai[0]; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeSaw = npc.whoAmI; - - // Check if arms are alive - bool cannonAlive = false; - bool laserAlive = false; - bool viceAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - - if (npc.ai[2] == 99f) - { - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y > 8f) - npc.velocity.Y = 8f; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.75f : 0.5f); - - if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.75f : 0.5f); - - if (npc.velocity.X < -12f) - npc.velocity.X = -12f; - } - } - else - { - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - // Start charging after 3 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!cannonAlive) - npc.ai[3] += 1f; - if (!laserAlive) - npc.ai[3] += 1f; - if (!viceAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 165f : 180f)) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); - - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - } - - if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.45f : 0.3f); - - if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 250f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.45f : 0.3f); - - if (npc.velocity.X < -12f) - npc.velocity.X = -12f; - } - - Vector2 vector52 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num468 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector52.X; - float num469 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector52.Y; - float num470 = (float)Math.Sqrt((double)(num468 * num468 + num469 * num469)); - npc.rotation = (float)Math.Atan2((double)num469, (double)num468) + 1.57f; - return false; - } - - if (npc.ai[2] == 1f) - { - Vector2 vector53 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num471 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector53.X; - float num472 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector53.Y; - float num473 = (float)Math.Sqrt((double)(num471 * num471 + num472 * num472)); - npc.rotation = (float)Math.Atan2((double)num472, (double)num471) + 1.57f; - - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.3f; - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - float chargeVelocity = CalamityWorld.bossRushActive ? 33f : 22f; - if (!cannonAlive) - chargeVelocity += 1.5f; - if (!laserAlive) - chargeVelocity += 1.5f; - if (!viceAlive) - chargeVelocity += 1.5f; - - npc.TargetClosest(true); - npc.ai[2] = 2f; - vector53 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num471 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector53.X; - num472 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector53.Y; - num473 = (float)Math.Sqrt((double)(num471 * num471 + num472 * num472)); - num473 = chargeVelocity / num473; - npc.velocity.X = num471 * num473; - npc.velocity.Y = num472 * num473; - npc.netUpdate = true; - } - } - - else if (npc.ai[2] == 2f) - { - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - npc.ai[2] = 3f; - } - - else - { - if (npc.ai[2] == 4f) - { - float chargeVelocity = CalamityWorld.bossRushActive ? 16f : 11f; - if (!cannonAlive) - chargeVelocity += 1.5f; - if (!laserAlive) - chargeVelocity += 1.5f; - if (!viceAlive) - chargeVelocity += 1.5f; - - npc.TargetClosest(true); - Vector2 vector54 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num474 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector54.X; - float num475 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector54.Y; - float num476 = (float)Math.Sqrt((double)(num474 * num474 + num475 * num475)); - num476 = chargeVelocity / num476; - num474 *= num476; - num475 *= num476; - - if (npc.velocity.X > num474) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.97f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.075f : 0.05f); - } - if (npc.velocity.X < num474) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.97f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.075f : 0.05f); - } - if (npc.velocity.Y > num475) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.97f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.075f : 0.05f); - } - if (npc.velocity.Y < num475) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.97f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.075f : 0.05f); - } - - npc.ai[3] += 1f; - if (npc.justHit) - npc.ai[3] += 2f; - - if (npc.ai[3] >= 600f) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - vector54 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num474 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector54.X; - num475 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector54.Y; - num476 = (float)Math.Sqrt((double)(num474 * num474 + num475 * num475)); - npc.rotation = (float)Math.Atan2((double)num475, (double)num474) + 1.57f; - return false; - } - - if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)))) - npc.ai[2] = 0f; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Plantera AI - public static bool BuffedPlanteraAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases based on HP - bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio < 0.25f; - - // Variables and target - bool enrage = false; - bool despawn = false; - npc.TargetClosest(true); - - // Check for Jungle and remaining Tentacles - bool surface = !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0; - int tentacleCount = NPC.CountNPCS(NPCID.PlanterasTentacle); - bool tentaclesDead = tentacleCount == 0; - bool speedUp = Vector2.Distance(Main.player[npc.target].Center, npc.Center) > (phase3 ? 480f : 640f); // 30 or 40 tile distance - - // Despawn - if (Main.player[npc.target].dead) - { - despawn = true; - enrage = true; - } - - // Despawn if too far from target - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6000f) - { - npc.active = false; - npc.life = 0; - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - - // Set whoAmI variable and spawn hooks - NPC.plantBoss = npc.whoAmI; - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - int num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - - // Find positions of hooks - int[] array2 = new int[3]; - float num730 = 0f; - float num731 = 0f; - int num732 = 0; - int num; - for (int num733 = 0; num733 < 200; num733 = num + 1) - { - if (Main.npc[num733].active && Main.npc[num733].aiStyle == 52) - { - num730 += Main.npc[num733].Center.X; - num731 += Main.npc[num733].Center.Y; - array2[num732] = num733; - - num732++; - if (num732 > 2) - break; - } - num = num733; - } - num730 /= (float)num732; - num731 /= (float)num732; - - // Velocity and acceleration - float velocity = 6f; - float acceleration = 0.06f; - if (phase3) - { - velocity = 10f; - acceleration = 0.1f; - if (tentaclesDead) - { - velocity = 12f; - acceleration = 0.12f; - } - } - else if (phase2) - { - velocity = 8f; - acceleration = 0.08f; - } - - // Move faster if inside active tiles - int radius = 2; // 2 tile radius - int diameter = radius * 2; - int npcCenterX = (int)(npc.Center.X / 16f); - int npcCenterY = (int)(npc.Center.Y / 16f); - Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); - bool insideTiles = false; - for (int x = area.Left; x < area.Right; x++) - { - for (int y = area.Top; y < area.Bottom; y++) - { - if (Main.tile[x, y] != null) - { - if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) - insideTiles = true; - } - } - } - - // Slow down if close to target and not inside tiles - if (!speedUp && !insideTiles) - { - velocity = 4f; - acceleration = 0.04f; - } - - // Enrage if target is on the surface - if (!CalamityWorld.bossRushActive && (surface || Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16))) - { - enrage = true; - velocity += 8f; - acceleration = 0.15f; - } - - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - velocity += 1f; - acceleration += 0.01f; - } - - if (CalamityWorld.bossRushActive) - { - velocity *= 1.5f; - acceleration *= 1.5f; - } - - // Detect active tiles around Plantera - radius = 20; // 20 tile radius - diameter = radius * 2; - area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); - int nearbyActiveTiles = 0; // 0 to 1600 - for (int x = area.Left; x < area.Right; x++) - { - for (int y = area.Top; y < area.Bottom; y++) - { - if (Main.tile[x, y] != null) - { - if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) - nearbyActiveTiles++; - } - } - } - - // Scale multiplier based on nearby active tiles - float tileEnrageMult = 1f; - if (nearbyActiveTiles < 800) - tileEnrageMult += (float)(800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f - - // Movement relative to the target and hook positions - Vector2 vector91 = new Vector2(num730, num731); - float num736 = Main.player[npc.target].Center.X - vector91.X; - float num737 = Main.player[npc.target].Center.Y - vector91.Y; - if (despawn) - { - num737 *= -1f; - num736 *= -1f; - velocity += 8f; - } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - - // Increase speed based on nearby active tiles - velocity *= tileEnrageMult; - acceleration *= tileEnrageMult; - - // Velocity ranges from 4 to 7.2, Acceleration ranges from 0.04 to 0.072, non-enraged phase 1 - // Velocity ranges from 7 to 12.6, Acceleration ranges from 0.07 to 0.126, non-enraged phase 2 - // Velocity ranges from 9 to 16.2, Acceleration ranges from 0.07 to 0.126, non-enraged phase 3 - // Velocity ranges from 17 to 30.6, Acceleration ranges from 0.15 to 0.27, enraged phase 3 - - // Distance Plantera can travel from her hooks - float maxDistanceFromHooks = enrage ? 850f : 550f; - if (phase3) - maxDistanceFromHooks += 150f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - maxDistanceFromHooks += 50f; - - if (num738 >= maxDistanceFromHooks) - { - num738 = maxDistanceFromHooks / num738; - num736 *= num738; - num737 *= num738; - } - - num730 += num736; - num731 += num737; - vector91 = new Vector2(npc.Center.X, npc.Center.Y); - num736 = num730 - vector91.X; - num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - - if (num738 < velocity) - { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; - } - else - { - num738 = velocity / num738; - num736 *= num738; - num737 *= num738; - } - - if (npc.velocity.X < num736) - { - npc.velocity.X += acceleration; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X += acceleration * 2f; - } - else if (npc.velocity.X > num736) - { - npc.velocity.X -= acceleration; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X -= acceleration * 2f; - } - if (npc.velocity.Y < num737) - { - npc.velocity.Y += acceleration; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y += acceleration * 2f; - } - else if (npc.velocity.Y > num737) - { - npc.velocity.Y -= acceleration; - if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y -= acceleration * 2f; - } - - // Slow down considerably if near player - if (!speedUp && nearbyActiveTiles > 800 && !insideTiles) - { - if (npc.velocity.Length() > velocity) - npc.velocity *= 0.97f; - } - - // Rotation - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; - - // Phase 1 - if (!phase2) - { - // Adjust stats - npc.defense = 42; - npc.damage = npc.defDamage; - if (enrage) - { - npc.defense *= 2; - npc.damage *= 2; - } - - // Fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f + (8f * (1f - lifeRatio)); - - if (enrage) - { - npc.localAI[1] += 3f; + int num422 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[num422]; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.1f; + } + + // Despawn Twins at the same time + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + { + int num; + for (int num423 = 0; num423 < 200; num423 = num + 1) + { + if (num423 != npc.whoAmI && Main.npc[num423].active && (Main.npc[num423].type == NPCID.Retinazer || Main.npc[num423].type == NPCID.Spazmatism) && Main.npc[num423].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[num423].timeLeft - 1; + + num = num423; + } + } + + // Despawn + if (Main.dayTime | Main.player[npc.target].dead) + { + npc.velocity.Y -= 0.04f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return false; + } + } + + // Phase 1 + else if (npc.ai[0] == 0f) + { + // Cursed fireball phase + if (npc.ai[1] == 0f) + { + // New target + npc.TargetClosest(true); + + // Velocity + float num424 = 12f; + float num425 = 0.4f; + if (CalamityWorld.bossRushActive) + { + num424 *= 1.5f; + num425 *= 1.5f; + } + + int num426 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num426 = -1; + + Vector2 vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num426 * 400) - vector44.X; + float num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; + float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); + + num429 = num424 / num429; + num427 *= num429; + num428 *= num429; + + if (npc.velocity.X < num427) + { + npc.velocity.X += num425; + if (npc.velocity.X < 0f && num427 > 0f) + npc.velocity.X += num425; + } + else if (npc.velocity.X > num427) + { + npc.velocity.X -= num425; + if (npc.velocity.X > 0f && num427 < 0f) + npc.velocity.X -= num425; + } + if (npc.velocity.Y < num428) + { + npc.velocity.Y += num425; + if (npc.velocity.Y < 0f && num428 > 0f) + npc.velocity.Y += num425; + } + else if (npc.velocity.Y > num428) + { + npc.velocity.Y -= num425; + if (npc.velocity.Y > 0f && num428 < 0f) + npc.velocity.Y -= num425; + } + + // Fire cursed flames for 5 seconds + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + // Reset AI array and go to charging phase + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + else + { + // Fire cursed flame every half second + if (!Main.player[npc.target].dead) + npc.ai[3] += 1f; + + if (npc.ai[3] >= 30f) + { + npc.ai[3] = 0f; + vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector44.X; + num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num430 = CalamityWorld.bossRushActive ? 20f : 15f; + int num431 = 27; + int num432 = ProjectileID.CursedFlameHostile; + + num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); + num429 = num430 / num429; + num427 *= num429; + num428 *= num429; + num427 += (float)Main.rand.Next(-10, 11) * 0.05f; + num428 += (float)Main.rand.Next(-10, 11) * 0.05f; + vector44.X += num427 * 4f; + vector44.Y += num428 * 4f; + + Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, num431, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + + // Charging phase + else if (npc.ai[1] == 1f) + { + // Rotation and velocity + npc.rotation = num420; + float num434 = CalamityWorld.bossRushActive ? 24f : 16f; + Vector2 vector45 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num435 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector45.X; + float num436 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector45.Y; + float num437 = (float)Math.Sqrt((double)(num435 * num435 + num436 * num436)); + num437 = num434 / num437; + npc.velocity.X = num435 * num437; + npc.velocity.Y = num436 * num437; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + + float timeBeforeSlowDown = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 15f : 12f; + if (npc.ai[2] >= timeBeforeSlowDown) + { + // Slow down + npc.velocity.X *= 0.9f; + npc.velocity.Y *= 0.9f; + + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + // Charge 8 times + float chargeTime = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 35f : 38f; + if (npc.ai[2] >= chargeTime) + { + // Reset AI array and go to cursed fireball phase + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num420; + if (npc.ai[3] >= 8f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + // Enter phase 2 earlier + double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.85 : 0.7); + if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) + { + // Reset AI array and go to transition phase + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + + // Transition phase + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + // AI timer for rotation + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + // Spin around like a moron while flinging blood and gore everywhere + npc.rotation += npc.ai[2]; + npc.ai[1] += 1f; + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + + if (npc.ai[0] == 3f) + npc.ai[2] = 0f; + else + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + + int num; + for (int num438 = 0; num438 < 2; num438 = num + 1) + { + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 144, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); + num = num438; + } + + for (int num439 = 0; num439 < 20; num439 = num + 1) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + num = num439; + } + + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; + + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + + // Phase 2 + else + { + // If in phase 2 but Ret isn't + bool retInPhase1 = false; + if (CalamityGlobalNPC.laserEye != -1) + { + if (Main.npc[CalamityGlobalNPC.laserEye].active) + retInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f; + } + int defenseGain = retInPhase1 ? 9999 : 30; + npc.chaseable = !retInPhase1; + + // Increase defense and damage + npc.damage = (int)((double)npc.defDamage * 1.5); + npc.defense = npc.defDefense + defenseGain; + + // Change hit sound to metal + npc.HitSound = SoundID.NPCHit4; + + // Shadowflamethrower phase + if (npc.ai[1] == 0f) + { + float num440 = 6.2f; + float num441 = 0.1f; + if (CalamityWorld.bossRushActive) + { + num440 *= 1.5f; + num441 *= 1.5f; + } + + int num442 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num442 = -1; + + Vector2 vector46 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num443 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num442 * 180) - vector46.X; + float num444 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector46.Y; + float num445 = (float)Math.Sqrt((double)(num443 * num443 + num444 * num444)); + + // Boost speed if too far from target + if (num445 > 300f) + num440 += 0.5f; + if (num445 > 400f) + num440 += 0.5f; + + // Enrage + if (targetFloatingUp) + num440 += 2f; + + // Speed increase + if (enraged || configBossRushBoost) + num440 += 2f; + + num445 = num440 / num445; + num443 *= num445; + num444 *= num445; + + if (npc.velocity.X < num443) + { + npc.velocity.X += num441; + if (npc.velocity.X < 0f && num443 > 0f) + npc.velocity.X += num441; + } + else if (npc.velocity.X > num443) + { + npc.velocity.X -= num441; + if (npc.velocity.X > 0f && num443 < 0f) + npc.velocity.X -= num441; + } + if (npc.velocity.Y < num444) + { + npc.velocity.Y += num441; + if (npc.velocity.Y < 0f && num444 > 0f) + npc.velocity.Y += num441; + } + else if (npc.velocity.Y > num444) + { + npc.velocity.Y -= num441; + if (npc.velocity.Y > 0f && num444 < 0f) + npc.velocity.Y -= num441; + } + + // Fire flamethrower for x seconds + npc.ai[2] += (retAlive ? 1f : 2f); + if (npc.ai[2] >= 180f) + { + npc.ai[1] = ((!retAlive || enrage) ? 5f : 1f); + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + + // Fire fireballs and flamethrower + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (canHit || !retAlive || enrage) + { + // Play flame sound on timer + npc.localAI[2] += 1f; + if (npc.localAI[2] > 22f) + { + npc.localAI[2] = 0f; + Main.PlaySound(SoundID.Item34, npc.position); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] > 2f) + { + npc.localAI[1] = 0f; + + float num446 = CalamityWorld.bossRushActive ? 9f : 6f; + + int num447 = 33; + int num448 = mod.ProjectileType("Shadowflamethrower"); + + vector46 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num443 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector46.X; + num444 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector46.Y; + num445 = (float)Math.Sqrt((double)(num443 * num443 + num444 * num444)); + num445 = num446 / num445; + num443 *= num445; + num444 *= num445; + num444 += (float)Main.rand.Next(-10, 11) * 0.01f; + num443 += (float)Main.rand.Next(-10, 11) * 0.01f; + num444 += npc.velocity.Y * 0.5f; + num443 += npc.velocity.X * 0.5f; + vector46.X -= num443 * 1f; + vector46.Y -= num444 * 1f; + + if (canHit) + Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, num448, num447, 0f, Main.myPlayer, 0f, 0f); + else + { + int proj = Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, num448, num447, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].tileCollide = false; + } + } + } + } + } + + // Charging phase + else + { + // Charge + if (npc.ai[1] == 1f) + { + // Play charge sound + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + + // Set rotation and velocity + npc.rotation = num420; + float num450 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 17f : 16.75f); + + // Enrage + if (targetFloatingUp) + num450 += 2f; + + if (CalamityWorld.bossRushActive) + num450 *= 1.5f; + + Vector2 vector47 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num451 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector47.X; + float num452 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector47.Y; + float num453 = (float)Math.Sqrt((double)(num451 * num451 + num452 * num452)); + num453 = num450 / num453; + npc.velocity.X = num451 * num453; + npc.velocity.Y = num452 * num453; + npc.ai[1] = 2f; + return false; + } + + if (npc.ai[1] == 2f) + { + npc.ai[2] += (retAlive ? 1f : 1.25f); + + // Enrage + if (targetFloatingUp) + npc.ai[2] += 0.25f; + + if (CalamityWorld.bossRushActive) + npc.ai[2] += 0.4f; + + float chargeTime = 50f; + + // Slow down + if (npc.ai[2] >= chargeTime) + { + npc.velocity *= 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + // Charges 5 times + if (npc.ai[2] >= chargeTime + 30f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num420; + if (npc.ai[3] >= 5f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return false; + } + npc.ai[1] = 1f; + } + } + + // Crazy charge + else if (npc.ai[1] == 3f) + { + // Reset AI array and go to shadowflamethrower phase or fireball phase if ret is dead + float secondFastCharge = 4f; + if (npc.ai[3] >= (retAlive ? secondFastCharge : secondFastCharge + 1f)) + { + npc.TargetClosest(true); + npc.ai[1] = (retAlive ? 0f : 5f); + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + if (npc.ai[1] == 0f) + npc.localAI[1] = -20f; + + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + + // Set charging velocity + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Get a target + npc.TargetClosest(true); + + // Velocity + float num48 = ((enraged || configBossRushBoost) ? 30f : 20f); + if (CalamityWorld.bossRushActive) + num48 *= 1.5f; + if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) + num48 *= 1.3f; + + Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num49 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector10.X; + float num50 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector10.Y; + float num51 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); + float num52 = num51; + + num51 = num48 / num51; + npc.velocity.X = num49 * num51; + npc.velocity.Y = num50 * num51; + + if (retAlive) + { + if (num52 < 100f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float num56 = Math.Abs(npc.velocity.X); + float num57 = Math.Abs(npc.velocity.Y); + + if (npc.Center.X > Main.player[npc.target].Center.X) + num57 *= -1f; + if (npc.Center.Y > Main.player[npc.target].Center.Y) + num56 *= -1f; + + npc.velocity.X = num57; + npc.velocity.Y = num56; + } + } + } + + npc.ai[1] = 4f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + // Crazy charge + else if (npc.ai[1] == 4f) + { + if (npc.ai[2] == 0f) + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + + float num60 = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f); + if (CalamityWorld.bossRushActive) + num60 *= 0.8f; + + npc.ai[2] += 1f; + + if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < (retAlive ? 200f : 150f)) + npc.ai[2] -= 1f; + + // Slow down + if (npc.ai[2] >= num60) + { + npc.velocity *= 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + + // Charge 3 times + float num61 = num60 + 25f; + if (npc.ai[2] >= num61) + { + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.ai[1] = 3f; + } + } + + // Get in position for charge + else if (npc.ai[1] == 5f) + { + float num62 = (retAlive ? 600f : 500f); + float num63 = ((enraged || configBossRushBoost) ? 24f : 16f); + float num64 = ((enraged || configBossRushBoost) ? 0.6f : 0.4f); + + if (retAlive) + { + num63 *= 0.75f; + num64 *= 0.75f; + } + + if (CalamityWorld.bossRushActive) + { + num63 *= 1.5f; + num64 *= 1.5f; + } + + Vector2 vector11 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector11.X; + float num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) + num62 - vector11.Y; + float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); + + num67 = num63 / num67; + num65 *= num67; + num66 *= num67; + + if (npc.velocity.X < num65) + { + npc.velocity.X += num64; + if (npc.velocity.X < 0f && num65 > 0f) + npc.velocity.X += num64; + } + else if (npc.velocity.X > num65) + { + npc.velocity.X -= num64; + if (npc.velocity.X > 0f && num65 < 0f) + npc.velocity.X -= num64; + } + if (npc.velocity.Y < num66) + { + npc.velocity.Y += num64; + if (npc.velocity.Y < 0f && num66 > 0f) + npc.velocity.Y += num64; + } + else if (npc.velocity.Y > num66) + { + npc.velocity.Y -= num64; + if (npc.velocity.Y > 0f && num66 < 0f) + npc.velocity.Y -= num64; + } + + npc.ai[2] += 1f; + + // Fire shadowflames + float fireRate = (retAlive ? 30f : 20f); + if (npc.ai[2] % fireRate == 0f) + { + Vector2 vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector44.X; + float num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num430 = 16f; + int num431 = 31; + int num432 = mod.ProjectileType("Shadowflame"); + + float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); + num429 = num430 / num429; + num427 *= num429; + num428 *= num429; + vector44.X += num427 * 4f; + vector44.Y += num428 * 4f; + + Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, num431, 0f, Main.myPlayer, 0f, (retAlive ? 0f : 1f)); + } + } + + // Take 3 seconds to get in position, then charge + if (npc.ai[2] >= (retAlive ? 180f : 135f)) + { + npc.TargetClosest(true); + npc.ai[1] = 3f; + npc.ai[2] = -1f; + npc.netUpdate = true; + } + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Skeletron Prime AI + public static bool BuffedSkeletronPrimeAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + // Enrage variable if player is floating upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + + // Spawn arms + if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(true); + npc.ai[0] = 1f; + + int arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeCannon, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = (float)npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeSaw, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = (float)npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeVice, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = (float)npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].ai[3] = 150f; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeLaser, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = (float)npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + Main.npc[arm].ai[3] = 150f; + } + + // Check if arms are alive + bool cannonAlive = false; + bool laserAlive = false; + bool viceAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive; + npc.chaseable = allArmsDead; + + // Set stats + if (npc.ai[1] == 5f) + npc.damage = 0; + else if (allArmsDead) + { + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + } + else + npc.defense = 9999; + + // Phases + bool phase2 = (double)npc.life < (double)npc.lifeMax * 0.66; + bool phase3 = (double)npc.life < (double)npc.lifeMax * 0.33; + + // Despawn + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) + npc.ai[1] = 3f; + } + + // Activate daytime enrage + if (Main.dayTime && !CalamityWorld.bossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) + { + // Heal + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = npc.life - 300; + if (healAmt < 0) + { + int absHeal = Math.Abs(healAmt); + npc.life += absHeal; + npc.HealEffect(absHeal, true); + npc.netUpdate = true; + } + } + + npc.ai[1] = 2f; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + + // Float near player + if (npc.ai[1] == 0f || npc.ai[1] == 4f) + { + // Start other phases if arms are dead, start with spinning phase + if (allArmsDead) + { + // Start spin phase after 5 seconds + npc.ai[2] += (phase3 ? 1.25f : 1f); + if (npc.ai[2] >= 300f) + { + bool shouldSpinAroundTarget = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 400f && + Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; + + if (shouldSpinAroundTarget || npc.ai[1] != 4f) + { + if (shouldSpinAroundTarget) + npc.ai[3] = Vector2.Distance(Main.player[npc.target].Center, npc.Center); + + npc.ai[2] = 0f; + npc.ai[1] = (shouldSpinAroundTarget ? 5f : 1f); + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Ring of lasers if laser is dead + if (!laserAlive) + { + npc.localAI[1] += (allArmsDead ? 2f : 1f); + if (phase3) + npc.localAI[1] += 1f; + + if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 450f : 480f)) + { + npc.localAI[1] = 0f; + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + int totalProjectiles = 12; + float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 + double offsetAngle; + float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + int damage = 31; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 + int proj = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + int proj2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj2].timeLeft = 300; + } + } + } + + // Spread of rockets if cannon is dead + if (!cannonAlive) + { + npc.localAI[2] += (allArmsDead ? 2f : 1f); + if (phase3) + npc.localAI[2] += 1f; + + if (npc.localAI[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 215f : 240f)) + { + npc.localAI[2] = 0f; + float num502 = CalamityWorld.bossRushActive ? 12f : 8f; + int num503 = 33; + int num504 = ProjectileID.RocketSkeleton; + Vector2 value19 = Main.player[npc.target].Center - npc.Center; + value19.Normalize(); + value19 *= num502; + int numProj = 2; + float rotation = MathHelper.ToRadians(3); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num504, num503, 0f, Main.myPlayer, 0f, 1f); + } + } + } + } + + npc.rotation = npc.velocity.X / 15f; + + float velocity2 = CalamityWorld.bossRushActive ? 4f : 2f; + float acceleration = CalamityWorld.bossRushActive ? 0.2f : 0.1f; + if (!cannonAlive) + { + velocity2 += 1f; + acceleration += 0.025f; + } + if (!laserAlive) + { + velocity2 += 1f; + acceleration += 0.025f; + } + if (!viceAlive) + { + velocity2 += 1f; + acceleration += 0.025f; + } + if (!sawAlive) + { + velocity2 += 1f; + acceleration += 0.025f; + } + + if (npc.position.Y > Main.player[npc.target].position.Y - 350f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.98f; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > velocity2) + npc.velocity.Y = velocity2; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - 500f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.98f; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -velocity2) + npc.velocity.Y = -velocity2; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 150f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.98f; + + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 150f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.98f; + + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + } + + else + { + // Spinning + if (npc.ai[1] == 1f) + { + npc.defense *= 2; + npc.damage *= 2; + + if (phase2) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 39f : 45f)) + { + npc.localAI[1] = 0f; + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + int totalProjectiles = 12; + float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 + double offsetAngle; + float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + int damage = 31; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 + int proj = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + int proj2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj2].timeLeft = 300; + } + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] == 2f) + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + + // Spin for 3 seconds then return to floating phase + float phaseTimer = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 150f : 180f); + if (phase2 && !phase3) + phaseTimer += 120f; + + if (npc.ai[2] >= phaseTimer) + { + npc.ai[2] = 0f; + npc.ai[1] = 4f; + } + + npc.rotation += (float)npc.direction * 0.3f; + Vector2 vector48 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num455 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector48.X; + float num456 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector48.Y; + float num457 = (float)Math.Sqrt((double)(num455 * num455 + num456 * num456)); + + float speed = CalamityWorld.bossRushActive ? 7f : 3f; + if (phase2 || CalamityWorld.bossRushActive) + speed += 1f; + if (phase3 || CalamityWorld.bossRushActive) + speed += 1f; + if (enraged || configBossRushBoost) + speed += 3f; + if (targetFloatingUp) + speed += 5f; + + float speedBuff = 3f + (3f * (1f - (float)npc.life / (float)npc.lifeMax)); + float speedBuff2 = 8f + (8f * (1f - (float)npc.life / (float)npc.lifeMax)); + + speed += num457 / 100f; + if (speed < speedBuff) + speed = speedBuff; + if (speed > speedBuff2) + speed = speedBuff2; + + num457 = speed / num457; + npc.velocity.X = num455 * num457; + npc.velocity.Y = num456 * num457; + } + + // Daytime enrage + if (npc.ai[1] == 2f) + { + npc.damage = 1000; + npc.defense = 9999; + + npc.rotation += (float)npc.direction * 0.3f; + + Vector2 vector49 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num458 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector49.X; + float num459 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector49.Y; + float num460 = (float)Math.Sqrt((double)(num458 * num458 + num459 * num459)); + + float num461 = 10f; + num461 += num460 / 100f; + if (num461 < 8f) + num461 = 8f; + if (num461 > 32f) + num461 = 32f; + + num460 = num461 / num460; + npc.velocity.X = num458 * num460; + npc.velocity.Y = num459 * num460; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 54f : 60f)) + { + npc.localAI[0] = 0f; + Vector2 vector16 = npc.Center; + if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num159 = 7f; + float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; + + Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + value += npc.velocity; + num160 = value.X; + num161 = value.Y; + + int num163 = 250; + int num164 = ProjectileID.Skull; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 300; + } + } + } + } + + // Despawning + if (npc.ai[1] == 3f) + { + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.X *= 0.95f; + + if (npc.timeLeft > 500) + npc.timeLeft = 500; + } + + // Fly around target in a circle and spawn probes + if (npc.ai[1] == 5f) + { + npc.ai[2] += 1f; + + npc.rotation = npc.velocity.X / 30f; + + // Spin for 3 seconds + float spinVelocity = 45f; + if (npc.ai[2] == 2f) + { + // Play angry noise + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + + // Set spin direction + if (Main.player[npc.target].velocity.X > 0) + calamityGlobalNPC.newAI[0] = 1f; + else if (Main.player[npc.target].velocity.X < 0) + calamityGlobalNPC.newAI[0] = -1f; + else + calamityGlobalNPC.newAI[0] = (float)Main.player[npc.target].direction; + + // Set spin velocity + npc.velocity.X = 3.14159265f * npc.ai[3] / spinVelocity; + npc.velocity *= -calamityGlobalNPC.newAI[0]; + npc.netUpdate = true; + } + + // Spawn 6 Probes and maintain velocity, or spit skulls if probes are alive + else + { + npc.velocity = npc.velocity.RotatedBy(3.14159265 / spinVelocity * -calamityGlobalNPC.newAI[0]); + if (npc.ai[2] % 30f == 0f) + { + calamityGlobalNPC.newAI[1] += 1f; + + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 64f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.CountNPCS(NPCID.Probe) < 6) + NPC.NewNPC((int)npc.Center.X, (int)(npc.Center.Y + 4f), NPCID.Probe); + else + { + Vector2 vector16 = npc.Center; + float num159 = CalamityWorld.bossRushActive ? 6f : 4f; + float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; + + Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + num160 = value.X; + num161 = value.Y; + + int num163 = 28; + int num164 = ProjectileID.Skull; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 180; + Main.projectile[num165].tileCollide = false; + } + } + } + + // Go to floating phase, or spinning phase if in phase 2 + if (calamityGlobalNPC.newAI[1] >= 6f) + { + npc.velocity.Normalize(); + + // Fly overhead and spit missiles if on low health + npc.ai[1] = (phase3 ? 6f : 1f); + npc.ai[2] = 0f; + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + npc.netUpdate = true; + } + } + } + } + + // Fly overhead and spit missiles + if (npc.ai[1] == 6f) + { + npc.ai[2] += 1f; + + npc.rotation = npc.velocity.X / 15f; + + float flightVelocity = CalamityWorld.bossRushActive ? 15f : 10f; + float fligthAcceleration = CalamityWorld.bossRushActive ? 0.18f : 0.12f; + + // Spit homing missiles and then go to floating phase + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float posX = Main.player[npc.target].Center.X - center.X; + float posY = Main.player[npc.target].Center.Y - center.Y - 500f; + + float distance = (float)Math.Sqrt((double)(posX * posX + posY * posY)); + if (distance < 20f) + { + posX = npc.velocity.X; + posY = npc.velocity.Y; + } + else + { + distance = flightVelocity / distance; + posX *= distance; + posY *= distance; + } + + if (npc.velocity.X < posX) + { + npc.velocity.X += fligthAcceleration; + if (npc.velocity.X < 0f && posX > 0f) + npc.velocity.X += fligthAcceleration; + } + else if (npc.velocity.X > posX) + { + npc.velocity.X -= fligthAcceleration; + if (npc.velocity.X > 0f && posX < 0f) + npc.velocity.X -= fligthAcceleration; + } + if (npc.velocity.Y < posY) + { + npc.velocity.Y += fligthAcceleration; + if (npc.velocity.Y < 0f && posY > 0f) + npc.velocity.Y += fligthAcceleration; + } + else if (npc.velocity.Y > posY) + { + npc.velocity.Y -= fligthAcceleration; + if (npc.velocity.Y > 0f && posY < 0f) + npc.velocity.Y -= fligthAcceleration; + } + + if (npc.ai[2] % 12f == 0f) + { + calamityGlobalNPC.newAI[1] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); + velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default); + velocity *= (CalamityWorld.bossRushActive ? 7.5f : 5f); + int damage = 33; + float delayBeforeHoming = CalamityWorld.bossRushActive ? 30f : 45f; + Projectile.NewProjectile(npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, ProjectileID.SaucerMissile, damage, 0f, Main.myPlayer, 0f, delayBeforeHoming); + } + + Main.PlaySound(SoundID.Item39, npc.Center); + + if (calamityGlobalNPC.newAI[1] >= 10f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + npc.localAI[1] = -90f; + npc.localAI[2] = -90f; + npc.netUpdate = true; + } + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) + { + // Set direction + npc.spriteDirection = -(int)npc.ai[0]; + + // Despawn if head is gone + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeLaser = npc.whoAmI; + + // Check if arms are alive + bool cannonAlive = false; + bool viceAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + + // Phase 1 + if (npc.ai[2] == 0f) + { + // Despawn if head is despawning + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + // Go to other phase after 13.3 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!cannonAlive) + npc.ai[3] += 1f; + if (!viceAlive) + npc.ai[3] += 1f; + if (!sawAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 680f : 800f)) + { + npc.localAI[0] = 0f; + npc.ai[2] = 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y < -3f) + npc.velocity.Y = -3f; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.21f : 0.14f); + + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.21f : 0.14f); + + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + + npc.TargetClosest(true); + Vector2 vector62 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num506 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector62.X; + float num507 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector62.Y; + float num508 = (float)Math.Sqrt((double)(num506 * num506 + num507 * num507)); + npc.rotation = (float)Math.Atan2((double)num507, (double)num506) - 1.57f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!cannonAlive) + npc.localAI[0] += 1f; + if (!viceAlive) + npc.localAI[0] += 1f; + if (!sawAlive) + npc.localAI[0] += 1f; + + if (npc.localAI[0] >= 90f) + { + npc.localAI[0] = 0f; + float num509 = CalamityWorld.bossRushActive ? 13f : 11f; + int num510 = 31; + int num511 = ProjectileID.DeathLaser; + num508 = num509 / num508; + num506 *= num508; + num507 *= num508; + vector62.X += num506 * 8f; + vector62.Y += num507 * 8f; + Projectile.NewProjectile(vector62.X, vector62.Y, num506, num507, num511, num510, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + // Other phase, get closer to the player and fire ring of lasers + else if (npc.ai[2] == 1f) + { + // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) + npc.ai[3] += 1f; + + float timeLimit = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 150f : 135f); + float timeMult = 1.882075f; + if (!cannonAlive) + timeLimit *= timeMult; + if (!viceAlive) + timeLimit *= timeMult; + if (!sawAlive) + timeLimit *= timeMult; + + if (npc.ai[3] >= timeLimit) + { + npc.localAI[0] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + Vector2 vector63 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num513 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 350f - vector63.X; + float num514 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 120f - vector63.Y; // Used to be 20f + float num515 = (float)Math.Sqrt((double)(num513 * num513 + num514 * num514)); + num515 = (CalamityWorld.bossRushActive ? 10f : 7f) / num515; + num513 *= num515; + num514 *= num515; + + if (npc.velocity.X > num513) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.9f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + } + if (npc.velocity.X < num513) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.9f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + } + if (npc.velocity.Y > num514) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.9f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.09f : 0.06f); + } + if (npc.velocity.Y < num514) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.9f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.09f : 0.06f); + } + + npc.TargetClosest(true); + vector63 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num513 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector63.X; + num514 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector63.Y; + num515 = (float)Math.Sqrt((double)(num513 * num513 + num514 * num514)); + npc.rotation = (float)Math.Atan2((double)num514, (double)num513) - 1.57f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!cannonAlive) + npc.localAI[0] += 0.5f; + if (!viceAlive) + npc.localAI[0] += 0.5f; + if (!sawAlive) + npc.localAI[0] += 0.5f; + + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + int totalProjectiles = 12; + float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 + double offsetAngle; + float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + int damage = 31; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) + { + npc.spriteDirection = -(int)npc.ai[0]; + + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeCannon = npc.whoAmI; + + // Check if arms are alive + bool laserAlive = false; + bool viceAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + + bool fireSlower = false; + if (laserAlive) + { + // If laser is firing ring of lasers + if (Main.npc[CalamityGlobalNPC.primeLaser].ai[2] == 1f) + fireSlower = true; + } + else + { + fireSlower = npc.ai[2] == 0f; + + if (fireSlower) + { + // Go to other phase after 13.33 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!laserAlive) + npc.ai[3] += 1f; + if (!viceAlive) + npc.ai[3] += 1f; + if (!sawAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 680f : 800f)) + { + npc.localAI[0] = 0f; + npc.ai[2] = 1f; + fireSlower = false; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else + { + // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) + npc.ai[3] += 1f; + + float timeLimit = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 145f : 120f); + float timeMult = 1.882075f; + if (!laserAlive) + timeLimit *= timeMult; + if (!viceAlive) + timeLimit *= timeMult; + if (!sawAlive) + timeLimit *= timeMult; + + if (npc.ai[3] >= timeLimit) + { + npc.localAI[0] = 0f; + npc.ai[2] = 0f; + fireSlower = true; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + } + + if (fireSlower) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + + if (npc.velocity.Y < -3f) + npc.velocity.Y = -3f; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 200f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.3f : 0.2f); + + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 160f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.3f : 0.2f); + + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + + Vector2 vector60 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num492 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector60.X; + float num493 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector60.Y; + float num494 = (float)Math.Sqrt((double)(num492 * num492 + num493 * num493)); + npc.rotation = (float)Math.Atan2((double)num493, (double)num492) - 1.57f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Fire rocket every 2 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!laserAlive) + npc.localAI[0] += 1f; + if (!viceAlive) + npc.localAI[0] += 1f; + if (!sawAlive) + npc.localAI[0] += 1f; + + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + float num495 = CalamityWorld.bossRushActive ? 12f : 8f; + int num496 = 33; + int num497 = ProjectileID.RocketSkeleton; + num494 = num495 / num494; + num492 *= num494; + num493 *= num494; + vector60.X += num492 * 5f; + vector60.Y += num493 * 5f; + Projectile.NewProjectile(vector60.X, vector60.Y, num492, num493, num497, num496, 0f, Main.myPlayer, 0f, 1f); + } + } + } + + else + { + Vector2 vector61 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num499 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector61.X; + float num500 = Main.npc[(int)npc.ai[1]].position.Y - vector61.Y; + num500 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 80f - vector61.Y; + float num501 = (float)Math.Sqrt((double)(num499 * num499 + num500 * num500)); + num501 = (CalamityWorld.bossRushActive ? 10f : 7f) / num501; + num499 *= num501; + num500 *= num501; + + if (npc.velocity.X > num499) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.9f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + } + if (npc.velocity.X < num499) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.9f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + } + if (npc.velocity.Y > num500) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.9f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + } + if (npc.velocity.Y < num500) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.9f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.12f : 0.08f); + } + + npc.TargetClosest(true); + vector61 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num499 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector61.X; + num500 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector61.Y; + num501 = (float)Math.Sqrt((double)(num499 * num499 + num500 * num500)); + npc.rotation = (float)Math.Atan2((double)num500, (double)num499) - 1.57f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Fire rockets every 2 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!laserAlive) + npc.localAI[0] += 0.5f; + if (!viceAlive) + npc.localAI[0] += 0.5f; + if (!sawAlive) + npc.localAI[0] += 0.5f; + + if (npc.localAI[0] >= 180f) + { + npc.localAI[0] = 0f; + float num502 = CalamityWorld.bossRushActive ? 12f : 8f; + int num503 = 33; + int num504 = ProjectileID.RocketSkeleton; + Vector2 value19 = Main.player[npc.target].Center - npc.Center; + value19.Normalize(); + value19 *= num502; + int numProj = 2; + float rotation = MathHelper.ToRadians(3); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num504, num503, 0f, Main.myPlayer, 0f, 1f); + } + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedPrimeViceAI(NPC npc, Mod mod) + { + // Direction + npc.spriteDirection = -(int)npc.ai[0]; + + // Where the vice should be in relation to the head + Vector2 vector55 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num477 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector55.X; + float num478 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector55.Y; + float num479 = (float)Math.Sqrt((double)(num477 * num477 + num478 * num478)); + + // Return the vice to its proper location in relation to the head if it's too far away + if (npc.ai[2] != 99f) + { + if (num479 > 800f) + npc.ai[2] = 99f; + } + else if (num479 < 400f) + npc.ai[2] = 0f; + + // Despawn if head is gone + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeVice = npc.whoAmI; + + // Check if arms are alive + bool cannonAlive = false; + bool laserAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + + // Return to the head + if (npc.ai[2] == 99f) + { + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y > 8f) + npc.velocity.Y = 8f; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y < -8f) + npc.velocity.Y = -8f; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + + if (npc.velocity.X > 12f) + npc.velocity.X = 12f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + + if (npc.velocity.X < -12f) + npc.velocity.X = -12f; + } + } + + // Other phases + else + { + // Stay near the head + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + // Despawn if head is despawning + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + // Start charging after 10 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!cannonAlive) + npc.ai[3] += 1f; + if (!laserAlive) + npc.ai[3] += 1f; + if (!sawAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 540f : 600f)) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y < -3f) + npc.velocity.Y = -3f; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 250f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.94f; + + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.45f : 0.3f); + + if (npc.velocity.X > 9f) + npc.velocity.X = 9f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.94f; + + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.3f : 0.2f); + + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + + Vector2 vector57 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num483 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector57.X; + float num484 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector57.Y; + float num485 = (float)Math.Sqrt((double)(num483 * num483 + num484 * num484)); + npc.rotation = (float)Math.Atan2((double)num484, (double)num483) + 1.57f; + return false; + } + + // Charge towards the player + if (npc.ai[2] == 1f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.9f; + + Vector2 vector58 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num486 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 280f * npc.ai[0] - vector58.X; + float num487 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector58.Y; + float num488 = (float)Math.Sqrt((double)(num486 * num486 + num487 * num487)); + npc.rotation = (float)Math.Atan2((double)num487, (double)num486) + 1.57f; + + npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; + npc.velocity.X += 0.5f; + + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -9f) + npc.velocity.Y = -9f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) + { + float chargeVelocity = CalamityWorld.bossRushActive ? 24f : 16f; + if (!cannonAlive) + chargeVelocity += 1.5f; + if (!laserAlive) + chargeVelocity += 1.5f; + if (!sawAlive) + chargeVelocity += 1.5f; + + npc.TargetClosest(true); + npc.ai[2] = 2f; + vector58 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num486 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector58.X; + num487 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector58.Y; + num488 = (float)Math.Sqrt((double)(num486 * num486 + num487 * num487)); + num488 = chargeVelocity / num488; + npc.velocity.X = num486 * num488; + npc.velocity.Y = num487 * num488; + npc.netUpdate = true; + } + } + + // Charge 4 times (more if arms are dead) + else if (npc.ai[2] == 2f) + { + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + { + float chargeAmt = 4f; + if (!cannonAlive) + chargeAmt += 1f; + if (!laserAlive) + chargeAmt += 1f; + if (!sawAlive) + chargeAmt += 1f; + + if (npc.ai[3] >= chargeAmt) + { + // Return to head + npc.ai[2] = 3f; + npc.ai[3] = 0f; + return false; + } + + npc.ai[2] = 1f; + npc.ai[3] += 1f; + } + } + + // Different type of charge + else if (npc.ai[2] == 4f) + { + Vector2 vector59 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num489 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector59.X; + float num490 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector59.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + npc.rotation = (float)Math.Atan2((double)num490, (double)num489) + 1.57f; + + npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; + + npc.velocity.X += 0.5f; + if (npc.velocity.X > 12f) + npc.velocity.X = 12f; + + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) + { + float chargeVelocity = CalamityWorld.bossRushActive ? 21f : 14f; + if (!cannonAlive) + chargeVelocity += 1.15f; + if (!laserAlive) + chargeVelocity += 1.15f; + if (!sawAlive) + chargeVelocity += 1.15f; + + npc.TargetClosest(true); + npc.ai[2] = 5f; + vector59 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num489 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector59.X; + num490 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector59.Y; + num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + num491 = chargeVelocity / num491; + npc.velocity.X = num489 * num491; + npc.velocity.Y = num490 * num491; + npc.netUpdate = true; + } + } + + // Charge 4 times (more if arms are dead) + else if (npc.ai[2] == 5f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) + { + float chargeAmt = 4f; + if (!cannonAlive) + chargeAmt += 1f; + if (!laserAlive) + chargeAmt += 1f; + if (!sawAlive) + chargeAmt += 1f; + + if (npc.ai[3] >= chargeAmt) + { + // Return to head + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return false; + } + + npc.ai[2] = 4f; + npc.ai[3] += 1f; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedPrimeSawAI(NPC npc, Mod mod) + { + Vector2 vector50 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num462 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector50.X; + float num463 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector50.Y; + float num464 = (float)Math.Sqrt((double)(num462 * num462 + num463 * num463)); + + if (npc.ai[2] != 99f) + { + if (num464 > 800f) + npc.ai[2] = 99f; + } + else if (num464 < 400f) + npc.ai[2] = 0f; + + npc.spriteDirection = -(int)npc.ai[0]; + + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeSaw = npc.whoAmI; + + // Check if arms are alive + bool cannonAlive = false; + bool laserAlive = false; + bool viceAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + + if (npc.ai[2] == 99f) + { + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y > 8f) + npc.velocity.Y = 8f; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + + if (npc.velocity.Y < -8f) + npc.velocity.Y = -8f; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + + if (npc.velocity.X > 12f) + npc.velocity.X = 12f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.75f : 0.5f); + + if (npc.velocity.X < -12f) + npc.velocity.X = -12f; + } + } + else + { + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + // Start charging after 3 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!cannonAlive) + npc.ai[3] += 1f; + if (!laserAlive) + npc.ai[3] += 1f; + if (!viceAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 165f : 180f)) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.96f; + + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.06f : 0.04f); + + if (npc.velocity.Y < -3f) + npc.velocity.Y = -3f; + } + + if (npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2)) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.45f : 0.3f); + + if (npc.velocity.X > 12f) + npc.velocity.X = 12f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 250f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.96f; + + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.45f : 0.3f); + + if (npc.velocity.X < -12f) + npc.velocity.X = -12f; + } + + Vector2 vector52 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num468 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector52.X; + float num469 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector52.Y; + float num470 = (float)Math.Sqrt((double)(num468 * num468 + num469 * num469)); + npc.rotation = (float)Math.Atan2((double)num469, (double)num468) + 1.57f; + return false; + } + + if (npc.ai[2] == 1f) + { + Vector2 vector53 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num471 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector53.X; + float num472 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector53.Y; + float num473 = (float)Math.Sqrt((double)(num471 * num471 + num472 * num472)); + npc.rotation = (float)Math.Atan2((double)num472, (double)num471) + 1.57f; + + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.3f; + if (npc.velocity.Y < -8f) + npc.velocity.Y = -8f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + float chargeVelocity = CalamityWorld.bossRushActive ? 33f : 22f; + if (!cannonAlive) + chargeVelocity += 1.5f; + if (!laserAlive) + chargeVelocity += 1.5f; + if (!viceAlive) + chargeVelocity += 1.5f; + + npc.TargetClosest(true); + npc.ai[2] = 2f; + vector53 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num471 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector53.X; + num472 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector53.Y; + num473 = (float)Math.Sqrt((double)(num471 * num471 + num472 * num472)); + num473 = chargeVelocity / num473; + npc.velocity.X = num471 * num473; + npc.velocity.Y = num472 * num473; + npc.netUpdate = true; + } + } + + else if (npc.ai[2] == 2f) + { + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + npc.ai[2] = 3f; + } + + else + { + if (npc.ai[2] == 4f) + { + float chargeVelocity = CalamityWorld.bossRushActive ? 16f : 11f; + if (!cannonAlive) + chargeVelocity += 1.5f; + if (!laserAlive) + chargeVelocity += 1.5f; + if (!viceAlive) + chargeVelocity += 1.5f; + + npc.TargetClosest(true); + Vector2 vector54 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num474 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector54.X; + float num475 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector54.Y; + float num476 = (float)Math.Sqrt((double)(num474 * num474 + num475 * num475)); + num476 = chargeVelocity / num476; + num474 *= num476; + num475 *= num476; + + if (npc.velocity.X > num474) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.97f; + npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + } + if (npc.velocity.X < num474) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.97f; + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + } + if (npc.velocity.Y > num475) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.97f; + npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + } + if (npc.velocity.Y < num475) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.97f; + npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.075f : 0.05f); + } + + npc.ai[3] += 1f; + if (npc.justHit) + npc.ai[3] += 2f; + + if (npc.ai[3] >= 600f) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + vector54 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num474 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector54.X; + num475 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector54.Y; + num476 = (float)Math.Sqrt((double)(num474 * num474 + num475 * num475)); + npc.rotation = (float)Math.Atan2((double)num475, (double)num474) + 1.57f; + return false; + } + + if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)))) + npc.ai[2] = 0f; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Plantera AI + public static bool BuffedPlanteraAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases based on HP + bool phase2 = lifeRatio <= 0.5f; + bool phase3 = lifeRatio < 0.25f; + + // Variables and target + bool enrage = false; + bool despawn = false; + npc.TargetClosest(true); + + // Check for Jungle and remaining Tentacles + bool surface = !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0; + int tentacleCount = NPC.CountNPCS(NPCID.PlanterasTentacle); + bool tentaclesDead = tentacleCount == 0; + bool speedUp = Vector2.Distance(Main.player[npc.target].Center, npc.Center) > (phase3 ? 480f : 640f); // 30 or 40 tile distance + + // Despawn + if (Main.player[npc.target].dead) + { + despawn = true; + enrage = true; + } + + // Despawn if too far from target + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6000f) + { + npc.active = false; + npc.life = 0; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + + // Set whoAmI variable and spawn hooks + NPC.plantBoss = npc.whoAmI; + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 1f; + int num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + + // Find positions of hooks + int[] array2 = new int[3]; + float num730 = 0f; + float num731 = 0f; + int num732 = 0; + int num; + for (int num733 = 0; num733 < 200; num733 = num + 1) + { + if (Main.npc[num733].active && Main.npc[num733].aiStyle == 52) + { + num730 += Main.npc[num733].Center.X; + num731 += Main.npc[num733].Center.Y; + array2[num732] = num733; + + num732++; + if (num732 > 2) + break; + } + num = num733; + } + num730 /= (float)num732; + num731 /= (float)num732; + + // Velocity and acceleration + float velocity = 6f; + float acceleration = 0.06f; + if (phase3) + { + velocity = 10f; + acceleration = 0.1f; + if (tentaclesDead) + { + velocity = 12f; + acceleration = 0.12f; + } + } + else if (phase2) + { + velocity = 8f; + acceleration = 0.08f; + } + + // Move faster if inside active tiles + int radius = 2; // 2 tile radius + int diameter = radius * 2; + int npcCenterX = (int)(npc.Center.X / 16f); + int npcCenterY = (int)(npc.Center.Y / 16f); + Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); + bool insideTiles = false; + for (int x = area.Left; x < area.Right; x++) + { + for (int y = area.Top; y < area.Bottom; y++) + { + if (Main.tile[x, y] != null) + { + if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) + insideTiles = true; + } + } + } + + // Slow down if close to target and not inside tiles + if (!speedUp && !insideTiles) + { + velocity = 4f; + acceleration = 0.04f; + } + + // Enrage if target is on the surface + if (!CalamityWorld.bossRushActive && (surface || Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16))) + { + enrage = true; + velocity += 8f; + acceleration = 0.15f; + } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + velocity += 1f; + acceleration += 0.01f; + } + + if (CalamityWorld.bossRushActive) + { + velocity *= 1.5f; + acceleration *= 1.5f; + } + + // Detect active tiles around Plantera + radius = 20; // 20 tile radius + diameter = radius * 2; + area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); + int nearbyActiveTiles = 0; // 0 to 1600 + for (int x = area.Left; x < area.Right; x++) + { + for (int y = area.Top; y < area.Bottom; y++) + { + if (Main.tile[x, y] != null) + { + if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) + nearbyActiveTiles++; + } + } + } + + // Scale multiplier based on nearby active tiles + float tileEnrageMult = 1f; + if (nearbyActiveTiles < 800) + tileEnrageMult += (float)(800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f + + // Movement relative to the target and hook positions + Vector2 vector91 = new Vector2(num730, num731); + float num736 = Main.player[npc.target].Center.X - vector91.X; + float num737 = Main.player[npc.target].Center.Y - vector91.Y; + if (despawn) + { + num737 *= -1f; + num736 *= -1f; + velocity += 8f; + } + float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + + // Increase speed based on nearby active tiles + velocity *= tileEnrageMult; + acceleration *= tileEnrageMult; + + // Velocity ranges from 4 to 7.2, Acceleration ranges from 0.04 to 0.072, non-enraged phase 1 + // Velocity ranges from 7 to 12.6, Acceleration ranges from 0.07 to 0.126, non-enraged phase 2 + // Velocity ranges from 9 to 16.2, Acceleration ranges from 0.07 to 0.126, non-enraged phase 3 + // Velocity ranges from 17 to 30.6, Acceleration ranges from 0.15 to 0.27, enraged phase 3 + + // Distance Plantera can travel from her hooks + float maxDistanceFromHooks = enrage ? 850f : 550f; + if (phase3) + maxDistanceFromHooks += 150f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + maxDistanceFromHooks += 50f; + + if (num738 >= maxDistanceFromHooks) + { + num738 = maxDistanceFromHooks / num738; + num736 *= num738; + num737 *= num738; + } + + num730 += num736; + num731 += num737; + vector91 = new Vector2(npc.Center.X, npc.Center.Y); + num736 = num730 - vector91.X; + num737 = num731 - vector91.Y; + num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + + if (num738 < velocity) + { + num736 = npc.velocity.X; + num737 = npc.velocity.Y; + } + else + { + num738 = velocity / num738; + num736 *= num738; + num737 *= num738; + } + + if (npc.velocity.X < num736) + { + npc.velocity.X += acceleration; + if (npc.velocity.X < 0f && num736 > 0f) + npc.velocity.X += acceleration * 2f; + } + else if (npc.velocity.X > num736) + { + npc.velocity.X -= acceleration; + if (npc.velocity.X > 0f && num736 < 0f) + npc.velocity.X -= acceleration * 2f; + } + if (npc.velocity.Y < num737) + { + npc.velocity.Y += acceleration; + if (npc.velocity.Y < 0f && num737 > 0f) + npc.velocity.Y += acceleration * 2f; + } + else if (npc.velocity.Y > num737) + { + npc.velocity.Y -= acceleration; + if (npc.velocity.Y > 0f && num737 < 0f) + npc.velocity.Y -= acceleration * 2f; + } + + // Slow down considerably if near player + if (!speedUp && nearbyActiveTiles > 800 && !insideTiles) + { + if (npc.velocity.Length() > velocity) + npc.velocity *= 0.97f; + } + + // Rotation + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = Main.player[npc.target].Center.X - vector92.X; + float num741 = Main.player[npc.target].Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + + // Phase 1 + if (!phase2) + { + // Adjust stats + npc.defense = 42; + npc.damage = npc.defDamage; + if (enrage) + { + npc.defense *= 2; + npc.damage *= 2; + } + + // Fire projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f + (8f * (1f - lifeRatio)); + + if (enrage) + { + npc.localAI[1] += 3f; // If hit, fire projectiles even if target is behind tiles if (npc.justHit && Main.rand.NextBool(2)) npc.localAI[3] = 1f; - } + } - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 65f : 75f)) - { - npc.localAI[1] = 0f; - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[3] > 0f) - { - canHit = true; - npc.localAI[3] = 0f; - } - if (canHit) - { - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); - float num742 = CalamityWorld.bossRushActive ? 27f : 18f; - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 65f : 75f)) + { + npc.localAI[1] = 0f; + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (npc.localAI[3] > 0f) + { + canHit = true; + npc.localAI[3] = 0f; + } + if (canHit) + { + Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); + float num742 = CalamityWorld.bossRushActive ? 27f : 18f; + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; - int damage = 24; - int projectileType = ProjectileID.SeedPlantera; + int damage = 24; + int projectileType = ProjectileID.SeedPlantera; if (lifeRatio < 0.9f && Main.rand.NextBool(2)) { - damage = 30; - npc.localAI[1] = -30f; - projectileType = ProjectileID.PoisonSeedPlantera; - } + damage = 30; + npc.localAI[1] = -30f; + projectileType = ProjectileID.PoisonSeedPlantera; + } else if (lifeRatio < 0.8f && Main.rand.NextBool(4)) { - int thornBallCount = 0; - for (int i = 0; i < 1000; i++) - { - if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) - thornBallCount++; - - if (thornBallCount > 2) - break; - } - if (thornBallCount < 3) - { - damage = 34; - npc.localAI[1] = -120f; - projectileType = ProjectileID.ThornBall; - } - } - - if (enrage) - damage *= 2; - - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - if (projectileType == ProjectileID.SeedPlantera) - Main.projectile[num748].timeLeft = 300; - } - } - } - } - - // Phase 2 - else - { - // Adjust stats - npc.defense = 21; - npc.damage = (int)((float)npc.defDamage * 1.4f); - if (enrage) - { - npc.defense *= 4; - npc.damage *= 2; - } - - // Spawn tentacles - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[0] == 1f) - { - npc.localAI[0] = 2f; - for (int num749 = 0; num749 < 8; num749 = num + 1) - { - int num750 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num = num749; - } - } - } - - // If tentacles are alive, gain high defense - if (!tentaclesDead) - npc.defense = 9999; - npc.chaseable = tentaclesDead; - - // Spawn gore - if (npc.localAI[2] == 0f) - { - Gore.NewGore(new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); - Gore.NewGore(new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); - Gore.NewGore(new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 380, npc.scale); - npc.localAI[2] = 1f; - } - - // Spawn spores - npc.localAI[1] += 1f + (8f * (0.5f - lifeRatio)); - - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 300f : 360f)) - { - float num757 = CalamityWorld.bossRushActive ? 12f : 8f; - Vector2 vector94 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num758 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector94.X + (float)Main.rand.Next(-10, 11); - float num759 = Math.Abs(num758 * 0.2f); - - float num760 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector94.Y + (float)Main.rand.Next(-10, 11); - if (num760 > 0f) - num759 = 0f; - - num760 -= num759; - float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); - num761 = num757 / num761; - num758 *= num761; - num760 *= num761; - - int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num762].velocity.X = num758; - Main.npc[num762].velocity.Y = num760; - Main.npc[num762].netUpdate = true; - npc.localAI[1] = 0f; - } - - // Fire spread of poison seeds - if (tentacleCount < 8) - { - int tentacleScale = 8 - tentacleCount; // 1 to 8 - - if (nearbyActiveTiles > 600) - npc.localAI[3] += 0.5f + ((float)(tentacleScale - 1) * 0.5f); - else - npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (float)(tentacleScale - 1); - - if (npc.localAI[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 330f : 360f)) - { - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); - - float num742 = 8f - ((float)tentacleScale * 0.25f); // 7.75f to 6f, slower projectiles are harder to avoid - if (nearbyActiveTiles < 300) - num742 = 8.5f; - if (CalamityWorld.bossRushActive) - num742 *= 1.5f; - - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - - int damage = 30; - int numProj = 2; - - int spread = 2 + tentacleScale; // 3 to 10, wider spread is harder to avoid - if (nearbyActiveTiles < 300) - spread = (Main.rand.NextBool(2) ? 3 : 6) + (tentacleScale / 2); - - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(num743, num744).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(vector93.X, vector93.Y, perturbedSpeed.X, perturbedSpeed.Y, ProjectileID.PoisonSeedPlantera, damage, 0f, Main.myPlayer, 0f, 0f); - } - npc.localAI[3] = 0f; - } - } - - // Fire spread of spore clouds - if (tentaclesDead) - { - calamityGlobalNPC.newAI[0] += 1f + (2f * (0.5f - lifeRatio)); - - if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 270f : 300f)) - { - Main.PlaySound(SoundID.Item20, npc.position); - - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); - float num742 = CalamityWorld.bossRushActive ? 10f : 7f; - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - - int damage = 35; - int numProj = 4; - - int spread = 30; - if (nearbyActiveTiles <= 300) - spread = (Main.rand.NextBool(2) ? 30 : 45); - - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; - double deltaAngle = rotation / (float)numProj; - double offsetAngle; - - for (int i = 0; i < numProj; i++) - { - offsetAngle = startAngle + deltaAngle * i; - float ai0 = (float)Main.rand.Next(3); - Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjectileType("SporeGasPlantera"), damage, 0f, Main.myPlayer, ai0, 0f); - } - - calamityGlobalNPC.newAI[0] = 0f; - } - } - } - - // Heal if on surface and it's daytime, else, gain defense - if (surface) - { - if (Main.dayTime) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 55, 0f, 0f, 200, default, 0.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.75f; - Main.dust[dust].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[dust].velocity = vector; - vector.Normalize(); - vector *= 86f; - Main.dust[dust].position = npc.Center - vector; - } - - // Heal, 25 seconds to reach full HP from 0 - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] >= 15f) - { - calamityGlobalNPC.newAI[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = npc.lifeMax / 100; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; - - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - else - { - npc.defense += 250; - if (npc.defense > 9999) - npc.defense = 9999; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedPlanterasHookAI(NPC npc, Mod mod) - { - // Variables - bool enrage = false; - bool despawn = false; - - // Despawn if Plantera is gone - if (NPC.plantBoss < 0) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - npc.netUpdate = true; - return false; - } - - // Percent life remaining, Plantera - float lifeRatio = (float)Main.npc[NPC.plantBoss].life / (float)Main.npc[NPC.plantBoss].lifeMax; - - // Despawn if Plantera's target is dead - if (Main.player[Main.npc[NPC.plantBoss].target].dead && !CalamityWorld.bossRushActive) - despawn = true; - - // Enrage if Plantera's target is on the surface - if (!CalamityWorld.bossRushActive && (((double)Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > (float)((Main.maxTilesY - 200) * 16)) | despawn)) - { - npc.localAI[0] -= 4f; - enrage = true; - } - - // Set centers for movement - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f) - npc.ai[0] = (float)((int)(npc.Center.X / 16f)); - if (npc.ai[1] == 0f) - npc.ai[1] = (float)((int)(npc.Center.X / 16f)); - } - - // Find new spot to move to after set time has passed - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Move immediately - if (npc.ai[0] == 0f || npc.ai[1] == 0f) - npc.localAI[0] = 0f; - - // Timer dictating whether to pick a new location or not - npc.localAI[0] -= (CalamityWorld.bossRushActive ? 4f : 1f) + (2f * (1f - lifeRatio)); - if (enrage) - npc.localAI[0] -= 6f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - npc.localAI[0] -= 0.5f; - - // Set timer to new amount if a different hook is currently moving - if (!despawn && npc.localAI[0] <= 0f && npc.ai[0] != 0f) - { - for (int num763 = 0; num763 < 200; num763++) - { - if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) - npc.localAI[0] = (float)Main.rand.Next(60, 301); - } - } - - // Pick a location to move to - if (npc.localAI[0] <= 0f) - { - // Reset timer - npc.localAI[0] = (float)Main.rand.Next(300, 601); - - // Pick location - bool flag50 = false; - int num764 = 0; - while (!flag50 && num764 <= 1000) - { - num764++; - - int num765 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.X / 16f); - int num766 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.Y / 16f); - - if (npc.ai[0] == 0f) - { - num765 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.X + Main.npc[NPC.plantBoss].Center.X) / 32f); - num766 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.Y + Main.npc[NPC.plantBoss].Center.Y) / 32f); - } - - if (despawn) - { - num765 = (int)Main.npc[NPC.plantBoss].position.X / 16; - num766 = (int)(Main.npc[NPC.plantBoss].position.Y + 400f) / 16; - } - - int num767 = 20; - num767 += (int)(100f * ((float)num764 / 1000f)); - int num768 = num765 + Main.rand.Next(-num767, num767 + 1); - int num769 = num766 + Main.rand.Next(-num767, num767 + 1); - - try - { - if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].wall > 0 && (num764 > 500 || lifeRatio < 0.5f))) - { - flag50 = true; - npc.ai[0] = (float)num768; - npc.ai[1] = (float)num769; - npc.netUpdate = true; - } - } - catch - { - } - } - } - } - - // Movement to new location - if (npc.ai[0] > 0f && npc.ai[1] > 0f) - { - // Hook movement velocity - float velocity = (CalamityWorld.bossRushActive ? 10f : 7f) + (3f * (1f - lifeRatio)); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - velocity += 1f; - if (enrage) - velocity *= 2f; - if (despawn) - velocity *= 2f; - - // Moving to new location - Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); - float num773 = npc.ai[0] * 16f - 8f - vector95.X; - float num774 = npc.ai[1] * 16f - 8f - vector95.Y; - float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); - if (num775 < 12f + velocity) - { - npc.velocity.X = num773; - npc.velocity.Y = num774; - } - else - { - num775 = velocity / num775; - npc.velocity.X = num773 * num775; - npc.velocity.Y = num774 * num775; - } - - // Rotation - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num776 = Main.npc[NPC.plantBoss].Center.X - vector96.X; - float num777 = Main.npc[NPC.plantBoss].Center.Y - vector96.Y; - npc.rotation = (float)Math.Atan2((double)num777, (double)num776) - 1.57f; - } - return false; - } - - public static bool BuffedPlanterasTentacleAI(NPC npc, Mod mod) - { - // Despawn if Plantera is gone - if (NPC.plantBoss < 0) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - npc.netUpdate = true; - return false; - } - - // Set Plantera to a variable - int num778 = NPC.plantBoss; - if (npc.ai[3] > 0f) - num778 = (int)npc.ai[3] - 1; - - // Movement variables - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - - // Target - npc.TargetClosest(true); - - // Velocity and acceleration - float num779 = CalamityWorld.bossRushActive ? 1f : 0.5f; - float num781 = 1f - (float)npc.life / (float)npc.lifeMax; - float num780 = (CalamityWorld.bossRushActive ? 300f : 200f) + (num781 * 50f); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num780 += 25f; - - // Despawn if Plantera is gone - if (!Main.npc[num778].active || NPC.plantBoss < 0) - { - npc.active = false; - return false; - } - - // Movement - float num782 = Main.npc[num778].position.X + (float)(Main.npc[num778].width / 2); - float num783 = Main.npc[num778].position.Y + (float)(Main.npc[num778].height / 2); - Vector2 vector97 = new Vector2(num782, num783); - float num784 = num782 + npc.ai[0]; - float num785 = num783 + npc.ai[1]; - float num786 = num784 - vector97.X; - float num787 = num785 - vector97.Y; - float num788 = (float)Math.Sqrt((double)(num786 * num786 + num787 * num787)); - num788 = num780 / num788; - num786 *= num788; - num787 *= num788; - if (npc.position.X < num782 + num786) - { - npc.velocity.X += num779; - if (npc.velocity.X < 0f && num786 > 0f) - npc.velocity.X *= 0.9f; - } - else if (npc.position.X > num782 + num786) - { - npc.velocity.X -= num779; - if (npc.velocity.X > 0f && num786 < 0f) - npc.velocity.X *= 0.9f; - } - if (npc.position.Y < num783 + num787) - { - npc.velocity.Y += num779; - if (npc.velocity.Y < 0f && num787 > 0f) - npc.velocity.Y *= 0.9f; - } - else if (npc.position.Y > num783 + num787) - { - npc.velocity.Y -= num779; - if (npc.velocity.Y > 0f && num787 < 0f) - npc.velocity.Y *= 0.9f; - } - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - if (npc.velocity.Y > 8f) - npc.velocity.Y = 8f; - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - - // Direction and rotation - if (num786 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num787, (double)num786); - } - if (num786 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num787, (double)num786) + 3.14f; - } - return false; - } - #endregion - - #region Buffed Golem AI - public static bool BuffedGolemAI(NPC npc, bool enraged, Mod mod) - { - // whoAmI variable - NPC.golemBoss = npc.whoAmI; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - bool phase4 = lifeRatio < 0.25f; - - // Spawn parts - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - NPC.NewNPC((int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft, 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight, 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead, 0, 0f, 0f, 0f, 0f, 255); - } - - // Despawn - if (npc.target >= 0 && Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - npc.noTileCollide = true; - } - - // Enrage if the target isn't inside the temple - bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) - enrage = false; - } - if (CalamityWorld.bossRushActive) - enrage = true; - - // Alpha - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 0f; - } - - // Check for body parts - bool flag40 = NPC.AnyNPCs(NPCID.GolemHead); - bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); - bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = flag40 || flag41 || flag42; - - // Damage - if (!flag40) - npc.damage = (int)((float)npc.defDamage * 1.5f); - - // Phase 2, check for free head - bool flag43 = NPC.AnyNPCs(NPCID.GolemHeadFree); - - // Spawn arm dust - if (!flag41) - { - int num642 = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num642]; - dust.alpha += Main.rand.Next(100); - dust.velocity *= 0.2f; - dust.velocity.Y -= (0.5f + (float)Main.rand.Next(10) * 0.1f); - dust.fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - - if (Main.rand.Next(10) == 0) - { - num642 = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); - if (Main.rand.Next(20) != 0) - { - Main.dust[num642].noGravity = true; - dust = Main.dust[num642]; - dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - dust.velocity.Y -= 1f; - } - } - } - if (!flag42) - { - int num643 = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num643]; - dust.alpha += Main.rand.Next(100); - dust.velocity *= 0.2f; - dust.velocity.Y -= (0.5f + (float)Main.rand.Next(10) * 0.1f); - dust.fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - - if (Main.rand.Next(10) == 0) - { - num643 = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); - if (Main.rand.Next(20) != 0) - { - Main.dust[num643].noGravity = true; - dust = Main.dust[num643]; - dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - dust.velocity.Y -= 1f; - } - } - } - - // Jump - if (npc.ai[0] == 0f) - { - npc.noTileCollide = false; - - if (npc.velocity.Y == 0f) - { - // Laser fire when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && !flag40) - { - npc.localAI[1] += 1f; - - float divisor = 15f - - (phase2 ? 4f : 0f) - - (phase3 ? 3f : 0f) - - (phase4 ? 2f : 0f); - - if (enrage) - divisor = 5f; - - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y - 60f); - if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, vector82) > 160f || !flag43)) - { - float num673 = enrage ? 12f : 6f; - float num674 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; - float num675 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; - float num676 = (float)Math.Sqrt((double)(num674 * num674 + num675 * num675)); - - num676 = num673 / num676; - num674 *= num676; - num675 *= num676; - vector82.X += num674 * 3f; - vector82.Y += num675 * 3f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, ProjectileID.EyeBeam, 35, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num677].timeLeft = 480; - } - } - - if (npc.localAI[1] >= 15f) - npc.localAI[1] = 0f; - } - - // Slow down - npc.velocity.X *= 0.8f; - - // Delay before jumping - npc.ai[1] += 1f; - if (npc.ai[1] > 0f) - { - npc.ai[1] += 1f; - if (enrage || CalamityWorld.death) - npc.ai[1] += 18f; - else - { - if (!flag41) - npc.ai[1] += 6f; - if (!flag42) - npc.ai[1] += 6f; - if (!flag40) - npc.ai[1] += 6f; - } - } - if (npc.ai[1] >= 300f) - { - npc.ai[1] = -20f; - npc.frameCounter = 0.0; - } - else if (npc.ai[1] == -1f) - { - // Set jump velocity - npc.TargetClosest(true); - - float velocityX = 4f + (8f * (1f - lifeRatio)); - if (enrage) - velocityX *= 1.5f; - - npc.velocity.X = velocityX * (float)npc.direction; - - if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) - npc.velocity.Y = ((!flag43 && !flag40) ? -15.1f : -12.1f); - else - npc.velocity.Y = 1f; - - npc.noTileCollide = true; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - } - } - - // Fall down - else if (npc.ai[0] == 1f) - { - if (npc.velocity.Y == 0f) - { - // Play sound - Main.PlaySound(SoundID.Item14, npc.position); - - npc.ai[0] = 0f; - - // Dust and gore - for (int num644 = (int)npc.position.X - 20; num644 < (int)npc.position.X + npc.width + 40; num644 += 20) - { - for (int num645 = 0; num645 < 4; num645++) - { - int num646 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, 31, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num646]; - dust.velocity *= 0.2f; - } - int num647 = Gore.NewGore(new Vector2((float)(num644 - 20), npc.position.Y + (float)npc.height - 8f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num647]; - gore.velocity *= 0.4f; - } - - // Fireball explosion when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && !flag40) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity.Y *= 6f; - Main.dust[num622].velocity.X *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity.X *= 2f; - } - - int spawnX = (int)(npc.width / 2); - for (int i = 0; i < 5; i++) - { - float velocityX = Main.rand.NextBool() ? (float)Main.rand.Next(4, 6) : (float)Main.rand.Next(-5, -3); - float velocityY = (float)Main.rand.Next(-1, 2); - - if (enrage) - { - velocityX *= 2f; - velocityY *= 2f; - } - - int proj = Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y + (float)(npc.height / 2) * 0.8f, - velocityX, velocityY, ProjectileID.Fireball, 37, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 240; - } - } - } - else - { - npc.TargetClosest(true); - - // Fall through - if (npc.target >= 0 && - ((Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f))) - npc.noTileCollide = true; - else - npc.noTileCollide = false; - - // Velocity when falling - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - { - npc.velocity.X *= 0.9f; - - if (Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height) - { - float fallSpeed = 0.2f + (0.8f * (1f - lifeRatio)); - if (enrage) - fallSpeed *= 1.5f; - - npc.velocity.Y += fallSpeed; - } - } - else - { - if (npc.direction < 0) - npc.velocity.X -= 0.2f; - else if (npc.direction > 0) - npc.velocity.X += 0.2f; - - float num648 = 3f + (6f * (1f - lifeRatio)); - if (enrage) - num648 *= 1.5f; - - if (npc.velocity.X < -num648) - npc.velocity.X = -num648; - if (npc.velocity.X > num648) - npc.velocity.X = num648; - } - } - } - - // Target - if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); - - // Despawn - int num649 = CalamityWorld.bossRushActive ? 4500 : 3000; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num649) - { - npc.TargetClosest(true); - - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num649) - npc.active = false; - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedGolemHeadAI(NPC npc, bool enraged, Mod mod) - { - // Don't collide - npc.noTileCollide = true; - - // Die if body is gone - if (NPC.golemBoss < 0) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - return false; - } - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Count body parts - bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); - bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = flag41 || flag42; - - // Stay in position on top of body - float num650 = 12f; - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num651 = Main.npc[NPC.golemBoss].Center.X - vector80.X; - float num652 = Main.npc[NPC.golemBoss].Center.Y - vector80.Y; - num652 -= 57f; - num651 -= 3f; - float num653 = (float)Math.Sqrt((double)(num651 * num651 + num652 * num652)); - if (num653 < 20f) - { - npc.rotation = 0f; - npc.velocity.X = num651; - npc.velocity.Y = num652; - } - else - { - num653 = num650 / num653; - npc.velocity.X = num651 * num653; - npc.velocity.Y = num652 * num653; - npc.rotation = npc.velocity.X * 0.1f; - } - - // Enrage if the target isn't inside the temple - bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) - enrage = false; - } - if (CalamityWorld.bossRushActive) - enrage = true; - - // Alpha - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 30f; - } - - // Spit fireballs if arms are alive - if (npc.ai[0] == 0f) - { - npc.ai[1] += 1f; - int num654 = 180; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num654 - 20)) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (npc.ai[1] >= (float)num654) - { - npc.TargetClosest(true); - - npc.ai[1] = 0f; - - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y + 10f); - float num655 = enrage ? 16f : 8f; - float num656 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector81.X; - float num657 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector81.Y; - float num658 = (float)Math.Sqrt((double)(num656 * num656 + num657 * num657)); - - num658 = num655 / num658; - num656 *= num658; - num657 *= num658; - - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(vector81.X, vector81.Y, num656, num657, ProjectileID.Fireball, 37, 0f, Main.myPlayer, 0f, 0f); - } - } - - // Shoot lasers and fireballs if arms are dead - else if (npc.ai[0] == 1f) - { - npc.TargetClosest(true); - - // Fire projectiles from eye positions - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y + 10f); - if (Main.player[npc.target].Center.X < npc.Center.X - (float)npc.width) - { - npc.localAI[1] = -1f; - vector82.X -= 40f; - } - else if (Main.player[npc.target].Center.X > npc.Center.X + (float)npc.width) - { - npc.localAI[1] = 1f; - vector82.X += 40f; - } - else - npc.localAI[1] = 0f; - - // Fireballs - npc.ai[1] += 1f + (2f * (1f - lifeRatio)); - - int num662 = 240; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num662 - 20)) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (npc.ai[1] >= (float)num662) - { - npc.TargetClosest(true); - - npc.ai[1] = 0f; - - float num663 = enrage ? 18f : 12f; - float num664 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; - float num665 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); - - num666 = num663 / num666; - num664 *= num666; - num665 *= num666; - - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(vector82.X, vector82.Y, num664, num665, ProjectileID.Fireball, 37, 0f, Main.myPlayer, 0f, 0f); - } - - // Lasers - npc.ai[2] += 1f + (3f * (1f - lifeRatio)); - if (enrage) - npc.ai[2] += 4f; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.ai[2] += 8f; - - if (npc.ai[2] >= 150f) - { - npc.ai[2] = 0f; - - int num670 = 35; - int num671 = ProjectileID.EyeBeam; - - if (npc.localAI[1] == 0f) - { - for (int num672 = 0; num672 < 2; num672++) - { - vector82 = new Vector2(npc.Center.X, npc.Center.Y - 22f); - if (num672 == 0) - vector82.X -= 18f; - else - vector82.X += 18f; - - float num673 = 9f; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - num673 = 14f; - - float num674 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; - float num675 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; - float num676 = (float)Math.Sqrt((double)(num674 * num674 + num675 * num675)); - - num676 = num673 / num676; - num674 *= num676; - num675 *= num676; - vector82.X += num674 * 3f; - vector82.Y += num675 * 3f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, num671, num670, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num677].timeLeft = (enrage ? 480 : 300); - } - } - } - else if (npc.localAI[1] != 0f) - { - vector82 = new Vector2(npc.Center.X, npc.Center.Y - 22f); - if (npc.localAI[1] == -1f) - vector82.X -= 30f; - else if (npc.localAI[1] == 1f) - vector82.X += 30f; - - float num678 = 9f; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - num678 = 14f; - - float num679 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; - float num680 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; - float num681 = (float)Math.Sqrt((double)(num679 * num679 + num680 * num680)); - - num681 = num678 / num681; - num679 *= num681; - num680 *= num681; - vector82.X += num679 * 3f; - vector82.Y += num680 * 3f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num682 = Projectile.NewProjectile(vector82.X, vector82.Y, num679, num680, num671, num670, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num682].timeLeft = (enrage ? 480 : 300); - } - } - } - } - - // Laser fire if arms are dead - if (!flag41 && !flag42) - { - npc.ai[0] = 1f; - return false; - } - npc.ai[0] = 0f; - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedGolemHeadFreeAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Die if body is gone - if (NPC.golemBoss < 0) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - return false; - } - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - float golemLifeRatio = (float)Main.npc[NPC.golemBoss].life / (float)Main.npc[NPC.golemBoss].lifeMax; - float combinedRatio = lifeRatio + golemLifeRatio; - - // Phases - bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.4f || golemLifeRatio < 0.7f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase4 = lifeRatio < 0.1f || golemLifeRatio < 0.55f || CalamityWorld.death || CalamityWorld.bossRushActive; - - // Float through tiles or not - bool flag44 = false; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3) - { - npc.noTileCollide = true; - flag44 = true; - } - else - npc.noTileCollide = false; - - // Target - npc.TargetClosest(true); - - // Enrage if the target isn't inside the temple - bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) - enrage = false; - } - if (CalamityWorld.bossRushActive) - enrage = true; - - // Move to new location - if (npc.ai[3] <= 0f) - { - npc.ai[3] = 300f; - - float maxDistance = 300f; - - // Four corners around target - if (phase3) - { - if (calamityGlobalNPC.newAI[1] == -maxDistance) - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - case 300: - calamityGlobalNPC.newAI[0] = -maxDistance; - break; - case -300: - calamityGlobalNPC.newAI[1] = maxDistance; - break; - default: - break; - } - } - else - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - case -300: - calamityGlobalNPC.newAI[0] = maxDistance; - break; - case 300: - calamityGlobalNPC.newAI[1] = -maxDistance; - break; - default: - break; - } - } - } - - // Above target - else if (phase2) - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - calamityGlobalNPC.newAI[0] = maxDistance; - break; - case 300: - calamityGlobalNPC.newAI[0] = -maxDistance; - break; - case -300: - calamityGlobalNPC.newAI[0] = 0f; - break; - default: - break; - } - } - else - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = -maxDistance; - } - } - - npc.ai[3] -= 1f + - (phase2 ? 1f : 0f) + - (phase3 ? 1f : 0f) + - (phase4 ? 2f : 0f); - - float offsetX = calamityGlobalNPC.newAI[0]; - float offsetY = calamityGlobalNPC.newAI[1]; - - // Velocity and acceleration - float num700 = 7f + - (phase2 ? 4f : 0f) + - (phase3 ? 14f : 0f); - - Vector2 vector87 = new Vector2(npc.Center.X, npc.Center.Y); - float num702 = Main.player[npc.target].Center.X - vector87.X + offsetX; - float num703 = Main.player[npc.target].Center.Y - vector87.Y + offsetY; - float num704 = (float)Math.Sqrt((double)(num702 * num702 + num703 * num703)); - - // Static movement - if (phase3) - { - if (enrage) - num700 = 25f; - - if (num704 < num700) - { - npc.velocity.X = num702; - npc.velocity.Y = num703; - } - else - { - num704 = num700 / num704; - npc.velocity.X = num702 * num704; - npc.velocity.Y = num703 * num704; - } - } - - // Rubber band movement - else - { - if (enrage) - num700 = 11f; - - float num701 = 0.1f + (phase2 ? 0.1f : 0f); - if (enrage) - num701 = 0.2f; - - num704 = num700 / num704; - num702 *= num704; - num703 *= num704; - - if (npc.velocity.X < num702) - { - npc.velocity.X += num701; - if (npc.velocity.X < 0f && num702 > 0f) - npc.velocity.X += num701; - } - else if (npc.velocity.X > num702) - { - npc.velocity.X -= num701; - if (npc.velocity.X > 0f && num702 < 0f) - npc.velocity.X -= num701; - } - if (npc.velocity.Y < num703) - { - npc.velocity.Y += num701; - if (npc.velocity.Y < 0f && num703 > 0f) - npc.velocity.Y += num701; - } - else if (npc.velocity.Y > num703) - { - npc.velocity.Y -= num701; - if (npc.velocity.Y > 0f && num703 < 0f) - npc.velocity.Y -= num701; - } - } - - // Fireballs - npc.ai[1] += 1f + (2f * (2f - (lifeRatio + golemLifeRatio))); - - int num705 = 360; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num705 - 20)) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (flag44 && !phase3) - npc.ai[1] = 20f; - - if (npc.ai[1] >= (float)num705 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) - { - npc.TargetClosest(true); - - npc.ai[1] = 0f; - - Vector2 vector88 = new Vector2(npc.Center.X, npc.Center.Y - 10f); - float num706 = enrage ? 10f : 5f; - float num709 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector88.X; - float num710 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector88.Y; - float num711 = (float)Math.Sqrt((double)(num709 * num709 + num710 * num710)); - - num711 = num706 / num711; - num709 *= num711; - num710 *= num711; - - int projectileType = phase3 ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(vector88.X, vector88.Y, num709, num710, projectileType, 40, 0f, Main.myPlayer, 0f, 0f); - if (projectileType == ProjectileID.InfernoHostileBolt) - { - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; - Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; - Main.projectile[proj].netUpdate = true; - } - } - } - - // Lasers - npc.ai[2] += 1f + (2f * (2f - (lifeRatio + golemLifeRatio))); - if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.ai[2] += 8f; - - if (npc.ai[2] >= 150f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) - { - npc.ai[2] = 0f; - - for (int num713 = 0; num713 < 2; num713++) - { - Vector2 vector89 = new Vector2(npc.Center.X, npc.Center.Y - 50f); - if (num713 == 0) - vector89.X -= 14f; - else if (num713 == 1) - vector89.X += 14f; - - float num714 = 5f + (2f * (2f - (lifeRatio + golemLifeRatio))); - float num717 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector89.X; - float num718 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector89.Y; - float num719 = (float)Math.Sqrt((double)(num717 * num717 + num718 * num718)); - - num719 = num714 / num719; - num717 *= num719; - num718 *= num719; - vector89.X += num717 * 3f; - vector89.Y += num718 * 3f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num720 = Projectile.NewProjectile(vector89.X, vector89.Y, num717, num718, ProjectileID.EyeBeam, 35, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num720].timeLeft = (enrage ? 480 : 300); - } - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Duke Fishron AI - public static bool BuffedDukeFishronAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Variables - float num = 0.6f * Main.damageMultiplier; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.66; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33 : 0.2); - bool phase2AI = npc.ai[0] > 4f; - bool phase3AI = npc.ai[0] > 9f; - bool charging = npc.ai[3] < 10f; - - // Adjust stats - if (phase3AI) - { - npc.damage = (int)((float)npc.defDamage * 1.1f * num); - npc.defense = (int)((float)npc.defDefense * 0.75f); - } - else if (phase2AI) - { - npc.damage = (int)((float)npc.defDamage * 1.2f * num); - npc.defense = npc.defDefense; - } - else - { - npc.damage = npc.defDamage; - npc.defense = (int)((float)npc.defDefense * 1.2f); - } - - int num2 = 30; - float num3 = 0.55f; - float scaleFactor = 8.5f; - if (phase3AI) - { - num3 = 0.7f; - scaleFactor = 12f; - } - else if (phase2AI & charging) - { - num3 = 0.6f; - scaleFactor = 10f; - } - - int chargeTime = 28; - float chargeVelocity = 17f; - if (phase3AI) - { - chargeTime = 25; - chargeVelocity = 27f; - } - else if (charging & phase2AI) - { - chargeTime = 27; - chargeVelocity = 21f; - } - - if (CalamityWorld.bossRushActive) - { - num2 = 25; - num3 *= 1.1f; - scaleFactor *= 1.15f; - chargeTime -= 2; - chargeVelocity *= 1.25f; - } - - // Variables - int num6 = CalamityWorld.bossRushActive ? 40 : 80; - int num7 = 4; - float num8 = 0.3f; - float scaleFactor2 = 5f; - int num9 = 90; - int num10 = 180; - int num11 = 180; - int num12 = 30; - int num13 = CalamityWorld.bossRushActive ? 60 : 120; - int num14 = 4; - float scaleFactor3 = 6f; - float scaleFactor4 = 20f; - float num15 = 6.28318548f / (float)(num13 / 2); - int num16 = 75; - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; - - // Get target - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - // Despawn - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.velocity.Y -= 0.4f; - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - - if (npc.ai[0] > 4f) - npc.ai[0] = 5f; - else - npc.ai[0] = 0f; - - npc.ai[2] = 0f; - } - - // Enrage variable - bool enrage = !CalamityWorld.bossRushActive && - (player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400))); - - // If the player isn't in the ocean biome or Fishron is transitioning between phases, become immune - if (!phase3AI) - npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f || enrage; - - // Enrage - if (enrage) - { - num2 = 20; - npc.damage = npc.defDamage * 2; - npc.defense = npc.defDefense * 2; - npc.ai[3] = 0f; - chargeVelocity += 8f; - } - - // Spawn cthulhunadoes in phase 3 - if (phase3AI) - { - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 600f) - { - calamityGlobalNPC.newAI[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - - npc.netUpdate = true; - } - } - - // Set variables for spawn effects - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - // Rotation - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); - if (npc.spriteDirection == 1) - num17 += 3.14159274f; - if (num17 < 0f) - num17 += 6.28318548f; - if (num17 > 6.28318548f) - num17 -= 6.28318548f; - if (npc.ai[0] == -1f) - num17 = 0f; - if (npc.ai[0] == 3f) - num17 = 0f; - if (npc.ai[0] == 4f) - num17 = 0f; - if (npc.ai[0] == 8f) - num17 = 0f; - - float num18 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f) - num18 = 0f; - if (npc.ai[0] == 7f) - num18 = 0f; - if (npc.ai[0] == 3f) - num18 = 0.01f; - if (npc.ai[0] == 4f) - num18 = 0.01f; - if (npc.ai[0] == 8f) - num18 = 0.01f; - - if (npc.rotation < num17) - { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) - npc.rotation -= num18; - else - npc.rotation += num18; - } - if (npc.rotation > num17) - { - if ((double)(npc.rotation - num17) > 3.1415926535897931) - npc.rotation += num18; - else - npc.rotation -= num18; - } - - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - if (npc.rotation < 0f) - npc.rotation += 6.28318548f; - if (npc.rotation > 6.28318548f) - npc.rotation -= 6.28318548f; - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - - // Alpha adjustments - if (npc.ai[0] != -1f && npc.ai[0] < 9f) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn effects - if (npc.ai[0] == -1f) - { - // Velocity - npc.velocity *= 0.98f; - - // Direction - int num19 = Math.Sign(player.Center.X - vector.X); - if (num19 != 0) - { - npc.direction = num19; - npc.spriteDirection = -npc.direction; - } - - // Alpha - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn dust and play sound - if (npc.ai[2] == (float)(num9 - 30)) - { - int num20 = 36; - for (int i = 0; i < num20; i++) - { - Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + npc.Center; - Vector2 vector2 = expr_80F - npc.Center; - int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); - Main.dust[num21].noGravity = true; - Main.dust[num21].noLight = true; - Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; - } - - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num16) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Phase 1 - else if (npc.ai[0] == 0f && !player.dead) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X -= num3; - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y -= num3; - } - - // Rotation and direction - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) - { - if (npc.ai[2] == 0f && num22 != npc.direction) - npc.rotation += 3.14159274f; - - npc.direction = num22; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num23 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - num23 = 1; - break; - case 10: - npc.ai[3] = 1f; - num23 = 2; - break; - case 11: - npc.ai[3] = 0f; - num23 = 3; - break; - } - - if (phase2) - num23 = 4; - - // Set velocity for charge - if (num23 == 1) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - - // Direction - if (num22 != 0) - { - npc.direction = num22; - - if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - } - - // Bubbles - else if (num23 == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Spawn sharknadoes - else if (num23 == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to phase 2 - else if (num23 == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[0] == 1f) - { - // Accelerate - npc.velocity *= 1.01f; - - // Spawn dust - int num24 = 7; - for (int j = 0; j < num24; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - - // Bubble belch - else if (npc.ai[0] == 2f) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - - Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor2; - if (npc.velocity.X < vector5.X) - { - npc.velocity.X += num8; - if (npc.velocity.X < 0f && vector5.X > 0f) - npc.velocity.X += num8; - } - else if (npc.velocity.X > vector5.X) - { - npc.velocity.X -= num8; - if (npc.velocity.X > 0f && vector5.X < 0f) - npc.velocity.X -= num8; - } - if (npc.velocity.Y < vector5.Y) - { - npc.velocity.Y += num8; - if (npc.velocity.Y < 0f && vector5.Y > 0f) - npc.velocity.Y += num8; - } - else if (npc.velocity.Y > vector5.Y) - { - npc.velocity.Y -= num8; - if (npc.velocity.Y > 0f && vector5.Y < 0f) - npc.velocity.Y -= num8; - } - - // Play sounds and spawn bubbles - if (npc.ai[2] == 0f) - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - - if (npc.ai[2] % (float)num7 == 0f) - { - Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (float)(npc.width + 20) / 2f + vector; - NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, NPCID.DetonatingBubble, 0, 0f, 0f, 0f, 0f, 255); - } - } - - // Direction - int num26 = Math.Sign(player.Center.X - vector.X); - if (num26 != 0) - { - npc.direction = num26; - if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num6) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Sharknado spawn - else if (npc.ai[0] == 3f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound and spawn sharknadoes - if (npc.ai[2] == (float)(num9 - 30)) - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 9, 1f, 0f); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num9 - 30)) - { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; - bool normal = Main.rand.NextBool(); - float velocityY = normal ? 8f : -4f; - float ai1 = normal ? 0f : -1f; - - Projectile.NewProjectile(vector7.X, vector7.Y, (float)(npc.direction * 3), velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); - Projectile.NewProjectile(vector7.X, vector7.Y, (float)(-(float)npc.direction * 3), velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); - - velocityY = normal ? -4f : 8f; - ai1 = normal ? -1f : 0f; - Projectile.NewProjectile(vector7.X, vector7.Y, 0f, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Transition to phase 2 - else if (npc.ai[0] == 4f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == (float)(num10 - 60)) - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num10) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - - // Phase 2 - else if (npc.ai[0] == 5f && !player.dead) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - - Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector8.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector8.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector8.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector8.X < 0f) - npc.velocity.X -= num3; - } - if (npc.velocity.Y < vector8.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector8.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector8.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector8.Y < 0f) - npc.velocity.Y -= num3; - } - - // Direction and rotation - int num27 = Math.Sign(player.Center.X - vector.X); - if (num27 != 0) - { - if (npc.ai[2] == 0f && num27 != npc.direction) - npc.rotation += 3.14159274f; - - npc.direction = num27; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num28 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - num28 = 1; - break; - case 6: - npc.ai[3] = 1f; - num28 = 2; - break; - case 7: - npc.ai[3] = 0f; - num28 = 3; - break; - } - - if (phase3) - num28 = 4; - - // Set velocity for charge - if (num28 == 1) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - - // Direction - if (num27 != 0) - { - npc.direction = num27; - - if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - } - - // Set velocity for spin - else if (num28 == 2) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - - // Direction - if (num27 != 0) - { - npc.direction = num27; - - if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Spawn cthulhunado - else if (num28 == 3) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to next phase - else if (num28 == 4) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[0] == 6f) - { - // Accelerate - npc.velocity *= 1.01f; - - // Spawn dust - int num29 = 7; - for (int k = 0; k < num29; k++) - { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(k - (num29 / 2 - 1)) * 3.1415926535897931 / (double)((float)num29), default) + vector; - Vector2 vector9 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, 172, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); - Main.dust[num30].noGravity = true; - Main.dust[num30].noLight = true; - Main.dust[num30].velocity /= 4f; - Main.dust[num30].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - - // Bubble spin - else if (npc.ai[0] == 7f) - { - // Play sounds and spawn bubbles - if (npc.ai[2] == 0f) - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - - if (npc.ai[2] % (float)num14 == 0f) - { - Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.DetonatingBubble, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy((double)(1.57079637f * (float)npc.direction), default) * scaleFactor3; - Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = (float)Main.rand.Next(80, 121) / 100f; - - if (npc.ai[2] % (float)(num14 * 5) == 0f) - { - int npc2 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.Sharkron2, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[npc2].ai[1] = 89f; - } - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default); - npc.rotation -= num15 * (float)npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Spawn cthulhunado - else if (npc.ai[0] == 8f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound and spawn cthulhunado - if (npc.ai[2] == (float)(num9 - 30)) - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num9 - 30)) - Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Transition to phase 3 - else if (npc.ai[0] == 9f) - { - // Alpha adjustments - if (npc.ai[2] < (float)(num11 - 90)) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - else if (npc.alpha < 255) - { - npc.alpha += 4; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == (float)(num11 - 60)) - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - - // Phase 3 - else if (npc.ai[0] == 10f && !player.dead) - { - npc.dontTakeDamage = false; - npc.chaseable = false; - - // Alpha - if (npc.alpha < 255) - { - npc.alpha += 25; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Teleport location - if (npc.ai[1] == 0f) - npc.ai[1] = (float)(360 * Math.Sign((vector - player.Center).X)); - - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, num3); - - // Rotation and direction - int num32 = Math.Sign(player.Center.X - vector.X); - if (num32 != 0) - { - if (npc.ai[2] == 0f && num32 != npc.direction) - { - npc.rotation += 3.14159274f; - for (int l = 0; l < npc.oldPos.Length; l++) - npc.oldPos[l] = Vector2.Zero; - } - - npc.direction = num32; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num33 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - num33 = 1; - break; - case 1: - case 4: - case 8: - num33 = 2; - break; - } - - // Set velocity for charge - if (num33 == 1) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - - // Direction - if (num32 != 0) - { - npc.direction = num32; - - if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - } - - // Pause - else if (num33 == 2) - { - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[0] == 11f) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - - // Accelerate - npc.velocity *= 1.01f; - - // Alpha - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; - - // Spawn dust - int num34 = 7; - for (int m = 0; m < num34; m++) - { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default) + vector; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); - Main.dust[num35].noGravity = true; - Main.dust[num35].noLight = true; - Main.dust[num35].velocity /= 4f; - Main.dust[num35].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - - // Pause before teleport - else if (npc.ai[0] == 12f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - - // Alpha - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == (float)(num12 / 2)) - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num12 / 2)) - { - // Teleport location - if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - - // Rotation and direction - Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); - vector = (npc.Center = center); - int num36 = Math.Sign(player.Center.X - vector.X); - if (num36 != 0) - { - if (npc.ai[2] == 0f && num36 != npc.direction) - { - npc.rotation += 3.14159274f; - for (int n = 0; n < npc.oldPos.Length; n++) - npc.oldPos[n] = Vector2.Zero; - } - - npc.direction = num36; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num12) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ai[3] += 1f; - if (npc.ai[3] >= 9f) - npc.ai[3] = 0f; - - npc.netUpdate = true; - } - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Cultist AI - public static bool BuffedCultistAI(NPC npc, bool enraged, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Set contact damage to 0 - npc.damage = (npc.defDamage = 0); - - // Chant sound - if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, Main.rand.Next(88, 92), 1f, 0f); - } - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.8f; - bool phase3 = lifeRatio < 0.6f; - bool phase4 = lifeRatio < 0.4f; - bool phase5 = lifeRatio < 0.2f; - - // Variables - bool isCultist = npc.type == NPCID.CultistBoss; - bool dontTakeDamage = false; - - int iceMistDamage = 38; - int fireballDamage = isCultist ? 30 : 27; - int lightningDamage = 45; - - int iceMistFireRate = 60 - - (phase2 ? 5 : 0) - - (phase3 ? 5 : 0) - - (phase4 ? 5 : 0) - - (phase5 ? 5 : 0); - - float iceMistSpeed = CalamityWorld.death ? 6.5f : 6f; - - int fireballFireRate = 12; - - float fireballSpeed = (CalamityWorld.death ? 7f : 6.5f) - (isCultist ? 0f : 3f); - - int lightningOrbFireRate = 40 - - (phase2 ? 5 : 0) - - (phase3 ? 5 : 0) - - (phase4 ? 5 : 0) - - (phase5 ? 5 : 0); - - int ancientLightSpawnRate = 30 - - (phase3 ? 10 : 0) - - (phase5 ? 10 : 0); - - int idleTime = 40 - - (phase2 ? 5 : 0) - - (phase3 ? 5 : 0) - - (phase4 ? 5 : 0) - - (phase5 ? 5 : 0); - - float timeToFinishRitual = 420f - - (phase2 ? 90f : 0f) - - (phase3 ? 60f : 0f) - - (phase4 ? 30f : 0f) - - (phase5 ? 15f : 0f); - - if (CalamityWorld.bossRushActive) - { - iceMistFireRate = 30; - iceMistSpeed = 9f; - fireballSpeed *= 1.5f; - lightningOrbFireRate = 20; - ancientLightSpawnRate = 10; - idleTime = 20; - } - - // Center and target - Vector2 center = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - // Enrage - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 180f) - { - calamityGlobalNPC.newAI[0] = 180f; - iceMistSpeed = 8f; - iceMistFireRate = 30; - lightningOrbFireRate = 15; - ancientLightSpawnRate = 5; - idleTime = 15; - timeToFinishRitual = 180f; - } - } - else - { - if (calamityGlobalNPC.newAI[0] > 0f) - calamityGlobalNPC.newAI[0] -= 1f; - } - - // Cultist clone AI - if (!isCultist) - { - if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - return false; - } - npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; - npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; - dontTakeDamage = true; - } - - // Stop spawning ritual if hit - else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual && npc.justHit) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - Main.projectile[(int)npc.ai[2]].ai[1] = -1f; - Main.projectile[(int)npc.ai[2]].netUpdate = true; - } - - // Despawn - if (player.dead || Vector2.Distance(player.Center, center) > 5600f) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - new List().Add(npc.whoAmI); - for (int j = 0; j < 200; j++) - { - if (Main.npc[j].active && Main.npc[j].type == 440 && Main.npc[j].ai[3] == (float)npc.whoAmI) - { - Main.npc[j].life = 0; - Main.npc[j].HitEffect(0, 10.0); - Main.npc[j].active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - } - } - - // Clones set to Cultist phase - float clonePhase = npc.ai[3]; - - // Spawn and play sound - if (npc.localAI[0] == 0f) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 89, 1f, 0f); - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - // Appear and do weird ritual shit with tablet - if (npc.ai[0] == -1f) - { - npc.alpha -= 5; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] += 1f; - if (npc.ai[1] >= 420f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[1] > 360f) - { - npc.velocity *= 0.95f; - if (npc.localAI[2] != 13f) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 105, 1f, 0f); - } - npc.localAI[2] = 13f; - } - else if (npc.ai[1] > 300f) - { - npc.velocity = -Vector2.UnitY; - npc.localAI[2] = 10f; - } - else if (npc.ai[1] > 120f) - { - npc.localAI[2] = 1f; - } - else - { - npc.localAI[2] = 0f; - } - dontTakeDamage = true; - } - - // Phase switch - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - npc.TargetClosest(false); - } - npc.localAI[2] = 10f; - int num14 = Math.Sign(player.Center.X - center.X); - if (num14 != 0) - { - npc.direction = (npc.spriteDirection = num14); - } - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)idleTime & isCultist) - { - int num15 = 0; - if (phase2) - { - switch ((int)npc.ai[3]) - { - case 0: - num15 = 0; - break; - case 1: - num15 = 1; - break; - case 2: - num15 = 0; - break; - case 3: - num15 = 5; - break; - case 4: - num15 = 0; - break; - case 5: - num15 = 3; - break; - case 6: - num15 = 0; - break; - case 7: - num15 = 5; - break; - case 8: - num15 = 0; - break; - case 9: - num15 = 2; - break; - case 10: - num15 = 0; - break; - case 11: - num15 = 3; - break; - case 12: - num15 = 0; - break; - case 13: - num15 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - num15 = 0; - break; - case 1: - num15 = 1; - break; - case 2: - num15 = 0; - break; - case 3: - num15 = 2; - break; - case 4: - num15 = 0; - break; - case 5: - num15 = 3; - break; - case 6: - num15 = 0; - break; - case 7: - num15 = 1; - break; - case 8: - num15 = 0; - break; - case 9: - num15 = 2; - break; - case 10: - num15 = 0; - break; - case 11: - num15 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } - - int maxValue = 6 - - (phase3 ? 2 : 0) - - (phase4 ? 1 : 0); - - // Spawn Ancient Dooms - if (phase2 && Main.rand.NextBool(maxValue) && num15 != 0 && num15 != 4 && num15 != 5 && NPC.CountNPCS(NPCID.AncientDoom) < 10) - { - num15 = 6; - } - - // Move above target, also moves clones - if (num15 == 0) - { - // Set a location to move to - float num16 = (float)Math.Ceiling((double)((player.Center + new Vector2(0f, -100f) - center).Length() / 50f)); - if (num16 == 0f) - { - num16 = 1f; - } - - // Add self and clones to list - List list2 = new List(); - int num17 = 0; - list2.Add(npc.whoAmI); - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == (float)npc.whoAmI) - { - list2.Add(k); - } - } - - // Move self and clones to location - bool flag5 = list2.Count % 2 == 0; - foreach (int current2 in list2) - { - NPC nPC2 = Main.npc[current2]; - Vector2 center2 = nPC2.Center; - float num18 = (float)((num17 + flag5.ToInt() + 1) / 2) * 6.28318548f * 0.4f / (float)list2.Count; - if (num17 % 2 == 1) - { - num18 *= -1f; - } - if (list2.Count == 1) - { - num18 = 0f; - } - Vector2 value = new Vector2(0f, -1f).RotatedBy((double)num18, default) * new Vector2(150f, 200f); - Vector2 value2 = player.Center + value - center2; - nPC2.ai[0] = 1f; - nPC2.ai[1] = num16; - nPC2.velocity = (value2 / num16) * 2f; - if (npc.whoAmI >= nPC2.whoAmI) - { - nPC2.position -= nPC2.velocity; - } - nPC2.netUpdate = true; - num17++; - } - } - - // Set AI phase - if (num15 == 1) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - } - else if (num15 == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - else if (num15 == 3) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - else if (num15 == 4) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - } - if (num15 == 5) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - } - if (num15 == 6) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - } - npc.netUpdate = true; - } - } - - // Movement, then switch to a different attack - else if (npc.ai[0] == 1f) - { - dontTakeDamage = true; - npc.localAI[2] = 10f; - if (npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) - { - npc.position -= npc.velocity; - } - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Ice Mist - else if (npc.ai[0] == 2f) - { - npc.localAI[2] = 11f; - Vector2 vec = Vector2.Normalize(player.Center - center); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % iceMistFireRate == 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - List list3 = new List(); - for (int l = 0; l < 200; l++) - { - if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == (float)npc.whoAmI) - { - list3.Add(l); - } - } - foreach (int current3 in list3) - { - NPC nPC3 = Main.npc[current3]; - Vector2 center3 = nPC3.Center; - int num19 = Math.Sign(player.Center.X - center3.X); - if (num19 != 0) - { - nPC3.direction = (nPC3.spriteDirection = num19); - } - vec = Vector2.Normalize(player.Center - center3 + player.velocity * 20f); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - Vector2 vector = center3 + new Vector2((float)(npc.direction * 30), 12f); - Vector2 vector2 = vec * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector2 = vector2.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector.X, vector.Y, vector2.X, vector2.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec = Vector2.Normalize(player.Center - center + player.velocity * 20f); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - Vector2 vector3 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); - Vector2 vector4 = vec * iceMistSpeed; - Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + iceMistFireRate * 2)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Fireballs - else if (npc.ai[0] == 3f) - { - npc.localAI[2] = 11f; - Vector2 vec2 = Vector2.Normalize(player.Center - center); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % fireballFireRate == 0) - { - if ((int)(npc.ai[1] - 4f) / fireballFireRate == 2) - { - List list4 = new List(); - for (int num20 = 0; num20 < 200; num20++) - { - if (Main.npc[num20].active && Main.npc[num20].type == NPCID.CultistBossClone && Main.npc[num20].ai[3] == (float)npc.whoAmI) - { - list4.Add(num20); - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - foreach (int current4 in list4) - { - NPC nPC4 = Main.npc[current4]; - Vector2 center4 = nPC4.Center; - int num21 = Math.Sign(player.Center.X - center4.X); - if (num21 != 0) - { - nPC4.direction = (nPC4.spriteDirection = num21); - } - vec2 = Vector2.Normalize(player.Center - center4 + player.velocity * 20f); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - Vector2 vector5 = center4 + new Vector2((float)(npc.direction * 30), 12f); - Vector2 vector6 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector6 = vector6.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector5.X, vector5.Y, vector6.X, vector6.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - int num23 = Math.Sign(player.Center.X - center.X); - if (num23 != 0) - { - npc.direction = (npc.spriteDirection = num23); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec2 = Vector2.Normalize(player.Center - center + player.velocity * 20f); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - Vector2 vector7 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); - Vector2 vector8 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 4f); - vector8 = vector8.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector7.X, vector7.Y, vector8.X, vector8.Y, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + fireballFireRate * 4)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Lightning Orb - else if (npc.ai[0] == 4f) - { - if (isCultist) - { - npc.localAI[2] = 12f; - } - else - { - npc.localAI[2] = 11f; - } - if ((npc.ai[1] == 20f & isCultist) && Main.netMode != NetmodeID.MultiplayerClient) - { - List list5 = new List(); - for (int num25 = 0; num25 < 200; num25++) - { - if (Main.npc[num25].active && Main.npc[num25].type == NPCID.CultistBossClone && Main.npc[num25].ai[3] == (float)npc.whoAmI) - { - list5.Add(num25); - } - } - foreach (int current5 in list5) - { - NPC nPC5 = Main.npc[current5]; - Vector2 center5 = nPC5.Center; - int num26 = Math.Sign(player.Center.X - center5.X); - if (num26 != 0) - { - nPC5.direction = (nPC5.spriteDirection = num26); - } - Vector2 vec3 = Vector2.Normalize(player.Center - center5 + player.velocity * 20f); - if (vec3.HasNaNs()) - { - vec3 = new Vector2((float)npc.direction, 0f); - } - Vector2 vector9 = center5 + new Vector2((float)(npc.direction * 30), 12f); - Vector2 vector10 = vec3 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector10 = vector10.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector9.X, vector9.Y, vector10.X, vector10.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); - } - Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 100f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer, 0f, 0f); - } - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(20 + lightningOrbFireRate)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Spawn Clones, and Dragon or Cthulhu head - else if (npc.ai[0] == 5f) - { - npc.localAI[2] = 10f; - if (Vector2.Normalize(player.Center - center).HasNaNs()) - { - new Vector2((float)npc.direction, 0f); - } - if (npc.ai[1] >= 0f && npc.ai[1] < 30f) - { - dontTakeDamage = true; - float num28 = (npc.ai[1] - 0f) / 30f; - npc.alpha = (int)(num28 * 255f); - } - else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) - { - if ((npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient) & isCultist) - { - npc.localAI[1] += 1f; - Vector2 spinningpoint = new Vector2(180f, 0f); - List list6 = new List(); - for (int num29 = 0; num29 < 200; num29++) - { - if (Main.npc[num29].active && Main.npc[num29].type == NPCID.CultistBossClone && Main.npc[num29].ai[3] == (float)npc.whoAmI) - { - list6.Add(num29); - } - } - int num30 = 6 - list6.Count; - if (num30 > 2) - { - num30 = 2; - } - int num31 = list6.Count + num30 + 1; - float[] array = new float[num31]; - for (int num32 = 0; num32 < array.Length; num32++) - { - array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((double)((float)num32 * 6.28318548f / (float)num31 - 1.57079637f), default), player.Center); - } - int num33 = 0; - for (int num34 = 1; num34 < array.Length; num34++) - { - if (array[num33] > array[num34]) - { - num33 = num34; - } - } - if (num33 < num31 / 2) - { - num33 += num31 / 2; - } - else - { - num33 -= num31 / 2; - } - int num35 = num30; - for (int num36 = 0; num36 < array.Length; num36++) - { - if (num33 != num36) - { - Vector2 vector11 = npc.Center + spinningpoint.RotatedBy((double)((float)num36 * 6.28318548f / (float)num31 - 1.57079637f), default); - if (num35-- > 0) - { - int num37 = NPC.NewNPC((int)vector11.X, (int)vector11.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num37].ai[3] = (float)npc.whoAmI; - Main.npc[num37].netUpdate = true; - Main.npc[num37].localAI[1] = npc.localAI[1]; - } - else - { - int num38 = list6[-num35 - 1]; - Main.npc[num38].Center = vector11; - NetMessage.SendData(23, -1, -1, null, num38, 0f, 0f, 0f, 0, 0, 0); - } - } - } - npc.ai[2] = (float)Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); - npc.Center += spinningpoint.RotatedBy((double)((float)num33 * 6.28318548f / (float)num31 - 1.57079637f), default); - npc.netUpdate = true; - list6.Clear(); - } - dontTakeDamage = true; - npc.alpha = 255; - if (isCultist) - { - Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; - vector12 -= npc.Center; - if (vector12 == Vector2.Zero) - { - vector12 = -Vector2.UnitY; - } - vector12.Normalize(); - if (Math.Abs(vector12.Y) < 0.77f) - { - npc.localAI[2] = 11f; - } - else if (vector12.Y < 0f) - { - npc.localAI[2] = 12f; - } - else - { - npc.localAI[2] = 10f; - } - int num39 = Math.Sign(vector12.X); - if (num39 != 0) - { - npc.direction = (npc.spriteDirection = num39); - } - } - else - { - Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector13 -= npc.Center; - if (vector13 == Vector2.Zero) - { - vector13 = -Vector2.UnitY; - } - vector13.Normalize(); - if (Math.Abs(vector13.Y) < 0.77f) - { - npc.localAI[2] = 11f; - } - else if (vector13.Y < 0f) - { - npc.localAI[2] = 12f; - } - else - { - npc.localAI[2] = 10f; - } - int num40 = Math.Sign(vector13.X); - if (num40 != 0) - { - npc.direction = (npc.spriteDirection = num40); - } - } - } - else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) - { - dontTakeDamage = true; - float num41 = (npc.ai[1] - 90f) / 30f; - npc.alpha = 255 - (int)(num41 * 255f); - } - else if (npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) - { - npc.alpha = 0; - if (isCultist) - { - Vector2 vector14 = Main.projectile[(int)npc.ai[2]].Center; - vector14 -= npc.Center; - if (vector14 == Vector2.Zero) - { - vector14 = -Vector2.UnitY; - } - vector14.Normalize(); - if (Math.Abs(vector14.Y) < 0.77f) - { - npc.localAI[2] = 11f; - } - else if (vector14.Y < 0f) - { - npc.localAI[2] = 12f; - } - else - { - npc.localAI[2] = 10f; - } - int num42 = Math.Sign(vector14.X); - if (num42 != 0) - { - npc.direction = (npc.spriteDirection = num42); - } - } - else - { - Vector2 vector15 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector15 -= npc.Center; - if (vector15 == Vector2.Zero) - { - vector15 = -Vector2.UnitY; - } - vector15.Normalize(); - if (Math.Abs(vector15.Y) < 0.77f) - { - npc.localAI[2] = 11f; - } - else if (vector15.Y < 0f) - { - npc.localAI[2] = 12f; - } - else - { - npc.localAI[2] = 10f; - } - int num43 = Math.Sign(vector15.X); - if (num43 != 0) - { - npc.direction = (npc.spriteDirection = num43); - } - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= timeToFinishRitual) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Pause - else if (npc.ai[0] == 6f) - { - npc.localAI[2] = 13f; - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(idleTime * 3)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Ancient Light - else if (npc.ai[0] == 7f) - { - npc.localAI[2] = 11f; - Vector2 vec4 = Vector2.Normalize(player.Center - center); - if (vec4.HasNaNs()) - { - vec4 = new Vector2((float)npc.direction, 0f); - } - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) - { - if ((int)(npc.ai[1] - 4f) / ancientLightSpawnRate == 2) - { - List list7 = new List(); - for (int num44 = 0; num44 < 200; num44++) - { - if (Main.npc[num44].active && Main.npc[num44].type == NPCID.CultistBossClone && Main.npc[num44].ai[3] == (float)npc.whoAmI) - { - list7.Add(num44); - } - } - foreach (int current6 in list7) - { - NPC nPC6 = Main.npc[current6]; - Vector2 center6 = nPC6.Center; - int num45 = Math.Sign(player.Center.X - center6.X); - if (num45 != 0) - { - nPC6.direction = (nPC6.spriteDirection = num45); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec4 = Vector2.Normalize(player.Center - center6 + player.velocity * 20f); - if (vec4.HasNaNs()) - { - vec4 = new Vector2((float)npc.direction, 0f); - } - Vector2 vector16 = center6 + new Vector2((float)(npc.direction * 30), 12f); - int num46 = 0; - while ((float)num46 < 5f) - { - Vector2 vector17 = vec4 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector17 = vector17.RotatedByRandom(1.2566370964050293); - Projectile.NewProjectile(vector16.X, vector16.Y, vector17.X, vector17.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); - num46++; - } - } - } - } - int num47 = Math.Sign(player.Center.X - center.X); - if (num47 != 0) - { - npc.direction = (npc.spriteDirection = num47); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec4 = Vector2.Normalize(player.Center - center + player.velocity * 20f); - if (vec4.HasNaNs()) - { - vec4 = new Vector2((float)npc.direction, 0f); - } - Vector2 vector18 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); - float scaleFactor = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 11f : 10f; - if (CalamityWorld.bossRushActive) - scaleFactor *= 1.5f; - - float num48 = 0.251327425f; - int num49 = 0; - while ((float)num49 < 5f) - { - Vector2 vector19 = vec4 * scaleFactor; - vector19 = vector19.RotatedBy((double)(num48 * (float)num49 - (1.2566371f - num48) / 2f), default); - float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * 6.28318548f / 60f; - int num50 = NPC.NewNPC((int)vector18.X, (int)vector18.Y + 7, NPCID.AncientLight, 0, 0f, ai, vector19.X, vector19.Y, 255); - Main.npc[num50].velocity = vector19; - num49++; - } - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + ancientLightSpawnRate * 2)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Ancient Doom - else if (npc.ai[0] == 8f) - { - npc.localAI[2] = 13f; - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20 == 0) - { - List list8 = new List(); - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == NPCID.CultistBossClone && Main.npc[num51].ai[3] == (float)npc.whoAmI) - { - list8.Add(num51); - } - } - int num52 = list8.Count + 1; - if (num52 > 3) - { - num52 = 3; - } - int num53 = Math.Sign(player.Center.X - center.X); - if (num53 != 0) - { - npc.direction = (npc.spriteDirection = num53); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int num54 = 0; num54 < num52; num54++) - { - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector20 = Main.player[npc.target].Center - npc.Center; - int num55 = 20; - int num56 = 3; - int num57 = 7; - int num58 = 2; - int num59 = 0; - bool flag6 = false; - if (vector20.Length() > 2800f) - { - flag6 = true; - } - while (!flag6 && num59 < 100) - { - num59++; - int num60 = Main.rand.Next(point2.X - num55, point2.X + num55 + 1); - int num61 = Main.rand.Next(point2.Y - num55, point2.Y + num55 + 1); - if ((num61 < point2.Y - num57 || num61 > point2.Y + num57 || num60 < point2.X - num57 || num60 > point2.X + num57) && (num61 < point.Y - num56 || num61 > point.Y + num56 || num60 < point.X - num56 || num60 > point.X + num56) && !Main.tile[num60, num61].nactive()) - { - bool flag7 = true; - if (flag7 && Collision.SolidTiles(num60 - num58, num60 + num58, num61 - num58, num61 + num58)) - { - flag7 = false; - } - if (flag7) - { - NPC.NewNPC(num60 * 16 + 8, num61 * 16 + 8, NPCID.AncientDoom, 0, (float)npc.whoAmI, 0f, 0f, 0f, 255); - break; - } - } - } - } - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= 64f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Set Clones to Cultist phase - if (!isCultist) - { - npc.ai[3] = clonePhase; - } - - // Take damage or not - npc.dontTakeDamage = dontTakeDamage; - npc.chaseable = npc.ai[0] != -1f && npc.ai[0] != 5f; - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedAncientDoomAI(NPC npc, Mod mod) - { - npc.damage = (npc.defDamage = 0); - float num1496 = 420f; - float num1497 = 120f; - int num1498 = 1; - float value57 = 0f; - float value58 = 1f; - float num1499 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5.5f : 5f; - if (CalamityWorld.bossRushActive) - num1499 *= 1.5f; - - bool flag110 = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; - if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) - { - if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 2) - { - num1498 = 2; - } - if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 4) - { - num1498 = 3; - } - } - else - { - flag110 = true; - } - npc.ai[1] += (float)num1498; - float num1500 = npc.ai[1] / num1497; - num1500 = MathHelper.Clamp(num1500, 0f, 1f); - npc.position = npc.Center; - npc.scale = MathHelper.Lerp(value57, value58, num1500); - npc.Center = npc.position; - npc.alpha = (int)(255f - num1500 * 255f); - if (Main.rand.NextBool(6)) - { - Vector2 spinningpoint4 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust17 = Main.dust[Dust.NewDust(npc.Center - spinningpoint4 * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; - dust17.noGravity = true; - dust17.position = npc.Center - spinningpoint4 * (float)Main.rand.Next(10, 21) * npc.scale; - dust17.velocity = spinningpoint4.RotatedBy(1.5707963705062866, default) * 4f; - dust17.scale = 0.5f + Main.rand.NextFloat(); - dust17.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 spinningpoint5 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust18 = Main.dust[Dust.NewDust(npc.Center - spinningpoint5 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; - dust18.noGravity = true; - dust18.position = npc.Center - spinningpoint5 * 20f * npc.scale; - dust18.velocity = spinningpoint5.RotatedBy(-1.5707963705062866, default) * 2f; - dust18.scale = 0.5f + Main.rand.NextFloat(); - dust18.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 vector254 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust19 = Main.dust[Dust.NewDust(npc.Center - vector254 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; - dust19.position = npc.Center - vector254 * 20f * npc.scale; - dust19.velocity = Vector2.Zero; - dust19.scale = 0.5f + Main.rand.NextFloat(); - dust19.fadeIn = 0.5f; - dust19.noLight = true; - } - npc.localAI[0] += 0.05235988f; - npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy((double)(npc.ai[1] * 6.28318548f / 60f), default).Y * 0.25f; - if (npc.ai[1] >= num1496) - { - flag110 = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num; - for (int num1501 = 0; num1501 < 4; num1501 = num + 1) - { - Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy((double)(1.57079637f * (float)num1501), default); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.AncientDoomProjectile, 50, 0f, Main.myPlayer, 0f, 0f); - num = num1501; - } - } - } - if (flag110) - { - npc.HitEffect(0, 9999.0); - npc.active = false; - } - - return false; - } - #endregion - - #region Buffed Moon Lord AI - public static bool BuffedMoonLordAI(NPC npc, bool enraged, Mod mod) - { - if (npc.type == NPCID.MoonLordCore) - { - // Play a random Moon Lord sound - if (npc.ai[0] != -1f && npc.ai[0] != 2f && Main.rand.NextBool(200)) - Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, Main.rand.Next(93, 100), 1f, 0f); - - // Start the AI - if (npc.localAI[3] == 0f) - { - npc.netUpdate = true; - npc.localAI[3] = 1f; - npc.ai[0] = -1f; - } - - if (npc.ai[0] == -2f) - { - npc.dontTakeDamage = true; - - npc.ai[1] += 1f; - if (npc.ai[1] == 30f) - Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); - - if (npc.ai[1] < 60f) - MoonlordDeathDrama.RequestLight(npc.ai[1] / 30f, npc.Center); - - if (npc.ai[1] == 60f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[2] = (float)Main.rand.Next(3); - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - } - - // Spawn head and hands - if (npc.ai[0] == -1f) - { - npc.dontTakeDamage = true; - - npc.ai[1] += 1f; - if (npc.ai[1] == 30f) - Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); - - if (npc.ai[1] < 60f) - MoonlordDeathDrama.RequestLight(npc.ai[1] / 30f, npc.Center); - - if (npc.ai[1] == 60f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[2] = (float)Main.rand.Next(3); - npc.ai[2] = 0f; - - npc.netUpdate = true; - int[] array5 = new int[3]; - int num1155 = 0; - int num; - - for (int num1156 = 0; num1156 < 2; num1156 = num + 1) - { - int num1157 = NPC.NewNPC((int)npc.Center.X + num1156 * 800 - 400, (int)npc.Center.Y - 100, NPCID.MoonLordHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num1157].ai[2] = (float)num1156; - Main.npc[num1157].netUpdate = true; - int[] arg_381A6_0 = array5; - num = num1155; - num1155 = num + 1; - arg_381A6_0[num] = num1157; - num = num1156; - } - - int num1158 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 400, NPCID.MoonLordHead, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num1158].netUpdate = true; - int[] arg_3823F_0 = array5; - num = num1155; - num1155 = num + 1; - arg_3823F_0[num] = num1158; - - for (int num1159 = 0; num1159 < 3; num1159 = num + 1) - { - Main.npc[array5[num1159]].ai[3] = (float)npc.whoAmI; - num = num1159; - } - for (int num1160 = 0; num1160 < 3; num1160 = num + 1) - { - npc.localAI[num1160] = (float)array5[num1160]; - num = num1160; - } - } - } - } - - // Fly near target, don't take damage - if (npc.ai[0] == 0f) - { - npc.dontTakeDamage = true; - npc.TargetClosest(false); - - Vector2 value4 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); - if (value4.Length() > 20f) - { - float velocity = CalamityWorld.bossRushActive ? 14f : 10f; - Vector2 desiredVelocity = Vector2.Normalize(value4 - npc.velocity) * velocity; - Vector2 velocity2 = npc.velocity; - npc.SimpleFlyMovement(desiredVelocity, 0.5f); - npc.velocity = Vector2.Lerp(npc.velocity, velocity2, 0.5f); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Despawn if other parts aren't there - bool flag84 = false; - if (npc.localAI[0] < 0f || npc.localAI[1] < 0f || npc.localAI[2] < 0f) - flag84 = true; - else if (!Main.npc[(int)npc.localAI[0]].active || Main.npc[(int)npc.localAI[0]].type != NPCID.MoonLordHand) - flag84 = true; - else if (!Main.npc[(int)npc.localAI[1]].active || Main.npc[(int)npc.localAI[1]].type != NPCID.MoonLordHand) - flag84 = true; - else if (!Main.npc[(int)npc.localAI[2]].active || Main.npc[(int)npc.localAI[2]].type != NPCID.MoonLordHead) - flag84 = true; - - if (flag84) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - - // Take damage if other parts are down - bool flag85 = true; - if (Main.npc[(int)npc.localAI[0]].Calamity().newAI[0] != 1f) - flag85 = false; - if (Main.npc[(int)npc.localAI[1]].Calamity().newAI[0] != 1f) - flag85 = false; - if (Main.npc[(int)npc.localAI[2]].Calamity().newAI[0] != 1f) - flag85 = false; - - if (flag85) - { - npc.ai[0] = 1f; - npc.dontTakeDamage = false; - npc.netUpdate = true; - } - } - } - - // Fly near target, take damage - else if (npc.ai[0] == 1f) - { - npc.dontTakeDamage = false; - npc.TargetClosest(false); - - Vector2 value5 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); - if (value5.Length() > 20f) - { - float velocity = CalamityWorld.bossRushActive ? 14f : 10f; - Vector2 desiredVelocity2 = Vector2.Normalize(value5 - npc.velocity) * velocity; - Vector2 velocity3 = npc.velocity; - npc.SimpleFlyMovement(desiredVelocity2, 0.5f); - npc.velocity = Vector2.Lerp(npc.velocity, velocity3, 0.5f); - } - } - - // Death effects - else if (npc.ai[0] == 2f) - { - npc.dontTakeDamage = true; - Vector2 value6 = new Vector2((float)npc.direction, -0.5f); - npc.velocity = Vector2.Lerp(npc.velocity, value6, 0.98f); - - npc.ai[1] += 1f; - float ai1 = npc.ai[1]; - if (npc.ai[1] < 60f) - MoonlordDeathDrama.RequestLight(npc.ai[1] / 60f, npc.Center); - - if (npc.ai[1] == 60f) - { - for (int num1161 = 0; num1161 < 1000; num1161++) - { - Projectile projectile = Main.projectile[num1161]; - if (projectile.active && (projectile.type == ProjectileID.MoonLeech || projectile.type == ProjectileID.PhantasmalBolt || - projectile.type == ProjectileID.PhantasmalDeathray || projectile.type == ProjectileID.PhantasmalEye || - projectile.type == ProjectileID.PhantasmalSphere)) - projectile.Kill(); - } - } - - if (npc.ai[1] % 3f == 0f && npc.ai[1] < 580f && npc.ai[1] > 60f) - { - Vector2 vector158 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector158 != Vector2.Zero) - vector158.Normalize(); - - vector158 *= 20f + Main.rand.NextFloat() * 400f; - Vector2 vector159 = npc.Center + vector158; - Point point5 = vector159.ToTileCoordinates(); - - bool flag86 = true; - if (!WorldGen.InWorld(point5.X, point5.Y, 0)) - flag86 = false; - if (flag86 && WorldGen.SolidTile(point5.X, point5.Y)) - flag86 = false; - - float num1163 = (float)Main.rand.Next(6, 19); - float num1164 = 6.28318548f / num1163; - float num1165 = 6.28318548f * Main.rand.NextFloat(); - float scaleFactor8 = 1f + Main.rand.NextFloat() * 2f; - float num1166 = 1f + Main.rand.NextFloat(); - float fadeIn = 0.4f + Main.rand.NextFloat(); - int num1167 = Utils.SelectRandom(Main.rand, new int[] - { - 31, - 229 - }); - - if (flag86) - { - MoonlordDeathDrama.AddExplosion(vector159); - for (float num1168 = 0f; num1168 < num1163 * 2f; num1168 = ai1 + 1f) - { - Dust dust2 = Main.dust[Dust.NewDust(vector159, 0, 0, 229, 0f, 0f, 0, default, 1f)]; - dust2.noGravity = true; - dust2.position = vector159; - dust2.velocity = Vector2.UnitY.RotatedBy((double)(num1165 + num1164 * num1168), default) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); - dust2.fadeIn = fadeIn; - dust2.scale = num1166; - ai1 = num1168; - } - } - - for (float num1169 = 0f; num1169 < npc.ai[1] / 60f; num1169 = ai1 + 1f) - { - Vector2 vector160 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector160 != Vector2.Zero) - vector160.Normalize(); - - vector160 *= 20f + Main.rand.NextFloat() * 800f; - Vector2 vector161 = npc.Center + vector160; - Point point6 = vector161.ToTileCoordinates(); - - bool flag87 = true; - if (!WorldGen.InWorld(point6.X, point6.Y, 0)) - flag87 = false; - if (flag87 && WorldGen.SolidTile(point6.X, point6.Y)) - flag87 = false; - - if (flag87) - { - Dust dust3 = Main.dust[Dust.NewDust(vector161, 0, 0, num1167, 0f, 0f, 0, default, 1f)]; - dust3.noGravity = true; - dust3.position = vector161; - dust3.velocity = -Vector2.UnitY * scaleFactor8 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust3.fadeIn = fadeIn; - dust3.scale = num1166; - } - - ai1 = num1169; - } - } - - if (npc.ai[1] % 15f == 0f && npc.ai[1] < 480f && npc.ai[1] >= 90f && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector162 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector162 != Vector2.Zero) - vector162.Normalize(); - - vector162 *= 20f + Main.rand.NextFloat() * 400f; - bool flag88 = true; - Vector2 vector163 = npc.Center + vector162; - Point point7 = vector163.ToTileCoordinates(); - - if (!WorldGen.InWorld(point7.X, point7.Y, 0)) - flag88 = false; - if (flag88 && WorldGen.SolidTile(point7.X, point7.Y)) - flag88 = false; - - if (flag88) - { - float num1170 = (float)(Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + 0.7853982f * Main.rand.NextFloat()); - Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy((double)num1170, default) * 6f; - Projectile.NewProjectile(vector163.X, vector163.Y, vector164.X, vector164.Y, ProjectileID.BlowupSmokeMoonlord, 0, 0f, Main.myPlayer, 0f, 0f); - } - } - - if (npc.ai[1] == 1f) - Main.PlaySound(SoundID.NPCDeath61, npc.Center); - - if (npc.ai[1] >= 480f) - MoonlordDeathDrama.RequestLight((npc.ai[1] - 480f) / 120f, npc.Center); - - if (npc.ai[1] >= 600f) - { - npc.life = 0; - npc.HitEffect(0, 1337.0); - npc.checkDead(); - return false; - } - } - - // Despawn effects - else if (npc.ai[0] == 3f) - { - npc.dontTakeDamage = true; - Vector2 value7 = new Vector2((float)npc.direction, -0.5f); - npc.velocity = Vector2.Lerp(npc.velocity, value7, 0.98f); - - npc.ai[1] += 1f; - if (npc.ai[1] < 60f) - MoonlordDeathDrama.RequestLight(npc.ai[1] / 40f, npc.Center); - - if (npc.ai[1] == 40f) - { - for (int num1171 = 0; num1171 < 1000; num1171++) - { - Projectile projectile2 = Main.projectile[num1171]; - if (projectile2.active && (projectile2.type == ProjectileID.MoonLeech || projectile2.type == ProjectileID.PhantasmalBolt || - projectile2.type == ProjectileID.PhantasmalDeathray || projectile2.type == ProjectileID.PhantasmalEye || - projectile2.type == ProjectileID.PhantasmalSphere)) - { - projectile2.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(27, -1, -1, null, num1171, 0f, 0f, 0f, 0, 0, 0); - } - } - for (int num1173 = 0; num1173 < 500; num1173++) - { - Gore gore2 = Main.gore[num1173]; - if (gore2.active && gore2.type >= 619 && gore2.type <= 622) - gore2.active = false; - } - } - - if (npc.ai[1] >= 60f) - { - for (int num1174 = 0; num1174 < 200; num1174++) - { - NPC nPC5 = Main.npc[num1174]; - if (nPC5.active && (nPC5.type == NPCID.MoonLordHand || nPC5.type == NPCID.MoonLordHead)) - { - nPC5.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(23, -1, -1, null, nPC5.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - - NPC.LunarApocalypseIsUp = false; - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - - return false; - } - } - - // Despawn - bool flag89 = false; - if (npc.ai[0] == -2f || npc.ai[0] == -1f || npc.ai[0] == -2f || npc.ai[0] == 3f) - flag89 = true; - if (Main.player[npc.target].active && !Main.player[npc.target].dead) - flag89 = true; - - if (!flag89) - { - for (int num1175 = 0; num1175 < 255; num1175++) - { - if (Main.player[num1175].active && !Main.player[num1175].dead) - { - flag89 = true; - break; - } - } - } - if (!flag89) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - // Teleport - if (npc.ai[0] >= 0f && npc.ai[0] < 2f && Main.netMode != NetmodeID.MultiplayerClient && npc.Distance(Main.player[npc.target].Center) > 1800f) - { - npc.ai[0] = -2f; - npc.netUpdate = true; - Vector2 value8 = Main.player[npc.target].Center - Vector2.UnitY * 150f - npc.Center; - npc.position += value8; - - if (Main.npc[(int)npc.localAI[0]].active) - { - NPC nPC6 = Main.npc[(int)npc.localAI[0]]; - nPC6.position += value8; - Main.npc[(int)npc.localAI[0]].netUpdate = true; - } - if (Main.npc[(int)npc.localAI[1]].active) - { - NPC nPC6 = Main.npc[(int)npc.localAI[1]]; - nPC6.position += value8; - Main.npc[(int)npc.localAI[1]].netUpdate = true; - } - if (Main.npc[(int)npc.localAI[2]].active) - { - NPC nPC6 = Main.npc[(int)npc.localAI[2]]; - nPC6.position += value8; - Main.npc[(int)npc.localAI[2]].netUpdate = true; - } - } - } - else if (npc.type == NPCID.MoonLordHead) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Despawn - if (!Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.MoonLordCore) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - - // Variables - npc.dontTakeDamage = (npc.localAI[3] >= 15f); - if (calamityGlobalNPC.newAI[0] == 1f) - npc.dontTakeDamage = true; - - npc.velocity = Vector2.Zero; - npc.Center = Main.npc[(int)npc.ai[3]].Center + new Vector2(0f, -400f); - Vector2 value19 = new Vector2(27f, 59f); - float num1207 = 0f; - float num1208 = 0f; - int num1209 = 0; - int num1210 = 0; - - // Invulnerable - if (npc.ai[0] >= 0f || npc.ai[0] == -2f) - { - if (npc.ai[0] == -2f) - { - if (calamityGlobalNPC.newAI[0] != 1f) - calamityGlobalNPC.newAI[0] = 1f; - - npc.life = npc.lifeMax; - npc.netUpdate = true; - npc.dontTakeDamage = true; - } - - // Go to die - if (Main.npc[(int)npc.ai[3]].ai[0] == 2f) - { - npc.ai[0] = -3f; - return false; - } - - // Set up attacks - float num1211 = npc.ai[0]; - npc.ai[1] += 1f; - int num1212 = (int)Main.npc[(int)npc.ai[3]].ai[2]; - int num1213 = 2; - int num1214 = 0; - int num1215 = 0; - - while (num1214 < 5) - { - num1208 = (float)NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; - if (num1208 + (float)num1215 > npc.ai[1]) - break; - - num1215 += (int)num1208; - int num = num1214; - num1214 = num + 1; - } - - if (num1214 == 5) - { - num1214 = 0; - npc.ai[1] = 0f; - num1208 = (float)NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; - num1215 = 0; - } - - npc.ai[0] = (float)NPC.MoonLordAttacksArray[num1212, num1213, 0, num1214]; - num1207 = (float)((int)npc.ai[1] - num1215); - - if (npc.ai[0] != num1211) - npc.netUpdate = true; - } - - // Die - if (npc.ai[0] == -3f) - { - npc.dontTakeDamage = true; - npc.rotation = MathHelper.Lerp(npc.rotation, 0.2617994f, 0.07f); - - npc.ai[1] += 1f; - if (npc.ai[1] >= 32f) - npc.ai[1] = 0f; - if (npc.ai[1] < 0f) - npc.ai[1] = 0f; - - if (npc.localAI[2] < 14f) - npc.localAI[2] += 1f; - } - - // Set variables for deathray - else if (npc.ai[0] == 0f) - { - num1210 = 3; - npc.TargetClosest(false); - - Vector2 v3 = Main.player[npc.target].Center - npc.Center - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); - } - - // Deathray - if (npc.ai[0] == 1f) - { - if (num1207 < 180f) - { - npc.localAI[1] -= 0.05f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - - if (num1207 >= 60f) - { - Vector2 center20 = npc.Center; - - int num1220 = 0; - if (num1207 >= 120f) - num1220 = 1; - - for (int num1221 = 0; num1221 < 1 + num1220; num1221++) - { - int num1222 = 229; - float num1223 = 0.8f; - if (num1221 % 2 == 1) - { - num1222 = 229; - num1223 = 1.65f; - } - - Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; - int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); - Main.dust[num1224].velocity = Vector2.Normalize(center20 - vector199) * 3.5f * (10f - (float)num1220 * 2f) / 10f; - Main.dust[num1224].noGravity = true; - Main.dust[num1224].scale = num1223; - Main.dust[num1224].customData = npc; - } - } - } - else if (num1207 < num1208 - 15f) - { - float rotation = CalamityWorld.bossRushActive ? 510f : 540f; - if (calamityGlobalNPC.newAI[0] == 1f) - rotation -= 60f; - - if (num1207 == 180f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(false); - Vector2 vector200 = Main.player[npc.target].Center - npc.Center; - vector200.Normalize(); - - float num1225 = -1f; - if (vector200.X < 0f) - num1225 = 1f; - - vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, ProjectileID.PhantasmalDeathray, 75, 0f, Main.myPlayer, num1225 * 6.28318548f / rotation, (float)npc.whoAmI); - npc.ai[2] = (vector200.ToRotation() + 9.424778f) * num1225; - npc.netUpdate = true; - } - - npc.localAI[1] += 0.05f; - if (npc.localAI[1] > 1f) - npc.localAI[1] = 1f; - - float num1226 = (float)(npc.ai[2] >= 0f).ToDirectionInt(); - float num1227 = npc.ai[2]; - if (num1227 < 0f) - num1227 *= -1f; - - num1227 += -9.424778f; - num1227 += num1226 * 6.28318548f / rotation; - npc.localAI[0] = num1227; - npc.ai[2] = (num1227 + 9.424778f) * num1226; - } - else - { - npc.localAI[1] -= 0.07f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - - num1210 = 3; - } - } - - // Moon Leech thing - else if (npc.ai[0] == 2f) - { - num1209 = 2; - num1210 = 3; - Vector2 value21 = new Vector2(0f, 216f); - - if (num1207 == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector201 = npc.Center + value21; - for (int num1228 = 0; num1228 < 255; num1228++) - { - Player player6 = Main.player[num1228]; - if (player6.active && !player6.dead && Vector2.Distance(player6.Center, vector201) <= 3000f) - { - Vector2 vector202 = Main.player[npc.target].Center - vector201; - if (vector202 != Vector2.Zero) - vector202.Normalize(); - - Projectile.NewProjectile(vector201.X, vector201.Y, vector202.X, vector202.Y, ProjectileID.MoonLeech, 0, 0f, Main.myPlayer, (float)(npc.whoAmI + 1), (float)num1228); - } - } - } - - if ((num1207 == 120f || num1207 == 180f || num1207 == 240f) && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int num1229 = 0; num1229 < 1000; num1229++) - { - Projectile projectile6 = Main.projectile[num1229]; - if (projectile6.active && projectile6.type == ProjectileID.MoonLeech && Main.player[(int)projectile6.ai[1]].FindBuffIndex(145) != -1) - { - Vector2 center21 = Main.player[npc.target].Center; - int num1230 = NPC.NewNPC((int)center21.X, (int)center21.Y, NPCID.MoonLordLeechBlob, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1230].netUpdate = true; - Main.npc[num1230].ai[0] = (float)(npc.whoAmI + 1); - Main.npc[num1230].ai[1] = (float)num1229; - } - } - } - } - - // Phantasmal Bolts - else if (npc.ai[0] == 3f) - { - if (num1207 == 0f) - { - npc.TargetClosest(false); - npc.netUpdate = true; - } - - Vector2 v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; - npc.localAI[0] = npc.localAI[0].AngleLerp(v4.ToRotation(), 0.5f); - npc.localAI[1] += 0.05f; - if (npc.localAI[1] > 1f) - npc.localAI[1] = 1f; - - if (num1207 == num1208 - 35f) - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); - - if ((num1207 == num1208 - 14f || num1207 == num1208 - 7f || num1207 == num1208) && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector203 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), value19 * npc.localAI[1]); - float velocity = CalamityWorld.bossRushActive ? 12f : 9f; - Vector2 vector204 = Vector2.Normalize(v4) * velocity; - Projectile.NewProjectile(npc.Center.X + vector203.X, npc.Center.Y + vector203.Y, vector204.X, vector204.Y, ProjectileID.PhantasmalBolt, 30, 0f, Main.myPlayer, 0f, 0f); - } - } - - // Dictates whether this npc is vulnerable or not - int num1231 = num1209 * 7; - if ((float)num1231 > npc.localAI[2]) - npc.localAI[2] += 1f; - if ((float)num1231 < npc.localAI[2]) - npc.localAI[2] -= 1f; - if (npc.localAI[2] < 0f) - npc.localAI[2] = 0f; - if (npc.localAI[2] > 14f) - npc.localAI[2] = 14f; - - int num1232 = num1210 * 5; - if ((float)num1232 > npc.localAI[3]) - npc.localAI[3] += 1f; - if ((float)num1232 < npc.localAI[3]) - npc.localAI[3] -= 1f; - if (npc.localAI[3] < 0f) - npc.localAI[2] = 0f; - if (npc.localAI[3] > 15f) - npc.localAI[2] = 15f; - } - else if (npc.type == NPCID.MoonLordHand) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Start attack array - NPC.InitializeMoonLordAttacks(); - - // Despawn - if (!Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.MoonLordCore) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - - // Variables - bool flag90 = npc.ai[2] == 0f; - float num1177 = (float)(-(float)flag90.ToDirectionInt()); - npc.spriteDirection = (int)num1177; - - npc.dontTakeDamage = (npc.frameCounter >= 21.0); - if (calamityGlobalNPC.newAI[0] == 1f) - npc.dontTakeDamage = true; - - Vector2 vector165 = new Vector2(30f, 66f); - float num1178 = 0f; - float num1179 = 0f; - int num1180 = 0; - - // Go to die - if (Main.npc[(int)npc.ai[3]].ai[0] == 2f) - npc.ai[0] = -2f; - - // Choose attacks - if (npc.ai[0] != -2f || (npc.ai[0] == -2f && Main.npc[(int)npc.ai[3]].ai[0] != 2f)) - { - if (npc.ai[0] == -2f && Main.npc[(int)npc.ai[3]].ai[0] != 2f) - { - if (calamityGlobalNPC.newAI[0] != 1f) - calamityGlobalNPC.newAI[0] = 1f; - - npc.life = npc.lifeMax; - npc.netUpdate = true; - npc.dontTakeDamage = true; - } - - float num1181 = npc.ai[0]; - npc.ai[1] += 1f; - int num1182 = (int)Main.npc[(int)npc.ai[3]].ai[2]; - int num1183 = flag90 ? 0 : 1; - int num1184 = 0; - int num1185 = 0; - - while (num1184 < 5) - { - num1179 = (float)NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; - if (num1179 + (float)num1185 > npc.ai[1]) - break; - - num1185 += (int)num1179; - int num = num1184; - num1184 = num + 1; - } - - if (num1184 == 5) - { - num1184 = 0; - npc.ai[1] = 0f; - num1179 = (float)NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; - num1185 = 0; - } - - npc.ai[0] = (float)NPC.MoonLordAttacksArray[num1182, num1183, 0, num1184]; - num1178 = (float)((int)npc.ai[1] - num1185); - if (npc.ai[0] != num1181) - npc.netUpdate = true; - } - - if (npc.ai[0] == -2f) - { - num1180 = 0; - - npc.dontTakeDamage = true; - - npc.velocity = Main.npc[(int)npc.ai[3]].velocity; - } - - // Move - else if (npc.ai[0] == 0f) - { - num1180 = 3; - npc.localAI[1] -= 0.05f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - - Vector2 center15 = Main.npc[(int)npc.ai[3]].Center; - Vector2 value10 = center15 + new Vector2(350f * num1177, -100f); - Vector2 vector167 = value10 - npc.Center; - - if (vector167.Length() > 20f) - { - vector167.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 10.5f : 7.5f; - vector167 *= velocity; - Vector2 velocity5 = npc.velocity; - - if (vector167 != Vector2.Zero) - npc.SimpleFlyMovement(vector167, 0.3f); - - npc.velocity = Vector2.Lerp(velocity5, npc.velocity, 0.5f); - } - } - - // Phantasmal Eyes - else if (npc.ai[0] == 1f) - { - num1180 = 0; - int num1186 = 7; - int num1187 = 4; - - if (num1178 >= (float)(num1186 * num1187 * 2)) - { - npc.localAI[1] -= 0.07f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - } - else if (num1178 >= (float)(num1186 * num1187)) - { - npc.localAI[1] += 0.05f; - if (npc.localAI[1] > 0.75f) - npc.localAI[1] = 0.75f; - - float num1188 = 6.28318548f * (num1178 % (float)(num1186 * num1187)) / (float)(num1186 * num1187) - 1.57079637f; - npc.localAI[0] = new Vector2((float)Math.Cos((double)num1188) * vector165.X, (float)Math.Sin((double)num1188) * vector165.Y).ToRotation(); - - if (num1178 % (float)num1187 == 0f) - { - Vector2 value11 = new Vector2(1f * -num1177, 3f); - Vector2 vector168 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); - Vector2 vector169 = npc.Center + Vector2.Normalize(vector168) * vector165.Length() * 0.4f + value11; - float velocity = CalamityWorld.bossRushActive ? 12f : 9f; - Vector2 vector170 = Vector2.Normalize(vector168) * velocity; - float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1177; - Projectile.NewProjectile(vector169.X, vector169.Y, vector170.X, vector170.Y, ProjectileID.PhantasmalEye, 30, 0f, Main.myPlayer, 0f, ai); - } - } - else - { - npc.localAI[1] += 0.02f; - if (npc.localAI[1] > 0.75f) - npc.localAI[1] = 0.75f; - - float num1189 = 6.28318548f * (num1178 % (float)(num1186 * num1187)) / (float)(num1186 * num1187) - 1.57079637f; - npc.localAI[0] = new Vector2((float)Math.Cos((double)num1189) * vector165.X, (float)Math.Sin((double)num1189) * vector165.Y).ToRotation(); - } - } - - // Phantasmal Spheres - else if (npc.ai[0] == 2f) - { - npc.localAI[1] -= 0.05f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - - Vector2 center16 = Main.npc[(int)npc.ai[3]].Center; - Vector2 value12 = new Vector2(220f * num1177, -60f) + center16; - value12 += new Vector2(num1177 * 100f, -50f); - Vector2 value13 = new Vector2(400f * num1177, -60f); - - float velocityMultiplier = CalamityWorld.bossRushActive ? 0.87f : 0.885f; - if (num1178 < 30f) - { - Vector2 vector171 = value12 - npc.Center; - if (vector171 != Vector2.Zero) - { - Vector2 vector172 = vector171; - vector172.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 14f : 10f; - npc.velocity = Vector2.SmoothStep(npc.velocity, vector172 * Math.Min(velocity, vector171.Length()), 0.2f); - } - } - else if (num1178 < 210f) - { - num1180 = 1; - int num1190 = (int)num1178 - 30; - - if (num1190 % 30 == 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector173 = new Vector2(5f * num1177, -8f); - int num1191 = num1190 / 30; - vector173.X += ((float)num1191 - 3.5f) * num1177 * 3f; - vector173.Y += ((float)num1191 - 4.5f) * 1f; - vector173 *= 1.2f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector173.X, vector173.Y, ProjectileID.PhantasmalSphere, 50, 1f, Main.myPlayer, 0f, (float)npc.whoAmI); - } - - Vector2 vector174 = Vector2.SmoothStep(value12, value12 + value13, (num1178 - 30f) / 180f) - npc.Center; - if (vector174 != Vector2.Zero) - { - Vector2 vector175 = vector174; - vector175.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 35f : 25f; - npc.velocity = Vector2.Lerp(npc.velocity, vector175 * Math.Min(velocity, vector174.Length()), 0.5f); - } - } - else if (num1178 < 282f) - { - num1180 = 0; - npc.velocity *= velocityMultiplier; - } - else if (num1178 < 287f) - { - num1180 = 1; - npc.velocity *= velocityMultiplier; - } - else if (num1178 < 292f) - { - num1180 = 2; - npc.velocity *= velocityMultiplier; - } - else if (num1178 < 300f) - { - num1180 = 3; - - if (num1178 == 292f && Main.netMode != NetmodeID.MultiplayerClient) - { - int num1193 = (int)Player.FindClosest(npc.position, npc.width, npc.height); - Vector2 vector176 = Vector2.Normalize(Main.player[num1193].Center - (npc.Center + Vector2.UnitY * -350f)); - if (float.IsNaN(vector176.X) || float.IsNaN(vector176.Y)) - vector176 = Vector2.UnitY; - - float velocity = CalamityWorld.bossRushActive ? 18f : 14f; - vector176 *= velocity; - for (int num1194 = 0; num1194 < 1000; num1194++) - { - Projectile projectile3 = Main.projectile[num1194]; - if (projectile3.active && projectile3.type == ProjectileID.PhantasmalSphere && projectile3.ai[1] == (float)npc.whoAmI && projectile3.ai[0] != -1f) - { - projectile3.ai[0] = -1f; - projectile3.velocity = vector176; - projectile3.netUpdate = true; - } - } - } - - Vector2 vector177 = Vector2.SmoothStep(value12, value12 + value13, 1f - (num1178 - 270f) / 30f) - npc.Center; - if (vector177 != Vector2.Zero) - { - Vector2 vector178 = vector177; - vector178.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 24.5f : 17.5f; - npc.velocity = Vector2.Lerp(npc.velocity, vector178 * Math.Min(velocity, vector177.Length()), 0.1f); - } - } - else - { - num1180 = 3; - - Vector2 vector179 = value12 - npc.Center; - if (vector179 != Vector2.Zero) - { - Vector2 vector180 = vector179; - vector180.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 14f : 10f; - npc.velocity = Vector2.SmoothStep(npc.velocity, vector180 * Math.Min(velocity, vector179.Length()), 0.2f); - } - } - } - - // Phantasmal Bolts - else if (npc.ai[0] == 3f) - { - if (num1178 == 0f) - { - npc.TargetClosest(false); - npc.netUpdate = true; - } - - Vector2 v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; - npc.localAI[0] = npc.localAI[0].AngleLerp(v.ToRotation(), 0.5f); - - npc.localAI[1] += 0.05f; - if (npc.localAI[1] > 1f) - npc.localAI[1] = 1f; - - if (num1178 == num1179 - 35f) - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); - - if ((num1178 == num1179 - 14f || num1178 == num1179 - 7f || num1178 == num1179) && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector181 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); - float velocity = CalamityWorld.bossRushActive ? 12f : 9f; - Vector2 vector182 = Vector2.Normalize(v) * velocity; - Projectile.NewProjectile(npc.Center.X + vector181.X, npc.Center.Y + vector181.Y, vector182.X, vector182.Y, ProjectileID.PhantasmalBolt, 30, 0f, Main.myPlayer, 0f, 0f); - } - } - - // Center - Vector2 center17 = Main.npc[(int)npc.ai[3]].Center; - Vector2 value14 = new Vector2(220f * num1177, -60f) + center17; - Vector2 vector183 = value14 + new Vector2(num1177 * 110f, -150f); - Vector2 vector184 = vector183 + new Vector2(num1177 * 370f, 150f); - - if (vector183.X > vector184.X) - Utils.Swap(ref vector183.X, ref vector184.X); - if (vector183.Y > vector184.Y) - Utils.Swap(ref vector183.Y, ref vector184.Y); - - Vector2 value15 = Vector2.Clamp(npc.Center + npc.velocity, vector183, vector184); - if (value15 != npc.Center + npc.velocity) - npc.Center = value15 - npc.velocity; - - // Frames - int num1195 = num1180 * 7; - if ((double)num1195 > npc.frameCounter) - { - double num1196 = npc.frameCounter; - npc.frameCounter = num1196 + 1.0; - } - if ((double)num1195 < npc.frameCounter) - { - double num1196 = npc.frameCounter; - npc.frameCounter = num1196 - 1.0; - } - - if (npc.frameCounter < 0.0) - npc.frameCounter = 0.0; - if (npc.frameCounter > 21.0) - npc.frameCounter = 21.0; - } - else if (npc.type == NPCID.MoonLordLeechBlob) - { - // Variables - float num1265 = 75f; - Vector2 value28 = new Vector2(0f, 216f); - int num1266 = (int)Math.Abs(npc.ai[0]) - 1; - int num1267 = (int)npc.ai[1]; - - // Despawn - if (!Main.npc[num1266].active || Main.npc[num1266].type != NPCID.MoonLordHead) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - return false; - } - - // Heal the Moon Lord - npc.ai[2] += 1f; - if (npc.ai[2] >= num1265) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num1268 = (int)Main.npc[num1266].ai[3]; - int num1269 = -1; - int num1270 = -1; - int num1271 = num1266; - - for (int num1272 = 0; num1272 < 200; num1272++) - { - if (Main.npc[num1272].active && Main.npc[num1272].ai[3] == (float)num1268) - { - if (num1269 == -1 && Main.npc[num1272].type == NPCID.MoonLordHand && Main.npc[num1272].ai[2] == 0f) - num1269 = num1272; - if (num1270 == -1 && Main.npc[num1272].type == NPCID.MoonLordHand && Main.npc[num1272].ai[2] == 1f) - num1270 = num1272; - if (num1269 != -1 && num1270 != -1 && num1271 != -1) - break; - } - } - - // Heal limits - int num1273 = CalamityWorld.death ? 1500 : 1250; - if (CalamityWorld.bossRushActive) - num1273 *= 10; - - int num1274 = Main.npc[num1268].lifeMax - Main.npc[num1268].life; - int num1275 = Main.npc[num1269].lifeMax - Main.npc[num1269].life; - int num1276 = Main.npc[num1270].lifeMax - Main.npc[num1270].life; - int num1277 = Main.npc[num1271].lifeMax - Main.npc[num1271].life; - - // Healing - if (num1277 > 0 && num1273 > 0) - { - int num1278 = num1277 - num1273; - if (num1278 > 0) - { - num1278 = 0; - } - int num1279 = num1273 + num1278; - num1273 -= num1279; - NPC nPC6 = Main.npc[num1271]; - nPC6.life += num1279; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1271].Center, new Vector2(50f)), num1279, true); - } - if (num1274 > 0 && num1273 > 0) - { - int num1280 = num1274 - num1273; - if (num1280 > 0) - { - num1280 = 0; - } - int num1281 = num1273 + num1280; - num1273 -= num1281; - NPC nPC6 = Main.npc[num1268]; - nPC6.life += num1281; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1268].Center, new Vector2(50f)), num1281, true); - } - if (num1275 > 0 && num1273 > 0) - { - int num1282 = num1275 - num1273; - if (num1282 > 0) - { - num1282 = 0; - } - int num1283 = num1273 + num1282; - num1273 -= num1283; - NPC nPC6 = Main.npc[num1269]; - nPC6.life += num1283; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1269].Center, new Vector2(50f)), num1283, true); - } - if (num1276 > 0 && num1273 > 0) - { - int num1284 = num1276 - num1273; - if (num1284 > 0) - { - num1284 = 0; - } - int num1285 = num1273 + num1284; - num1273 -= num1285; - NPC nPC6 = Main.npc[num1270]; - nPC6.life += num1285; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1270].Center, new Vector2(50f)), num1285, true); - } - } - - // Die - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - return false; - } - - // Move towards the Moon Lord mouth - npc.velocity = Vector2.Zero; - npc.Center = Vector2.Lerp(Main.projectile[num1267].Center, Main.npc[(int)Math.Abs(npc.ai[0]) - 1].Center + value28, npc.ai[2] / num1265); - - // Emit dust - Vector2 spinningpoint3 = Vector2.UnitY * (float)(-(float)npc.height) / 2f; - for (int num1286 = 0; num1286 < 6; num1286++) - { - int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1286 * 6.28318548f / 6f), default), 0, 0, 229, 0f, 0f, 0, default, 1f); - Main.dust[num1287].velocity = -Vector2.UnitY; - Main.dust[num1287].noGravity = true; - Main.dust[num1287].scale = 0.7f; - Main.dust[num1287].customData = npc; - } - - spinningpoint3 = Vector2.UnitY * (float)(-(float)npc.height) / 6f; - for (int num1288 = 0; num1288 < 3; num1288++) - { - int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1288 * 6.28318548f / 6f), default), 0, 0, 229, 0f, -2f, 0, default, 1f); - Main.dust[num1289].noGravity = true; - Main.dust[num1289].scale = 1.5f; - Main.dust[num1289].customData = npc; - } - } - return false; - } - #endregion - - #region Buffed Mothron AI - public static bool BuffedMothronAI(NPC npc) - { - npc.noTileCollide = false; - npc.noGravity = true; - npc.knockBackResist = 0f; - npc.damage = npc.defDamage; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.4f; - bool phase3 = lifeRatio < 0.1f; - - if (!Main.eclipse) - npc.ai[0] = -1f; - else if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - npc.ai[0] = -1f; - } - - if (npc.ai[0] == -1f) - { - Vector2 value37 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 22f + value37) / 10f; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - return false; - } - - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - - if (npc.Center.X < Main.player[npc.target].Center.X - 2f) - npc.direction = 1; - if (npc.Center.X > Main.player[npc.target].Center.X + 2f) - npc.direction = -1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - - if (npc.collideX) - { - npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); - - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); - - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - - Vector2 value38 = Main.player[npc.target].Center - npc.Center; - value38.Y -= 200f; - if (value38.Length() > 3000f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value38.Length() > 600f) - { - float scaleFactor15 = 15f; - float num1354 = 30f; - value38.Normalize(); - value38 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1354 - 1f) + value38) / num1354; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - npc.ai[1] += 1f; - - if (npc.ai[1] >= 10f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - - while (npc.ai[0] == 0f) - { - int num1355 = Main.rand.Next(3); - if (phase3) - num1355 = 1; - else if (phase2) - num1355 = Main.rand.Next(2); - - if (num1355 == 0 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.ai[0] = 2f; - else if (num1355 == 1) - npc.ai[0] = 3f; - else if (num1355 == 2 && NPC.CountNPCS(478) + NPC.CountNPCS(479) < 2) - npc.ai[0] = 4f; - } - } - } - else - { - if (npc.ai[0] == 1f) - { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - npc.TargetClosest(true); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.02f) / 10f; - - Vector2 value39 = Main.player[npc.target].Center - npc.Center; - if (value39.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - float scaleFactor16 = 18f + value39.Length() / 100f; - float num1356 = 25f; - value39.Normalize(); - value39 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1356 - 1f) + value39) / num1356; - return false; - } - - if (npc.ai[0] == 2f) - { - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - if (Main.player[npc.target].Center.X - 10f < npc.Center.X) - npc.direction = -1; - else if (Main.player[npc.target].Center.X + 10f > npc.Center.X) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.025f) / 5f; - - if (npc.collideX) - { - npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); - - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); - - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - - Vector2 value40 = Main.player[npc.target].Center - npc.Center; - value40.Y -= 20f; - - npc.ai[2] += 0.0222222228f; - if (Main.expertMode) - npc.ai[2] += 0.0166666675f; - - float scaleFactor17 = 12f + npc.ai[2] + value40.Length() / 120f; - float num1357 = 20f; - value40.Normalize(); - value40 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1357 - 1f) + value40) / num1357; - - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else - { - if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; - - Vector2 value41 = Main.player[npc.target].Center - npc.Center; - value41.Y -= 12f; - if (npc.Center.X > Main.player[npc.target].Center.X) - value41.X += 600f; - else - value41.X -= 600f; - - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 550f && Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) < 20f) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - } - - npc.ai[1] += 0.0333333351f; - float scaleFactor18 = 24f + npc.ai[1]; - float num1358 = 4f; - value41.Normalize(); - value41 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1358 - 1f) + value41) / num1358; - return false; - } - - if (npc.ai[0] == 3.1f) - { - npc.noTileCollide = true; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; - - Vector2 vector237 = Main.player[npc.target].Center - npc.Center; - vector237.Y -= 12f; - float scaleFactor19 = 32f; - float num1359 = 8f; - vector237.Normalize(); - vector237 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1359 - 1f) + vector237) / num1359; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = vector237; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 3.2f; - npc.ai[1] = 0f; - npc.ai[1] = (float)npc.direction; - } - } - else - { - if (npc.ai[0] == 3.2f) - { - npc.damage = (int)((double)npc.defDamage * 1.2); - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - npc.ai[2] += 0.0333333351f; - npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; - - if ((npc.ai[1] > 0f && npc.Center.X > Main.player[npc.target].Center.X + 460f) || (npc.ai[1] < 0f && npc.Center.X < Main.player[npc.target].Center.X - 460f)) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 800f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; - return false; - } - - if (npc.ai[0] == 4f) - { - npc.ai[0] = 0f; - npc.TargetClosest(true); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = -1f; - npc.ai[2] = -1f; - - int num; - for (int num1360 = 0; num1360 < 1000; num1360 = num + 1) - { - int num1361 = (int)Main.player[npc.target].Center.X / 16; - int num1362 = (int)Main.player[npc.target].Center.Y / 16; - int num1363 = 30 + num1360 / 50; - int num1364 = 20 + num1360 / 75; - - num1361 += Main.rand.Next(-num1363, num1363 + 1); - num1362 += Main.rand.Next(-num1364, num1364 + 1); - - if (!WorldGen.SolidTile(num1361, num1362)) - { - while (!WorldGen.SolidTile(num1361, num1362) && (double)num1362 < Main.worldSurface) - num1362++; - - if ((new Vector2((float)(num1361 * 16 + 8), (float)(num1362 * 16 + 8)) - Main.player[npc.target].Center).Length() < 5600f) - { - npc.ai[0] = 4.1f; - npc.ai[1] = (float)num1361; - npc.ai[2] = (float)num1362; - break; - } - } - num = num1360; - } - } - npc.netUpdate = true; - return false; - } - - if (npc.ai[0] == 4.1f) - { - if (npc.velocity.X < -2f) - npc.direction = -1; - else if (npc.velocity.X > 2f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - npc.noTileCollide = true; - - int num1365 = (int)npc.ai[1]; - int num1366 = (int)npc.ai[2]; - float x2 = (float)(num1365 * 16 + 8); - float y2 = (float)(num1366 * 16 - 20); - Vector2 vector238 = new Vector2(x2, y2); - vector238 -= npc.Center; - float num1367 = 12f + vector238.Length() / 150f; - - if (num1367 > 20f) - num1367 = 20f; - - if (vector238.Length() < 10f) - npc.ai[0] = 4.2f; - - vector238.Normalize(); - vector238 *= num1367; - float num1368 = 10f; - npc.velocity = (npc.velocity * (num1368 - 1f) + vector238) / num1368; - return false; - } - - if (npc.ai[0] == 4.2f) - { - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - npc.noTileCollide = true; - - int num1369 = (int)npc.ai[1]; - int num1370 = (int)npc.ai[2]; - float x3 = (float)(num1369 * 16 + 8); - float y3 = (float)(num1370 * 16 - 20); - Vector2 vector239 = new Vector2(x3, y3); - vector239 -= npc.Center; - float num1371 = 4f; - float num1372 = 2f; - - if (Main.netMode != NetmodeID.MultiplayerClient && vector239.Length() < 4f) - { - int num1373 = 20; - if (Main.expertMode) - num1373 = (int)((double)num1373 * 0.75); - - npc.ai[3] += 1f; - - if (npc.ai[3] == (float)num1373) - NPC.NewNPC(num1369 * 16 + 8, num1370 * 16, 478, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - else if (npc.ai[3] == (float)(num1373 * 2)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (NPC.CountNPCS(478) + NPC.CountNPCS(479) < 3 && Main.rand.Next(3) != 0) - npc.ai[0] = 4f; - else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 1f; - } - } - - if (vector239.Length() > num1371) - { - vector239.Normalize(); - vector239 *= num1371; - } - npc.velocity = (npc.velocity * (num1372 - 1f) + vector239) / num1372; - } - } - } - } - return false; - } - #endregion - - #region Buffed Pumpking and Pumpking Blade AI - public static bool BuffedPumpkingAI(NPC npc) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > 6f) - { - npc.localAI[0] = 0f; - npc.localAI[1] += 1f; - - if (npc.localAI[1] > 4f) - npc.localAI[1] = 0f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 300f) - { - npc.ai[3] = (float)Main.rand.Next(3); - npc.localAI[2] = 0f; - } - else if (npc.ai[3] == 0f && npc.localAI[2] % 30f == 0f && npc.localAI[2] > 30f) - { - float num856 = 10f; - Vector2 vector109 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - if (!WorldGen.SolidTile((int)vector109.X / 16, (int)vector109.Y / 16)) - { - float num857 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector109.X; - float num858 = Main.player[npc.target].position.Y - vector109.Y; - num857 += (float)Main.rand.Next(-50, 51); - num858 += (float)Main.rand.Next(50, 201); - num858 *= 0.2f; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); - num859 = num856 / num859; - num857 *= num859; - num858 *= num859; - num857 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - num858 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, Main.rand.Next(326, 329), 60, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(true); - npc.ai[0] = 1f; - - int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num861].ai[0] = -1f; - Main.npc[num861].ai[1] = (float)npc.whoAmI; - Main.npc[num861].target = npc.target; - Main.npc[num861].netUpdate = true; - - num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num861].ai[0] = 1f; - Main.npc[num861].ai[1] = (float)npc.whoAmI; - Main.npc[num861].ai[3] = 150f; - Main.npc[num861].target = npc.target; - Main.npc[num861].netUpdate = true; - } - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - { - npc.TargetClosest(true); - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - npc.ai[1] = 2f; - } - - if (Main.dayTime) - { - npc.velocity.Y += 0.3f; - npc.velocity.X *= 0.9f; - } - else if (npc.ai[1] == 0f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - if (npc.ai[3] != 1f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - - Vector2 vector110 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num862 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector110.X; - float num863 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector110.Y; - float num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863)); - float num865 = 8f; - - if (npc.ai[3] == 1f) - { - if (num864 > 900f) - num865 = 14f; - else if (num864 > 600f) - num865 = 12f; - else if (num864 > 300f) - num865 = 10f; - } - - if (num864 > 50f) - { - num864 = num865 / num864; - npc.velocity.X = (npc.velocity.X * 14f + num862 * num864) / 15f; - npc.velocity.Y = (npc.velocity.Y * 14f + num863 * num864) / 15f; - } - } - else if (npc.ai[1] == 1f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 600f || npc.ai[3] != 1f) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - } - - Vector2 vector111 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num866 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector111.X; - float num867 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector111.Y; - float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); - num868 = 20f / num868; - - npc.velocity.X = (npc.velocity.X * 49f + num866 * num868) / 50f; - npc.velocity.Y = (npc.velocity.Y * 49f + num867 * num868) / 50f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[1] = 3f; - npc.velocity.Y += 0.1f; - - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - - if (npc.timeLeft > 500) - npc.timeLeft = 500; - } - npc.rotation = npc.velocity.X * -0.02f; - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - - public static bool BuffedPumpkingBladeAI(NPC npc) - { - npc.spriteDirection = -(int)npc.ai[0]; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient && Main.npc[(int)npc.ai[1]].ai[3] == 2f) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] > 30f) - { - npc.localAI[1] = 0f; - - float num869 = 0.01f; - Vector2 vector112 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float num870 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector112.X; - float num871 = Main.player[npc.target].position.Y - vector112.Y; - float num872 = (float)Math.Sqrt((double)(num870 * num870 + num871 * num871)); - - num872 = num869 / num872; - num870 *= num872; - num871 *= num872; - - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num870, num871, 329, 70, 0f, Main.myPlayer, npc.rotation, (float)npc.spriteDirection); - } - } - - if (Main.dayTime) - { - npc.velocity.Y += 0.3f; - npc.velocity.X *= 0.9f; - return false; - } - - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - npc.ai[3] += 1f; - if (npc.ai[3] >= 180f) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - Vector2 vector113 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num874 = (Main.player[npc.target].Center.X + Main.npc[(int)npc.ai[1]].Center.X) / 2f; - float num875 = (Main.player[npc.target].Center.Y + Main.npc[(int)npc.ai[1]].Center.Y) / 2f; - num874 += -170f * npc.ai[0] - vector113.X; - num875 += 90f - vector113.Y; - - float num876 = Math.Abs(Main.player[npc.target].Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(Main.player[npc.target].Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - if (num876 > 700f) - { - num874 = Main.npc[(int)npc.ai[1]].Center.X - 170f * npc.ai[0] - vector113.X; - num875 = Main.npc[(int)npc.ai[1]].Center.Y + 90f - vector113.Y; - } - - float num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); - float num878 = 8f; - if (num877 > 1000f) - num878 = 23f; - else if (num877 > 800f) - num878 = 20f; - else if (num877 > 600f) - num878 = 17f; - else if (num877 > 400f) - num878 = 14f; - else if (num877 > 200f) - num878 = 11f; - - if (npc.ai[0] < 0f && npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - num874 -= 4f; - if (npc.ai[0] > 0f && npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - num874 += 4f; - - num877 = num878 / num877; - npc.velocity.X = (npc.velocity.X * 14f + num874 * num877) / 15f; - npc.velocity.Y = (npc.velocity.Y * 14f + num875 * num877) / 15f; - num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); - - if (num877 > 20f) - npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + 1.57f; - } - else if (npc.ai[2] == 1f) - { - Vector2 vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num879 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector114.X; - float num880 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector114.Y; - float num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); - - npc.rotation = (float)Math.Atan2((double)num880, (double)num879) + 1.57f; - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.3f; - - if (npc.velocity.Y < -18f) - npc.velocity.Y = -18f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - npc.TargetClosest(true); - npc.ai[2] = 2f; - - vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num879 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector114.X; - num880 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector114.Y; - num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); - num881 = 24f / num881; - - npc.velocity.X = num879 * num881; - npc.velocity.Y = num880 * num881; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - float num882 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || num882 > 800f) - npc.ai[2] = 3f; - } - else if (npc.ai[2] == 4f) - { - Vector2 vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num883 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector115.X; - float num884 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector115.Y; - float num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); - - npc.rotation = (float)Math.Atan2((double)num884, (double)num883) + 1.57f; - npc.velocity.Y *= 0.95f; - npc.velocity.X += 0.3f * -npc.ai[0]; - - if (npc.velocity.X < -18f) - npc.velocity.X = -18f; - if (npc.velocity.X > 18f) - npc.velocity.X = 18f; - - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) - { - npc.TargetClosest(true); - npc.ai[2] = 5f; - - vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num883 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector115.X; - num884 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector115.Y; - num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); - num885 = 17f / num885; - - npc.velocity.X = num883 * num885; - npc.velocity.Y = num884 * num885; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f) - { - float num886 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - - if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || num886 > 800f) - npc.ai[2] = 0f; - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Buffed Ice Queen AI - public static bool BuffedIceQueenAI(NPC npc) - { - if (Main.dayTime) - { - if (npc.velocity.X > 0f) - npc.velocity.X += 0.25f; - else - npc.velocity.X -= 0.25f; - - npc.velocity.Y -= 0.1f; - npc.rotation = npc.velocity.X * 0.05f; - } - else if (npc.ai[0] == 0f) - { - if (npc.ai[2] == 0f) - { - npc.TargetClosest(true); - - if (npc.Center.X < Main.player[npc.target].Center.X) - npc.ai[2] = 1f; - else - npc.ai[2] = -1f; - } - - npc.TargetClosest(true); - int num887 = 800; - float num888 = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - - if (npc.Center.X < Main.player[npc.target].Center.X && npc.ai[2] < 0f && num888 > (float)num887) - npc.ai[2] = 0f; - if (npc.Center.X > Main.player[npc.target].Center.X && npc.ai[2] > 0f && num888 > (float)num887) - npc.ai[2] = 0f; - - float num889 = 0.6f; - float num890 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num889 = 0.7f; - num890 = 12f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num889 = 0.8f; - num890 = 14f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num889 = 0.95f; - num890 = 16f; - } - - npc.velocity.X += npc.ai[2] * num889; - if (npc.velocity.X > num890) - npc.velocity.X = num890; - if (npc.velocity.X < -num890) - npc.velocity.X = -num890; - - float num891 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); - if (num891 < 150f) - npc.velocity.Y -= 0.2f; - if (num891 > 200f) - npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 9f) - npc.velocity.Y = 9f; - if (npc.velocity.Y < -9f) - npc.velocity.Y = -9f; - - npc.rotation = npc.velocity.X * 0.05f; - - if ((num888 < 500f || npc.ai[3] < 0f) && npc.position.Y < Main.player[npc.target].position.Y) - { - npc.ai[3] += 1f; - int num892 = 8; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num892 = 7; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num892 = 6; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num892 = 5; - - num892++; - if (npc.ai[3] > (float)num892) - npc.ai[3] = (float)(-(float)num892); - - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector116 = new Vector2(npc.Center.X, npc.Center.Y); - vector116.X += npc.velocity.X * 7f; - float num893 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector116.X; - float num894 = Main.player[npc.target].Center.Y - vector116.Y; - float num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); - - float num896 = 8f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num896 = 9f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num896 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num896 = 11f; - - num895 = num896 / num895; - num893 *= num895; - num894 *= num895; - - Projectile.NewProjectile(vector116.X, vector116.Y, num893, num894, 348, 50, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (npc.ai[3] < 0f) - npc.ai[3] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - - if (npc.ai[1] > 600f && num888 < 600f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 1f) - { - npc.TargetClosest(true); - - float num898 = 0.2f; - float num899 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num898 = 0.24f; - num899 = 12f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num898 = 0.28f; - num899 = 14f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num898 = 0.32f; - num899 = 16f; - } - num898 -= 0.05f; - num899 -= 1f; - - if (npc.Center.X < Main.player[npc.target].Center.X) - { - npc.velocity.X += num898; - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - } - if (npc.Center.X > Main.player[npc.target].Center.X) - { - npc.velocity.X -= num898; - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - } - if (npc.velocity.X > num899 || npc.velocity.X < -num899) - npc.velocity.X *= 0.95f; - - float num900 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); - if (num900 < 180f) - npc.velocity.Y -= 0.1f; - if (num900 > 200f) - npc.velocity.Y += 0.1f; - - if (npc.velocity.Y > 7f) - npc.velocity.Y = 7f; - if (npc.velocity.Y < -7f) - npc.velocity.Y = -7f; - - npc.rotation = npc.velocity.X * 0.01f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - int num901 = 10; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num901 = 8; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num901 = 6; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num901 = 4; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num901 = 2; - - num901 += 3; - if (npc.ai[3] >= (float)num901) - { - npc.ai[3] = 0f; - Vector2 vector117 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); - int i2 = (int)(vector117.X / 16f); - int j2 = (int)(vector117.Y / 16f); - if (!WorldGen.SolidTile(i2, j2)) - { - float num902 = npc.velocity.Y; - - if (num902 < 0f) - num902 = 0f; - - num902 += 3f; - float speedX2 = npc.velocity.X * 0.25f; - Projectile.NewProjectile(vector117.X, vector117.Y, speedX2, num902, 349, 44, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - - if (npc.ai[1] > 450f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - - Vector2 vector118 = new Vector2(npc.Center.X, npc.Center.Y - 20f); - float num904 = (float)Main.rand.Next(-1000, 1001); - float num905 = (float)Main.rand.Next(-1000, 1001); - float num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); - float num907 = 20f; - - npc.velocity *= 0.95f; - num906 = num907 / num906; - num904 *= num906; - num905 *= num906; - npc.rotation += 0.2f; - vector118.X += num904 * 4f; - vector118.Y += num905 * 4f; - - npc.ai[3] += 1f; - int num908 = 7; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num908--; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num908 -= 2; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num908 -= 3; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num908 -= 4; - - if (npc.ai[3] > (float)num908) - { - npc.ai[3] = 0f; - int num909 = Projectile.NewProjectile(vector118.X, vector118.Y, num904, num905, 349, 40, 0f, Main.myPlayer, 0f, 0f); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - - if (npc.ai[1] > 300f) - npc.ai[0] = -1f; - } - } - if (npc.ai[0] == -1f) - { - int num910 = Main.rand.Next(3); - npc.TargetClosest(true); - - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 1000f) - num910 = 0; - - npc.ai[0] = (float)num910; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - if (ModLoader.GetMod("FargowiltasSouls") != null) - ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); - - return false; - } - #endregion - - #region Revengeance Dungeon Guardian AI - public static void RevengeanceDungeonGuardianAI(NPC npc, bool configBossRushBoost, bool enraged) - { - Vector2 vector21 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num177 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector21.X; - float num178 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector21.Y; - float num179 = (float)Math.Sqrt((double)(num177 * num177 + num178 * num178)); - num179 = 12f / num179; - npc.velocity.X = num177 * num179; - npc.velocity.Y = num178 * num179; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 60f) - { - npc.localAI[1] = 0f; - Vector2 vector16 = npc.Center; - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num159 = 5f; - float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - value += npc.velocity; - num160 = value.X; - num161 = value.Y; - int num163 = 2500; - int num164 = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; - } - } - } - } - #endregion - - #region Revengeance Basic NPC AI - public static void RevengeanceLihzahrdAI(NPC npc) - { - // Transform into second state sooner - if (Main.netMode != NetmodeID.MultiplayerClient && (double)npc.life <= (double)npc.lifeMax * 0.9) - npc.Transform(NPCID.LihzahrdCrawler); - } - - public static void RevengeanceIceGolemAI(NPC npc) - { - // Increases movement speed - float num63 = 2f; - float num64 = 0.14f; - num63 += (1f - (float)npc.life / (float)npc.lifeMax) * 1.5f; - num64 += (1f - (float)npc.life / (float)npc.lifeMax) * 0.15f; - - if (npc.velocity.X < -num63 || npc.velocity.X > num63) - return; - else if (npc.velocity.X < num63 && npc.direction == 1) - { - npc.velocity.X += num64; - if (npc.velocity.X > num63) - npc.velocity.X = num63; - } - else if (npc.velocity.X > -num63 && npc.direction == -1) - { - npc.velocity.X -= num64; - if (npc.velocity.X < -num63) - npc.velocity.X = -num63; - } - } - #endregion - } + int thornBallCount = 0; + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) + thornBallCount++; + + if (thornBallCount > 2) + break; + } + if (thornBallCount < 3) + { + damage = 34; + npc.localAI[1] = -120f; + projectileType = ProjectileID.ThornBall; + } + } + + if (enrage) + damage *= 2; + + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + if (projectileType == ProjectileID.SeedPlantera) + Main.projectile[num748].timeLeft = 300; + } + } + } + } + + // Phase 2 + else + { + // Adjust stats + npc.defense = 21; + npc.damage = (int)((float)npc.defDamage * 1.4f); + if (enrage) + { + npc.defense *= 4; + npc.damage *= 2; + } + + // Spawn tentacles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[0] == 1f) + { + npc.localAI[0] = 2f; + for (int num749 = 0; num749 < 8; num749 = num + 1) + { + int num750 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num = num749; + } + } + } + + // If tentacles are alive, gain high defense + if (!tentaclesDead) + npc.defense = 9999; + npc.chaseable = tentaclesDead; + + // Spawn gore + if (npc.localAI[2] == 0f) + { + Gore.NewGore(new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); + Gore.NewGore(new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); + Gore.NewGore(new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 380, npc.scale); + npc.localAI[2] = 1f; + } + + // Spawn spores + npc.localAI[1] += 1f + (8f * (0.5f - lifeRatio)); + + if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 300f : 360f)) + { + float num757 = CalamityWorld.bossRushActive ? 12f : 8f; + Vector2 vector94 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num758 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector94.X + (float)Main.rand.Next(-10, 11); + float num759 = Math.Abs(num758 * 0.2f); + + float num760 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector94.Y + (float)Main.rand.Next(-10, 11); + if (num760 > 0f) + num759 = 0f; + + num760 -= num759; + float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); + num761 = num757 / num761; + num758 *= num761; + num760 *= num761; + + int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num762].velocity.X = num758; + Main.npc[num762].velocity.Y = num760; + Main.npc[num762].netUpdate = true; + npc.localAI[1] = 0f; + } + + // Fire spread of poison seeds + if (tentacleCount < 8) + { + int tentacleScale = 8 - tentacleCount; // 1 to 8 + + if (nearbyActiveTiles > 600) + npc.localAI[3] += 0.5f + ((float)(tentacleScale - 1) * 0.5f); + else + npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (float)(tentacleScale - 1); + + if (npc.localAI[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 330f : 360f)) + { + Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); + + float num742 = 8f - ((float)tentacleScale * 0.25f); // 7.75f to 6f, slower projectiles are harder to avoid + if (nearbyActiveTiles < 300) + num742 = 8.5f; + if (CalamityWorld.bossRushActive) + num742 *= 1.5f; + + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + + int damage = 30; + int numProj = 2; + + int spread = 2 + tentacleScale; // 3 to 10, wider spread is harder to avoid + if (nearbyActiveTiles < 300) + spread = (Main.rand.NextBool(2) ? 3 : 6) + (tentacleScale / 2); + + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(num743, num744).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(vector93.X, vector93.Y, perturbedSpeed.X, perturbedSpeed.Y, ProjectileID.PoisonSeedPlantera, damage, 0f, Main.myPlayer, 0f, 0f); + } + npc.localAI[3] = 0f; + } + } + + // Fire spread of spore clouds + if (tentaclesDead) + { + calamityGlobalNPC.newAI[0] += 1f + (2f * (0.5f - lifeRatio)); + + if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 270f : 300f)) + { + Main.PlaySound(SoundID.Item20, npc.position); + + Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); + float num742 = CalamityWorld.bossRushActive ? 10f : 7f; + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + + int damage = 35; + int numProj = 4; + + int spread = 30; + if (nearbyActiveTiles <= 300) + spread = (Main.rand.NextBool(2) ? 30 : 45); + + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / (float)numProj; + double offsetAngle; + + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + float ai0 = (float)Main.rand.Next(3); + Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjectileType("SporeGasPlantera"), damage, 0f, Main.myPlayer, ai0, 0f); + } + + calamityGlobalNPC.newAI[0] = 0f; + } + } + } + + // Heal if on surface and it's daytime, else, gain defense + if (surface) + { + if (Main.dayTime) + { + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, 55, 0f, 0f, 200, default, 0.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[dust].velocity = vector; + vector.Normalize(); + vector *= 86f; + Main.dust[dust].position = npc.Center - vector; + } + + // Heal, 25 seconds to reach full HP from 0 + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= 15f) + { + calamityGlobalNPC.newAI[1] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = npc.lifeMax / 100; + if (healAmt > npc.lifeMax - npc.life) + healAmt = npc.lifeMax - npc.life; + + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + else + { + npc.defense += 250; + if (npc.defense > 9999) + npc.defense = 9999; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedPlanterasHookAI(NPC npc, Mod mod) + { + // Variables + bool enrage = false; + bool despawn = false; + + // Despawn if Plantera is gone + if (NPC.plantBoss < 0) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + npc.netUpdate = true; + return false; + } + + // Percent life remaining, Plantera + float lifeRatio = (float)Main.npc[NPC.plantBoss].life / (float)Main.npc[NPC.plantBoss].lifeMax; + + // Despawn if Plantera's target is dead + if (Main.player[Main.npc[NPC.plantBoss].target].dead && !CalamityWorld.bossRushActive) + despawn = true; + + // Enrage if Plantera's target is on the surface + if (!CalamityWorld.bossRushActive && (((double)Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > (float)((Main.maxTilesY - 200) * 16)) | despawn)) + { + npc.localAI[0] -= 4f; + enrage = true; + } + + // Set centers for movement + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f) + npc.ai[0] = (float)((int)(npc.Center.X / 16f)); + if (npc.ai[1] == 0f) + npc.ai[1] = (float)((int)(npc.Center.X / 16f)); + } + + // Find new spot to move to after set time has passed + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Move immediately + if (npc.ai[0] == 0f || npc.ai[1] == 0f) + npc.localAI[0] = 0f; + + // Timer dictating whether to pick a new location or not + npc.localAI[0] -= (CalamityWorld.bossRushActive ? 4f : 1f) + (2f * (1f - lifeRatio)); + if (enrage) + npc.localAI[0] -= 6f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.localAI[0] -= 0.5f; + + // Set timer to new amount if a different hook is currently moving + if (!despawn && npc.localAI[0] <= 0f && npc.ai[0] != 0f) + { + for (int num763 = 0; num763 < 200; num763++) + { + if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) + npc.localAI[0] = (float)Main.rand.Next(60, 301); + } + } + + // Pick a location to move to + if (npc.localAI[0] <= 0f) + { + // Reset timer + npc.localAI[0] = (float)Main.rand.Next(300, 601); + + // Pick location + bool flag50 = false; + int num764 = 0; + while (!flag50 && num764 <= 1000) + { + num764++; + + int num765 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.X / 16f); + int num766 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.Y / 16f); + + if (npc.ai[0] == 0f) + { + num765 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.X + Main.npc[NPC.plantBoss].Center.X) / 32f); + num766 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.Y + Main.npc[NPC.plantBoss].Center.Y) / 32f); + } + + if (despawn) + { + num765 = (int)Main.npc[NPC.plantBoss].position.X / 16; + num766 = (int)(Main.npc[NPC.plantBoss].position.Y + 400f) / 16; + } + + int num767 = 20; + num767 += (int)(100f * ((float)num764 / 1000f)); + int num768 = num765 + Main.rand.Next(-num767, num767 + 1); + int num769 = num766 + Main.rand.Next(-num767, num767 + 1); + + try + { + if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].wall > 0 && (num764 > 500 || lifeRatio < 0.5f))) + { + flag50 = true; + npc.ai[0] = (float)num768; + npc.ai[1] = (float)num769; + npc.netUpdate = true; + } + } catch + { + } + } + } + } + + // Movement to new location + if (npc.ai[0] > 0f && npc.ai[1] > 0f) + { + // Hook movement velocity + float velocity = (CalamityWorld.bossRushActive ? 10f : 7f) + (3f * (1f - lifeRatio)); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + velocity += 1f; + if (enrage) + velocity *= 2f; + if (despawn) + velocity *= 2f; + + // Moving to new location + Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); + float num773 = npc.ai[0] * 16f - 8f - vector95.X; + float num774 = npc.ai[1] * 16f - 8f - vector95.Y; + float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); + if (num775 < 12f + velocity) + { + npc.velocity.X = num773; + npc.velocity.Y = num774; + } + else + { + num775 = velocity / num775; + npc.velocity.X = num773 * num775; + npc.velocity.Y = num774 * num775; + } + + // Rotation + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num776 = Main.npc[NPC.plantBoss].Center.X - vector96.X; + float num777 = Main.npc[NPC.plantBoss].Center.Y - vector96.Y; + npc.rotation = (float)Math.Atan2((double)num777, (double)num776) - 1.57f; + } + return false; + } + + public static bool BuffedPlanterasTentacleAI(NPC npc, Mod mod) + { + // Despawn if Plantera is gone + if (NPC.plantBoss < 0) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + npc.netUpdate = true; + return false; + } + + // Set Plantera to a variable + int num778 = NPC.plantBoss; + if (npc.ai[3] > 0f) + num778 = (int)npc.ai[3] - 1; + + // Movement variables + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(120, 480); + npc.ai[0] = (float)Main.rand.Next(-100, 101); + npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + + // Target + npc.TargetClosest(true); + + // Velocity and acceleration + float num779 = CalamityWorld.bossRushActive ? 1f : 0.5f; + float num781 = 1f - (float)npc.life / (float)npc.lifeMax; + float num780 = (CalamityWorld.bossRushActive ? 300f : 200f) + (num781 * 50f); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + num780 += 25f; + + // Despawn if Plantera is gone + if (!Main.npc[num778].active || NPC.plantBoss < 0) + { + npc.active = false; + return false; + } + + // Movement + float num782 = Main.npc[num778].position.X + (float)(Main.npc[num778].width / 2); + float num783 = Main.npc[num778].position.Y + (float)(Main.npc[num778].height / 2); + Vector2 vector97 = new Vector2(num782, num783); + float num784 = num782 + npc.ai[0]; + float num785 = num783 + npc.ai[1]; + float num786 = num784 - vector97.X; + float num787 = num785 - vector97.Y; + float num788 = (float)Math.Sqrt((double)(num786 * num786 + num787 * num787)); + num788 = num780 / num788; + num786 *= num788; + num787 *= num788; + if (npc.position.X < num782 + num786) + { + npc.velocity.X += num779; + if (npc.velocity.X < 0f && num786 > 0f) + npc.velocity.X *= 0.9f; + } + else if (npc.position.X > num782 + num786) + { + npc.velocity.X -= num779; + if (npc.velocity.X > 0f && num786 < 0f) + npc.velocity.X *= 0.9f; + } + if (npc.position.Y < num783 + num787) + { + npc.velocity.Y += num779; + if (npc.velocity.Y < 0f && num787 > 0f) + npc.velocity.Y *= 0.9f; + } + else if (npc.position.Y > num783 + num787) + { + npc.velocity.Y -= num779; + if (npc.velocity.Y > 0f && num787 < 0f) + npc.velocity.Y *= 0.9f; + } + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + if (npc.velocity.Y > 8f) + npc.velocity.Y = 8f; + if (npc.velocity.Y < -8f) + npc.velocity.Y = -8f; + + // Direction and rotation + if (num786 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num787, (double)num786); + } + if (num786 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num787, (double)num786) + 3.14f; + } + return false; + } + #endregion + + #region Buffed Golem AI + public static bool BuffedGolemAI(NPC npc, bool enraged, Mod mod) + { + // whoAmI variable + NPC.golemBoss = npc.whoAmI; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Spawn parts + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 1f; + NPC.NewNPC((int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead, 0, 0f, 0f, 0f, 0f, 255); + } + + // Despawn + if (npc.target >= 0 && Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + npc.noTileCollide = true; + } + + // Enrage if the target isn't inside the temple + bool enrage = true; + if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == WallID.LihzahrdBrickUnsafe) + enrage = false; + } + if (CalamityWorld.bossRushActive) + enrage = true; + + // Alpha + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 0f; + } + + // Check for body parts + bool flag40 = NPC.AnyNPCs(NPCID.GolemHead); + bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); + bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); + npc.dontTakeDamage = flag40 || flag41 || flag42; + + // Damage + if (!flag40) + npc.damage = (int)((float)npc.defDamage * 1.5f); + + // Phase 2, check for free head + bool flag43 = NPC.AnyNPCs(NPCID.GolemHeadFree); + + // Spawn arm dust + if (!flag41) + { + int num642 = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[num642]; + dust.alpha += Main.rand.Next(100); + dust.velocity *= 0.2f; + dust.velocity.Y -= (0.5f + (float)Main.rand.Next(10) * 0.1f); + dust.fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + + if (Main.rand.Next(10) == 0) + { + num642 = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); + if (Main.rand.Next(20) != 0) + { + Main.dust[num642].noGravity = true; + dust = Main.dust[num642]; + dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + dust.velocity.Y -= 1f; + } + } + } + if (!flag42) + { + int num643 = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[num643]; + dust.alpha += Main.rand.Next(100); + dust.velocity *= 0.2f; + dust.velocity.Y -= (0.5f + (float)Main.rand.Next(10) * 0.1f); + dust.fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + + if (Main.rand.Next(10) == 0) + { + num643 = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); + if (Main.rand.Next(20) != 0) + { + Main.dust[num643].noGravity = true; + dust = Main.dust[num643]; + dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + dust.velocity.Y -= 1f; + } + } + } + + // Jump + if (npc.ai[0] == 0f) + { + npc.noTileCollide = false; + + if (npc.velocity.Y == 0f) + { + // Laser fire when head is dead + if (Main.netMode != NetmodeID.MultiplayerClient && !flag40) + { + npc.localAI[1] += 1f; + + float divisor = 15f - + (phase2 ? 4f : 0f) - + (phase3 ? 3f : 0f) - + (phase4 ? 2f : 0f); + + if (enrage) + divisor = 5f; + + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y - 60f); + if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, vector82) > 160f || !flag43)) + { + float num673 = enrage ? 12f : 6f; + float num674 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; + float num675 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; + float num676 = (float)Math.Sqrt((double)(num674 * num674 + num675 * num675)); + + num676 = num673 / num676; + num674 *= num676; + num675 *= num676; + vector82.X += num674 * 3f; + vector82.Y += num675 * 3f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, ProjectileID.EyeBeam, 35, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num677].timeLeft = 480; + } + } + + if (npc.localAI[1] >= 15f) + npc.localAI[1] = 0f; + } + + // Slow down + npc.velocity.X *= 0.8f; + + // Delay before jumping + npc.ai[1] += 1f; + if (npc.ai[1] > 0f) + { + npc.ai[1] += 1f; + if (enrage || CalamityWorld.death) + npc.ai[1] += 18f; + else + { + if (!flag41) + npc.ai[1] += 6f; + if (!flag42) + npc.ai[1] += 6f; + if (!flag40) + npc.ai[1] += 6f; + } + } + if (npc.ai[1] >= 300f) + { + npc.ai[1] = -20f; + npc.frameCounter = 0.0; + } + else if (npc.ai[1] == -1f) + { + // Set jump velocity + npc.TargetClosest(true); + + float velocityX = 4f + (8f * (1f - lifeRatio)); + if (enrage) + velocityX *= 1.5f; + + npc.velocity.X = velocityX * (float)npc.direction; + + if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) + npc.velocity.Y = ((!flag43 && !flag40) ? -15.1f : -12.1f); + else + npc.velocity.Y = 1f; + + npc.noTileCollide = true; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + } + } + + // Fall down + else if (npc.ai[0] == 1f) + { + if (npc.velocity.Y == 0f) + { + // Play sound + Main.PlaySound(SoundID.Item14, npc.position); + + npc.ai[0] = 0f; + + // Dust and gore + for (int num644 = (int)npc.position.X - 20; num644 < (int)npc.position.X + npc.width + 40; num644 += 20) + { + for (int num645 = 0; num645 < 4; num645++) + { + int num646 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, 31, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[num646]; + dust.velocity *= 0.2f; + } + int num647 = Gore.NewGore(new Vector2((float)(num644 - 20), npc.position.Y + (float)npc.height - 8f), default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[num647]; + gore.velocity *= 0.4f; + } + + // Fireball explosion when head is dead + if (Main.netMode != NetmodeID.MultiplayerClient && !flag40) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity.Y *= 6f; + Main.dust[num622].velocity.X *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity.Y *= 10f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity.X *= 2f; + } + + int spawnX = (int)(npc.width / 2); + for (int i = 0; i < 5; i++) + { + float velocityX = Main.rand.NextBool() ? (float)Main.rand.Next(4, 6) : (float)Main.rand.Next(-5, -3); + float velocityY = (float)Main.rand.Next(-1, 2); + + if (enrage) + { + velocityX *= 2f; + velocityY *= 2f; + } + + int proj = Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y + (float)(npc.height / 2) * 0.8f, + velocityX, velocityY, ProjectileID.Fireball, 37, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 240; + } + } + } + else + { + npc.TargetClosest(true); + + // Fall through + if (npc.target >= 0 && + ((Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f))) + npc.noTileCollide = true; + else + npc.noTileCollide = false; + + // Velocity when falling + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + { + npc.velocity.X *= 0.9f; + + if (Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height) + { + float fallSpeed = 0.2f + (0.8f * (1f - lifeRatio)); + if (enrage) + fallSpeed *= 1.5f; + + npc.velocity.Y += fallSpeed; + } + } + else + { + if (npc.direction < 0) + npc.velocity.X -= 0.2f; + else if (npc.direction > 0) + npc.velocity.X += 0.2f; + + float num648 = 3f + (6f * (1f - lifeRatio)); + if (enrage) + num648 *= 1.5f; + + if (npc.velocity.X < -num648) + npc.velocity.X = -num648; + if (npc.velocity.X > num648) + npc.velocity.X = num648; + } + } + } + + // Target + if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) + npc.TargetClosest(true); + + // Despawn + int num649 = CalamityWorld.bossRushActive ? 4500 : 3000; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num649) + { + npc.TargetClosest(true); + + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num649) + npc.active = false; + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedGolemHeadAI(NPC npc, bool enraged, Mod mod) + { + // Don't collide + npc.noTileCollide = true; + + // Die if body is gone + if (NPC.golemBoss < 0) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + return false; + } + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Count body parts + bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); + bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); + npc.dontTakeDamage = flag41 || flag42; + + // Stay in position on top of body + float num650 = 12f; + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num651 = Main.npc[NPC.golemBoss].Center.X - vector80.X; + float num652 = Main.npc[NPC.golemBoss].Center.Y - vector80.Y; + num652 -= 57f; + num651 -= 3f; + float num653 = (float)Math.Sqrt((double)(num651 * num651 + num652 * num652)); + if (num653 < 20f) + { + npc.rotation = 0f; + npc.velocity.X = num651; + npc.velocity.Y = num652; + } + else + { + num653 = num650 / num653; + npc.velocity.X = num651 * num653; + npc.velocity.Y = num652 * num653; + npc.rotation = npc.velocity.X * 0.1f; + } + + // Enrage if the target isn't inside the temple + bool enrage = true; + if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == WallID.LihzahrdBrickUnsafe) + enrage = false; + } + if (CalamityWorld.bossRushActive) + enrage = true; + + // Alpha + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 30f; + } + + // Spit fireballs if arms are alive + if (npc.ai[0] == 0f) + { + npc.ai[1] += 1f; + int num654 = 180; + if (npc.ai[1] < 20f || npc.ai[1] > (float)(num654 - 20)) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (npc.ai[1] >= (float)num654) + { + npc.TargetClosest(true); + + npc.ai[1] = 0f; + + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y + 10f); + float num655 = enrage ? 16f : 8f; + float num656 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector81.X; + float num657 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector81.Y; + float num658 = (float)Math.Sqrt((double)(num656 * num656 + num657 * num657)); + + num658 = num655 / num658; + num656 *= num658; + num657 *= num658; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(vector81.X, vector81.Y, num656, num657, ProjectileID.Fireball, 37, 0f, Main.myPlayer, 0f, 0f); + } + } + + // Shoot lasers and fireballs if arms are dead + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(true); + + // Fire projectiles from eye positions + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y + 10f); + if (Main.player[npc.target].Center.X < npc.Center.X - (float)npc.width) + { + npc.localAI[1] = -1f; + vector82.X -= 40f; + } + else if (Main.player[npc.target].Center.X > npc.Center.X + (float)npc.width) + { + npc.localAI[1] = 1f; + vector82.X += 40f; + } + else + npc.localAI[1] = 0f; + + // Fireballs + npc.ai[1] += 1f + (2f * (1f - lifeRatio)); + + int num662 = 240; + if (npc.ai[1] < 20f || npc.ai[1] > (float)(num662 - 20)) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (npc.ai[1] >= (float)num662) + { + npc.TargetClosest(true); + + npc.ai[1] = 0f; + + float num663 = enrage ? 18f : 12f; + float num664 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; + float num665 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; + float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + + num666 = num663 / num666; + num664 *= num666; + num665 *= num666; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(vector82.X, vector82.Y, num664, num665, ProjectileID.Fireball, 37, 0f, Main.myPlayer, 0f, 0f); + } + + // Lasers + npc.ai[2] += 1f + (3f * (1f - lifeRatio)); + if (enrage) + npc.ai[2] += 4f; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + npc.ai[2] += 8f; + + if (npc.ai[2] >= 150f) + { + npc.ai[2] = 0f; + + int num670 = 35; + int num671 = ProjectileID.EyeBeam; + + if (npc.localAI[1] == 0f) + { + for (int num672 = 0; num672 < 2; num672++) + { + vector82 = new Vector2(npc.Center.X, npc.Center.Y - 22f); + if (num672 == 0) + vector82.X -= 18f; + else + vector82.X += 18f; + + float num673 = 9f; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + num673 = 14f; + + float num674 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; + float num675 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; + float num676 = (float)Math.Sqrt((double)(num674 * num674 + num675 * num675)); + + num676 = num673 / num676; + num674 *= num676; + num675 *= num676; + vector82.X += num674 * 3f; + vector82.Y += num675 * 3f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, num671, num670, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num677].timeLeft = (enrage ? 480 : 300); + } + } + } + else if (npc.localAI[1] != 0f) + { + vector82 = new Vector2(npc.Center.X, npc.Center.Y - 22f); + if (npc.localAI[1] == -1f) + vector82.X -= 30f; + else if (npc.localAI[1] == 1f) + vector82.X += 30f; + + float num678 = 9f; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + num678 = 14f; + + float num679 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector82.X; + float num680 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector82.Y; + float num681 = (float)Math.Sqrt((double)(num679 * num679 + num680 * num680)); + + num681 = num678 / num681; + num679 *= num681; + num680 *= num681; + vector82.X += num679 * 3f; + vector82.Y += num680 * 3f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num682 = Projectile.NewProjectile(vector82.X, vector82.Y, num679, num680, num671, num670, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num682].timeLeft = (enrage ? 480 : 300); + } + } + } + } + + // Laser fire if arms are dead + if (!flag41 && !flag42) + { + npc.ai[0] = 1f; + return false; + } + npc.ai[0] = 0f; + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedGolemHeadFreeAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Die if body is gone + if (NPC.golemBoss < 0) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + return false; + } + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float golemLifeRatio = (float)Main.npc[NPC.golemBoss].life / (float)Main.npc[NPC.golemBoss].lifeMax; + float combinedRatio = lifeRatio + golemLifeRatio; + + // Phases + bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase3 = lifeRatio < 0.4f || golemLifeRatio < 0.7f || CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase4 = lifeRatio < 0.1f || golemLifeRatio < 0.55f || CalamityWorld.death || CalamityWorld.bossRushActive; + + // Float through tiles or not + bool flag44 = false; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3) + { + npc.noTileCollide = true; + flag44 = true; + } + else + npc.noTileCollide = false; + + // Target + npc.TargetClosest(true); + + // Enrage if the target isn't inside the temple + bool enrage = true; + if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == WallID.LihzahrdBrickUnsafe) + enrage = false; + } + if (CalamityWorld.bossRushActive) + enrage = true; + + // Move to new location + if (npc.ai[3] <= 0f) + { + npc.ai[3] = 300f; + + float maxDistance = 300f; + + // Four corners around target + if (phase3) + { + if (calamityGlobalNPC.newAI[1] == -maxDistance) + { + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: + case 300: + calamityGlobalNPC.newAI[0] = -maxDistance; + break; + case -300: + calamityGlobalNPC.newAI[1] = maxDistance; + break; + default: + break; + } + } + else + { + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: + case -300: + calamityGlobalNPC.newAI[0] = maxDistance; + break; + case 300: + calamityGlobalNPC.newAI[1] = -maxDistance; + break; + default: + break; + } + } + } + + // Above target + else if (phase2) + { + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: + calamityGlobalNPC.newAI[0] = maxDistance; + break; + case 300: + calamityGlobalNPC.newAI[0] = -maxDistance; + break; + case -300: + calamityGlobalNPC.newAI[0] = 0f; + break; + default: + break; + } + } + else + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = -maxDistance; + } + } + + npc.ai[3] -= 1f + + (phase2 ? 1f : 0f) + + (phase3 ? 1f : 0f) + + (phase4 ? 2f : 0f); + + float offsetX = calamityGlobalNPC.newAI[0]; + float offsetY = calamityGlobalNPC.newAI[1]; + + // Velocity and acceleration + float num700 = 7f + + (phase2 ? 4f : 0f) + + (phase3 ? 14f : 0f); + + Vector2 vector87 = new Vector2(npc.Center.X, npc.Center.Y); + float num702 = Main.player[npc.target].Center.X - vector87.X + offsetX; + float num703 = Main.player[npc.target].Center.Y - vector87.Y + offsetY; + float num704 = (float)Math.Sqrt((double)(num702 * num702 + num703 * num703)); + + // Static movement + if (phase3) + { + if (enrage) + num700 = 25f; + + if (num704 < num700) + { + npc.velocity.X = num702; + npc.velocity.Y = num703; + } + else + { + num704 = num700 / num704; + npc.velocity.X = num702 * num704; + npc.velocity.Y = num703 * num704; + } + } + + // Rubber band movement + else + { + if (enrage) + num700 = 11f; + + float num701 = 0.1f + (phase2 ? 0.1f : 0f); + if (enrage) + num701 = 0.2f; + + num704 = num700 / num704; + num702 *= num704; + num703 *= num704; + + if (npc.velocity.X < num702) + { + npc.velocity.X += num701; + if (npc.velocity.X < 0f && num702 > 0f) + npc.velocity.X += num701; + } + else if (npc.velocity.X > num702) + { + npc.velocity.X -= num701; + if (npc.velocity.X > 0f && num702 < 0f) + npc.velocity.X -= num701; + } + if (npc.velocity.Y < num703) + { + npc.velocity.Y += num701; + if (npc.velocity.Y < 0f && num703 > 0f) + npc.velocity.Y += num701; + } + else if (npc.velocity.Y > num703) + { + npc.velocity.Y -= num701; + if (npc.velocity.Y > 0f && num703 < 0f) + npc.velocity.Y -= num701; + } + } + + // Fireballs + npc.ai[1] += 1f + (2f * (2f - (lifeRatio + golemLifeRatio))); + + int num705 = 360; + if (npc.ai[1] < 20f || npc.ai[1] > (float)(num705 - 20)) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (flag44 && !phase3) + npc.ai[1] = 20f; + + if (npc.ai[1] >= (float)num705 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + { + npc.TargetClosest(true); + + npc.ai[1] = 0f; + + Vector2 vector88 = new Vector2(npc.Center.X, npc.Center.Y - 10f); + float num706 = enrage ? 10f : 5f; + float num709 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector88.X; + float num710 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector88.Y; + float num711 = (float)Math.Sqrt((double)(num709 * num709 + num710 * num710)); + + num711 = num706 / num711; + num709 *= num711; + num710 *= num711; + + int projectileType = phase3 ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(vector88.X, vector88.Y, num709, num710, projectileType, 40, 0f, Main.myPlayer, 0f, 0f); + if (projectileType == ProjectileID.InfernoHostileBolt) + { + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; + Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; + Main.projectile[proj].netUpdate = true; + } + } + } + + // Lasers + npc.ai[2] += 1f + (2f * (2f - (lifeRatio + golemLifeRatio))); + if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + npc.ai[2] += 8f; + + if (npc.ai[2] >= 150f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + { + npc.ai[2] = 0f; + + for (int num713 = 0; num713 < 2; num713++) + { + Vector2 vector89 = new Vector2(npc.Center.X, npc.Center.Y - 50f); + if (num713 == 0) + vector89.X -= 14f; + else if (num713 == 1) + vector89.X += 14f; + + float num714 = 5f + (2f * (2f - (lifeRatio + golemLifeRatio))); + float num717 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector89.X; + float num718 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector89.Y; + float num719 = (float)Math.Sqrt((double)(num717 * num717 + num718 * num718)); + + num719 = num714 / num719; + num717 *= num719; + num718 *= num719; + vector89.X += num717 * 3f; + vector89.Y += num718 * 3f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num720 = Projectile.NewProjectile(vector89.X, vector89.Y, num717, num718, ProjectileID.EyeBeam, 35, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num720].timeLeft = (enrage ? 480 : 300); + } + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Duke Fishron AI + public static bool BuffedDukeFishronAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Variables + float num = 0.6f * Main.damageMultiplier; + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.66; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33 : 0.2); + bool phase2AI = npc.ai[0] > 4f; + bool phase3AI = npc.ai[0] > 9f; + bool charging = npc.ai[3] < 10f; + + // Adjust stats + if (phase3AI) + { + npc.damage = (int)((float)npc.defDamage * 1.1f * num); + npc.defense = (int)((float)npc.defDefense * 0.75f); + } + else if (phase2AI) + { + npc.damage = (int)((float)npc.defDamage * 1.2f * num); + npc.defense = npc.defDefense; + } + else + { + npc.damage = npc.defDamage; + npc.defense = (int)((float)npc.defDefense * 1.2f); + } + + int num2 = 30; + float num3 = 0.55f; + float scaleFactor = 8.5f; + if (phase3AI) + { + num3 = 0.7f; + scaleFactor = 12f; + } + else if (phase2AI & charging) + { + num3 = 0.6f; + scaleFactor = 10f; + } + + int chargeTime = 28; + float chargeVelocity = 17f; + if (phase3AI) + { + chargeTime = 25; + chargeVelocity = 27f; + } + else if (charging & phase2AI) + { + chargeTime = 27; + chargeVelocity = 21f; + } + + if (CalamityWorld.bossRushActive) + { + num2 = 25; + num3 *= 1.1f; + scaleFactor *= 1.15f; + chargeTime -= 2; + chargeVelocity *= 1.25f; + } + + // Variables + int num6 = CalamityWorld.bossRushActive ? 40 : 80; + int num7 = 4; + float num8 = 0.3f; + float scaleFactor2 = 5f; + int num9 = 90; + int num10 = 180; + int num11 = 180; + int num12 = 30; + int num13 = CalamityWorld.bossRushActive ? 60 : 120; + int num14 = 4; + float scaleFactor3 = 6f; + float scaleFactor4 = 20f; + float num15 = 6.28318548f / (float)(num13 / 2); + int num16 = 75; + Vector2 vector = npc.Center; + Player player = Main.player[npc.target]; + + // Get target + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + // Despawn + if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.velocity.Y -= 0.4f; + + if (npc.timeLeft > 10) + npc.timeLeft = 10; + + if (npc.ai[0] > 4f) + npc.ai[0] = 5f; + else + npc.ai[0] = 0f; + + npc.ai[2] = 0f; + } + + // Enrage variable + bool enrage = !CalamityWorld.bossRushActive && + (player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400))); + + // If the player isn't in the ocean biome or Fishron is transitioning between phases, become immune + if (!phase3AI) + npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f || enrage; + + // Enrage + if (enrage) + { + num2 = 20; + npc.damage = npc.defDamage * 2; + npc.defense = npc.defDefense * 2; + npc.ai[3] = 0f; + chargeVelocity += 8f; + } + + // Spawn cthulhunadoes in phase 3 + if (phase3AI) + { + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= 600f) + { + calamityGlobalNPC.newAI[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + + npc.netUpdate = true; + } + } + + // Set variables for spawn effects + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + // Rotation + float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + if (npc.spriteDirection == 1) + num17 += 3.14159274f; + if (num17 < 0f) + num17 += 6.28318548f; + if (num17 > 6.28318548f) + num17 -= 6.28318548f; + if (npc.ai[0] == -1f) + num17 = 0f; + if (npc.ai[0] == 3f) + num17 = 0f; + if (npc.ai[0] == 4f) + num17 = 0f; + if (npc.ai[0] == 8f) + num17 = 0f; + + float num18 = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f) + num18 = 0f; + if (npc.ai[0] == 7f) + num18 = 0f; + if (npc.ai[0] == 3f) + num18 = 0.01f; + if (npc.ai[0] == 4f) + num18 = 0.01f; + if (npc.ai[0] == 8f) + num18 = 0.01f; + + if (npc.rotation < num17) + { + if ((double)(num17 - npc.rotation) > 3.1415926535897931) + npc.rotation -= num18; + else + npc.rotation += num18; + } + if (npc.rotation > num17) + { + if ((double)(npc.rotation - num17) > 3.1415926535897931) + npc.rotation += num18; + else + npc.rotation -= num18; + } + + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + npc.rotation = num17; + if (npc.rotation < 0f) + npc.rotation += 6.28318548f; + if (npc.rotation > 6.28318548f) + npc.rotation -= 6.28318548f; + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + npc.rotation = num17; + + // Alpha adjustments + if (npc.ai[0] != -1f && npc.ai[0] < 9f) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + + // Spawn effects + if (npc.ai[0] == -1f) + { + // Velocity + npc.velocity *= 0.98f; + + // Direction + int num19 = Math.Sign(player.Center.X - vector.X); + if (num19 != 0) + { + npc.direction = num19; + npc.spriteDirection = -npc.direction; + } + + // Alpha + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + + // Spawn dust and play sound + if (npc.ai[2] == (float)(num9 - 30)) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + npc.Center; + Vector2 vector2 = expr_80F - npc.Center; + int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; + } + + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num16) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Phase 1 + else if (npc.ai[0] == 0f && !player.dead) + { + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector3.X) + { + npc.velocity.X += num3; + if (npc.velocity.X < 0f && vector3.X > 0f) + npc.velocity.X += num3; + } + else if (npc.velocity.X > vector3.X) + { + npc.velocity.X -= num3; + if (npc.velocity.X > 0f && vector3.X < 0f) + npc.velocity.X -= num3; + } + if (npc.velocity.Y < vector3.Y) + { + npc.velocity.Y += num3; + if (npc.velocity.Y < 0f && vector3.Y > 0f) + npc.velocity.Y += num3; + } + else if (npc.velocity.Y > vector3.Y) + { + npc.velocity.Y -= num3; + if (npc.velocity.Y > 0f && vector3.Y < 0f) + npc.velocity.Y -= num3; + } + + // Rotation and direction + int num22 = Math.Sign(player.Center.X - vector.X); + if (num22 != 0) + { + if (npc.ai[2] == 0f && num22 != npc.direction) + npc.rotation += 3.14159274f; + + npc.direction = num22; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num23 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + num23 = 1; + break; + case 10: + npc.ai[3] = 1f; + num23 = 2; + break; + case 11: + npc.ai[3] = 0f; + num23 = 3; + break; + } + + if (phase2) + num23 = 4; + + // Set velocity for charge + if (num23 == 1) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity + npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + + // Direction + if (num22 != 0) + { + npc.direction = num22; + + if (npc.spriteDirection == 1) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + } + + // Bubbles + else if (num23 == 2) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Spawn sharknadoes + else if (num23 == 3) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Go to phase 2 + else if (num23 == 4) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[0] == 1f) + { + // Accelerate + npc.velocity *= 1.01f; + + // Spawn dust + int num24 = 7; + for (int j = 0; j < num24; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity /= 4f; + Main.dust[num25].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + + // Bubble belch + else if (npc.ai[0] == 2f) + { + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + + Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor2; + if (npc.velocity.X < vector5.X) + { + npc.velocity.X += num8; + if (npc.velocity.X < 0f && vector5.X > 0f) + npc.velocity.X += num8; + } + else if (npc.velocity.X > vector5.X) + { + npc.velocity.X -= num8; + if (npc.velocity.X > 0f && vector5.X < 0f) + npc.velocity.X -= num8; + } + if (npc.velocity.Y < vector5.Y) + { + npc.velocity.Y += num8; + if (npc.velocity.Y < 0f && vector5.Y > 0f) + npc.velocity.Y += num8; + } + else if (npc.velocity.Y > vector5.Y) + { + npc.velocity.Y -= num8; + if (npc.velocity.Y > 0f && vector5.Y < 0f) + npc.velocity.Y -= num8; + } + + // Play sounds and spawn bubbles + if (npc.ai[2] == 0f) + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + + if (npc.ai[2] % (float)num7 == 0f) + { + Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (float)(npc.width + 20) / 2f + vector; + NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, NPCID.DetonatingBubble, 0, 0f, 0f, 0f, 0f, 255); + } + } + + // Direction + int num26 = Math.Sign(player.Center.X - vector.X); + if (num26 != 0) + { + npc.direction = num26; + if (npc.spriteDirection != -npc.direction) + npc.rotation += 3.14159274f; + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num6) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Sharknado spawn + else if (npc.ai[0] == 3f) + { + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound and spawn sharknadoes + if (npc.ai[2] == (float)(num9 - 30)) + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 9, 1f, 0f); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num9 - 30)) + { + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; + bool normal = Main.rand.NextBool(); + float velocityY = normal ? 8f : -4f; + float ai1 = normal ? 0f : -1f; + + Projectile.NewProjectile(vector7.X, vector7.Y, (float)(npc.direction * 3), velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + Projectile.NewProjectile(vector7.X, vector7.Y, (float)(-(float)npc.direction * 3), velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + + velocityY = normal ? -4f : 8f; + ai1 = normal ? -1f : 0f; + Projectile.NewProjectile(vector7.X, vector7.Y, 0f, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num9) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Transition to phase 2 + else if (npc.ai[0] == 4f) + { + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Sound + if (npc.ai[2] == (float)(num10 - 60)) + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num10) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + + // Phase 2 + else if (npc.ai[0] == 5f && !player.dead) + { + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + + Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector8.X) + { + npc.velocity.X += num3; + if (npc.velocity.X < 0f && vector8.X > 0f) + npc.velocity.X += num3; + } + else if (npc.velocity.X > vector8.X) + { + npc.velocity.X -= num3; + if (npc.velocity.X > 0f && vector8.X < 0f) + npc.velocity.X -= num3; + } + if (npc.velocity.Y < vector8.Y) + { + npc.velocity.Y += num3; + if (npc.velocity.Y < 0f && vector8.Y > 0f) + npc.velocity.Y += num3; + } + else if (npc.velocity.Y > vector8.Y) + { + npc.velocity.Y -= num3; + if (npc.velocity.Y > 0f && vector8.Y < 0f) + npc.velocity.Y -= num3; + } + + // Direction and rotation + int num27 = Math.Sign(player.Center.X - vector.X); + if (num27 != 0) + { + if (npc.ai[2] == 0f && num27 != npc.direction) + npc.rotation += 3.14159274f; + + npc.direction = num27; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num28 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + num28 = 1; + break; + case 6: + npc.ai[3] = 1f; + num28 = 2; + break; + case 7: + npc.ai[3] = 0f; + num28 = 3; + break; + } + + if (phase3) + num28 = 4; + + // Set velocity for charge + if (num28 == 1) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + + // Direction + if (num27 != 0) + { + npc.direction = num27; + + if (npc.spriteDirection == 1) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + } + + // Set velocity for spin + else if (num28 == 2) + { + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + + // Direction + if (num27 != 0) + { + npc.direction = num27; + + if (npc.spriteDirection == 1) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Spawn cthulhunado + else if (num28 == 3) + { + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Go to next phase + else if (num28 == 4) + { + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[0] == 6f) + { + // Accelerate + npc.velocity *= 1.01f; + + // Spawn dust + int num29 = 7; + for (int k = 0; k < num29; k++) + { + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(k - (num29 / 2 - 1)) * 3.1415926535897931 / (double)((float)num29), default) + vector; + Vector2 vector9 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, 172, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); + Main.dust[num30].noGravity = true; + Main.dust[num30].noLight = true; + Main.dust[num30].velocity /= 4f; + Main.dust[num30].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + + // Bubble spin + else if (npc.ai[0] == 7f) + { + // Play sounds and spawn bubbles + if (npc.ai[2] == 0f) + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + + if (npc.ai[2] % (float)num14 == 0f) + { + Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector; + int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.DetonatingBubble, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num31].target = npc.target; + Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy((double)(1.57079637f * (float)npc.direction), default) * scaleFactor3; + Main.npc[num31].netUpdate = true; + Main.npc[num31].ai[3] = (float)Main.rand.Next(80, 121) / 100f; + + if (npc.ai[2] % (float)(num14 * 5) == 0f) + { + int npc2 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.Sharkron2, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[npc2].ai[1] = 89f; + } + } + } + + // Velocity and rotation + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default); + npc.rotation -= num15 * (float)npc.direction; + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num13) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Spawn cthulhunado + else if (npc.ai[0] == 8f) + { + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound and spawn cthulhunado + if (npc.ai[2] == (float)(num9 - 30)) + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num9 - 30)) + Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num9) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Transition to phase 3 + else if (npc.ai[0] == 9f) + { + // Alpha adjustments + if (npc.ai[2] < (float)(num11 - 90)) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + else if (npc.alpha < 255) + { + npc.alpha += 4; + if (npc.alpha > 255) + npc.alpha = 255; + } + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound + if (npc.ai[2] == (float)(num11 - 60)) + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num11) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + + // Phase 3 + else if (npc.ai[0] == 10f && !player.dead) + { + npc.dontTakeDamage = false; + npc.chaseable = false; + + // Alpha + if (npc.alpha < 255) + { + npc.alpha += 25; + if (npc.alpha > 255) + npc.alpha = 255; + } + + // Teleport location + if (npc.ai[1] == 0f) + npc.ai[1] = (float)(360 * Math.Sign((vector - player.Center).X)); + + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + npc.SimpleFlyMovement(desiredVelocity, num3); + + // Rotation and direction + int num32 = Math.Sign(player.Center.X - vector.X); + if (num32 != 0) + { + if (npc.ai[2] == 0f && num32 != npc.direction) + { + npc.rotation += 3.14159274f; + for (int l = 0; l < npc.oldPos.Length; l++) + npc.oldPos[l] = Vector2.Zero; + } + + npc.direction = num32; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num33 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + num33 = 1; + break; + case 1: + case 4: + case 8: + num33 = 2; + break; + } + + // Set velocity for charge + if (num33 == 1) + { + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + + // Direction + if (num32 != 0) + { + npc.direction = num32; + + if (npc.spriteDirection == 1) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + } + + // Pause + else if (num33 == 2) + { + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[0] == 11f) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + + // Accelerate + npc.velocity *= 1.01f; + + // Alpha + npc.alpha -= 25; + if (npc.alpha < 0) + npc.alpha = 0; + + // Spawn dust + int num34 = 7; + for (int m = 0; m < num34; m++) + { + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default) + vector; + Vector2 vector11 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); + Main.dust[num35].noGravity = true; + Main.dust[num35].noLight = true; + Main.dust[num35].velocity /= 4f; + Main.dust[num35].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + + // Pause before teleport + else if (npc.ai[0] == 12f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + + // Alpha + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound + if (npc.ai[2] == (float)(num12 / 2)) + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num12 / 2)) + { + // Teleport location + if (npc.ai[1] == 0f) + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + + // Rotation and direction + Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); + vector = (npc.Center = center); + int num36 = Math.Sign(player.Center.X - vector.X); + if (num36 != 0) + { + if (npc.ai[2] == 0f && num36 != npc.direction) + { + npc.rotation += 3.14159274f; + for (int n = 0; n < npc.oldPos.Length; n++) + npc.oldPos[n] = Vector2.Zero; + } + + npc.direction = num36; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num12) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.ai[3] += 1f; + if (npc.ai[3] >= 9f) + npc.ai[3] = 0f; + + npc.netUpdate = true; + } + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Cultist AI + public static bool BuffedCultistAI(NPC npc, bool enraged, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Set contact damage to 0 + npc.damage = (npc.defDamage = 0); + + // Chant sound + if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, Main.rand.Next(88, 92), 1f, 0f); + } + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.8f; + bool phase3 = lifeRatio < 0.6f; + bool phase4 = lifeRatio < 0.4f; + bool phase5 = lifeRatio < 0.2f; + + // Variables + bool isCultist = npc.type == NPCID.CultistBoss; + bool dontTakeDamage = false; + + int iceMistDamage = 38; + int fireballDamage = isCultist ? 30 : 27; + int lightningDamage = 45; + + int iceMistFireRate = 60 - + (phase2 ? 5 : 0) - + (phase3 ? 5 : 0) - + (phase4 ? 5 : 0) - + (phase5 ? 5 : 0); + + float iceMistSpeed = CalamityWorld.death ? 6.5f : 6f; + + int fireballFireRate = 12; + + float fireballSpeed = (CalamityWorld.death ? 7f : 6.5f) - (isCultist ? 0f : 3f); + + int lightningOrbFireRate = 40 - + (phase2 ? 5 : 0) - + (phase3 ? 5 : 0) - + (phase4 ? 5 : 0) - + (phase5 ? 5 : 0); + + int ancientLightSpawnRate = 30 - + (phase3 ? 10 : 0) - + (phase5 ? 10 : 0); + + int idleTime = 40 - + (phase2 ? 5 : 0) - + (phase3 ? 5 : 0) - + (phase4 ? 5 : 0) - + (phase5 ? 5 : 0); + + float timeToFinishRitual = 420f - + (phase2 ? 90f : 0f) - + (phase3 ? 60f : 0f) - + (phase4 ? 30f : 0f) - + (phase5 ? 15f : 0f); + + if (CalamityWorld.bossRushActive) + { + iceMistFireRate = 30; + iceMistSpeed = 9f; + fireballSpeed *= 1.5f; + lightningOrbFireRate = 20; + ancientLightSpawnRate = 10; + idleTime = 20; + } + + // Center and target + Vector2 center = npc.Center; + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + // Enrage + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= 180f) + { + calamityGlobalNPC.newAI[0] = 180f; + iceMistSpeed = 8f; + iceMistFireRate = 30; + lightningOrbFireRate = 15; + ancientLightSpawnRate = 5; + idleTime = 15; + timeToFinishRitual = 180f; + } + } + else + { + if (calamityGlobalNPC.newAI[0] > 0f) + calamityGlobalNPC.newAI[0] -= 1f; + } + + // Cultist clone AI + if (!isCultist) + { + if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + return false; + } + npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; + npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; + dontTakeDamage = true; + } + + // Stop spawning ritual if hit + else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual && npc.justHit) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + Main.projectile[(int)npc.ai[2]].ai[1] = -1f; + Main.projectile[(int)npc.ai[2]].netUpdate = true; + } + + // Despawn + if (player.dead || Vector2.Distance(player.Center, center) > 5600f) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + new List().Add(npc.whoAmI); + for (int j = 0; j < 200; j++) + { + if (Main.npc[j].active && Main.npc[j].type == 440 && Main.npc[j].ai[3] == (float)npc.whoAmI) + { + Main.npc[j].life = 0; + Main.npc[j].HitEffect(0, 10.0); + Main.npc[j].active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + } + } + + // Clones set to Cultist phase + float clonePhase = npc.ai[3]; + + // Spawn and play sound + if (npc.localAI[0] == 0f) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 89, 1f, 0f); + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + // Appear and do weird ritual shit with tablet + if (npc.ai[0] == -1f) + { + npc.alpha -= 5; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] += 1f; + if (npc.ai[1] >= 420f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[1] > 360f) + { + npc.velocity *= 0.95f; + if (npc.localAI[2] != 13f) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 105, 1f, 0f); + } + npc.localAI[2] = 13f; + } + else if (npc.ai[1] > 300f) + { + npc.velocity = -Vector2.UnitY; + npc.localAI[2] = 10f; + } + else if (npc.ai[1] > 120f) + { + npc.localAI[2] = 1f; + } + else + { + npc.localAI[2] = 0f; + } + dontTakeDamage = true; + } + + // Phase switch + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + npc.TargetClosest(false); + } + npc.localAI[2] = 10f; + int num14 = Math.Sign(player.Center.X - center.X); + if (num14 != 0) + { + npc.direction = (npc.spriteDirection = num14); + } + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)idleTime & isCultist) + { + int num15 = 0; + if (phase2) + { + switch ((int)npc.ai[3]) + { + case 0: + num15 = 0; + break; + case 1: + num15 = 1; + break; + case 2: + num15 = 0; + break; + case 3: + num15 = 5; + break; + case 4: + num15 = 0; + break; + case 5: + num15 = 3; + break; + case 6: + num15 = 0; + break; + case 7: + num15 = 5; + break; + case 8: + num15 = 0; + break; + case 9: + num15 = 2; + break; + case 10: + num15 = 0; + break; + case 11: + num15 = 3; + break; + case 12: + num15 = 0; + break; + case 13: + num15 = 4; + npc.ai[3] = -1f; + break; + default: + npc.ai[3] = -1f; + break; + } + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + num15 = 0; + break; + case 1: + num15 = 1; + break; + case 2: + num15 = 0; + break; + case 3: + num15 = 2; + break; + case 4: + num15 = 0; + break; + case 5: + num15 = 3; + break; + case 6: + num15 = 0; + break; + case 7: + num15 = 1; + break; + case 8: + num15 = 0; + break; + case 9: + num15 = 2; + break; + case 10: + num15 = 0; + break; + case 11: + num15 = 4; + npc.ai[3] = -1f; + break; + default: + npc.ai[3] = -1f; + break; + } + } + + int maxValue = 6 - + (phase3 ? 2 : 0) - + (phase4 ? 1 : 0); + + // Spawn Ancient Dooms + if (phase2 && Main.rand.NextBool(maxValue) && num15 != 0 && num15 != 4 && num15 != 5 && NPC.CountNPCS(NPCID.AncientDoom) < 10) + { + num15 = 6; + } + + // Move above target, also moves clones + if (num15 == 0) + { + // Set a location to move to + float num16 = (float)Math.Ceiling((double)((player.Center + new Vector2(0f, -100f) - center).Length() / 50f)); + if (num16 == 0f) + { + num16 = 1f; + } + + // Add self and clones to list + List list2 = new List(); + int num17 = 0; + list2.Add(npc.whoAmI); + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == (float)npc.whoAmI) + { + list2.Add(k); + } + } + + // Move self and clones to location + bool flag5 = list2.Count % 2 == 0; + foreach (int current2 in list2) + { + NPC nPC2 = Main.npc[current2]; + Vector2 center2 = nPC2.Center; + float num18 = (float)((num17 + flag5.ToInt() + 1) / 2) * 6.28318548f * 0.4f / (float)list2.Count; + if (num17 % 2 == 1) + { + num18 *= -1f; + } + if (list2.Count == 1) + { + num18 = 0f; + } + Vector2 value = new Vector2(0f, -1f).RotatedBy((double)num18, default) * new Vector2(150f, 200f); + Vector2 value2 = player.Center + value - center2; + nPC2.ai[0] = 1f; + nPC2.ai[1] = num16; + nPC2.velocity = (value2 / num16) * 2f; + if (npc.whoAmI >= nPC2.whoAmI) + { + nPC2.position -= nPC2.velocity; + } + nPC2.netUpdate = true; + num17++; + } + } + + // Set AI phase + if (num15 == 1) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + } + else if (num15 == 2) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + else if (num15 == 3) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + else if (num15 == 4) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + } + if (num15 == 5) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + } + if (num15 == 6) + { + npc.ai[0] = 8f; + npc.ai[1] = 0f; + } + npc.netUpdate = true; + } + } + + // Movement, then switch to a different attack + else if (npc.ai[0] == 1f) + { + dontTakeDamage = true; + npc.localAI[2] = 10f; + if (npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) + { + npc.position -= npc.velocity; + } + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Ice Mist + else if (npc.ai[0] == 2f) + { + npc.localAI[2] = 11f; + Vector2 vec = Vector2.Normalize(player.Center - center); + if (vec.HasNaNs()) + { + vec = new Vector2((float)npc.direction, 0f); + } + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % iceMistFireRate == 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + List list3 = new List(); + for (int l = 0; l < 200; l++) + { + if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == (float)npc.whoAmI) + { + list3.Add(l); + } + } + foreach (int current3 in list3) + { + NPC nPC3 = Main.npc[current3]; + Vector2 center3 = nPC3.Center; + int num19 = Math.Sign(player.Center.X - center3.X); + if (num19 != 0) + { + nPC3.direction = (nPC3.spriteDirection = num19); + } + vec = Vector2.Normalize(player.Center - center3 + player.velocity * 20f); + if (vec.HasNaNs()) + { + vec = new Vector2((float)npc.direction, 0f); + } + Vector2 vector = center3 + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector2 = vec * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + vector2 = vector2.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(vector.X, vector.Y, vector2.X, vector2.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec = Vector2.Normalize(player.Center - center + player.velocity * 20f); + if (vec.HasNaNs()) + { + vec = new Vector2((float)npc.direction, 0f); + } + Vector2 vector3 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector4 = vec * iceMistSpeed; + Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + iceMistFireRate * 2)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Fireballs + else if (npc.ai[0] == 3f) + { + npc.localAI[2] = 11f; + Vector2 vec2 = Vector2.Normalize(player.Center - center); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % fireballFireRate == 0) + { + if ((int)(npc.ai[1] - 4f) / fireballFireRate == 2) + { + List list4 = new List(); + for (int num20 = 0; num20 < 200; num20++) + { + if (Main.npc[num20].active && Main.npc[num20].type == NPCID.CultistBossClone && Main.npc[num20].ai[3] == (float)npc.whoAmI) + { + list4.Add(num20); + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + foreach (int current4 in list4) + { + NPC nPC4 = Main.npc[current4]; + Vector2 center4 = nPC4.Center; + int num21 = Math.Sign(player.Center.X - center4.X); + if (num21 != 0) + { + nPC4.direction = (nPC4.spriteDirection = num21); + } + vec2 = Vector2.Normalize(player.Center - center4 + player.velocity * 20f); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + Vector2 vector5 = center4 + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector6 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + vector6 = vector6.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(vector5.X, vector5.Y, vector6.X, vector6.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + int num23 = Math.Sign(player.Center.X - center.X); + if (num23 != 0) + { + npc.direction = (npc.spriteDirection = num23); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec2 = Vector2.Normalize(player.Center - center + player.velocity * 20f); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + Vector2 vector7 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector8 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 4f); + vector8 = vector8.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(vector7.X, vector7.Y, vector8.X, vector8.Y, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + fireballFireRate * 4)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Lightning Orb + else if (npc.ai[0] == 4f) + { + if (isCultist) + { + npc.localAI[2] = 12f; + } + else + { + npc.localAI[2] = 11f; + } + if ((npc.ai[1] == 20f & isCultist) && Main.netMode != NetmodeID.MultiplayerClient) + { + List list5 = new List(); + for (int num25 = 0; num25 < 200; num25++) + { + if (Main.npc[num25].active && Main.npc[num25].type == NPCID.CultistBossClone && Main.npc[num25].ai[3] == (float)npc.whoAmI) + { + list5.Add(num25); + } + } + foreach (int current5 in list5) + { + NPC nPC5 = Main.npc[current5]; + Vector2 center5 = nPC5.Center; + int num26 = Math.Sign(player.Center.X - center5.X); + if (num26 != 0) + { + nPC5.direction = (nPC5.spriteDirection = num26); + } + Vector2 vec3 = Vector2.Normalize(player.Center - center5 + player.velocity * 20f); + if (vec3.HasNaNs()) + { + vec3 = new Vector2((float)npc.direction, 0f); + } + Vector2 vector9 = center5 + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector10 = vec3 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + vector10 = vector10.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(vector9.X, vector9.Y, vector10.X, vector10.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + } + Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 100f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer, 0f, 0f); + } + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(20 + lightningOrbFireRate)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Spawn Clones, and Dragon or Cthulhu head + else if (npc.ai[0] == 5f) + { + npc.localAI[2] = 10f; + if (Vector2.Normalize(player.Center - center).HasNaNs()) + { + new Vector2((float)npc.direction, 0f); + } + if (npc.ai[1] >= 0f && npc.ai[1] < 30f) + { + dontTakeDamage = true; + float num28 = (npc.ai[1] - 0f) / 30f; + npc.alpha = (int)(num28 * 255f); + } + else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) + { + if ((npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient) & isCultist) + { + npc.localAI[1] += 1f; + Vector2 spinningpoint = new Vector2(180f, 0f); + List list6 = new List(); + for (int num29 = 0; num29 < 200; num29++) + { + if (Main.npc[num29].active && Main.npc[num29].type == NPCID.CultistBossClone && Main.npc[num29].ai[3] == (float)npc.whoAmI) + { + list6.Add(num29); + } + } + int num30 = 6 - list6.Count; + if (num30 > 2) + { + num30 = 2; + } + int num31 = list6.Count + num30 + 1; + float[] array = new float[num31]; + for (int num32 = 0; num32 < array.Length; num32++) + { + array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((double)((float)num32 * 6.28318548f / (float)num31 - 1.57079637f), default), player.Center); + } + int num33 = 0; + for (int num34 = 1; num34 < array.Length; num34++) + { + if (array[num33] > array[num34]) + { + num33 = num34; + } + } + if (num33 < num31 / 2) + { + num33 += num31 / 2; + } + else + { + num33 -= num31 / 2; + } + int num35 = num30; + for (int num36 = 0; num36 < array.Length; num36++) + { + if (num33 != num36) + { + Vector2 vector11 = npc.Center + spinningpoint.RotatedBy((double)((float)num36 * 6.28318548f / (float)num31 - 1.57079637f), default); + if (num35-- > 0) + { + int num37 = NPC.NewNPC((int)vector11.X, (int)vector11.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num37].ai[3] = (float)npc.whoAmI; + Main.npc[num37].netUpdate = true; + Main.npc[num37].localAI[1] = npc.localAI[1]; + } + else + { + int num38 = list6[-num35 - 1]; + Main.npc[num38].Center = vector11; + NetMessage.SendData(23, -1, -1, null, num38, 0f, 0f, 0f, 0, 0, 0); + } + } + } + npc.ai[2] = (float)Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + npc.Center += spinningpoint.RotatedBy((double)((float)num33 * 6.28318548f / (float)num31 - 1.57079637f), default); + npc.netUpdate = true; + list6.Clear(); + } + dontTakeDamage = true; + npc.alpha = 255; + if (isCultist) + { + Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; + vector12 -= npc.Center; + if (vector12 == Vector2.Zero) + { + vector12 = -Vector2.UnitY; + } + vector12.Normalize(); + if (Math.Abs(vector12.Y) < 0.77f) + { + npc.localAI[2] = 11f; + } + else if (vector12.Y < 0f) + { + npc.localAI[2] = 12f; + } + else + { + npc.localAI[2] = 10f; + } + int num39 = Math.Sign(vector12.X); + if (num39 != 0) + { + npc.direction = (npc.spriteDirection = num39); + } + } + else + { + Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + vector13 -= npc.Center; + if (vector13 == Vector2.Zero) + { + vector13 = -Vector2.UnitY; + } + vector13.Normalize(); + if (Math.Abs(vector13.Y) < 0.77f) + { + npc.localAI[2] = 11f; + } + else if (vector13.Y < 0f) + { + npc.localAI[2] = 12f; + } + else + { + npc.localAI[2] = 10f; + } + int num40 = Math.Sign(vector13.X); + if (num40 != 0) + { + npc.direction = (npc.spriteDirection = num40); + } + } + } + else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) + { + dontTakeDamage = true; + float num41 = (npc.ai[1] - 90f) / 30f; + npc.alpha = 255 - (int)(num41 * 255f); + } + else if (npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) + { + npc.alpha = 0; + if (isCultist) + { + Vector2 vector14 = Main.projectile[(int)npc.ai[2]].Center; + vector14 -= npc.Center; + if (vector14 == Vector2.Zero) + { + vector14 = -Vector2.UnitY; + } + vector14.Normalize(); + if (Math.Abs(vector14.Y) < 0.77f) + { + npc.localAI[2] = 11f; + } + else if (vector14.Y < 0f) + { + npc.localAI[2] = 12f; + } + else + { + npc.localAI[2] = 10f; + } + int num42 = Math.Sign(vector14.X); + if (num42 != 0) + { + npc.direction = (npc.spriteDirection = num42); + } + } + else + { + Vector2 vector15 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + vector15 -= npc.Center; + if (vector15 == Vector2.Zero) + { + vector15 = -Vector2.UnitY; + } + vector15.Normalize(); + if (Math.Abs(vector15.Y) < 0.77f) + { + npc.localAI[2] = 11f; + } + else if (vector15.Y < 0f) + { + npc.localAI[2] = 12f; + } + else + { + npc.localAI[2] = 10f; + } + int num43 = Math.Sign(vector15.X); + if (num43 != 0) + { + npc.direction = (npc.spriteDirection = num43); + } + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= timeToFinishRitual) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Pause + else if (npc.ai[0] == 6f) + { + npc.localAI[2] = 13f; + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(idleTime * 3)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Ancient Light + else if (npc.ai[0] == 7f) + { + npc.localAI[2] = 11f; + Vector2 vec4 = Vector2.Normalize(player.Center - center); + if (vec4.HasNaNs()) + { + vec4 = new Vector2((float)npc.direction, 0f); + } + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) + { + if ((int)(npc.ai[1] - 4f) / ancientLightSpawnRate == 2) + { + List list7 = new List(); + for (int num44 = 0; num44 < 200; num44++) + { + if (Main.npc[num44].active && Main.npc[num44].type == NPCID.CultistBossClone && Main.npc[num44].ai[3] == (float)npc.whoAmI) + { + list7.Add(num44); + } + } + foreach (int current6 in list7) + { + NPC nPC6 = Main.npc[current6]; + Vector2 center6 = nPC6.Center; + int num45 = Math.Sign(player.Center.X - center6.X); + if (num45 != 0) + { + nPC6.direction = (nPC6.spriteDirection = num45); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec4 = Vector2.Normalize(player.Center - center6 + player.velocity * 20f); + if (vec4.HasNaNs()) + { + vec4 = new Vector2((float)npc.direction, 0f); + } + Vector2 vector16 = center6 + new Vector2((float)(npc.direction * 30), 12f); + int num46 = 0; + while ((float)num46 < 5f) + { + Vector2 vector17 = vec4 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + vector17 = vector17.RotatedByRandom(1.2566370964050293); + Projectile.NewProjectile(vector16.X, vector16.Y, vector17.X, vector17.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + num46++; + } + } + } + } + int num47 = Math.Sign(player.Center.X - center.X); + if (num47 != 0) + { + npc.direction = (npc.spriteDirection = num47); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec4 = Vector2.Normalize(player.Center - center + player.velocity * 20f); + if (vec4.HasNaNs()) + { + vec4 = new Vector2((float)npc.direction, 0f); + } + Vector2 vector18 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); + float scaleFactor = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 11f : 10f; + if (CalamityWorld.bossRushActive) + scaleFactor *= 1.5f; + + float num48 = 0.251327425f; + int num49 = 0; + while ((float)num49 < 5f) + { + Vector2 vector19 = vec4 * scaleFactor; + vector19 = vector19.RotatedBy((double)(num48 * (float)num49 - (1.2566371f - num48) / 2f), default); + float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * 6.28318548f / 60f; + int num50 = NPC.NewNPC((int)vector18.X, (int)vector18.Y + 7, NPCID.AncientLight, 0, 0f, ai, vector19.X, vector19.Y, 255); + Main.npc[num50].velocity = vector19; + num49++; + } + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + ancientLightSpawnRate * 2)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Ancient Doom + else if (npc.ai[0] == 8f) + { + npc.localAI[2] = 13f; + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20 == 0) + { + List list8 = new List(); + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == NPCID.CultistBossClone && Main.npc[num51].ai[3] == (float)npc.whoAmI) + { + list8.Add(num51); + } + } + int num52 = list8.Count + 1; + if (num52 > 3) + { + num52 = 3; + } + int num53 = Math.Sign(player.Center.X - center.X); + if (num53 != 0) + { + npc.direction = (npc.spriteDirection = num53); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int num54 = 0; num54 < num52; num54++) + { + Point point = npc.Center.ToTileCoordinates(); + Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 vector20 = Main.player[npc.target].Center - npc.Center; + int num55 = 20; + int num56 = 3; + int num57 = 7; + int num58 = 2; + int num59 = 0; + bool flag6 = false; + if (vector20.Length() > 2800f) + { + flag6 = true; + } + while (!flag6 && num59 < 100) + { + num59++; + int num60 = Main.rand.Next(point2.X - num55, point2.X + num55 + 1); + int num61 = Main.rand.Next(point2.Y - num55, point2.Y + num55 + 1); + if ((num61 < point2.Y - num57 || num61 > point2.Y + num57 || num60 < point2.X - num57 || num60 > point2.X + num57) && (num61 < point.Y - num56 || num61 > point.Y + num56 || num60 < point.X - num56 || num60 > point.X + num56) && !Main.tile[num60, num61].nactive()) + { + bool flag7 = true; + if (flag7 && Collision.SolidTiles(num60 - num58, num60 + num58, num61 - num58, num61 + num58)) + { + flag7 = false; + } + if (flag7) + { + NPC.NewNPC(num60 * 16 + 8, num61 * 16 + 8, NPCID.AncientDoom, 0, (float)npc.whoAmI, 0f, 0f, 0f, 255); + break; + } + } + } + } + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= 64f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Set Clones to Cultist phase + if (!isCultist) + { + npc.ai[3] = clonePhase; + } + + // Take damage or not + npc.dontTakeDamage = dontTakeDamage; + npc.chaseable = npc.ai[0] != -1f && npc.ai[0] != 5f; + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedAncientDoomAI(NPC npc, Mod mod) + { + npc.damage = (npc.defDamage = 0); + float num1496 = 420f; + float num1497 = 120f; + int num1498 = 1; + float value57 = 0f; + float value58 = 1f; + float num1499 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5.5f : 5f; + if (CalamityWorld.bossRushActive) + num1499 *= 1.5f; + + bool flag110 = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; + if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) + { + if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 2) + { + num1498 = 2; + } + if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 4) + { + num1498 = 3; + } + } + else + { + flag110 = true; + } + npc.ai[1] += (float)num1498; + float num1500 = npc.ai[1] / num1497; + num1500 = MathHelper.Clamp(num1500, 0f, 1f); + npc.position = npc.Center; + npc.scale = MathHelper.Lerp(value57, value58, num1500); + npc.Center = npc.position; + npc.alpha = (int)(255f - num1500 * 255f); + if (Main.rand.NextBool(6)) + { + Vector2 spinningpoint4 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust17 = Main.dust[Dust.NewDust(npc.Center - spinningpoint4 * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; + dust17.noGravity = true; + dust17.position = npc.Center - spinningpoint4 * (float)Main.rand.Next(10, 21) * npc.scale; + dust17.velocity = spinningpoint4.RotatedBy(1.5707963705062866, default) * 4f; + dust17.scale = 0.5f + Main.rand.NextFloat(); + dust17.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 spinningpoint5 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust18 = Main.dust[Dust.NewDust(npc.Center - spinningpoint5 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; + dust18.noGravity = true; + dust18.position = npc.Center - spinningpoint5 * 20f * npc.scale; + dust18.velocity = spinningpoint5.RotatedBy(-1.5707963705062866, default) * 2f; + dust18.scale = 0.5f + Main.rand.NextFloat(); + dust18.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 vector254 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust19 = Main.dust[Dust.NewDust(npc.Center - vector254 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; + dust19.position = npc.Center - vector254 * 20f * npc.scale; + dust19.velocity = Vector2.Zero; + dust19.scale = 0.5f + Main.rand.NextFloat(); + dust19.fadeIn = 0.5f; + dust19.noLight = true; + } + npc.localAI[0] += 0.05235988f; + npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy((double)(npc.ai[1] * 6.28318548f / 60f), default).Y * 0.25f; + if (npc.ai[1] >= num1496) + { + flag110 = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num; + for (int num1501 = 0; num1501 < 4; num1501 = num + 1) + { + Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy((double)(1.57079637f * (float)num1501), default); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.AncientDoomProjectile, 50, 0f, Main.myPlayer, 0f, 0f); + num = num1501; + } + } + } + if (flag110) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + + return false; + } + #endregion + + #region Buffed Moon Lord AI + public static bool BuffedMoonLordAI(NPC npc, bool enraged, Mod mod) + { + if (npc.type == NPCID.MoonLordCore) + { + // Play a random Moon Lord sound + if (npc.ai[0] != -1f && npc.ai[0] != 2f && Main.rand.NextBool(200)) + Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, Main.rand.Next(93, 100), 1f, 0f); + + // Start the AI + if (npc.localAI[3] == 0f) + { + npc.netUpdate = true; + npc.localAI[3] = 1f; + npc.ai[0] = -1f; + } + + if (npc.ai[0] == -2f) + { + npc.dontTakeDamage = true; + + npc.ai[1] += 1f; + if (npc.ai[1] == 30f) + Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); + + if (npc.ai[1] < 60f) + MoonlordDeathDrama.RequestLight(npc.ai[1] / 30f, npc.Center); + + if (npc.ai[1] == 60f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[2] = (float)Main.rand.Next(3); + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + } + + // Spawn head and hands + if (npc.ai[0] == -1f) + { + npc.dontTakeDamage = true; + + npc.ai[1] += 1f; + if (npc.ai[1] == 30f) + Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); + + if (npc.ai[1] < 60f) + MoonlordDeathDrama.RequestLight(npc.ai[1] / 30f, npc.Center); + + if (npc.ai[1] == 60f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[2] = (float)Main.rand.Next(3); + npc.ai[2] = 0f; + + npc.netUpdate = true; + int[] array5 = new int[3]; + int num1155 = 0; + int num; + + for (int num1156 = 0; num1156 < 2; num1156 = num + 1) + { + int num1157 = NPC.NewNPC((int)npc.Center.X + num1156 * 800 - 400, (int)npc.Center.Y - 100, NPCID.MoonLordHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num1157].ai[2] = (float)num1156; + Main.npc[num1157].netUpdate = true; + int[] arg_381A6_0 = array5; + num = num1155; + num1155 = num + 1; + arg_381A6_0[num] = num1157; + num = num1156; + } + + int num1158 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 400, NPCID.MoonLordHead, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num1158].netUpdate = true; + int[] arg_3823F_0 = array5; + num = num1155; + num1155 = num + 1; + arg_3823F_0[num] = num1158; + + for (int num1159 = 0; num1159 < 3; num1159 = num + 1) + { + Main.npc[array5[num1159]].ai[3] = (float)npc.whoAmI; + num = num1159; + } + for (int num1160 = 0; num1160 < 3; num1160 = num + 1) + { + npc.localAI[num1160] = (float)array5[num1160]; + num = num1160; + } + } + } + } + + // Fly near target, don't take damage + if (npc.ai[0] == 0f) + { + npc.dontTakeDamage = true; + npc.TargetClosest(false); + + Vector2 value4 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); + if (value4.Length() > 20f) + { + float velocity = CalamityWorld.bossRushActive ? 14f : 10f; + Vector2 desiredVelocity = Vector2.Normalize(value4 - npc.velocity) * velocity; + Vector2 velocity2 = npc.velocity; + npc.SimpleFlyMovement(desiredVelocity, 0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, velocity2, 0.5f); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Despawn if other parts aren't there + bool flag84 = false; + if (npc.localAI[0] < 0f || npc.localAI[1] < 0f || npc.localAI[2] < 0f) + flag84 = true; + else if (!Main.npc[(int)npc.localAI[0]].active || Main.npc[(int)npc.localAI[0]].type != NPCID.MoonLordHand) + flag84 = true; + else if (!Main.npc[(int)npc.localAI[1]].active || Main.npc[(int)npc.localAI[1]].type != NPCID.MoonLordHand) + flag84 = true; + else if (!Main.npc[(int)npc.localAI[2]].active || Main.npc[(int)npc.localAI[2]].type != NPCID.MoonLordHead) + flag84 = true; + + if (flag84) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + + // Take damage if other parts are down + bool flag85 = true; + if (Main.npc[(int)npc.localAI[0]].Calamity().newAI[0] != 1f) + flag85 = false; + if (Main.npc[(int)npc.localAI[1]].Calamity().newAI[0] != 1f) + flag85 = false; + if (Main.npc[(int)npc.localAI[2]].Calamity().newAI[0] != 1f) + flag85 = false; + + if (flag85) + { + npc.ai[0] = 1f; + npc.dontTakeDamage = false; + npc.netUpdate = true; + } + } + } + + // Fly near target, take damage + else if (npc.ai[0] == 1f) + { + npc.dontTakeDamage = false; + npc.TargetClosest(false); + + Vector2 value5 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); + if (value5.Length() > 20f) + { + float velocity = CalamityWorld.bossRushActive ? 14f : 10f; + Vector2 desiredVelocity2 = Vector2.Normalize(value5 - npc.velocity) * velocity; + Vector2 velocity3 = npc.velocity; + npc.SimpleFlyMovement(desiredVelocity2, 0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, velocity3, 0.5f); + } + } + + // Death effects + else if (npc.ai[0] == 2f) + { + npc.dontTakeDamage = true; + Vector2 value6 = new Vector2((float)npc.direction, -0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, value6, 0.98f); + + npc.ai[1] += 1f; + float ai1 = npc.ai[1]; + if (npc.ai[1] < 60f) + MoonlordDeathDrama.RequestLight(npc.ai[1] / 60f, npc.Center); + + if (npc.ai[1] == 60f) + { + for (int num1161 = 0; num1161 < 1000; num1161++) + { + Projectile projectile = Main.projectile[num1161]; + if (projectile.active && (projectile.type == ProjectileID.MoonLeech || projectile.type == ProjectileID.PhantasmalBolt || + projectile.type == ProjectileID.PhantasmalDeathray || projectile.type == ProjectileID.PhantasmalEye || + projectile.type == ProjectileID.PhantasmalSphere)) + projectile.Kill(); + } + } + + if (npc.ai[1] % 3f == 0f && npc.ai[1] < 580f && npc.ai[1] > 60f) + { + Vector2 vector158 = Utils.RandomVector2(Main.rand, -1f, 1f); + if (vector158 != Vector2.Zero) + vector158.Normalize(); + + vector158 *= 20f + Main.rand.NextFloat() * 400f; + Vector2 vector159 = npc.Center + vector158; + Point point5 = vector159.ToTileCoordinates(); + + bool flag86 = true; + if (!WorldGen.InWorld(point5.X, point5.Y, 0)) + flag86 = false; + if (flag86 && WorldGen.SolidTile(point5.X, point5.Y)) + flag86 = false; + + float num1163 = (float)Main.rand.Next(6, 19); + float num1164 = 6.28318548f / num1163; + float num1165 = 6.28318548f * Main.rand.NextFloat(); + float scaleFactor8 = 1f + Main.rand.NextFloat() * 2f; + float num1166 = 1f + Main.rand.NextFloat(); + float fadeIn = 0.4f + Main.rand.NextFloat(); + int num1167 = Utils.SelectRandom(Main.rand, new int[] + { + 31, + 229 + }); + + if (flag86) + { + MoonlordDeathDrama.AddExplosion(vector159); + for (float num1168 = 0f; num1168 < num1163 * 2f; num1168 = ai1 + 1f) + { + Dust dust2 = Main.dust[Dust.NewDust(vector159, 0, 0, 229, 0f, 0f, 0, default, 1f)]; + dust2.noGravity = true; + dust2.position = vector159; + dust2.velocity = Vector2.UnitY.RotatedBy((double)(num1165 + num1164 * num1168), default) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); + dust2.fadeIn = fadeIn; + dust2.scale = num1166; + ai1 = num1168; + } + } + + for (float num1169 = 0f; num1169 < npc.ai[1] / 60f; num1169 = ai1 + 1f) + { + Vector2 vector160 = Utils.RandomVector2(Main.rand, -1f, 1f); + if (vector160 != Vector2.Zero) + vector160.Normalize(); + + vector160 *= 20f + Main.rand.NextFloat() * 800f; + Vector2 vector161 = npc.Center + vector160; + Point point6 = vector161.ToTileCoordinates(); + + bool flag87 = true; + if (!WorldGen.InWorld(point6.X, point6.Y, 0)) + flag87 = false; + if (flag87 && WorldGen.SolidTile(point6.X, point6.Y)) + flag87 = false; + + if (flag87) + { + Dust dust3 = Main.dust[Dust.NewDust(vector161, 0, 0, num1167, 0f, 0f, 0, default, 1f)]; + dust3.noGravity = true; + dust3.position = vector161; + dust3.velocity = -Vector2.UnitY * scaleFactor8 * (Main.rand.NextFloat() * 0.9f + 1.6f); + dust3.fadeIn = fadeIn; + dust3.scale = num1166; + } + + ai1 = num1169; + } + } + + if (npc.ai[1] % 15f == 0f && npc.ai[1] < 480f && npc.ai[1] >= 90f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector162 = Utils.RandomVector2(Main.rand, -1f, 1f); + if (vector162 != Vector2.Zero) + vector162.Normalize(); + + vector162 *= 20f + Main.rand.NextFloat() * 400f; + bool flag88 = true; + Vector2 vector163 = npc.Center + vector162; + Point point7 = vector163.ToTileCoordinates(); + + if (!WorldGen.InWorld(point7.X, point7.Y, 0)) + flag88 = false; + if (flag88 && WorldGen.SolidTile(point7.X, point7.Y)) + flag88 = false; + + if (flag88) + { + float num1170 = (float)(Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + 0.7853982f * Main.rand.NextFloat()); + Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy((double)num1170, default) * 6f; + Projectile.NewProjectile(vector163.X, vector163.Y, vector164.X, vector164.Y, ProjectileID.BlowupSmokeMoonlord, 0, 0f, Main.myPlayer, 0f, 0f); + } + } + + if (npc.ai[1] == 1f) + Main.PlaySound(SoundID.NPCDeath61, npc.Center); + + if (npc.ai[1] >= 480f) + MoonlordDeathDrama.RequestLight((npc.ai[1] - 480f) / 120f, npc.Center); + + if (npc.ai[1] >= 600f) + { + npc.life = 0; + npc.HitEffect(0, 1337.0); + npc.checkDead(); + return false; + } + } + + // Despawn effects + else if (npc.ai[0] == 3f) + { + npc.dontTakeDamage = true; + Vector2 value7 = new Vector2((float)npc.direction, -0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, value7, 0.98f); + + npc.ai[1] += 1f; + if (npc.ai[1] < 60f) + MoonlordDeathDrama.RequestLight(npc.ai[1] / 40f, npc.Center); + + if (npc.ai[1] == 40f) + { + for (int num1171 = 0; num1171 < 1000; num1171++) + { + Projectile projectile2 = Main.projectile[num1171]; + if (projectile2.active && (projectile2.type == ProjectileID.MoonLeech || projectile2.type == ProjectileID.PhantasmalBolt || + projectile2.type == ProjectileID.PhantasmalDeathray || projectile2.type == ProjectileID.PhantasmalEye || + projectile2.type == ProjectileID.PhantasmalSphere)) + { + projectile2.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(27, -1, -1, null, num1171, 0f, 0f, 0f, 0, 0, 0); + } + } + for (int num1173 = 0; num1173 < 500; num1173++) + { + Gore gore2 = Main.gore[num1173]; + if (gore2.active && gore2.type >= 619 && gore2.type <= 622) + gore2.active = false; + } + } + + if (npc.ai[1] >= 60f) + { + for (int num1174 = 0; num1174 < 200; num1174++) + { + NPC nPC5 = Main.npc[num1174]; + if (nPC5.active && (nPC5.type == NPCID.MoonLordHand || nPC5.type == NPCID.MoonLordHead)) + { + nPC5.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(23, -1, -1, null, nPC5.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + + NPC.LunarApocalypseIsUp = false; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + + return false; + } + } + + // Despawn + bool flag89 = false; + if (npc.ai[0] == -2f || npc.ai[0] == -1f || npc.ai[0] == -2f || npc.ai[0] == 3f) + flag89 = true; + if (Main.player[npc.target].active && !Main.player[npc.target].dead) + flag89 = true; + + if (!flag89) + { + for (int num1175 = 0; num1175 < 255; num1175++) + { + if (Main.player[num1175].active && !Main.player[num1175].dead) + { + flag89 = true; + break; + } + } + } + if (!flag89) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + // Teleport + if (npc.ai[0] >= 0f && npc.ai[0] < 2f && Main.netMode != NetmodeID.MultiplayerClient && npc.Distance(Main.player[npc.target].Center) > 1800f) + { + npc.ai[0] = -2f; + npc.netUpdate = true; + Vector2 value8 = Main.player[npc.target].Center - Vector2.UnitY * 150f - npc.Center; + npc.position += value8; + + if (Main.npc[(int)npc.localAI[0]].active) + { + NPC nPC6 = Main.npc[(int)npc.localAI[0]]; + nPC6.position += value8; + Main.npc[(int)npc.localAI[0]].netUpdate = true; + } + if (Main.npc[(int)npc.localAI[1]].active) + { + NPC nPC6 = Main.npc[(int)npc.localAI[1]]; + nPC6.position += value8; + Main.npc[(int)npc.localAI[1]].netUpdate = true; + } + if (Main.npc[(int)npc.localAI[2]].active) + { + NPC nPC6 = Main.npc[(int)npc.localAI[2]]; + nPC6.position += value8; + Main.npc[(int)npc.localAI[2]].netUpdate = true; + } + } + } + else if (npc.type == NPCID.MoonLordHead) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Despawn + if (!Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.MoonLordCore) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + + // Variables + npc.dontTakeDamage = (npc.localAI[3] >= 15f); + if (calamityGlobalNPC.newAI[0] == 1f) + npc.dontTakeDamage = true; + + npc.velocity = Vector2.Zero; + npc.Center = Main.npc[(int)npc.ai[3]].Center + new Vector2(0f, -400f); + Vector2 value19 = new Vector2(27f, 59f); + float num1207 = 0f; + float num1208 = 0f; + int num1209 = 0; + int num1210 = 0; + + // Invulnerable + if (npc.ai[0] >= 0f || npc.ai[0] == -2f) + { + if (npc.ai[0] == -2f) + { + if (calamityGlobalNPC.newAI[0] != 1f) + calamityGlobalNPC.newAI[0] = 1f; + + npc.life = npc.lifeMax; + npc.netUpdate = true; + npc.dontTakeDamage = true; + } + + // Go to die + if (Main.npc[(int)npc.ai[3]].ai[0] == 2f) + { + npc.ai[0] = -3f; + return false; + } + + // Set up attacks + float num1211 = npc.ai[0]; + npc.ai[1] += 1f; + int num1212 = (int)Main.npc[(int)npc.ai[3]].ai[2]; + int num1213 = 2; + int num1214 = 0; + int num1215 = 0; + + while (num1214 < 5) + { + num1208 = (float)NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; + if (num1208 + (float)num1215 > npc.ai[1]) + break; + + num1215 += (int)num1208; + int num = num1214; + num1214 = num + 1; + } + + if (num1214 == 5) + { + num1214 = 0; + npc.ai[1] = 0f; + num1208 = (float)NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; + num1215 = 0; + } + + npc.ai[0] = (float)NPC.MoonLordAttacksArray[num1212, num1213, 0, num1214]; + num1207 = (float)((int)npc.ai[1] - num1215); + + if (npc.ai[0] != num1211) + npc.netUpdate = true; + } + + // Die + if (npc.ai[0] == -3f) + { + npc.dontTakeDamage = true; + npc.rotation = MathHelper.Lerp(npc.rotation, 0.2617994f, 0.07f); + + npc.ai[1] += 1f; + if (npc.ai[1] >= 32f) + npc.ai[1] = 0f; + if (npc.ai[1] < 0f) + npc.ai[1] = 0f; + + if (npc.localAI[2] < 14f) + npc.localAI[2] += 1f; + } + + // Set variables for deathray + else if (npc.ai[0] == 0f) + { + num1210 = 3; + npc.TargetClosest(false); + + Vector2 v3 = Main.player[npc.target].Center - npc.Center - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + num1219 = 1f; + + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + num1219 = 1f; + + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); + } + + // Deathray + if (npc.ai[0] == 1f) + { + if (num1207 < 180f) + { + npc.localAI[1] -= 0.05f; + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + + if (num1207 >= 60f) + { + Vector2 center20 = npc.Center; + + int num1220 = 0; + if (num1207 >= 120f) + num1220 = 1; + + for (int num1221 = 0; num1221 < 1 + num1220; num1221++) + { + int num1222 = 229; + float num1223 = 0.8f; + if (num1221 % 2 == 1) + { + num1222 = 229; + num1223 = 1.65f; + } + + Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; + int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + Main.dust[num1224].velocity = Vector2.Normalize(center20 - vector199) * 3.5f * (10f - (float)num1220 * 2f) / 10f; + Main.dust[num1224].noGravity = true; + Main.dust[num1224].scale = num1223; + Main.dust[num1224].customData = npc; + } + } + } + else if (num1207 < num1208 - 15f) + { + float rotation = CalamityWorld.bossRushActive ? 510f : 540f; + if (calamityGlobalNPC.newAI[0] == 1f) + rotation -= 60f; + + if (num1207 == 180f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(false); + Vector2 vector200 = Main.player[npc.target].Center - npc.Center; + vector200.Normalize(); + + float num1225 = -1f; + if (vector200.X < 0f) + num1225 = 1f; + + vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, ProjectileID.PhantasmalDeathray, 75, 0f, Main.myPlayer, num1225 * 6.28318548f / rotation, (float)npc.whoAmI); + npc.ai[2] = (vector200.ToRotation() + 9.424778f) * num1225; + npc.netUpdate = true; + } + + npc.localAI[1] += 0.05f; + if (npc.localAI[1] > 1f) + npc.localAI[1] = 1f; + + float num1226 = (float)(npc.ai[2] >= 0f).ToDirectionInt(); + float num1227 = npc.ai[2]; + if (num1227 < 0f) + num1227 *= -1f; + + num1227 += -9.424778f; + num1227 += num1226 * 6.28318548f / rotation; + npc.localAI[0] = num1227; + npc.ai[2] = (num1227 + 9.424778f) * num1226; + } + else + { + npc.localAI[1] -= 0.07f; + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + + num1210 = 3; + } + } + + // Moon Leech thing + else if (npc.ai[0] == 2f) + { + num1209 = 2; + num1210 = 3; + Vector2 value21 = new Vector2(0f, 216f); + + if (num1207 == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector201 = npc.Center + value21; + for (int num1228 = 0; num1228 < 255; num1228++) + { + Player player6 = Main.player[num1228]; + if (player6.active && !player6.dead && Vector2.Distance(player6.Center, vector201) <= 3000f) + { + Vector2 vector202 = Main.player[npc.target].Center - vector201; + if (vector202 != Vector2.Zero) + vector202.Normalize(); + + Projectile.NewProjectile(vector201.X, vector201.Y, vector202.X, vector202.Y, ProjectileID.MoonLeech, 0, 0f, Main.myPlayer, (float)(npc.whoAmI + 1), (float)num1228); + } + } + } + + if ((num1207 == 120f || num1207 == 180f || num1207 == 240f) && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int num1229 = 0; num1229 < 1000; num1229++) + { + Projectile projectile6 = Main.projectile[num1229]; + if (projectile6.active && projectile6.type == ProjectileID.MoonLeech && Main.player[(int)projectile6.ai[1]].FindBuffIndex(145) != -1) + { + Vector2 center21 = Main.player[npc.target].Center; + int num1230 = NPC.NewNPC((int)center21.X, (int)center21.Y, NPCID.MoonLordLeechBlob, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1230].netUpdate = true; + Main.npc[num1230].ai[0] = (float)(npc.whoAmI + 1); + Main.npc[num1230].ai[1] = (float)num1229; + } + } + } + } + + // Phantasmal Bolts + else if (npc.ai[0] == 3f) + { + if (num1207 == 0f) + { + npc.TargetClosest(false); + npc.netUpdate = true; + } + + Vector2 v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; + npc.localAI[0] = npc.localAI[0].AngleLerp(v4.ToRotation(), 0.5f); + npc.localAI[1] += 0.05f; + if (npc.localAI[1] > 1f) + npc.localAI[1] = 1f; + + if (num1207 == num1208 - 35f) + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); + + if ((num1207 == num1208 - 14f || num1207 == num1208 - 7f || num1207 == num1208) && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector203 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), value19 * npc.localAI[1]); + float velocity = CalamityWorld.bossRushActive ? 12f : 9f; + Vector2 vector204 = Vector2.Normalize(v4) * velocity; + Projectile.NewProjectile(npc.Center.X + vector203.X, npc.Center.Y + vector203.Y, vector204.X, vector204.Y, ProjectileID.PhantasmalBolt, 30, 0f, Main.myPlayer, 0f, 0f); + } + } + + // Dictates whether this npc is vulnerable or not + int num1231 = num1209 * 7; + if ((float)num1231 > npc.localAI[2]) + npc.localAI[2] += 1f; + if ((float)num1231 < npc.localAI[2]) + npc.localAI[2] -= 1f; + if (npc.localAI[2] < 0f) + npc.localAI[2] = 0f; + if (npc.localAI[2] > 14f) + npc.localAI[2] = 14f; + + int num1232 = num1210 * 5; + if ((float)num1232 > npc.localAI[3]) + npc.localAI[3] += 1f; + if ((float)num1232 < npc.localAI[3]) + npc.localAI[3] -= 1f; + if (npc.localAI[3] < 0f) + npc.localAI[2] = 0f; + if (npc.localAI[3] > 15f) + npc.localAI[2] = 15f; + } + else if (npc.type == NPCID.MoonLordHand) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Start attack array + NPC.InitializeMoonLordAttacks(); + + // Despawn + if (!Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.MoonLordCore) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + + // Variables + bool flag90 = npc.ai[2] == 0f; + float num1177 = (float)(-(float)flag90.ToDirectionInt()); + npc.spriteDirection = (int)num1177; + + npc.dontTakeDamage = (npc.frameCounter >= 21.0); + if (calamityGlobalNPC.newAI[0] == 1f) + npc.dontTakeDamage = true; + + Vector2 vector165 = new Vector2(30f, 66f); + float num1178 = 0f; + float num1179 = 0f; + int num1180 = 0; + + // Go to die + if (Main.npc[(int)npc.ai[3]].ai[0] == 2f) + npc.ai[0] = -2f; + + // Choose attacks + if (npc.ai[0] != -2f || (npc.ai[0] == -2f && Main.npc[(int)npc.ai[3]].ai[0] != 2f)) + { + if (npc.ai[0] == -2f && Main.npc[(int)npc.ai[3]].ai[0] != 2f) + { + if (calamityGlobalNPC.newAI[0] != 1f) + calamityGlobalNPC.newAI[0] = 1f; + + npc.life = npc.lifeMax; + npc.netUpdate = true; + npc.dontTakeDamage = true; + } + + float num1181 = npc.ai[0]; + npc.ai[1] += 1f; + int num1182 = (int)Main.npc[(int)npc.ai[3]].ai[2]; + int num1183 = flag90 ? 0 : 1; + int num1184 = 0; + int num1185 = 0; + + while (num1184 < 5) + { + num1179 = (float)NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; + if (num1179 + (float)num1185 > npc.ai[1]) + break; + + num1185 += (int)num1179; + int num = num1184; + num1184 = num + 1; + } + + if (num1184 == 5) + { + num1184 = 0; + npc.ai[1] = 0f; + num1179 = (float)NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; + num1185 = 0; + } + + npc.ai[0] = (float)NPC.MoonLordAttacksArray[num1182, num1183, 0, num1184]; + num1178 = (float)((int)npc.ai[1] - num1185); + if (npc.ai[0] != num1181) + npc.netUpdate = true; + } + + if (npc.ai[0] == -2f) + { + num1180 = 0; + + npc.dontTakeDamage = true; + + npc.velocity = Main.npc[(int)npc.ai[3]].velocity; + } + + // Move + else if (npc.ai[0] == 0f) + { + num1180 = 3; + npc.localAI[1] -= 0.05f; + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + + Vector2 center15 = Main.npc[(int)npc.ai[3]].Center; + Vector2 value10 = center15 + new Vector2(350f * num1177, -100f); + Vector2 vector167 = value10 - npc.Center; + + if (vector167.Length() > 20f) + { + vector167.Normalize(); + float velocity = CalamityWorld.bossRushActive ? 10.5f : 7.5f; + vector167 *= velocity; + Vector2 velocity5 = npc.velocity; + + if (vector167 != Vector2.Zero) + npc.SimpleFlyMovement(vector167, 0.3f); + + npc.velocity = Vector2.Lerp(velocity5, npc.velocity, 0.5f); + } + } + + // Phantasmal Eyes + else if (npc.ai[0] == 1f) + { + num1180 = 0; + int num1186 = 7; + int num1187 = 4; + + if (num1178 >= (float)(num1186 * num1187 * 2)) + { + npc.localAI[1] -= 0.07f; + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + } + else if (num1178 >= (float)(num1186 * num1187)) + { + npc.localAI[1] += 0.05f; + if (npc.localAI[1] > 0.75f) + npc.localAI[1] = 0.75f; + + float num1188 = 6.28318548f * (num1178 % (float)(num1186 * num1187)) / (float)(num1186 * num1187) - 1.57079637f; + npc.localAI[0] = new Vector2((float)Math.Cos((double)num1188) * vector165.X, (float)Math.Sin((double)num1188) * vector165.Y).ToRotation(); + + if (num1178 % (float)num1187 == 0f) + { + Vector2 value11 = new Vector2(1f * -num1177, 3f); + Vector2 vector168 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); + Vector2 vector169 = npc.Center + Vector2.Normalize(vector168) * vector165.Length() * 0.4f + value11; + float velocity = CalamityWorld.bossRushActive ? 12f : 9f; + Vector2 vector170 = Vector2.Normalize(vector168) * velocity; + float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1177; + Projectile.NewProjectile(vector169.X, vector169.Y, vector170.X, vector170.Y, ProjectileID.PhantasmalEye, 30, 0f, Main.myPlayer, 0f, ai); + } + } + else + { + npc.localAI[1] += 0.02f; + if (npc.localAI[1] > 0.75f) + npc.localAI[1] = 0.75f; + + float num1189 = 6.28318548f * (num1178 % (float)(num1186 * num1187)) / (float)(num1186 * num1187) - 1.57079637f; + npc.localAI[0] = new Vector2((float)Math.Cos((double)num1189) * vector165.X, (float)Math.Sin((double)num1189) * vector165.Y).ToRotation(); + } + } + + // Phantasmal Spheres + else if (npc.ai[0] == 2f) + { + npc.localAI[1] -= 0.05f; + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + + Vector2 center16 = Main.npc[(int)npc.ai[3]].Center; + Vector2 value12 = new Vector2(220f * num1177, -60f) + center16; + value12 += new Vector2(num1177 * 100f, -50f); + Vector2 value13 = new Vector2(400f * num1177, -60f); + + float velocityMultiplier = CalamityWorld.bossRushActive ? 0.87f : 0.885f; + if (num1178 < 30f) + { + Vector2 vector171 = value12 - npc.Center; + if (vector171 != Vector2.Zero) + { + Vector2 vector172 = vector171; + vector172.Normalize(); + float velocity = CalamityWorld.bossRushActive ? 14f : 10f; + npc.velocity = Vector2.SmoothStep(npc.velocity, vector172 * Math.Min(velocity, vector171.Length()), 0.2f); + } + } + else if (num1178 < 210f) + { + num1180 = 1; + int num1190 = (int)num1178 - 30; + + if (num1190 % 30 == 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector173 = new Vector2(5f * num1177, -8f); + int num1191 = num1190 / 30; + vector173.X += ((float)num1191 - 3.5f) * num1177 * 3f; + vector173.Y += ((float)num1191 - 4.5f) * 1f; + vector173 *= 1.2f; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector173.X, vector173.Y, ProjectileID.PhantasmalSphere, 50, 1f, Main.myPlayer, 0f, (float)npc.whoAmI); + } + + Vector2 vector174 = Vector2.SmoothStep(value12, value12 + value13, (num1178 - 30f) / 180f) - npc.Center; + if (vector174 != Vector2.Zero) + { + Vector2 vector175 = vector174; + vector175.Normalize(); + float velocity = CalamityWorld.bossRushActive ? 35f : 25f; + npc.velocity = Vector2.Lerp(npc.velocity, vector175 * Math.Min(velocity, vector174.Length()), 0.5f); + } + } + else if (num1178 < 282f) + { + num1180 = 0; + npc.velocity *= velocityMultiplier; + } + else if (num1178 < 287f) + { + num1180 = 1; + npc.velocity *= velocityMultiplier; + } + else if (num1178 < 292f) + { + num1180 = 2; + npc.velocity *= velocityMultiplier; + } + else if (num1178 < 300f) + { + num1180 = 3; + + if (num1178 == 292f && Main.netMode != NetmodeID.MultiplayerClient) + { + int num1193 = (int)Player.FindClosest(npc.position, npc.width, npc.height); + Vector2 vector176 = Vector2.Normalize(Main.player[num1193].Center - (npc.Center + Vector2.UnitY * -350f)); + if (float.IsNaN(vector176.X) || float.IsNaN(vector176.Y)) + vector176 = Vector2.UnitY; + + float velocity = CalamityWorld.bossRushActive ? 18f : 14f; + vector176 *= velocity; + for (int num1194 = 0; num1194 < 1000; num1194++) + { + Projectile projectile3 = Main.projectile[num1194]; + if (projectile3.active && projectile3.type == ProjectileID.PhantasmalSphere && projectile3.ai[1] == (float)npc.whoAmI && projectile3.ai[0] != -1f) + { + projectile3.ai[0] = -1f; + projectile3.velocity = vector176; + projectile3.netUpdate = true; + } + } + } + + Vector2 vector177 = Vector2.SmoothStep(value12, value12 + value13, 1f - (num1178 - 270f) / 30f) - npc.Center; + if (vector177 != Vector2.Zero) + { + Vector2 vector178 = vector177; + vector178.Normalize(); + float velocity = CalamityWorld.bossRushActive ? 24.5f : 17.5f; + npc.velocity = Vector2.Lerp(npc.velocity, vector178 * Math.Min(velocity, vector177.Length()), 0.1f); + } + } + else + { + num1180 = 3; + + Vector2 vector179 = value12 - npc.Center; + if (vector179 != Vector2.Zero) + { + Vector2 vector180 = vector179; + vector180.Normalize(); + float velocity = CalamityWorld.bossRushActive ? 14f : 10f; + npc.velocity = Vector2.SmoothStep(npc.velocity, vector180 * Math.Min(velocity, vector179.Length()), 0.2f); + } + } + } + + // Phantasmal Bolts + else if (npc.ai[0] == 3f) + { + if (num1178 == 0f) + { + npc.TargetClosest(false); + npc.netUpdate = true; + } + + Vector2 v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; + npc.localAI[0] = npc.localAI[0].AngleLerp(v.ToRotation(), 0.5f); + + npc.localAI[1] += 0.05f; + if (npc.localAI[1] > 1f) + npc.localAI[1] = 1f; + + if (num1178 == num1179 - 35f) + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); + + if ((num1178 == num1179 - 14f || num1178 == num1179 - 7f || num1178 == num1179) && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector181 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); + float velocity = CalamityWorld.bossRushActive ? 12f : 9f; + Vector2 vector182 = Vector2.Normalize(v) * velocity; + Projectile.NewProjectile(npc.Center.X + vector181.X, npc.Center.Y + vector181.Y, vector182.X, vector182.Y, ProjectileID.PhantasmalBolt, 30, 0f, Main.myPlayer, 0f, 0f); + } + } + + // Center + Vector2 center17 = Main.npc[(int)npc.ai[3]].Center; + Vector2 value14 = new Vector2(220f * num1177, -60f) + center17; + Vector2 vector183 = value14 + new Vector2(num1177 * 110f, -150f); + Vector2 vector184 = vector183 + new Vector2(num1177 * 370f, 150f); + + if (vector183.X > vector184.X) + Utils.Swap(ref vector183.X, ref vector184.X); + if (vector183.Y > vector184.Y) + Utils.Swap(ref vector183.Y, ref vector184.Y); + + Vector2 value15 = Vector2.Clamp(npc.Center + npc.velocity, vector183, vector184); + if (value15 != npc.Center + npc.velocity) + npc.Center = value15 - npc.velocity; + + // Frames + int num1195 = num1180 * 7; + if ((double)num1195 > npc.frameCounter) + { + double num1196 = npc.frameCounter; + npc.frameCounter = num1196 + 1.0; + } + if ((double)num1195 < npc.frameCounter) + { + double num1196 = npc.frameCounter; + npc.frameCounter = num1196 - 1.0; + } + + if (npc.frameCounter < 0.0) + npc.frameCounter = 0.0; + if (npc.frameCounter > 21.0) + npc.frameCounter = 21.0; + } + else if (npc.type == NPCID.MoonLordLeechBlob) + { + // Variables + float num1265 = 75f; + Vector2 value28 = new Vector2(0f, 216f); + int num1266 = (int)Math.Abs(npc.ai[0]) - 1; + int num1267 = (int)npc.ai[1]; + + // Despawn + if (!Main.npc[num1266].active || Main.npc[num1266].type != NPCID.MoonLordHead) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + return false; + } + + // Heal the Moon Lord + npc.ai[2] += 1f; + if (npc.ai[2] >= num1265) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num1268 = (int)Main.npc[num1266].ai[3]; + int num1269 = -1; + int num1270 = -1; + int num1271 = num1266; + + for (int num1272 = 0; num1272 < 200; num1272++) + { + if (Main.npc[num1272].active && Main.npc[num1272].ai[3] == (float)num1268) + { + if (num1269 == -1 && Main.npc[num1272].type == NPCID.MoonLordHand && Main.npc[num1272].ai[2] == 0f) + num1269 = num1272; + if (num1270 == -1 && Main.npc[num1272].type == NPCID.MoonLordHand && Main.npc[num1272].ai[2] == 1f) + num1270 = num1272; + if (num1269 != -1 && num1270 != -1 && num1271 != -1) + break; + } + } + + // Heal limits + int num1273 = CalamityWorld.death ? 1500 : 1250; + if (CalamityWorld.bossRushActive) + num1273 *= 10; + + int num1274 = Main.npc[num1268].lifeMax - Main.npc[num1268].life; + int num1275 = Main.npc[num1269].lifeMax - Main.npc[num1269].life; + int num1276 = Main.npc[num1270].lifeMax - Main.npc[num1270].life; + int num1277 = Main.npc[num1271].lifeMax - Main.npc[num1271].life; + + // Healing + if (num1277 > 0 && num1273 > 0) + { + int num1278 = num1277 - num1273; + if (num1278 > 0) + { + num1278 = 0; + } + int num1279 = num1273 + num1278; + num1273 -= num1279; + NPC nPC6 = Main.npc[num1271]; + nPC6.life += num1279; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1271].Center, new Vector2(50f)), num1279, true); + } + if (num1274 > 0 && num1273 > 0) + { + int num1280 = num1274 - num1273; + if (num1280 > 0) + { + num1280 = 0; + } + int num1281 = num1273 + num1280; + num1273 -= num1281; + NPC nPC6 = Main.npc[num1268]; + nPC6.life += num1281; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1268].Center, new Vector2(50f)), num1281, true); + } + if (num1275 > 0 && num1273 > 0) + { + int num1282 = num1275 - num1273; + if (num1282 > 0) + { + num1282 = 0; + } + int num1283 = num1273 + num1282; + num1273 -= num1283; + NPC nPC6 = Main.npc[num1269]; + nPC6.life += num1283; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1269].Center, new Vector2(50f)), num1283, true); + } + if (num1276 > 0 && num1273 > 0) + { + int num1284 = num1276 - num1273; + if (num1284 > 0) + { + num1284 = 0; + } + int num1285 = num1273 + num1284; + num1273 -= num1285; + NPC nPC6 = Main.npc[num1270]; + nPC6.life += num1285; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1270].Center, new Vector2(50f)), num1285, true); + } + } + + // Die + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + return false; + } + + // Move towards the Moon Lord mouth + npc.velocity = Vector2.Zero; + npc.Center = Vector2.Lerp(Main.projectile[num1267].Center, Main.npc[(int)Math.Abs(npc.ai[0]) - 1].Center + value28, npc.ai[2] / num1265); + + // Emit dust + Vector2 spinningpoint3 = Vector2.UnitY * (float)(-(float)npc.height) / 2f; + for (int num1286 = 0; num1286 < 6; num1286++) + { + int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1286 * 6.28318548f / 6f), default), 0, 0, 229, 0f, 0f, 0, default, 1f); + Main.dust[num1287].velocity = -Vector2.UnitY; + Main.dust[num1287].noGravity = true; + Main.dust[num1287].scale = 0.7f; + Main.dust[num1287].customData = npc; + } + + spinningpoint3 = Vector2.UnitY * (float)(-(float)npc.height) / 6f; + for (int num1288 = 0; num1288 < 3; num1288++) + { + int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy((double)((float)num1288 * 6.28318548f / 6f), default), 0, 0, 229, 0f, -2f, 0, default, 1f); + Main.dust[num1289].noGravity = true; + Main.dust[num1289].scale = 1.5f; + Main.dust[num1289].customData = npc; + } + } + return false; + } + #endregion + + #region Buffed Mothron AI + public static bool BuffedMothronAI(NPC npc) + { + npc.noTileCollide = false; + npc.noGravity = true; + npc.knockBackResist = 0f; + npc.damage = npc.defDamage; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.4f; + bool phase3 = lifeRatio < 0.1f; + + if (!Main.eclipse) + npc.ai[0] = -1f; + else if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + npc.ai[0] = -1f; + } + + if (npc.ai[0] == -1f) + { + Vector2 value37 = new Vector2(0f, -8f); + npc.velocity = (npc.velocity * 22f + value37) / 10f; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + return false; + } + + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + + if (npc.Center.X < Main.player[npc.target].Center.X - 2f) + npc.direction = 1; + if (npc.Center.X > Main.player[npc.target].Center.X + 2f) + npc.direction = -1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + + if (npc.collideX) + { + npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); + + if (npc.velocity.X > 4f) + npc.velocity.X = 4f; + if (npc.velocity.X < -4f) + npc.velocity.X = -4f; + } + if (npc.collideY) + { + npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); + + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + + Vector2 value38 = Main.player[npc.target].Center - npc.Center; + value38.Y -= 200f; + if (value38.Length() > 3000f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (value38.Length() > 600f) + { + float scaleFactor15 = 15f; + float num1354 = 30f; + value38.Normalize(); + value38 *= scaleFactor15; + npc.velocity = (npc.velocity * (num1354 - 1f) + value38) / num1354; + } + else if (npc.velocity.Length() > 2f) + npc.velocity *= 0.95f; + else if (npc.velocity.Length() < 1f) + npc.velocity *= 1.05f; + + npc.ai[1] += 1f; + + if (npc.ai[1] >= 10f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + + while (npc.ai[0] == 0f) + { + int num1355 = Main.rand.Next(3); + if (phase3) + num1355 = 1; + else if (phase2) + num1355 = Main.rand.Next(2); + + if (num1355 == 0 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + npc.ai[0] = 2f; + else if (num1355 == 1) + npc.ai[0] = 3f; + else if (num1355 == 2 && NPC.CountNPCS(478) + NPC.CountNPCS(479) < 2) + npc.ai[0] = 4f; + } + } + } + else + { + if (npc.ai[0] == 1f) + { + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + + if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) + npc.TargetClosest(true); + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.02f) / 10f; + + Vector2 value39 = Main.player[npc.target].Center - npc.Center; + if (value39.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + float scaleFactor16 = 18f + value39.Length() / 100f; + float num1356 = 25f; + value39.Normalize(); + value39 *= scaleFactor16; + npc.velocity = (npc.velocity * (num1356 - 1f) + value39) / num1356; + return false; + } + + if (npc.ai[0] == 2f) + { + if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + if (Main.player[npc.target].Center.X - 10f < npc.Center.X) + npc.direction = -1; + else if (Main.player[npc.target].Center.X + 10f > npc.Center.X) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.025f) / 5f; + + if (npc.collideX) + { + npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); + + if (npc.velocity.X > 4f) + npc.velocity.X = 4f; + if (npc.velocity.X < -4f) + npc.velocity.X = -4f; + } + if (npc.collideY) + { + npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); + + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + + Vector2 value40 = Main.player[npc.target].Center - npc.Center; + value40.Y -= 20f; + + npc.ai[2] += 0.0222222228f; + if (Main.expertMode) + npc.ai[2] += 0.0166666675f; + + float scaleFactor17 = 12f + npc.ai[2] + value40.Length() / 120f; + float num1357 = 20f; + value40.Normalize(); + value40 *= scaleFactor17; + npc.velocity = (npc.velocity * (num1357 - 1f) + value40) / num1357; + + npc.ai[1] += 1f; + if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else + { + if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; + + Vector2 value41 = Main.player[npc.target].Center - npc.Center; + value41.Y -= 12f; + if (npc.Center.X > Main.player[npc.target].Center.X) + value41.X += 600f; + else + value41.X -= 600f; + + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 550f && Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) < 20f) + { + npc.ai[0] = 3.1f; + npc.ai[1] = 0f; + } + + npc.ai[1] += 0.0333333351f; + float scaleFactor18 = 24f + npc.ai[1]; + float num1358 = 4f; + value41.Normalize(); + value41 *= scaleFactor18; + npc.velocity = (npc.velocity * (num1358 - 1f) + value41) / num1358; + return false; + } + + if (npc.ai[0] == 3.1f) + { + npc.noTileCollide = true; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; + + Vector2 vector237 = Main.player[npc.target].Center - npc.Center; + vector237.Y -= 12f; + float scaleFactor19 = 32f; + float num1359 = 8f; + vector237.Normalize(); + vector237 *= scaleFactor19; + npc.velocity = (npc.velocity * (num1359 - 1f) + vector237) / num1359; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.velocity = vector237; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.ai[0] = 3.2f; + npc.ai[1] = 0f; + npc.ai[1] = (float)npc.direction; + } + } + else + { + if (npc.ai[0] == 3.2f) + { + npc.damage = (int)((double)npc.defDamage * 1.2); + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + npc.ai[2] += 0.0333333351f; + npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; + + if ((npc.ai[1] > 0f && npc.Center.X > Main.player[npc.target].Center.X + 460f) || (npc.ai[1] < 0f && npc.Center.X < Main.player[npc.target].Center.X - 460f)) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 800f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; + return false; + } + + if (npc.ai[0] == 4f) + { + npc.ai[0] = 0f; + npc.TargetClosest(true); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = -1f; + npc.ai[2] = -1f; + + int num; + for (int num1360 = 0; num1360 < 1000; num1360 = num + 1) + { + int num1361 = (int)Main.player[npc.target].Center.X / 16; + int num1362 = (int)Main.player[npc.target].Center.Y / 16; + int num1363 = 30 + num1360 / 50; + int num1364 = 20 + num1360 / 75; + + num1361 += Main.rand.Next(-num1363, num1363 + 1); + num1362 += Main.rand.Next(-num1364, num1364 + 1); + + if (!WorldGen.SolidTile(num1361, num1362)) + { + while (!WorldGen.SolidTile(num1361, num1362) && (double)num1362 < Main.worldSurface) + num1362++; + + if ((new Vector2((float)(num1361 * 16 + 8), (float)(num1362 * 16 + 8)) - Main.player[npc.target].Center).Length() < 5600f) + { + npc.ai[0] = 4.1f; + npc.ai[1] = (float)num1361; + npc.ai[2] = (float)num1362; + break; + } + } + num = num1360; + } + } + npc.netUpdate = true; + return false; + } + + if (npc.ai[0] == 4.1f) + { + if (npc.velocity.X < -2f) + npc.direction = -1; + else if (npc.velocity.X > 2f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + npc.noTileCollide = true; + + int num1365 = (int)npc.ai[1]; + int num1366 = (int)npc.ai[2]; + float x2 = (float)(num1365 * 16 + 8); + float y2 = (float)(num1366 * 16 - 20); + Vector2 vector238 = new Vector2(x2, y2); + vector238 -= npc.Center; + float num1367 = 12f + vector238.Length() / 150f; + + if (num1367 > 20f) + num1367 = 20f; + + if (vector238.Length() < 10f) + npc.ai[0] = 4.2f; + + vector238.Normalize(); + vector238 *= num1367; + float num1368 = 10f; + npc.velocity = (npc.velocity * (num1368 - 1f) + vector238) / num1368; + return false; + } + + if (npc.ai[0] == 4.2f) + { + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + npc.noTileCollide = true; + + int num1369 = (int)npc.ai[1]; + int num1370 = (int)npc.ai[2]; + float x3 = (float)(num1369 * 16 + 8); + float y3 = (float)(num1370 * 16 - 20); + Vector2 vector239 = new Vector2(x3, y3); + vector239 -= npc.Center; + float num1371 = 4f; + float num1372 = 2f; + + if (Main.netMode != NetmodeID.MultiplayerClient && vector239.Length() < 4f) + { + int num1373 = 20; + if (Main.expertMode) + num1373 = (int)((double)num1373 * 0.75); + + npc.ai[3] += 1f; + + if (npc.ai[3] == (float)num1373) + NPC.NewNPC(num1369 * 16 + 8, num1370 * 16, 478, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + else if (npc.ai[3] == (float)(num1373 * 2)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + if (NPC.CountNPCS(478) + NPC.CountNPCS(479) < 3 && Main.rand.Next(3) != 0) + npc.ai[0] = 4f; + else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.ai[0] = 1f; + } + } + + if (vector239.Length() > num1371) + { + vector239.Normalize(); + vector239 *= num1371; + } + npc.velocity = (npc.velocity * (num1372 - 1f) + vector239) / num1372; + } + } + } + } + return false; + } + #endregion + + #region Buffed Pumpking and Pumpking Blade AI + public static bool BuffedPumpkingAI(NPC npc) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > 6f) + { + npc.localAI[0] = 0f; + npc.localAI[1] += 1f; + + if (npc.localAI[1] > 4f) + npc.localAI[1] = 0f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 300f) + { + npc.ai[3] = (float)Main.rand.Next(3); + npc.localAI[2] = 0f; + } + else if (npc.ai[3] == 0f && npc.localAI[2] % 30f == 0f && npc.localAI[2] > 30f) + { + float num856 = 10f; + Vector2 vector109 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + if (!WorldGen.SolidTile((int)vector109.X / 16, (int)vector109.Y / 16)) + { + float num857 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector109.X; + float num858 = Main.player[npc.target].position.Y - vector109.Y; + num857 += (float)Main.rand.Next(-50, 51); + num858 += (float)Main.rand.Next(50, 201); + num858 *= 0.2f; + float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + num859 = num856 / num859; + num857 *= num859; + num858 *= num859; + num857 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + num858 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, Main.rand.Next(326, 329), 60, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(true); + npc.ai[0] = 1f; + + int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num861].ai[0] = -1f; + Main.npc[num861].ai[1] = (float)npc.whoAmI; + Main.npc[num861].target = npc.target; + Main.npc[num861].netUpdate = true; + + num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num861].ai[0] = 1f; + Main.npc[num861].ai[1] = (float)npc.whoAmI; + Main.npc[num861].ai[3] = 150f; + Main.npc[num861].target = npc.target; + Main.npc[num861].netUpdate = true; + } + + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + { + npc.TargetClosest(true); + + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + npc.ai[1] = 2f; + } + + if (Main.dayTime) + { + npc.velocity.Y += 0.3f; + npc.velocity.X *= 0.9f; + } + else if (npc.ai[1] == 0f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + if (npc.ai[3] != 1f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else + { + npc.ai[2] = 0f; + npc.ai[1] = 1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + + Vector2 vector110 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num862 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector110.X; + float num863 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector110.Y; + float num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863)); + float num865 = 8f; + + if (npc.ai[3] == 1f) + { + if (num864 > 900f) + num865 = 14f; + else if (num864 > 600f) + num865 = 12f; + else if (num864 > 300f) + num865 = 10f; + } + + if (num864 > 50f) + { + num864 = num865 / num864; + npc.velocity.X = (npc.velocity.X * 14f + num862 * num864) / 15f; + npc.velocity.Y = (npc.velocity.Y * 14f + num863 * num864) / 15f; + } + } + else if (npc.ai[1] == 1f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 600f || npc.ai[3] != 1f) + { + npc.ai[2] = 0f; + npc.ai[1] = 0f; + } + + Vector2 vector111 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num866 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector111.X; + float num867 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector111.Y; + float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); + num868 = 20f / num868; + + npc.velocity.X = (npc.velocity.X * 49f + num866 * num868) / 50f; + npc.velocity.Y = (npc.velocity.Y * 49f + num867 * num868) / 50f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[1] = 3f; + npc.velocity.Y += 0.1f; + + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.X *= 0.95f; + + if (npc.timeLeft > 500) + npc.timeLeft = 500; + } + npc.rotation = npc.velocity.X * -0.02f; + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + + public static bool BuffedPumpkingBladeAI(NPC npc) + { + npc.spriteDirection = -(int)npc.ai[0]; + + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient && Main.npc[(int)npc.ai[1]].ai[3] == 2f) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] > 30f) + { + npc.localAI[1] = 0f; + + float num869 = 0.01f; + Vector2 vector112 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float num870 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector112.X; + float num871 = Main.player[npc.target].position.Y - vector112.Y; + float num872 = (float)Math.Sqrt((double)(num870 * num870 + num871 * num871)); + + num872 = num869 / num872; + num870 *= num872; + num871 *= num872; + + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num870, num871, 329, 70, 0f, Main.myPlayer, npc.rotation, (float)npc.spriteDirection); + } + } + + if (Main.dayTime) + { + npc.velocity.Y += 0.3f; + npc.velocity.X *= 0.9f; + return false; + } + + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + npc.ai[3] += 1f; + if (npc.ai[3] >= 180f) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + Vector2 vector113 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num874 = (Main.player[npc.target].Center.X + Main.npc[(int)npc.ai[1]].Center.X) / 2f; + float num875 = (Main.player[npc.target].Center.Y + Main.npc[(int)npc.ai[1]].Center.Y) / 2f; + num874 += -170f * npc.ai[0] - vector113.X; + num875 += 90f - vector113.Y; + + float num876 = Math.Abs(Main.player[npc.target].Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(Main.player[npc.target].Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + if (num876 > 700f) + { + num874 = Main.npc[(int)npc.ai[1]].Center.X - 170f * npc.ai[0] - vector113.X; + num875 = Main.npc[(int)npc.ai[1]].Center.Y + 90f - vector113.Y; + } + + float num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); + float num878 = 8f; + if (num877 > 1000f) + num878 = 23f; + else if (num877 > 800f) + num878 = 20f; + else if (num877 > 600f) + num878 = 17f; + else if (num877 > 400f) + num878 = 14f; + else if (num877 > 200f) + num878 = 11f; + + if (npc.ai[0] < 0f && npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + num874 -= 4f; + if (npc.ai[0] > 0f && npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + num874 += 4f; + + num877 = num878 / num877; + npc.velocity.X = (npc.velocity.X * 14f + num874 * num877) / 15f; + npc.velocity.Y = (npc.velocity.Y * 14f + num875 * num877) / 15f; + num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); + + if (num877 > 20f) + npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + 1.57f; + } + else if (npc.ai[2] == 1f) + { + Vector2 vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num879 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector114.X; + float num880 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector114.Y; + float num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); + + npc.rotation = (float)Math.Atan2((double)num880, (double)num879) + 1.57f; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.3f; + + if (npc.velocity.Y < -18f) + npc.velocity.Y = -18f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + npc.TargetClosest(true); + npc.ai[2] = 2f; + + vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num879 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector114.X; + num880 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector114.Y; + num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); + num881 = 24f / num881; + + npc.velocity.X = num879 * num881; + npc.velocity.Y = num880 * num881; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + float num882 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || num882 > 800f) + npc.ai[2] = 3f; + } + else if (npc.ai[2] == 4f) + { + Vector2 vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num883 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector115.X; + float num884 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector115.Y; + float num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); + + npc.rotation = (float)Math.Atan2((double)num884, (double)num883) + 1.57f; + npc.velocity.Y *= 0.95f; + npc.velocity.X += 0.3f * -npc.ai[0]; + + if (npc.velocity.X < -18f) + npc.velocity.X = -18f; + if (npc.velocity.X > 18f) + npc.velocity.X = 18f; + + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) + { + npc.TargetClosest(true); + npc.ai[2] = 5f; + + vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num883 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector115.X; + num884 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector115.Y; + num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); + num885 = 17f / num885; + + npc.velocity.X = num883 * num885; + npc.velocity.Y = num884 * num885; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 5f) + { + float num886 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + + if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || num886 > 800f) + npc.ai[2] = 0f; + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Buffed Ice Queen AI + public static bool BuffedIceQueenAI(NPC npc) + { + if (Main.dayTime) + { + if (npc.velocity.X > 0f) + npc.velocity.X += 0.25f; + else + npc.velocity.X -= 0.25f; + + npc.velocity.Y -= 0.1f; + npc.rotation = npc.velocity.X * 0.05f; + } + else if (npc.ai[0] == 0f) + { + if (npc.ai[2] == 0f) + { + npc.TargetClosest(true); + + if (npc.Center.X < Main.player[npc.target].Center.X) + npc.ai[2] = 1f; + else + npc.ai[2] = -1f; + } + + npc.TargetClosest(true); + int num887 = 800; + float num888 = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + + if (npc.Center.X < Main.player[npc.target].Center.X && npc.ai[2] < 0f && num888 > (float)num887) + npc.ai[2] = 0f; + if (npc.Center.X > Main.player[npc.target].Center.X && npc.ai[2] > 0f && num888 > (float)num887) + npc.ai[2] = 0f; + + float num889 = 0.6f; + float num890 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num889 = 0.7f; + num890 = 12f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num889 = 0.8f; + num890 = 14f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num889 = 0.95f; + num890 = 16f; + } + + npc.velocity.X += npc.ai[2] * num889; + if (npc.velocity.X > num890) + npc.velocity.X = num890; + if (npc.velocity.X < -num890) + npc.velocity.X = -num890; + + float num891 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); + if (num891 < 150f) + npc.velocity.Y -= 0.2f; + if (num891 > 200f) + npc.velocity.Y += 0.2f; + if (npc.velocity.Y > 9f) + npc.velocity.Y = 9f; + if (npc.velocity.Y < -9f) + npc.velocity.Y = -9f; + + npc.rotation = npc.velocity.X * 0.05f; + + if ((num888 < 500f || npc.ai[3] < 0f) && npc.position.Y < Main.player[npc.target].position.Y) + { + npc.ai[3] += 1f; + int num892 = 8; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num892 = 7; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num892 = 6; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num892 = 5; + + num892++; + if (npc.ai[3] > (float)num892) + npc.ai[3] = (float)(-(float)num892); + + if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector116 = new Vector2(npc.Center.X, npc.Center.Y); + vector116.X += npc.velocity.X * 7f; + float num893 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector116.X; + float num894 = Main.player[npc.target].Center.Y - vector116.Y; + float num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); + + float num896 = 8f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num896 = 9f; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num896 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num896 = 11f; + + num895 = num896 / num895; + num893 *= num895; + num894 *= num895; + + Projectile.NewProjectile(vector116.X, vector116.Y, num893, num894, 348, 50, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (npc.ai[3] < 0f) + npc.ai[3] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + + if (npc.ai[1] > 600f && num888 < 600f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(true); + + float num898 = 0.2f; + float num899 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num898 = 0.24f; + num899 = 12f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num898 = 0.28f; + num899 = 14f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num898 = 0.32f; + num899 = 16f; + } + num898 -= 0.05f; + num899 -= 1f; + + if (npc.Center.X < Main.player[npc.target].Center.X) + { + npc.velocity.X += num898; + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.98f; + } + if (npc.Center.X > Main.player[npc.target].Center.X) + { + npc.velocity.X -= num898; + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.98f; + } + if (npc.velocity.X > num899 || npc.velocity.X < -num899) + npc.velocity.X *= 0.95f; + + float num900 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); + if (num900 < 180f) + npc.velocity.Y -= 0.1f; + if (num900 > 200f) + npc.velocity.Y += 0.1f; + + if (npc.velocity.Y > 7f) + npc.velocity.Y = 7f; + if (npc.velocity.Y < -7f) + npc.velocity.Y = -7f; + + npc.rotation = npc.velocity.X * 0.01f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[3] += 1f; + int num901 = 10; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num901 = 8; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num901 = 6; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num901 = 4; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num901 = 2; + + num901 += 3; + if (npc.ai[3] >= (float)num901) + { + npc.ai[3] = 0f; + Vector2 vector117 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); + int i2 = (int)(vector117.X / 16f); + int j2 = (int)(vector117.Y / 16f); + if (!WorldGen.SolidTile(i2, j2)) + { + float num902 = npc.velocity.Y; + + if (num902 < 0f) + num902 = 0f; + + num902 += 3f; + float speedX2 = npc.velocity.X * 0.25f; + Projectile.NewProjectile(vector117.X, vector117.Y, speedX2, num902, 349, 44, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + + if (npc.ai[1] > 450f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + + Vector2 vector118 = new Vector2(npc.Center.X, npc.Center.Y - 20f); + float num904 = (float)Main.rand.Next(-1000, 1001); + float num905 = (float)Main.rand.Next(-1000, 1001); + float num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); + float num907 = 20f; + + npc.velocity *= 0.95f; + num906 = num907 / num906; + num904 *= num906; + num905 *= num906; + npc.rotation += 0.2f; + vector118.X += num904 * 4f; + vector118.Y += num905 * 4f; + + npc.ai[3] += 1f; + int num908 = 7; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num908--; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num908 -= 2; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num908 -= 3; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num908 -= 4; + + if (npc.ai[3] > (float)num908) + { + npc.ai[3] = 0f; + int num909 = Projectile.NewProjectile(vector118.X, vector118.Y, num904, num905, 349, 40, 0f, Main.myPlayer, 0f, 0f); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + + if (npc.ai[1] > 300f) + npc.ai[0] = -1f; + } + } + if (npc.ai[0] == -1f) + { + int num910 = Main.rand.Next(3); + npc.TargetClosest(true); + + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 1000f) + num910 = 0; + + npc.ai[0] = (float)num910; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + if (ModLoader.GetMod("FargowiltasSouls") != null) + ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); + + return false; + } + #endregion + + #region Revengeance Dungeon Guardian AI + public static void RevengeanceDungeonGuardianAI(NPC npc, bool configBossRushBoost, bool enraged) + { + Vector2 vector21 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num177 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector21.X; + float num178 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector21.Y; + float num179 = (float)Math.Sqrt((double)(num177 * num177 + num178 * num178)); + num179 = 12f / num179; + npc.velocity.X = num177 * num179; + npc.velocity.Y = num178 * num179; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 60f) + { + npc.localAI[1] = 0f; + Vector2 vector16 = npc.Center; + if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num159 = 5f; + float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; + Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + value += npc.velocity; + num160 = value.X; + num161 = value.Y; + int num163 = 2500; + int num164 = ProjectileID.Skull; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 300; + } + } + } + } + #endregion + + #region Revengeance Basic NPC AI + public static void RevengeanceLihzahrdAI(NPC npc) + { + // Transform into second state sooner + if (Main.netMode != NetmodeID.MultiplayerClient && (double)npc.life <= (double)npc.lifeMax * 0.9) + npc.Transform(NPCID.LihzahrdCrawler); + } + + public static void RevengeanceIceGolemAI(NPC npc) + { + // Increases movement speed + float num63 = 2f; + float num64 = 0.14f; + num63 += (1f - (float)npc.life / (float)npc.lifeMax) * 1.5f; + num64 += (1f - (float)npc.life / (float)npc.lifeMax) * 0.15f; + + if (npc.velocity.X < -num63 || npc.velocity.X > num63) + return; + else if (npc.velocity.X < num63 && npc.direction == 1) + { + npc.velocity.X += num64; + if (npc.velocity.X > num63) + npc.velocity.X = num63; + } + else if (npc.velocity.X > -num63 && npc.direction == -1) + { + npc.velocity.X -= num64; + if (npc.velocity.X < -num63) + npc.velocity.X = -num63; + } + } + #endregion + } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 81b054330b..bd9ef58a41 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1,14 +1,12 @@ using CalamityMod.Buffs.DoTDebuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; -using CalamityMod.Projectiles; using CalamityMod.Utilities; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -17,7 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs { public class CalamityGlobalNPC : GlobalNPC - { + { #region Variables public float DR { get; set; } = 0f; @@ -39,77 +37,77 @@ namespace CalamityMod.NPCs // NewAI private const int maxAIMod = 4; - public float[] newAI = new float[maxAIMod]; + public float[] newAI = new float[maxAIMod]; - // Town NPC Patreon - private bool setNewName = true; + // Town NPC Patreon + private bool setNewName = true; - // Draedons Remote - public static bool DraedonMayhem = false; + // Draedons Remote + public static bool DraedonMayhem = false; - // Debuffs - public bool timeSlow = false; - public bool wCleave = false; - public bool bBlood = false; - public bool dFlames = false; - public bool marked = false; - public bool irradiated = false; - public bool bFlames = false; - public bool hFlames = false; - public bool pFlames = false; - public bool gState = false; - public bool aCrunch = false; - public bool tSad = false; - public bool pShred = false; - public bool cDepth = false; - public bool gsInferno = false; - public bool astralInfection = false; - public bool aFlames = false; - public bool eFreeze = false; - public bool wDeath = false; - public bool nightwither = false; - public bool silvaStun = false; - public bool enraged = false; - public bool yellowCandle = false; - public bool pearlAura = false; - public bool shellfishVore = false; - public bool clamDebuff = false; + // Debuffs + public bool timeSlow = false; + public bool wCleave = false; + public bool bBlood = false; + public bool dFlames = false; + public bool marked = false; + public bool irradiated = false; + public bool bFlames = false; + public bool hFlames = false; + public bool pFlames = false; + public bool gState = false; + public bool aCrunch = false; + public bool tSad = false; + public bool pShred = false; + public bool cDepth = false; + public bool gsInferno = false; + public bool astralInfection = false; + public bool aFlames = false; + public bool eFreeze = false; + public bool wDeath = false; + public bool nightwither = false; + public bool silvaStun = false; + public bool enraged = false; + public bool yellowCandle = false; + public bool pearlAura = false; + public bool shellfishVore = false; + public bool clamDebuff = false; - // whoAmI Variables - public static int bobbitWormBottom = -1; - public static int hiveMind = -1; - public static int perfHive = -1; - public static int slimeGodPurple = -1; - public static int slimeGodRed = -1; - public static int slimeGod = -1; - public static int laserEye = -1; - public static int fireEye = -1; - public static int primeLaser = -1; - public static int primeCannon = -1; - public static int primeVice = -1; - public static int primeSaw = -1; - public static int brimstoneElemental = -1; - public static int cataclysm = -1; - public static int catastrophe = -1; - public static int calamitas = -1; - public static int leviathan = -1; - public static int siren = -1; - public static int scavenger = -1; - public static int astrumDeusHeadMain = -1; - public static int energyFlame = -1; - public static int doughnutBoss = -1; - public static int holyBossAttacker = -1; - public static int holyBossDefender = -1; - public static int holyBossHealer = -1; - public static int holyBoss = -1; - public static int voidBoss = -1; - public static int ghostBossClone = -1; - public static int ghostBoss = -1; - public static int DoGHead = -1; - public static int SCalCataclysm = -1; - public static int SCalCatastrophe = -1; - public static int SCal = -1; - public static int SCalWorm = -1; + // whoAmI Variables + public static int bobbitWormBottom = -1; + public static int hiveMind = -1; + public static int perfHive = -1; + public static int slimeGodPurple = -1; + public static int slimeGodRed = -1; + public static int slimeGod = -1; + public static int laserEye = -1; + public static int fireEye = -1; + public static int primeLaser = -1; + public static int primeCannon = -1; + public static int primeVice = -1; + public static int primeSaw = -1; + public static int brimstoneElemental = -1; + public static int cataclysm = -1; + public static int catastrophe = -1; + public static int calamitas = -1; + public static int leviathan = -1; + public static int siren = -1; + public static int scavenger = -1; + public static int astrumDeusHeadMain = -1; + public static int energyFlame = -1; + public static int doughnutBoss = -1; + public static int holyBossAttacker = -1; + public static int holyBossDefender = -1; + public static int holyBossHealer = -1; + public static int holyBoss = -1; + public static int voidBoss = -1; + public static int ghostBossClone = -1; + public static int ghostBoss = -1; + public static int DoGHead = -1; + public static int SCalCataclysm = -1; + public static int SCalCatastrophe = -1; + public static int SCal = -1; + public static int SCalWorm = -1; // Collections public static SortedDictionary BossRushHPChanges = new SortedDictionary @@ -121,15 +119,15 @@ namespace CalamityMod.NPCs { NPCID.KingSlime, 500000 }, { NPCID.BlueSlime, 12000 }, { NPCID.SlimeSpiked, 24000 }, - { NPCID.GreenSlime, 9000 }, - { NPCID.RedSlime, 18000 }, - { NPCID.PurpleSlime, 24000 }, - { NPCID.YellowSlime, 21000 }, - { NPCID.IceSlime, 15000 }, - { NPCID.UmbrellaSlime, 18000 }, - { NPCID.RainbowSlime, 100000 }, - { NPCID.Pinky, 50000 }, - { NPCID.EyeofCthulhu, 600000 }, + { NPCID.GreenSlime, 9000 }, + { NPCID.RedSlime, 18000 }, + { NPCID.PurpleSlime, 24000 }, + { NPCID.YellowSlime, 21000 }, + { NPCID.IceSlime, 15000 }, + { NPCID.UmbrellaSlime, 18000 }, + { NPCID.RainbowSlime, 100000 }, + { NPCID.Pinky, 50000 }, + { NPCID.EyeofCthulhu, 600000 }, { NPCID.ServantofCthulhu, 60000 }, { NPCID.SkeletronPrime, 980000 }, { NPCID.PrimeVice, 540000 }, @@ -174,8 +172,8 @@ namespace CalamityMod.NPCs { NPCID.MoonLordCore, 1400000 }, { NPCID.MoonLordHand, 450000 }, { NPCID.MoonLordHead, 600000 }, - { NPCID.MoonLordLeechBlob, 8000 } - }; + { NPCID.MoonLordLeechBlob, 8000 } + }; public static SortedDictionary BossValues = new SortedDictionary { @@ -524,9 +522,9 @@ namespace CalamityMod.NPCs } if (CalamityWorld.bossRushActive) - { - BossRushStatChanges(npc, mod); - } + { + BossRushStatChanges(npc, mod); + } else { if (CalamityMod.enemyImmunityList.Contains(npc.type)) @@ -678,11 +676,11 @@ namespace CalamityMod.NPCs npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.4) : (int)(npc.lifeMax * 1.9); npc.npcSlots = 36f; } - else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordLeechBlob) - { - npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.2); - } - else if (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail) + else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordLeechBlob) + { + npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.2); + } + else if (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail) { npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 10.0) : (int)(npc.lifeMax * 5.0); } @@ -696,29 +694,29 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)(npc.lifeMax * 5.0); } else if (npc.type == NPCID.Golem) - { + { npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 7.0) : (int)(npc.lifeMax * 4.0); - npc.npcSlots = 64f; - } - else if (npc.type == NPCID.GolemHead) - { + npc.npcSlots = 64f; + } + else if (npc.type == NPCID.GolemHead) + { npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.0) : (int)(npc.lifeMax * 1.5); - } - else if (npc.type == NPCID.GolemHeadFree) - { - npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.5) : (int)(npc.lifeMax * 1.25); - npc.dontTakeDamage = false; - } + } + else if (npc.type == NPCID.GolemHeadFree) + { + npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.5) : (int)(npc.lifeMax * 1.25); + npc.dontTakeDamage = false; + } else if (npc.type == NPCID.Plantera) { npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 3.4) : (int)(npc.lifeMax * 2.3); npc.npcSlots = 32f; } - else if (npc.type == NPCID.PlanterasHook) - { - npc.damage = (npc.defDamage = 0); - } - else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) + else if (npc.type == NPCID.PlanterasHook) + { + npc.damage = (npc.defDamage = 0); + } + else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) { npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.6) : (int)(npc.lifeMax * 1.9); @@ -923,10 +921,10 @@ namespace CalamityMod.NPCs // TODO -- Change Iron Heart damage in here for Iron Heart mode #region Iron Heart Changes private void IronHeartChanges(NPC npc) - { - // Iron Heart damage variable will scale with npc.damage - // ironHeartDamage = 0; - } + { + // Iron Heart damage variable will scale with npc.damage + // ironHeartDamage = 0; + } #endregion #region Scale Expert Multiplayer Stats @@ -1089,7 +1087,7 @@ namespace CalamityMod.NPCs cooldownSlot = 1; } - if(CalamityWorld.buffedEclipse && Main.eclipse) + if (CalamityWorld.buffedEclipse && Main.eclipse) { cooldownSlot = 1; } @@ -1123,33 +1121,33 @@ namespace CalamityMod.NPCs // TODO -- move this to Destroyer's Rev+ AI; either set his DR or modify npc.takenDamageMultiplier if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail) { - if ((newAI[1] < 480f || newAI[2] > 0f) && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - damage *= 0.01; - } - } + if ((newAI[1] < 480f || newAI[2] > 0f) && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + damage *= 0.01; + } + } - // Override hand/head eye 'death' code and use custom 'death' code instead, this is here just in case the AI code fails - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) - { - if (npc.life - (int)damage <= 0) - { - if (newAI[0] != 1f) - { - newAI[0] = 1f; - npc.life = npc.lifeMax; - npc.netUpdate = true; - npc.dontTakeDamage = true; - } - } - } - } + // Override hand/head eye 'death' code and use custom 'death' code instead, this is here just in case the AI code fails + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) + { + if (npc.life - (int)damage <= 0) + { + if (newAI[0] != 1f) + { + newAI[0] = 1f; + npc.life = npc.lifeMax; + npc.netUpdate = true; + npc.dontTakeDamage = true; + } + } + } + } - // Yellow Candle provides +5% damage which ignores both DR and defense. - // However, armor penetration bonus damage has already been applied, so it's slightly higher than it should be. - double yellowCandleDamage = 0.05 * damage; + // Yellow Candle provides +5% damage which ignores both DR and defense. + // However, armor penetration bonus damage has already been applied, so it's slightly higher than it should be. + double yellowCandleDamage = 0.05 * damage; // Apply modifications to enemy's current defense based on Calamity debuffs. // As with defense and DR, flat reductions apply first, then multiplicative reductions. @@ -1292,29 +1290,29 @@ namespace CalamityMod.NPCs #region Boss Head Slot public override void BossHeadSlot(NPC npc, ref int index) - { - if (CalamityWorld.revenge) - { - if (npc.type == NPCID.BrainofCthulhu) - { - if ((float)npc.life / (float)npc.lifeMax < (CalamityWorld.death ? 0.33f : 0.2f)) - index = -1; - } + { + if (CalamityWorld.revenge) + { + if (npc.type == NPCID.BrainofCthulhu) + { + if ((float)npc.life / (float)npc.lifeMax < (CalamityWorld.death ? 0.33f : 0.2f)) + index = -1; + } - if (CalamityWorld.death) - { - if (npc.type == NPCID.DukeFishron) - { - if ((float)npc.life / (float)npc.lifeMax < 0.15f) - index = -1; - } - } - } - } - #endregion + if (CalamityWorld.death) + { + if (npc.type == NPCID.DukeFishron) + { + if ((float)npc.life / (float)npc.lifeMax < 0.15f) + index = -1; + } + } + } + } + #endregion - #region Pre AI - public override bool PreAI(NPC npc) + #region Pre AI + public override bool PreAI(NPC npc) { SetPatreonTownNPCName(npc); @@ -1342,17 +1340,17 @@ namespace CalamityMod.NPCs } } - // Always prevent true eye of cthulhu appearance in rev+ - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - if (npc.type == NPCID.MoonLordFreeEye) - { - npc.active = false; - npc.netUpdate = true; - } - } + // Always prevent true eye of cthulhu appearance in rev+ + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + if (npc.type == NPCID.MoonLordFreeEye) + { + npc.active = false; + npc.netUpdate = true; + } + } - if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) + if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) { BossRushForceDespawnOtherNPCs(npc, mod); } @@ -1419,11 +1417,11 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedPlanterasTentacleAI(npc, mod); case NPCID.Golem: - return CalamityGlobalAI.BuffedGolemAI(npc, enraged, mod); - case NPCID.GolemHead: - return CalamityGlobalAI.BuffedGolemHeadAI(npc, enraged, mod); - case NPCID.GolemHeadFree: - return CalamityGlobalAI.BuffedGolemHeadFreeAI(npc, enraged, mod); + return CalamityGlobalAI.BuffedGolemAI(npc, enraged, mod); + case NPCID.GolemHead: + return CalamityGlobalAI.BuffedGolemHeadAI(npc, enraged, mod); + case NPCID.GolemHeadFree: + return CalamityGlobalAI.BuffedGolemHeadFreeAI(npc, enraged, mod); case NPCID.DukeFishron: return CalamityGlobalAI.BuffedDukeFishronAI(npc, enraged, mod); @@ -1460,19 +1458,19 @@ namespace CalamityMod.NPCs break; - case NPCID.CultistBoss: - case NPCID.CultistBossClone: - return CalamityGlobalAI.BuffedCultistAI(npc, enraged, mod); - case NPCID.AncientDoom: - return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod); + case NPCID.CultistBoss: + case NPCID.CultistBossClone: + return CalamityGlobalAI.BuffedCultistAI(npc, enraged, mod); + case NPCID.AncientDoom: + return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod); - case NPCID.MoonLordCore: - case NPCID.MoonLordHand: - case NPCID.MoonLordHead: - case NPCID.MoonLordLeechBlob: - return CalamityGlobalAI.BuffedMoonLordAI(npc, enraged, mod); + case NPCID.MoonLordCore: + case NPCID.MoonLordHand: + case NPCID.MoonLordHead: + case NPCID.MoonLordLeechBlob: + return CalamityGlobalAI.BuffedMoonLordAI(npc, enraged, mod); - default: + default: break; } } @@ -1584,13 +1582,13 @@ namespace CalamityMod.NPCs switch (CalamityWorld.bossRushStage) { case 0: - if (npc.type != NPCID.QueenBee) - { - npc.active = false; - npc.netUpdate = true; - } + if (npc.type != NPCID.QueenBee) + { + npc.active = false; + npc.netUpdate = true; + } - break; + break; case 1: if (npc.type != NPCID.BrainofCthulhu && npc.type != NPCID.Creeper) @@ -1602,15 +1600,15 @@ namespace CalamityMod.NPCs break; case 2: - if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked && npc.type != mod.NPCType("KingSlimeJewel") && - npc.type != NPCID.YellowSlime && npc.type != NPCID.PurpleSlime && npc.type != NPCID.GreenSlime && npc.type != NPCID.RedSlime && - npc.type != NPCID.IceSlime && npc.type != NPCID.UmbrellaSlime && npc.type != NPCID.RainbowSlime && npc.type != NPCID.Pinky) - { - npc.active = false; - npc.netUpdate = true; - } + if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked && npc.type != mod.NPCType("KingSlimeJewel") && + npc.type != NPCID.YellowSlime && npc.type != NPCID.PurpleSlime && npc.type != NPCID.GreenSlime && npc.type != NPCID.RedSlime && + npc.type != NPCID.IceSlime && npc.type != NPCID.UmbrellaSlime && npc.type != NPCID.RainbowSlime && npc.type != NPCID.Pinky) + { + npc.active = false; + npc.netUpdate = true; + } - break; + break; case 3: if (npc.type != NPCID.EyeofCthulhu && npc.type != NPCID.ServantofCthulhu) @@ -1622,14 +1620,14 @@ namespace CalamityMod.NPCs break; case 4: - if (npc.type != NPCID.SkeletronPrime && npc.type != NPCID.PrimeSaw && npc.type != NPCID.PrimeVice && - npc.type != NPCID.PrimeCannon && npc.type != NPCID.PrimeLaser && npc.type != NPCID.Probe) - { - npc.active = false; - npc.netUpdate = true; - } + if (npc.type != NPCID.SkeletronPrime && npc.type != NPCID.PrimeSaw && npc.type != NPCID.PrimeVice && + npc.type != NPCID.PrimeCannon && npc.type != NPCID.PrimeLaser && npc.type != NPCID.Probe) + { + npc.active = false; + npc.netUpdate = true; + } - break; + break; case 5: if (npc.type != NPCID.Golem && npc.type != NPCID.GolemFistLeft && npc.type != NPCID.GolemFistRight && @@ -1662,13 +1660,13 @@ namespace CalamityMod.NPCs break; case 8: - if (npc.type != mod.NPCType("Astrageldon") && npc.type != mod.NPCType("AstrageldonSlime")) - { - npc.active = false; - npc.netUpdate = true; - } + if (npc.type != mod.NPCType("Astrageldon") && npc.type != mod.NPCType("AstrageldonSlime")) + { + npc.active = false; + npc.netUpdate = true; + } - break; + break; case 9: if (npc.type != NPCID.TheDestroyer && npc.type != NPCID.TheDestroyerBody && npc.type != NPCID.TheDestroyerTail && @@ -1769,16 +1767,16 @@ namespace CalamityMod.NPCs break; case 18: - if (npc.type != NPCID.CultistBoss && npc.type != NPCID.CultistBossClone && npc.type != NPCID.CultistDragonHead && - npc.type != NPCID.CultistDragonBody1 && npc.type != NPCID.CultistDragonBody2 && npc.type != NPCID.CultistDragonBody3 && - npc.type != NPCID.CultistDragonBody4 && npc.type != NPCID.CultistDragonTail && npc.type != NPCID.AncientCultistSquidhead && - npc.type != NPCID.AncientLight && npc.type != NPCID.AncientDoom) - { - npc.active = false; - npc.netUpdate = true; - } + if (npc.type != NPCID.CultistBoss && npc.type != NPCID.CultistBossClone && npc.type != NPCID.CultistDragonHead && + npc.type != NPCID.CultistDragonBody1 && npc.type != NPCID.CultistDragonBody2 && npc.type != NPCID.CultistDragonBody3 && + npc.type != NPCID.CultistDragonBody4 && npc.type != NPCID.CultistDragonTail && npc.type != NPCID.AncientCultistSquidhead && + npc.type != NPCID.AncientLight && npc.type != NPCID.AncientDoom) + { + npc.active = false; + npc.netUpdate = true; + } - break; + break; case 19: if (npc.type != mod.NPCType("CrabulonIdle") && npc.type != mod.NPCType("CrabShroom")) @@ -1876,14 +1874,14 @@ namespace CalamityMod.NPCs break; case 28: - if (npc.type != NPCID.MoonLordCore && npc.type != NPCID.MoonLordHead && npc.type != NPCID.MoonLordHand && - npc.type != NPCID.MoonLordLeechBlob) - { - npc.active = false; - npc.netUpdate = true; - } + if (npc.type != NPCID.MoonLordCore && npc.type != NPCID.MoonLordHead && npc.type != NPCID.MoonLordHand && + npc.type != NPCID.MoonLordLeechBlob) + { + npc.active = false; + npc.netUpdate = true; + } - break; + break; case 29: if (npc.type != mod.NPCType("AstrumDeusHead") && npc.type != mod.NPCType("AstrumDeusBody") && @@ -1978,14 +1976,14 @@ namespace CalamityMod.NPCs break; case 37: - if (npc.type != mod.NPCType("Yharon") && npc.type != mod.NPCType("DetonatingFlare") && - npc.type != mod.NPCType("DetonatingFlare2")) - { - npc.active = false; - npc.netUpdate = true; - } + if (npc.type != mod.NPCType("Yharon") && npc.type != mod.NPCType("DetonatingFlare") && + npc.type != mod.NPCType("DetonatingFlare2")) + { + npc.active = false; + npc.netUpdate = true; + } - break; + break; case 38: if (npc.type != mod.NPCType("DevourerofGodsHeadS") && npc.type != mod.NPCType("DevourerofGodsBodyS") && @@ -2002,48 +2000,48 @@ namespace CalamityMod.NPCs #region AI public override void AI(NPC npc) - { - if (!CalamityWorld.spawnedHardBoss) - { - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.SkeletronPrime || - npc.type == NPCID.Plantera || npc.type == mod.NPCType("Cryogen") || npc.type == mod.NPCType("AquaticScourgeHead") || - npc.type == mod.NPCType("BrimstoneElemental") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("AstrumDeusHeadSpectral") || - npc.type == mod.NPCType("Calamitas") || npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("PlaguebringerGoliath") || - npc.type == mod.NPCType("ScavengerBody") || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem) - { - CalamityWorld.spawnedHardBoss = true; - CalamityMod.UpdateServerBoolean(); - } - } + { + if (!CalamityWorld.spawnedHardBoss) + { + if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.SkeletronPrime || + npc.type == NPCID.Plantera || npc.type == mod.NPCType("Cryogen") || npc.type == mod.NPCType("AquaticScourgeHead") || + npc.type == mod.NPCType("BrimstoneElemental") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("AstrumDeusHeadSpectral") || + npc.type == mod.NPCType("Calamitas") || npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("PlaguebringerGoliath") || + npc.type == mod.NPCType("ScavengerBody") || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem) + { + CalamityWorld.spawnedHardBoss = true; + CalamityMod.UpdateServerBoolean(); + } + } - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - switch (npc.type) - { - case NPCID.DungeonGuardian: - CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc, configBossRushBoost, enraged); - break; + switch (npc.type) + { + case NPCID.DungeonGuardian: + CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc, configBossRushBoost, enraged); + break; - case NPCID.Lihzahrd: - CalamityGlobalAI.RevengeanceLihzahrdAI(npc); - break; + case NPCID.Lihzahrd: + CalamityGlobalAI.RevengeanceLihzahrdAI(npc); + break; - case NPCID.IceGolem: - CalamityGlobalAI.RevengeanceIceGolemAI(npc); - break; + case NPCID.IceGolem: + CalamityGlobalAI.RevengeanceIceGolemAI(npc); + break; - default: - break; - } - } - } - #endregion + default: + break; + } + } + } + #endregion - #region Post AI - public override void PostAI(NPC npc) - { + #region Post AI + public override void PostAI(NPC npc) + { // Bosses and any specific other NPCs are completely immune to having their movement impaired. if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type)) return; @@ -2052,13 +2050,13 @@ namespace CalamityMod.NPCs npc.velocity *= 0.95f; if (!CalamityWorld.bossRushActive) - { - if (silvaStun) + { + if (silvaStun) npc.velocity = Vector2.Zero; - else if (timeSlow) + else if (timeSlow) npc.velocity *= 0.85f; - } - } + } + } #endregion #region On Hit Player @@ -2089,30 +2087,30 @@ namespace CalamityMod.NPCs } if (CalamityWorld.revenge) - { - if (Config.RevengeanceAndDeathThoriumBossBuff) - { - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (thorium != null) - { - if (npc.type == thorium.NPCType("GraniteEnergyStorm") || npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || - npc.type == thorium.NPCType("TheBuriedWarrior2") || npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || - npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || npc.type == thorium.NPCType("SlagFury") || - npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || npc.type == thorium.NPCType("Aquaius") || - npc.type == thorium.NPCType("Aquaius2")) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == thorium.NPCType("ViscountBaby") || npc.type == thorium.NPCType("EnemyBeholder") || npc.type == thorium.NPCType("AbyssalSpawn") || - npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2") || - npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("Abyssion") || - npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - target.AddBuff(mod.BuffType("Horror"), 180); - } - } - } + { + if (Config.RevengeanceAndDeathThoriumBossBuff) + { + Mod thorium = ModLoader.GetMod("ThoriumMod"); + if (thorium != null) + { + if (npc.type == thorium.NPCType("GraniteEnergyStorm") || npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || + npc.type == thorium.NPCType("TheBuriedWarrior2") || npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || + npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || npc.type == thorium.NPCType("SlagFury") || + npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || npc.type == thorium.NPCType("Aquaius") || + npc.type == thorium.NPCType("Aquaius2")) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == thorium.NPCType("ViscountBaby") || npc.type == thorium.NPCType("EnemyBeholder") || npc.type == thorium.NPCType("AbyssalSpawn") || + npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2") || + npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("Abyssion") || + npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + target.AddBuff(mod.BuffType("Horror"), 180); + } + } + } switch (npc.type) { @@ -2401,7 +2399,7 @@ namespace CalamityMod.NPCs #region On Hit By Projectile public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) { - bool isSummon = projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type); + bool isSummon = projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type); if (Main.player[projectile.owner].Calamity().sGenerator) { @@ -2686,16 +2684,16 @@ namespace CalamityMod.NPCs #region Edit Spawn Pool public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneCalamity || - spawnInfo.player.Calamity().ZoneSulphur || - spawnInfo.player.Calamity().ZoneSunkenSea || - (spawnInfo.player.Calamity().ZoneAstral && !NPC.LunarApocalypseIsUp)) - { - pool[0] = 0f; - } - } + { + if (spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneCalamity || + spawnInfo.player.Calamity().ZoneSulphur || + spawnInfo.player.Calamity().ZoneSunkenSea || + (spawnInfo.player.Calamity().ZoneAstral && !NPC.LunarApocalypseIsUp)) + { + pool[0] = 0f; + } + } #endregion #region Drawing @@ -3510,35 +3508,35 @@ namespace CalamityMod.NPCs public void SetShopItem(ref Chest shop, ref int nextSlot, int itemID, bool condition = true, int? price = null) { - if (condition) - { - shop.item[nextSlot].SetDefaults(itemID); - if (price != null) - { - shop.item[nextSlot].shopCustomPrice = price; - } + if (condition) + { + shop.item[nextSlot].SetDefaults(itemID); + if (price != null) + { + shop.item[nextSlot].shopCustomPrice = price; + } - nextSlot++; - } + nextSlot++; + } } #endregion #region Any Boss NPCs public static bool AnyBossNPCS() - { - Mod mod = ModLoader.GetMod("CalamityMod"); + { + Mod mod = ModLoader.GetMod("CalamityMod"); - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && Main.npc[i].type != NPCID.MartianSaucerCore && - (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsTail || Main.npc[i].type == mod.NPCType("SlimeGodRun") || - Main.npc[i].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[i].type == mod.NPCType("SlimeGod") || Main.npc[i].type == mod.NPCType("SlimeGodSplit"))) - { - return true; - } - } - return false; - } + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && Main.npc[i].type != NPCID.MartianSaucerCore && + (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsTail || Main.npc[i].type == mod.NPCType("SlimeGodRun") || + Main.npc[i].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[i].type == mod.NPCType("SlimeGod") || Main.npc[i].type == mod.NPCType("SlimeGodSplit"))) + { + return true; + } + } + return false; + } #endregion #region Any Living Players @@ -3557,19 +3555,19 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) - { - Mod mod = ModLoader.GetMod("CalamityMod"); + { + Mod mod = ModLoader.GetMod("CalamityMod"); - if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Mothron && - target.type != NPCID.Pumpking && target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail && - target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCID.IceQueen && - target.type != mod.NPCType("Reaper") && target.type != mod.NPCType("Mauler") && target.type != mod.NPCType("EidolonWyrmHead") && - target.type != mod.NPCType("EidolonWyrmHeadHuge") && target.type != mod.NPCType("ColossalSquid") && target.type != NPCID.DD2Betsy) - { - return true; - } - return false; - } + if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Mothron && + target.type != NPCID.Pumpking && target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail && + target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCID.IceQueen && + target.type != mod.NPCType("Reaper") && target.type != mod.NPCType("Mauler") && target.type != mod.NPCType("EidolonWyrmHead") && + target.type != mod.NPCType("EidolonWyrmHeadHuge") && target.type != mod.NPCType("ColossalSquid") && target.type != NPCID.DD2Betsy) + { + return true; + } + return false; + } #endregion #region Old Duke Spawn diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index b05ebe4ef6..00bfb0ecf1 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -10,24 +10,24 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs { public class CalamityGlobalNPCLoot : GlobalNPC - { - #region PreNPCLoot - public override bool PreNPCLoot(NPC npc) - { - if (CalamityWorld.bossRushActive) + { + #region PreNPCLoot + public override bool PreNPCLoot(NPC npc) + { + if (CalamityWorld.bossRushActive) { return BossRushLootCancel(npc, mod); } bool abyssLootCancel = AbyssLootCancel(npc, mod); - if (abyssLootCancel) + if (abyssLootCancel) { return false; } if (CalamityWorld.revenge) - { - if (npc.type == NPCID.Probe || npc.type == NPCID.ServantofCthulhu) + { + if (npc.type == NPCID.Probe || npc.type == NPCID.ServantofCthulhu) { return false; } @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs // Determine whether this NPC is the second Twin killed in a fight, regardless of which Twin it is. bool lastTwinStanding = false; - if (npc.type == NPCID.Retinazer) + if (npc.type == NPCID.Retinazer) { lastTwinStanding = !NPC.AnyNPCs(NPCID.Spazmatism); } @@ -46,61 +46,61 @@ namespace CalamityMod.NPCs // Mechanical Bosses' combined lore item bool mechLore = !NPC.downedMechBossAny && (lastTwinStanding || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeMechs"), true, mechLore); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeMechs"), true, mechLore); - if (npc.type == NPCID.KingSlime) - { - // Drop a huge spray of Gel items - int minGel = Main.expertMode ? 90 : 60; - int maxGel = Main.expertMode ? 120 : 80; - DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 2); + if (npc.type == NPCID.KingSlime) + { + // Drop a huge spray of Gel items + int minGel = Main.expertMode ? 90 : 60; + int maxGel = Main.expertMode ? 120 : 80; + DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 2); - // King Slime doesn't have a lore item yet - DropHelper.DropResidentEvilAmmo(npc, NPC.downedSlimeKing, 2, 0, 0); - } - else if (npc.type == NPCID.EyeofCthulhu) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeEyeofCthulhu"), true, !NPC.downedBoss1); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss1, 2, 0, 0); - } - else if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeCorruption"), true, !WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeEaterofWorlds"), true, !WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeCrimson"), true, WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBrainofCthulhu"), true, WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss2, 2, 0, 0); - } - else if (npc.type == NPCID.QueenBee) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeQueenBee"), true, !NPC.downedQueenBee); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedQueenBee, 2, 0, 0); - } - else if (npc.type == NPCID.SkeletronHead) - { + // King Slime doesn't have a lore item yet + DropHelper.DropResidentEvilAmmo(npc, NPC.downedSlimeKing, 2, 0, 0); + } + else if (npc.type == NPCID.EyeofCthulhu) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeEyeofCthulhu"), true, !NPC.downedBoss1); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss1, 2, 0, 0); + } + else if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeCorruption"), true, !WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeEaterofWorlds"), true, !WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeCrimson"), true, WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBrainofCthulhu"), true, WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss2, 2, 0, 0); + } + else if (npc.type == NPCID.QueenBee) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeQueenBee"), true, !NPC.downedQueenBee); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedQueenBee, 2, 0, 0); + } + else if (npc.type == NPCID.SkeletronHead) + { DropHelper.DropItemCondition(npc, mod.ItemType("ClothiersWrath"), !Main.expertMode, DropHelper.RareVariantDropRateInt, 1, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeSkeletron"), true, !NPC.downedBoss3); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss3, 3, 1, 0); - } - else if (npc.type == NPCID.WallofFlesh) - { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeSkeletron"), true, !NPC.downedBoss3); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss3, 3, 1, 0); + } + else if (npc.type == NPCID.WallofFlesh) + { DropHelper.DropItemCondition(npc, mod.ItemType("MLGRune"), !Main.expertMode); // Demon Trophy DropHelper.DropItemCondition(npc, mod.ItemType("Meowthrower"), !Main.expertMode, 5, 1, 1); DropHelper.DropItemCondition(npc, mod.ItemType("BlackHawkRemote"), !Main.expertMode, 5, 1, 1); DropHelper.DropItemCondition(npc, mod.ItemType("RogueEmblem"), !Main.expertMode, 8, 1, 1); - DropHelper.DropItemChance(npc, mod.ItemType("IbarakiBox"), !Main.hardMode, Main.hardMode ? 0.1f : 1f); // 100% chance on first kill, 10% chance afterwards + DropHelper.DropItemChance(npc, mod.ItemType("IbarakiBox"), !Main.hardMode, Main.hardMode ? 0.1f : 1f); // 100% chance on first kill, 10% chance afterwards DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 5, ItemID.CorruptionKey, ItemID.CrimsonKey); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeUnderworld"), true, !Main.hardMode); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeWallofFlesh"), true, !Main.hardMode); - DropHelper.DropResidentEvilAmmo(npc, Main.hardMode, 3, 1, 0); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeUnderworld"), true, !Main.hardMode); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeWallofFlesh"), true, !Main.hardMode); + DropHelper.DropResidentEvilAmmo(npc, Main.hardMode, 3, 1, 0); - // First kill text (this is not a loot function) - if (!Main.hardMode) - { - string key2 = "Mods.CalamityMod.UglyBossText"; - Color messageColor2 = Color.Aquamarine; - if (Main.netMode == NetmodeID.SinglePlayer) + // First kill text (this is not a loot function) + if (!Main.hardMode) + { + string key2 = "Mods.CalamityMod.UglyBossText"; + Color messageColor2 = Color.Aquamarine; + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key2), messageColor2); } @@ -109,29 +109,29 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); } } - } - else if (lastTwinStanding) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeTwins"), true, !NPC.downedMechBoss2); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss2, 4, 2, 1); - } - else if (npc.type == NPCID.TheDestroyer) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeDestroyer"), true, !NPC.downedMechBoss1); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss1, 4, 2, 1); - } - else if (npc.type == NPCID.SkeletronPrime) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeSkeletronPrime"), true, !NPC.downedMechBoss3); + } + else if (lastTwinStanding) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeTwins"), true, !NPC.downedMechBoss2); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss2, 4, 2, 1); + } + else if (npc.type == NPCID.TheDestroyer) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeDestroyer"), true, !NPC.downedMechBoss1); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss1, 4, 2, 1); + } + else if (npc.type == NPCID.SkeletronPrime) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeSkeletronPrime"), true, !NPC.downedMechBoss3); DropHelper.DropItemCondition(npc, mod.ItemType("GoldBurdenBreaker"), true, (npc.ai[1] == 2f && CalamityWorld.revenge)); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss3, 4, 2, 1); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss3, 4, 2, 1); - // If neither Prime nor Brimmy have been killed, show this text (not a loot function) - string key = "Mods.CalamityMod.SteelSkullBossText"; - Color messageColor = Color.Crimson; - if (!NPC.downedMechBoss3 && !CalamityWorld.downedBrimstoneElemental) - { - if (Main.netMode == NetmodeID.SinglePlayer) + // If neither Prime nor Brimmy have been killed, show this text (not a loot function) + string key = "Mods.CalamityMod.SteelSkullBossText"; + Color messageColor = Color.Crimson; + if (!NPC.downedMechBoss3 && !CalamityWorld.downedBrimstoneElemental) + { + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -140,22 +140,22 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - } - else if (npc.type == NPCID.Plantera) - { + } + else if (npc.type == NPCID.Plantera) + { DropHelper.DropItemCondition(npc, ItemID.JungleKey, !Main.expertMode, 5, 1, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgePlantera"), true, !NPC.downedPlantBoss); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgePlantera"), true, !NPC.downedPlantBoss); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); - // Spawn Perennial Ore if Plantera has never been killed - if (!NPC.downedPlantBoss) - { - string key2 = "Mods.CalamityMod.PlantOreText"; - Color messageColor2 = Color.GreenYellow; + // Spawn Perennial Ore if Plantera has never been killed + if (!NPC.downedPlantBoss) + { + string key2 = "Mods.CalamityMod.PlantOreText"; + Color messageColor2 = Color.GreenYellow; - WorldGenerationMethods.SpawnOre(mod.TileType("PerennialOre"), 12E-05, .5f, .7f); + WorldGenerationMethods.SpawnOre(mod.TileType("PerennialOre"), 12E-05, .5f, .7f); - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key2), messageColor2); } @@ -165,13 +165,13 @@ namespace CalamityMod.NPCs } } - // Awaken the Abyss if neither Plantera or Calamitas has been killed - if (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas) - { - string key = "Mods.CalamityMod.PlantBossText"; - Color messageColor = Color.RoyalBlue; + // Awaken the Abyss if neither Plantera or Calamitas has been killed + if (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas) + { + string key = "Mods.CalamityMod.PlantBossText"; + Color messageColor = Color.RoyalBlue; - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); } @@ -185,61 +185,61 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - } - else if (npc.type == NPCID.Golem) - { - DropHelper.DropItemCondition(npc, ItemID.Picksaw, true, !NPC.downedGolemBoss); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeGolem"), true, !NPC.downedGolemBoss); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedGolemBoss, 4, 2, 1); + } + else if (npc.type == NPCID.Golem) + { + DropHelper.DropItemCondition(npc, ItemID.Picksaw, true, !NPC.downedGolemBoss); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeGolem"), true, !NPC.downedGolemBoss); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedGolemBoss, 4, 2, 1); - // If Golem has never been killed, send messages about PBG and Ravager - if (!NPC.downedGolemBoss) - { - string key = "Mods.CalamityMod.BabyBossText"; - Color messageColor = Color.Lime; - string key2 = "Mods.CalamityMod.BabyBossText2"; - Color messageColor2 = Color.Yellow; + // If Golem has never been killed, send messages about PBG and Ravager + if (!NPC.downedGolemBoss) + { + string key = "Mods.CalamityMod.BabyBossText"; + Color messageColor = Color.Lime; + string key2 = "Mods.CalamityMod.BabyBossText2"; + Color messageColor2 = Color.Yellow; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - } - else if (npc.type == NPCID.DD2Betsy && !CalamityWorld.downedBetsy) - { - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBetsy, 4, 2, 1); + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + } + else if (npc.type == NPCID.DD2Betsy && !CalamityWorld.downedBetsy) + { + DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBetsy, 4, 2, 1); - // Mark Betsy as dead (Vanilla does not keep track of her) - CalamityWorld.downedBetsy = true; - CalamityMod.UpdateServerBoolean(); - } - else if (npc.type == NPCID.DukeFishron) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeDukeFishron"), true, !NPC.downedFishron); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); - } - else if (npc.type == NPCID.CultistBoss) - { - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeLunaticCultist"), true, !NPC.downedAncientCultist); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedAncientCultist, 4, 2, 1); + // Mark Betsy as dead (Vanilla does not keep track of her) + CalamityWorld.downedBetsy = true; + CalamityMod.UpdateServerBoolean(); + } + else if (npc.type == NPCID.DukeFishron) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeDukeFishron"), true, !NPC.downedFishron); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); + } + else if (npc.type == NPCID.CultistBoss) + { + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeLunaticCultist"), true, !NPC.downedAncientCultist); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedAncientCultist, 4, 2, 1); - // Blood Moon lore item - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBloodMoon"), true, Main.bloodMoon); + // Blood Moon lore item + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeBloodMoon"), true, Main.bloodMoon); - // Deus text (this is not a loot function) - if (!NPC.downedAncientCultist) - { - string key = "Mods.CalamityMod.DeusText"; - Color messageColor = Color.Gold; + // Deus text (this is not a loot function) + if (!NPC.downedAncientCultist) + { + string key = "Mods.CalamityMod.DeusText"; + Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -248,241 +248,241 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - } - else if (npc.type == NPCID.MoonLordCore) - { + } + else if (npc.type == NPCID.MoonLordCore) + { DropHelper.DropItemCondition(npc, mod.ItemType("MLGRune2"), true, !Main.expertMode); DropHelper.DropItemCondition(npc, mod.ItemType("UtensilPoker"), !Main.expertMode, 9, 1, 1); DropHelper.DropItemCondition(npc, mod.ItemType("GrandDad"), !Main.expertMode, DropHelper.RareVariantDropRateInt, 1, 1); DropHelper.DropItemCondition(npc, mod.ItemType("Infinity"), !Main.expertMode, DropHelper.RareVariantDropRateInt, 1, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeMoonLord"), true, !NPC.downedMoonlord); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMoonlord, 5, 2, 1); + DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeMoonLord"), true, !NPC.downedMoonlord); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMoonlord, 5, 2, 1); - string key = "Mods.CalamityMod.MoonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.MoonBossText2"; - Color messageColor2 = Color.Violet; - string key3 = "Mods.CalamityMod.MoonBossText3"; - Color messageColor3 = Color.Crimson; - string key4 = "Mods.CalamityMod.ProfanedBossText2"; - Color messageColor4 = Color.Cyan; - string key5 = "Mods.CalamityMod.FutureOreText"; - Color messageColor5 = Color.LightGray; + string key = "Mods.CalamityMod.MoonBossText"; + Color messageColor = Color.Orange; + string key2 = "Mods.CalamityMod.MoonBossText2"; + Color messageColor2 = Color.Violet; + string key3 = "Mods.CalamityMod.MoonBossText3"; + Color messageColor3 = Color.Crimson; + string key4 = "Mods.CalamityMod.ProfanedBossText2"; + Color messageColor4 = Color.Cyan; + string key5 = "Mods.CalamityMod.FutureOreText"; + Color messageColor5 = Color.LightGray; - // Spawn Exodium and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet - if (!NPC.downedMoonlord) - { - WorldGenerationMethods.SpawnOre(mod.TileType("ExodiumOre"), 12E-05, .01f, .07f); + // Spawn Exodium and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet + if (!NPC.downedMoonlord) + { + WorldGenerationMethods.SpawnOre(mod.TileType("ExodiumOre"), 12E-05, .01f, .07f); - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - Main.NewText(Language.GetTextValue(key4), messageColor4); - Main.NewText(Language.GetTextValue(key5), messageColor5); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); - } - } - } - - return true; - } - #endregion - - #region Boss Rush Loot Cancel - private bool BossRushLootCancel(NPC npc, Mod mod) - { - if (npc.type == mod.NPCType("ProfanedGuardianBoss")) - { - CalamityWorld.bossRushStage = 7; - DespawnProj(); - } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - int count = 0; - for (int j = 0; j < Main.maxNPCs; j++) - { - if (Main.npc[j].active && (Main.npc[j].type == NPCID.EaterofWorldsHead || Main.npc[j].type == NPCID.EaterofWorldsBody || Main.npc[j].type == NPCID.EaterofWorldsTail)) - { - count++; - break; - } - } - - if (count < 4) - { - CalamityWorld.bossRushStage = 8; - DespawnProj(); - } - } - else if (npc.type == mod.NPCType("Astrageldon")) - { - CalamityWorld.bossRushStage = 9; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Bumblefuck")) - { - CalamityWorld.bossRushStage = 12; - DespawnProj(); - } - else if (npc.type == mod.NPCType("HiveMindP2")) - { - CalamityWorld.bossRushStage = 14; - DespawnProj(); - } - else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) - { - CalamityWorld.bossRushStage = 16; - DespawnProj(); - } - else if (npc.type == mod.NPCType("AquaticScourgeHead")) - { - CalamityWorld.bossRushStage = 17; - DespawnProj(); - } - else if (npc.type == mod.NPCType("DesertScourgeHead")) - { - CalamityWorld.bossRushStage = 18; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CrabulonIdle")) - { - CalamityWorld.bossRushStage = 20; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CeaselessVoid")) - { - CalamityWorld.bossRushStage = 22; - DespawnProj(); - } - else if (npc.type == mod.NPCType("PerforatorHive")) - { - CalamityWorld.bossRushStage = 23; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Cryogen")) - { - CalamityWorld.bossRushStage = 24; - DespawnProj(); - } - else if (npc.type == mod.NPCType("BrimstoneElemental")) - { - CalamityWorld.bossRushStage = 25; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CosmicWraith")) - { - CalamityWorld.bossRushStage = 26; - DespawnProj(); + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + Main.NewText(Language.GetTextValue(key3), messageColor3); + Main.NewText(Language.GetTextValue(key4), messageColor4); + Main.NewText(Language.GetTextValue(key5), messageColor5); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); + } + } } - else if (npc.type == mod.NPCType("ScavengerBody")) - { - CalamityWorld.bossRushStage = 27; - DespawnProj(); - } - else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) - { - CalamityWorld.bossRushStage = 30; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Polterghast")) - { - CalamityWorld.bossRushStage = 31; - DespawnProj(); - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath")) - { - CalamityWorld.bossRushStage = 32; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CalamitasRun3")) - { - CalamityWorld.bossRushStage = 33; - DespawnProj(); + + return true; + } + #endregion + + #region Boss Rush Loot Cancel + private bool BossRushLootCancel(NPC npc, Mod mod) + { + if (npc.type == mod.NPCType("ProfanedGuardianBoss")) + { + CalamityWorld.bossRushStage = 7; + DespawnProj(); } - else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) - { - int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); - if (!NPC.AnyNPCs(bossType)) - { - CalamityWorld.bossRushStage = 34; - DespawnProj(); - } - } - else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) - { - if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && - !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - CalamityWorld.bossRushStage = 35; - DespawnProj(); - } - else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - CalamityWorld.bossRushStage = 35; - DespawnProj(); - } - else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) - { - CalamityWorld.bossRushStage = 35; - DespawnProj(); - } - } - else if (npc.type == mod.NPCType("Providence")) - { - CalamityWorld.bossRushStage = 36; - DespawnProj(); + else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + int count = 0; + for (int j = 0; j < Main.maxNPCs; j++) + { + if (Main.npc[j].active && (Main.npc[j].type == NPCID.EaterofWorldsHead || Main.npc[j].type == NPCID.EaterofWorldsBody || Main.npc[j].type == NPCID.EaterofWorldsTail)) + { + count++; + break; + } + } - string key = "Mods.CalamityMod.BossRushTierFourEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (npc.type == mod.NPCType("SupremeCalamitas")) - { - CalamityWorld.bossRushStage = 37; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Yharon")) - { - CalamityWorld.bossRushStage = 38; - DespawnProj(); - } - else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) - { - DropHelper.DropItem(npc, mod.ItemType("Rock"), true); - CalamityWorld.bossRushStage = 0; - DespawnProj(); - CalamityWorld.bossRushActive = false; + if (count < 4) + { + CalamityWorld.bossRushStage = 8; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("Astrageldon")) + { + CalamityWorld.bossRushStage = 9; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Bumblefuck")) + { + CalamityWorld.bossRushStage = 12; + DespawnProj(); + } + else if (npc.type == mod.NPCType("HiveMindP2")) + { + CalamityWorld.bossRushStage = 14; + DespawnProj(); + } + else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) + { + CalamityWorld.bossRushStage = 16; + DespawnProj(); + } + else if (npc.type == mod.NPCType("AquaticScourgeHead")) + { + CalamityWorld.bossRushStage = 17; + DespawnProj(); + } + else if (npc.type == mod.NPCType("DesertScourgeHead")) + { + CalamityWorld.bossRushStage = 18; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CrabulonIdle")) + { + CalamityWorld.bossRushStage = 20; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CeaselessVoid")) + { + CalamityWorld.bossRushStage = 22; + DespawnProj(); + } + else if (npc.type == mod.NPCType("PerforatorHive")) + { + CalamityWorld.bossRushStage = 23; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Cryogen")) + { + CalamityWorld.bossRushStage = 24; + DespawnProj(); + } + else if (npc.type == mod.NPCType("BrimstoneElemental")) + { + CalamityWorld.bossRushStage = 25; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CosmicWraith")) + { + CalamityWorld.bossRushStage = 26; + DespawnProj(); + } + else if (npc.type == mod.NPCType("ScavengerBody")) + { + CalamityWorld.bossRushStage = 27; + DespawnProj(); + } + else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) + { + CalamityWorld.bossRushStage = 30; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Polterghast")) + { + CalamityWorld.bossRushStage = 31; + DespawnProj(); + } + else if (npc.type == mod.NPCType("PlaguebringerGoliath")) + { + CalamityWorld.bossRushStage = 32; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CalamitasRun3")) + { + CalamityWorld.bossRushStage = 33; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) + { + int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); + if (!NPC.AnyNPCs(bossType)) + { + CalamityWorld.bossRushStage = 34; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) + { + if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && + !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + CalamityWorld.bossRushStage = 35; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + CalamityWorld.bossRushStage = 35; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) + { + CalamityWorld.bossRushStage = 35; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("Providence")) + { + CalamityWorld.bossRushStage = 36; + DespawnProj(); - CalamityMod.UpdateServerBoolean(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); - netMessage.Send(); - } + string key = "Mods.CalamityMod.BossRushTierFourEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (npc.type == mod.NPCType("SupremeCalamitas")) + { + CalamityWorld.bossRushStage = 37; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Yharon")) + { + CalamityWorld.bossRushStage = 38; + DespawnProj(); + } + else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) + { + DropHelper.DropItem(npc, mod.ItemType("Rock"), true); + CalamityWorld.bossRushStage = 0; + DespawnProj(); + CalamityWorld.bossRushActive = false; - string key = "Mods.CalamityMod.BossRushTierFiveEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) + CalamityMod.UpdateServerBoolean(); + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(CalamityWorld.bossRushStage); + netMessage.Send(); + } + + string key = "Mods.CalamityMod.BossRushTierFiveEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -492,47 +492,47 @@ namespace CalamityMod.NPCs } return false; - } + } - switch (npc.type) - { - case NPCID.QueenBee: - CalamityWorld.bossRushStage = 1; - DespawnProj(); - break; + switch (npc.type) + { + case NPCID.QueenBee: + CalamityWorld.bossRushStage = 1; + DespawnProj(); + break; - case NPCID.BrainofCthulhu: - CalamityWorld.bossRushStage = 2; - DespawnProj(); - break; + case NPCID.BrainofCthulhu: + CalamityWorld.bossRushStage = 2; + DespawnProj(); + break; - case NPCID.KingSlime: - CalamityWorld.bossRushStage = 3; - DespawnProj(); - break; + case NPCID.KingSlime: + CalamityWorld.bossRushStage = 3; + DespawnProj(); + break; - case NPCID.EyeofCthulhu: - CalamityWorld.bossRushStage = 4; - DespawnProj(); - break; + case NPCID.EyeofCthulhu: + CalamityWorld.bossRushStage = 4; + DespawnProj(); + break; - case NPCID.SkeletronPrime: - CalamityWorld.bossRushStage = 5; - DespawnProj(); - break; + case NPCID.SkeletronPrime: + CalamityWorld.bossRushStage = 5; + DespawnProj(); + break; - case NPCID.Golem: - CalamityWorld.bossRushStage = 6; - DespawnProj(); - break; + case NPCID.Golem: + CalamityWorld.bossRushStage = 6; + DespawnProj(); + break; - case NPCID.TheDestroyer: - CalamityWorld.bossRushStage = 10; - DespawnProj(); + case NPCID.TheDestroyer: + CalamityWorld.bossRushStage = 10; + DespawnProj(); - string key = "Mods.CalamityMod.BossRushTierOneEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) + string key = "Mods.CalamityMod.BossRushTierOneEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -543,33 +543,33 @@ namespace CalamityMod.NPCs break; - case NPCID.Spazmatism: - CalamityWorld.bossRushStage = 11; - DespawnProj(); - break; + case NPCID.Spazmatism: + CalamityWorld.bossRushStage = 11; + DespawnProj(); + break; - case NPCID.Retinazer: - CalamityWorld.bossRushStage = 11; - DespawnProj(); - break; + case NPCID.Retinazer: + CalamityWorld.bossRushStage = 11; + DespawnProj(); + break; - case NPCID.WallofFlesh: - CalamityWorld.bossRushStage = 13; - DespawnProj(); - break; + case NPCID.WallofFlesh: + CalamityWorld.bossRushStage = 13; + DespawnProj(); + break; - case NPCID.SkeletronHead: - CalamityWorld.bossRushStage = 15; - DespawnProj(); - break; + case NPCID.SkeletronHead: + CalamityWorld.bossRushStage = 15; + DespawnProj(); + break; - case NPCID.CultistBoss: - CalamityWorld.bossRushStage = 19; - DespawnProj(); + case NPCID.CultistBoss: + CalamityWorld.bossRushStage = 19; + DespawnProj(); - string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; - Color messageColor2 = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) + string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; + Color messageColor2 = Color.LightCoral; + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key2), messageColor2); } @@ -580,99 +580,99 @@ namespace CalamityMod.NPCs break; - case NPCID.Plantera: - CalamityWorld.bossRushStage = 21; - DespawnProj(); - break; + case NPCID.Plantera: + CalamityWorld.bossRushStage = 21; + DespawnProj(); + break; - case NPCID.DukeFishron: - CalamityWorld.bossRushStage = 28; - DespawnProj(); + case NPCID.DukeFishron: + CalamityWorld.bossRushStage = 28; + DespawnProj(); - string key3 = "Mods.CalamityMod.BossRushTierThreeEndText"; - Color messageColor3 = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key3), messageColor3); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - } + string key3 = "Mods.CalamityMod.BossRushTierThreeEndText"; + Color messageColor3 = Color.LightCoral; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key3), messageColor3); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); + } - break; + break; - case NPCID.MoonLordCore: - CalamityWorld.bossRushStage = 29; - DespawnProj(); - break; + case NPCID.MoonLordCore: + CalamityWorld.bossRushStage = 29; + DespawnProj(); + break; - default: - break; - } + default: + break; + } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); - netMessage.Send(); - } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(CalamityWorld.bossRushStage); + netMessage.Send(); + } - return false; - } - #endregion + return false; + } + #endregion - #region Abyss Loot Cancel - private bool AbyssLootCancel(NPC npc, Mod mod) - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmY = y - 250; - int abyssChasmX = CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); - bool abyssPosX = false; - bool abyssPosY = (double)(npc.position.Y / 16f) <= abyssChasmY; + #region Abyss Loot Cancel + private bool AbyssLootCancel(NPC npc, Mod mod) + { + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmY = y - 250; + int abyssChasmX = CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); + bool abyssPosX = false; + bool abyssPosY = (double)(npc.position.Y / 16f) <= abyssChasmY; - if (CalamityWorld.abyssSide) - { - if ((double)(npc.position.X / 16f) < abyssChasmX + 80) + if (CalamityWorld.abyssSide) + { + if ((double)(npc.position.X / 16f) < abyssChasmX + 80) { abyssPosX = true; } } - else - { - if ((double)(npc.position.X / 16f) > abyssChasmX - 80) + else + { + if ((double)(npc.position.X / 16f) > abyssChasmX - 80) { abyssPosX = true; } } - bool hurtByAbyss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && - (((npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && - abyssPosY && abyssPosX) || CalamityWorld.abyssTiles > 200) && !npc.buffImmune[mod.BuffType("CrushDepth")]); + bool hurtByAbyss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && + (((npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && + abyssPosY && abyssPosX) || CalamityWorld.abyssTiles > 200) && !npc.buffImmune[mod.BuffType("CrushDepth")]); - return hurtByAbyss; - } - #endregion + return hurtByAbyss; + } + #endregion - #region NPCLoot - public override void NPCLoot(NPC npc) - { - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.DraedonMayhem) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - CalamityGlobalNPC.DraedonMayhem = false; - CalamityMod.UpdateServerBoolean(); - } - } + #region NPCLoot + public override void NPCLoot(NPC npc) + { + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.DraedonMayhem) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + CalamityGlobalNPC.DraedonMayhem = false; + CalamityMod.UpdateServerBoolean(); + } + } - RareVariants(npc, mod); + RareVariants(npc, mod); - if (CalamityWorld.defiled) + if (CalamityWorld.defiled) { DefiledLoot(npc, mod); } @@ -683,309 +683,309 @@ namespace CalamityMod.NPCs } if (npc.boss && revenge) - { - if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("Siren") && - npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && - npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("DevourerofGodsHead") && - npc.type != mod.NPCType("DevourerofGodsBody") && npc.type != mod.NPCType("DevourerofGodsTail")) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("Siren") && + npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && + npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("DevourerofGodsHead") && + npc.type != mod.NPCType("DevourerofGodsBody") && npc.type != mod.NPCType("DevourerofGodsTail")) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) { Main.player[Main.myPlayer].Calamity().adrenaline = 0; } } - } - } + } + } - CheckBossSpawn(npc, mod); - ArmorSetLoot(npc, mod); - RareLoot(npc, mod); - CommonLoot(npc, mod); - BossLoot(npc, mod); - } - #endregion + CheckBossSpawn(npc, mod); + ArmorSetLoot(npc, mod); + RareLoot(npc, mod); + CommonLoot(npc, mod); + BossLoot(npc, mod); + } + #endregion - #region Rare Variants - private void RareVariants(NPC npc, Mod mod) - { - switch (npc.type) - { - case NPCID.BloodZombie: - DropHelper.DropItemCondition(npc, mod.ItemType("Carnage"), NPC.downedBoss3 && !npc.SpawnedFromStatue, 200, 1, 1); - break; + #region Rare Variants + private void RareVariants(NPC npc, Mod mod) + { + switch (npc.type) + { + case NPCID.BloodZombie: + DropHelper.DropItemCondition(npc, mod.ItemType("Carnage"), NPC.downedBoss3 && !npc.SpawnedFromStatue, 200, 1, 1); + break; - case NPCID.TacticalSkeleton: - DropHelper.DropItemChance(npc, mod.ItemType("TrueConferenceCall"), 200); - break; + case NPCID.TacticalSkeleton: + DropHelper.DropItemChance(npc, mod.ItemType("TrueConferenceCall"), 200); + break; - case NPCID.DesertBeast: - DropHelper.DropItemChance(npc, mod.ItemType("EvilSmasher"), 200); - break; + case NPCID.DesertBeast: + DropHelper.DropItemChance(npc, mod.ItemType("EvilSmasher"), 200); + break; - case NPCID.DungeonSpirit: - DropHelper.DropItemChance(npc, mod.ItemType("PearlGod"), 200); - break; + case NPCID.DungeonSpirit: + DropHelper.DropItemChance(npc, mod.ItemType("PearlGod"), 200); + break; - case NPCID.RuneWizard: - DropHelper.DropItemChance(npc, mod.ItemType("EyeofMagnus"), 10); - break; + case NPCID.RuneWizard: + DropHelper.DropItemChance(npc, mod.ItemType("EyeofMagnus"), 10); + break; - case NPCID.Mimic: - DropHelper.DropItemCondition(npc, mod.ItemType("TheBee"), !npc.SpawnedFromStatue, 100, 1, 1); - break; + case NPCID.Mimic: + DropHelper.DropItemCondition(npc, mod.ItemType("TheBee"), !npc.SpawnedFromStatue, 100, 1, 1); + break; default: break; } - } - #endregion + } + #endregion - #region Defiled Loot - private void DefiledLoot(NPC npc, Mod mod) - { - switch (npc.type) - { - case NPCID.Werewolf: - DropHelper.DropItemChance(npc, ItemID.MoonCharm, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, DropHelper.DefiledDropRateInt); - break; + #region Defiled Loot + private void DefiledLoot(NPC npc, Mod mod) + { + switch (npc.type) + { + case NPCID.Werewolf: + DropHelper.DropItemChance(npc, ItemID.MoonCharm, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, DropHelper.DefiledDropRateInt); + break; - case NPCID.AnglerFish: - DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, DropHelper.DefiledDropRateInt); - break; + case NPCID.AnglerFish: + DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, DropHelper.DefiledDropRateInt); + break; - case NPCID.DesertBeast: - DropHelper.DropItemChance(npc, ItemID.AncientHorn, DropHelper.DefiledDropRateInt); - break; + case NPCID.DesertBeast: + DropHelper.DropItemChance(npc, ItemID.AncientHorn, DropHelper.DefiledDropRateInt); + break; - case NPCID.ArmoredSkeleton: - DropHelper.DropItemChance(npc, ItemID.BeamSword, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.ArmorPolish, DropHelper.DefiledDropRateInt); - break; + case NPCID.ArmoredSkeleton: + DropHelper.DropItemChance(npc, ItemID.BeamSword, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.ArmorPolish, DropHelper.DefiledDropRateInt); + break; - case NPCID.Clown: - DropHelper.DropItemChance(npc, ItemID.Bananarang, DropHelper.DefiledDropRateInt); - break; + case NPCID.Clown: + DropHelper.DropItemChance(npc, ItemID.Bananarang, DropHelper.DefiledDropRateInt); + break; - case NPCID.ToxicSludge: - DropHelper.DropItemChance(npc, ItemID.Bezoar, DropHelper.DefiledDropRateInt); - break; + case NPCID.ToxicSludge: + DropHelper.DropItemChance(npc, ItemID.Bezoar, DropHelper.DefiledDropRateInt); + break; - case NPCID.EyeofCthulhu: - DropHelper.DropItemChance(npc, ItemID.Binoculars, DropHelper.DefiledDropRateInt); - break; + case NPCID.EyeofCthulhu: + DropHelper.DropItemChance(npc, ItemID.Binoculars, DropHelper.DefiledDropRateInt); + break; - case NPCID.WanderingEye: - DropHelper.DropItemChance(npc, ItemID.BlackLens, DropHelper.DefiledDropRateInt); - break; + case NPCID.WanderingEye: + DropHelper.DropItemChance(npc, ItemID.BlackLens, DropHelper.DefiledDropRateInt); + break; - case NPCID.CorruptSlime: - DropHelper.DropItemChance(npc, ItemID.Blindfold, DropHelper.DefiledDropRateInt); - break; + case NPCID.CorruptSlime: + DropHelper.DropItemChance(npc, ItemID.Blindfold, DropHelper.DefiledDropRateInt); + break; - // This is all the random skeletons in the hardmode dungeon - case 269: - case 270: - case 271: - case 272: - case 273: - case 274: - case 275: - case 276: - case 277: - case 278: - case 279: - case 280: - DropHelper.DropItemChance(npc, ItemID.Keybrand, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.BoneFeather, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.MagnetSphere, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.WispinaBottle, DropHelper.DefiledDropRateInt); - break; + // This is all the random skeletons in the hardmode dungeon + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + DropHelper.DropItemChance(npc, ItemID.Keybrand, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.BoneFeather, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.MagnetSphere, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.WispinaBottle, DropHelper.DefiledDropRateInt); + break; - case NPCID.UndeadMiner: - DropHelper.DropItemChance(npc, ItemID.BonePickaxe, DropHelper.DefiledDropRateInt); - break; + case NPCID.UndeadMiner: + DropHelper.DropItemChance(npc, ItemID.BonePickaxe, DropHelper.DefiledDropRateInt); + break; - case NPCID.ScutlixRider: - DropHelper.DropItemChance(npc, ItemID.BrainScrambler, DropHelper.DefiledDropRateInt); - break; + case NPCID.ScutlixRider: + DropHelper.DropItemChance(npc, ItemID.BrainScrambler, DropHelper.DefiledDropRateInt); + break; - case NPCID.Vampire: - DropHelper.DropItemChance(npc, ItemID.BrokenBatWing, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.MoonStone, DropHelper.DefiledDropRateInt); - break; + case NPCID.Vampire: + DropHelper.DropItemChance(npc, ItemID.BrokenBatWing, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.MoonStone, DropHelper.DefiledDropRateInt); + break; - case NPCID.CaveBat: - DropHelper.DropItemChance(npc, ItemID.ChainKnife, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.DepthMeter, DropHelper.DefiledDropRateInt); - break; + case NPCID.CaveBat: + DropHelper.DropItemChance(npc, ItemID.ChainKnife, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.DepthMeter, DropHelper.DefiledDropRateInt); + break; - case NPCID.DarkCaster: - DropHelper.DropItemChance(npc, ItemID.ClothierVoodooDoll, DropHelper.DefiledDropRateInt); - break; + case NPCID.DarkCaster: + DropHelper.DropItemChance(npc, ItemID.ClothierVoodooDoll, DropHelper.DefiledDropRateInt); + break; - case NPCID.PirateCaptain: - DropHelper.DropItemChance(npc, ItemID.CoinGun, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.DiscountCard, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.Cutlass, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.LuckyCoin, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.PirateStaff, DropHelper.DefiledDropRateInt); - break; + case NPCID.PirateCaptain: + DropHelper.DropItemChance(npc, ItemID.CoinGun, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.DiscountCard, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.Cutlass, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.LuckyCoin, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.PirateStaff, DropHelper.DefiledDropRateInt); + break; - case NPCID.Reaper: - DropHelper.DropItemChance(npc, ItemID.DeathSickle, DropHelper.DefiledDropRateInt); - break; + case NPCID.Reaper: + DropHelper.DropItemChance(npc, ItemID.DeathSickle, DropHelper.DefiledDropRateInt); + break; - case NPCID.Demon: - DropHelper.DropItemChance(npc, ItemID.DemonScythe, DropHelper.DefiledDropRateInt); - break; + case NPCID.Demon: + DropHelper.DropItemChance(npc, ItemID.DemonScythe, DropHelper.DefiledDropRateInt); + break; - case NPCID.DesertDjinn: - DropHelper.DropItemChance(npc, ItemID.DjinnLamp, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.DjinnsCurse, DropHelper.DefiledDropRateInt); - break; + case NPCID.DesertDjinn: + DropHelper.DropItemChance(npc, ItemID.DjinnLamp, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.DjinnsCurse, DropHelper.DefiledDropRateInt); + break; - case NPCID.Shark: - DropHelper.DropItemChance(npc, ItemID.DivingHelmet, DropHelper.DefiledDropRateInt); - break; + case NPCID.Shark: + DropHelper.DropItemChance(npc, ItemID.DivingHelmet, DropHelper.DefiledDropRateInt); + break; - case NPCID.Pixie: - case NPCID.Wraith: - case NPCID.Mummy: - DropHelper.DropItemChance(npc, ItemID.FastClock, DropHelper.DefiledDropRateInt); - break; + case NPCID.Pixie: + case NPCID.Wraith: + case NPCID.Mummy: + DropHelper.DropItemChance(npc, ItemID.FastClock, DropHelper.DefiledDropRateInt); + break; - case NPCID.RedDevil: - DropHelper.DropItemChance(npc, ItemID.FireFeather, DropHelper.DefiledDropRateInt); - break; + case NPCID.RedDevil: + DropHelper.DropItemChance(npc, ItemID.FireFeather, DropHelper.DefiledDropRateInt); + break; - case NPCID.IceElemental: - case NPCID.IcyMerman: - DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.FrostStaff, DropHelper.DefiledDropRateInt); - break; + case NPCID.IceElemental: + case NPCID.IcyMerman: + DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.FrostStaff, DropHelper.DefiledDropRateInt); + break; - case NPCID.ArmoredViking: - DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); - break; + case NPCID.ArmoredViking: + DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); + break; - case NPCID.IceTortoise: - DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.FrozenTurtleShell, DropHelper.DefiledDropRateInt); - break; + case NPCID.IceTortoise: + DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.FrozenTurtleShell, DropHelper.DefiledDropRateInt); + break; - case NPCID.Harpy: - DropHelper.DropItemCondition(npc, ItemID.GiantHarpyFeather, Main.hardMode, DropHelper.DefiledDropRateFloat); - break; + case NPCID.Harpy: + DropHelper.DropItemCondition(npc, ItemID.GiantHarpyFeather, Main.hardMode, DropHelper.DefiledDropRateFloat); + break; - case NPCID.QueenBee: - DropHelper.DropItemChance(npc, ItemID.HoneyedGoggles, DropHelper.DefiledDropRateInt); - break; + case NPCID.QueenBee: + DropHelper.DropItemChance(npc, ItemID.HoneyedGoggles, DropHelper.DefiledDropRateInt); + break; - case NPCID.Piranha: - DropHelper.DropItemChance(npc, ItemID.Hook, DropHelper.DefiledDropRateInt); - break; + case NPCID.Piranha: + DropHelper.DropItemChance(npc, ItemID.Hook, DropHelper.DefiledDropRateInt); + break; - case NPCID.DiabolistRed: - case NPCID.DiabolistWhite: - DropHelper.DropItemChance(npc, ItemID.InfernoFork, DropHelper.DefiledDropRateInt); - break; + case NPCID.DiabolistRed: + case NPCID.DiabolistWhite: + DropHelper.DropItemChance(npc, ItemID.InfernoFork, DropHelper.DefiledDropRateInt); + break; - case NPCID.PinkJellyfish: - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, DropHelper.DefiledDropRateInt); - break; + case NPCID.PinkJellyfish: + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, DropHelper.DefiledDropRateInt); + break; - case NPCID.Paladin: - DropHelper.DropItemChance(npc, ItemID.Kraken, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.PaladinsHammer, DropHelper.DefiledDropRateInt); - break; + case NPCID.Paladin: + DropHelper.DropItemChance(npc, ItemID.Kraken, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.PaladinsHammer, DropHelper.DefiledDropRateInt); + break; - case NPCID.SkeletonArcher: - DropHelper.DropItemChance(npc, ItemID.Marrow, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.MagicQuiver, DropHelper.DefiledDropRateInt); - break; + case NPCID.SkeletonArcher: + DropHelper.DropItemChance(npc, ItemID.Marrow, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.MagicQuiver, DropHelper.DefiledDropRateInt); + break; - case NPCID.Lavabat: - DropHelper.DropItemChance(npc, ItemID.MagmaStone, DropHelper.DefiledDropRateInt); - break; + case NPCID.Lavabat: + DropHelper.DropItemChance(npc, ItemID.MagmaStone, DropHelper.DefiledDropRateInt); + break; - case NPCID.WalkingAntlion: - DropHelper.DropItemChance(npc, ItemID.AntlionClaw, DropHelper.DefiledDropRateInt); - break; + case NPCID.WalkingAntlion: + DropHelper.DropItemChance(npc, ItemID.AntlionClaw, DropHelper.DefiledDropRateInt); + break; - case NPCID.DarkMummy: - DropHelper.DropItemChance(npc, ItemID.Blindfold, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.Megaphone, DropHelper.DefiledDropRateInt); - break; + case NPCID.DarkMummy: + DropHelper.DropItemChance(npc, ItemID.Blindfold, DropHelper.DefiledDropRateInt); + DropHelper.DropItemChance(npc, ItemID.Megaphone, DropHelper.DefiledDropRateInt); + break; - case NPCID.GreenJellyfish: - DropHelper.DropItemChance(npc, ItemID.Megaphone, DropHelper.DefiledDropRateInt); - break; + case NPCID.GreenJellyfish: + DropHelper.DropItemChance(npc, ItemID.Megaphone, DropHelper.DefiledDropRateInt); + break; - case NPCID.CursedSkull: - DropHelper.DropItemChance(npc, ItemID.Nazar, DropHelper.DefiledDropRateInt); - break; + case NPCID.CursedSkull: + DropHelper.DropItemChance(npc, ItemID.Nazar, DropHelper.DefiledDropRateInt); + break; - case NPCID.FireImp: - DropHelper.DropItemChance(npc, ItemID.ObsidianRose, DropHelper.DefiledDropRateInt); - break; + case NPCID.FireImp: + DropHelper.DropItemChance(npc, ItemID.ObsidianRose, DropHelper.DefiledDropRateInt); + break; - case NPCID.BlackRecluse: - case NPCID.BlackRecluseWall: - DropHelper.DropItemChance(npc, ItemID.PoisonStaff, DropHelper.DefiledDropRateInt); - break; + case NPCID.BlackRecluse: + case NPCID.BlackRecluseWall: + DropHelper.DropItemChance(npc, ItemID.PoisonStaff, DropHelper.DefiledDropRateInt); + break; - case NPCID.SkeletonSniper: - DropHelper.DropItemChance(npc, ItemID.RifleScope, DropHelper.DefiledDropRateInt); - break; + case NPCID.SkeletonSniper: + DropHelper.DropItemChance(npc, ItemID.RifleScope, DropHelper.DefiledDropRateInt); + break; - case NPCID.ChaosElemental: - DropHelper.DropItemChance(npc, ItemID.RodofDiscord, DropHelper.DefiledDropRateInt); - break; + case NPCID.ChaosElemental: + DropHelper.DropItemChance(npc, ItemID.RodofDiscord, DropHelper.DefiledDropRateInt); + break; - case NPCID.Necromancer: - case NPCID.NecromancerArmored: - DropHelper.DropItemChance(npc, ItemID.ShadowbeamStaff, DropHelper.DefiledDropRateInt); - break; + case NPCID.Necromancer: + case NPCID.NecromancerArmored: + DropHelper.DropItemChance(npc, ItemID.ShadowbeamStaff, DropHelper.DefiledDropRateInt); + break; - case NPCID.SnowFlinx: - DropHelper.DropItemChance(npc, ItemID.SnowballLauncher, DropHelper.DefiledDropRateInt); - break; + case NPCID.SnowFlinx: + DropHelper.DropItemChance(npc, ItemID.SnowballLauncher, DropHelper.DefiledDropRateInt); + break; - case NPCID.RaggedCaster: - case NPCID.RaggedCasterOpenCoat: - DropHelper.DropItemChance(npc, ItemID.SpectreStaff, DropHelper.DefiledDropRateInt); - break; + case NPCID.RaggedCaster: + case NPCID.RaggedCasterOpenCoat: + DropHelper.DropItemChance(npc, ItemID.SpectreStaff, DropHelper.DefiledDropRateInt); + break; - case NPCID.Plantera: - DropHelper.DropItemChance(npc, ItemID.TheAxe, DropHelper.DefiledDropRateInt); - break; + case NPCID.Plantera: + DropHelper.DropItemChance(npc, ItemID.TheAxe, DropHelper.DefiledDropRateInt); + break; - case NPCID.GiantBat: - DropHelper.DropItemChance(npc, ItemID.TrifoldMap, DropHelper.DefiledDropRateInt); - break; + case NPCID.GiantBat: + DropHelper.DropItemChance(npc, ItemID.TrifoldMap, DropHelper.DefiledDropRateInt); + break; - case NPCID.AngryTrapper: - DropHelper.DropItemChance(npc, ItemID.Uzi, DropHelper.DefiledDropRateInt); - break; + case NPCID.AngryTrapper: + DropHelper.DropItemChance(npc, ItemID.Uzi, DropHelper.DefiledDropRateInt); + break; - case NPCID.Corruptor: - case NPCID.FloatyGross: - DropHelper.DropItemChance(npc, ItemID.Vitamins, DropHelper.DefiledDropRateInt); - break; + case NPCID.Corruptor: + case NPCID.FloatyGross: + DropHelper.DropItemChance(npc, ItemID.Vitamins, DropHelper.DefiledDropRateInt); + break; - case NPCID.GiantTortoise: - DropHelper.DropItemCondition(npc, ItemID.Yelets, NPC.downedMechBossAny, DropHelper.DefiledDropRateFloat); - break; + case NPCID.GiantTortoise: + DropHelper.DropItemCondition(npc, ItemID.Yelets, NPC.downedMechBossAny, DropHelper.DefiledDropRateFloat); + break; default: break; } - // Every type of demon eye counts for Black Lenses - if (CalamityMod.demonEyeList.Contains(npc.type)) + // Every type of demon eye counts for Black Lenses + if (CalamityMod.demonEyeList.Contains(npc.type)) { DropHelper.DropItemChance(npc, ItemID.BlackLens, DropHelper.DefiledDropRateInt); } @@ -1024,75 +1024,75 @@ namespace CalamityMod.NPCs DropHelper.DropItemChance(npc, ItemID.Amarok, DropHelper.DefiledDropRateInt); } } - #endregion + #endregion - #region Armageddon Loot - private void ArmageddonLoot(NPC npc, Mod mod) - { - switch (npc.type) - { - case NPCID.KingSlime: - case NPCID.EyeofCthulhu: - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - if (npc.boss) // only drop from the 1 "boss" segment (redcode) + #region Armageddon Loot + private void ArmageddonLoot(NPC npc, Mod mod) + { + switch (npc.type) + { + case NPCID.KingSlime: + case NPCID.EyeofCthulhu: + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + if (npc.boss) // only drop from the 1 "boss" segment (redcode) { DropHelper.DropArmageddonBags(npc); } break; - case NPCID.BrainofCthulhu: - case NPCID.QueenBee: - case NPCID.SkeletronHead: - case NPCID.WallofFlesh: - case NPCID.Retinazer: // only drop if spaz is already dead - if (!NPC.AnyNPCs(NPCID.Spazmatism)) + case NPCID.BrainofCthulhu: + case NPCID.QueenBee: + case NPCID.SkeletronHead: + case NPCID.WallofFlesh: + case NPCID.Retinazer: // only drop if spaz is already dead + if (!NPC.AnyNPCs(NPCID.Spazmatism)) { DropHelper.DropArmageddonBags(npc); } break; - case NPCID.Spazmatism: // only drop if ret is already dead - if (!NPC.AnyNPCs(NPCID.Retinazer)) + case NPCID.Spazmatism: // only drop if ret is already dead + if (!NPC.AnyNPCs(NPCID.Retinazer)) { DropHelper.DropArmageddonBags(npc); } break; - case NPCID.TheDestroyer: - case NPCID.SkeletronPrime: - case NPCID.Plantera: - case NPCID.Golem: - case NPCID.DD2Betsy: - case NPCID.DukeFishron: - case NPCID.MoonLordCore: - DropHelper.DropArmageddonBags(npc); - break; + case NPCID.TheDestroyer: + case NPCID.SkeletronPrime: + case NPCID.Plantera: + case NPCID.Golem: + case NPCID.DD2Betsy: + case NPCID.DukeFishron: + case NPCID.MoonLordCore: + DropHelper.DropArmageddonBags(npc); + break; default: break; } - } - #endregion + } + #endregion - #region Check Boss Spawn - // not really drop code - private void CheckBossSpawn(NPC npc, Mod mod) - { - if ((npc.type == mod.NPCType("PhantomSpirit") || npc.type == mod.NPCType("PhantomSpiritS") || npc.type == mod.NPCType("PhantomSpiritM") || - npc.type == mod.NPCType("PhantomSpiritL")) && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && !CalamityWorld.downedPolterghast) - { - CalamityMod.ghostKillCount++; - if (CalamityMod.ghostKillCount == 10) - { - string key = "Mods.CalamityMod.GhostBossText2"; - Color messageColor = Color.Cyan; + #region Check Boss Spawn + // not really drop code + private void CheckBossSpawn(NPC npc, Mod mod) + { + if ((npc.type == mod.NPCType("PhantomSpirit") || npc.type == mod.NPCType("PhantomSpiritS") || npc.type == mod.NPCType("PhantomSpiritM") || + npc.type == mod.NPCType("PhantomSpiritL")) && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && !CalamityWorld.downedPolterghast) + { + CalamityMod.ghostKillCount++; + if (CalamityMod.ghostKillCount == 10) + { + string key = "Mods.CalamityMod.GhostBossText2"; + Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -1101,12 +1101,12 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - else if (CalamityMod.ghostKillCount == 20) - { - string key = "Mods.CalamityMod.GhostBossText3"; - Color messageColor = Color.Cyan; + else if (CalamityMod.ghostKillCount == 20) + { + string key = "Mods.CalamityMod.GhostBossText3"; + Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -1116,32 +1116,32 @@ namespace CalamityMod.NPCs } } - if (CalamityMod.ghostKillCount >= 30 && Main.netMode != NetmodeID.MultiplayerClient) - { - int lastPlayer = npc.lastInteraction; + if (CalamityMod.ghostKillCount >= 30 && Main.netMode != NetmodeID.MultiplayerClient) + { + int lastPlayer = npc.lastInteraction; - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) { lastPlayer = npc.FindClosestPlayer(); } if (lastPlayer >= 0) - { - NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("Polterghast")); - CalamityMod.ghostKillCount = 0; - } - } - } + { + NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("Polterghast")); + CalamityMod.ghostKillCount = 0; + } + } + } - if (NPC.downedPlantBoss && npc.type == NPCID.SandShark && !NPC.AnyNPCs(mod.NPCType("GreatSandShark"))) - { - CalamityMod.sharkKillCount++; - if (CalamityMod.sharkKillCount == 4) - { - string key = "Mods.CalamityMod.SandSharkText"; - Color messageColor = Color.Goldenrod; + if (NPC.downedPlantBoss && npc.type == NPCID.SandShark && !NPC.AnyNPCs(mod.NPCType("GreatSandShark"))) + { + CalamityMod.sharkKillCount++; + if (CalamityMod.sharkKillCount == 4) + { + string key = "Mods.CalamityMod.SandSharkText"; + Color messageColor = Color.Goldenrod; - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -1150,12 +1150,12 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - else if (CalamityMod.sharkKillCount == 8) - { - string key = "Mods.CalamityMod.SandSharkText2"; - Color messageColor = Color.Goldenrod; + else if (CalamityMod.sharkKillCount == 8) + { + string key = "Mods.CalamityMod.SandSharkText2"; + Color messageColor = Color.Goldenrod; - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -1164,38 +1164,38 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - if (CalamityMod.sharkKillCount >= 10 && Main.netMode != NetmodeID.MultiplayerClient) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } + if (CalamityMod.sharkKillCount >= 10 && Main.netMode != NetmodeID.MultiplayerClient) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } - int lastPlayer = npc.lastInteraction; + int lastPlayer = npc.lastInteraction; - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) { lastPlayer = npc.FindClosestPlayer(); } if (lastPlayer >= 0) - { - NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("GreatSandShark")); - CalamityMod.sharkKillCount = -5; - } - } - } + { + NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("GreatSandShark")); + CalamityMod.sharkKillCount = -5; + } + } + } - if (NPC.downedAncientCultist && !CalamityWorld.downedStarGod && npc.type == mod.NPCType("Atlas") && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHeadSpectral"))) - { - CalamityMod.astralKillCount++; - if (CalamityMod.astralKillCount == 1) - { - string key = "Mods.CalamityMod.DeusText2"; - Color messageColor = Color.Gold; + if (NPC.downedAncientCultist && !CalamityWorld.downedStarGod && npc.type == mod.NPCType("Atlas") && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHeadSpectral"))) + { + CalamityMod.astralKillCount++; + if (CalamityMod.astralKillCount == 1) + { + string key = "Mods.CalamityMod.DeusText2"; + Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -1204,12 +1204,12 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - else if (CalamityMod.astralKillCount == 2) - { - string key = "Mods.CalamityMod.DeusText3"; - Color messageColor = Color.Gold; + else if (CalamityMod.astralKillCount == 2) + { + string key = "Mods.CalamityMod.DeusText3"; + Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) + if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(Language.GetTextValue(key), messageColor); } @@ -1218,363 +1218,363 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - if (CalamityMod.astralKillCount >= 3 && Main.netMode != NetmodeID.MultiplayerClient) - { - int lastPlayer = npc.lastInteraction; + if (CalamityMod.astralKillCount >= 3 && Main.netMode != NetmodeID.MultiplayerClient) + { + int lastPlayer = npc.lastInteraction; - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) { lastPlayer = npc.FindClosestPlayer(); } if (lastPlayer >= 0) - { - CalamityWorld.ChangeTime(false); + { + CalamityWorld.ChangeTime(false); - for (int x = 0; x < 10; x++) + for (int x = 0; x < 10; x++) { NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("AstrumDeusHead")); } NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("AstrumDeusHeadSpectral")); - CalamityMod.astralKillCount = 0; - } - } - } - } - #endregion + CalamityMod.astralKillCount = 0; + } + } + } + } + #endregion - #region Armor Set Loot - private void ArmorSetLoot(NPC npc, Mod mod) - { - // Tarragon armor set bonus: 20% chance to drop hearts from all valid enemies - if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().tarraSet) - { - if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && npc.lifeMax > 100) + #region Armor Set Loot + private void ArmorSetLoot(NPC npc, Mod mod) + { + // Tarragon armor set bonus: 20% chance to drop hearts from all valid enemies + if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().tarraSet) + { + if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && npc.lifeMax > 100) { DropHelper.DropItemChance(npc, ItemID.Heart, 5); } } - // Blood Orb drops: Valid enemy during a blood moon on the Surface - if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.bloodMoon && npc.HasPlayerTarget && npc.position.Y / 16D < Main.worldSurface) - { - if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().bloodflareSet) + // Blood Orb drops: Valid enemy during a blood moon on the Surface + if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.bloodMoon && npc.HasPlayerTarget && npc.position.Y / 16D < Main.worldSurface) + { + if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().bloodflareSet) { DropHelper.DropItemChance(npc, mod.ItemType("BloodOrb"), 2); // 50% chance of 1 orb with Bloodflare } // 1/12 chance to get a Blood Orb with or without Bloodflare DropHelper.DropItemChance(npc, mod.ItemType("BloodOrb"), 12); - } - } - #endregion + } + } + #endregion - #region Rare Loot - private void RareLoot(NPC npc, Mod mod) - { + #region Rare Loot + private void RareLoot(NPC npc, Mod mod) + { switch (npc.type) - { + { case NPCID.Drippler: int eyeballDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 300; DropHelper.DropItemChance(npc, mod.ItemType("BouncingEyeball"), eyeballDropRate, 1, 1); break; - case NPCID.PossessedArmor: - int amuletDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 150 : 200; - DropHelper.DropItemChance(npc, mod.ItemType("PsychoticAmulet"), amuletDropRate, 1, 1); - break; + case NPCID.PossessedArmor: + int amuletDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 150 : 200; + DropHelper.DropItemChance(npc, mod.ItemType("PsychoticAmulet"), amuletDropRate, 1, 1); + break; - case NPCID.SeaSnail: + case NPCID.SeaSnail: DropHelper.DropItemChance(npc, mod.ItemType("SeaShell"), Main.expertMode ? 2 : 3); - break; + break; - case NPCID.GreekSkeleton: - int gladiatorDropRate = Main.expertMode ? 15 : 20; - DropHelper.DropItemChance(npc, ItemID.GladiatorHelmet, gladiatorDropRate); - DropHelper.DropItemChance(npc, ItemID.GladiatorBreastplate, gladiatorDropRate); - DropHelper.DropItemChance(npc, ItemID.GladiatorLeggings, gladiatorDropRate); - break; + case NPCID.GreekSkeleton: + int gladiatorDropRate = Main.expertMode ? 15 : 20; + DropHelper.DropItemChance(npc, ItemID.GladiatorHelmet, gladiatorDropRate); + DropHelper.DropItemChance(npc, ItemID.GladiatorBreastplate, gladiatorDropRate); + DropHelper.DropItemChance(npc, ItemID.GladiatorLeggings, gladiatorDropRate); + break; - case NPCID.GiantTortoise: - int tortoiseDropRate = Main.expertMode ? 5 : 7; - float shellRoll = Main.rand.NextFloat(); - bool fabledShell = shellRoll < 0.005f; // Exact 1/200 chance for rare regardless of difficulty - DropHelper.DropItemCondition(npc, mod.ItemType("GiantTortoiseShell"), !fabledShell, tortoiseDropRate, 1, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("FabledTortoiseShell"), fabledShell, tortoiseDropRate, 1, 1); - break; + case NPCID.GiantTortoise: + int tortoiseDropRate = Main.expertMode ? 5 : 7; + float shellRoll = Main.rand.NextFloat(); + bool fabledShell = shellRoll < 0.005f; // Exact 1/200 chance for rare regardless of difficulty + DropHelper.DropItemCondition(npc, mod.ItemType("GiantTortoiseShell"), !fabledShell, tortoiseDropRate, 1, 1); + DropHelper.DropItemCondition(npc, mod.ItemType("FabledTortoiseShell"), fabledShell, tortoiseDropRate, 1, 1); + break; - case NPCID.GiantShelly: - case NPCID.GiantShelly2: + case NPCID.GiantShelly: + case NPCID.GiantShelly2: DropHelper.DropItemChance(npc, mod.ItemType("GiantShell"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.AnomuraFungus: + case NPCID.AnomuraFungus: DropHelper.DropItemChance(npc, mod.ItemType("FungalCarapace"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.Crawdad: - case NPCID.Crawdad2: + case NPCID.Crawdad: + case NPCID.Crawdad2: DropHelper.DropItemChance(npc, mod.ItemType("CrawCarapace"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.GreenJellyfish: + case NPCID.GreenJellyfish: DropHelper.DropItemChance(npc, mod.ItemType("VitalJelly"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.PinkJellyfish: + case NPCID.PinkJellyfish: DropHelper.DropItemChance(npc, mod.ItemType("LifeJelly"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.BlueJellyfish: + case NPCID.BlueJellyfish: DropHelper.DropItemChance(npc, mod.ItemType("ManaJelly"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.DarkCaster: + case NPCID.DarkCaster: DropHelper.DropItemChance(npc, mod.ItemType("AncientShiv"), Main.expertMode ? 20 : 25); - break; + break; - case NPCID.BigMimicHallow: - case NPCID.BigMimicCorruption: - case NPCID.BigMimicCrimson: - case NPCID.BigMimicJungle: // arguably unnecessary + case NPCID.BigMimicHallow: + case NPCID.BigMimicCorruption: + case NPCID.BigMimicCrimson: + case NPCID.BigMimicJungle: // arguably unnecessary DropHelper.DropItemChance(npc, mod.ItemType("CelestialClaymore"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.Clinger: + case NPCID.Clinger: DropHelper.DropItemChance(npc, mod.ItemType("CursedDagger"), Main.expertMode ? 20 : 25); - break; + break; - case NPCID.Shark: + case NPCID.Shark: DropHelper.DropItemChance(npc, mod.ItemType("DepthBlade"), Main.expertMode ? 10 : 15); DropHelper.DropItemChance(npc, ItemID.SharkToothNecklace, Main.expertMode ? 20 : 30); - break; + break; - case NPCID.PresentMimic: + case NPCID.PresentMimic: DropHelper.DropItemChance(npc, mod.ItemType("HolidayHalberd"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.IchorSticker: - int spearDropRate = Main.expertMode ? 20 : 25; - float spearRoll = Main.rand.NextFloat(); - bool spearOfDestiny = spearRoll < 0.005f; // Exact 1/200 chance for rare regardless of difficulty - DropHelper.DropItemCondition(npc, mod.ItemType("IchorSpear"), !spearOfDestiny, spearDropRate, 1, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("SpearofDestiny"), spearOfDestiny, spearDropRate, 1, 1); - break; + case NPCID.IchorSticker: + int spearDropRate = Main.expertMode ? 20 : 25; + float spearRoll = Main.rand.NextFloat(); + bool spearOfDestiny = spearRoll < 0.005f; // Exact 1/200 chance for rare regardless of difficulty + DropHelper.DropItemCondition(npc, mod.ItemType("IchorSpear"), !spearOfDestiny, spearDropRate, 1, 1); + DropHelper.DropItemCondition(npc, mod.ItemType("SpearofDestiny"), spearOfDestiny, spearDropRate, 1, 1); + break; - case NPCID.Harpy: - int glazeDropRate = CalamityWorld.defiled ? 20 : Main.expertMode ? 60 : 80; - DropHelper.DropItemCondition(npc, mod.ItemType("SkyGlaze"), NPC.downedBoss1, glazeDropRate, 1, 1); - break; + case NPCID.Harpy: + int glazeDropRate = CalamityWorld.defiled ? 20 : Main.expertMode ? 60 : 80; + DropHelper.DropItemCondition(npc, mod.ItemType("SkyGlaze"), NPC.downedBoss1, glazeDropRate, 1, 1); + break; - case NPCID.Antlion: - case NPCID.WalkingAntlion: - case NPCID.FlyingAntlion: + case NPCID.Antlion: + case NPCID.WalkingAntlion: + case NPCID.FlyingAntlion: DropHelper.DropItemChance(npc, mod.ItemType("MandibleClaws"), Main.expertMode ? 30 : 40); DropHelper.DropItemChance(npc, mod.ItemType("MandibleBow"), Main.expertMode ? 30 : 40); - break; + break; - case NPCID.TombCrawlerHead: + case NPCID.TombCrawlerHead: DropHelper.DropItemChance(npc, mod.ItemType("BurntSienna"), Main.expertMode ? 15 : 20); - break; + break; - case NPCID.DuneSplicerHead: + case NPCID.DuneSplicerHead: DropHelper.DropItemCondition(npc, mod.ItemType("Terracotta"), NPC.downedPlantBoss, Main.expertMode ? 20 : 30, 1, 1); - break; + break; - case NPCID.MartianSaucerCore: + case NPCID.MartianSaucerCore: DropHelper.DropItemChance(npc, mod.ItemType("NullificationRifle"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.Demon: + case NPCID.Demon: DropHelper.DropItemChance(npc, mod.ItemType("DemonicBoneAsh"), Main.expertMode ? 2 : 3); DropHelper.DropItemChance(npc, mod.ItemType("BladecrestOathsword"), Main.expertMode ? 20 : 25); - break; + break; - case NPCID.BoneSerpentHead: + case NPCID.BoneSerpentHead: DropHelper.DropItemChance(npc, mod.ItemType("DemonicBoneAsh"), Main.expertMode ? 2 : 3); DropHelper.DropItemChance(npc, mod.ItemType("OldLordOathsword"), Main.expertMode ? 10 : 15); - break; + break; - case NPCID.Tim: + case NPCID.Tim: DropHelper.DropItemChance(npc, mod.ItemType("PlasmaRod"), Main.expertMode ? 2 : 3); - break; + break; - case NPCID.GoblinSorcerer: + case NPCID.GoblinSorcerer: DropHelper.DropItemChance(npc, mod.ItemType("PlasmaRod"), Main.expertMode ? 20 : 25); - break; + break; - case NPCID.PirateDeadeye: + case NPCID.PirateDeadeye: DropHelper.DropItemChance(npc, mod.ItemType("ProporsePistol"), Main.expertMode ? 20 : 25); - break; + break; - case NPCID.PirateCrossbower: - int crossbowDropRate = Main.expertMode ? 20 : 25; - float arbalestRoll = Main.rand.NextFloat(); - bool arbalest = arbalestRoll < 0.005f; // Exact 1/200 chance for rare regardless of difficulty - DropHelper.DropItemCondition(npc, mod.ItemType("RaidersGlory"), !arbalest, crossbowDropRate, 1, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("Arbalest"), arbalest, crossbowDropRate, 1, 1); - break; + case NPCID.PirateCrossbower: + int crossbowDropRate = Main.expertMode ? 20 : 25; + float arbalestRoll = Main.rand.NextFloat(); + bool arbalest = arbalestRoll < 0.005f; // Exact 1/200 chance for rare regardless of difficulty + DropHelper.DropItemCondition(npc, mod.ItemType("RaidersGlory"), !arbalest, crossbowDropRate, 1, 1); + DropHelper.DropItemCondition(npc, mod.ItemType("Arbalest"), arbalest, crossbowDropRate, 1, 1); + break; - case NPCID.GoblinSummoner: + case NPCID.GoblinSummoner: DropHelper.DropItemChance(npc, mod.ItemType("TheFirstShadowflame"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.SandElemental: + case NPCID.SandElemental: DropHelper.DropItemChance(npc, mod.ItemType("WifeinaBottle"), Main.expertMode ? 5 : 7); DropHelper.DropItemCondition(npc, mod.ItemType("WifeinaBottlewithBoobs"), Main.expertMode, 20, 1, 1); - break; + break; - case NPCID.GoblinWarrior: + case NPCID.GoblinWarrior: DropHelper.DropItemChance(npc, mod.ItemType("Warblade"), Main.expertMode ? 15 : 20); - break; + break; - case NPCID.MartianWalker: + case NPCID.MartianWalker: DropHelper.DropItemChance(npc, mod.ItemType("Wingman"), Main.expertMode ? 5 : 7); - break; + break; - case NPCID.GiantCursedSkull: + case NPCID.GiantCursedSkull: DropHelper.DropItemChance(npc, mod.ItemType("WrathoftheAncients"), Main.expertMode ? 20 : 25); - DropHelper.DropItemCondition(npc, mod.ItemType("Keelhaul"), CalamityWorld.downedLeviathan, 10, 1, 1); - break; + DropHelper.DropItemCondition(npc, mod.ItemType("Keelhaul"), CalamityWorld.downedLeviathan, 10, 1, 1); + break; - case NPCID.Necromancer: - case NPCID.NecromancerArmored: + case NPCID.Necromancer: + case NPCID.NecromancerArmored: DropHelper.DropItemChance(npc, mod.ItemType("WrathoftheAncients"), Main.expertMode ? 20 : 25); - break; + break; default: break; } - // Every type of Moss Hornet counts for the Needler - if (CalamityMod.mossHornetList.Contains(npc.type)) - { - int needlerDropRate = Main.expertMode ? 20 : 25; - DropHelper.DropItemChance(npc, mod.ItemType("Needler"), needlerDropRate); - } + // Every type of Moss Hornet counts for the Needler + if (CalamityMod.mossHornetList.Contains(npc.type)) + { + int needlerDropRate = Main.expertMode ? 20 : 25; + DropHelper.DropItemChance(npc, mod.ItemType("Needler"), needlerDropRate); + } - // Every type of Skeleton counts for the Waraxe and Ancient Bone Dust - if (CalamityMod.skeletonList.Contains(npc.type)) - { + // Every type of Skeleton counts for the Waraxe and Ancient Bone Dust + if (CalamityMod.skeletonList.Contains(npc.type)) + { DropHelper.DropItemCondition(npc, mod.ItemType("Waraxe"), !Main.hardMode, Main.expertMode ? 15 : 20, 1, 1); DropHelper.DropItemChance(npc, mod.ItemType("AncientBoneDust"), Main.expertMode ? 4 : 5); - } - } - #endregion + } + } + #endregion - #region Common Loot - private void CommonLoot(NPC npc, Mod mod) - { + #region Common Loot + private void CommonLoot(NPC npc, Mod mod) + { switch (npc.type) - { - case NPCID.Vulture: + { + case NPCID.Vulture: DropHelper.DropItemChance(npc, mod.ItemType("DesertFeather"), 2, 1, Main.expertMode ? 2 : 1); - break; + break; - case NPCID.RedDevil: + case NPCID.RedDevil: DropHelper.DropItemChance(npc, mod.ItemType("EssenceofChaos"), Main.expertMode ? 1f : 0.5f); - break; + break; - case NPCID.WyvernHead: + case NPCID.WyvernHead: DropHelper.DropItem(npc, mod.ItemType("EssenceofCinder"), 1, Main.expertMode ? 2 : 1); - break; + break; - case NPCID.AngryNimbus: + case NPCID.AngryNimbus: DropHelper.DropItemChance(npc, mod.ItemType("EssenceofCinder"), Main.expertMode ? 2 : 3); - break; + break; - case NPCID.IcyMerman: - case NPCID.IceTortoise: + case NPCID.IcyMerman: + case NPCID.IceTortoise: DropHelper.DropItemChance(npc, mod.ItemType("EssenceofEleum"), Main.expertMode ? 2 : 3); - break; + break; - case NPCID.IceGolem: - DropHelper.DropItem(npc, mod.ItemType("EssenceofEleum"), 1, 2); - break; + case NPCID.IceGolem: + DropHelper.DropItem(npc, mod.ItemType("EssenceofEleum"), 1, 2); + break; - case NPCID.Plantera: + case NPCID.Plantera: DropHelper.DropItemCondition(npc, mod.ItemType("LivingShard"), !Main.expertMode, 6, 9); - break; + break; - case NPCID.NebulaBrain: - case NPCID.NebulaSoldier: - case NPCID.NebulaHeadcrab: - case NPCID.NebulaBeast: + case NPCID.NebulaBrain: + case NPCID.NebulaSoldier: + case NPCID.NebulaHeadcrab: + case NPCID.NebulaBeast: DropHelper.DropItemChance(npc, mod.ItemType("MeldBlob"), 4, Main.expertMode ? 2 : 1, Main.expertMode ? 3 : 2); - break; + break; - case NPCID.DungeonGuardian: - DropHelper.DropItemCondition(npc, mod.ItemType("GoldBurdenBreaker"), Main.hardMode); - break; + case NPCID.DungeonGuardian: + DropHelper.DropItemCondition(npc, mod.ItemType("GoldBurdenBreaker"), Main.hardMode); + break; - case NPCID.CultistBoss: + case NPCID.CultistBoss: DropHelper.DropItemChance(npc, mod.ItemType("StardustStaff"), Main.expertMode ? 3 : 5); - DropHelper.DropItemChance(npc, mod.ItemType("ThornBlossom"), DropHelper.RareVariantDropRateInt); - break; + DropHelper.DropItemChance(npc, mod.ItemType("ThornBlossom"), DropHelper.RareVariantDropRateInt); + break; - case NPCID.EyeofCthulhu: + case NPCID.EyeofCthulhu: DropHelper.DropItemCondition(npc, mod.ItemType("VictoryShard"), !Main.expertMode, 2, 4); DropHelper.DropItemCondition(npc, mod.ItemType("TeardropCleaver"), !Main.expertMode, 5, 1, 1); - break; + break; - case NPCID.DevourerHead: - case NPCID.SeekerHead: + case NPCID.DevourerHead: + case NPCID.SeekerHead: DropHelper.DropItemChance(npc, mod.ItemType("FetidEssence"), Main.expertMode ? 2 : 3); - break; + break; - case NPCID.FaceMonster: - case NPCID.Herpling: + case NPCID.FaceMonster: + case NPCID.Herpling: DropHelper.DropItemChance(npc, mod.ItemType("BloodlettingEssence"), Main.expertMode ? 4 : 5); - break; + break; - case NPCID.ManEater: + case NPCID.ManEater: DropHelper.DropItemChance(npc, mod.ItemType("ManeaterBulb"), Main.expertMode ? 2 : 3); - break; + break; - case NPCID.AngryTrapper: + case NPCID.AngryTrapper: DropHelper.DropItemChance(npc, mod.ItemType("TrapperBulb"), Main.expertMode ? 4 : 5); - break; + break; - case NPCID.MotherSlime: - case NPCID.CorruptSlime: - case NPCID.Crimslime: + case NPCID.MotherSlime: + case NPCID.CorruptSlime: + case NPCID.Crimslime: DropHelper.DropItemChance(npc, mod.ItemType("MurkySludge"), Main.expertMode ? 3 : 4); - break; + break; - case NPCID.Moth: + case NPCID.Moth: DropHelper.DropItemChance(npc, mod.ItemType("GypsyPowder"), Main.expertMode ? 1f : 0.5f); - break; + break; - case NPCID.Derpling: + case NPCID.Derpling: DropHelper.DropItemChance(npc, mod.ItemType("BeetleJuice"), Main.expertMode ? 4 : 5); - break; + break; - case NPCID.SpikedJungleSlime: - case NPCID.Arapaima: + case NPCID.SpikedJungleSlime: + case NPCID.Arapaima: DropHelper.DropItemChance(npc, mod.ItemType("MurkyPaste"), Main.expertMode ? 4 : 5); - break; + break; default: break; } - // All hardmode dungeon enemies drop Ectoblood - if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) + // All hardmode dungeon enemies drop Ectoblood + if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) { DropHelper.DropItemChance(npc, mod.ItemType("Ectoblood"), 2, 1, Main.expertMode ? 3 : 1); } } - #endregion + #endregion - #region Boss Loot - private void BossLoot(NPC npc, Mod mod) - { - // Not really loot code, but NPCLoot is the only death hook - if (npc.boss && !CalamityWorld.downedBossAny) - { - CalamityWorld.downedBossAny = true; - CalamityMod.UpdateServerBoolean(); - } + #region Boss Loot + private void BossLoot(NPC npc, Mod mod) + { + // Not really loot code, but NPCLoot is the only death hook + if (npc.boss && !CalamityWorld.downedBossAny) + { + CalamityWorld.downedBossAny = true; + CalamityMod.UpdateServerBoolean(); + } // Nightmare Fuel, Endothermic Energy and Darksun Fragments if (npc.type == NPCID.Pumpking) @@ -1586,31 +1586,31 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, mod.ItemType("EndothermicEnergy"), CalamityWorld.downedDoG, 20, 40); } else if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) - { + { DropHelper.DropItem(npc, mod.ItemType("DarksunFragment"), 10, 20); // Mark a buffed Mothron as killed (allowing access to Yharon P2) - CalamityWorld.downedBuffedMothron = true; - CalamityMod.UpdateServerBoolean(); - } - } - #endregion + CalamityWorld.downedBuffedMothron = true; + CalamityMod.UpdateServerBoolean(); + } + } + #endregion - #region DespawnHostileProjectiles - public void DespawnProj() - { - int proj; - for (int x = 0; x < Main.maxProjectiles; x = proj + 1) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) + #region DespawnHostileProjectiles + public void DespawnProj() + { + int proj; + for (int x = 0; x < Main.maxProjectiles; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) { projectile.Kill(); } proj = x; - } - } - #endregion - } + } + } + #endregion + } } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 7220fc2be5..8c210293b9 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -1,327 +1,327 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.CeaselessVoid { [AutoloadBossHead] - public class CeaselessVoid : ModNPC - { - private float bossLife; - private int beamPortal = 0; - private int shootBoost = 0; + public class CeaselessVoid : ModNPC + { + private float bossLife; + private int beamPortal = 0; + private int shootBoost = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ceaseless Void"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Void"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 150; - npc.npcSlots = 36f; - npc.width = 100; - npc.height = 100; - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 150; + npc.npcSlots = 36f; + npc.width = 100; + npc.height = 100; + npc.defense = 0; npc.takenDamageMultiplier = 1E-6f; - npc.lifeMax = 200; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Void"); - else - music = MusicID.Boss3; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.noGravity = true; - npc.noTileCollide = true; - npc.boss = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + npc.lifeMax = 200; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.value = Item.buyPrice(0, 35, 0, 0); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Void"); + else + music = MusicID.Boss3; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.noGravity = true; + npc.noTileCollide = true; + npc.boss = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(beamPortal); - writer.Write(shootBoost); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(beamPortal); + writer.Write(shootBoost); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - beamPortal = reader.ReadInt32(); - shootBoost = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + beamPortal = reader.ReadInt32(); + shootBoost = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Texture2D texture = Main.npcTexture[npc.type]; - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + return false; + } - public override void AI() - { - double lifeRatio = (double)npc.life / (double)npc.lifeMax; - int lifePercentage = (int)(100.0 * lifeRatio); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - CalamityGlobalNPC.voidBoss = npc.whoAmI; - Vector2 vector = npc.Center; - npc.TargetClosest(true); - Player player = Main.player[npc.target]; + public override void AI() + { + double lifeRatio = (double)npc.life / (double)npc.lifeMax; + int lifePercentage = (int)(100.0 * lifeRatio); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + CalamityGlobalNPC.voidBoss = npc.whoAmI; + Vector2 vector = npc.Center; + npc.TargetClosest(true); + Player player = Main.player[npc.target]; - if (NPC.CountNPCS(mod.NPCType("DarkEnergy")) > 0 || - NPC.CountNPCS(mod.NPCType("DarkEnergy2")) > 0 || - NPC.CountNPCS(mod.NPCType("DarkEnergy3")) > 0) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } + if (NPC.CountNPCS(mod.NPCType("DarkEnergy")) > 0 || + NPC.CountNPCS(mod.NPCType("DarkEnergy2")) > 0 || + NPC.CountNPCS(mod.NPCType("DarkEnergy3")) > 0) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (lifePercentage < 90) - { - float num472 = npc.Center.X; - float num473 = npc.Center.Y; - float num474 = (float)(500.0 * (1.0 - lifeRatio)); - if (!player.ZoneDungeon) - { - num474 *= 1.25f; - } - npc.ai[0] += 1f; - if (npc.ai[0] == 60f) - { - npc.ai[0] = 0f; - int numDust = (int)(0.2f * MathHelper.TwoPi * num474); - float angleIncrement = MathHelper.TwoPi / (float)numDust; - Vector2 dustOffset = new Vector2(num474, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - for (int i = 0; i < numDust; i++) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(npc.Center, 1, 1, 173); - Main.dust[dust].position = npc.Center + dustOffset; - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].scale = 0.5f; - } - for (int num475 = 0; num475 < 255; num475++) - { - if (Collision.CanHit(npc.Center, 1, 1, Main.player[num475].Center, 1, 1)) - { - float num476 = Main.player[num475].position.X + (float)(Main.player[num475].width / 2); - float num477 = Main.player[num475].position.Y + (float)(Main.player[num475].height / 2); - float num478 = Math.Abs(npc.position.X + (float)(npc.width / 2) - num476) + Math.Abs(npc.position.Y + (float)(npc.height / 2) - num477); - if (num478 < num474) - { - if (Main.player[num475].position.X < num472) - { - Main.player[num475].velocity.X += 15f; - } - else - { - Main.player[num475].velocity.X -= 15f; - } - if (Main.player[num475].position.Y < num473) - { - Main.player[num475].velocity.Y += 15f; - } - else - { - Main.player[num475].velocity.Y -= 15f; - } - } - } - } - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - beamPortal += expertMode ? 2 : 1; - beamPortal += shootBoost; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - beamPortal += 1; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - beamPortal += 2; - } - if (beamPortal >= 1200) - { - beamPortal = 0; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num941 = 3f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 50 : 60; - int num946 = mod.ProjectileType("DoGBeamPortal"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 300; - npc.netUpdate = true; - } - if (lifePercentage < 50 && revenge) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 50 : 60; - int i; - float passedVar = 1f; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), mod.ProjectileType("DarkEnergyBall"), damage, 0f, Main.myPlayer, passedVar, 0f); - passedVar += 1f; - } - } - } - } - float num823 = 7.5f; - float num824 = 0.08f; - if (!player.ZoneDungeon || CalamityWorld.bossRushActive) - { - num823 = 25f; - } - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.26); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - shootBoost += 1; - int glob = revenge ? 8 : 4; - if (bossLife <= 0.5f) - { - glob = revenge ? 16 : 8; - } - for (int num662 = 0; num662 < glob; num662++) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (lifePercentage < 90) + { + float num472 = npc.Center.X; + float num473 = npc.Center.Y; + float num474 = (float)(500.0 * (1.0 - lifeRatio)); + if (!player.ZoneDungeon) + { + num474 *= 1.25f; + } + npc.ai[0] += 1f; + if (npc.ai[0] == 60f) + { + npc.ai[0] = 0f; + int numDust = (int)(0.2f * MathHelper.TwoPi * num474); + float angleIncrement = MathHelper.TwoPi / (float)numDust; + Vector2 dustOffset = new Vector2(num474, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + for (int i = 0; i < numDust; i++) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dust = Dust.NewDust(npc.Center, 1, 1, 173); + Main.dust[dust].position = npc.Center + dustOffset; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].scale = 0.5f; + } + for (int num475 = 0; num475 < 255; num475++) + { + if (Collision.CanHit(npc.Center, 1, 1, Main.player[num475].Center, 1, 1)) + { + float num476 = Main.player[num475].position.X + (float)(Main.player[num475].width / 2); + float num477 = Main.player[num475].position.Y + (float)(Main.player[num475].height / 2); + float num478 = Math.Abs(npc.position.X + (float)(npc.width / 2) - num476) + Math.Abs(npc.position.Y + (float)(npc.height / 2) - num477); + if (num478 < num474) + { + if (Main.player[num475].position.X < num472) + { + Main.player[num475].velocity.X += 15f; + } + else + { + Main.player[num475].velocity.X -= 15f; + } + if (Main.player[num475].position.Y < num473) + { + Main.player[num475].velocity.Y += 15f; + } + else + { + Main.player[num475].velocity.Y -= 15f; + } + } + } + } + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + beamPortal += expertMode ? 2 : 1; + beamPortal += shootBoost; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + beamPortal += 1; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + beamPortal += 2; + } + if (beamPortal >= 1200) + { + beamPortal = 0; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num941 = 3f; + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = player.position.X + (float)player.width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); + float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + int num945 = expertMode ? 50 : 60; + int num946 = mod.ProjectileType("DoGBeamPortal"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num947].timeLeft = 300; + npc.netUpdate = true; + } + if (lifePercentage < 50 && revenge) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 50 : 60; + int i; + float passedVar = 1f; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), mod.ProjectileType("DarkEnergyBall"), damage, 0f, Main.myPlayer, passedVar, 0f); + passedVar += 1f; + } + } + } + } + float num823 = 7.5f; + float num824 = 0.08f; + if (!player.ZoneDungeon || CalamityWorld.bossRushActive) + { + num823 = 25f; + } + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.26); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + shootBoost += 1; + int glob = revenge ? 8 : 4; + if (bossLife <= 0.5f) + { + glob = revenge ? 16 : 8; + } + for (int num662 = 0; num662 < glob; num662++) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } - public override void NPCLoot() - { + public override void NPCLoot() + { // Only drop items if fought alone if (CalamityWorld.DoGSecondStageCountdown <= 0) - { + { // Materials DropHelper.DropItem(npc, mod.ItemType("DarkPlasma"), true, 2, 3); @@ -364,50 +364,50 @@ namespace CalamityMod.NPCs.CeaselessVoid CalamityMod.UpdateServerBoolean(); } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid5"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid5"), 1f); + } + } + } } diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index b2ac6afcd7..97e6972e50 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -1,32 +1,32 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.CeaselessVoid { public class DarkEnergy : ModNPC - { + { public int invinceTime = 120; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; - npc.height = 80; - npc.defense = 50; - npc.lifeMax = 6000; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.dontTakeDamage = true; + npc.width = 80; + npc.height = 80; + npc.defense = 50; + npc.lifeMax = 6000; if (CalamityWorld.DoGSecondStageCountdown <= 0) { npc.lifeMax = 24000; @@ -35,34 +35,34 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0.25f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0.25f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -70,9 +70,9 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.frame.Y = frame * frameHeight; } - public override void AI() - { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + public override void AI() + { + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; if (invinceTime > 0) { invinceTime--; @@ -80,42 +80,42 @@ namespace CalamityMod.NPCs.CeaselessVoid else { npc.damage = expertMode ? 240 : 120; - if (CalamityWorld.revenge) - npc.damage = 300; + if (CalamityWorld.revenge) + npc.damage = 300; npc.dontTakeDamage = false; } Vector2 vectorCenter = npc.Center; - npc.TargetClosest(true); - Player player = Main.player[npc.target]; + npc.TargetClosest(true); + Player player = Main.player[npc.target]; - double mult = 0.5 + - (CalamityWorld.revenge ? 0.2 : 0.0) + - (CalamityWorld.death ? 0.2 : 0.0); + double mult = 0.5 + + (CalamityWorld.revenge ? 0.2 : 0.0) + + (CalamityWorld.death ? 0.2 : 0.0); if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) { npc.knockBackResist = 0f; } - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } + if (npc.ai[1] == 0f) + { + npc.scale -= 0.01f; + npc.alpha += 15; + if (npc.alpha >= 125) + { + npc.alpha = 130; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.01f; + npc.alpha -= 15; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { npc.TargetClosest(false); @@ -135,81 +135,81 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.timeLeft = 2400; } if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 90f) - { - num786 = (CalamityWorld.bossRushActive ? 24f : 16f) / num786; - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 16f) - { - npc.velocity.Y = npc.velocity.Y * 1.1f; - npc.velocity.X = npc.velocity.X * 1.1f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = (CalamityWorld.bossRushActive ? 16f : 12f) / num786; - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - } - else - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= (CalamityWorld.bossRushActive ? 16f : 11f); - npc.velocity = (npc.velocity * 99f + value4) / 100f; - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - npc.ai[2] += 1f; - if (num789 > 700f || npc.ai[2] >= 150f) - { - npc.ai[0] = 0f; - npc.ai[2] = 0f; - } - } - } + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 90f) + { + num786 = (CalamityWorld.bossRushActive ? 24f : 16f) / num786; + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 16f) + { + npc.velocity.Y = npc.velocity.Y * 1.1f; + npc.velocity.X = npc.velocity.X * 1.1f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = (CalamityWorld.bossRushActive ? 16f : 12f) / num786; + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + } + else + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= (CalamityWorld.bossRushActive ? 16f : 11f); + npc.velocity = (npc.velocity * 99f + value4) / 100f; + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + npc.ai[2] += 1f; + if (num789 > 700f || npc.ai[2] >= 150f) + { + npc.ai[0] = 0f; + npc.ai[2] = 0f; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs index 7c1efd734f..f0098de6d0 100644 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -1,31 +1,31 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.CeaselessVoid { public class DarkEnergy2 : ModNPC - { + { public int invinceTime = 120; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; - npc.height = 80; - npc.defense = 50; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.dontTakeDamage = true; + npc.width = 80; + npc.height = 80; + npc.defense = 50; npc.lifeMax = 6000; if (CalamityWorld.DoGSecondStageCountdown <= 0) { @@ -35,34 +35,34 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0.1f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0.1f; npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } + npc.noTileCollide = true; + npc.canGhostHeal = false; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -70,52 +70,52 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.frame.Y = frame * frameHeight; } - public override void AI() - { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + public override void AI() + { + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; if (invinceTime > 0) { invinceTime--; } else { - npc.damage = expertMode ? 240 : 120; - if (CalamityWorld.revenge) - npc.damage = 300; - npc.dontTakeDamage = false; + npc.damage = expertMode ? 240 : 120; + if (CalamityWorld.revenge) + npc.damage = 300; + npc.dontTakeDamage = false; } - double mult = 0.5 + - (CalamityWorld.revenge ? 0.2 : 0.0) + - (CalamityWorld.death ? 0.2 : 0.0); - if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) - { - npc.knockBackResist = 0f; - } + double mult = 0.5 + + (CalamityWorld.revenge ? 0.2 : 0.0) + + (CalamityWorld.death ? 0.2 : 0.0); + if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) + { + npc.knockBackResist = 0f; + } - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + if (npc.ai[1] == 0f) + { + npc.scale -= 0.01f; + npc.alpha += 15; + if (npc.alpha >= 125) + { + npc.alpha = 130; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.01f; + npc.alpha -= 15; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { npc.TargetClosest(false); player = Main.player[npc.target]; @@ -134,46 +134,46 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.timeLeft = 2400; } Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - float num1258 = Main.player[npc.target].Center.X - vector145.X; - float num1259 = Main.player[npc.target].Center.Y - vector145.Y; - float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); + float num1258 = Main.player[npc.target].Center.X - vector145.X; + float num1259 = Main.player[npc.target].Center.Y - vector145.Y; + float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); - float num1261 = expertMode ? 15f : 12f; - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - num1261 += 3f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num1261 += 3f; + float num1261 = expertMode ? 15f : 12f; + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + num1261 += 3f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + num1261 += 3f; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; - } + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs index 43a97b7338..6d2542fdb7 100644 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -1,30 +1,30 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.CeaselessVoid { public class DarkEnergy3 : ModNPC - { + { public int invinceTime = 120; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; - npc.height = 80; - npc.defense = 50; + public override void SetDefaults() + { + npc.damage = 0; + npc.dontTakeDamage = true; + npc.width = 80; + npc.height = 80; + npc.defense = 50; npc.lifeMax = 6000; if (CalamityWorld.DoGSecondStageCountdown <= 0) { @@ -34,35 +34,35 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0.3f; + npc.knockBackResist = 0.3f; npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } + npc.noTileCollide = true; + npc.canGhostHeal = false; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -70,8 +70,8 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.frame.Y = frame * frameHeight; } - public override void AI() - { + public override void AI() + { bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; if (invinceTime > 0) { @@ -79,43 +79,43 @@ namespace CalamityMod.NPCs.CeaselessVoid } else { - npc.damage = expertMode ? 240 : 120; - if (CalamityWorld.revenge) - npc.damage = 300; - npc.dontTakeDamage = false; + npc.damage = expertMode ? 240 : 120; + if (CalamityWorld.revenge) + npc.damage = 300; + npc.dontTakeDamage = false; } - double mult = 0.5 + - (CalamityWorld.revenge ? 0.2 : 0.0) + - (CalamityWorld.death ? 0.2 : 0.0); - if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) - { - npc.knockBackResist = 0f; - } + double mult = 0.5 + + (CalamityWorld.revenge ? 0.2 : 0.0) + + (CalamityWorld.death ? 0.2 : 0.0); + if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) + { + npc.knockBackResist = 0f; + } - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + if (npc.ai[1] == 0f) + { + npc.scale -= 0.01f; + npc.alpha += 15; + if (npc.alpha >= 125) + { + npc.alpha = 130; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.01f; + npc.alpha -= 15; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { npc.TargetClosest(false); player = Main.player[npc.target]; @@ -135,72 +135,72 @@ namespace CalamityMod.NPCs.CeaselessVoid } float num1372 = expertMode ? 10f : 8f; - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - num1372 += 2f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num1372 += 2f; + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + num1372 += 2f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + num1372 += 2f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; + float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/CosmicWraith/CosmicLantern.cs b/NPCs/CosmicWraith/CosmicLantern.cs index bcbc4864fd..7269f714a5 100644 --- a/NPCs/CosmicWraith/CosmicLantern.cs +++ b/NPCs/CosmicWraith/CosmicLantern.cs @@ -1,56 +1,56 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.CosmicWraith { public class CosmicLantern : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Lantern"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Lantern"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 110; - npc.width = 25; - npc.height = 25; - npc.defense = 50; - npc.lifeMax = 25; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 110; + npc.width = 25; + npc.height = 25; + npc.defense = 50; + npc.lifeMax = 25; npc.alpha = 255; - npc.knockBackResist = 0.85f; - npc.noGravity = true; + npc.knockBackResist = 0.85f; + npc.noGravity = true; npc.dontTakeDamage = true; npc.chaseable = false; - npc.canGhostHeal = false; - npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } + npc.canGhostHeal = false; + npc.noTileCollide = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -58,8 +58,8 @@ namespace CalamityMod.NPCs.CosmicWraith npc.frame.Y = frame * frameHeight; } - public override void AI() - { + public override void AI() + { npc.alpha -= 3; if (npc.alpha < 0) { @@ -93,35 +93,35 @@ namespace CalamityMod.NPCs.CosmicWraith } npc.dontTakeDamage = false; npc.chaseable = true; - playerDistMagnitude = playerDistNormMult / playerDistMagnitude; - playerDistX *= playerDistMagnitude; - playerDistY *= playerDistMagnitude; - npc.velocity = (npc.velocity * 100f + new Vector2(playerDistX, playerDistY)) / 101f; - } + playerDistMagnitude = playerDistNormMult / playerDistMagnitude; + playerDistX *= playerDistMagnitude; + playerDistY *= playerDistMagnitude; + npc.velocity = (npc.velocity * 100f + new Vector2(playerDistX, playerDistY)) / 101f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 0; - return npc.alpha == 0; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 0; + return npc.alpha == 0; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 204, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 204, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/CosmicWraith/CosmicWraith.cs b/NPCs/CosmicWraith/CosmicWraith.cs index 14d6db871a..15fe5ccc13 100644 --- a/NPCs/CosmicWraith/CosmicWraith.cs +++ b/NPCs/CosmicWraith/CosmicWraith.cs @@ -1,719 +1,719 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.CosmicWraith { [AutoloadBossHead] - public class CosmicWraith : ModNPC - { - private int phaseSwitch = 0; - private int chargeSwitch = 0; - private int dustTimer = 3; - private int spawnX = 750; - private int spawnY = 120; - private int lifeToAlpha = 0; + public class CosmicWraith : ModNPC + { + private int phaseSwitch = 0; + private int chargeSwitch = 0; + private int dustTimer = 3; + private int spawnX = 750; + private int spawnY = 120; + private int lifeToAlpha = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Signus, Envoy of the Devourer"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Signus, Envoy of the Devourer"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 32f; - npc.damage = 175; - npc.width = 130; - npc.height = 130; - npc.defense = 70; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss4; - npc.lifeMax = CalamityWorld.revenge ? 109500 : 70000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"); - else - music = MusicID.Boss4; - npc.lifeMax = CalamityWorld.revenge ? 445500 : 280000; - if (CalamityWorld.death) - { - npc.lifeMax = 722250; - } - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2400000 : 2200000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - } + public override void SetDefaults() + { + npc.npcSlots = 32f; + npc.damage = 175; + npc.width = 130; + npc.height = 130; + npc.defense = 70; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss4; + npc.lifeMax = CalamityWorld.revenge ? 109500 : 70000; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.value = Item.buyPrice(0, 35, 0, 0); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"); + else + music = MusicID.Boss4; + npc.lifeMax = CalamityWorld.revenge ? 445500 : 280000; + if (CalamityWorld.death) + { + npc.lifeMax = 722250; + } + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2400000 : 2200000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("ExoFreeze")] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + npc.HitSound = SoundID.NPCHit49; + npc.DeathSound = SoundID.NPCDeath51; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(phaseSwitch); - writer.Write(chargeSwitch); - writer.Write(dustTimer); - writer.Write(spawnX); - writer.Write(spawnY); - writer.Write(lifeToAlpha); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(phaseSwitch); + writer.Write(chargeSwitch); + writer.Write(dustTimer); + writer.Write(spawnX); + writer.Write(spawnY); + writer.Write(lifeToAlpha); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - phaseSwitch = reader.ReadInt32(); - chargeSwitch = reader.ReadInt32(); - dustTimer = reader.ReadInt32(); - spawnX = reader.ReadInt32(); - spawnY = reader.ReadInt32(); - lifeToAlpha = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + phaseSwitch = reader.ReadInt32(); + chargeSwitch = reader.ReadInt32(); + dustTimer = reader.ReadInt32(); + spawnX = reader.ReadInt32(); + spawnY = reader.ReadInt32(); + lifeToAlpha = reader.ReadInt32(); + } - public override void AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + public override void AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - double lifeRatio = (double)npc.life / (double)npc.lifeMax; - lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); + double lifeRatio = (double)npc.life / (double)npc.lifeMax; + lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); - double mult = 1.0 - - (revenge ? 0.25 : 0.0) - - (CalamityWorld.death ? 0.25 : 0.0); + double mult = 1.0 - + (revenge ? 0.25 : 0.0) - + (CalamityWorld.death ? 0.25 : 0.0); - bool cosmicDust = lifeToAlpha > (int)(15D * mult) || CalamityWorld.bossRushActive; - bool speedBoost = lifeToAlpha > (int)(25D * mult) || CalamityWorld.bossRushActive; - bool cosmicRain = lifeToAlpha > (int)(35D * mult) || CalamityWorld.bossRushActive; - bool cosmicSpeed = lifeToAlpha > (int)(50D * mult) || CalamityWorld.bossRushActive; + bool cosmicDust = lifeToAlpha > (int)(15D * mult) || CalamityWorld.bossRushActive; + bool speedBoost = lifeToAlpha > (int)(25D * mult) || CalamityWorld.bossRushActive; + bool cosmicRain = lifeToAlpha > (int)(35D * mult) || CalamityWorld.bossRushActive; + bool cosmicSpeed = lifeToAlpha > (int)(50D * mult) || CalamityWorld.bossRushActive; - Player player = Main.player[npc.target]; - npc.TargetClosest(true); - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vectorCenter = npc.Center; - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = cosmicSpeed ? 12f : 15f; - float num1001 = 5f; - float scaleFactor4 = 0.75f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = cosmicSpeed ? 12f : 15f; - float num1006 = 0.333333343f; - float num1007 = 10f; - float chargeSpeedDivisor = cosmicSpeed ? 11.85f : 14.85f; - num1006 *= num1005; - if (lifeToAlpha < 50) - { - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < 1) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2(70f), 70 * 2, 70 * 2, 173, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - } - if (Vector2.Distance(player.Center, vectorCenter) > 6400f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (npc.ai[0] <= 2f) - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.knockBackResist = 0.05f; - if (expertMode) - { - npc.knockBackResist *= Main.expertKnockBack; - } - if (cosmicSpeed) - { - npc.knockBackResist = 0f; - } - float speed = expertMode ? 14f : 12f; - if (speedBoost) - { - speed = expertMode ? 16f : 14f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed += 3f; - } - Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); - float num795 = player.Center.X - vector98.X; - float num796 = player.Center.Y - vector98.Y; - float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); - num797 = speed / num797; - num795 *= num797; - num796 *= num797; - npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; - } - else - { - npc.knockBackResist = 0f; - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 120f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; + Player player = Main.player[npc.target]; + npc.TargetClosest(true); + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vectorCenter = npc.Center; + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = cosmicSpeed ? 12f : 15f; + float num1001 = 5f; + float scaleFactor4 = 0.75f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = cosmicSpeed ? 12f : 15f; + float num1006 = 0.333333343f; + float num1007 = 10f; + float chargeSpeedDivisor = cosmicSpeed ? 11.85f : 14.85f; + num1006 *= num1005; + if (lifeToAlpha < 50) + { + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < 1) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2(70f), 70 * 2, 70 * 2, 173, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + } + if (Vector2.Distance(player.Center, vectorCenter) > 6400f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (npc.ai[0] <= 2f) + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.knockBackResist = 0.05f; + if (expertMode) + { + npc.knockBackResist *= Main.expertKnockBack; + } + if (cosmicSpeed) + { + npc.knockBackResist = 0f; + } + float speed = expertMode ? 14f : 12f; + if (speedBoost) + { + speed = expertMode ? 16f : 14f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed += 3f; + } + Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); + float num795 = player.Center.X - vector98.X; + float num796 = player.Center.Y - vector98.Y; + float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); + num797 = speed / num797; + num795 *= num797; + num796 *= num797; + npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; + } + else + { + npc.knockBackResist = 0f; + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 120f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)player.Center.X / 16; + num1251 = (int)player.Center.Y / 16; - int min = 23; - int max = 26; + int min = 23; + int max = 26; - if (Main.rand.NextBool(2)) - num1250 += Main.rand.Next(min, max); - else - num1250 -= Main.rand.Next(min, max); + if (Main.rand.NextBool(2)) + num1250 += Main.rand.Next(min, max); + else + num1250 -= Main.rand.Next(min, max); - if (Main.rand.NextBool(2)) - num1251 += Main.rand.Next(min, max); - else - num1251 -= Main.rand.Next(min, max); + if (Main.rand.NextBool(2)) + num1251 += Main.rand.Next(min, max); + else + num1251 -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num1250, num1251)) - break; + if (!WorldGen.SolidTile(num1250, num1251)) + break; - if (num1249 > 100) - return; - } - npc.ai[0] = 1f; - npc.ai[1] = (float)num1250; - npc.ai[2] = (float)num1251; - npc.netUpdate = true; - return; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.alpha += 25; - if (npc.alpha >= 255) - { - Main.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= 25; - if (npc.alpha <= lifeToAlpha) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - if (Main.netMode != NetmodeID.MultiplayerClient && revenge) - { - int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); - } - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - int num623 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num623].velocity *= 3f; - Main.dust[num623].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num623].scale = 0.5f; - Main.dust[num623].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - int num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num625].noGravity = true; - Main.dust[num625].velocity *= 5f; - num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num625].velocity *= 2f; - } - } - npc.ai[3] += 1f; - npc.alpha = lifeToAlpha; - if (npc.ai[3] >= 3f) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[0] = 0f; + if (num1249 > 100) + return; + } + npc.ai[0] = 1f; + npc.ai[1] = (float)num1250; + npc.ai[2] = (float)num1251; + npc.netUpdate = true; + return; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.alpha += 25; + if (npc.alpha >= 255) + { + Main.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= 25; + if (npc.alpha <= lifeToAlpha) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + if (Main.netMode != NetmodeID.MultiplayerClient && revenge) + { + int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + } + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + int num623 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num623].velocity *= 3f; + Main.dust[num623].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num623].scale = 0.5f; + Main.dust[num623].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + int num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num625].noGravity = true; + Main.dust[num625].velocity *= 5f; + num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num625].velocity *= 2f; + } + } + npc.ai[3] += 1f; + npc.alpha = lifeToAlpha; + if (npc.ai[3] >= 3f) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[0] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.life < npc.lifeMax / 4 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 30f == 29f) - { - flag104 = true; - } - } - else if (npc.life < npc.lifeMax / 2) - { - if (npc.ai[1] % 35f == 34f) - { - flag104 = true; - } - } - else if (npc.ai[1] % 40f == 39f) - { - flag104 = true; - } - if (flag104) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num1070 = 15f; //changed from 10 - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1070 += 3f; - } - if (cosmicRain) - { - num1070 += 1f; //changed from 3 not a prob - } - if (cosmicSpeed) - { - num1070 += 1f; - } - if (revenge) - { - num1070 += 1f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1070 += 1f; - } - float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - int num1074 = expertMode ? 48 : 60; //projectile damage - int num1075 = mod.ProjectileType("SignusScythe"); //projectile type - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, (float)(npc.target + 1)); - } - } - if (npc.position.Y > player.position.Y - 200f) //200 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.975f; - } - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - } - else if (npc.position.Y < player.position.Y - 400f) //500 - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.975f; - } - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 500f) //100 - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 15f) - { - npc.velocity.X = 15f; - } - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 500f) //100 - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -15f) - { - npc.velocity.X = -15f; - } - } - if (npc.ai[1] > 300f) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (NPC.CountNPCS(mod.NPCType("CosmicLantern")) < 5) - { - for (int x = 0; x < 5; x++) - { - int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); - } - spawnY -= 60; - } - spawnY = 120; - } - } - npc.TargetClosest(false); - npc.rotation = npc.velocity.ToRotation(); - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - if (npc.rotation < -1.57079637f) - { - npc.rotation += 3.14159274f; - } - if (npc.rotation > 1.57079637f) - { - npc.rotation -= 3.14159274f; - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - phaseSwitch += 1; - if (chargeSwitch == 0) //line up the charge - { - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = player.Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); - if (num1013 > num999 || !flag64) - { - npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / chargeSpeedDivisor; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - chargeSwitch = 1; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (chargeSwitch == 1) //pause before charge - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - chargeSwitch = 2; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (chargeSwitch == 2) //charging - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - dustTimer--; - if (cosmicDust && dustTimer <= 0) - { - Main.PlaySound(SoundID.Item73, npc.position); - int damage = expertMode ? 60 : 70; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("EssenceDust"), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].timeLeft = 60; - Main.projectile[projectile].velocity.X = 0f; - Main.projectile[projectile].velocity.Y = 0f; - dustTimer = 3; - } - } - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, player.Center) > num1004 && npc.Center.Y > player.Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - chargeSwitch = 3; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = player.Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / chargeSpeedDivisor; - } - } - else if (chargeSwitch == 3) //slow down after charging and reset - { - npc.ai[1] -= 2f; - if (npc.ai[1] <= 0f) - { - chargeSwitch = 0; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.97f; - } - if (phaseSwitch > 300) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - chargeSwitch = 0; - phaseSwitch = 0; - npc.netUpdate = true; - } - } - } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.life < npc.lifeMax / 4 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 30f == 29f) + { + flag104 = true; + } + } + else if (npc.life < npc.lifeMax / 2) + { + if (npc.ai[1] % 35f == 34f) + { + flag104 = true; + } + } + else if (npc.ai[1] % 40f == 39f) + { + flag104 = true; + } + if (flag104) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num1070 = 15f; //changed from 10 + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1070 += 3f; + } + if (cosmicRain) + { + num1070 += 1f; //changed from 3 not a prob + } + if (cosmicSpeed) + { + num1070 += 1f; + } + if (revenge) + { + num1070 += 1f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1070 += 1f; + } + float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X; + float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y; + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + int num1074 = expertMode ? 48 : 60; //projectile damage + int num1075 = mod.ProjectileType("SignusScythe"); //projectile type + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, (float)(npc.target + 1)); + } + } + if (npc.position.Y > player.position.Y - 200f) //200 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.975f; + } + npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + } + else if (npc.position.Y < player.position.Y - 400f) //500 + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.975f; + } + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 500f) //100 + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X > 15f) + { + npc.velocity.X = 15f; + } + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 500f) //100 + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X < -15f) + { + npc.velocity.X = -15f; + } + } + if (npc.ai[1] > 300f) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.CountNPCS(mod.NPCType("CosmicLantern")) < 5) + { + for (int x = 0; x < 5; x++) + { + int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + } + spawnY -= 60; + } + spawnY = 120; + } + } + npc.TargetClosest(false); + npc.rotation = npc.velocity.ToRotation(); + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + if (npc.rotation < -1.57079637f) + { + npc.rotation += 3.14159274f; + } + if (npc.rotation > 1.57079637f) + { + npc.rotation -= 3.14159274f; + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + phaseSwitch += 1; + if (chargeSwitch == 0) //line up the charge + { + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = player.Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); + if (num1013 > num999 || !flag64) + { + npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / chargeSpeedDivisor; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + chargeSwitch = 1; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (chargeSwitch == 1) //pause before charge + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + chargeSwitch = 2; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (chargeSwitch == 2) //charging + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + dustTimer--; + if (cosmicDust && dustTimer <= 0) + { + Main.PlaySound(SoundID.Item73, npc.position); + int damage = expertMode ? 60 : 70; + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("EssenceDust"), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].timeLeft = 60; + Main.projectile[projectile].velocity.X = 0f; + Main.projectile[projectile].velocity.Y = 0f; + dustTimer = 3; + } + } + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, player.Center) > num1004 && npc.Center.Y > player.Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + chargeSwitch = 3; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = player.Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / chargeSpeedDivisor; + } + } + else if (chargeSwitch == 3) //slow down after charging and reset + { + npc.ai[1] -= 2f; + if (npc.ai[1] <= 0f) + { + chargeSwitch = 0; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.97f; + } + if (phaseSwitch > 300) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + chargeSwitch = 0; + phaseSwitch = 0; + npc.netUpdate = true; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.ai[0] == 4f) - { - if (npc.frameCounter > 72.0) //12 - { - npc.frameCounter = 0.0; - } - } - else - { - int frameY = 196; - if (npc.frameCounter > 72.0) - { - npc.frameCounter = 0.0; - } - npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); //1 to 6 - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.ai[0] == 4f) + { + if (npc.frameCounter > 72.0) //12 + { + npc.frameCounter = 0.0; + } + } + else + { + int frameY = 196; + if (npc.frameCounter > 72.0) + { + npc.frameCounter = 0.0; + } + npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); //1 to 6 + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D NPCTexture = Main.npcTexture[npc.type]; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - int frameCount = Main.npcFrameCount[npc.type]; - float scale = npc.scale; - float rotation = npc.rotation; - float offsetY = npc.gfxOffY; - if (npc.ai[0] == 4f) - { - NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt2"); - int height = 564; - int width = 176; - Vector2 vector = new Vector2((float)(width / 2), (float)(height / frameCount / 2)); - Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, height / frameCount); - frame.Y = 94 * (int)(npc.frameCounter / 12.0); //1 to 6 - if (frame.Y >= 94 * 6) - { - frame.Y = 0; - } - Main.spriteBatch.Draw(NPCTexture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * scale / 2f + vector.X * scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)height * scale / (float)frameCount + 4f + vector.Y * scale + 0f + offsetY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(drawColor), - rotation, - vector, - scale, - spriteEffects, - 0f); - return false; - } - else if (npc.ai[0] == 3f) - { - NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt"); - } - else - { - NPCTexture = Main.npcTexture[npc.type]; - } - Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / frameCount / 2)); - Main.spriteBatch.Draw(NPCTexture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)frameCount + 4f + vector11.Y * scale + 0f + offsetY), - new Microsoft.Xna.Framework.Rectangle?(frame2), - npc.GetAlpha(drawColor), - rotation, - vector11, - scale, - spriteEffects, - 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D NPCTexture = Main.npcTexture[npc.type]; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + int frameCount = Main.npcFrameCount[npc.type]; + float scale = npc.scale; + float rotation = npc.rotation; + float offsetY = npc.gfxOffY; + if (npc.ai[0] == 4f) + { + NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt2"); + int height = 564; + int width = 176; + Vector2 vector = new Vector2((float)(width / 2), (float)(height / frameCount / 2)); + Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, height / frameCount); + frame.Y = 94 * (int)(npc.frameCounter / 12.0); //1 to 6 + if (frame.Y >= 94 * 6) + { + frame.Y = 0; + } + Main.spriteBatch.Draw(NPCTexture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * scale / 2f + vector.X * scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)height * scale / (float)frameCount + 4f + vector.Y * scale + 0f + offsetY), + new Microsoft.Xna.Framework.Rectangle?(frame), + npc.GetAlpha(drawColor), + rotation, + vector, + scale, + spriteEffects, + 0f); + return false; + } + else if (npc.ai[0] == 3f) + { + NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt"); + } + else + { + NPCTexture = Main.npcTexture[npc.type]; + } + Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / frameCount / 2)); + Main.spriteBatch.Draw(NPCTexture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)frameCount + 4f + vector11.Y * scale + 0f + offsetY), + new Microsoft.Xna.Framework.Rectangle?(frame2), + npc.GetAlpha(drawColor), + rotation, + vector11, + scale, + spriteEffects, + 0f); + return false; + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } - public override void NPCLoot() - { + public override void NPCLoot() + { // Only drop items if fought alone if (CalamityWorld.DoGSecondStageCountdown <= 0) { @@ -751,60 +751,60 @@ namespace CalamityMod.NPCs.CosmicWraith CalamityMod.UpdateServerBoolean(); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 150; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus5"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 150; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus5"), 1f); + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } } diff --git a/NPCs/CosmicWraith/SignusBomb.cs b/NPCs/CosmicWraith/SignusBomb.cs index fcc3d58540..0dbba7cd97 100644 --- a/NPCs/CosmicWraith/SignusBomb.cs +++ b/NPCs/CosmicWraith/SignusBomb.cs @@ -1,47 +1,46 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.CosmicWraith { public class SignusBomb : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Mine"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Mine"); + } - public override void SetDefaults() - { - npc.damage = 0; - npc.width = 30; - npc.height = 30; - npc.lifeMax = 100; - npc.aiStyle = -1; + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 30; + npc.height = 30; + npc.lifeMax = 100; + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { + public override void AI() + { npc.rotation = npc.velocity.X * 0.04f; if (npc.ai[1] == 0f) { @@ -64,23 +63,23 @@ namespace CalamityMod.NPCs.CosmicWraith } } Player player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - return; - } - } - else if (npc.timeLeft > 600) - { - npc.timeLeft = 600; - } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + return; + } + } + else if (npc.timeLeft > 600) + { + npc.timeLeft = 600; + } Vector2 vector = Main.player[npc.target].Center - npc.Center; if (vector.Length() < 90f || npc.ai[3] >= 300f) { @@ -97,45 +96,45 @@ namespace CalamityMod.NPCs.CosmicWraith npc.velocity.X *= 0.985f; return; } - npc.TargetClosest(true); - float num1372 = 14f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } + npc.TargetClosest(true); + float num1372 = 14f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } public override Color? GetAlpha(Color drawColor) { @@ -173,5 +172,5 @@ namespace CalamityMod.NPCs.CosmicWraith } return true; } - } + } } diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 64b12bbd1c..785e36989c 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -1,38 +1,37 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Crabulon { public class CrabShroom : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crab Shroom"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crab Shroom"); Main.npcFrameCount[npc.type] = 4; } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 25; - npc.width = 14; - npc.height = 14; - npc.lifeMax = 25; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 25; + npc.width = 14; + npc.height = 14; + npc.lifeMax = 25; if (CalamityWorld.bossRushActive) { npc.lifeMax = 90000; } aiType = -1; - npc.knockBackResist = 0.75f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } + npc.knockBackResist = 0.75f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } public override void FindFrame(int frameHeight) { @@ -43,53 +42,53 @@ namespace CalamityMod.NPCs.Crabulon } public override void AI() - { + { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.2f, 0.4f); bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - float speed = revenge ? 1.5f : 1f; - Player player = Main.player[npc.target]; - npc.velocity.Y = npc.velocity.Y + 0.02f; - if (npc.velocity.Y > speed) - { - npc.velocity.Y = speed; - } - npc.TargetClosest(true); - if (npc.position.X + (float)npc.width < player.position.X) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.2f : 0.1f); - } - else if (npc.position.X > player.position.X + (float)player.width) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.2f : 0.1f); - } - if (npc.velocity.X > (CalamityWorld.bossRushActive ? 15f : 5f) || npc.velocity.X < (CalamityWorld.bossRushActive ? -15f : -5f)) - { - npc.velocity.X = npc.velocity.X * 0.97f; - } - npc.rotation = npc.velocity.X * 0.1f; - } + float speed = revenge ? 1.5f : 1f; + Player player = Main.player[npc.target]; + npc.velocity.Y = npc.velocity.Y + 0.02f; + if (npc.velocity.Y > speed) + { + npc.velocity.Y = speed; + } + npc.TargetClosest(true); + if (npc.position.X + (float)npc.width < player.position.X) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.2f : 0.1f); + } + else if (npc.position.X > player.position.X + (float)player.width) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.2f : 0.1f); + } + if (npc.velocity.X > (CalamityWorld.bossRushActive ? 15f : 5f) || npc.velocity.X < (CalamityWorld.bossRushActive ? -15f : -5f)) + { + npc.velocity.X = npc.velocity.X * 0.97f; + } + npc.rotation = npc.velocity.X * 0.1f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index a9ee8e8baf..a4a9481f29 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -1,495 +1,495 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Crabulon { [AutoloadBossHead] - public class CrabulonIdle : ModNPC - { - private int shotSpacing = 1000; + public class CrabulonIdle : ModNPC + { + private int shotSpacing = 1000; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 14f; - npc.damage = 40; - npc.width = 280; - npc.height = 160; - npc.defense = 8; - npc.lifeMax = CalamityWorld.revenge ? 4000 : 3000; - if (CalamityWorld.death) - { - npc.lifeMax = 6930; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.noGravity = false; - npc.noTileCollide = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); - else - music = MusicID.Boss4; - npc.boss = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 4, 0, 0); - npc.HitSound = SoundID.NPCHit45; - npc.DeathSound = SoundID.NPCDeath1; - bossBag = mod.ItemType("CrabulonBag"); - } + public override void SetDefaults() + { + npc.npcSlots = 14f; + npc.damage = 40; + npc.width = 280; + npc.height = 160; + npc.defense = 8; + npc.lifeMax = CalamityWorld.revenge ? 4000 : 3000; + if (CalamityWorld.death) + { + npc.lifeMax = 6930; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.noGravity = false; + npc.noTileCollide = false; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); + else + music = MusicID.Boss4; + npc.boss = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 4, 0, 0); + npc.HitSound = SoundID.NPCHit45; + npc.DeathSound = SoundID.NPCDeath1; + bossBag = mod.ItemType("CrabulonBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(shotSpacing); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(shotSpacing); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - shotSpacing = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + shotSpacing = reader.ReadInt32(); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 1f); - Player player = Main.player[npc.target]; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.noTileCollide = true; - npc.velocity = new Vector2(0f, 10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - } - if (npc.ai[0] != 0f && npc.ai[0] < 3f) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = player.position.X + (float)(player.width / 2) - vector34.X; - float num350 = player.position.Y + (float)(player.height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num352 = 1; - npc.localAI[3] += 2f; - if (CalamityWorld.bossRushActive) - { - npc.localAI[3] += 2f; - num352 += 3; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[3] += 1f; - num352 += 2; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[3] += 2f; - num352 += 3; - } - if (npc.ai[3] == 0f) - { - if (npc.localAI[3] > 600f) - { - npc.ai[3] = 1f; - npc.localAI[3] = 0f; - } - } - else if (npc.localAI[3] > 45f) - { - npc.localAI[3] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] >= (float)num352) - { - npc.ai[3] = 0f; - } - float num353 = 10f; - int num354 = expertMode ? 11 : 14; - int num355 = mod.ProjectileType("MushBomb"); - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - if (CalamityWorld.bossRushActive) - { - num354 += 3; - num353 += 3f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - num354++; - num353 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num354++; - num353 += 1f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num354 += 3; - num353 += 1f; - } - vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num349 = player.position.X + (float)player.width * 0.5f - vector34.X; - num350 = player.position.Y + (float)player.height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, num355, num354, 0f, Main.myPlayer, 0f, 0f); - } - } - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.Server) - { - if (!player.dead && player.active && (player.Center - npc.Center).Length() < 800f) - { - player.AddBuff(mod.BuffType("Mushy"), 2); - } - } - int sporeDust = Dust.NewDust(npc.position, npc.width, npc.height, 56, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), 1.2f); - Main.dust[sporeDust].noGravity = true; - Main.dust[sporeDust].velocity *= 0.5f; - npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 420f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - float num823 = 1.25f; - bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num823 = 1.5f; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num823 = 2f; - if (CalamityWorld.bossRushActive) - num823 = 12f; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num823 = 16f; + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 1f); + Player player = Main.player[npc.target]; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.noTileCollide = true; + npc.velocity = new Vector2(0f, 10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + } + if (npc.ai[0] != 0f && npc.ai[0] < 3f) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = player.position.X + (float)(player.width / 2) - vector34.X; + float num350 = player.position.Y + (float)(player.height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num352 = 1; + npc.localAI[3] += 2f; + if (CalamityWorld.bossRushActive) + { + npc.localAI[3] += 2f; + num352 += 3; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[3] += 1f; + num352 += 2; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[3] += 2f; + num352 += 3; + } + if (npc.ai[3] == 0f) + { + if (npc.localAI[3] > 600f) + { + npc.ai[3] = 1f; + npc.localAI[3] = 0f; + } + } + else if (npc.localAI[3] > 45f) + { + npc.localAI[3] = 0f; + npc.ai[3] += 1f; + if (npc.ai[3] >= (float)num352) + { + npc.ai[3] = 0f; + } + float num353 = 10f; + int num354 = expertMode ? 11 : 14; + int num355 = mod.ProjectileType("MushBomb"); + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + if (CalamityWorld.bossRushActive) + { + num354 += 3; + num353 += 3f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + num354++; + num353 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num354++; + num353 += 1f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num354 += 3; + num353 += 1f; + } + vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num349 = player.position.X + (float)player.width * 0.5f - vector34.X; + num350 = player.position.Y + (float)player.height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num353 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349; + vector34.Y += num350; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, num355, num354, 0f, Main.myPlayer, 0f, 0f); + } + } + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.Server) + { + if (!player.dead && player.active && (player.Center - npc.Center).Length() < 800f) + { + player.AddBuff(mod.BuffType("Mushy"), 2); + } + } + int sporeDust = Dust.NewDust(npc.position, npc.width, npc.height, 56, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), 1.2f); + Main.dust[sporeDust].noGravity = true; + Main.dust[sporeDust].velocity *= 0.5f; + npc.ai[1] += 1f; + if (npc.justHit || npc.ai[1] >= 420f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + float num823 = 1.25f; + bool flag51 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num823 = 1.5f; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num823 = 2f; + if (CalamityWorld.bossRushActive) + num823 = 12f; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num823 = 16f; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) - { - flag51 = true; - } - if (flag51) - { - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) + { + flag51 = true; + } + if (flag51) + { + npc.velocity.X = npc.velocity.X * 0.9f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + } + else + { + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); - if (npc.direction > 0) - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; - if (npc.direction < 0) - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; - } - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); - bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) - { - flag52 = true; - } - if (flag52) - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y > -0.2) - { - npc.velocity.Y = npc.velocity.Y - 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = npc.velocity.Y + 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= 360f) - { - npc.noGravity = false; - npc.noTileCollide = false; - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - } - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = false; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 0f) - { - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 4f; - } - if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 8f; - } - } - if (npc.ai[1] >= 300f) - { - npc.ai[1] = -20f; - npc.frameCounter = 0.0; - } - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(true); - npc.velocity.X = (float)((CalamityWorld.bossRushActive ? 12 : 4) * npc.direction); - npc.velocity.Y = CalamityWorld.bossRushActive ? -16f : -12.1f; - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - } - } - else - { - if (npc.velocity.Y == 0f) - { - Main.PlaySound(SoundID.Item14, npc.position); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile((int)npc.Center.X, (int)npc.Center.Y + 20, 0f, 0f, mod.ProjectileType("Mushmash"), 20, 0f, Main.myPlayer, 0f, 0f); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 3f) - { - if (Main.netMode != NetmodeID.MultiplayerClient && revenge) - { - for (int x = 0; x < 20; x++) - { - int num354 = expertMode ? 11 : 14; - Projectile.NewProjectile(npc.Center.X + (float)shotSpacing, npc.Center.Y - 1000f, 0f, 0f, mod.ProjectileType("MushBombFall"), num354, 0f, Main.myPlayer, 0f, 0f); - shotSpacing -= 100; - } - shotSpacing = 1000; - } - npc.ai[0] = 1f; - npc.ai[2] = 0f; - } - else - { - npc.ai[0] = 3f; - } - for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) - { - for (int num623 = 0; num623 < 4; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].velocity *= 0.2f; - } - } - } - else - { - npc.TargetClosest(true); - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) - { - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.3f : 0.15f); - } - else - { - if (npc.direction < 0) - { - npc.velocity.X = npc.velocity.X - 0.2f; - } - else if (npc.direction > 0) - { - npc.velocity.X = npc.velocity.X + 0.2f; - } - float num626 = CalamityWorld.bossRushActive ? 5f : 2.5f; - if (revenge) - { - num626 += 1f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num626 += 3f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num626 += 2f; - } - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) - { - num626 += 1f; - } - if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) - { - num626 += 1f; - } - if (npc.velocity.X < -num626) - { - npc.velocity.X = -num626; - } - if (npc.velocity.X > num626) - { - npc.velocity.X = num626; - } - } - } - } - if (npc.localAI[0] == 0f && npc.life > 0) - { - npc.localAI[0] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < npc.localAI[0]) - { - npc.localAI[0] = (float)npc.life; - int num661 = (expertMode ? Main.rand.Next(2, 4) : Main.rand.Next(1, 3)); - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("CrabShroom"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-50, 51) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-50, -31) * 0.1f; - if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } + if (npc.direction > 0) + npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + if (npc.direction < 0) + npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + } + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + bool flag52 = false; + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) + { + flag52 = true; + } + if (flag52) + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y > -0.2) + { + npc.velocity.Y = npc.velocity.Y - 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = npc.velocity.Y + 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= 360f) + { + npc.noGravity = false; + npc.noTileCollide = false; + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + } + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = false; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 0f) + { + if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 4f; + } + if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 8f; + } + } + if (npc.ai[1] >= 300f) + { + npc.ai[1] = -20f; + npc.frameCounter = 0.0; + } + else if (npc.ai[1] == -1f) + { + npc.TargetClosest(true); + npc.velocity.X = (float)((CalamityWorld.bossRushActive ? 12 : 4) * npc.direction); + npc.velocity.Y = CalamityWorld.bossRushActive ? -16f : -12.1f; + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } + else + { + if (npc.velocity.Y == 0f) + { + Main.PlaySound(SoundID.Item14, npc.position); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile((int)npc.Center.X, (int)npc.Center.Y + 20, 0f, 0f, mod.ProjectileType("Mushmash"), 20, 0f, Main.myPlayer, 0f, 0f); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 3f) + { + if (Main.netMode != NetmodeID.MultiplayerClient && revenge) + { + for (int x = 0; x < 20; x++) + { + int num354 = expertMode ? 11 : 14; + Projectile.NewProjectile(npc.Center.X + (float)shotSpacing, npc.Center.Y - 1000f, 0f, 0f, mod.ProjectileType("MushBombFall"), num354, 0f, Main.myPlayer, 0f, 0f); + shotSpacing -= 100; + } + shotSpacing = 1000; + } + npc.ai[0] = 1f; + npc.ai[2] = 0f; + } + else + { + npc.ai[0] = 3f; + } + for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + { + for (int num623 = 0; num623 < 4; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].velocity *= 0.2f; + } + } + } + else + { + npc.TargetClosest(true); + if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) + { + npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.3f : 0.15f); + } + else + { + if (npc.direction < 0) + { + npc.velocity.X = npc.velocity.X - 0.2f; + } + else if (npc.direction > 0) + { + npc.velocity.X = npc.velocity.X + 0.2f; + } + float num626 = CalamityWorld.bossRushActive ? 5f : 2.5f; + if (revenge) + { + num626 += 1f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num626 += 3f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num626 += 2f; + } + if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + { + num626 += 1f; + } + if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) + { + num626 += 1f; + } + if (npc.velocity.X < -num626) + { + npc.velocity.X = -num626; + } + if (npc.velocity.X > num626) + { + npc.velocity.X = num626; + } + } + } + } + if (npc.localAI[0] == 0f && npc.life > 0) + { + npc.localAI[0] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < npc.localAI[0]) + { + npc.localAI[0] = (float)npc.life; + int num661 = (expertMode ? Main.rand.Next(2, 4) : Main.rand.Next(1, 3)); + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("CrabShroom"); + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-50, 51) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-50, -31) * 0.1f; + if (Main.netMode == NetmodeID.Server && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return npc.ai[0] > 1f; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.ai[0] > 1f; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/Crabulon/CrabulonIdleAlt"); - Texture2D textureAttack = mod.GetTexture("NPCs/Crabulon/CrabulonAttack"); - if (npc.ai[0] > 2f) - { - CalamityMod.DrawTexture(spriteBatch, textureAttack, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, (npc.ai[0] == 2f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor, true); - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/Crabulon/CrabulonIdleAlt"); + Texture2D textureAttack = mod.GetTexture("NPCs/Crabulon/CrabulonAttack"); + if (npc.ai[0] > 2f) + { + CalamityMod.DrawTexture(spriteBatch, textureAttack, 0, npc, drawColor, true); + } + else + { + CalamityMod.DrawTexture(spriteBatch, (npc.ai[0] == 2f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor, true); + } + return false; + } public override void NPCLoot() - { + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("CrabulonTrophy"), 10); @@ -498,7 +498,7 @@ namespace CalamityMod.NPCs.Crabulon // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Materials DropHelper.DropItem(npc, ItemID.GlowingMushroom, 20, 30); DropHelper.DropItem(npc, ItemID.MushroomGrassSeeds, 3, 6); @@ -511,60 +511,60 @@ namespace CalamityMod.NPCs.Crabulon // Vanity DropHelper.DropItemChance(npc, mod.ItemType("CrabulonMask"), 7); - } + } // Mark Crabulon as dead CalamityWorld.downedCrabulon = true; CalamityMod.UpdateServerBoolean(); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon5"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon6"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon7"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon5"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon6"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon7"), 1f); + } + } + } } diff --git a/NPCs/Cryogen/Cryocore.cs b/NPCs/Cryogen/Cryocore.cs index 515a6f5bf9..b6b5b79cdd 100644 --- a/NPCs/Cryogen/Cryocore.cs +++ b/NPCs/Cryogen/Cryocore.cs @@ -1,40 +1,40 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Cryogen { public class Cryocore : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryocore"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryocore"); Main.npcFrameCount[npc.type] = 5; } - public override void SetDefaults() - { - npc.damage = 35; - npc.width = 40; - npc.height = 40; - npc.defense = 6; - npc.lifeMax = 220; + public override void SetDefaults() + { + npc.damage = 35; + npc.width = 40; + npc.height = 40; + npc.defense = 6; + npc.lifeMax = 220; if (CalamityWorld.bossRushActive) { npc.lifeMax = 30000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.75f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - } + npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.75f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + } public override void FindFrame(int frameHeight) { @@ -45,52 +45,52 @@ namespace CalamityMod.NPCs.Cryogen } public override void AI() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); - npc.TargetClosest(true); - float num1372 = revenge ? 12f : 11f; - if (CalamityWorld.bossRushActive) - num1372 = 24f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.3f; - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - npc.rotation = npc.velocity.X * 0.15f; - } + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); + npc.TargetClosest(true); + float num1372 = revenge ? 12f : 11f; + if (CalamityWorld.bossRushActive) + num1372 = 24f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; + float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.3f; + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + npc.rotation = npc.velocity.X * 0.15f; + } public override void OnHitPlayer(Player player, int damage, bool crit) { @@ -99,24 +99,24 @@ namespace CalamityMod.NPCs.Cryogen } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore"), 1f); } - } - } + } + } } diff --git a/NPCs/Cryogen/Cryocore2.cs b/NPCs/Cryogen/Cryocore2.cs index 7d51a4d99c..45e305c769 100644 --- a/NPCs/Cryogen/Cryocore2.cs +++ b/NPCs/Cryogen/Cryocore2.cs @@ -1,40 +1,40 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Cryogen { public class Cryocore2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryocore"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryocore"); Main.npcFrameCount[npc.type] = 6; } - public override void SetDefaults() - { - npc.damage = 40; - npc.width = 66; - npc.height = 66; - npc.defense = 10; - npc.lifeMax = 300; + public override void SetDefaults() + { + npc.damage = 40; + npc.width = 66; + npc.height = 66; + npc.defense = 10; + npc.lifeMax = 300; if (CalamityWorld.bossRushActive) { npc.lifeMax = 40000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.5f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - } + npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.5f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + } public override void FindFrame(int frameHeight) { @@ -45,52 +45,52 @@ namespace CalamityMod.NPCs.Cryogen } public override void AI() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); - npc.TargetClosest(true); - float num1372 = revenge ? 14f : 12f; - if (CalamityWorld.bossRushActive) - num1372 = 28f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.3f; - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - npc.rotation = npc.velocity.X * 0.15f; - } + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); + npc.TargetClosest(true); + float num1372 = revenge ? 14f : 12f; + if (CalamityWorld.bossRushActive) + num1372 = 28f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; + float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.3f; + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + npc.rotation = npc.velocity.X * 0.15f; + } public override void OnHitPlayer(Player player, int damage, bool crit) { @@ -99,24 +99,24 @@ namespace CalamityMod.NPCs.Cryogen } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore2"), 1f); } - } - } + } + } } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index a6feb65ce2..4f6698a786 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,967 +1,968 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Cryogen { [AutoloadBossHead] - public class Cryogen : ModNPC - { - private int time = 0; - private int iceShard = 0; - private bool drawAltTexture = false; - private int teleportLocationX = 0; + public class Cryogen : ModNPC + { + private int time = 0; + private int iceShard = 0; + private bool drawAltTexture = false; + private int teleportLocationX = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen"); + } - public override void SetDefaults() - { - npc.npcSlots = 24f; - npc.damage = 50; - npc.width = 80; - npc.height = 80; - npc.defense = 12; + public override void SetDefaults() + { + npc.npcSlots = 24f; + npc.damage = 50; + npc.width = 80; + npc.height = 80; + npc.defense = 12; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = CalamityWorld.revenge ? 26300 : 17900; - if (CalamityWorld.death) - { - npc.lifeMax = 39900; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 3000000 : 2700000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - animationType = 10; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 12, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.OnFire] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); - else - music = MusicID.FrostMoon; - bossBag = mod.ItemType("CryogenBag"); - } + npc.lifeMax = CalamityWorld.revenge ? 26300 : 17900; + if (CalamityWorld.death) + { + npc.lifeMax = 39900; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 3000000 : 2700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + animationType = 10; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 12, 0, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.OnFire] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); + else + music = MusicID.FrostMoon; + bossBag = mod.ItemType("CryogenBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(drawAltTexture); - writer.Write(time); - writer.Write(iceShard); - writer.Write(teleportLocationX); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(drawAltTexture); + writer.Write(time); + writer.Write(iceShard); + writer.Write(teleportLocationX); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - drawAltTexture = reader.ReadBoolean(); - time = reader.ReadInt32(); - iceShard = reader.ReadInt32(); - teleportLocationX = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + drawAltTexture = reader.ReadBoolean(); + time = reader.ReadInt32(); + iceShard = reader.ReadInt32(); + teleportLocationX = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 1f, 1f); - Player player = Main.player[npc.target]; - bool isChill = player.ZoneSnow; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - double multAdd = revenge ? 0.1 : 0D; - npc.TargetClosest(true); - if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (npc.ai[0] < 4f || CalamityWorld.bossRushActive)) //spawn shield for phase 0 1 2 3, not 4 5 - { - int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CryogenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - npc.ai[2] = (float)(num6 + 1); - npc.localAI[1] = -1f; - npc.netUpdate = true; - Main.npc[num6].ai[0] = (float)npc.whoAmI; - Main.npc[num6].netUpdate = true; - } - int num7 = (int)npc.ai[2] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("CryogenIce")) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - npc.ai[2] = 0f; - if (npc.localAI[1] == -1f) - { - npc.localAI[1] = expertMode ? 720f : 1080f; - } - if (npc.localAI[1] > 0f) - { - npc.localAI[1] -= 1f; - } - } - if (npc.ai[0] == 0f || npc.ai[0] == 2f || npc.ai[0] == 4f) - { - npc.rotation = npc.velocity.X * 0.1f; - } - else if (npc.ai[0] == 1f || npc.ai[0] == 3f) - { - npc.rotation = 0f; - } - if (!Main.raining && !CalamityWorld.bossRushActive) - { - RainStart(); - } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (Main.netMode != NetmodeID.MultiplayerClient && expertMode) - { - time++; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - time++; - } - if (time >= 600) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 4f; - double offsetAngle; - int i; - int num184 = 25; - float velocity = CalamityWorld.bossRushActive ? 12f : 8f; - for (i = 0; i < 2; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); - } - time = 0; - } - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 12f : 8f; - int i; - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float num1246 = isChill ? 4f : 6f; - if (CalamityWorld.death) - { - num1246 = isChill ? 5f : 7f; - } - if (CalamityWorld.bossRushActive) - { - num1246 = 11f; - } - num1245 = num1246 / num1245; - num1243 *= num1245; - num1244 *= num1245; - npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; - if ((double)npc.life < (double)npc.lifeMax * (0.83 + multAdd)) - { - npc.ai[0] = 1f; - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 12f : 8f; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } - } - } - } - float num1164 = isChill ? 6f : 7.5f; - float num1165 = isChill ? 0.1f : 0.12f; - if (CalamityWorld.death) - { - num1164 = isChill ? 6.5f : 8f; - } - if (CalamityWorld.bossRushActive) - { - num1164 = 20f; - } - Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); - float num1166 = player.Center.X - vector133.X; - float num1167 = player.Center.Y - vector133.Y - 400f; - float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); - if (num1168 < 20f) - { - num1166 = npc.velocity.X; - num1167 = npc.velocity.Y; - } - else - { - num1168 = num1164 / num1168; - num1166 *= num1168; - num1167 *= num1168; - } - if (npc.velocity.X < num1166) - { - npc.velocity.X = npc.velocity.X + num1165; - if (npc.velocity.X < 0f && num1166 > 0f) - { - npc.velocity.X = npc.velocity.X + num1165 * 2f; - } - } - else if (npc.velocity.X > num1166) - { - npc.velocity.X = npc.velocity.X - num1165; - if (npc.velocity.X > 0f && num1166 < 0f) - { - npc.velocity.X = npc.velocity.X - num1165 * 2f; - } - } - if (npc.velocity.Y < num1167) - { - npc.velocity.Y = npc.velocity.Y + num1165; - if (npc.velocity.Y < 0f && num1167 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1165 * 2f; - } - } - else if (npc.velocity.Y > num1167) - { - npc.velocity.Y = npc.velocity.Y - num1165; - if (npc.velocity.Y > 0f && num1167 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1165 * 2f; - } - } - if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != NetmodeID.MultiplayerClient) - { - iceShard += 4; - if (iceShard > 8) - { - iceShard = 0; - int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); - int damage = expertMode ? 23 : 26; - float velocity = revenge ? 6f : 5f; - if (CalamityWorld.bossRushActive) - velocity = 9f; + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 1f, 1f); + Player player = Main.player[npc.target]; + bool isChill = player.ZoneSnow; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + double multAdd = revenge ? 0.1 : 0D; + npc.TargetClosest(true); + if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (npc.ai[0] < 4f || CalamityWorld.bossRushActive)) //spawn shield for phase 0 1 2 3, not 4 5 + { + int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CryogenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + npc.ai[2] = (float)(num6 + 1); + npc.localAI[1] = -1f; + npc.netUpdate = true; + Main.npc[num6].ai[0] = (float)npc.whoAmI; + Main.npc[num6].netUpdate = true; + } + int num7 = (int)npc.ai[2] - 1; + if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("CryogenIce")) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + npc.ai[2] = 0f; + if (npc.localAI[1] == -1f) + { + npc.localAI[1] = expertMode ? 720f : 1080f; + } + if (npc.localAI[1] > 0f) + { + npc.localAI[1] -= 1f; + } + } + if (npc.ai[0] == 0f || npc.ai[0] == 2f || npc.ai[0] == 4f) + { + npc.rotation = npc.velocity.X * 0.1f; + } + else if (npc.ai[0] == 1f || npc.ai[0] == 3f) + { + npc.rotation = 0f; + } + if (!Main.raining && !CalamityWorld.bossRushActive) + { + RainStart(); + } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (Main.netMode != NetmodeID.MultiplayerClient && expertMode) + { + time++; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + time++; + } + if (time >= 600) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 4f; + double offsetAngle; + int i; + int num184 = 25; + float velocity = CalamityWorld.bossRushActive ? 12f : 8f; + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); + } + time = 0; + } + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + float velocity = CalamityWorld.bossRushActive ? 12f : 8f; + int i; + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float num1246 = isChill ? 4f : 6f; + if (CalamityWorld.death) + { + num1246 = isChill ? 5f : 7f; + } + if (CalamityWorld.bossRushActive) + { + num1246 = 11f; + } + num1245 = num1246 / num1245; + num1243 *= num1245; + num1244 *= num1245; + npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; + if ((double)npc.life < (double)npc.lifeMax * (0.83 + multAdd)) + { + npc.ai[0] = 1f; + npc.localAI[0] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + float velocity = CalamityWorld.bossRushActive ? 12f : 8f; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[ice].timeLeft = 300; + Main.projectile[ice2].timeLeft = 300; + } + } + } + } + float num1164 = isChill ? 6f : 7.5f; + float num1165 = isChill ? 0.1f : 0.12f; + if (CalamityWorld.death) + { + num1164 = isChill ? 6.5f : 8f; + } + if (CalamityWorld.bossRushActive) + { + num1164 = 20f; + } + Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); + float num1166 = player.Center.X - vector133.X; + float num1167 = player.Center.Y - vector133.Y - 400f; + float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); + if (num1168 < 20f) + { + num1166 = npc.velocity.X; + num1167 = npc.velocity.Y; + } + else + { + num1168 = num1164 / num1168; + num1166 *= num1168; + num1167 *= num1168; + } + if (npc.velocity.X < num1166) + { + npc.velocity.X = npc.velocity.X + num1165; + if (npc.velocity.X < 0f && num1166 > 0f) + { + npc.velocity.X = npc.velocity.X + num1165 * 2f; + } + } + else if (npc.velocity.X > num1166) + { + npc.velocity.X = npc.velocity.X - num1165; + if (npc.velocity.X > 0f && num1166 < 0f) + { + npc.velocity.X = npc.velocity.X - num1165 * 2f; + } + } + if (npc.velocity.Y < num1167) + { + npc.velocity.Y = npc.velocity.Y + num1165; + if (npc.velocity.Y < 0f && num1167 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1165 * 2f; + } + } + else if (npc.velocity.Y > num1167) + { + npc.velocity.Y = npc.velocity.Y - num1165; + if (npc.velocity.Y > 0f && num1167 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1165 * 2f; + } + } + if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != NetmodeID.MultiplayerClient) + { + iceShard += 4; + if (iceShard > 8) + { + iceShard = 0; + int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); + int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); + int damage = expertMode ? 23 : 26; + float velocity = revenge ? 6f : 5f; + if (CalamityWorld.bossRushActive) + velocity = 9f; - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, velocity, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if ((double)npc.life < (double)npc.lifeMax * (0.66 + multAdd)) - { - npc.ai[0] = 2f; - npc.localAI[0] = 0f; - iceShard = 0; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - if (Main.rand.NextBool(2)) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 14f : 9f; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } - } - else - { - float num179 = revenge ? 9f : 7f; - if (CalamityWorld.bossRushActive) - num179 = 14f; + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, velocity, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if ((double)npc.life < (double)npc.lifeMax * (0.66 + multAdd)) + { + npc.ai[0] = 2f; + npc.localAI[0] = 0f; + iceShard = 0; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + if (Main.rand.NextBool(2)) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + float velocity = CalamityWorld.bossRushActive ? 14f : 9f; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[ice].timeLeft = 300; + Main.projectile[ice2].timeLeft = 300; + } + } + else + { + float num179 = revenge ? 9f : 7f; + if (CalamityWorld.bossRushActive) + num179 = 14f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 23 : 26; - int num185 = mod.ProjectileType("IceRain"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 15; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-100, 101); - num182 += (float)Main.rand.Next(-100, 101); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float num1246 = isChill ? 6f : 8f; - if (CalamityWorld.death) - { - num1246 = isChill ? 7f : 9f; - } - if (CalamityWorld.bossRushActive) - { - num1246 = 15f; - } - num1245 = num1246 / num1245; - num1243 *= num1245; - num1244 *= num1245; - npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; - if ((double)npc.life < (double)npc.lifeMax * (0.49 + multAdd)) - { - npc.ai[0] = 3f; - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num179 = revenge ? 9f : 7f; - if (CalamityWorld.bossRushActive) - num179 = 14f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 23 : 26; + int num185 = mod.ProjectileType("IceRain"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 15; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-100, 101); + num182 += (float)Main.rand.Next(-100, 101); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float num1246 = isChill ? 6f : 8f; + if (CalamityWorld.death) + { + num1246 = isChill ? 7f : 9f; + } + if (CalamityWorld.bossRushActive) + { + num1246 = 15f; + } + num1245 = num1246 / num1245; + num1243 *= num1245; + num1244 *= num1245; + npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; + if ((double)npc.life < (double)npc.lifeMax * (0.49 + multAdd)) + { + npc.ai[0] = 3f; + npc.localAI[0] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num179 = revenge ? 9f : 7f; + if (CalamityWorld.bossRushActive) + num179 = 14f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 23 : 26; - int num185 = mod.ProjectileType("IceRain"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 15; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-100, 101); - num182 += (float)Main.rand.Next(-100, 101); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - float num1164 = isChill ? 6.5f : 8f; - float num1165 = isChill ? 0.1f : 0.12f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1164 = isChill ? 7f : 8.5f; - } - Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); - float num1166 = player.Center.X - vector133.X; - float num1167 = player.Center.Y - vector133.Y - 300f; - float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); - if (num1168 < 20f) - { - num1166 = npc.velocity.X; - num1167 = npc.velocity.Y; - } - else - { - num1168 = num1164 / num1168; - num1166 *= num1168; - num1167 *= num1168; - } - if (npc.velocity.X < num1166) - { - npc.velocity.X = npc.velocity.X + num1165; - if (npc.velocity.X < 0f && num1166 > 0f) - { - npc.velocity.X = npc.velocity.X + num1165 * 2f; - } - } - else if (npc.velocity.X > num1166) - { - npc.velocity.X = npc.velocity.X - num1165; - if (npc.velocity.X > 0f && num1166 < 0f) - { - npc.velocity.X = npc.velocity.X - num1165 * 2f; - } - } - if (npc.velocity.Y < num1167) - { - npc.velocity.Y = npc.velocity.Y + num1165; - if (npc.velocity.Y < 0f && num1167 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1165 * 2f; - } - } - else if (npc.velocity.Y > num1167) - { - npc.velocity.Y = npc.velocity.Y - num1165; - if (npc.velocity.Y > 0f && num1167 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1165 * 2f; - } - } - if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != NetmodeID.MultiplayerClient) - { - iceShard += 4; - if (iceShard > 8) - { - iceShard = 0; - int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); - int damage = expertMode ? 23 : 26; - float velocity = revenge ? 6f : 5f; - if (CalamityWorld.bossRushActive) - velocity = 9f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 23 : 26; + int num185 = mod.ProjectileType("IceRain"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 15; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-100, 101); + num182 += (float)Main.rand.Next(-100, 101); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + float num1164 = isChill ? 6.5f : 8f; + float num1165 = isChill ? 0.1f : 0.12f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1164 = isChill ? 7f : 8.5f; + } + Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); + float num1166 = player.Center.X - vector133.X; + float num1167 = player.Center.Y - vector133.Y - 300f; + float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); + if (num1168 < 20f) + { + num1166 = npc.velocity.X; + num1167 = npc.velocity.Y; + } + else + { + num1168 = num1164 / num1168; + num1166 *= num1168; + num1167 *= num1168; + } + if (npc.velocity.X < num1166) + { + npc.velocity.X = npc.velocity.X + num1165; + if (npc.velocity.X < 0f && num1166 > 0f) + { + npc.velocity.X = npc.velocity.X + num1165 * 2f; + } + } + else if (npc.velocity.X > num1166) + { + npc.velocity.X = npc.velocity.X - num1165; + if (npc.velocity.X > 0f && num1166 < 0f) + { + npc.velocity.X = npc.velocity.X - num1165 * 2f; + } + } + if (npc.velocity.Y < num1167) + { + npc.velocity.Y = npc.velocity.Y + num1165; + if (npc.velocity.Y < 0f && num1167 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1165 * 2f; + } + } + else if (npc.velocity.Y > num1167) + { + npc.velocity.Y = npc.velocity.Y - num1165; + if (npc.velocity.Y > 0f && num1167 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1165 * 2f; + } + } + if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != NetmodeID.MultiplayerClient) + { + iceShard += 4; + if (iceShard > 8) + { + iceShard = 0; + int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); + int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); + int damage = expertMode ? 23 : 26; + float velocity = revenge ? 6f : 5f; + if (CalamityWorld.bossRushActive) + velocity = 9f; - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, velocity, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if ((double)npc.life < (double)npc.lifeMax * (0.32 + multAdd)) - { - npc.ai[0] = 4f; - npc.localAI[0] = 0f; - iceShard = 0; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 60f && npc.alpha == 0) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } - } - } - } - npc.TargetClosest(true); - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float speed = revenge ? 5.5f : 5f; - if (CalamityWorld.bossRushActive) - { - speed = 10f; - } - num1245 = speed / num1245; - num1243 *= num1245; - num1244 *= num1245; - npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; - if (npc.ai[1] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= (CalamityWorld.bossRushActive ? 90f : 180f)) - { - npc.localAI[2] = 0f; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, velocity, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if ((double)npc.life < (double)npc.lifeMax * (0.32 + multAdd)) + { + npc.ai[0] = 4f; + npc.localAI[0] = 0f; + iceShard = 0; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 60f && npc.alpha == 0) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[ice].timeLeft = 300; + Main.projectile[ice2].timeLeft = 300; + } + } + } + } + npc.TargetClosest(true); + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float speed = revenge ? 5.5f : 5f; + if (CalamityWorld.bossRushActive) + { + speed = 10f; + } + num1245 = speed / num1245; + num1243 *= num1245; + num1244 *= num1245; + npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; + if (npc.ai[1] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= (CalamityWorld.bossRushActive ? 90f : 180f)) + { + npc.localAI[2] = 0f; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)player.Center.X / 16; + num1251 = (int)player.Center.Y / 16; - int min = 21; - int max = 24; + int min = 21; + int max = 24; - if (Main.rand.NextBool(2)) - num1250 += Main.rand.Next(min, max); - else - num1250 -= Main.rand.Next(min, max); + if (Main.rand.NextBool(2)) + num1250 += Main.rand.Next(min, max); + else + num1250 -= Main.rand.Next(min, max); - if (Main.rand.NextBool(2)) - num1251 += Main.rand.Next(min, max); - else - num1251 -= Main.rand.Next(min, max); + if (Main.rand.NextBool(2)) + num1251 += Main.rand.Next(min, max); + else + num1251 -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) - break; + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) + break; - if (num1249 > 100) - goto Block; - } - npc.ai[1] = 1f; - teleportLocationX = num1250; - iceShard = num1251; - npc.netUpdate = true; - Block:; - } - } - } - else if (npc.ai[1] == 1f) - { - npc.alpha += 25; - if (npc.alpha >= 255) - { - Main.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = (float)teleportLocationX * 16f - (float)(npc.width / 2); - npc.position.Y = (float)iceShard * 16f - (float)(npc.height / 2); - npc.ai[1] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[1] == 2f) - { - npc.alpha -= 25; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - if ((double)npc.life < (double)npc.lifeMax * (0.15 + multAdd)) - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); - drawAltTexture = true; - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore3"), 1f); - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; - teleportLocationX = 0; - iceShard = 0; - npc.netUpdate = true; - string key = "Mods.CalamityMod.CryogenBossText"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - else - { - npc.damage = (int)((float)npc.defDamage * 1.5f); - float num1372 = isChill ? 16f : 22f; - if (CalamityWorld.bossRushActive) - { - num1372 = 30f; - } - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - iceShard--; - if ((double)npc.life < (double)npc.lifeMax * (0.05 + multAdd) || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (num1375 < 170f || iceShard > 0) - { - if (num1375 < 170f) - { - iceShard = 17; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.5f; - return; - } - } - else if ((double)npc.life < (double)npc.lifeMax * (0.1 + multAdd)) - { - if (num1375 < 190f || iceShard > 0) - { - if (num1375 < 190f) - { - iceShard = 19; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.35f; - return; - } - } - else - { - if (num1375 < 200f || iceShard > 0) - { - if (num1375 < 200f) - { - iceShard = 20; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.3f; - return; - } - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - npc.rotation = npc.velocity.X * 0.15f; - } - if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - for (int num662 = 0; num662 < 2; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int randomSpawn = Main.rand.Next(3); - if (randomSpawn == 0) - { - randomSpawn = mod.NPCType("Cryocore"); - } - else if (randomSpawn == 1) - { - randomSpawn = mod.NPCType("IceMass"); - } - else - { - randomSpawn = mod.NPCType("Cryocore2"); - } - int num664 = NPC.NewNPC(x, y, randomSpawn, 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } + if (num1249 > 100) + goto Block; + } + npc.ai[1] = 1f; + teleportLocationX = num1250; + iceShard = num1251; + npc.netUpdate = true; + Block: + ; + } + } + } + else if (npc.ai[1] == 1f) + { + npc.alpha += 25; + if (npc.alpha >= 255) + { + Main.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position.X = (float)teleportLocationX * 16f - (float)(npc.width / 2); + npc.position.Y = (float)iceShard * 16f - (float)(npc.height / 2); + npc.ai[1] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[1] == 2f) + { + npc.alpha -= 25; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + if ((double)npc.life < (double)npc.lifeMax * (0.15 + multAdd)) + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); + drawAltTexture = true; + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore3"), 1f); + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + teleportLocationX = 0; + iceShard = 0; + npc.netUpdate = true; + string key = "Mods.CalamityMod.CryogenBossText"; + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + else + { + npc.damage = (int)((float)npc.defDamage * 1.5f); + float num1372 = isChill ? 16f : 22f; + if (CalamityWorld.bossRushActive) + { + num1372 = 30f; + } + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + iceShard--; + if ((double)npc.life < (double)npc.lifeMax * (0.05 + multAdd) || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (num1375 < 170f || iceShard > 0) + { + if (num1375 < 170f) + { + iceShard = 17; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.5f; + return; + } + } + else if ((double)npc.life < (double)npc.lifeMax * (0.1 + multAdd)) + { + if (num1375 < 190f || iceShard > 0) + { + if (num1375 < 190f) + { + iceShard = 19; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.35f; + return; + } + } + else + { + if (num1375 < 200f || iceShard > 0) + { + if (num1375 < 200f) + { + iceShard = 20; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.3f; + return; + } + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + npc.rotation = npc.velocity.X * 0.15f; + } + if (npc.ai[3] == 0f && npc.life > 0) + { + npc.ai[3] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + for (int num662 = 0; num662 < 2; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int randomSpawn = Main.rand.Next(3); + if (randomSpawn == 0) + { + randomSpawn = mod.NPCType("Cryocore"); + } + else if (randomSpawn == 1) + { + randomSpawn = mod.NPCType("IceMass"); + } + else + { + randomSpawn = mod.NPCType("Cryocore2"); + } + int num664 = NPC.NewNPC(x, y, randomSpawn, 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //for alt textures - { - if (drawAltTexture) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/Cryogen/Cryogen2"); - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - return false; - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //for alt textures + { + if (drawAltTexture) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/Cryogen/Cryogen2"); + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + return false; + } + return true; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.9f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.9f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore8"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore9"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore10"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore8"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore9"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore10"), 1f); + } + } - private void RainStart() - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.NextBool(3)) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.NextBool(4)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(5)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(6)) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.NextBool(7)) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.NextBool(8)) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.NextBool(2)) - { - num3 += 0.05f; - } - if (Main.rand.NextBool(3)) - { - num3 += 0.1f; - } - if (Main.rand.NextBool(4)) - { - num3 += 0.15f; - } - if (Main.rand.NextBool(5)) - { - num3 += 0.2f; - } - Main.rainTime = (int)((float)Main.rainTime * num3); - Main.raining = true; - CalamityMod.UpdateServerBoolean(); - } + private void RainStart() + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.NextBool(3)) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.NextBool(4)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(5)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(6)) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.NextBool(7)) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.NextBool(8)) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.NextBool(2)) + { + num3 += 0.05f; + } + if (Main.rand.NextBool(3)) + { + num3 += 0.1f; + } + if (Main.rand.NextBool(4)) + { + num3 += 0.15f; + } + if (Main.rand.NextBool(5)) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + CalamityMod.UpdateServerBoolean(); + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } - public override void NPCLoot() - { + public override void NPCLoot() + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("CryogenTrophy"), 10); @@ -969,7 +970,7 @@ namespace CalamityMod.NPCs.Cryogen DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedCryogen, 4, 2, 1); if (!Main.expertMode) - { + { // Materials DropHelper.DropItem(npc, ItemID.SoulofMight, 20, 40); DropHelper.DropItem(npc, mod.ItemType("CryoBar"), 15, 25); @@ -994,7 +995,7 @@ namespace CalamityMod.NPCs.Cryogen // Other DropHelper.DropItemChance(npc, ItemID.FrozenKey, 5); - } + } // Spawn Permafrost if he isn't in the world int permafrostNPC = NPC.FindFirstNPC(mod.NPCType("DILF")); @@ -1021,10 +1022,10 @@ namespace CalamityMod.NPCs.Cryogen CalamityMod.UpdateServerBoolean(); } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 120, true); - player.AddBuff(BuffID.Chilled, 90, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } + } } diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index f7322f17e3..e5c917ac48 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -1,29 +1,29 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Cryogen { public class CryogenIce : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen's Shield"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen's Shield"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.canGhostHeal = false; - npc.noTileCollide = true; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.canGhostHeal = false; + npc.noTileCollide = true; npc.damage = 50; - npc.width = 240; - npc.height = 240; - npc.defense = 0; + npc.width = 240; + npc.height = 240; + npc.defense = 0; npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = 1400; if (CalamityWorld.bossRushActive) @@ -31,78 +31,78 @@ namespace CalamityMod.NPCs.Cryogen npc.lifeMax = 100000; } npc.alpha = 255; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - } + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + } - public override void AI() - { - npc.alpha -= 3; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.rotation += 0.15f; - if (npc.type == mod.NPCType("CryogenIce")) - { - int num989 = (int)npc.ai[0]; - if (Main.npc[num989].active && Main.npc[num989].type == mod.NPCType("Cryogen")) - { - npc.velocity = Vector2.Zero; - npc.position = Main.npc[num989].Center; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - npc.gfxOffY = Main.npc[num989].gfxOffY; - return; - } - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } + public override void AI() + { + npc.alpha -= 3; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.rotation += 0.15f; + if (npc.type == mod.NPCType("CryogenIce")) + { + int num989 = (int)npc.ai[0]; + if (Main.npc[num989].active && Main.npc[num989].type == mod.NPCType("Cryogen")) + { + npc.velocity = Vector2.Zero; + npc.position = Main.npc[num989].Center; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.gfxOffY = Main.npc[num989].gfxOffY; + return; + } + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return npc.alpha == 0; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.alpha == 0; + } - public override void OnHitPlayer(Player player, int damage, bool crit) + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Frostburn, 90, true); player.AddBuff(BuffID.Chilled, 60, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); - } + { + npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int num621 = 0; num621 < 25; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int num621 = 0; num621 < 25; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; @@ -128,6 +128,6 @@ namespace CalamityMod.NPCs.Cryogen Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore7"), 1f); } } - } - } + } + } } diff --git a/NPCs/Cryogen/IceMass.cs b/NPCs/Cryogen/IceMass.cs index 98a0507680..7e930baa6f 100644 --- a/NPCs/Cryogen/IceMass.cs +++ b/NPCs/Cryogen/IceMass.cs @@ -1,38 +1,37 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Cryogen { public class IceMass : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aurora Spirit"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aurora Spirit"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.aiStyle = 86; - npc.damage = 40; - npc.width = 40; - npc.height = 24; - npc.defense = 8; - npc.alpha = 100; - npc.lifeMax = 220; + public override void SetDefaults() + { + npc.aiStyle = 86; + npc.damage = 40; + npc.width = 40; + npc.height = 24; + npc.defense = 8; + npc.alpha = 100; + npc.lifeMax = 220; if (CalamityWorld.bossRushActive) { npc.lifeMax = 30000; } npc.knockBackResist = 0f; - animationType = 472; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - } + animationType = 472; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + } public override void OnHitPlayer(Player player, int damage, bool crit) { @@ -41,29 +40,29 @@ namespace CalamityMod.NPCs.Cryogen } public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.35f, 0.35f); - } + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.35f, 0.35f); + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CryoSpirit"), 1f); } - } - } + } + } } diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 83e1e17283..d193ab04a1 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -1,84 +1,84 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DesertScourgeBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } - public override void SetDefaults() - { - npc.damage = 16; - npc.npcSlots = 5f; - npc.width = 32; - npc.height = 36; - npc.defense = 6; + public override void SetDefaults() + { + npc.damage = 16; + npc.npcSlots = 5f; + npc.width = 32; + npc.height = 36; + npc.defense = 6; npc.Calamity().RevPlusDR(0.05f); npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; if (CalamityWorld.death) { npc.lifeMax = 5100; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.boss = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.boss = true; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); else music = MusicID.Boss1; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { Player player = Main.player[npc.target]; npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; if (!Main.npc[(int)npc.ai[1]].active) @@ -87,14 +87,14 @@ namespace CalamityMod.NPCs.DesertScourge npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } if (Main.netMode != NetmodeID.MultiplayerClient && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) { npc.localAI[0] += (float)Main.rand.Next(4); @@ -130,58 +130,58 @@ namespace CalamityMod.NPCs.DesertScourge } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - int wormCount = 5; - if (npc.life <= (npc.lifeMax * 0.75f) && NPC.CountNPCS(mod.NPCType("DriedSeekerHead")) < wormCount) - { - if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - int seeker = NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("DriedSeekerHead")); - if (Main.netMode == NetmodeID.Server && seeker < 200) - { - NetMessage.SendData(23, -1, -1, null, seeker, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 1f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + int wormCount = 5; + if (npc.life <= (npc.lifeMax * 0.75f) && NPC.CountNPCS(mod.NPCType("DriedSeekerHead")) < wormCount) + { + if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + int seeker = NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("DriedSeekerHead")); + if (Main.netMode == NetmodeID.Server && seeker < 200) + { + NetMessage.SendData(23, -1, -1, null, seeker, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 1f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + } + } } diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.cs b/NPCs/DesertScourge/DesertScourgeBodySmall.cs index 1d09261e4b..1b28f3e5ba 100644 --- a/NPCs/DesertScourge/DesertScourgeBodySmall.cs +++ b/NPCs/DesertScourge/DesertScourgeBodySmall.cs @@ -1,107 +1,107 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DesertScourgeBodySmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } - public override void SetDefaults() - { - npc.damage = 10; - npc.npcSlots = 5f; - npc.width = 32; - npc.height = 36; - npc.defense = 4; - npc.lifeMax = 800; + public override void SetDefaults() + { + npc.damage = 10; + npc.npcSlots = 5f; + npc.width = 32; + npc.height = 36; + npc.defense = 4; + npc.lifeMax = 800; if (CalamityWorld.bossRushActive) { npc.lifeMax = 350000; } npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.scale = 0.75f; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.scale = 0.75f; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Player player = Main.player[npc.target]; - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + Player player = Main.player[npc.target]; + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 0.65f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 0.65f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 0.65f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 0.65f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 0.65f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 0.65f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 60, true); + } + } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 8a2440e4ff..8a7e274d0e 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -1,19 +1,19 @@ -using System.IO; -using System.Reflection; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; +using System.Reflection; using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.GameContent.Events; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] - public class DesertScourgeHead : ModNPC - { + public class DesertScourgeHead : ModNPC + { private bool flies = false; private float speed = 15f; private float turnSpeed = 0.15f; @@ -21,18 +21,18 @@ namespace CalamityMod.NPCs.DesertScourge private const int maxLength = 31; private bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } - public override void SetDefaults() - { - npc.damage = 30; - npc.npcSlots = 12f; - npc.width = 32; - npc.height = 80; - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 30; + npc.npcSlots = 12f; + npc.width = 32; + npc.height = 80; + npc.defense = 0; npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; if (CalamityWorld.death) { @@ -42,409 +42,409 @@ namespace CalamityMod.NPCs.DesertScourge { npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(0, 2, 0, 0); - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + npc.knockBackResist = 0f; + npc.boss = true; + npc.value = Item.buyPrice(0, 2, 0, 0); + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - bossBag = mod.ItemType("DesertScourgeBag"); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + bossBag = mod.ItemType("DesertScourgeBag"); Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); else music = MusicID.Boss1; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - Player player = Main.player[npc.target]; - npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.45f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - speedMult = 1.6f; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - speedMult = 2f; - if (CalamityWorld.bossRushActive) - speedMult *= 2f; + public override void AI() + { + Player player = Main.player[npc.target]; + npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.45f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + speedMult = 1.6f; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + speedMult = 2f; + if (CalamityWorld.bossRushActive) + speedMult *= 2f; - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = 13f * (speedMult - (life / totalLife)); - turnSpeed = 0.13f * (speedMult - (life / totalLife)); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || player.dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTail"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000); - if (CalamityWorld.bossRushActive) - num954 /= 2; + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = 13f * (speedMult - (life / totalLife)); + turnSpeed = 0.13f * (speedMult - (life / totalLife)); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || player.dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTail"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000); + if (CalamityWorld.bossRushActive) + num954 /= 2; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 1f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - } + bool flag95 = true; + if (npc.position.Y > player.position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (player.dead) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 1f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = player.position.X + (float)(player.width / 2); + float num192 = player.position.Y + (float)(player.height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + } + else if (npc.velocity.Y == num188) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + bool flag21 = false; + if (!flag21) + { + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } + } - #region Loot - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SandBlock; - } + #region Loot + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SandBlock; + } - public override bool SpecialNPCLoot() - { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, - mod.NPCType("DesertScourgeHead"), - mod.NPCType("DesertScourgeBody"), - mod.NPCType("DesertScourgeTail")); - npc.position = Main.npc[closestSegmentID].position; - return false; - } + public override bool SpecialNPCLoot() + { + int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + mod.NPCType("DesertScourgeHead"), + mod.NPCType("DesertScourgeBody"), + mod.NPCType("DesertScourgeTail")); + npc.position = Main.npc[closestSegmentID].position; + return false; + } public override void NPCLoot() { @@ -506,22 +506,22 @@ namespace CalamityMod.NPCs.DesertScourge { string key = "Mods.CalamityMod.OpenSunkenSea"; Color messageColor = Color.Aquamarine; - string key2 = "Mods.CalamityMod.SandstormTrigger"; - Color messageColor2 = Color.PaleGoldenrod; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } + string key2 = "Mods.CalamityMod.SandstormTrigger"; + Color messageColor2 = Color.PaleGoldenrod; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } - if (!Sandstorm.Happening) - typeof(Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); - } + if (!Sandstorm.Happening) + typeof(Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); + } // Mark Desert Scourge as dead CalamityWorld.downedDesertScourge = true; @@ -530,31 +530,31 @@ namespace CalamityMod.NPCs.DesertScourge #endregion public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 1f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 1f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 1.1f); } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 300, true); + } + } } diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index 1bae1328e0..5b223c63ef 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -1,385 +1,385 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DesertScourgeHeadSmall : ModNPC - { - public bool flies = false; - public float speed = CalamityWorld.bossRushActive ? 20f : 12.5f; - public float turnSpeed = CalamityWorld.bossRushActive ? 0.2f : 0.125f; - public int minLength = 12; - public int maxLength = 13; - bool TailSpawned = false; + { + public bool flies = false; + public float speed = CalamityWorld.bossRushActive ? 20f : 12.5f; + public float turnSpeed = CalamityWorld.bossRushActive ? 0.2f : 0.125f; + public int minLength = 12; + public int maxLength = 13; + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } - public override void SetDefaults() - { - npc.damage = 18; - npc.npcSlots = 2f; - npc.width = 32; - npc.height = 80; - npc.defense = 0; - npc.lifeMax = 800; + public override void SetDefaults() + { + npc.damage = 18; + npc.npcSlots = 2f; + npc.width = 32; + npc.height = 80; + npc.defense = 0; + npc.lifeMax = 800; if (CalamityWorld.bossRushActive) { npc.lifeMax = 350000; } npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; } npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.scale = 0.75f; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.scale = 0.75f; + } - public override void AI() - { - Player player = Main.player[npc.target]; - bool expertMode = Main.expertMode; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || player.dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBodySmall"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTailSmall"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = CalamityWorld.death ? 300 : 1000; - if (CalamityWorld.bossRushActive) - num954 = 150; + public override void AI() + { + Player player = Main.player[npc.target]; + bool expertMode = Main.expertMode; + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || player.dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBodySmall"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTailSmall"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = CalamityWorld.death ? 300 : 1000; + if (CalamityWorld.bossRushActive) + num954 = 150; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 1f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - } + bool flag95 = true; + if (npc.position.Y > player.position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (player.dead) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 1f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = player.position.X + (float)(player.width / 2); + float num192 = player.position.Y + (float)(player.height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + } + else if (npc.velocity.Y == num188) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + bool flag21 = false; + if (!flag21) + { + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } + } public override bool PreNPCLoot() { @@ -387,30 +387,30 @@ namespace CalamityMod.NPCs.DesertScourge } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 0.65f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 0.65f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 0.65f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 0.65f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + } + } } diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index a7da54a5a2..aff278db10 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -1,84 +1,84 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DesertScourgeTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } - public override void SetDefaults() - { - npc.damage = 12; - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 48; //216 - npc.defense = 9; + public override void SetDefaults() + { + npc.damage = 12; + npc.npcSlots = 5f; + npc.width = 32; //324 + npc.height = 48; //216 + npc.defense = 9; npc.Calamity().RevPlusDR(0.1f); npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; if (CalamityWorld.death) { npc.lifeMax = 5100; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; //new + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.boss = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.boss = true; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); else music = MusicID.Boss1; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Player player = Main.player[npc.target]; + public override void AI() + { + Player player = Main.player[npc.target]; npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; if (!Main.npc[(int)npc.ai[1]].active) { @@ -86,51 +86,51 @@ namespace CalamityMod.NPCs.DesertScourge npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 1f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 1f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 90, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 90, true); + } + } } diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.cs b/NPCs/DesertScourge/DesertScourgeTailSmall.cs index 68c525e614..46420af657 100644 --- a/NPCs/DesertScourge/DesertScourgeTailSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeTailSmall.cs @@ -1,104 +1,104 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DesertScourgeTailSmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } - public override void SetDefaults() - { - npc.damage = 8; - npc.npcSlots = 5f; - npc.width = 32; - npc.height = 48; - npc.defense = 7; - npc.lifeMax = 800; + public override void SetDefaults() + { + npc.damage = 8; + npc.npcSlots = 5f; + npc.width = 32; + npc.height = 48; + npc.defense = 7; + npc.lifeMax = 800; if (CalamityWorld.bossRushActive) { npc.lifeMax = 350000; } npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.scale = 0.75f; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.scale = 0.75f; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Player player = Main.player[npc.target]; - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + Player player = Main.player[npc.target]; + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 0.65f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 0.65f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 30, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 30, true); + } + } } diff --git a/NPCs/DesertScourge/DriedSeekerBody.cs b/NPCs/DesertScourge/DriedSeekerBody.cs index de6d1da3ec..ed7c199ef0 100644 --- a/NPCs/DesertScourge/DriedSeekerBody.cs +++ b/NPCs/DesertScourge/DriedSeekerBody.cs @@ -1,76 +1,76 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DriedSeekerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } - public override void SetDefaults() - { - npc.damage = 8; - npc.npcSlots = 5f; - npc.width = 18; - npc.height = 18; - npc.defense = 2; - npc.lifeMax = 100; + public override void SetDefaults() + { + npc.damage = 8; + npc.npcSlots = 5f; + npc.width = 18; + npc.height = 18; + npc.defense = 2; + npc.lifeMax = 100; if (CalamityWorld.bossRushActive) { npc.lifeMax = 50000; } npc.knockBackResist = 0f; - npc.aiStyle = 6; + npc.aiStyle = 6; aiType = -1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 802128929a..4e5ef67160 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -1,46 +1,45 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DriedSeekerHead : ModNPC - { - bool TailSpawned = false; + { + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } - public override void SetDefaults() - { - npc.damage = 14; - npc.npcSlots = 5f; - npc.width = 18; - npc.height = 18; - npc.lifeMax = 100; + public override void SetDefaults() + { + npc.damage = 14; + npc.npcSlots = 5f; + npc.width = 18; + npc.height = 18; + npc.lifeMax = 100; if (CalamityWorld.bossRushActive) { npc.lifeMax = 50000; } npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - } + npc.knockBackResist = 0f; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } - public override void AI() - { - if (!TailSpawned) + public override void AI() + { + if (!TailSpawned) { int Previous = npc.whoAmI; for (int num36 = 0; num36 < 4; num36++) @@ -63,44 +62,44 @@ namespace CalamityMod.NPCs.DesertScourge } TailSpawned = true; } - if (Main.player[npc.target].dead) - { - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 1f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - } + if (Main.player[npc.target].dead) + { + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 1f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/DesertScourge/DriedSeekerTail.cs b/NPCs/DesertScourge/DriedSeekerTail.cs index 6a6922be76..f70424130b 100644 --- a/NPCs/DesertScourge/DriedSeekerTail.cs +++ b/NPCs/DesertScourge/DriedSeekerTail.cs @@ -1,76 +1,76 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.DesertScourge { public class DriedSeekerTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } - public override void SetDefaults() - { - npc.damage = 6; - npc.npcSlots = 5f; - npc.width = 18; - npc.height = 18; - npc.defense = 4; - npc.lifeMax = 100; + public override void SetDefaults() + { + npc.damage = 6; + npc.npcSlots = 5f; + npc.width = 18; + npc.height = 18; + npc.defense = 4; + npc.lifeMax = 100; if (CalamityWorld.bossRushActive) { npc.lifeMax = 50000; } npc.knockBackResist = 0f; - npc.aiStyle = 6; + npc.aiStyle = 6; aiType = -1; - npc.behindTiles = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.behindTiles = true; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool CheckActive() - { - return false; - } - } + public override bool CheckActive() + { + return false; + } + } } diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 7f1a291a64..852cb27f22 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,687 +1,693 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent.Events; -using CalamityMod.World; namespace CalamityMod.NPCs.GreatSandShark { public class GreatSandShark : ModNPC - { - private bool resetAI = false; + { + private bool resetAI = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Great Sand Shark"); - Main.npcFrameCount[npc.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Great Sand Shark"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.npcSlots = 15f; - npc.damage = 100; - npc.width = 300; - npc.height = 120; - npc.defense = 60; + public override void SetDefaults() + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.npcSlots = 15f; + npc.damage = 100; + npc.width = 300; + npc.height = 120; + npc.defense = 60; npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = CalamityWorld.revenge ? 11000 : 8000; - if (CalamityWorld.death) - { - npc.lifeMax = 16000; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 10, 0, 0); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.behindTiles = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.timeLeft = NPC.activeTime * 30; - banner = npc.type; - bannerItem = mod.ItemType("GreatSandSharkBanner"); - } + if (CalamityWorld.death) + { + npc.lifeMax = 16000; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 10, 0, 0); + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.behindTiles = true; + npc.netAlways = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.timeLeft = NPC.activeTime * 30; + banner = npc.type; + bannerItem = mod.ItemType("GreatSandSharkBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(resetAI); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(resetAI); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - resetAI = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + resetAI = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); + } - public override void AI() - { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - bool death = CalamityWorld.death; - bool lowLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.75 : 0.5); - bool lowerLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.35 : 0.2); - bool youMustDie = !Main.player[npc.target].ZoneDesert; - if (!Sandstorm.Happening) - { - Main.raining = false; - Sandstorm.Happening = true; - Sandstorm.TimeLeft = (int)(3600f * (8f + Main.rand.NextFloat() * 16f)); - CalamityMod.UpdateServerBoolean(); - } - if (npc.soundDelay <= 0) - { - npc.soundDelay = 480; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.localAI[3] >= 1f || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 1000f) - { - if (!resetAI) - { - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - resetAI = true; - npc.netUpdate = true; - } - int num2 = expertMode ? 35 : 50; - float num3 = expertMode ? 0.5f : 0.42f; - float scaleFactor = expertMode ? 7.5f : 6.7f; - int num4 = expertMode ? 28 : 30; - float num5 = expertMode ? 15.5f : 14f; - if (revenge || lowerLife) - { - num3 *= 1.1f; - scaleFactor *= 1.1f; - num5 *= 1.1f; - } - if (death) - { - num3 *= 1.1f; - scaleFactor *= 1.1f; - num5 *= 1.1f; - num4 = 25; - } - if (youMustDie) - { - num3 *= 1.5f; - scaleFactor *= 1.5f; - num5 *= 1.5f; - num4 = 20; - } - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - npc.ai[0] = 0f; - npc.ai[2] = 0f; - } - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); - if (npc.spriteDirection == 1) - { - num17 += 3.14159274f; - } - if (num17 < 0f) - { - num17 += 6.28318548f; - } - if (num17 > 6.28318548f) - { - num17 -= 6.28318548f; - } - float num18 = 0.04f; - if (npc.ai[0] == 1f) - { - num18 = 0f; - } - if (npc.rotation < num17) - { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) - { - npc.rotation -= num18; - } - else - { - npc.rotation += num18; - } - } - if (npc.rotation > num17) - { - if ((double)(npc.rotation - num17) > 3.1415926535897931) - { - npc.rotation += num18; - } - else - { - npc.rotation -= num18; - } - } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - { - npc.rotation = num17; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.28318548f; - } - if (npc.rotation > 6.28318548f) - { - npc.rotation -= 6.28318548f; - } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - { - npc.rotation = num17; - } - if (npc.ai[0] == 0f && !player.dead) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - } - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X = npc.velocity.X + num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - { - npc.velocity.X = npc.velocity.X + num3; - } - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X = npc.velocity.X - num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - { - npc.velocity.X = npc.velocity.X - num3; - } - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y = npc.velocity.Y + num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num3; - } - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y = npc.velocity.Y - num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num3; - } - } - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) - { - if (npc.ai[2] == 0f && num22 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num22; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vector) * num5; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num22 != 0) - { - npc.direction = num22; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 1f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 2f) - { - npc.localAI[3] = 0f; - } - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - } - } - else - { - resetAI = false; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - Point point15 = npc.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = tileSafely.nactive() || tileSafely.liquid > 0; - bool flag122 = false; - npc.TargetClosest(false); - Vector2 vector260 = npc.targetRect.Center.ToVector2(); - if (Main.player[npc.target].velocity.Y > -0.1f && !Main.player[npc.target].dead && npc.Distance(vector260) > 150f) - { - flag122 = true; - } - npc.localAI[1] += 1f; - if (lowLife) - { - bool spawnFlag = npc.localAI[1] == 150f; - if (NPC.CountNPCS(NPCID.SandShark) > 2) - { - spawnFlag = false; - } - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.localAI[1] >= 300f) - { - npc.localAI[1] = 0f; - if (npc.localAI[2] > 0f) - { - npc.localAI[2] = 0f; - } - switch (Main.rand.Next(3)) - { - case 0: - npc.ai[3] = 0f; - break; - case 1: - npc.ai[3] = 1f; - break; - case 2: - npc.ai[3] = 2f; - break; - } - int random = lowerLife ? 5 : 9; - if (lowLife && Main.rand.Next(random) == 0) - { - npc.localAI[3] = 1f; - } - npc.netUpdate = true; - } - if (npc.localAI[0] == -1f && !flag121) - { - npc.localAI[0] = 20f; - } - if (npc.localAI[0] > 0f) - { - npc.localAI[0] -= 1f; - } - if (flag121) - { - float num1534 = npc.ai[1]; - bool flag123 = false; - point15 = (npc.Center + new Vector2(0f, 24f)).ToTileCoordinates(); - tileSafely = Framing.GetTileSafely(point15.X, point15.Y - 2); - if (tileSafely.nactive()) - { - flag123 = true; - } - npc.ai[1] = (float)flag123.ToInt(); - if (npc.ai[2] < 30f) - { - npc.ai[2] += 1f; - } - if (flag122) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - float velocityX = 8f; - float velocityY = 6f; - switch ((int)npc.ai[3]) - { - case 0: - velocityX = 10f; velocityY = 9f; - break; - case 1: - velocityX = 14f; velocityY = 7f; - break; - case 2: - velocityX = 8f; velocityY = 11f; - break; - } - if (revenge || lowerLife) - { - velocityX *= 1.1f; - velocityY *= 1.1f; - } - if (youMustDie) - { - velocityX *= 1.5f; - velocityY *= 1.5f; - } - if (npc.velocity.X > velocityX) - { - npc.velocity.X = velocityX; - } - if (npc.velocity.X < -velocityX) - { - npc.velocity.X = -velocityX; - } - if (npc.velocity.Y > velocityY) - { - npc.velocity.Y = velocityY; - } - if (npc.velocity.Y < -velocityY) - { - npc.velocity.Y = -velocityY; - } - Vector2 vec4 = npc.Center + npc.velocity.SafeNormalize(Vector2.Zero) * npc.Size.Length() / 2f + npc.velocity; - point15 = vec4.ToTileCoordinates(); - tileSafely = Framing.GetTileSafely(point15); - bool flag124 = tileSafely.nactive(); - if (!flag124 && Math.Sign(npc.velocity.X) == npc.direction && (npc.Distance(vector260) < 600f || youMustDie) && - (npc.ai[2] >= 30f || npc.ai[2] < 0f)) - { - if (npc.localAI[0] == 0f) - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); - npc.localAI[0] = -1f; - for (int num621 = 0; num621 < 25; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 32, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity.Y *= 6f; - Main.dust[num622].velocity.X *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 85, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 268, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity.X *= 2f; - } - int spawnX = (int)(npc.width / 2); - for (int sand = 0; sand < 5; sand++) - Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y, - (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), mod.ProjectileType("GreatSandBlast"), 40, 0f, Main.myPlayer, 0f, 0f); - } - npc.ai[2] = -30f; - Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); - npc.velocity = vector261 * 18f; //12 - } - } - else - { - float num1535 = 6f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -num1535 || npc.velocity.X > num1535) - { - npc.velocity.X = npc.velocity.X * 0.95f; //.95 - } - if (flag123) - { - npc.ai[0] = -1f; - } - else - { - npc.ai[0] = 1f; - } - float num1536 = 0.06f; - float num1537 = 0.01f; - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - num1537; - if (npc.velocity.Y < -num1536) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + num1537; - if (npc.velocity.Y > num1536) - { - npc.ai[0] = -1f; - } - } - if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - } - else - { - if (npc.velocity.Y == 0f) - { - if (flag122) - { - npc.TargetClosest(true); - } - float num1538 = 1f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -num1538 || npc.velocity.X > num1538) - { - npc.velocity.X = npc.velocity.X * 0.95f; //.95 - } - } - if (npc.localAI[2] == 0f) - { - npc.localAI[2] = 1f; - float velocityX = 12f; - float velocityY = 12f; - switch ((int)npc.ai[3]) - { - case 0: - velocityX = 12f; velocityY = 12f; - break; - case 1: - velocityX = 14f; velocityY = 14f; - break; - case 2: - velocityX = 16f; velocityY = 16f; - break; - } - if (revenge || lowerLife) - { - velocityX *= 1.1f; - velocityY *= 1.1f; - } - if (youMustDie) - { - velocityX *= 1.5f; - velocityY *= 1.5f; - } - npc.velocity.Y = -velocityY; - npc.velocity.X = velocityX * (float)npc.direction; - npc.netUpdate = true; - } - npc.velocity.Y = npc.velocity.Y + 0.4f; //0.3 - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if (npc.rotation < -0.1f) - { - npc.rotation = -0.1f; - } - if (npc.rotation > 0.1f) - { - npc.rotation = 0.1f; - } - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + bool death = CalamityWorld.death; + bool lowLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.75 : 0.5); + bool lowerLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.35 : 0.2); + bool youMustDie = !Main.player[npc.target].ZoneDesert; + if (!Sandstorm.Happening) + { + Main.raining = false; + Sandstorm.Happening = true; + Sandstorm.TimeLeft = (int)(3600f * (8f + Main.rand.NextFloat() * 16f)); + CalamityMod.UpdateServerBoolean(); + } + if (npc.soundDelay <= 0) + { + npc.soundDelay = 480; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.localAI[3] >= 1f || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 1000f) + { + if (!resetAI) + { + npc.localAI[0] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + resetAI = true; + npc.netUpdate = true; + } + int num2 = expertMode ? 35 : 50; + float num3 = expertMode ? 0.5f : 0.42f; + float scaleFactor = expertMode ? 7.5f : 6.7f; + int num4 = expertMode ? 28 : 30; + float num5 = expertMode ? 15.5f : 14f; + if (revenge || lowerLife) + { + num3 *= 1.1f; + scaleFactor *= 1.1f; + num5 *= 1.1f; + } + if (death) + { + num3 *= 1.1f; + scaleFactor *= 1.1f; + num5 *= 1.1f; + num4 = 25; + } + if (youMustDie) + { + num3 *= 1.5f; + scaleFactor *= 1.5f; + num5 *= 1.5f; + num4 = 20; + } + Vector2 vector = npc.Center; + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + npc.ai[0] = 0f; + npc.ai[2] = 0f; + } + float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + if (npc.spriteDirection == 1) + { + num17 += 3.14159274f; + } + if (num17 < 0f) + { + num17 += 6.28318548f; + } + if (num17 > 6.28318548f) + { + num17 -= 6.28318548f; + } + float num18 = 0.04f; + if (npc.ai[0] == 1f) + { + num18 = 0f; + } + if (npc.rotation < num17) + { + if ((double)(num17 - npc.rotation) > 3.1415926535897931) + { + npc.rotation -= num18; + } + else + { + npc.rotation += num18; + } + } + if (npc.rotation > num17) + { + if ((double)(npc.rotation - num17) > 3.1415926535897931) + { + npc.rotation += num18; + } + else + { + npc.rotation -= num18; + } + } + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + { + npc.rotation = num17; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.28318548f; + } + if (npc.rotation > 6.28318548f) + { + npc.rotation -= 6.28318548f; + } + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + { + npc.rotation = num17; + } + if (npc.ai[0] == 0f && !player.dead) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + } + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector3.X) + { + npc.velocity.X = npc.velocity.X + num3; + if (npc.velocity.X < 0f && vector3.X > 0f) + { + npc.velocity.X = npc.velocity.X + num3; + } + } + else if (npc.velocity.X > vector3.X) + { + npc.velocity.X = npc.velocity.X - num3; + if (npc.velocity.X > 0f && vector3.X < 0f) + { + npc.velocity.X = npc.velocity.X - num3; + } + } + if (npc.velocity.Y < vector3.Y) + { + npc.velocity.Y = npc.velocity.Y + num3; + if (npc.velocity.Y < 0f && vector3.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num3; + } + } + else if (npc.velocity.Y > vector3.Y) + { + npc.velocity.Y = npc.velocity.Y - num3; + if (npc.velocity.Y > 0f && vector3.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num3; + } + } + int num22 = Math.Sign(player.Center.X - vector.X); + if (num22 != 0) + { + if (npc.ai[2] == 0f && num22 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num22; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vector) * num5; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num22 != 0) + { + npc.direction = num22; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 1f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num4) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 2f) + { + npc.localAI[3] = 0f; + } + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + } + } + else + { + resetAI = false; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + Point point15 = npc.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point15); + bool flag121 = tileSafely.nactive() || tileSafely.liquid > 0; + bool flag122 = false; + npc.TargetClosest(false); + Vector2 vector260 = npc.targetRect.Center.ToVector2(); + if (Main.player[npc.target].velocity.Y > -0.1f && !Main.player[npc.target].dead && npc.Distance(vector260) > 150f) + { + flag122 = true; + } + npc.localAI[1] += 1f; + if (lowLife) + { + bool spawnFlag = npc.localAI[1] == 150f; + if (NPC.CountNPCS(NPCID.SandShark) > 2) + { + spawnFlag = false; + } + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); + } + } + if (npc.localAI[1] >= 300f) + { + npc.localAI[1] = 0f; + if (npc.localAI[2] > 0f) + { + npc.localAI[2] = 0f; + } + switch (Main.rand.Next(3)) + { + case 0: + npc.ai[3] = 0f; + break; + case 1: + npc.ai[3] = 1f; + break; + case 2: + npc.ai[3] = 2f; + break; + } + int random = lowerLife ? 5 : 9; + if (lowLife && Main.rand.Next(random) == 0) + { + npc.localAI[3] = 1f; + } + npc.netUpdate = true; + } + if (npc.localAI[0] == -1f && !flag121) + { + npc.localAI[0] = 20f; + } + if (npc.localAI[0] > 0f) + { + npc.localAI[0] -= 1f; + } + if (flag121) + { + float num1534 = npc.ai[1]; + bool flag123 = false; + point15 = (npc.Center + new Vector2(0f, 24f)).ToTileCoordinates(); + tileSafely = Framing.GetTileSafely(point15.X, point15.Y - 2); + if (tileSafely.nactive()) + { + flag123 = true; + } + npc.ai[1] = (float)flag123.ToInt(); + if (npc.ai[2] < 30f) + { + npc.ai[2] += 1f; + } + if (flag122) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + float velocityX = 8f; + float velocityY = 6f; + switch ((int)npc.ai[3]) + { + case 0: + velocityX = 10f; + velocityY = 9f; + break; + case 1: + velocityX = 14f; + velocityY = 7f; + break; + case 2: + velocityX = 8f; + velocityY = 11f; + break; + } + if (revenge || lowerLife) + { + velocityX *= 1.1f; + velocityY *= 1.1f; + } + if (youMustDie) + { + velocityX *= 1.5f; + velocityY *= 1.5f; + } + if (npc.velocity.X > velocityX) + { + npc.velocity.X = velocityX; + } + if (npc.velocity.X < -velocityX) + { + npc.velocity.X = -velocityX; + } + if (npc.velocity.Y > velocityY) + { + npc.velocity.Y = velocityY; + } + if (npc.velocity.Y < -velocityY) + { + npc.velocity.Y = -velocityY; + } + Vector2 vec4 = npc.Center + npc.velocity.SafeNormalize(Vector2.Zero) * npc.Size.Length() / 2f + npc.velocity; + point15 = vec4.ToTileCoordinates(); + tileSafely = Framing.GetTileSafely(point15); + bool flag124 = tileSafely.nactive(); + if (!flag124 && Math.Sign(npc.velocity.X) == npc.direction && (npc.Distance(vector260) < 600f || youMustDie) && + (npc.ai[2] >= 30f || npc.ai[2] < 0f)) + { + if (npc.localAI[0] == 0f) + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); + npc.localAI[0] = -1f; + for (int num621 = 0; num621 < 25; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 32, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity.Y *= 6f; + Main.dust[num622].velocity.X *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 85, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity.Y *= 10f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 268, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity.X *= 2f; + } + int spawnX = (int)(npc.width / 2); + for (int sand = 0; sand < 5; sand++) + Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y, + (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), mod.ProjectileType("GreatSandBlast"), 40, 0f, Main.myPlayer, 0f, 0f); + } + npc.ai[2] = -30f; + Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); + npc.velocity = vector261 * 18f; //12 + } + } + else + { + float num1535 = 6f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -num1535 || npc.velocity.X > num1535) + { + npc.velocity.X = npc.velocity.X * 0.95f; //.95 + } + if (flag123) + { + npc.ai[0] = -1f; + } + else + { + npc.ai[0] = 1f; + } + float num1536 = 0.06f; + float num1537 = 0.01f; + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - num1537; + if (npc.velocity.Y < -num1536) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + num1537; + if (npc.velocity.Y > num1536) + { + npc.ai[0] = -1f; + } + } + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + } + else + { + if (npc.velocity.Y == 0f) + { + if (flag122) + { + npc.TargetClosest(true); + } + float num1538 = 1f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -num1538 || npc.velocity.X > num1538) + { + npc.velocity.X = npc.velocity.X * 0.95f; //.95 + } + } + if (npc.localAI[2] == 0f) + { + npc.localAI[2] = 1f; + float velocityX = 12f; + float velocityY = 12f; + switch ((int)npc.ai[3]) + { + case 0: + velocityX = 12f; + velocityY = 12f; + break; + case 1: + velocityX = 14f; + velocityY = 14f; + break; + case 2: + velocityX = 16f; + velocityY = 16f; + break; + } + if (revenge || lowerLife) + { + velocityX *= 1.1f; + velocityY *= 1.1f; + } + if (youMustDie) + { + velocityX *= 1.5f; + velocityY *= 1.5f; + } + npc.velocity.Y = -velocityY; + npc.velocity.X = velocityX * (float)npc.direction; + npc.netUpdate = true; + } + npc.velocity.Y = npc.velocity.Y + 0.4f; //0.3 + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if (npc.rotation < -0.1f) + { + npc.rotation = -0.1f; + } + if (npc.rotation > 0.1f) + { + npc.rotation = 0.1f; + } + } + } - public override void FindFrame(int frameHeight) - { - if (npc.localAI[3] == 0f) - { - npc.spriteDirection = -npc.direction; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (npc.localAI[3] == 0f) + { + npc.spriteDirection = -npc.direction; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int num621 = 0; num621 < 50; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 100; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int num621 = 0; num621 < 50; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 100; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); - if (Main.expertMode && Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); + if (Main.expertMode && Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Rabies, 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Rabies, 240, true); + player.AddBuff(BuffID.Bleeding, 240, true); + } + } } diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index e0e349ead9..f1d157b664 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -1,26 +1,26 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.HiveMind { public class DankCreeper : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dank Creeper"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + } - public override void SetDefaults() - { - npc.damage = 25; - npc.width = 74; - npc.height = 74; - npc.defense = 6; - npc.lifeMax = 45; + public override void SetDefaults() + { + npc.damage = 25; + npc.width = 74; + npc.height = 74; + npc.defense = 6; + npc.lifeMax = 45; if (CalamityWorld.bossRushActive) { npc.lifeMax = 10000; @@ -28,92 +28,92 @@ namespace CalamityMod.NPCs.HiveMind npc.aiStyle = -1; aiType = -1; animationType = 10; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.3f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } + npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.3f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge; - npc.TargetClosest(true); - float num1372 = revenge ? 12f : 11f; - if (CalamityWorld.bossRushActive) - num1372 = 18f; + public override void AI() + { + bool revenge = CalamityWorld.revenge; + npc.TargetClosest(true); + float num1372 = revenge ? 12f : 11f; + if (CalamityWorld.bossRushActive) + num1372 = 18f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; + float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore3"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore3"), 1f); + } + } - public override void NPCLoot() - { - if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbusHostile"), 14, 0f, Main.myPlayer, 0f, 0f); - } - } - } + public override void NPCLoot() + { + if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbusHostile"), 14, 0f, Main.myPlayer, 0f, 0f); + } + } + } } diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 9bc4d92112..52cf99ff8f 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -1,42 +1,42 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.HiveMind { public class DarkHeart : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Heart"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Heart"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 0; - npc.width = 32; - npc.height = 32; - npc.defense = 2; - npc.lifeMax = 80; + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 32; + npc.height = 32; + npc.defense = 2; + npc.lifeMax = 80; if (CalamityWorld.bossRushActive) { npc.lifeMax = 12000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.4f; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath21; - } + npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.4f; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath21; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -44,97 +44,97 @@ namespace CalamityMod.NPCs.HiveMind npc.frame.Y = frame * frameHeight; } - public override void AI() - { - bool revenge = CalamityWorld.revenge; - npc.TargetClosest(true); - float num1164 = revenge ? 4.5f : 4f; - float num1165 = revenge ? 0.8f : 0.75f; - if (CalamityWorld.bossRushActive) - { - num1164 *= 2f; - num1165 *= 2f; - } + public override void AI() + { + bool revenge = CalamityWorld.revenge; + npc.TargetClosest(true); + float num1164 = revenge ? 4.5f : 4f; + float num1165 = revenge ? 0.8f : 0.75f; + if (CalamityWorld.bossRushActive) + { + num1164 *= 2f; + num1165 *= 2f; + } - Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); - float num1166 = Main.player[npc.target].Center.X - vector133.X; - float num1167 = Main.player[npc.target].Center.Y - vector133.Y - 300f; - float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); - if (num1168 < 20f) - { - num1166 = npc.velocity.X; - num1167 = npc.velocity.Y; - } - else - { - num1168 = num1164 / num1168; - num1166 *= num1168; - num1167 *= num1168; - } - if (npc.velocity.X < num1166) - { - npc.velocity.X = npc.velocity.X + num1165; - if (npc.velocity.X < 0f && num1166 > 0f) - { - npc.velocity.X = npc.velocity.X + num1165 * 2f; - } - } - else if (npc.velocity.X > num1166) - { - npc.velocity.X = npc.velocity.X - num1165; - if (npc.velocity.X > 0f && num1166 < 0f) - { - npc.velocity.X = npc.velocity.X - num1165 * 2f; - } - } - if (npc.velocity.Y < num1167) - { - npc.velocity.Y = npc.velocity.Y + num1165; - if (npc.velocity.Y < 0f && num1167 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1165 * 2f; - } - } - else if (npc.velocity.Y > num1167) - { - npc.velocity.Y = npc.velocity.Y - num1165; - if (npc.velocity.Y > 0f && num1167 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1165 * 2f; - } - } - if (npc.position.X + (float)npc.width > Main.player[npc.target].position.X && npc.position.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] += 4f; - if (npc.ai[0] > 16f) - { - npc.ai[0] = 0f; - int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); - int num184 = Main.expertMode ? 14 : 18; - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("ShaderainHostile"), num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } + Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); + float num1166 = Main.player[npc.target].Center.X - vector133.X; + float num1167 = Main.player[npc.target].Center.Y - vector133.Y - 300f; + float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); + if (num1168 < 20f) + { + num1166 = npc.velocity.X; + num1167 = npc.velocity.Y; + } + else + { + num1168 = num1164 / num1168; + num1166 *= num1168; + num1167 *= num1168; + } + if (npc.velocity.X < num1166) + { + npc.velocity.X = npc.velocity.X + num1165; + if (npc.velocity.X < 0f && num1166 > 0f) + { + npc.velocity.X = npc.velocity.X + num1165 * 2f; + } + } + else if (npc.velocity.X > num1166) + { + npc.velocity.X = npc.velocity.X - num1165; + if (npc.velocity.X > 0f && num1166 < 0f) + { + npc.velocity.X = npc.velocity.X - num1165 * 2f; + } + } + if (npc.velocity.Y < num1167) + { + npc.velocity.Y = npc.velocity.Y + num1165; + if (npc.velocity.Y < 0f && num1167 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1165 * 2f; + } + } + else if (npc.velocity.Y > num1167) + { + npc.velocity.Y = npc.velocity.Y - num1165; + if (npc.velocity.Y > 0f && num1167 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1165 * 2f; + } + } + if (npc.position.X + (float)npc.width > Main.player[npc.target].position.X && npc.position.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] += 4f; + if (npc.ai[0] > 16f) + { + npc.ai[0] = 0f; + int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); + int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); + int num184 = Main.expertMode ? 14 : 18; + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("ShaderainHostile"), num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 62e7ac5335..2e79cf9573 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -1,218 +1,218 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.HiveMind { public class HiveBlob : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Blob"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Blob"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 25; - npc.height = 25; - npc.lifeMax = 75; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 13000; - } - aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 25; + npc.height = 25; + npc.lifeMax = 75; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 13000; + } + aiType = -1; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } - public override void AI() - { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.hiveMind; - if (npc.ai[3] > 0f) - { - num750 = (int)npc.ai[3] - 1; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - npc.TargetClosest(true); - float num751 = 0.01f; - float num752 = 400f; - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.5) - { - num752 += 60f; - } - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.15) - { - num752 += 120f; - } - if (expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 100f; - num751 += 0.02f; - } - if (revenge) - { - num751 += 0.1f; - } - if (!Main.npc[num750].active || CalamityGlobalNPC.hiveMind < 0) - { - npc.active = false; - return; - } - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (npc.position.X < num754 + num758) - { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - else if (npc.position.X > num754 + num758) - { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (npc.position.Y < num755 + num759) - { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - else if (npc.position.Y > num755 + num759) - { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] = 180f; - } - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num941 = revenge ? 6f : 5f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 7f; - } - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = mod.ProjectileType("VileClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + int num750 = CalamityGlobalNPC.hiveMind; + if (npc.ai[3] > 0f) + { + num750 = (int)npc.ai[3] - 1; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(120, 480); + npc.ai[0] = (float)Main.rand.Next(-100, 101); + npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + npc.TargetClosest(true); + float num751 = 0.01f; + float num752 = 400f; + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.5) + { + num752 += 60f; + } + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.15) + { + num752 += 120f; + } + if (expertMode) + { + float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + num752 += num753 * 100f; + num751 += 0.02f; + } + if (revenge) + { + num751 += 0.1f; + } + if (!Main.npc[num750].active || CalamityGlobalNPC.hiveMind < 0) + { + npc.active = false; + return; + } + Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); + float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + Vector2 vector93 = new Vector2(num754, num755); + float num756 = num754 + npc.ai[0]; + float num757 = num755 + npc.ai[1]; + float num758 = num756 - vector93.X; + float num759 = num757 - vector93.Y; + float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + num760 = num752 / num760; + num758 *= num760; + num759 *= num760; + if (npc.position.X < num754 + num758) + { + npc.velocity.X = npc.velocity.X + num751; + if (npc.velocity.X < 0f && num758 > 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + else if (npc.position.X > num754 + num758) + { + npc.velocity.X = npc.velocity.X - num751; + if (npc.velocity.X > 0f && num758 < 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (npc.position.Y < num755 + num759) + { + npc.velocity.Y = npc.velocity.Y + num751; + if (npc.velocity.Y < 0f && num759 > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + else if (npc.position.Y > num755 + num759) + { + npc.velocity.Y = npc.velocity.Y - num751; + if (npc.velocity.Y > 0f && num759 < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + if (npc.velocity.X > 4f) + { + npc.velocity.X = 4f; + } + if (npc.velocity.X < -4f) + { + npc.velocity.X = -4f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] = 180f; + } + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num941 = revenge ? 6f : 5f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 7f; + } + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + int num945 = expertMode ? 12 : 15; + int num946 = mod.ProjectileType("VileClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index f673067f5a..6b3a234e83 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -1,198 +1,198 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.HiveMind { public class HiveBlob2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Blob"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Blob"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 25; - npc.height = 25; - npc.lifeMax = 75; + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 25; + npc.height = 25; + npc.lifeMax = 75; if (CalamityWorld.bossRushActive) { npc.lifeMax = 13000; } aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } - public override void AI() - { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.hiveMind; - if (npc.ai[3] > 0f) - { - num750 = (int)npc.ai[3] - 1; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - npc.TargetClosest(true); - float num751 = 0.01f; - float num752 = 300f; - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.25) - { - num752 += 30f; - } - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.1) - { - num752 += 60f; - } - if (expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 100f; - num751 += 0.02f; - } - if (revenge) - { - num751 += 0.1f; - } - if (!Main.npc[num750].active) - { - npc.active = false; - return; - } - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (npc.position.X < num754 + num758) - { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - else if (npc.position.X > num754 + num758) - { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (npc.position.Y < num755 + num759) - { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - else if (npc.position.Y > num755 + num759) - { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] = 180f; - } - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num941 = revenge ? 6f : 5f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 7f; - } - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = mod.ProjectileType("VileClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + int num750 = CalamityGlobalNPC.hiveMind; + if (npc.ai[3] > 0f) + { + num750 = (int)npc.ai[3] - 1; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(120, 480); + npc.ai[0] = (float)Main.rand.Next(-100, 101); + npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + npc.TargetClosest(true); + float num751 = 0.01f; + float num752 = 300f; + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.25) + { + num752 += 30f; + } + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.1) + { + num752 += 60f; + } + if (expertMode) + { + float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + num752 += num753 * 100f; + num751 += 0.02f; + } + if (revenge) + { + num751 += 0.1f; + } + if (!Main.npc[num750].active) + { + npc.active = false; + return; + } + Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); + float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + Vector2 vector93 = new Vector2(num754, num755); + float num756 = num754 + npc.ai[0]; + float num757 = num755 + npc.ai[1]; + float num758 = num756 - vector93.X; + float num759 = num757 - vector93.Y; + float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + num760 = num752 / num760; + num758 *= num760; + num759 *= num760; + if (npc.position.X < num754 + num758) + { + npc.velocity.X = npc.velocity.X + num751; + if (npc.velocity.X < 0f && num758 > 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + else if (npc.position.X > num754 + num758) + { + npc.velocity.X = npc.velocity.X - num751; + if (npc.velocity.X > 0f && num758 < 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (npc.position.Y < num755 + num759) + { + npc.velocity.Y = npc.velocity.Y + num751; + if (npc.velocity.Y < 0f && num759 > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + else if (npc.position.Y > num755 + num759) + { + npc.velocity.Y = npc.velocity.Y - num751; + if (npc.velocity.Y > 0f && num759 < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + if (npc.velocity.X > 4f) + { + npc.velocity.X = 4f; + } + if (npc.velocity.X < -4f) + { + npc.velocity.X = -4f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] = 180f; + } + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num941 = revenge ? 6f : 5f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 7f; + } + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + int num945 = expertMode ? 12 : 15; + int num946 = mod.ProjectileType("VileClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.1f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -200,19 +200,19 @@ namespace CalamityMod.NPCs.HiveMind npc.frame.Y = frame * frameHeight; } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs index 22a8cccf95..944a6b8688 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveCyst.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.HiveMind { public class HiveCyst : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Cyst"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Cyst"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 0; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.rarity = 2; - } + public override void SetDefaults() + { + npc.npcSlots = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 0; + npc.lifeMax = 1000; + npc.knockBackResist = 0f; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.rarity = 2; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -38,43 +38,43 @@ namespace CalamityMod.NPCs.HiveMind npc.frame.Y = frame * frameHeight; } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("HiveCyst")) || NPC.AnyNPCs(mod.NPCType("HiveMind")) || NPC.AnyNPCs(mod.NPCType("HiveMindP2"))) - { - return 0f; - } - else if (NPC.downedBoss2 && !CalamityWorld.downedHiveMind) - { - return SpawnCondition.Corruption.Chance * 1.5f; - } - return SpawnCondition.Corruption.Chance * (Main.hardMode ? 0.05f : 0.5f); - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("HiveCyst")) || NPC.AnyNPCs(mod.NPCType("HiveMind")) || NPC.AnyNPCs(mod.NPCType("HiveMindP2"))) + { + return 0f; + } + else if (NPC.downedBoss2 && !CalamityWorld.downedHiveMind) + { + return SpawnCondition.Corruption.Chance * 1.5f; + } + return SpawnCondition.Corruption.Chance * (Main.hardMode ? 0.05f : 0.5f); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 2000; - npc.damage = 0; - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 2000; + npc.damage = 0; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("HiveMind")) < 1) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveMind")); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("HiveMind")) < 1) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveMind")); + } + } + } + } } diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index fa3c1938d9..c7f5d5536a 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1,31 +1,31 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.HiveMind { [AutoloadBossHead] - public class HiveMind : ModNPC - { - int burrowTimer = 720; + public class HiveMind : ModNPC + { + int burrowTimer = 720; public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Main.npcFrameCount[npc.type] = 4; - } + { + DisplayName.SetDefault("The Hive Mind"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 5f; - npc.damage = 20; - npc.width = 150; - npc.height = 120; - npc.defense = 10; - npc.lifeMax = CalamityWorld.revenge ? 1800 : 1200; + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 20; + npc.width = 150; + npc.height = 120; + npc.defense = 10; + npc.lifeMax = CalamityWorld.revenge ? 1800 : 1200; if (CalamityWorld.death) { npc.lifeMax = 3300; @@ -34,17 +34,17 @@ namespace CalamityMod.NPCs.HiveMind { npc.lifeMax = CalamityWorld.death ? 400000 : 350000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; - npc.boss = true; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.boss = true; npc.value = 0f; npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + npc.DeathSound = SoundID.NPCDeath1; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); @@ -52,17 +52,17 @@ namespace CalamityMod.NPCs.HiveMind music = MusicID.Boss2; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -70,212 +70,212 @@ namespace CalamityMod.NPCs.HiveMind npc.frame.Y = frame * frameHeight; } - public override void AI() - { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.timeLeft > 60) - npc.timeLeft = 60; - if (npc.localAI[3] < 120f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 + 1f; - } - if (npc.localAI[3] > 60f) - { - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; - npc.noGravity = true; - npc.noTileCollide = true; - if (burrowTimer > 30) - burrowTimer = 30; - } - return; - } - if (npc.localAI[3] > 0f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 - 1f; - return; - } - npc.noGravity = false; - npc.noTileCollide = false; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - CalamityGlobalNPC.hiveMind = npc.whoAmI; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (revenge) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - for (int num723 = 0; num723 < 5; num723++) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - bool flag100 = false; - int num568 = 0; - if (expertMode) - { - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("DankCreeper")) - { - flag100 = true; - num568++; - } - } - npc.defense += num568 * 25; - } - if (expertMode) - { - if (!flag100) - { - npc.defense = 10; - } - } - if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.25); - if ((float)(npc.life + num660) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - int num661 = Main.rand.Next(3, 6); - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("HiveBlob"); - if (Main.rand.NextBool(3) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num663 = mod.NPCType("DankCreeper"); - } - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - return; - } - } - } - burrowTimer--; - if (burrowTimer < -120) - { - burrowTimer = 600; - npc.scale = 1f; - npc.alpha = 0; - npc.dontTakeDamage = false; + public override void AI() + { + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.timeLeft > 60) + npc.timeLeft = 60; + if (npc.localAI[3] < 120f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 + 1f; + } + if (npc.localAI[3] > 60f) + { + npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; + npc.noGravity = true; + npc.noTileCollide = true; + if (burrowTimer > 30) + burrowTimer = 30; + } + return; + } + if (npc.localAI[3] > 0f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 - 1f; + return; + } + npc.noGravity = false; + npc.noTileCollide = false; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + CalamityGlobalNPC.hiveMind = npc.whoAmI; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (revenge) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + for (int num723 = 0; num723 < 5; num723++) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + bool flag100 = false; + int num568 = 0; + if (expertMode) + { + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("DankCreeper")) + { + flag100 = true; + num568++; + } + } + npc.defense += num568 * 25; + } + if (expertMode) + { + if (!flag100) + { + npc.defense = 10; + } + } + if (npc.ai[3] == 0f && npc.life > 0) + { + npc.ai[3] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.25); + if ((float)(npc.life + num660) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + int num661 = Main.rand.Next(3, 6); + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("HiveBlob"); + if (Main.rand.NextBool(3) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num663 = mod.NPCType("DankCreeper"); + } + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + if (Main.netMode == NetmodeID.Server && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + return; + } + } + } + burrowTimer--; + if (burrowTimer < -120) + { + burrowTimer = 600; + npc.scale = 1f; + npc.alpha = 0; + npc.dontTakeDamage = false; npc.damage = npc.defDamage; } - else if (burrowTimer < -60) - { - npc.scale += 0.0165f; - npc.alpha -= 4; - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); - Main.dust[num622].velocity *= 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - for (int i = 0; i < 2; i++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 3.5f * npc.scale); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); - Main.dust[num624].velocity *= 1f; - } - } - else if (burrowTimer == -60) - { - npc.scale = 0.01f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Center = player.Center; - npc.position.Y = player.position.Y - npc.height; - int tilePosX = (int)npc.Center.X / 16; - int tilePosY = (int)(npc.position.Y + npc.height) / 16 + 1; - if (Main.tile[tilePosX, tilePosY] == null) - Main.tile[tilePosX, tilePosY] = new Tile(); - while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[(int)Main.tile[tilePosX, tilePosY].type])) - { - tilePosY++; - npc.position.Y += 16; - if (Main.tile[tilePosX, tilePosY] == null) - Main.tile[tilePosX, tilePosY] = new Tile(); - } - } + else if (burrowTimer < -60) + { + npc.scale += 0.0165f; + npc.alpha -= 4; + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + Main.dust[num622].velocity *= 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + for (int i = 0; i < 2; i++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 3.5f * npc.scale); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 3.5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + Main.dust[num624].velocity *= 1f; + } + } + else if (burrowTimer == -60) + { + npc.scale = 0.01f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Center = player.Center; + npc.position.Y = player.position.Y - npc.height; + int tilePosX = (int)npc.Center.X / 16; + int tilePosY = (int)(npc.position.Y + npc.height) / 16 + 1; + if (Main.tile[tilePosX, tilePosY] == null) + Main.tile[tilePosX, tilePosY] = new Tile(); + while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[(int)Main.tile[tilePosX, tilePosY].type])) + { + tilePosY++; + npc.position.Y += 16; + if (Main.tile[tilePosX, tilePosY] == null) + Main.tile[tilePosX, tilePosY] = new Tile(); + } + } npc.netUpdate = true; } - else if (burrowTimer < 0) - { - npc.scale -= 0.0165f; - npc.alpha += 4; - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); - Main.dust[num622].velocity *= 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - for (int i = 0; i < 2; i++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 3.5f * npc.scale); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); - Main.dust[num624].velocity *= 1f; - } - } - else if (burrowTimer == 0) - { - if (!player.active || player.dead) - { - burrowTimer = 30; - } - else - { - npc.dontTakeDamage = true; + else if (burrowTimer < 0) + { + npc.scale -= 0.0165f; + npc.alpha += 4; + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + Main.dust[num622].velocity *= 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + for (int i = 0; i < 2; i++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 3.5f * npc.scale); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 3.5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + Main.dust[num624].velocity *= 1f; + } + } + else if (burrowTimer == 0) + { + if (!player.active || player.dead) + { + burrowTimer = 30; + } + else + { + npc.dontTakeDamage = true; npc.damage = 0; } - } - } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { if (npc.life > 0) { if (NPC.CountNPCS(NPCID.EaterofSouls) < 3 && NPC.CountNPCS(NPCID.DevourerHead) < 1) @@ -300,42 +300,42 @@ namespace CalamityMod.NPCs.HiveMind } else { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore4"), 1f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (NPC.CountNPCS(mod.NPCType("HiveMindP2")) < 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveMindP2"), npc.whoAmI, 0f, 0f, 0f, 0f, npc.target); - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - } - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore4"), 1f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.CountNPCS(mod.NPCType("HiveMindP2")) < 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveMindP2"), npc.whoAmI, 0f, 0f, 0f, 0f, npc.target); + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + } + } } - } + } - public override bool CanHitPlayer (Player target, ref int cooldownSlot) - { - return npc.scale == 1f; //no damage when shrunk - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.scale == 1f; //no damage when shrunk + } - public override bool? DrawHealthBar (byte hbPosition, ref float scale, ref Vector2 position) - { - return npc.scale == 1f; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return npc.scale == 1f; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } } diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 386924ba18..d60b26eb3c 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -1,12 +1,12 @@ -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; /* states: * 0 = slow drift @@ -21,656 +21,657 @@ using CalamityMod.Utilities; namespace CalamityMod.NPCs.HiveMind { [AutoloadBossHead] - public class HiveMindP2 : ModNPC - { - //this block of values can be modified in SetDefaults() based on difficulty mode or something - int minimumDriftTime = 300; - int teleportRadius = 300; - int decelerationTime = 30; - int reelbackFade = 3; //divide 255 by this for duration of reelback in ticks - float arcTime = 45f; //ticks needed to complete movement for spawn and rain attacks (DEATH ONLY) - float driftSpeed = 2f; //default speed when slowly floating at player - float driftBoost = 1f; //max speed added as health decreases - int lungeDelay = 90; //# of ticks long hive mind spends sliding to a stop before lunging - int lungeTime = 30; - int lungeFade = 15; //divide 255 by this for duration of hive mind spin before slowing for lunge - double lungeRots = 0.2; //number of revolutions made while spinning/fading in for lunge - bool dashStarted = false; - int phase2timer = 360; - int rotationDirection; - double rotation; - double rotationIncrement; - int state = 0; - int previousState = 0; - int nextState = 0; - int reelCount = 0; - Vector2 deceleration; + public class HiveMindP2 : ModNPC + { + //this block of values can be modified in SetDefaults() based on difficulty mode or something + int minimumDriftTime = 300; + int teleportRadius = 300; + int decelerationTime = 30; + int reelbackFade = 3; //divide 255 by this for duration of reelback in ticks + float arcTime = 45f; //ticks needed to complete movement for spawn and rain attacks (DEATH ONLY) + float driftSpeed = 2f; //default speed when slowly floating at player + float driftBoost = 1f; //max speed added as health decreases + int lungeDelay = 90; //# of ticks long hive mind spends sliding to a stop before lunging + int lungeTime = 30; + int lungeFade = 15; //divide 255 by this for duration of hive mind spin before slowing for lunge + double lungeRots = 0.2; //number of revolutions made while spinning/fading in for lunge + bool dashStarted = false; + int phase2timer = 360; + int rotationDirection; + double rotation; + double rotationIncrement; + int state = 0; + int previousState = 0; + int nextState = 0; + int reelCount = 0; + Vector2 deceleration; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Hive Mind"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 5f; - npc.damage = 35; - npc.width = 150; - npc.height = 120; - npc.defense = 5; - npc.lifeMax = CalamityWorld.revenge ? 7560 : 5800; - if (CalamityWorld.death) - { - npc.lifeMax = 12500; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1600000 : 1400000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 6, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); - else - music = MusicID.Boss2; - bossBag = mod.ItemType("HiveMindBag"); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - if (Main.expertMode) - { - minimumDriftTime = 120; - reelbackFade = 5; - } - if (CalamityWorld.revenge) - { - lungeRots = 0.3; - minimumDriftTime = 90; - reelbackFade = 6; - lungeTime = 25; - driftSpeed = 3f; - driftBoost = 2f; - } - if (CalamityWorld.death) - { - lungeRots = 0.4; - minimumDriftTime = 60; - reelbackFade = 7; - lungeTime = 20; - driftSpeed = 4f; - driftBoost = 1f; - } - if (CalamityWorld.bossRushActive) - { - lungeRots = 0.4; - minimumDriftTime = 20; - reelbackFade = 15; - lungeTime = 10; - driftSpeed = 12f; - } - phase2timer = minimumDriftTime; - rotationIncrement = 0.0246399424 * lungeRots * lungeFade; - } + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 35; + npc.width = 150; + npc.height = 120; + npc.defense = 5; + npc.lifeMax = CalamityWorld.revenge ? 7560 : 5800; + if (CalamityWorld.death) + { + npc.lifeMax = 12500; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1600000 : 1400000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 6, 0, 0); + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); + else + music = MusicID.Boss2; + bossBag = mod.ItemType("HiveMindBag"); + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + if (Main.expertMode) + { + minimumDriftTime = 120; + reelbackFade = 5; + } + if (CalamityWorld.revenge) + { + lungeRots = 0.3; + minimumDriftTime = 90; + reelbackFade = 6; + lungeTime = 25; + driftSpeed = 3f; + driftBoost = 2f; + } + if (CalamityWorld.death) + { + lungeRots = 0.4; + minimumDriftTime = 60; + reelbackFade = 7; + lungeTime = 20; + driftSpeed = 4f; + driftBoost = 1f; + } + if (CalamityWorld.bossRushActive) + { + lungeRots = 0.4; + minimumDriftTime = 20; + reelbackFade = 15; + lungeTime = 10; + driftSpeed = 12f; + } + phase2timer = minimumDriftTime; + rotationIncrement = 0.0246399424 * lungeRots * lungeFade; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(state); - writer.Write(nextState); - writer.Write(phase2timer); - writer.Write(dashStarted); - writer.Write(rotationDirection); - writer.Write(rotation); - writer.Write(previousState); - writer.Write(reelCount); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(state); + writer.Write(nextState); + writer.Write(phase2timer); + writer.Write(dashStarted); + writer.Write(rotationDirection); + writer.Write(rotation); + writer.Write(previousState); + writer.Write(reelCount); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - state = reader.ReadInt32(); - nextState = reader.ReadInt32(); - phase2timer = reader.ReadInt32(); - dashStarted = reader.ReadBoolean(); - rotationDirection = reader.ReadInt32(); - rotation = reader.ReadDouble(); - previousState = reader.ReadInt32(); - reelCount = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + state = reader.ReadInt32(); + nextState = reader.ReadInt32(); + phase2timer = reader.ReadInt32(); + dashStarted = reader.ReadBoolean(); + rotationDirection = reader.ReadInt32(); + rotation = reader.ReadDouble(); + previousState = reader.ReadInt32(); + reelCount = reader.ReadInt32(); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = lightColor; - color24 = npc.GetAlpha(color24); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = mod.GetTexture("NPCs/HiveMind/HiveMindP2"); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (state != 0 && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = npc.GetAlpha(color26); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, effects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = lightColor; + color24 = npc.GetAlpha(color24); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = mod.GetTexture("NPCs/HiveMind/HiveMindP2"); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (state != 0 && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = npc.GetAlpha(color26); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + SpriteEffects effects = spriteEffects; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, effects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - private void SpawnStuff() - { - Player player = Main.player[npc.target]; - for (int i = 0; i < 5; i++) - { - bool spawnedSomething = false; - int type = NPCID.EaterofSouls; - int maxAmount = 0; - int random = Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) ? 6 : 4; - switch (Main.rand.Next(random)) - { - case 0: - type = NPCID.DevourerHead; - maxAmount = 1; - break; - case 1: - type = mod.NPCType("DankCreeper"); - maxAmount = 1; - break; - case 2: - type = mod.NPCType("DankCreeper"); - maxAmount = 2; - break; - case 3: - type = mod.NPCType("HiveBlob2"); - maxAmount = 2; - break; - case 4: - type = NPCID.EaterofSouls; - maxAmount = 2; - break; - case 5: - type = mod.NPCType("DarkHeart"); - maxAmount = 2; - break; - } - int numToSpawn = maxAmount - NPC.CountNPCS(type); - while (numToSpawn > 0) - { - numToSpawn--; - spawnedSomething = true; - int spawn = NPC.NewNPC((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), type); - Main.npc[spawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[spawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - } - if (spawnedSomething) - return; - } - } + private void SpawnStuff() + { + Player player = Main.player[npc.target]; + for (int i = 0; i < 5; i++) + { + bool spawnedSomething = false; + int type = NPCID.EaterofSouls; + int maxAmount = 0; + int random = Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) ? 6 : 4; + switch (Main.rand.Next(random)) + { + case 0: + type = NPCID.DevourerHead; + maxAmount = 1; + break; + case 1: + type = mod.NPCType("DankCreeper"); + maxAmount = 1; + break; + case 2: + type = mod.NPCType("DankCreeper"); + maxAmount = 2; + break; + case 3: + type = mod.NPCType("HiveBlob2"); + maxAmount = 2; + break; + case 4: + type = NPCID.EaterofSouls; + maxAmount = 2; + break; + case 5: + type = mod.NPCType("DarkHeart"); + maxAmount = 2; + break; + } + int numToSpawn = maxAmount - NPC.CountNPCS(type); + while (numToSpawn > 0) + { + numToSpawn--; + spawnedSomething = true; + int spawn = NPC.NewNPC((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), type); + Main.npc[spawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[spawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + } + if (spawnedSomething) + return; + } + } - private void ReelBack() - { - npc.alpha = 0; - phase2timer = 0; - deceleration = npc.velocity / 255f * reelbackFade; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - state = 2; - Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); - } - else - { - if (Main.netMode != NetmodeID.MultiplayerClient) - SpawnStuff(); - state = nextState; - nextState = 0; - if (state == 2) - { - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - } - else - { - Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); - } - } - } + private void ReelBack() + { + npc.alpha = 0; + phase2timer = 0; + deceleration = npc.velocity / 255f * reelbackFade; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + state = 2; + Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); + } + else + { + if (Main.netMode != NetmodeID.MultiplayerClient) + SpawnStuff(); + state = nextState; + nextState = 0; + if (state == 2) + { + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + } + else + { + Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); + } + } + } - public override void AI() - { - Player player = Main.player[npc.target]; - npc.defense = (player.ZoneCorrupt || CalamityWorld.bossRushActive) ? 5 : 9999; - CalamityGlobalNPC.hiveMind = npc.whoAmI; - if (npc.alpha != 0) - { - if (npc.damage != 0) - { - npc.damage = 0; - } - } - else - { - npc.damage = npc.defDamage; - } - switch (state) - { - case 0: //slowdrift - if (npc.alpha > 0) - npc.alpha -= 3; - if (nextState == 0) - { - npc.TargetClosest(true); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - do nextState = Main.rand.Next(3, 6); - while (nextState == previousState); - previousState = nextState; - } - else - { - if (CalamityWorld.revenge && (Main.rand.NextBool(4) || reelCount == 3)) - { - reelCount = 0; - nextState = 2; - } - else - { - reelCount++; - nextState = 1; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - if (nextState == 3) - rotation = MathHelper.ToRadians(Main.rand.Next(360)); - npc.netUpdate = true; - } - if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 5000f) - { - npc.TargetClosest(true); - if (npc.timeLeft > 60) - npc.timeLeft = 60; - if (npc.localAI[3] < 120f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 + 1f; - } - if (npc.localAI[3] > 60f) - { - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; - } - return; - } - if (npc.localAI[3] > 0f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 - 1f; - return; - } - npc.velocity = player.Center - npc.Center; - phase2timer--; - if (phase2timer <= -180) //no stalling drift mode forever - { - npc.velocity *= 2f / 255f * reelbackFade; - ReelBack(); - npc.netUpdate = true; - } - else - { - npc.velocity.Normalize(); - if (Main.expertMode || CalamityWorld.bossRushActive) //variable velocity in expert and up - { - npc.velocity *= driftSpeed + driftBoost * (npc.lifeMax - npc.life) / npc.lifeMax; - } - else - { - npc.velocity *= driftSpeed; - } - } - break; - case 1: //reelback and teleport - npc.alpha += reelbackFade; - npc.velocity -= deceleration; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.velocity = Vector2.Zero; - state = 0; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] != 0f && npc.ai[2] != 0f) - { - npc.position.X = npc.ai[1] * 16 - npc.width / 2; - npc.position.Y = npc.ai[2] * 16 - npc.height / 2; - } - phase2timer = minimumDriftTime + Main.rand.Next(121); - npc.netUpdate = true; - } - else if (npc.ai[1] == 0f && npc.ai[2] == 0f) - { - for (int i = 0; i < 10; i++) - { - int posX = (int)player.Center.X / 16 + Main.rand.Next(15, 46) * (Main.rand.NextBool(2) ? -1 : 1); - int posY = (int)player.Center.Y / 16 + Main.rand.Next(15, 46) * (Main.rand.NextBool(2) ? -1 : 1); - if (!WorldGen.SolidTile(posX, posY) && Collision.CanHit(new Vector2(posX * 16, posY * 16), 1, 1, player.position, player.width, player.height)) - { - npc.ai[1] = posX; - npc.ai[2] = posY; - npc.netUpdate = true; - break; - } - } - } - break; - case 2: //reelback for lunge + death legacy - npc.alpha += reelbackFade; - npc.velocity -= deceleration; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.velocity = Vector2.Zero; - dashStarted = false; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - state = nextState; - nextState = 0; - previousState = state; - } - else - { - state = 3; - } - if (player.velocity.X > 0) - rotationDirection = 1; - else if (player.velocity.X < 0) - rotationDirection = -1; - else - rotationDirection = player.direction; - } - break; - case 3: //rev lunge - npc.netUpdate = true; - if (npc.alpha > 0) - { - npc.alpha -= lungeFade; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - } - rotation += rotationIncrement * rotationDirection; - phase2timer = lungeDelay; - } - else - { - phase2timer--; - if (!dashStarted) - { - if (phase2timer <= 0) - { - phase2timer = lungeTime; - npc.velocity = player.Center - npc.Center; - npc.velocity.Normalize(); - npc.velocity *= teleportRadius / lungeTime; - dashStarted = true; - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - } - else - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - } - rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; - } - } - else - { - if (phase2timer <= 0) - { - state = 6; - phase2timer = 0; - deceleration = npc.velocity / decelerationTime; - } - } - } - break; - case 4: //enemy spawn arc (death mode) - if (npc.alpha > 0) - { - npc.alpha -= 5; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Center = player.Center; - npc.position.Y += teleportRadius; - } - npc.netUpdate = true; - } - else - { - if (!dashStarted) - { - dashStarted = true; - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - npc.velocity.X = 3.14159265f * teleportRadius / arcTime; - npc.velocity *= rotationDirection; - npc.netUpdate = true; - } - else - { - npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); - phase2timer++; - if (phase2timer == (int)arcTime / 6) - { - phase2timer = 0; - npc.ai[0]++; - if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height)) //draw line of sight - { - if (npc.ai[0] == 2 || npc.ai[0] == 4) - { - if ((Main.expertMode || CalamityWorld.bossRushActive) && NPC.CountNPCS(mod.NPCType("DarkHeart")) < 2) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DarkHeart")); - } - } - else if (NPC.CountNPCS(NPCID.EaterofSouls) < 2) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.EaterofSouls); - } - } - if (npc.ai[0] == 6) - { - npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); - SpawnStuff(); - state = 6; - npc.ai[0] = 0; - deceleration = npc.velocity / decelerationTime; - } - } - } - } - break; - case 5: //raindash (death mode) - if (npc.alpha > 0) - { - npc.alpha -= 5; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Center = player.Center; - npc.position.Y -= teleportRadius; - npc.position.X += teleportRadius * rotationDirection; - } - npc.netUpdate = true; - } - else - { - if (!dashStarted) - { - dashStarted = true; - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - npc.velocity.X = teleportRadius / arcTime * 3; - npc.velocity *= -rotationDirection; - npc.netUpdate = true; - } - else - { - phase2timer++; - if (phase2timer == (int)arcTime / 20) - { - phase2timer = 0; - npc.ai[0]++; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = Main.expertMode ? 14 : 18; - Projectile.NewProjectile(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), 0, 0, mod.ProjectileType("ShadeNimbusHostile"), damage, 0, Main.myPlayer, 11, 0); - } - if (npc.ai[0] == 10) - { - state = 6; - npc.ai[0] = 0; - deceleration = npc.velocity / decelerationTime; - } - } - } - } - break; - case 6: //deceleration - npc.velocity -= deceleration; - phase2timer++; - if (phase2timer == decelerationTime) - { - phase2timer = minimumDriftTime + Main.rand.Next(121); - state = 0; - npc.netUpdate = true; - } - break; - } - } + public override void AI() + { + Player player = Main.player[npc.target]; + npc.defense = (player.ZoneCorrupt || CalamityWorld.bossRushActive) ? 5 : 9999; + CalamityGlobalNPC.hiveMind = npc.whoAmI; + if (npc.alpha != 0) + { + if (npc.damage != 0) + { + npc.damage = 0; + } + } + else + { + npc.damage = npc.defDamage; + } + switch (state) + { + case 0: //slowdrift + if (npc.alpha > 0) + npc.alpha -= 3; + if (nextState == 0) + { + npc.TargetClosest(true); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + do + nextState = Main.rand.Next(3, 6); + while (nextState == previousState); + previousState = nextState; + } + else + { + if (CalamityWorld.revenge && (Main.rand.NextBool(4) || reelCount == 3)) + { + reelCount = 0; + nextState = 2; + } + else + { + reelCount++; + nextState = 1; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + if (nextState == 3) + rotation = MathHelper.ToRadians(Main.rand.Next(360)); + npc.netUpdate = true; + } + if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 5000f) + { + npc.TargetClosest(true); + if (npc.timeLeft > 60) + npc.timeLeft = 60; + if (npc.localAI[3] < 120f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 + 1f; + } + if (npc.localAI[3] > 60f) + { + npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; + } + return; + } + if (npc.localAI[3] > 0f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 - 1f; + return; + } + npc.velocity = player.Center - npc.Center; + phase2timer--; + if (phase2timer <= -180) //no stalling drift mode forever + { + npc.velocity *= 2f / 255f * reelbackFade; + ReelBack(); + npc.netUpdate = true; + } + else + { + npc.velocity.Normalize(); + if (Main.expertMode || CalamityWorld.bossRushActive) //variable velocity in expert and up + { + npc.velocity *= driftSpeed + driftBoost * (npc.lifeMax - npc.life) / npc.lifeMax; + } + else + { + npc.velocity *= driftSpeed; + } + } + break; + case 1: //reelback and teleport + npc.alpha += reelbackFade; + npc.velocity -= deceleration; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.velocity = Vector2.Zero; + state = 0; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] != 0f && npc.ai[2] != 0f) + { + npc.position.X = npc.ai[1] * 16 - npc.width / 2; + npc.position.Y = npc.ai[2] * 16 - npc.height / 2; + } + phase2timer = minimumDriftTime + Main.rand.Next(121); + npc.netUpdate = true; + } + else if (npc.ai[1] == 0f && npc.ai[2] == 0f) + { + for (int i = 0; i < 10; i++) + { + int posX = (int)player.Center.X / 16 + Main.rand.Next(15, 46) * (Main.rand.NextBool(2) ? -1 : 1); + int posY = (int)player.Center.Y / 16 + Main.rand.Next(15, 46) * (Main.rand.NextBool(2) ? -1 : 1); + if (!WorldGen.SolidTile(posX, posY) && Collision.CanHit(new Vector2(posX * 16, posY * 16), 1, 1, player.position, player.width, player.height)) + { + npc.ai[1] = posX; + npc.ai[2] = posY; + npc.netUpdate = true; + break; + } + } + } + break; + case 2: //reelback for lunge + death legacy + npc.alpha += reelbackFade; + npc.velocity -= deceleration; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.velocity = Vector2.Zero; + dashStarted = false; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + state = nextState; + nextState = 0; + previousState = state; + } + else + { + state = 3; + } + if (player.velocity.X > 0) + rotationDirection = 1; + else if (player.velocity.X < 0) + rotationDirection = -1; + else + rotationDirection = player.direction; + } + break; + case 3: //rev lunge + npc.netUpdate = true; + if (npc.alpha > 0) + { + npc.alpha -= lungeFade; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + } + rotation += rotationIncrement * rotationDirection; + phase2timer = lungeDelay; + } + else + { + phase2timer--; + if (!dashStarted) + { + if (phase2timer <= 0) + { + phase2timer = lungeTime; + npc.velocity = player.Center - npc.Center; + npc.velocity.Normalize(); + npc.velocity *= teleportRadius / lungeTime; + dashStarted = true; + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + } + else + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + } + rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; + } + } + else + { + if (phase2timer <= 0) + { + state = 6; + phase2timer = 0; + deceleration = npc.velocity / decelerationTime; + } + } + } + break; + case 4: //enemy spawn arc (death mode) + if (npc.alpha > 0) + { + npc.alpha -= 5; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Center = player.Center; + npc.position.Y += teleportRadius; + } + npc.netUpdate = true; + } + else + { + if (!dashStarted) + { + dashStarted = true; + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + npc.velocity.X = 3.14159265f * teleportRadius / arcTime; + npc.velocity *= rotationDirection; + npc.netUpdate = true; + } + else + { + npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); + phase2timer++; + if (phase2timer == (int)arcTime / 6) + { + phase2timer = 0; + npc.ai[0]++; + if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height)) //draw line of sight + { + if (npc.ai[0] == 2 || npc.ai[0] == 4) + { + if ((Main.expertMode || CalamityWorld.bossRushActive) && NPC.CountNPCS(mod.NPCType("DarkHeart")) < 2) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DarkHeart")); + } + } + else if (NPC.CountNPCS(NPCID.EaterofSouls) < 2) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.EaterofSouls); + } + } + if (npc.ai[0] == 6) + { + npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); + SpawnStuff(); + state = 6; + npc.ai[0] = 0; + deceleration = npc.velocity / decelerationTime; + } + } + } + } + break; + case 5: //raindash (death mode) + if (npc.alpha > 0) + { + npc.alpha -= 5; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Center = player.Center; + npc.position.Y -= teleportRadius; + npc.position.X += teleportRadius * rotationDirection; + } + npc.netUpdate = true; + } + else + { + if (!dashStarted) + { + dashStarted = true; + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + npc.velocity.X = teleportRadius / arcTime * 3; + npc.velocity *= -rotationDirection; + npc.netUpdate = true; + } + else + { + phase2timer++; + if (phase2timer == (int)arcTime / 20) + { + phase2timer = 0; + npc.ai[0]++; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = Main.expertMode ? 14 : 18; + Projectile.NewProjectile(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), 0, 0, mod.ProjectileType("ShadeNimbusHostile"), damage, 0, Main.myPlayer, 11, 0); + } + if (npc.ai[0] == 10) + { + state = 6; + npc.ai[0] = 0; + deceleration = npc.velocity / decelerationTime; + } + } + } + } + break; + case 6: //deceleration + npc.velocity -= deceleration; + phase2timer++; + if (phase2timer == decelerationTime) + { + phase2timer = minimumDriftTime + Main.rand.Next(121); + state = 0; + npc.netUpdate = true; + } + break; + } + } - public override bool? CanHitNPC(NPC target) - { - if (npc.alpha > 0) - return false; - return null; - } + public override bool? CanHitNPC(NPC target) + { + if (npc.alpha > 0) + return false; + return null; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return npc.alpha <= 0; //no damage when not fully visible - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.alpha <= 0; //no damage when not fully visible + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (phase2timer < 0 && damage > 1) - { - npc.velocity *= -4f; - ReelBack(); - npc.netUpdate = true; - } - return true; - } + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (phase2timer < 0 && damage > 1) + { + npc.velocity *= -4f; + ReelBack(); + npc.netUpdate = true; + } + return true; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.9f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.9f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(15) && NPC.CountNPCS(mod.NPCType("HiveBlob2")) < 2) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveBlob2")); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore6"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 150; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(15) && NPC.CountNPCS(mod.NPCType("HiveBlob2")) < 2) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveBlob2")); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore6"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 150; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.HealingPotion; + } - public override void NPCLoot() - { + public override void NPCLoot() + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("HiveMindTrophy"), 10); @@ -679,7 +680,7 @@ namespace CalamityMod.NPCs.HiveMind // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Materials DropHelper.DropItemSpray(npc, mod.ItemType("TrueShadowScale"), 25, 30); DropHelper.DropItemSpray(npc, ItemID.DemoniteBar, 7, 10); @@ -698,7 +699,7 @@ namespace CalamityMod.NPCs.HiveMind // Vanity DropHelper.DropItemChance(npc, mod.ItemType("HiveMindMask"), 7); - } + } // If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore if (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) @@ -718,12 +719,12 @@ namespace CalamityMod.NPCs.HiveMind CalamityMod.UpdateServerBoolean(); } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } } diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 1e7714c2c2..e168e9314a 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -1,44 +1,44 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Leviathan { public class AquaticAberration : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Aberration"); - Main.npcFrameCount[npc.type] = 9; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Aberration"); + Main.npcFrameCount[npc.type] = 9; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 60; - npc.width = 70; - npc.height = 40; - npc.defense = 14; - npc.lifeMax = CalamityWorld.death ? 2200 : 1100; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 60; + npc.width = 70; + npc.height = 40; + npc.defense = 14; + npc.lifeMax = CalamityWorld.death ? 2200 : 1100; if (CalamityWorld.bossRushActive) { npc.lifeMax = 100000; } npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - aiType = -1; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("AquaticAberrationBanner"); - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + aiType = -1; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("AquaticAberrationBanner"); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -46,176 +46,176 @@ namespace CalamityMod.NPCs.Leviathan npc.frame.Y = frame * frameHeight; } - public override void AI() - { - if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(false); - npc.rotation = npc.velocity.ToRotation(); - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - if (npc.rotation < -1.57079637f) - { - npc.rotation += 3.14159274f; - } - if (npc.rotation > 1.57079637f) - { - npc.rotation -= 3.14159274f; - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = 60f; - float num1001 = 5f; - float scaleFactor4 = 0.8f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = 60f; - float num1006 = 0.333333343f; - float num1007 = 8f; - num1006 *= num1005; - int num1009 = (npc.ai[0] == 2f) ? 2 : 1; - int num1010 = (npc.ai[0] == 2f) ? 30 : 20; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 33, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (npc.ai[0] == 0f) - { - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = Main.player[npc.target].Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); - if (num1013 > num999 || !flag64) - { - npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - npc.ai[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (npc.ai[0] == 2f) - { - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - npc.ai[0] = 4f; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = Main.player[npc.target].Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; - } - } - else if (npc.ai[0] == 4f) - { - npc.ai[1] -= 3f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.95f; - } - } + public override void AI() + { + if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(false); + npc.rotation = npc.velocity.ToRotation(); + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + if (npc.rotation < -1.57079637f) + { + npc.rotation += 3.14159274f; + } + if (npc.rotation > 1.57079637f) + { + npc.rotation -= 3.14159274f; + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = 60f; + float num1001 = 5f; + float scaleFactor4 = 0.8f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = 60f; + float num1006 = 0.333333343f; + float num1007 = 8f; + num1006 *= num1005; + int num1009 = (npc.ai[0] == 2f) ? 2 : 1; + int num1010 = (npc.ai[0] == 2f) ? 30 : 20; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 33, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (npc.ai[0] == 0f) + { + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = Main.player[npc.target].Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); + if (num1013 > num999 || !flag64) + { + npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + npc.ai[0] = 1f; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (npc.ai[0] == 2f) + { + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + npc.ai[0] = 4f; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = Main.player[npc.target].Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; + } + } + else if (npc.ai[0] == 4f) + { + npc.ai[1] -= 3f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.95f; + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Wet, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Wet, 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Leviathan/LevScreenShaderData.cs b/NPCs/Leviathan/LevScreenShaderData.cs index 9a8bb7da45..1750c129d7 100644 --- a/NPCs/Leviathan/LevScreenShaderData.cs +++ b/NPCs/Leviathan/LevScreenShaderData.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Leviathan { - public class LevScreenShaderData : ScreenShaderData - { - private int LevIndex; + public class LevScreenShaderData : ScreenShaderData + { + private int LevIndex; - public LevScreenShaderData(string passName) - : base(passName) - { - } + public LevScreenShaderData(string passName) + : base(passName) + { + } - private void UpdateLIndex() - { - int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); - if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) - { - return; - } - LevIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == LevType) - { - LevIndex = i; - break; - } - } - } + private void UpdateLIndex() + { + int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); + if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) + { + return; + } + LevIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == LevType) + { + LevIndex = i; + break; + } + } + } - public override void Apply() - { - UpdateLIndex(); - if (LevIndex != -1) - { - UseTargetPosition(Main.npc[LevIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdateLIndex(); + if (LevIndex != -1) + { + UseTargetPosition(Main.npc[LevIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index 2e4dd0a768..9043aac52c 100644 --- a/NPCs/Leviathan/LevSky.cs +++ b/NPCs/Leviathan/LevSky.cs @@ -6,96 +6,96 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Leviathan { - public class LevSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int LevIndex = -1; + public class LevSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int LevIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdateLIndex()) - { - float x = 0f; - if (this.LevIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.LevIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } + private float GetIntensity() + { + if (this.UpdateLIndex()) + { + float x = 0f; + if (this.LevIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.LevIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdateLIndex() - { - int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); - if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) - { - return true; - } - LevIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == LevType) - { - LevIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return LevIndex != -1; - } + private bool UpdateLIndex() + { + int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); + if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) + { + return true; + } + LevIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == LevType) + { + LevIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return LevIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index e9f4c38a87..5e1ec9558e 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -1,610 +1,610 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Leviathan { - [AutoloadBossHead] - public class Leviathan : ModNPC - { - private bool altTextureSwap = false; + [AutoloadBossHead] + public class Leviathan : ModNPC + { + private bool altTextureSwap = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Leviathan"); - Main.npcFrameCount[npc.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Leviathan"); + Main.npcFrameCount[npc.type] = 3; + } - public override void SetDefaults() - { - npc.npcSlots = 20f; - npc.damage = 90; - npc.width = 850; - npc.height = 450; - npc.defense = 40; + public override void SetDefaults() + { + npc.npcSlots = 20f; + npc.damage = 90; + npc.width = 850; + npc.height = 450; + npc.defense = 40; npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = CalamityWorld.revenge ? 90700 : 69000; - if (CalamityWorld.death) - { - npc.lifeMax = 189750; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 15, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - npc.noTileCollide = true; - npc.noGravity = true; - npc.boss = true; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("LeviathanBag"); - } + if (CalamityWorld.death) + { + npc.lifeMax = 189750; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 15, 0, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + npc.noTileCollide = true; + npc.noGravity = true; + npc.boss = true; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("LeviathanBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(altTextureSwap); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(altTextureSwap); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - altTextureSwap = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + altTextureSwap = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - CalamityGlobalNPC.leviathan = npc.whoAmI; + public override void AI() + { + CalamityGlobalNPC.leviathan = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - bool sirenAlive = false; - if (CalamityGlobalNPC.siren != -1) - { - sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; - } + bool sirenAlive = false; + if (CalamityGlobalNPC.siren != -1) + { + sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; + } - int soundChoice = Main.rand.Next(3); - int soundChoiceRage = 92; - if (soundChoice == 0) - { - soundChoice = 38; - } - else if (soundChoice == 1) - { - soundChoice = 39; - } - else - { - soundChoice = 40; - } - if (Main.rand.NextBool(600)) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, - ((sirenAlive && !CalamityWorld.death && !CalamityWorld.bossRushActive) ? soundChoice : soundChoiceRage)); - } + int soundChoice = Main.rand.Next(3); + int soundChoiceRage = 92; + if (soundChoice == 0) + { + soundChoice = 38; + } + else if (soundChoice == 1) + { + soundChoice = 39; + } + else + { + soundChoice = 40; + } + if (Main.rand.NextBool(600)) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, + ((sirenAlive && !CalamityWorld.death && !CalamityWorld.bossRushActive) ? soundChoice : soundChoiceRage)); + } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + Player player = Main.player[npc.target]; - bool flag6 = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); - npc.dontTakeDamage = flag6 && !CalamityWorld.bossRushActive; + bool flag6 = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + npc.dontTakeDamage = flag6 && !CalamityWorld.bossRushActive; - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.velocity = new Vector2(0f, 10f); - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int x = 0; x < 200; x++) - { - if (Main.npc[x].type == mod.NPCType("Siren")) - { - Main.npc[x].active = false; - Main.npc[x].netUpdate = true; - } - } - npc.active = false; - npc.netUpdate = true; - } - return; - } - } - else - { - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - float num412 = sirenAlive ? 3.5f : 7f; - float num413 = sirenAlive ? 0.1f : 0.2f; - if (CalamityWorld.bossRushActive) - { - num412 *= 1.5f; - num413 *= 1.5f; - } + if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.velocity = new Vector2(0f, 10f); + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int x = 0; x < 200; x++) + { + if (Main.npc[x].type == mod.NPCType("Siren")) + { + Main.npc[x].active = false; + Main.npc[x].netUpdate = true; + } + } + npc.active = false; + npc.netUpdate = true; + } + return; + } + } + else + { + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + float num412 = sirenAlive ? 3.5f : 7f; + float num413 = sirenAlive ? 0.1f : 0.2f; + if (CalamityWorld.bossRushActive) + { + num412 *= 1.5f; + num413 *= 1.5f; + } - int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num414 = -1; - } + int num414 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num414 = -1; + } - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 800) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; + Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 800) - vector40.X; + float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num412 / num417; + num415 *= num417; + num416 *= num417; - if (npc.velocity.X < num415) - { - npc.velocity.X = npc.velocity.X + num413; - if (npc.velocity.X < 0f && num415 > 0f) - { - npc.velocity.X = npc.velocity.X + num413; - } - } - else if (npc.velocity.X > num415) - { - npc.velocity.X = npc.velocity.X - num413; - if (npc.velocity.X > 0f && num415 < 0f) - { - npc.velocity.X = npc.velocity.X - num413; - } - } - if (npc.velocity.Y < num416) - { - npc.velocity.Y = npc.velocity.Y + num413; - if (npc.velocity.Y < 0f && num416 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num413; - } - } - else if (npc.velocity.Y > num416) - { - npc.velocity.Y = npc.velocity.Y - num413; - if (npc.velocity.Y > 0f && num416 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num413; - } - } + if (npc.velocity.X < num415) + { + npc.velocity.X = npc.velocity.X + num413; + if (npc.velocity.X < 0f && num415 > 0f) + { + npc.velocity.X = npc.velocity.X + num413; + } + } + else if (npc.velocity.X > num415) + { + npc.velocity.X = npc.velocity.X - num413; + if (npc.velocity.X > 0f && num415 < 0f) + { + npc.velocity.X = npc.velocity.X - num413; + } + } + if (npc.velocity.Y < num416) + { + npc.velocity.Y = npc.velocity.Y + num413; + if (npc.velocity.Y < 0f && num416 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num413; + } + } + else if (npc.velocity.Y > num416) + { + npc.velocity.Y = npc.velocity.Y - num413; + if (npc.velocity.Y > 0f && num416 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num413; + } + } - npc.ai[1] += 1f; - if (npc.ai[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 120f : 240f)) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - else - { - if (!player.dead) - { - npc.ai[2] += 1f; - if (!sirenAlive) - npc.ai[2] += 2f; - } + npc.ai[1] += 1f; + if (npc.ai[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 120f : 240f)) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + else + { + if (!player.dead) + { + npc.ai[2] += 1f; + if (!sirenAlive) + npc.ai[2] += 2f; + } - if (npc.ai[2] >= 75f) - { - npc.ai[2] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + if (npc.ai[2] >= 75f) + { + npc.ai[2] = 0f; + vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num415 = player.position.X + (float)(player.width / 2) - vector40.X; + num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num418 = sirenAlive ? 13.5f : 16f; - int num419 = 40; - int num420 = mod.ProjectileType("LeviathanBomb"); - if (expertMode) - { - num418 = sirenAlive ? 14f : 17f; - num419 = 33; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num418 = 22f; - } - if (CalamityWorld.bossRushActive) - { - num418 *= 1.5f; - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num418 = sirenAlive ? 13.5f : 16f; + int num419 = 40; + int num420 = mod.ProjectileType("LeviathanBomb"); + if (expertMode) + { + num418 = sirenAlive ? 14f : 17f; + num419 = 33; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num418 = 22f; + } + if (CalamityWorld.bossRushActive) + { + num418 *= 1.5f; + } - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.ai[0] == 1f) - { - npc.TargetClosest(true); + num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num418 / num417; + num415 *= num417; + num416 *= num417; + vector40.X += num415 * 4f; + vector40.Y += num416 * 4f; + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += (revenge ? 2f : 1f); - if (!sirenAlive || CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.ai[1] += 2.5f; - } + npc.ai[1] += (revenge ? 2f : 1f); + if (!sirenAlive || CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.ai[1] += 2.5f; + } - bool flag103 = false; - int spawnLimit = sirenAlive ? 2 : 4; - int spawnLimit2 = sirenAlive ? 5 : 10; + bool flag103 = false; + int spawnLimit = sirenAlive ? 2 : 4; + int spawnLimit2 = sirenAlive ? 5 : 10; - if (npc.ai[1] > 80f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - if (flag103) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoice); - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("Parasea")) < spawnLimit2 && NPC.CountNPCS(mod.NPCType("AquaticAberration")) < spawnLimit) - { - int num1061; - int value = CalamityWorld.death ? 2 : 3; - if (CalamityWorld.bossRushActive) - value++; - if (Main.rand.Next(value) == 0) - { - num1061 = mod.NPCType("AquaticAberration"); - } - else - { - num1061 = mod.NPCType("Parasea"); - } - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, num1061, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.01f; - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.01f; - Main.npc[num1062].netUpdate = true; - } - } + if (npc.ai[1] > 80f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + if (flag103) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoice); + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("Parasea")) < spawnLimit2 && NPC.CountNPCS(mod.NPCType("AquaticAberration")) < spawnLimit) + { + int num1061; + int value = CalamityWorld.death ? 2 : 3; + if (CalamityWorld.bossRushActive) + value++; + if (Main.rand.Next(value) == 0) + { + num1061 = mod.NPCType("AquaticAberration"); + } + else + { + num1061 = mod.NPCType("Parasea"); + } + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, num1061, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.01f; + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.01f; + Main.npc[num1062].netUpdate = true; + } + } - if (num1060 > 600f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num1063 = sirenAlive ? 7f : 8f; - float num1064 = sirenAlive ? 0.05f : 0.065f; - if (CalamityWorld.bossRushActive) - { - num1063 *= 1.5f; - num1064 *= 1.5f; - } + if (num1060 > 600f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num1063 = sirenAlive ? 7f : 8f; + float num1064 = sirenAlive ? 0.05f : 0.065f; + if (CalamityWorld.bossRushActive) + { + num1063 *= 1.5f; + num1064 *= 1.5f; + } - vector120 = vector119; - num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - num1060 = num1063 / num1060; + vector120 = vector119; + num1058 = player.position.X + (float)(player.width / 2) - vector120.X; + num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) - { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - { - npc.velocity.X = npc.velocity.X + num1064; - } - } - else if (npc.velocity.X > num1058) - { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - { - npc.velocity.X = npc.velocity.X - num1064; - } - } - if (npc.velocity.Y < num1059) - { - npc.velocity.Y = npc.velocity.Y + num1064; - if (npc.velocity.Y < 0f && num1059 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1064; - } - } - else if (npc.velocity.Y > num1059) - { - npc.velocity.Y = npc.velocity.Y - num1064; - if (npc.velocity.Y > 0f && num1059 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1064; - } - } - } - else - { - npc.velocity *= 0.9f; - } + if (npc.velocity.X < num1058) + { + npc.velocity.X = npc.velocity.X + num1064; + if (npc.velocity.X < 0f && num1058 > 0f) + { + npc.velocity.X = npc.velocity.X + num1064; + } + } + else if (npc.velocity.X > num1058) + { + npc.velocity.X = npc.velocity.X - num1064; + if (npc.velocity.X > 0f && num1058 < 0f) + { + npc.velocity.X = npc.velocity.X - num1064; + } + } + if (npc.velocity.Y < num1059) + { + npc.velocity.Y = npc.velocity.Y + num1064; + if (npc.velocity.Y < 0f && num1059 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1064; + } + } + else if (npc.velocity.Y > num1059) + { + npc.velocity.Y = npc.velocity.Y - num1064; + if (npc.velocity.Y > 0f && num1059 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1064; + } + } + } + else + { + npc.velocity *= 0.9f; + } - npc.spriteDirection = npc.direction; + npc.spriteDirection = npc.direction; - if (npc.ai[2] > 3f) - { - npc.ai[0] = ((double)npc.life < (double)npc.lifeMax * 0.5 ? 2f : 0f); - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; - if (npc.ai[1] > 1f || distFromPlayer.Length() > 2400f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] % 2f == 0f) - { - int num24 = 7; - for (int j = 0; j < num24; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; - } + if (npc.ai[2] > 3f) + { + npc.ai[0] = ((double)npc.life < (double)npc.lifeMax * 0.5 ? 2f : 0f); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; + if (npc.ai[1] > 1f || distFromPlayer.Length() > 2400f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] % 2f == 0f) + { + int num24 = 7; + for (int j = 0; j < num24; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity /= 4f; + Main.dust[num25].velocity -= npc.velocity; + } - npc.TargetClosest(true); + npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) - { - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num1044 = revenge ? 20f : 18f; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) - { - num1044 += 2f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num1044 += 2f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1044 += 4f; - } - if (CalamityWorld.bossRushActive) - { - num1044 *= 1.25f; - } + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) + { + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num1044 = revenge ? 20f : 18f; + if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + { + num1044 += 2f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num1044 += 2f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1044 += 4f; + } + if (CalamityWorld.bossRushActive) + { + num1044 *= 1.25f; + } - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.spriteDirection = npc.direction; - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage); - return; - } + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + npc.spriteDirection = npc.direction; + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage); + return; + } - float num1048 = revenge ? 7.5f : 6.5f; - float num1049 = revenge ? 0.12f : 0.11f; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) - { - num1048 += 2f; - num1049 += 0.05f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num1048 += 2f; - num1049 += 0.1f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1048 += 3f; - num1049 += 0.2f; - } - if (CalamityWorld.bossRushActive) - { - num1048 *= 1.25f; - num1049 *= 1.25f; - } + float num1048 = revenge ? 7.5f : 6.5f; + float num1049 = revenge ? 0.12f : 0.11f; + if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + { + num1048 += 2f; + num1049 += 0.05f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num1048 += 2f; + num1049 += 0.1f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1048 += 3f; + num1049 += 0.2f; + } + if (CalamityWorld.bossRushActive) + { + num1048 *= 1.25f; + num1049 *= 1.25f; + } - if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) - { - npc.velocity.Y = npc.velocity.Y + num1049; - } - else - { - npc.velocity.Y = npc.velocity.Y - num1049; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -num1048; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = num1048; - } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.8f; - } - if (npc.velocity.X < -16f) - { - npc.velocity.X = -16f; - } - if (npc.velocity.X > 16f) - { - npc.velocity.X = 16f; - } - npc.spriteDirection = npc.direction; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } + if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) + { + npc.velocity.Y = npc.velocity.Y + num1049; + } + else + { + npc.velocity.Y = npc.velocity.Y - num1049; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -num1048; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = num1048; + } + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + { + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + } + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + { + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.8f; + } + if (npc.velocity.X < -16f) + { + npc.velocity.X = -16f; + } + if (npc.velocity.X > 16f) + { + npc.velocity.X = 16f; + } + npc.spriteDirection = npc.direction; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } - npc.spriteDirection = npc.direction; + npc.spriteDirection = npc.direction; - int num1050 = sirenAlive ? 1100 : 900; - int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - num1051 = -1; - } - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - { - npc.ai[2] = 1f; - } - if (npc.ai[2] != 1f) - { - return; - } + int num1050 = sirenAlive ? 1100 : 900; + int num1051 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + num1051 = -1; + } + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + { + npc.ai[2] = 1f; + } + if (npc.ai[2] != 1f) + { + return; + } - npc.TargetClosest(true); + npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.velocity *= 0.9f; - float num1052 = revenge ? 0.11f : 0.1f; - if (npc.life < npc.lifeMax / 4 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - } - } + npc.spriteDirection = npc.direction; + npc.velocity *= 0.9f; + float num1052 = revenge ? 0.11f : 0.1f; + if (npc.life < npc.lifeMax / 4 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib3"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib1"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib3"), 1f); + } + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } // The Leviathan runs the same loot code as Anahita, but only if she dies last. public override void NPCLoot() @@ -658,67 +658,67 @@ namespace CalamityMod.NPCs.Leviathan CalamityMod.UpdateServerBoolean(); } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 240, true); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Wet, 240, true); + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - Texture2D texture2 = mod.GetTexture("NPCs/Leviathan/LeviathanTexTwo"); - Texture2D texture3 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexOne"); - Texture2D texture4 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexTwo"); - if (npc.ai[0] == 1f) - { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor, true); - } - } - else - { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor, true); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + Texture2D texture2 = mod.GetTexture("NPCs/Leviathan/LeviathanTexTwo"); + Texture2D texture3 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexOne"); + Texture2D texture4 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexTwo"); + if (npc.ai[0] == 1f) + { + if (!altTextureSwap) + { + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor, true); + } + } + else + { + if (!altTextureSwap) + { + CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor, true); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor, true); + } + } + return false; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - altTextureSwap = !altTextureSwap; - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + altTextureSwap = !altTextureSwap; + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index eb7e0a052e..3802e05636 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -1,40 +1,38 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.Leviathan { public class LeviathanStart : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("???"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("???"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 70; //324 - npc.height = 70; //216 - npc.defense = 0; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.rarity = 2; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 70; //324 + npc.height = 70; //216 + npc.defense = 0; + npc.lifeMax = 3000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.rarity = 2; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SirenLure"); - } + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.1f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -42,46 +40,46 @@ namespace CalamityMod.NPCs.Leviathan npc.frame.Y = frame * frameHeight; } - public override void AI() - { - npc.TargetClosest(true); - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.55f, 0.25f, 0f); - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && Main.npc[num569].boss) - { - npc.active = false; - } - } - } + public override void AI() + { + npc.TargetClosest(true); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.55f, 0.25f, 0f); + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && Main.npc[num569].boss) + { + npc.active = false; + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || NPC.AnyNPCs(NPCID.DukeFishron) || NPC.AnyNPCs(mod.NPCType("LeviathanStart")) || NPC.AnyNPCs(mod.NPCType("Siren")) || NPC.AnyNPCs(mod.NPCType("Leviathan")) || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } + { + return 0f; + } if (!Main.hardMode) { return SpawnCondition.OceanMonster.Chance * 0.025f; } if (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas) - { - return SpawnCondition.OceanMonster.Chance * 0.1f; - } - return SpawnCondition.OceanMonster.Chance * 0.4f; - } + { + return SpawnCondition.OceanMonster.Chance * 0.1f; + } + return SpawnCondition.OceanMonster.Chance * 0.4f; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 3000; - npc.damage = 0; - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 3000; + npc.damage = 0; + } public override void NPCLoot() { @@ -92,25 +90,25 @@ namespace CalamityMod.NPCs.Leviathan } public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - else - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("Siren"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - } + { + if (npc.life > 0) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + else + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("Siren"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + } } diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index 0e0e9df0e8..92ee15623b 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.cs @@ -1,70 +1,70 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Leviathan { public class Parasea : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Parasea"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Parasea"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 50; - npc.width = 90; - npc.height = 20; - npc.defense = 8; - npc.lifeMax = 650; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.damage = 50; + npc.width = 90; + npc.height = 20; + npc.defense = 8; + npc.lifeMax = 650; if (CalamityWorld.bossRushActive) { npc.lifeMax = 50000; } npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("ParaseaBanner"); - } + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("ParaseaBanner"); + } public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); - Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - float num1258 = Main.player[npc.target].Center.X - vector145.X; - float num1259 = Main.player[npc.target].Center.Y - vector145.Y; - float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); - float num1261 = revenge ? 16f : 13f; - if (CalamityWorld.bossRushActive) - num1261 = 24f; + { + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); + Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); + float num1258 = Main.player[npc.target].Center.X - vector145.X; + float num1259 = Main.player[npc.target].Center.Y - vector145.Y; + float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); + float num1261 = revenge ? 16f : 13f; + if (CalamityWorld.bossRushActive) + num1261 = 24f; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; - npc.rotation = (float)Math.Atan2((double)num1259, (double)num1258) + 3.14f; - } + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; + npc.rotation = (float)Math.Atan2((double)num1259, (double)num1258) + 3.14f; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -72,24 +72,24 @@ namespace CalamityMod.NPCs.Leviathan npc.frame.Y = frame * frameHeight; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Wet, 60, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Wet, 60, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index a67fd6b176..5f50beb132 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -1,840 +1,846 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Leviathan { - [AutoloadBossHead] - public class Siren : ModNPC - { - private bool spawnedLevi = false; - private bool secondClone = false; - private bool forceChargeFrames = false; - private int frameUsed = 0; + [AutoloadBossHead] + public class Siren : ModNPC + { + private bool spawnedLevi = false; + private bool secondClone = false; + private bool forceChargeFrames = false; + private int frameUsed = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Siren"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Siren"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 16f; - npc.width = 100; - npc.height = 100; - npc.defense = 20; + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 16f; + npc.width = 100; + npc.height = 100; + npc.defense = 20; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = CalamityWorld.revenge ? 41600 : 27400; - if (CalamityWorld.death) - { - npc.lifeMax = 58650; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2800000 : 2600000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.boss = true; - npc.value = Item.buyPrice(0, 15, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("LeviathanBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawnedLevi); - writer.Write(secondClone); - writer.Write(forceChargeFrames); - writer.Write(npc.localAI[0]); - writer.Write(frameUsed); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - spawnedLevi = reader.ReadBoolean(); - secondClone = reader.ReadBoolean(); - forceChargeFrames = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - frameUsed = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - // whoAmI variable - CalamityGlobalNPC.siren = npc.whoAmI; - - // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); - - // Variables - Player player = Main.player[npc.target]; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); - bool isNotOcean = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.66f; - bool phase3 = lifeRatio < 0.33f; - - // Check for Leviathan - bool leviAlive = false; - if (CalamityGlobalNPC.leviathan != -1) - leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active; - - // Spawn Leviathan and Clones, change music - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (phase2 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (!spawnedLevi) - { - if (revenge) - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); - - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - else - music = MusicID.Boss3; - - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Leviathan")); - spawnedLevi = true; - } - } - - // Spawn Clone - if (phase3 && revenge) - { - if (!secondClone) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); - secondClone = true; - } - } - } - - // Ice Shield - if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("SirenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - npc.ai[3] = (float)(num6 + 1); - npc.localAI[1] = -1f; - npc.netUpdate = true; - Main.npc[num6].ai[0] = (float)npc.whoAmI; - Main.npc[num6].netUpdate = true; - } - - int num7 = (int)npc.ai[3] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("SirenIce")) - npc.dontTakeDamage = true; - else - { - npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; - npc.ai[3] = 0f; - - if (npc.localAI[1] == -1f) - npc.localAI[1] = revenge ? 600f : 1200f; - if (npc.localAI[1] > 0f) - npc.localAI[1] -= 1f; - } - - // Alpha - if (isNotOcean) - { - npc.alpha += 3; - if (npc.alpha >= 150) - npc.alpha = 150; - } - else - { - npc.alpha -= 5; - if (npc.alpha <= 0) - npc.alpha = 0; - } - - // Play sound - if (Main.rand.NextBool(300)) - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); - - // Time left - if (npc.timeLeft < 3000) - npc.timeLeft = 3000; - - // Rotation when charging - if (npc.ai[0] > 2f) - ChargeRotation(player, vector); - - // Target - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - npc.TargetClosest(true); - - // Phase switch - else if (npc.ai[0] == -1f) - { - int random = phase2 ? 3 : 2; - int num871 = Main.rand.Next(random); - - if (num871 == 0) - num871 = phase3 ? 3 : 0; - else if (num871 == 1) - num871 = 2; - else - num871 = 3; - - npc.ai[0] = (float)num871; - - if (npc.ai[0] != 3f) - { - forceChargeFrames = false; - float playerLocation = vector.X - player.Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - } - else - ChargeRotation(player, vector); - - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Get in position for bubble spawn - else if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - npc.rotation = npc.velocity.X * 0.02f; - npc.spriteDirection = npc.direction; - - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = player.position.X + (float)(player.width / 2) - vector118.X; - float num1056 = player.position.Y + (float)(player.height / 2) - 200f - vector118.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); - - if (num1057 < 600f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return; - } - - if (npc.position.Y > player.position.Y - 350f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - } - else if (npc.position.Y < player.position.Y - 450f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - } - - // Bubble spawn - else if (npc.ai[0] == 1f) - { - npc.rotation = npc.velocity.X * 0.02f; - npc.TargetClosest(true); - - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - float num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - - npc.ai[1] += 1f; - if (phase2 || CalamityWorld.bossRushActive) - npc.ai[1] += 0.25f; - if (phase3 || CalamityWorld.bossRushActive) - npc.ai[1] += 0.25f; - - bool flag103 = false; - if (npc.ai[1] > 20f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - - if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 85); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num1061 = 371; - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y - 30, num1061, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); - Main.npc[num1062].localAI[0] = 60f; - Main.npc[num1062].netUpdate = true; - } - } - - if (num1060 > 600f) - { - if (npc.position.Y > player.position.Y - 350f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - } - else if (npc.position.Y < player.position.Y - 450f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - } - else - npc.velocity *= 0.9f; - - npc.spriteDirection = npc.direction; - - if (npc.ai[2] > 4f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Float around and fire projectiles - else if (npc.ai[0] == 2f) - { - npc.rotation = npc.velocity.X * 0.02f; - Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); - - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - if (npc.ai[1] % 10f == 9f) - flag104 = true; - } - else - { - if (((phase3 || CalamityWorld.death) && !leviAlive) || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 20f == 19f) - flag104 = true; - } - else if (phase2) - { - if (npc.ai[1] % 25f == 24f) - flag104 = true; - } - else if (npc.ai[1] % 30f == 29f) - flag104 = true; - } - - if (flag104 && (npc.position.Y + (float)npc.height < player.position.Y || (!leviAlive && phase2)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num1070 = revenge ? 15f : 13f; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num1070 = 24f; - else if (isNotOcean || (!leviAlive && phase2) || CalamityWorld.death || CalamityWorld.bossRushActive) - num1070 = revenge ? 17f : 16f; - else - { - if (phase3) - num1070 += 2f; - } - - float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - - int num1074 = expertMode ? 26 : 32; - int num1075 = mod.ProjectileType("WaterSpear"); - switch (Main.rand.Next(6)) - { - case 0: num1075 = mod.ProjectileType("SirenSong"); break; - case 1: num1075 = mod.ProjectileType("FrostMist"); break; - case 2: - case 3: - case 4: - case 5: num1075 = mod.ProjectileType("WaterSpear"); break; - } - if (isNotOcean) - num1074 *= 2; - - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); - } - } - - if (npc.position.Y > player.position.Y - 300f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - } - else if (npc.position.Y < player.position.Y - 500f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - - float playerLocation = vector.X - player.Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - - if (npc.ai[1] >= 300f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - - // Set up charge - else if (npc.ai[0] == 3f) - { - ChargeLocation(player, vector, leviAlive, expertMode); - - npc.ai[1] += 1f; - - if (npc.ai[1] >= (expertMode ? 40f : 60f)) - { - forceChargeFrames = true; - npc.ai[0] = (npc.ai[2] >= (leviAlive ? 2f : 3f) ? -1f : 4f); - npc.ai[1] = 0f; - npc.localAI[0] = 0f; - - // Velocity and rotation - float chargeVelocity = leviAlive ? 16f : 21f; - if (CalamityWorld.bossRushActive) - chargeVelocity = 26f; - - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - - // Direction - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) - { - npc.direction = num22; - - if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - } - } - - // Charge - else if (npc.ai[0] == 4f) - { - // Spawn dust - int num24 = 7; - for (int j = 0; j < num24; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.netUpdate = true; - } - } - - // Despawn - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.localAI[3] < 120f) - npc.localAI[3] += 1f; - - if (npc.localAI[3] > 60f) - { - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.25f; - - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int x = 0; x < 200; x++) - { - if (Main.npc[x].type == mod.NPCType("Leviathan")) - { - Main.npc[x].active = false; - Main.npc[x].netUpdate = true; - } - } - - npc.active = false; - npc.netUpdate = true; - } - } - return; - } - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - } - - // Rotation when charging - private void ChargeRotation(Player player, Vector2 vector) - { - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); - if (npc.spriteDirection == 1) - num17 += 3.14159274f; - if (num17 < 0f) - num17 += 6.28318548f; - if (num17 > 6.28318548f) - num17 -= 6.28318548f; - - float num18 = 0.04f; - if (npc.ai[0] == 4f) - num18 = 0f; - - if (npc.rotation < num17) - { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) - npc.rotation -= num18; - else - npc.rotation += num18; - } - if (npc.rotation > num17) - { - if ((double)(npc.rotation - num17) > 3.1415926535897931) - npc.rotation += num18; - else - npc.rotation -= num18; - } - - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - if (npc.rotation < 0f) - npc.rotation += 6.28318548f; - if (npc.rotation > 6.28318548f) - npc.rotation -= 6.28318548f; - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - } - - // Move to charge location - private void ChargeLocation(Player player, Vector2 vector, bool leviAlive, bool expertMode) - { - float distance = leviAlive ? 400f : 350f; - - // Velocity - if (npc.localAI[0] == 0f) - npc.localAI[0] = (float)((int)distance * Math.Sign((vector - player.Center).X)); - - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 9f; - float acceleration = expertMode ? 0.75f : 0.5f; - if (CalamityWorld.bossRushActive) - acceleration = 1f; - - if (npc.velocity.X < vector3.X) - { - npc.velocity.X = npc.velocity.X + acceleration; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X = npc.velocity.X + acceleration; - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X = npc.velocity.X - acceleration; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X = npc.velocity.X - acceleration; - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y = npc.velocity.Y + acceleration; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y = npc.velocity.Y + acceleration; - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y = npc.velocity.Y - acceleration; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y = npc.velocity.Y - acceleration; - } - - // Rotation - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) - { - if (npc.ai[1] == 0f && num22 != npc.direction) - npc.rotation += 3.14159274f; - - npc.direction = num22; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; - - npc.spriteDirection = -npc.direction; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren5"), 1f); - - for (int k = 0; k < 50; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) // 2 total states (ice shield or no ice shield) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - if (npc.dontTakeDamage) - { - switch (frameUsed) - { - case 0: - texture = mod.GetTexture("NPCs/Leviathan/SirenAlt"); - break; - case 1: - texture = mod.GetTexture("NPCs/Leviathan/SirenAltSinging"); - break; - case 2: - texture = mod.GetTexture("NPCs/Leviathan/SirenAltStabbing"); - break; - } - } - else - { - switch (frameUsed) - { - case 0: - texture = Main.npcTexture[npc.type]; - break; - case 1: - texture = mod.GetTexture("NPCs/Leviathan/SirenSinging"); - break; - case 2: - texture = mod.GetTexture("NPCs/Leviathan/SirenStabbing"); - break; - } - } - - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - if (npc.ai[0] > 2f || forceChargeFrames) - { - int width = 106; - Vector2 vector = new Vector2((float)(width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); - Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, texture.Height / Main.npcFrameCount[npc.type]); - frame.Y = 146 * (int)(npc.frameCounter / 12.0); // 1 to 6 - if (frame.Y >= 146 * 6 || npc.ai[0] == 4f) - frame.Y = 0; - - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + vector.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)texture.Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(drawColor), - npc.rotation, - vector, - npc.scale, - spriteEffects, - 0f); - return false; - } - - Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame2), - npc.GetAlpha(drawColor), - npc.rotation, - vector11, - npc.scale, - spriteEffects, - 0f); - return false; - } - - public override void FindFrame(int frameHeight) // 6 total frames, 3 total texture types - { - if (forceChargeFrames) - frameUsed = 2; - else if (npc.ai[0] == 2f) - frameUsed = 0; - else if (npc.ai[0] <= 1f) - frameUsed = 1; - else - frameUsed = 2; - - npc.frameCounter += 1.0; - if (npc.ai[0] == 3f || forceChargeFrames) - { - if (npc.frameCounter > 72.0) - npc.frameCounter = 0.0; - } - else if (npc.ai[0] != 4f) - { - int frameY = 146; - if (npc.frameCounter > 72.0) - npc.frameCounter = 0.0; - - npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); - if (npc.frame.Y >= frameHeight * 6) - npc.frame.Y = 0; - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } + npc.lifeMax = CalamityWorld.revenge ? 41600 : 27400; + if (CalamityWorld.death) + { + npc.lifeMax = 58650; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2800000 : 2600000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.boss = true; + npc.value = Item.buyPrice(0, 15, 0, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("LeviathanBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawnedLevi); + writer.Write(secondClone); + writer.Write(forceChargeFrames); + writer.Write(npc.localAI[0]); + writer.Write(frameUsed); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + spawnedLevi = reader.ReadBoolean(); + secondClone = reader.ReadBoolean(); + forceChargeFrames = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + frameUsed = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + // whoAmI variable + CalamityGlobalNPC.siren = npc.whoAmI; + + // Light + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); + + // Variables + Player player = Main.player[npc.target]; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); + bool isNotOcean = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.66f; + bool phase3 = lifeRatio < 0.33f; + + // Check for Leviathan + bool leviAlive = false; + if (CalamityGlobalNPC.leviathan != -1) + leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active; + + // Spawn Leviathan and Clones, change music + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase2 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (!spawnedLevi) + { + if (revenge) + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); + + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); + else + music = MusicID.Boss3; + + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Leviathan")); + spawnedLevi = true; + } + } + + // Spawn Clone + if (phase3 && revenge) + { + if (!secondClone) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); + secondClone = true; + } + } + } + + // Ice Shield + if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("SirenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + npc.ai[3] = (float)(num6 + 1); + npc.localAI[1] = -1f; + npc.netUpdate = true; + Main.npc[num6].ai[0] = (float)npc.whoAmI; + Main.npc[num6].netUpdate = true; + } + + int num7 = (int)npc.ai[3] - 1; + if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("SirenIce")) + npc.dontTakeDamage = true; + else + { + npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; + npc.ai[3] = 0f; + + if (npc.localAI[1] == -1f) + npc.localAI[1] = revenge ? 600f : 1200f; + if (npc.localAI[1] > 0f) + npc.localAI[1] -= 1f; + } + + // Alpha + if (isNotOcean) + { + npc.alpha += 3; + if (npc.alpha >= 150) + npc.alpha = 150; + } + else + { + npc.alpha -= 5; + if (npc.alpha <= 0) + npc.alpha = 0; + } + + // Play sound + if (Main.rand.NextBool(300)) + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); + + // Time left + if (npc.timeLeft < 3000) + npc.timeLeft = 3000; + + // Rotation when charging + if (npc.ai[0] > 2f) + ChargeRotation(player, vector); + + // Target + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + npc.TargetClosest(true); + + // Phase switch + else if (npc.ai[0] == -1f) + { + int random = phase2 ? 3 : 2; + int num871 = Main.rand.Next(random); + + if (num871 == 0) + num871 = phase3 ? 3 : 0; + else if (num871 == 1) + num871 = 2; + else + num871 = 3; + + npc.ai[0] = (float)num871; + + if (npc.ai[0] != 3f) + { + forceChargeFrames = false; + float playerLocation = vector.X - player.Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + } + else + ChargeRotation(player, vector); + + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Get in position for bubble spawn + else if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + npc.rotation = npc.velocity.X * 0.02f; + npc.spriteDirection = npc.direction; + + Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1055 = player.position.X + (float)(player.width / 2) - vector118.X; + float num1056 = player.position.Y + (float)(player.height / 2) - 200f - vector118.Y; + float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + + if (num1057 < 600f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return; + } + + if (npc.position.Y > player.position.Y - 350f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + } + else if (npc.position.Y < player.position.Y - 450f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + } + + // Bubble spawn + else if (npc.ai[0] == 1f) + { + npc.rotation = npc.velocity.X * 0.02f; + npc.TargetClosest(true); + + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = player.position.X + (float)(player.width / 2) - vector120.X; + float num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + + npc.ai[1] += 1f; + if (phase2 || CalamityWorld.bossRushActive) + npc.ai[1] += 0.25f; + if (phase3 || CalamityWorld.bossRushActive) + npc.ai[1] += 0.25f; + + bool flag103 = false; + if (npc.ai[1] > 20f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + + if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 85); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num1061 = 371; + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y - 30, num1061, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); + Main.npc[num1062].localAI[0] = 60f; + Main.npc[num1062].netUpdate = true; + } + } + + if (num1060 > 600f) + { + if (npc.position.Y > player.position.Y - 350f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + } + else if (npc.position.Y < player.position.Y - 450f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + } + else + npc.velocity *= 0.9f; + + npc.spriteDirection = npc.direction; + + if (npc.ai[2] > 4f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Float around and fire projectiles + else if (npc.ai[0] == 2f) + { + npc.rotation = npc.velocity.X * 0.02f; + Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); + + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + if (npc.ai[1] % 10f == 9f) + flag104 = true; + } + else + { + if (((phase3 || CalamityWorld.death) && !leviAlive) || CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 20f == 19f) + flag104 = true; + } + else if (phase2) + { + if (npc.ai[1] % 25f == 24f) + flag104 = true; + } + else if (npc.ai[1] % 30f == 29f) + flag104 = true; + } + + if (flag104 && (npc.position.Y + (float)npc.height < player.position.Y || (!leviAlive && phase2)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num1070 = revenge ? 15f : 13f; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num1070 = 24f; + else if (isNotOcean || (!leviAlive && phase2) || CalamityWorld.death || CalamityWorld.bossRushActive) + num1070 = revenge ? 17f : 16f; + else + { + if (phase3) + num1070 += 2f; + } + + float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X; + float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y; + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + + int num1074 = expertMode ? 26 : 32; + int num1075 = mod.ProjectileType("WaterSpear"); + switch (Main.rand.Next(6)) + { + case 0: + num1075 = mod.ProjectileType("SirenSong"); + break; + case 1: + num1075 = mod.ProjectileType("FrostMist"); + break; + case 2: + case 3: + case 4: + case 5: + num1075 = mod.ProjectileType("WaterSpear"); + break; + } + if (isNotOcean) + num1074 *= 2; + + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); + } + } + + if (npc.position.Y > player.position.Y - 300f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + } + else if (npc.position.Y < player.position.Y - 500f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + + float playerLocation = vector.X - player.Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + + if (npc.ai[1] >= 300f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + + // Set up charge + else if (npc.ai[0] == 3f) + { + ChargeLocation(player, vector, leviAlive, expertMode); + + npc.ai[1] += 1f; + + if (npc.ai[1] >= (expertMode ? 40f : 60f)) + { + forceChargeFrames = true; + npc.ai[0] = (npc.ai[2] >= (leviAlive ? 2f : 3f) ? -1f : 4f); + npc.ai[1] = 0f; + npc.localAI[0] = 0f; + + // Velocity and rotation + float chargeVelocity = leviAlive ? 16f : 21f; + if (CalamityWorld.bossRushActive) + chargeVelocity = 26f; + + npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + + // Direction + int num22 = Math.Sign(player.Center.X - vector.X); + if (num22 != 0) + { + npc.direction = num22; + + if (npc.spriteDirection == 1) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + } + } + + // Charge + else if (npc.ai[0] == 4f) + { + // Spawn dust + int num24 = 7; + for (int j = 0; j < num24; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity /= 4f; + Main.dust[num25].velocity -= npc.velocity; + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 30f) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] += 1f; + npc.netUpdate = true; + } + } + + // Despawn + if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + if (npc.localAI[3] < 120f) + npc.localAI[3] += 1f; + + if (npc.localAI[3] > 60f) + { + npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.25f; + + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int x = 0; x < 200; x++) + { + if (Main.npc[x].type == mod.NPCType("Leviathan")) + { + Main.npc[x].active = false; + Main.npc[x].netUpdate = true; + } + } + + npc.active = false; + npc.netUpdate = true; + } + } + return; + } + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + } + + // Rotation when charging + private void ChargeRotation(Player player, Vector2 vector) + { + float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + if (npc.spriteDirection == 1) + num17 += 3.14159274f; + if (num17 < 0f) + num17 += 6.28318548f; + if (num17 > 6.28318548f) + num17 -= 6.28318548f; + + float num18 = 0.04f; + if (npc.ai[0] == 4f) + num18 = 0f; + + if (npc.rotation < num17) + { + if ((double)(num17 - npc.rotation) > 3.1415926535897931) + npc.rotation -= num18; + else + npc.rotation += num18; + } + if (npc.rotation > num17) + { + if ((double)(npc.rotation - num17) > 3.1415926535897931) + npc.rotation += num18; + else + npc.rotation -= num18; + } + + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + npc.rotation = num17; + if (npc.rotation < 0f) + npc.rotation += 6.28318548f; + if (npc.rotation > 6.28318548f) + npc.rotation -= 6.28318548f; + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + npc.rotation = num17; + } + + // Move to charge location + private void ChargeLocation(Player player, Vector2 vector, bool leviAlive, bool expertMode) + { + float distance = leviAlive ? 400f : 350f; + + // Velocity + if (npc.localAI[0] == 0f) + npc.localAI[0] = (float)((int)distance * Math.Sign((vector - player.Center).X)); + + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 9f; + float acceleration = expertMode ? 0.75f : 0.5f; + if (CalamityWorld.bossRushActive) + acceleration = 1f; + + if (npc.velocity.X < vector3.X) + { + npc.velocity.X = npc.velocity.X + acceleration; + if (npc.velocity.X < 0f && vector3.X > 0f) + npc.velocity.X = npc.velocity.X + acceleration; + } + else if (npc.velocity.X > vector3.X) + { + npc.velocity.X = npc.velocity.X - acceleration; + if (npc.velocity.X > 0f && vector3.X < 0f) + npc.velocity.X = npc.velocity.X - acceleration; + } + if (npc.velocity.Y < vector3.Y) + { + npc.velocity.Y = npc.velocity.Y + acceleration; + if (npc.velocity.Y < 0f && vector3.Y > 0f) + npc.velocity.Y = npc.velocity.Y + acceleration; + } + else if (npc.velocity.Y > vector3.Y) + { + npc.velocity.Y = npc.velocity.Y - acceleration; + if (npc.velocity.Y > 0f && vector3.Y < 0f) + npc.velocity.Y = npc.velocity.Y - acceleration; + } + + // Rotation + int num22 = Math.Sign(player.Center.X - vector.X); + if (num22 != 0) + { + if (npc.ai[1] == 0f && num22 != npc.direction) + npc.rotation += 3.14159274f; + + npc.direction = num22; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += 3.14159274f; + + npc.spriteDirection = -npc.direction; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren5"), 1f); + + for (int k = 0; k < 50; k++) + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) // 2 total states (ice shield or no ice shield) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.dontTakeDamage) + { + switch (frameUsed) + { + case 0: + texture = mod.GetTexture("NPCs/Leviathan/SirenAlt"); + break; + case 1: + texture = mod.GetTexture("NPCs/Leviathan/SirenAltSinging"); + break; + case 2: + texture = mod.GetTexture("NPCs/Leviathan/SirenAltStabbing"); + break; + } + } + else + { + switch (frameUsed) + { + case 0: + texture = Main.npcTexture[npc.type]; + break; + case 1: + texture = mod.GetTexture("NPCs/Leviathan/SirenSinging"); + break; + case 2: + texture = mod.GetTexture("NPCs/Leviathan/SirenStabbing"); + break; + } + } + + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + if (npc.ai[0] > 2f || forceChargeFrames) + { + int width = 106; + Vector2 vector = new Vector2((float)(width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); + Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, texture.Height / Main.npcFrameCount[npc.type]); + frame.Y = 146 * (int)(npc.frameCounter / 12.0); // 1 to 6 + if (frame.Y >= 146 * 6 || npc.ai[0] == 4f) + frame.Y = 0; + + Main.spriteBatch.Draw(texture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + vector.X * npc.scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)texture.Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector.Y * npc.scale + 0f + npc.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(frame), + npc.GetAlpha(drawColor), + npc.rotation, + vector, + npc.scale, + spriteEffects, + 0f); + return false; + } + + Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Main.spriteBatch.Draw(texture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + 0f + npc.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(frame2), + npc.GetAlpha(drawColor), + npc.rotation, + vector11, + npc.scale, + spriteEffects, + 0f); + return false; + } + + public override void FindFrame(int frameHeight) // 6 total frames, 3 total texture types + { + if (forceChargeFrames) + frameUsed = 2; + else if (npc.ai[0] == 2f) + frameUsed = 0; + else if (npc.ai[0] <= 1f) + frameUsed = 1; + else + frameUsed = 2; + + npc.frameCounter += 1.0; + if (npc.ai[0] == 3f || forceChargeFrames) + { + if (npc.frameCounter > 72.0) + npc.frameCounter = 0.0; + } + else if (npc.ai[0] != 4f) + { + int frameY = 146; + if (npc.frameCounter > 72.0) + npc.frameCounter = 0.0; + + npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); + if (npc.frame.Y >= frameHeight * 6) + npc.frame.Y = 0; + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } // Anahita runs the same loot code as the Leviathan, but only if she dies last. public override void NPCLoot() - { + { if (!NPC.AnyNPCs(mod.NPCType("Leviathan"))) Leviathan.DropSirenLeviLoot(npc); - } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 120, true); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Wet, 120, true); + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/Leviathan/SirenClone.cs b/NPCs/Leviathan/SirenClone.cs index 0ccf11356d..fb6bc122e0 100644 --- a/NPCs/Leviathan/SirenClone.cs +++ b/NPCs/Leviathan/SirenClone.cs @@ -1,37 +1,37 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Leviathan { public class SirenClone : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren Clone"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren Clone"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 70; - npc.height = 120; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit1; - npc.alpha = 255; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 70; + npc.height = 120; + npc.lifeMax = 3000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit1; + npc.alpha = 255; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.1f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -39,65 +39,65 @@ namespace CalamityMod.NPCs.Leviathan npc.frame.Y = frame * frameHeight; } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); - if (CalamityGlobalNPC.siren < 0 || !Main.npc[CalamityGlobalNPC.siren].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.alpha > 50) - { - npc.alpha -= 5; - } - npc.TargetClosest(true); - Vector2 center = npc.Center; - int num14 = Math.Sign(Main.player[npc.target].Center.X - center.X); - if (num14 != 0) - { - npc.direction = (npc.spriteDirection = num14); - } - Vector2 direction = Main.player[npc.target].Center - center; - direction.Normalize(); - direction *= (CalamityWorld.bossRushActive ? 16f : 11f); - npc.ai[0] += 1f; - if (npc.ai[0] > 45f) - { - npc.ai[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = Main.expertMode ? 26 : 32; - Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, mod.ProjectileType("WaterSpear"), damage, 0f, npc.target); - } - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); + if (CalamityGlobalNPC.siren < 0 || !Main.npc[CalamityGlobalNPC.siren].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.alpha > 50) + { + npc.alpha -= 5; + } + npc.TargetClosest(true); + Vector2 center = npc.Center; + int num14 = Math.Sign(Main.player[npc.target].Center.X - center.X); + if (num14 != 0) + { + npc.direction = (npc.spriteDirection = num14); + } + Vector2 direction = Main.player[npc.target].Center - center; + direction.Normalize(); + direction *= (CalamityWorld.bossRushActive ? 16f : 11f); + npc.ai[0] += 1f; + if (npc.ai[0] > 45f) + { + npc.ai[0] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = Main.expertMode ? 26 : 32; + Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, mod.ProjectileType("WaterSpear"), damage, 0f, npc.target); + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 3000; - npc.damage = 0; - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 3000; + npc.damage = 0; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index fa8c01de18..dcabba3c57 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -1,38 +1,38 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Leviathan { public class SirenIce : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Shield"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Shield"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.damage = 55; - npc.width = 100; - npc.height = 100; - npc.defense = 10; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.damage = 55; + npc.width = 100; + npc.height = 100; + npc.defense = 10; npc.Calamity().RevPlusDR(0.5f); npc.lifeMax = 650; - if (CalamityWorld.bossRushActive) + if (CalamityWorld.bossRushActive) { npc.lifeMax = 400000; } npc.alpha = 255; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - } + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + } public override void AI() { @@ -59,8 +59,8 @@ namespace CalamityMod.NPCs.Leviathan npc.active = false; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { if (projectile.type != mod.ProjectileType("FlakKraken")) { if (projectile.penetrate == -1 && !projectile.minion) @@ -72,31 +72,31 @@ namespace CalamityMod.NPCs.Leviathan projectile.penetrate = 1; } } - } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, npc.alpha); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, npc.alpha); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 240, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 240, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 13face023b..4ab6ebff76 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -1,69 +1,67 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class AeroSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aero Slime"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aero Slime"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = 14; - npc.damage = 18; - npc.width = 40; - npc.height = 30; - npc.defense = 6; - npc.lifeMax = 50; - npc.knockBackResist = 0f; - animationType = 121; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("AeroSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 14; + npc.damage = 18; + npc.width = 40; + npc.height = 30; + npc.defense = 6; + npc.lifeMax = 50; + npc.knockBackResist = 0f; + animationType = 121; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("AeroSlimeBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.05f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.05f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AerialiteOre"), Main.rand.Next(10, 27)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AerialiteOre"), Main.rand.Next(10, 27)); + } + } } diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index 4b8bdc845a..eaf81c043c 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -1,59 +1,58 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class AngryDog : ModNPC - { + { private bool reset = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Angry Dog"); - Main.npcFrameCount[npc.type] = 9; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Angry Dog"); + Main.npcFrameCount[npc.type] = 9; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 10; - npc.width = 56; - npc.height = 56; - npc.defense = 4; - npc.lifeMax = 50; - if (CalamityWorld.downedCryogen) - { - npc.damage = 84; - npc.defense = 10; - npc.lifeMax = 1000; - } - npc.knockBackResist = 0.3f; - animationType = 329; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); - npc.DeathSound = SoundID.NPCDeath5; - banner = npc.type; - bannerItem = mod.ItemType("AngryDogBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 10; + npc.width = 56; + npc.height = 56; + npc.defense = 4; + npc.lifeMax = 50; + if (CalamityWorld.downedCryogen) + { + npc.damage = 84; + npc.defense = 10; + npc.lifeMax = 1000; + } + npc.knockBackResist = 0.3f; + animationType = 329; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 3, 0); + npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); + npc.DeathSound = SoundID.NPCDeath5; + banner = npc.type; + bannerItem = mod.ItemType("AngryDogBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(reset); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(reset); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - reset = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + reset = reader.ReadBoolean(); + } - public override void AI() + public override void AI() { if (Main.rand.NextBool(900)) { @@ -353,7 +352,7 @@ namespace CalamityMod.NPCs.NormalNPCs } int num19 = 30; int num20 = 10; - bool flag19= false; + bool flag19 = false; bool flag20 = false; bool flag30 = false; if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) @@ -421,7 +420,7 @@ namespace CalamityMod.NPCs.NormalNPCs } float num6 = 6f; float num70 = 0.07f; - if (!flag19&& (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { if (npc.velocity.X < -num6 || npc.velocity.X > num6) { @@ -622,45 +621,45 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { return spawnInfo.player.ZoneSnow && - !spawnInfo.player.ZoneTowerStardust && - !spawnInfo.player.ZoneTowerSolar && - !spawnInfo.player.ZoneTowerVortex && - !spawnInfo.player.ZoneTowerNebula && + !spawnInfo.player.ZoneTowerStardust && + !spawnInfo.player.ZoneTowerSolar && + !spawnInfo.player.ZoneTowerVortex && + !spawnInfo.player.ZoneTowerNebula && !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.Calamity().ZoneSunkenSea && - !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; + !spawnInfo.player.Calamity().ZoneSunkenSea && + !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Leather, Main.rand.Next(1, 3)); - } - if (Main.rand.NextBool(100)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Cryophobia")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Leather, Main.rand.Next(1, 3)); + } + if (Main.rand.NextBool(100)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Cryophobia")); + } + } + } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 3ffbbe0882..01a2ce7279 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -1,164 +1,163 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class ArmoredDiggerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } + public class ArmoredDiggerBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Digger"); + } - public override void SetDefaults() - { - npc.damage = 70; - npc.width = 38; - npc.height = 38; - npc.defense = 30; + public override void SetDefaults() + { + npc.damage = 70; + npc.width = 38; + npc.height = 38; + npc.defense = 30; npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("ArmoredDiggerHead"); - bannerItem = mod.ItemType("ArmoredDiggerBanner"); - } + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("ArmoredDiggerHead"); + bannerItem = mod.ItemType("ArmoredDiggerBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(1800, 26000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 7f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int num9 = 30; - int num10 = 450; - vector.X += num6 * 5f; - vector.Y += num7 * 5f; - Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; - } - catch - { - } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); - num22 = (num22 - (float)num23) / num22; - num20 *= num22; - num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; - } - } + public override void AI() + { + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.localAI[0] >= (float)Main.rand.Next(1800, 26000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 7f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int num9 = 30; + int num10 = 450; + vector.X += num6 * 5f; + vector.Y += num7 * 5f; + Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + } catch + { + } + npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + int num23 = (int)(44f * npc.scale); + num22 = (num22 - (float)num23) / num22; + num20 *= num22; + num21 *= num22; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num20; + npc.position.Y = npc.position.Y + num21; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 180, true); - player.AddBuff(BuffID.Electrified, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Chilled, 180, true); + player.AddBuff(BuffID.Electrified, 120, true); + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 57998d6063..d44d7e8262 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,423 +1,423 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class ArmoredDiggerHead : ModNPC - { - bool TailSpawned = false; + public class ArmoredDiggerHead : ModNPC + { + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Digger"); + } - public override void SetDefaults() - { - npc.damage = 90; - npc.npcSlots = 10f; - npc.width = 54; - npc.height = 54; - npc.defense = 15; + public override void SetDefaults() + { + npc.damage = 90; + npc.npcSlots = 10f; + npc.width = 54; + npc.height = 54; + npc.defense = 15; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("ArmoredDiggerBanner"); - } + npc.lifeMax = 20000; + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 5, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("ArmoredDiggerBanner"); + } - public override void AI() - { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned) - { - npc.ai[3] = (float)npc.whoAmI; - npc.realLife = npc.whoAmI; - int num2 = npc.whoAmI; - int num3 = 40; - for (int j = 0; j <= num3; j++) - { - int num4 = mod.NPCType("ArmoredDiggerBody"); - if (j == num3) - { - num4 = mod.NPCType("ArmoredDiggerTail"); - } - int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num5].ai[3] = (float)npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; - Main.npc[num5].ai[1] = (float)num2; - Main.npc[num2].ai[0] = (float)num5; - NetMessage.SendData(23, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); - num2 = num5; - } - TailSpawned = true; - } - } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num12 < 0) - { - num12 = 0; - } - if (num13 > Main.maxTilesX) - { - num13 = Main.maxTilesX; - } - if (num14 < 0) - { - num14 = 0; - } - if (num15 > Main.maxTilesY) - { - num15 = Main.maxTilesY; - } - bool flag2 = false; - if (!flag2) - { - for (int k = num12; k < num13; k++) - { - for (int l = num14; l < num15; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) - { - Vector2 vector2; - vector2.X = (float)(k * 16); - vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - break; - } - } - } - } - } - if (!flag2) - { - npc.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num16 = 1000; - bool flag3 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int m = 0; m < 255; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - if (flag3) - { - flag2 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - float num17 = 16f; - if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer * 16.0) - { - flag2 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - npc.velocity.Y = npc.velocity.Y + 1f; - num17 = 32f; - } - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || - Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) - { - Main.npc[a].active = false; - } - } - } - } - float num18 = 0.1f; - float num19 = 0.15f; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (!flag2) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) - { - npc.velocity.Y = num17; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - } - else if (npc.velocity.Y == num17) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; - } - } - } - else - { - if (npc.soundDelay == 0) - { - float num24 = num22 / 40f; - if (num24 < 10f) - { - num24 = 10f; - } - if (num24 > 20f) - { - num24 = 20f; - } - npc.soundDelay = (int)num24; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num19; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num19; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num19; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num19; - } - } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18; - } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; - } - } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 2f; - } - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18; - } - } - } - else - { - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18; - } - else - { - npc.velocity.X = npc.velocity.X - num18; - } - } - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag2) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + public override void AI() + { + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned) + { + npc.ai[3] = (float)npc.whoAmI; + npc.realLife = npc.whoAmI; + int num2 = npc.whoAmI; + int num3 = 40; + for (int j = 0; j <= num3; j++) + { + int num4 = mod.NPCType("ArmoredDiggerBody"); + if (j == num3) + { + num4 = mod.NPCType("ArmoredDiggerTail"); + } + int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num5].ai[3] = (float)npc.whoAmI; + Main.npc[num5].realLife = npc.whoAmI; + Main.npc[num5].ai[1] = (float)num2; + Main.npc[num2].ai[0] = (float)num5; + NetMessage.SendData(23, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); + num2 = num5; + } + TailSpawned = true; + } + } + int num12 = (int)(npc.position.X / 16f) - 1; + int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num14 = (int)(npc.position.Y / 16f) - 1; + int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + for (int l = num14; l < num15; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + { + Vector2 vector2; + vector2.X = (float)(k * 16); + vector2.Y = (float)(l * 16); + if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + npc.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num16 = 1000; + bool flag3 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + { + flag2 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + float num17 = 16f; + if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer * 16.0) + { + flag2 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + npc.velocity.Y = npc.velocity.Y + 1f; + num17 = 32f; + } + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || + Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) + { + Main.npc[a].active = false; + } + } + } + } + float num18 = 0.1f; + float num19 = 0.15f; + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + if (!flag2) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + 0.15f; + if (npc.velocity.Y > num17) + { + npc.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = num17 / num22; + num20 *= num27; + num21 *= num27; + if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num19; + } + } + if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18; + } + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18 * 2f; + } + } + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag2) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 240, true); - player.AddBuff(BuffID.Electrified, 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Chilled, 240, true); + player.AddBuff(BuffID.Electrified, 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(40)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeadWizard")); - } - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonsRemote")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh"), Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(40)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeadWizard")); + } + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonsRemote")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh"), Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 5db9e55704..702b32f078 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -1,137 +1,136 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class ArmoredDiggerTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } + public class ArmoredDiggerTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Digger"); + } - public override void SetDefaults() - { - npc.damage = 55; - npc.width = 34; - npc.height = 34; - npc.defense = 45; + public override void SetDefaults() + { + npc.damage = 55; + npc.width = 34; + npc.height = 34; + npc.defense = 45; npc.Calamity().RevPlusDR(0.45f); npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("ArmoredDiggerHead"); - bannerItem = mod.ItemType("ArmoredDiggerBanner"); - } + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("ArmoredDiggerHead"); + bannerItem = mod.ItemType("ArmoredDiggerBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; - } - catch - { - } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); - num22 = (num22 - (float)num23) / num22; - num20 *= num22; - num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; - } - } + public override void AI() + { + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + } catch + { + } + npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + int num23 = (int)(44f * npc.scale); + num22 = (num22 - (float)num23) / num22; + num20 *= num22; + num21 *= num22; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num20; + npc.position.Y = npc.position.Y + num21; + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 120, true); - player.AddBuff(BuffID.Electrified, 90, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Chilled, 120, true); + player.AddBuff(BuffID.Electrified, 90, true); + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index 84ef2c1d1b..3f7585fe9a 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -1,71 +1,69 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class BlightedEye : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blighted Eye"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blighted Eye"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 2; - npc.damage = 32; - npc.width = 30; - npc.height = 32; - npc.defense = 8; - npc.lifeMax = 120; - npc.knockBackResist = 0.6f; - animationType = 2; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("BlightedEyeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 2; + npc.damage = 32; + npc.width = 30; + npc.height = 32; + npc.defense = 8; + npc.lifeMax = 120; + npc.knockBackResist = 0.6f; + animationType = 2; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("BlightedEyeBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldNightMonster.Chance * 0.075f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.075f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 120, true); + } - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens")); + } + } + } } diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index e0ba45b5a1..9f82562cfc 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -1,69 +1,67 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class BloomSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloom Slime"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloom Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 80; - npc.width = 40; - npc.height = 30; - npc.defense = 25; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("BloomSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 80; + npc.width = 40; + npc.height = 30; + npc.defense = 25; + npc.lifeMax = 1000; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("BloomSlimeBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.08f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.08f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UelibloomOre"), Main.rand.Next(10, 27)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UelibloomOre"), Main.rand.Next(10, 27)); + } + } } diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index 0d1aeb98e7..d118f11bd3 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -1,343 +1,343 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { public class Bohldohr : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("BOHLDOHR"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("BOHLDOHR"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 150; - npc.width = 40; - npc.height = 40; - npc.defense = 18; - npc.lifeMax = 300; - npc.knockBackResist = 0.9f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath35; - npc.behindTiles = true; - banner = npc.type; - bannerItem = mod.ItemType("BOHLDOHRBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 150; + npc.width = 40; + npc.height = 40; + npc.defense = 18; + npc.lifeMax = 300; + npc.knockBackResist = 0.9f; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath35; + npc.behindTiles = true; + banner = npc.type; + bannerItem = mod.ItemType("BOHLDOHRBanner"); + } - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - 4f; - Main.PlaySound(3, npc.Center, 7); - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); - if (!Main.player[npc.target].ZoneSandstorm) - { - num9 = 0f; - } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.2f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - bool flag6 = npc.type == 410 || npc.type == 423; - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = -8.5f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7.5f; - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - 4f; + Main.PlaySound(3, npc.Center, 7); + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); + if (!Main.player[npc.target].ZoneSandstorm) + { + num9 = 0f; + } + num7 = 5f + num9 * (float)npc.direction * 4f; + num8 = 0.2f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + bool flag6 = npc.type == 410 || npc.type == 423; + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = -8.5f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7.5f; + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss) - { - return 0f; - } - return SpawnCondition.JungleTemple.Chance * 0.05f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss) + { + return 0f; + } + return SpawnCondition.JungleTemple.Chance * 0.05f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default, 1f); + } + } + } public override void NPCLoot() { diff --git a/NPCs/NormalNPCs/CalamityEye.cs b/NPCs/NormalNPCs/CalamityEye.cs index 68a0c3a697..23b0c4d998 100644 --- a/NPCs/NormalNPCs/CalamityEye.cs +++ b/NPCs/NormalNPCs/CalamityEye.cs @@ -1,77 +1,75 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CalamityEye : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamity Eye"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamity Eye"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = 2; - npc.damage = 40; - npc.width = 30; - npc.height = 32; - npc.defense = 12; - npc.lifeMax = 140; - npc.knockBackResist = 0f; - animationType = 2; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("CalamityEyeBanner"); - } + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = 2; + npc.damage = 40; + npc.width = 30; + npc.height = 32; + npc.defense = 12; + npc.lifeMax = 140; + npc.knockBackResist = 0f; + animationType = 2; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("CalamityEyeBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldNightMonster.Chance * 0.045f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.045f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); + } - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens")); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Lens); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens")); + } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Lens); + } + } + } } diff --git a/NPCs/NormalNPCs/CharredSlime.cs b/NPCs/NormalNPCs/CharredSlime.cs index 5576b0bd5b..d293a19d7c 100644 --- a/NPCs/NormalNPCs/CharredSlime.cs +++ b/NPCs/NormalNPCs/CharredSlime.cs @@ -1,66 +1,65 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class CharredSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charred Slime"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Charred Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 40; - npc.width = 40; - npc.height = 30; - npc.defense = 10; - npc.lifeMax = 250; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 50; - npc.lavaImmune = true; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("CharredSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 40; + npc.width = 40; + npc.height = 30; + npc.defense = 10; + npc.lifeMax = 250; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.alpha = 50; + npc.lavaImmune = true; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("CharredSlimeBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss) - { - return 0f; - } - return SpawnCondition.Underworld.Chance * 0.06f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss) + { + return 0f; + } + return SpawnCondition.Underworld.Chance * 0.06f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CharredOre"), Main.rand.Next(10, 27)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CharredOre"), Main.rand.Next(10, 27)); + } + } } diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 6aca19a78b..b3cac1a3b1 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -1,50 +1,49 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class Cnidrion : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cnidrion"); - Main.npcFrameCount[npc.type] = 10; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cnidrion"); + Main.npcFrameCount[npc.type] = 10; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 20; - npc.width = 160; - npc.height = 80; - npc.defense = 6; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 20; + npc.width = 160; + npc.height = 80; + npc.defense = 6; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = 400; - npc.knockBackResist = 0.05f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit12; - npc.DeathSound = SoundID.NPCDeath18; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("CnidrionBanner"); - } + npc.lifeMax = 400; + npc.knockBackResist = 0.05f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit12; + npc.DeathSound = SoundID.NPCDeath18; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("CnidrionBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.0175f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.0175f; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.1f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -52,253 +51,253 @@ namespace CalamityMod.NPCs.NormalNPCs npc.frame.Y = frame * frameHeight; } - public override void AI() - { - Player player = Main.player[npc.target]; - bool expertMode = Main.expertMode; - npc.noGravity = true; - npc.noTileCollide = true; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - float num823 = 1f; - npc.TargetClosest(true); - bool flag51 = false; - int offsetX = 80; - if ((double)npc.life < (double)npc.lifeMax * 0.33) - { - num823 = 2f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num823 = 4f; - } - if (npc.ai[0] == 0f) - { - npc.ai[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.33) - { - npc.ai[1] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 300f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - npc.ai[0] = (float)Main.rand.Next(3, 5); - } - else - { - npc.ai[0] = (float)Main.rand.Next(1, 3); - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - flag51 = true; - npc.ai[1] += 1f; - if (npc.ai[1] % 30f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); - float num832 = 6f; - num831 = num832 / num831; - num829 *= num831; - num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 8 : 11), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 120f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 2f) - { - flag51 = true; - npc.ai[1] += 1f; - if (npc.ai[1] > 60f && npc.ai[1] < 240f && npc.ai[1] % 16f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); - float num832 = 8f; - num831 = num832 / num831; - num829 *= num831; - num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-15, 16) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-15, 16) * 0.01f; - Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 9 : 12), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 300f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - num823 = 4f; - npc.ai[1] += 1f; - if (npc.ai[1] % 30f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num844 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num845 = Main.player[npc.target].position.Y - vector18.Y; - float num846 = (float)Math.Sqrt((double)(num844 * num844 + num845 * num845)); - float num847 = 10f; - num846 = num847 / num846; - num844 *= num846; - num845 *= num846; - num844 *= 1f + (float)Main.rand.Next(-10, 11) * 0.001f; - num845 *= 1f + (float)Main.rand.Next(-10, 11) * 0.001f; - int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 11 : 14), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 120f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - num823 = 4f; - npc.ai[1] += 1f; - if (npc.ai[1] % 20f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); - float num832 = 11f; - num831 = num832 / num831; - num829 *= num831; - num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-5, 6) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-5, 6) * 0.01f; - int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 13 : 17), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 240f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) - { - flag51 = true; - } - if (flag51) - { - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - } - else - { - if (npc.direction > 0) - { - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; - } - if (npc.direction < 0) - { - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; - } - } - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); - bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) - { - flag52 = true; - } - if (flag52) - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y > -0.2) - { - npc.velocity.Y = npc.velocity.Y - 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = npc.velocity.Y + 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - } + public override void AI() + { + Player player = Main.player[npc.target]; + bool expertMode = Main.expertMode; + npc.noGravity = true; + npc.noTileCollide = true; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + float num823 = 1f; + npc.TargetClosest(true); + bool flag51 = false; + int offsetX = 80; + if ((double)npc.life < (double)npc.lifeMax * 0.33) + { + num823 = 2f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num823 = 4f; + } + if (npc.ai[0] == 0f) + { + npc.ai[1] += 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.33) + { + npc.ai[1] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 300f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + npc.ai[0] = (float)Main.rand.Next(3, 5); + } + else + { + npc.ai[0] = (float)Main.rand.Next(1, 3); + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + flag51 = true; + npc.ai[1] += 1f; + if (npc.ai[1] % 30f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(offsetX * npc.direction); + float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num830 = Main.player[npc.target].position.Y - vector18.Y; + float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num832 = 6f; + num831 = num832 / num831; + num829 *= num831; + num830 *= num831; + num829 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + num830 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 8 : 11), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 120f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 2f) + { + flag51 = true; + npc.ai[1] += 1f; + if (npc.ai[1] > 60f && npc.ai[1] < 240f && npc.ai[1] % 16f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(offsetX * npc.direction); + float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num830 = Main.player[npc.target].position.Y - vector18.Y; + float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num832 = 8f; + num831 = num832 / num831; + num829 *= num831; + num830 *= num831; + num829 *= 1f + (float)Main.rand.Next(-15, 16) * 0.01f; + num830 *= 1f + (float)Main.rand.Next(-15, 16) * 0.01f; + Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 9 : 12), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 300f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + num823 = 4f; + npc.ai[1] += 1f; + if (npc.ai[1] % 30f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(offsetX * npc.direction); + float num844 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num845 = Main.player[npc.target].position.Y - vector18.Y; + float num846 = (float)Math.Sqrt((double)(num844 * num844 + num845 * num845)); + float num847 = 10f; + num846 = num847 / num846; + num844 *= num846; + num845 *= num846; + num844 *= 1f + (float)Main.rand.Next(-10, 11) * 0.001f; + num845 *= 1f + (float)Main.rand.Next(-10, 11) * 0.001f; + int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 11 : 14), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 120f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + num823 = 4f; + npc.ai[1] += 1f; + if (npc.ai[1] % 20f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(offsetX * npc.direction); + float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num830 = Main.player[npc.target].position.Y - vector18.Y; + float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num832 = 11f; + num831 = num832 / num831; + num829 *= num831; + num830 *= num831; + num829 *= 1f + (float)Main.rand.Next(-5, 6) * 0.01f; + num830 *= 1f + (float)Main.rand.Next(-5, 6) * 0.01f; + int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 13 : 17), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 240f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) + { + flag51 = true; + } + if (flag51) + { + npc.velocity.X = npc.velocity.X * 0.9f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + } + else + { + if (npc.direction > 0) + { + npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + } + if (npc.direction < 0) + { + npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + } + } + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + bool flag52 = false; + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) + { + flag52 = true; + } + if (flag52) + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y > -0.2) + { + npc.velocity.Y = npc.velocity.Y - 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = npc.velocity.Y + 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(1, 4)); - if (Main.rand.NextBool(4)) - { - if (Main.rand.NextBool(25)) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheTransformer")); - else - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasSpark")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(1, 4)); + if (Main.rand.NextBool(4)) + { + if (Main.rand.NextBool(25)) + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheTransformer")); + else + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasSpark")); + } + } + } } diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 8107e28188..abeb9dbc98 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -1,89 +1,87 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CosmicElemental : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Elemental"); - Main.npcFrameCount[npc.type] = 22; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Elemental"); + Main.npcFrameCount[npc.type] = 22; + } - public override void SetDefaults() - { - npc.npcSlots = 0.5f; - npc.aiStyle = 91; - npc.damage = 20; - npc.width = 20; - npc.height = 30; - npc.defense = 10; - npc.lifeMax = 25; - npc.knockBackResist = 0.5f; - animationType = 483; - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath6; - banner = npc.type; - bannerItem = mod.ItemType("CosmicElementalBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.5f; + npc.aiStyle = 91; + npc.damage = 20; + npc.width = 20; + npc.height = 30; + npc.defense = 10; + npc.lifeMax = 25; + npc.knockBackResist = 0.5f; + animationType = 483; + npc.value = Item.buyPrice(0, 0, 3, 0); + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath6; + banner = npc.type; + bannerItem = mod.ItemType("CosmicElementalBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.01f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.01f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(BuffID.Confused, 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(BuffID.Confused, 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); - } - if (Main.rand.NextBool(50)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); - } - if (Main.rand.NextBool(100)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); - } - if (Main.rand.NextBool(1000)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); - } + public override void NPCLoot() + { + if (Main.rand.NextBool(10)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); + } + if (Main.rand.NextBool(50)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); + } + if (Main.rand.NextBool(100)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); + } + if (Main.rand.NextBool(1000)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); + } if (CalamityWorld.defiled) { if (Main.rand.NextBool(20)) @@ -100,5 +98,5 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - } + } } diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 106e0534d0..97e5ab7f43 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -1,271 +1,270 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerAmber : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amber Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amber Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 25; - npc.width = 44; - npc.height = 34; - npc.defense = 10; - npc.lifeMax = 90; - npc.knockBackResist = 0.3f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("AmberCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 25; + npc.width = 44; + npc.height = 34; + npc.defense = 10; + npc.lifeMax = 90; + npc.knockBackResist = 0.3f; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("AmberCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5f; //5 - float num70 = 0.05f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 5f; //5 + float num70 = 0.05f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.0175f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.0175f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amber, Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amber, Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 66176c6ef2..0f95abe0a9 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -1,271 +1,270 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerAmethyst : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amethyst Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amethyst Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 15; - npc.width = 44; - npc.height = 34; - npc.defense = 4; - npc.lifeMax = 60; - npc.knockBackResist = 0.75f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("AmethystCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 15; + npc.width = 44; + npc.height = 34; + npc.defense = 4; + npc.lifeMax = 60; + npc.knockBackResist = 0.75f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("AmethystCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 4.5f; //5 - float num70 = 0.045f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 4.5f; //5 + float num70 = 0.045f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.04f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.04f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amethyst, Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amethyst, Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 8cf1d85214..7b49fa57b4 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -1,275 +1,274 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerCrystal : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 35; - npc.width = 44; - npc.height = 34; - npc.defense = 12; - npc.lifeMax = 300; - npc.knockBackResist = 0.15f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("CrystalCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 35; + npc.width = 44; + npc.height = 34; + npc.defense = 12; + npc.lifeMax = 300; + npc.knockBackResist = 0.15f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("CrystalCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 7f; //5 - float num70 = 0.07f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 7f; //5 + float num70 = 0.07f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.EnchantedSword.Chance; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.EnchantedSword.Chance; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrystalShard, Main.rand.Next(2, 5)); - if (Main.rand.NextBool(5)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrystalBlade")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrystalShard, Main.rand.Next(2, 5)); + if (Main.rand.NextBool(5)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrystalBlade")); + } + } + } } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 0356341d65..13007272e9 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -1,271 +1,270 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerDiamond : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Diamond Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Diamond Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 24; - npc.width = 44; - npc.height = 34; - npc.defense = 8; - npc.lifeMax = 150; - npc.knockBackResist = 0.35f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("DiamondCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 24; + npc.width = 44; + npc.height = 34; + npc.defense = 8; + npc.lifeMax = 150; + npc.knockBackResist = 0.35f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("DiamondCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 6f; //5 - float num70 = 0.06f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 6f; //5 + float num70 = 0.06f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.0175f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.0175f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Diamond, Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Diamond, Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 642178360b..cb17e4c080 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -1,271 +1,270 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerEmerald : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Emerald Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Emerald Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 20; - npc.width = 44; - npc.height = 34; - npc.defense = 6; - npc.lifeMax = 105; - npc.knockBackResist = 0.55f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("EmeraldCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 20; + npc.width = 44; + npc.height = 34; + npc.defense = 6; + npc.lifeMax = 105; + npc.knockBackResist = 0.55f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("EmeraldCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5.5f; //5 - float num70 = 0.055f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 5.5f; //5 + float num70 = 0.055f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.0275f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.0275f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Emerald, Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Emerald, Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index dd465e1312..b27b80668e 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -1,271 +1,270 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerRuby : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ruby Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruby Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 23; - npc.width = 44; - npc.height = 34; - npc.defense = 8; - npc.lifeMax = 135; - npc.knockBackResist = 0.45f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("RubyCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 23; + npc.width = 44; + npc.height = 34; + npc.defense = 8; + npc.lifeMax = 135; + npc.knockBackResist = 0.45f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("RubyCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 6f; //5 - float num70 = 0.06f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 6f; //5 + float num70 = 0.06f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.0275f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.0275f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ruby, Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ruby, Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 06ae1be0cb..471880c24a 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -1,271 +1,270 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerSapphire : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sapphire Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sapphire Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 18; - npc.width = 44; - npc.height = 34; - npc.defense = 6; - npc.lifeMax = 90; - npc.knockBackResist = 0.65f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("SapphireCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 18; + npc.width = 44; + npc.height = 34; + npc.defense = 6; + npc.lifeMax = 90; + npc.knockBackResist = 0.65f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("SapphireCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5.5f; //5 - float num70 = 0.055f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 5.5f; //5 + float num70 = 0.055f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.03f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.03f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sapphire, Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sapphire, Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index d9404dda9f..fb00923c98 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -1,271 +1,270 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrawlerTopaz : ModNPC - { - private bool detected = false; + { + private bool detected = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Topaz Crawler"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Topaz Crawler"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 12; - npc.width = 44; - npc.height = 34; - npc.defense = 4; - npc.lifeMax = 45; - npc.knockBackResist = 0.85f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("TopazCrawlerBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 12; + npc.width = 44; + npc.height = 34; + npc.defense = 4; + npc.lifeMax = 45; + npc.knockBackResist = 0.85f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("TopazCrawlerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 4.5f; //5 - float num70 = 0.045f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 4.5f; //5 + float num70 = 0.045f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.0425f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.0425f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Topaz, Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Topaz, Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 678965e67d..e6b9b3a7f8 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -1,79 +1,77 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CrimulanBlightSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimulan Blight Slime"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimulan Blight Slime"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 60; - npc.height = 42; - npc.defense = 8; - npc.lifeMax = 130; - npc.knockBackResist = 0.3f; - animationType = 244; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.alpha = 105; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - banner = npc.type; - bannerItem = mod.ItemType("CrimulanBlightSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 60; + npc.height = 42; + npc.defense = 8; + npc.lifeMax = 130; + npc.knockBackResist = 0.3f; + animationType = 244; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.alpha = 105; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + banner = npc.type; + bannerItem = mod.ItemType("CrimulanBlightSlimeBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) - { - return 0f; - } - return SpawnCondition.Crimson.Chance * 0.15f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) + { + return 0f; + } + return SpawnCondition.Crimson.Chance * 0.15f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.ManaSickness, 120, true); - player.AddBuff(BuffID.Confused, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.ManaSickness, 120, true); + player.AddBuff(BuffID.Confused, 120, true); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EbonianGel"), Main.rand.Next(15, 17)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(10, 15)); - if (Main.rand.NextBool(100) && NPC.downedBoss3) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Carnage")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EbonianGel"), Main.rand.Next(15, 17)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(10, 15)); + if (Main.rand.NextBool(100) && NPC.downedBoss3) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Carnage")); + } + } + } } diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 9269ce7d9b..4e81ac53e3 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -1,69 +1,67 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class CryoSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryo Slime"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryo Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 40; - npc.height = 30; - npc.defense = 8; - npc.lifeMax = 120; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("CryoSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 40; + npc.height = 30; + npc.defense = 8; + npc.lifeMax = 120; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("CryoSlimeBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.08f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.08f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryonicOre"), Main.rand.Next(10, 27)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryonicOre"), Main.rand.Next(10, 27)); + } + } } diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index b38e63852f..8a25ab8f6a 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -1,37 +1,36 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class Cryon : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryon"); - Main.npcFrameCount[npc.type] = 8; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryon"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.aiStyle = -1; + public override void SetDefaults() + { + npc.aiStyle = -1; aiType = -1; - npc.damage = 42; - npc.width = 50; - npc.height = 64; - npc.defense = 10; + npc.damage = 42; + npc.width = 50; + npc.height = 64; + npc.defense = 10; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 300; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - banner = npc.type; - bannerItem = mod.ItemType("CryonBanner"); - } + npc.lifeMax = 300; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + banner = npc.type; + bannerItem = mod.ItemType("CryonBanner"); + } public override void AI() { @@ -345,8 +344,8 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula && !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.Calamity().ZoneSunkenSea && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; + !spawnInfo.player.Calamity().ZoneSunkenSea && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -359,7 +358,7 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void HitEffect(int hitDirection, double damage) - { + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); @@ -373,12 +372,12 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); + } + } + } } diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index ac51afc894..df8bf114c4 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -1,75 +1,73 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class EbonianBlightSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ebonian Blight Slime"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ebonian Blight Slime"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 60; - npc.height = 42; - npc.defense = 8; - npc.lifeMax = 130; - npc.knockBackResist = 0.3f; - animationType = 244; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.alpha = 105; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - banner = npc.type; - bannerItem = mod.ItemType("EbonianBlightSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 60; + npc.height = 42; + npc.defense = 8; + npc.lifeMax = 130; + npc.knockBackResist = 0.3f; + animationType = 244; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.alpha = 105; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + banner = npc.type; + bannerItem = mod.ItemType("EbonianBlightSlimeBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) - { - return 0f; - } - return SpawnCondition.Corruption.Chance * 0.15f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) + { + return 0f; + } + return SpawnCondition.Corruption.Chance * 0.15f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.ManaSickness, 120, true); - player.AddBuff(BuffID.Weak, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.ManaSickness, 120, true); + player.AddBuff(BuffID.Weak, 120, true); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EbonianGel"), Main.rand.Next(15, 17)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(10, 15)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EbonianGel"), Main.rand.Next(15, 17)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(10, 15)); + } + } } diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index c522c08ce7..2f7d71d5a2 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -1,339 +1,338 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class Eidolist : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolist"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolist"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 60; - npc.height = 80; - npc.lifeMax = 10000; - if (CalamityWorld.death) - { - npc.lifeMax = 13000; - } - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.alpha = 50; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath59; - npc.timeLeft = NPC.activeTime * 2; - banner = npc.type; - bannerItem = mod.ItemType("EidolistBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 60; + npc.height = 80; + npc.lifeMax = 10000; + if (CalamityWorld.death) + { + npc.lifeMax = 13000; + } + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 1, 0, 0); + npc.alpha = 50; + npc.noGravity = true; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath59; + npc.timeLeft = NPC.activeTime * 2; + banner = npc.type; + bannerItem = mod.ItemType("EidolistBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.4f, 0.5f); - if (npc.justHit || CalamityGlobalNPC.AnyBossNPCS()) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (!hasBeenHit) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.localAI[2] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.localAI[2] = 1f; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2f || npc.velocity.X > 2f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.localAI[2] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.localAI[2] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.localAI[2] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - return; - } - npc.noTileCollide = true; - float num1446 = 7f; - int num1447 = 480; - float num244; - if (npc.localAI[1] == 1f) - { - npc.localAI[1] = 0f; - if (Main.rand.NextBool(4)) - { - npc.ai[0] = (float)num1447; - } - } - npc.TargetClosest(true); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 40; - if (Main.expertMode) - { - damage = 30; - } - int random = Main.rand.Next(2); - if (random == 0) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - else - { - Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - } - } - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) - { - Main.PlaySound(SoundID.Item8, npc.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 20; - int num1454 = 3; - int num1455 = 10; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].lava()) - { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; - break; - } - } - } - npc.netUpdate = true; - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.4f, 0.5f); + if (npc.justHit || CalamityGlobalNPC.AnyBossNPCS()) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (!hasBeenHit) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.localAI[2] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.localAI[2] = 1f; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2f || npc.velocity.X > 2f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.localAI[2] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.localAI[2] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.localAI[2] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + return; + } + npc.noTileCollide = true; + float num1446 = 7f; + int num1447 = 480; + float num244; + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 0f; + if (Main.rand.NextBool(4)) + { + npc.ai[0] = (float)num1447; + } + } + npc.TargetClosest(true); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 40; + if (Main.expertMode) + { + damage = 30; + } + int random = Main.rand.Next(2); + if (random == 0) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + else + { + Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); + if (vec.HasNaNs()) + { + vec = new Vector2((float)npc.direction, 0f); + } + for (int n = 0; n < 1; n++) + { + Vector2 vector4 = vec * 4f; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + } + } + if (vector251.Length() > 400f || !flag104) + { + Vector2 value54 = vector251; + if (value54.Length() > num1446) + { + value54.Normalize(); + value54 *= num1446; + } + int num1448 = 30; + npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) + { + Main.PlaySound(SoundID.Item8, npc.Center); + int num; + for (int num1449 = 0; num1449 < 20; num1449 = num + 1) + { + int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1452]; + dust.velocity *= 3f; + Main.dust[num1452].noGravity = true; + Main.dust[num1452].scale = 2.5f; + num = num1451; + } + } + float[] var_9_48E3C_cp_0 = npc.ai; + int var_9_48E3C_cp_1 = 0; + num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; + var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; + if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = 0f; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 20; + int num1454 = 3; + int num1455 = 10; + int num1456 = 1; + int num1457 = 0; + bool flag106 = false; + if (vector251.Length() > 2000f) + { + flag106 = true; + } + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + bool flag107 = true; + if (flag107 && Main.tile[num1458, num1459].lava()) + { + flag107 = false; + } + if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) + { + flag107 = false; + } + if (flag107) + { + npc.ai[2] = (float)num1458; + npc.ai[3] = (float)num1459; + break; + } + } + } + npc.netUpdate = true; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (!Main.hardMode) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) - { - return 0.05f; - } - return spawnInfo.player.ZoneDungeon ? 0.04f : 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (!Main.hardMode) + { + return 0f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + { + return 0.05f; + } + return spawnInfo.player.ZoneDungeon ? 0.04f : 0f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(4)) - { - if (!NPC.LunarApocalypseIsUp) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolonTablet")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticHood); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticRobe); - } - if (CalamityWorld.downedCalamitas || NPC.downedPlantBoss) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(8, 11)); - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(2, 5)); - } - } - if (NPC.downedPlantBoss) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(3, 6)); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(4)) + { + if (!NPC.LunarApocalypseIsUp) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolonTablet")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticHood); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticRobe); + } + if (CalamityWorld.downedCalamitas || NPC.downedPlantBoss) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(8, 11)); + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(2, 5)); + } + } + if (NPC.downedPlantBoss) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(3, 6)); + } + } + } } diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 2dbca7d16f..494f5c7885 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -1,424 +1,422 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class FearlessGoldfishWarrior : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fearless Goldfish Warrior"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = Main.hardMode ? 120 : 30; - npc.width = 36; - npc.height = 32; - npc.defense = Main.hardMode ? 10 : 2; - npc.lifeMax = Main.hardMode ? 150 : 50; - npc.knockBackResist = Main.hardMode ? 0.2f : 0.5f; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - //banner = npc.type; - //bannerItem = mod.ItemType("OverloadedSoldierBanner"); - } - - public override void AI() - { - bool flag3 = false; - if (npc.velocity.X == 0f) - { - flag3 = true; - } - if (npc.justHit) - { - flag3 = false; - } - bool flag4 = false; - bool flag5 = false; - int num35 = 60; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag4 = true; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num35) | flag4) - { - npc.ai[3] += 1f; - } - else if ((double)Math.Abs(npc.velocity.X) > 0.9 && npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num35 * 10)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num35) - { - npc.netUpdate = true; - } - if (npc.ai[3] < (float)num35) - { - npc.TargetClosest(true); - } - else if (npc.ai[2] <= 0f) - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - if (npc.direction == 0) - { - npc.direction = 1; - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 18f) - { - npc.ai[3] = 0f; - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - return; - } - float num65 = 1f; - float num66 = 0.08f; - num65 += (1f - (float)npc.life / (float)npc.lifeMax) * 2f; - num66 += (1f - (float)npc.life / (float)npc.lifeMax) * 0.2f; - if (npc.velocity.X < -num65 || npc.velocity.X > num65) - { - if (npc.velocity.Y == 0f) - npc.velocity *= 0.7f; - } - else if (npc.velocity.X < num65 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num66; - if (npc.velocity.X > num65) - npc.velocity.X = num65; - } - else if (npc.velocity.X > -num65 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num66; - if (npc.velocity.X < -num65) - npc.velocity.X = -num65; - } - bool flag22 = false; - if (npc.velocity.Y == 0f) - { - int num161 = (int)(npc.position.Y + (float)npc.height + 7f) / 16; - int arg_A8FB_0 = (int)npc.position.X / 16; - int num162 = (int)(npc.position.X + (float)npc.width) / 16; - for (int num163 = arg_A8FB_0; num163 <= num162; num163++) - { - if (Main.tile[num163, num161] == null) - { - return; - } - if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].type]) - { - flag22 = true; - break; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num164 = 0; - if (npc.velocity.X < 0f) - { - num164 = -1; - } - if (npc.velocity.X > 0f) - { - num164 = 1; - } - Vector2 position2 = npc.position; - position2.X += npc.velocity.X; - int num165 = (int)((position2.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num164)) / 16f); - int num166 = (int)((position2.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num165, num166] == null) - { - Main.tile[num165, num166] = new Tile(); - } - if (Main.tile[num165, num166 - 1] == null) - { - Main.tile[num165, num166 - 1] = new Tile(); - } - if (Main.tile[num165, num166 - 2] == null) - { - Main.tile[num165, num166 - 2] = new Tile(); - } - if (Main.tile[num165, num166 - 3] == null) - { - Main.tile[num165, num166 - 3] = new Tile(); - } - if (Main.tile[num165, num166 + 1] == null) - { - Main.tile[num165, num166 + 1] = new Tile(); - } - if (Main.tile[num165 - num164, num166 - 3] == null) - { - Main.tile[num165 - num164, num166 - 3] = new Tile(); - } - if ((float)(num165 * 16) < position2.X + (float)npc.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].type] && !Main.tileSolidTop[(int)Main.tile[num165, num166].type]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].type] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].type]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].type]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].type]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].type])) - { - float num167 = (float)(num166 * 16); - if (Main.tile[num165, num166].halfBrick()) - { - num167 += 8f; - } - if (Main.tile[num165, num166 - 1].halfBrick()) - { - num167 -= 8f; - } - if (num167 < position2.Y + (float)npc.height) - { - float num168 = position2.Y + (float)npc.height - num167; - float num169 = 16.1f; - if (num168 <= num169) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num167; - npc.position.Y = num167 - (float)npc.height; - if (num168 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (flag22) - { - int num170 = (int)((npc.position.X + (float)(npc.width / 2) + (float)(15 * npc.direction)) / 16f); - int num171 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num170, num171] == null) - { - Main.tile[num170, num171] = new Tile(); - } - if (Main.tile[num170, num171 - 1] == null) - { - Main.tile[num170, num171 - 1] = new Tile(); - } - if (Main.tile[num170, num171 - 2] == null) - { - Main.tile[num170, num171 - 2] = new Tile(); - } - if (Main.tile[num170, num171 - 3] == null) - { - Main.tile[num170, num171 - 3] = new Tile(); - } - if (Main.tile[num170, num171 + 1] == null) - { - Main.tile[num170, num171 + 1] = new Tile(); - } - if (Main.tile[num170 + npc.direction, num171 - 1] == null) - { - Main.tile[num170 + npc.direction, num171 - 1] = new Tile(); - } - if (Main.tile[num170 + npc.direction, num171 + 1] == null) - { - Main.tile[num170 + npc.direction, num171 + 1] = new Tile(); - } - if (Main.tile[num170 - npc.direction, num171 + 1] == null) - { - Main.tile[num170 - npc.direction, num171 + 1] = new Tile(); - } - Main.tile[num170, num171 + 1].halfBrick(); - if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].type == 10 || Main.tile[num170, num171 - 1].type == 388)) & flag5) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - if (npc.ai[2] >= 60f) - { - npc.velocity.X = 0.5f * (float)(-(float)npc.direction); - int num172 = 5; - if (Main.tile[num170, num171 - 1].type == 388) - { - num172 = 2; - } - npc.ai[1] += (float)num172; - npc.ai[2] = 0f; - bool flag23 = false; - if (npc.ai[1] >= 10f) - { - flag23 = true; - npc.ai[1] = 10f; - } - WorldGen.KillTile(num170, num171 - 1, true, false, false); - if ((Main.netMode != NetmodeID.MultiplayerClient || !flag23) && flag23 && Main.netMode != NetmodeID.MultiplayerClient) - { - if (Main.tile[num170, num171 - 1].type == 10) - { - bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, npc.direction); - if (!flag24) - { - npc.ai[3] = (float)num35; - npc.netUpdate = true; - } - if (Main.netMode == NetmodeID.Server & flag24) - { - NetMessage.SendData(19, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)npc.direction, 0, 0, 0); - } - } - if (Main.tile[num170, num171 - 1].type == 388) - { - bool flag25 = WorldGen.ShiftTallGate(num170, num171 - 1, false); - if (!flag25) - { - npc.ai[3] = (float)num35; - npc.netUpdate = true; - } - if (Main.netMode == NetmodeID.Server & flag25) - { - NetMessage.SendData(19, -1, -1, null, 4, (float)num170, (float)(num171 - 1), 0f, 0, 0, 0); - } - } - } - } - } - else - { - int num173 = npc.spriteDirection; - if ((npc.velocity.X < 0f && num173 == -1) || (npc.velocity.X > 0f && num173 == 1)) - { - if (npc.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].type]) - { - if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].type]) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - } - else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].type]) - { - npc.velocity.Y = -5f; - npc.netUpdate = true; - } - else if (npc.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].type]) && (!Main.tile[num170 + npc.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + npc.direction, num171 + 1].type])) - { - npc.velocity.Y = -8f; - npc.velocity.X = npc.velocity.X * 1.5f; - npc.netUpdate = true; - } - else if (flag5) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - if ((npc.velocity.Y == 0f & flag3) && npc.ai[3] == 1f) - { - npc.velocity.Y = -5f; - } - } - } - } - else if (flag5) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - - public override void FindFrame(int frameHeight) - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 18f) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y < frameHeight * 5) - npc.frame.Y = frameHeight * 5; - if (npc.frame.Y > frameHeight * 9) - npc.frame.Y = frameHeight * 5; - } - else - { - npc.frameCounter += (double)Math.Abs(npc.velocity.X); - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.velocity.Y == 0f) - { - if (npc.direction == 1) - npc.spriteDirection = 1; - if (npc.direction == -1) - npc.spriteDirection = -1; - } - else - { - npc.frameCounter = 0.0; - npc.frame.Y = frameHeight; - return; - } - if (npc.velocity.X == 0f) - { - npc.frameCounter = 0.0; - npc.frame.Y = 0; - } - else - { - if (npc.frame.Y > frameHeight * 4) - npc.frame.Y = 0; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + public override void SetStaticDefaults() { - if (spawnInfo.playerSafe || !Main.raining || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDayRain.Chance * 0.05f; - } + DisplayName.SetDefault("Fearless Goldfish Warrior"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = Main.hardMode ? 120 : 30; + npc.width = 36; + npc.height = 32; + npc.defense = Main.hardMode ? 10 : 2; + npc.lifeMax = Main.hardMode ? 150 : 50; + npc.knockBackResist = Main.hardMode ? 0.2f : 0.5f; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + //banner = npc.type; + //bannerItem = mod.ItemType("OverloadedSoldierBanner"); + } + + public override void AI() + { + bool flag3 = false; + if (npc.velocity.X == 0f) + { + flag3 = true; + } + if (npc.justHit) + { + flag3 = false; + } + bool flag4 = false; + bool flag5 = false; + int num35 = 60; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag4 = true; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num35) | flag4) + { + npc.ai[3] += 1f; + } + else if ((double)Math.Abs(npc.velocity.X) > 0.9 && npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num35 * 10)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num35) + { + npc.netUpdate = true; + } + if (npc.ai[3] < (float)num35) + { + npc.TargetClosest(true); + } + else if (npc.ai[2] <= 0f) + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + if (npc.direction == 0) + { + npc.direction = 1; + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 18f) + { + npc.ai[3] = 0f; + npc.velocity.X = npc.velocity.X * 0.9f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + return; + } + float num65 = 1f; + float num66 = 0.08f; + num65 += (1f - (float)npc.life / (float)npc.lifeMax) * 2f; + num66 += (1f - (float)npc.life / (float)npc.lifeMax) * 0.2f; + if (npc.velocity.X < -num65 || npc.velocity.X > num65) + { + if (npc.velocity.Y == 0f) + npc.velocity *= 0.7f; + } + else if (npc.velocity.X < num65 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num66; + if (npc.velocity.X > num65) + npc.velocity.X = num65; + } + else if (npc.velocity.X > -num65 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num66; + if (npc.velocity.X < -num65) + npc.velocity.X = -num65; + } + bool flag22 = false; + if (npc.velocity.Y == 0f) + { + int num161 = (int)(npc.position.Y + (float)npc.height + 7f) / 16; + int arg_A8FB_0 = (int)npc.position.X / 16; + int num162 = (int)(npc.position.X + (float)npc.width) / 16; + for (int num163 = arg_A8FB_0; num163 <= num162; num163++) + { + if (Main.tile[num163, num161] == null) + { + return; + } + if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].type]) + { + flag22 = true; + break; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num164 = 0; + if (npc.velocity.X < 0f) + { + num164 = -1; + } + if (npc.velocity.X > 0f) + { + num164 = 1; + } + Vector2 position2 = npc.position; + position2.X += npc.velocity.X; + int num165 = (int)((position2.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num164)) / 16f); + int num166 = (int)((position2.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num165, num166] == null) + { + Main.tile[num165, num166] = new Tile(); + } + if (Main.tile[num165, num166 - 1] == null) + { + Main.tile[num165, num166 - 1] = new Tile(); + } + if (Main.tile[num165, num166 - 2] == null) + { + Main.tile[num165, num166 - 2] = new Tile(); + } + if (Main.tile[num165, num166 - 3] == null) + { + Main.tile[num165, num166 - 3] = new Tile(); + } + if (Main.tile[num165, num166 + 1] == null) + { + Main.tile[num165, num166 + 1] = new Tile(); + } + if (Main.tile[num165 - num164, num166 - 3] == null) + { + Main.tile[num165 - num164, num166 - 3] = new Tile(); + } + if ((float)(num165 * 16) < position2.X + (float)npc.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].type] && !Main.tileSolidTop[(int)Main.tile[num165, num166].type]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].type] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].type]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].type]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].type]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].type])) + { + float num167 = (float)(num166 * 16); + if (Main.tile[num165, num166].halfBrick()) + { + num167 += 8f; + } + if (Main.tile[num165, num166 - 1].halfBrick()) + { + num167 -= 8f; + } + if (num167 < position2.Y + (float)npc.height) + { + float num168 = position2.Y + (float)npc.height - num167; + float num169 = 16.1f; + if (num168 <= num169) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num167; + npc.position.Y = num167 - (float)npc.height; + if (num168 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (flag22) + { + int num170 = (int)((npc.position.X + (float)(npc.width / 2) + (float)(15 * npc.direction)) / 16f); + int num171 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num170, num171] == null) + { + Main.tile[num170, num171] = new Tile(); + } + if (Main.tile[num170, num171 - 1] == null) + { + Main.tile[num170, num171 - 1] = new Tile(); + } + if (Main.tile[num170, num171 - 2] == null) + { + Main.tile[num170, num171 - 2] = new Tile(); + } + if (Main.tile[num170, num171 - 3] == null) + { + Main.tile[num170, num171 - 3] = new Tile(); + } + if (Main.tile[num170, num171 + 1] == null) + { + Main.tile[num170, num171 + 1] = new Tile(); + } + if (Main.tile[num170 + npc.direction, num171 - 1] == null) + { + Main.tile[num170 + npc.direction, num171 - 1] = new Tile(); + } + if (Main.tile[num170 + npc.direction, num171 + 1] == null) + { + Main.tile[num170 + npc.direction, num171 + 1] = new Tile(); + } + if (Main.tile[num170 - npc.direction, num171 + 1] == null) + { + Main.tile[num170 - npc.direction, num171 + 1] = new Tile(); + } + Main.tile[num170, num171 + 1].halfBrick(); + if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].type == 10 || Main.tile[num170, num171 - 1].type == 388)) & flag5) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + if (npc.ai[2] >= 60f) + { + npc.velocity.X = 0.5f * (float)(-(float)npc.direction); + int num172 = 5; + if (Main.tile[num170, num171 - 1].type == 388) + { + num172 = 2; + } + npc.ai[1] += (float)num172; + npc.ai[2] = 0f; + bool flag23 = false; + if (npc.ai[1] >= 10f) + { + flag23 = true; + npc.ai[1] = 10f; + } + WorldGen.KillTile(num170, num171 - 1, true, false, false); + if ((Main.netMode != NetmodeID.MultiplayerClient || !flag23) && flag23 && Main.netMode != NetmodeID.MultiplayerClient) + { + if (Main.tile[num170, num171 - 1].type == 10) + { + bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, npc.direction); + if (!flag24) + { + npc.ai[3] = (float)num35; + npc.netUpdate = true; + } + if (Main.netMode == NetmodeID.Server & flag24) + { + NetMessage.SendData(19, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)npc.direction, 0, 0, 0); + } + } + if (Main.tile[num170, num171 - 1].type == 388) + { + bool flag25 = WorldGen.ShiftTallGate(num170, num171 - 1, false); + if (!flag25) + { + npc.ai[3] = (float)num35; + npc.netUpdate = true; + } + if (Main.netMode == NetmodeID.Server & flag25) + { + NetMessage.SendData(19, -1, -1, null, 4, (float)num170, (float)(num171 - 1), 0f, 0, 0, 0); + } + } + } + } + } + else + { + int num173 = npc.spriteDirection; + if ((npc.velocity.X < 0f && num173 == -1) || (npc.velocity.X > 0f && num173 == 1)) + { + if (npc.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].type]) + { + if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].type]) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + } + else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].type]) + { + npc.velocity.Y = -5f; + npc.netUpdate = true; + } + else if (npc.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].type]) && (!Main.tile[num170 + npc.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + npc.direction, num171 + 1].type])) + { + npc.velocity.Y = -8f; + npc.velocity.X = npc.velocity.X * 1.5f; + npc.netUpdate = true; + } + else if (flag5) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + if ((npc.velocity.Y == 0f & flag3) && npc.ai[3] == 1f) + { + npc.velocity.Y = -5f; + } + } + } + } + else if (flag5) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + + public override void FindFrame(int frameHeight) + { + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 18f) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y < frameHeight * 5) + npc.frame.Y = frameHeight * 5; + if (npc.frame.Y > frameHeight * 9) + npc.frame.Y = frameHeight * 5; + } + else + { + npc.frameCounter += (double)Math.Abs(npc.velocity.X); + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.velocity.Y == 0f) + { + if (npc.direction == 1) + npc.spriteDirection = 1; + if (npc.direction == -1) + npc.spriteDirection = -1; + } + else + { + npc.frameCounter = 0.0; + npc.frame.Y = frameHeight; + return; + } + if (npc.velocity.X == 0f) + { + npc.frameCounter = 0.0; + npc.frame.Y = 0; + } + else + { + if (npc.frame.Y > frameHeight * 4) + npc.frame.Y = 0; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.raining || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDayRain.Chance * 0.05f; + } public override void HitEffect(int hitDirection, double damage) - { + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); @@ -432,13 +430,13 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TinHelmet); + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TinHelmet); if (Main.hardMode) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagicDagger); } } - } + } } diff --git a/NPCs/NormalNPCs/HeatSpirit.cs b/NPCs/NormalNPCs/HeatSpirit.cs index 2a59f29249..3cfb0763a7 100644 --- a/NPCs/NormalNPCs/HeatSpirit.cs +++ b/NPCs/NormalNPCs/HeatSpirit.cs @@ -1,5 +1,4 @@ using System; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,95 +6,95 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class HeatSpirit : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heat Spirit"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = 86; - npc.damage = 33; - npc.width = 40; - npc.height = 40; - npc.defense = 8; - npc.lifeMax = 50; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - banner = npc.type; - bannerItem = mod.ItemType("HeatSpiritBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Underworld.Chance * 0.065f; - } - - public override void FindFrame(int frameHeight) + { + public override void SetStaticDefaults() { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - if (npc.direction == 1) - { - npc.spriteDirection = 1; - } - if (npc.direction == -1) - { - npc.spriteDirection = -1; - } - npc.rotation = (float)Math.Atan2((double)(npc.velocity.Y * (float)npc.direction), (double)(npc.velocity.X * (float)npc.direction)); + DisplayName.SetDefault("Heat Spirit"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = 86; + npc.damage = 33; + npc.width = 40; + npc.height = 40; + npc.defense = 8; + npc.lifeMax = 50; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + banner = npc.type; + bannerItem = mod.ItemType("HeatSpiritBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode) + { + return 0f; + } + return SpawnCondition.Underworld.Chance * 0.065f; + } + + public override void FindFrame(int frameHeight) + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + if (npc.direction == 1) + { + npc.spriteDirection = 1; + } + if (npc.direction == -1) + { + npc.spriteDirection = -1; + } + npc.rotation = (float)Math.Atan2((double)(npc.velocity.Y * (float)npc.direction), (double)(npc.velocity.X * (float)npc.direction)); npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; int frame = (int)npc.frameCounter; npc.frame.Y = frame * frameHeight; } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0f, 0.05f); - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0f, 0.05f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + } } diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 8917fc4422..5fdb714121 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -1,246 +1,245 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class Horse : ModNPC - { - private int chargetimer = 0; - private int basespeed = 1; + { + private int chargetimer = 0; + private int basespeed = 1; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth Elemental"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth Elemental"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 50; - npc.width = 230; - npc.height = 230; - npc.defense = 20; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 50; + npc.width = 230; + npc.height = 230; + npc.defense = 20; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 3800; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 1, 50, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("EarthElementalBanner"); - } + npc.lifeMax = 3800; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 1, 50, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("EarthElementalBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(chargetimer); - writer.Write(basespeed); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(chargetimer); + writer.Write(basespeed); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - chargetimer = reader.ReadInt32(); - basespeed = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + chargetimer = reader.ReadInt32(); + basespeed = reader.ReadInt32(); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.005f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.005f; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter++; - if (npc.frameCounter >= 8) - { - npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight); - npc.frameCounter = 0; - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 8) + { + npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight); + npc.frameCounter = 0; + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AridArtifact")); - } - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlagMagnum")); - } - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Aftershock")); - } - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EarthenPike")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AridArtifact")); + } + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlagMagnum")); + } + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Aftershock")); + } + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EarthenPike")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 31, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 160; - npc.height = 160; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 31, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 160; + npc.height = 160; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } - public override bool PreAI() - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - Main.PlaySound(3, (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)(npc.height / 2)), 41); - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = 4f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 30; - int num185 = mod.ProjectileType("EarthRockSmall"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 4; num186++) - { - num185 = (Main.rand.NextBool(4) ? mod.ProjectileType("EarthRockBig") : mod.ProjectileType("EarthRockSmall")); - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-40, 41); - num182 += (float)Main.rand.Next(-40, 41); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - if ((double)Math.Abs(npc.velocity.X) > 0.2) - { - npc.spriteDirection = npc.direction; - } - bool expertMode = Main.expertMode; - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - chargetimer += expertMode ? 2 : 1; - if (chargetimer >= Math.Sqrt(npc.life) * 14.0) - { - if (Main.rand.Next(25) == 1) - { - direction.X *= 6f; - direction.Y *= 6f; - npc.velocity = direction; - chargetimer = 0; - } - } - if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) > basespeed) - { - npc.velocity *= 0.985f; - } - if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) <= basespeed * 1.15) - { - npc.velocity = direction * basespeed; - } - return false; + public override bool PreAI() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + Main.PlaySound(3, (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)(npc.height / 2)), 41); + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num179 = 4f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = 30; + int num185 = mod.ProjectileType("EarthRockSmall"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 4; num186++) + { + num185 = (Main.rand.NextBool(4) ? mod.ProjectileType("EarthRockBig") : mod.ProjectileType("EarthRockSmall")); + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-40, 41); + num182 += (float)Main.rand.Next(-40, 41); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + if ((double)Math.Abs(npc.velocity.X) > 0.2) + { + npc.spriteDirection = npc.direction; + } + bool expertMode = Main.expertMode; + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + chargetimer += expertMode ? 2 : 1; + if (chargetimer >= Math.Sqrt(npc.life) * 14.0) + { + if (Main.rand.Next(25) == 1) + { + direction.X *= 6f; + direction.Y *= 6f; + npc.velocity = direction; + chargetimer = 0; + } + } + if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) > basespeed) + { + npc.velocity *= 0.985f; + } + if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) <= basespeed * 1.15) + { + npc.velocity = direction * basespeed; + } + return false; - } - } + } + } } diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index 2ecc121297..3f1954fe2d 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -1,41 +1,40 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class IceClasper : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Clasper"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Clasper"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.npcSlots = 3f; npc.noGravity = true; - npc.damage = 32; - npc.width = 40; - npc.height = 40; - npc.defense = 12; - npc.lifeMax = 600; - npc.knockBackResist = 0.35f; + npc.damage = 32; + npc.width = 40; + npc.height = 40; + npc.defense = 12; + npc.lifeMax = 600; + npc.knockBackResist = 0.35f; npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.coldDamage = true; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.coldDamage = true; npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("IceClasperBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("IceClasperBanner"); + } public override void AI() { @@ -234,13 +233,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { return spawnInfo.player.ZoneSnow && - !spawnInfo.player.ZoneTowerStardust && - !spawnInfo.player.ZoneTowerSolar && - !spawnInfo.player.ZoneTowerVortex && - !spawnInfo.player.ZoneTowerNebula && + !spawnInfo.player.ZoneTowerStardust && + !spawnInfo.player.ZoneTowerSolar && + !spawnInfo.player.ZoneTowerVortex && + !spawnInfo.player.ZoneTowerNebula && !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.Calamity().ZoneSunkenSea && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; + !spawnInfo.player.Calamity().ZoneSunkenSea && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -252,24 +251,24 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); if (Main.rand.NextBool(10)) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FrostBarrier")); @@ -279,5 +278,5 @@ namespace CalamityMod.NPCs.NormalNPCs Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientIceChunk")); } } - } + } } diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index dbbd84abb8..04528f7faf 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,284 +8,284 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class ImpiousImmolator : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Impious Immolator"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Impious Immolator"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 0; - npc.width = 60; - npc.height = 60; - npc.defense = 30; - npc.lifeMax = 11000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.knockBackResist = 0.2f; - banner = npc.type; - bannerItem = mod.ItemType("ImpiousImmolatorBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 0; + npc.width = 60; + npc.height = 60; + npc.defense = 30; + npc.lifeMax = 11000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.knockBackResist = 0.2f; + banner = npc.type; + bannerItem = mod.ItemType("ImpiousImmolatorBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (!npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; - if (npc.velocity.X > 12f) - { - npc.velocity.X = 12f; - } - if (npc.velocity.X < -12f) - { - npc.velocity.X = -12f; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -12f; - } - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 90f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 12f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 55; - if (Main.expertMode) - { - damage = 42; - } - int beam = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("FlameBurstHostile"), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].tileCollide = true; - } - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -3f || npc.velocity.X > 3f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid < 128) //problem? - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 5f) - { - npc.velocity.Y = 5f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.1) - { - npc.rotation = -0.1f; - } - if ((double)npc.rotation > 0.1) - { - npc.rotation = 0.1f; - return; - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (!npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if ((Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; + if (npc.velocity.X > 12f) + { + npc.velocity.X = 12f; + } + if (npc.velocity.X < -12f) + { + npc.velocity.X = -12f; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -12f; + } + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 90f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 12f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 55; + if (Main.expertMode) + { + damage = 42; + } + int beam = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("FlameBurstHostile"), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].tileCollide = true; + } + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -3f || npc.velocity.X > 3f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid < 128) //problem? + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 5f) + { + npc.velocity.Y = 5f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.1) + { + npc.rotation = -0.1f; + } + if ((double)npc.rotation > 0.1) + { + npc.rotation = 0.1f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedMoonlord) - { - return 0f; - } - if (SpawnCondition.Underworld.Chance > 0f) - { - return SpawnCondition.Underworld.Chance / 4f; - } - return SpawnCondition.OverworldHallow.Chance / 4f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord) + { + return 0f; + } + if (SpawnCondition.Underworld.Chance > 0f) + { + return SpawnCondition.Underworld.Chance / 4f; + } + return SpawnCondition.OverworldHallow.Chance / 4f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 180, true); - player.AddBuff(mod.BuffType("HolyLight"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 180, true); + player.AddBuff(mod.BuffType("HolyLight"), 180, true); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); - if (Main.rand.NextBool(15)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EnergyStaff")); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); + if (Main.rand.NextBool(15)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EnergyStaff")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/IrradiatedSlime.cs b/NPCs/NormalNPCs/IrradiatedSlime.cs index f68df6a674..c232fc9e0e 100644 --- a/NPCs/NormalNPCs/IrradiatedSlime.cs +++ b/NPCs/NormalNPCs/IrradiatedSlime.cs @@ -1,94 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class IrradiatedSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Irradiated Slime"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Irradiated Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 50; - npc.width = 40; - npc.height = 30; - npc.defense = 10; - npc.lifeMax = 300; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("IrradiatedSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 50; + npc.width = 40; + npc.height = 30; + npc.defense = 10; + npc.lifeMax = 300; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("IrradiatedSlimeBanner"); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining) - { - return 0f; - } - return 0.05f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining) + { + return 0f; + } + return 0.05f; + } - /*public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Width, (float)(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - }*/ + /*public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Width, (float)(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + }*/ - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime2"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime2"), 1f); + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeadCore")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(10)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeadCore")); + } + } + } } diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 8505780dea..458f9f9693 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -1,152 +1,150 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Projectiles; namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewel : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crown Jewel"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crown Jewel"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 22; - npc.height = 22; - npc.lifeMax = 999; - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.DeathSound = SoundID.NPCDeath39; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 22; + npc.height = 22; + npc.lifeMax = 999; + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.noGravity = true; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.DeathSound = SoundID.NPCDeath39; + } - public override void AI() - { - // Red light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + public override void AI() + { + // Red light + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); - // Despawn - if (!NPC.AnyNPCs(NPCID.KingSlime)) - { - npc.active = false; - npc.netUpdate = true; - return; - } + // Despawn + if (!NPC.AnyNPCs(NPCID.KingSlime)) + { + npc.active = false; + npc.netUpdate = true; + return; + } - // Float around the player - npc.rotation = npc.velocity.X / 15f; + // Float around the player + npc.rotation = npc.velocity.X / 15f; - npc.TargetClosest(true); + npc.TargetClosest(true); - float velocity = CalamityWorld.bossRushActive ? 8f : 2f; - float acceleration = CalamityWorld.bossRushActive ? 0.4f : 0.1f; + float velocity = CalamityWorld.bossRushActive ? 8f : 2f; + float acceleration = CalamityWorld.bossRushActive ? 0.4f : 0.1f; - if (npc.position.Y > Main.player[npc.target].position.Y - 350f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + if (npc.position.Y > Main.player[npc.target].position.Y - 350f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y - acceleration; + npc.velocity.Y = npc.velocity.Y - acceleration; - if (npc.velocity.Y > velocity) - npc.velocity.Y = velocity; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 400f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + if (npc.velocity.Y > velocity) + npc.velocity.Y = velocity; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - 400f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y + acceleration; + npc.velocity.Y = npc.velocity.Y + acceleration; - if (npc.velocity.Y < -velocity) - npc.velocity.Y = -velocity; - } + if (npc.velocity.Y < -velocity) + npc.velocity.Y = -velocity; + } - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X - acceleration; + npc.velocity.X = npc.velocity.X - acceleration; - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X + acceleration; + npc.velocity.X = npc.velocity.X + acceleration; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } - // Fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Fire bolt every 1.5 seconds - npc.localAI[0] += (CalamityWorld.bossRushActive ? 2f : 1f); - if (npc.localAI[0] >= (CalamityWorld.death ? 60f : 75f)) - { - npc.localAI[0] = 0f; + // Fire projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Fire bolt every 1.5 seconds + npc.localAI[0] += (CalamityWorld.bossRushActive ? 2f : 1f); + if (npc.localAI[0] >= (CalamityWorld.death ? 60f : 75f)) + { + npc.localAI[0] = 0f; - Vector2 vector62 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num506 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector62.X; - float num507 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector62.Y; - float num508 = (float)Math.Sqrt((double)(num506 * num506 + num507 * num507)); + Vector2 vector62 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num506 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector62.X; + float num507 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector62.Y; + float num508 = (float)Math.Sqrt((double)(num506 * num506 + num507 * num507)); - float num509 = CalamityWorld.bossRushActive ? 18f : 9f; - int num510 = 11; - int num511 = ProjectileID.RubyBolt; + float num509 = CalamityWorld.bossRushActive ? 18f : 9f; + int num510 = 11; + int num511 = ProjectileID.RubyBolt; - num508 = num509 / num508; - num506 *= num508; - num507 *= num508; - vector62.X += num506 * 2f; - vector62.Y += num507 * 2f; + num508 = num509 / num508; + num506 *= num508; + num507 *= num508; + vector62.X += num506 * 2f; + vector62.Y += num507 * 2f; - for (int num621 = 0; num621 < 10; num621++) - { - Vector2 velocity2 = new Vector2(num506, num507); - velocity2.Normalize(); - int num622 = Dust.NewDust(npc.Center, npc.width, npc.height, 90, velocity2.X, velocity2.Y, 100, default, 2f); - Main.dust[num622].velocity *= 1.5f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 8); + for (int num621 = 0; num621 < 10; num621++) + { + Vector2 velocity2 = new Vector2(num506, num507); + velocity2.Normalize(); + int num622 = Dust.NewDust(npc.Center, npc.width, npc.height, 90, velocity2.X, velocity2.Y, 100, default, 2f); + Main.dust[num622].velocity *= 1.5f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 8); - int proj = Projectile.NewProjectile(vector62.X, vector62.Y, num506, num507, num511, num510, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].Calamity().forceHostile = true; - } - } - } + int proj = Projectile.NewProjectile(vector62.X, vector62.Y, num506, num507, num511, num510, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].Calamity().forceHostile = true; + } + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(255, 50, 50, 0); - } - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, 50, 50, 0); + } + } } diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index bda612f95e..7f21b7a875 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -1,37 +1,35 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class OverloadedSoldier : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Overloaded Soldier"); - Main.npcFrameCount[npc.type] = 15; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Overloaded Soldier"); + Main.npcFrameCount[npc.type] = 15; + } - public override void SetDefaults() - { - npc.aiStyle = 3; - npc.damage = 42; - npc.width = 18; - npc.height = 40; - npc.defense = 18; + public override void SetDefaults() + { + npc.aiStyle = 3; + npc.damage = 42; + npc.width = 18; + npc.height = 40; + npc.defense = 18; npc.Calamity().RevPlusDR(0.15f); npc.lifeMax = 90; - npc.knockBackResist = 0.5f; - animationType = 77; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath2; - banner = npc.type; - bannerItem = mod.ItemType("OverloadedSoldierBanner"); - } + npc.knockBackResist = 0.5f; + animationType = 77; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit2; + npc.DeathSound = SoundID.NPCDeath2; + banner = npc.type; + bannerItem = mod.ItemType("OverloadedSoldierBanner"); + } public override void AI() { @@ -41,7 +39,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } @@ -57,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void HitEffect(int hitDirection, double damage) - { + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); @@ -71,13 +69,13 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); if (NPC.downedMoonlord) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); } } - } + } } diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index fa47b49db9..076ab46fd9 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -1,68 +1,66 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PerennialSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perennial Slime"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perennial Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 35; - npc.width = 40; - npc.height = 30; - npc.defense = 12; - npc.lifeMax = 150; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("PerennialSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 35; + npc.width = 40; + npc.height = 30; + npc.defense = 12; + npc.lifeMax = 150; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("PerennialSlimeBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.08f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.08f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerennialOre"), Main.rand.Next(10, 27)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerennialOre"), Main.rand.Next(10, 27)); + } + } } diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index d0282e98d5..841817ff8b 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -1,37 +1,35 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PhantomDebris : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Debris"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Debris"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 44; - npc.height = 22; - npc.defense = 20; + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 44; + npc.height = 22; + npc.defense = 20; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 80; + npc.lifeMax = 80; npc.aiStyle = 3; aiType = 67; npc.knockBackResist = 0.5f; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("PhantomDebrisBanner"); - } + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit2; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("PhantomDebrisBanner"); + } public override void FindFrame(int frameHeight) { @@ -88,7 +86,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; } @@ -104,7 +102,7 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void HitEffect(int hitDirection, double damage) - { + { for (int k = 0; k < 3; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); @@ -118,13 +116,13 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); if (NPC.downedMoonlord) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); } - } - } + } + } } diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 54fe3a2742..1f36f1ffb2 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -1,97 +1,97 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { public class PhantomSpirit : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 3; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 3; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 70; - npc.width = 16; - npc.height = 16; - npc.defense = 10; - npc.lifeMax = 1000; - npc.knockBackResist = 0.1f; - animationType = 288; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 70; + npc.width = 16; + npc.height = 16; + npc.defense = 10; + npc.lifeMax = 1000; + npc.knockBackResist = 0.1f; + animationType = 288; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 20, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = npc.type; + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } - public override void AI() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 17f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - return; - } + public override void AI() + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 17f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + return; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); + } + } } diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 084513cf75..c31da30144 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -1,39 +1,39 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { public class PhantomSpiritL : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 32; - npc.height = 32; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 100; + npc.width = 32; + npc.height = 32; npc.scale = 1.2f; - npc.defense = 40; - npc.lifeMax = 9000; - npc.knockBackResist = 0f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 60, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = mod.NPCType("PhantomSpirit"); - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } + npc.defense = 40; + npc.lifeMax = 9000; + npc.knockBackResist = 0f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 60, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = mod.NPCType("PhantomSpirit"); + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } public override void FindFrame(int frameHeight) { @@ -44,24 +44,24 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void AI() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 12f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 12f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; @@ -100,43 +100,43 @@ namespace CalamityMod.NPCs.NormalNPCs int num154 = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); } } - } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 790435cc9c..b60c4ebfac 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -1,39 +1,39 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { public class PhantomSpiritM : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 90; - npc.width = 32; - npc.height = 32; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 90; + npc.width = 32; + npc.height = 32; npc.scale = 1.1f; - npc.defense = 30; - npc.lifeMax = 2100; - npc.knockBackResist = 0.1f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 40, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = mod.NPCType("PhantomSpirit"); - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } + npc.defense = 30; + npc.lifeMax = 2100; + npc.knockBackResist = 0.1f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 40, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = mod.NPCType("PhantomSpirit"); + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } public override void FindFrame(int frameHeight) { @@ -44,62 +44,62 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void AI() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 13.5f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - return; - } + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 13.5f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + return; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 150); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 150); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 4)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 4)); + } + } } diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index e5752a08a8..e40c8cf0f3 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -1,38 +1,38 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { public class PhantomSpiritS : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 80; - npc.width = 32; - npc.height = 32; - npc.defense = 20; - npc.lifeMax = 1500; - npc.knockBackResist = 0.1f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = mod.NPCType("PhantomSpirit"); - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 80; + npc.width = 32; + npc.height = 32; + npc.defense = 20; + npc.lifeMax = 1500; + npc.knockBackResist = 0.1f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 30, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = mod.NPCType("PhantomSpirit"); + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } public override void FindFrame(int frameHeight) { @@ -43,62 +43,62 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void AI() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 15f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - return; - } + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 15f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + return; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 150); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 150); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 3)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 3)); + } + } } diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index bbb35718b2..8e7a0c63c3 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -1,102 +1,100 @@ using System; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class Piggy : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Piggy"); - Main.npcFrameCount[npc.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piggy"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.chaseable = false; - npc.aiStyle = 26; - npc.damage = 0; - npc.width = 26; - npc.height = 26; - npc.lifeMax = 2000; - npc.aiStyle = 7; - aiType = 299; - npc.knockBackResist = 0.99f; - npc.value = Item.buyPrice(0, 10, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("PiggyBanner"); - } + public override void SetDefaults() + { + npc.chaseable = false; + npc.aiStyle = 26; + npc.damage = 0; + npc.width = 26; + npc.height = 26; + npc.lifeMax = 2000; + npc.aiStyle = 7; + aiType = 299; + npc.knockBackResist = 0.99f; + npc.value = Item.buyPrice(0, 10, 0, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("PiggyBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSulphur || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.TownCritter.Chance * 0.01f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSulphur || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.TownCritter.Chance * 0.01f; + } - public override void FindFrame(int frameHeight) - { - if (npc.velocity.Y == 0f) - { - if (npc.direction == 1) - { - npc.spriteDirection = -1; - } - if (npc.direction == -1) - { - npc.spriteDirection = 1; - } - if (npc.velocity.X == 0f) - { - npc.frame.Y = 0; - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += (double)(Math.Abs(npc.velocity.X) * 0.25f); - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y / frameHeight >= Main.npcFrameCount[npc.type] - 1) - { - npc.frame.Y = frameHeight; - } - } - else - { - npc.frameCounter = 0.0; - npc.frame.Y = frameHeight * 2; - } - } + public override void FindFrame(int frameHeight) + { + if (npc.velocity.Y == 0f) + { + if (npc.direction == 1) + { + npc.spriteDirection = -1; + } + if (npc.direction == -1) + { + npc.spriteDirection = 1; + } + if (npc.velocity.X == 0f) + { + npc.frame.Y = 0; + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += (double)(Math.Abs(npc.velocity.X) * 0.25f); + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y / frameHeight >= Main.npcFrameCount[npc.type] - 1) + { + npc.frame.Y = frameHeight; + } + } + else + { + npc.frameCounter = 0.0; + npc.frame.Y = frameHeight * 2; + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bacon); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bacon); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs index 5e261c3579..3c3d7ca217 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Pitbull.cs @@ -1,64 +1,62 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class Pitbull : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pitbull"); - Main.npcFrameCount[npc.type] = 10; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pitbull"); + Main.npcFrameCount[npc.type] = 10; + } - public override void SetDefaults() - { - npc.aiStyle = 26; - npc.damage = 18; - npc.width = 46; - npc.height = 30; - npc.defense = 4; - npc.lifeMax = 60; - npc.knockBackResist = 0.3f; - animationType = 329; - aiType = NPCID.Wolf; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - banner = npc.type; - bannerItem = mod.ItemType("PitbullBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 26; + npc.damage = 18; + npc.width = 46; + npc.height = 30; + npc.defense = 4; + npc.lifeMax = 60; + npc.knockBackResist = 0.3f; + animationType = 329; + aiType = NPCID.Wolf; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath5; + banner = npc.type; + bannerItem = mod.ItemType("PitbullBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldNightMonster.Chance * 0.045f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.045f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/NormalNPCs/PlagueBee.cs index ccd34dac1a..20cced37db 100644 --- a/NPCs/NormalNPCs/PlagueBee.cs +++ b/NPCs/NormalNPCs/PlagueBee.cs @@ -1,83 +1,81 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PlagueBee : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 37; - npc.width = 36; - npc.height = 30; - npc.defense = 20; - npc.scale = 0.5f; - npc.lifeMax = 200; - npc.aiStyle = 5; - aiType = 210; - npc.knockBackResist = 0f; - animationType = 210; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("PlagueChargerBanner"); - } + public override void SetDefaults() + { + npc.damage = 37; + npc.width = 36; + npc.height = 30; + npc.defense = 20; + npc.scale = 0.5f; + npc.lifeMax = 200; + npc.aiStyle = 5; + aiType = 210; + npc.knockBackResist = 0f; + animationType = 210; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = npc.type; + bannerItem = mod.ItemType("PlagueChargerBanner"); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.12f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.12f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/NormalNPCs/PlagueBeeLarge.cs index 847b8927dd..d84712f26b 100644 --- a/NPCs/NormalNPCs/PlagueBeeLarge.cs +++ b/NPCs/NormalNPCs/PlagueBeeLarge.cs @@ -1,83 +1,81 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PlagueBeeLarge : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 45; - npc.width = 36; - npc.height = 30; - npc.defense = 25; - npc.scale = 0.75f; - npc.lifeMax = 300; - npc.aiStyle = 5; - aiType = 210; - npc.knockBackResist = 0f; - animationType = 210; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = mod.NPCType("PlagueBee"); - bannerItem = mod.ItemType("PlagueChargerBanner"); - } + public override void SetDefaults() + { + npc.damage = 45; + npc.width = 36; + npc.height = 30; + npc.defense = 25; + npc.scale = 0.75f; + npc.lifeMax = 300; + npc.aiStyle = 5; + aiType = 210; + npc.knockBackResist = 0f; + animationType = 210; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = mod.NPCType("PlagueBee"); + bannerItem = mod.ItemType("PlagueChargerBanner"); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(2, 4)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(2, 4)); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.12f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.12f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs index 73ebb460cb..3c7dc5ab54 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -1,34 +1,33 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PlaguedDerpling : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viruling"); - Main.npcFrameCount[npc.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viruling"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.noGravity = true; npc.aiStyle = -1; aiType = -1; - npc.damage = 60; - npc.width = 58; - npc.height = 44; - npc.defense = 18; - npc.lifeMax = 400; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit22; - npc.DeathSound = SoundID.NPCDeath25; + npc.damage = 60; + npc.width = 58; + npc.height = 44; + npc.defense = 18; + npc.lifeMax = 400; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit22; + npc.DeathSound = SoundID.NPCDeath25; npc.buffImmune[189] = true; npc.buffImmune[153] = true; npc.buffImmune[70] = true; @@ -40,19 +39,19 @@ namespace CalamityMod.NPCs.NormalNPCs npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; npc.buffImmune[mod.BuffType("HolyLight")] = true; npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("VirulingBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("VirulingBanner"); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() + public override void AI() { if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { @@ -153,7 +152,7 @@ namespace CalamityMod.NPCs.NormalNPCs } public override float SpawnChance(NPCSpawnInfo spawnInfo) - { + { if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; @@ -161,32 +160,32 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.HardmodeJungle.Chance * 0.09f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { + public override void OnHitPlayer(Player player, int damage, bool crit) + { player.AddBuff(mod.BuffType("Plague"), 300, true); } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling3"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling3"), 1f); + } + } - public override void NPCLoot() - { + public override void NPCLoot() + { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); } - } + } } diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.cs b/NPCs/NormalNPCs/PlaguedFlyingFox.cs index 4b66a4b043..f356e9f176 100644 --- a/NPCs/NormalNPCs/PlaguedFlyingFox.cs +++ b/NPCs/NormalNPCs/PlaguedFlyingFox.cs @@ -1,34 +1,32 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PlaguedFlyingFox : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Melter"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Melter"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.npcSlots = 0.5f; npc.aiStyle = 14; aiType = 152; animationType = 152; - npc.damage = 55; - npc.width = 38; - npc.height = 34; - npc.defense = 15; - npc.lifeMax = 500; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath4; + npc.damage = 55; + npc.width = 38; + npc.height = 34; + npc.defense = 15; + npc.lifeMax = 500; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath4; npc.buffImmune[189] = true; npc.buffImmune[153] = true; npc.buffImmune[70] = true; @@ -40,12 +38,12 @@ namespace CalamityMod.NPCs.NormalNPCs npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; npc.buffImmune[mod.BuffType("HolyLight")] = true; npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("MelterBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("MelterBanner"); + } public override float SpawnChance(NPCSpawnInfo spawnInfo) - { + { if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) { return 0f; @@ -53,29 +51,29 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.HardmodeJungle.Chance * 0.09f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { + public override void OnHitPlayer(Player player, int damage, bool crit) + { player.AddBuff(mod.BuffType("Plague"), 300, true); } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { + public override void NPCLoot() + { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); } - } + } } diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index d5510c550e..4a712320c3 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -1,39 +1,38 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PlaguedJungleSlime : ModNPC - { - public float spikeTimer = 60f; + { + public float spikeTimer = 60f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pestilent Slime"); - Main.npcFrameCount[npc.type] = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pestilent Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 55; - npc.width = 40; - npc.height = 30; - npc.defense = 12; - npc.lifeMax = 350; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 55; + npc.width = 40; + npc.height = 30; + npc.defense = 12; + npc.lifeMax = 350; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; npc.buffImmune[189] = true; npc.buffImmune[153] = true; npc.buffImmune[70] = true; @@ -45,65 +44,65 @@ namespace CalamityMod.NPCs.NormalNPCs npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; npc.buffImmune[mod.BuffType("HolyLight")] = true; npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("PestilentSlimeBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("PestilentSlimeBanner"); + } - public override void AI() - { - if (spikeTimer > 0f) - { - spikeTimer -= 1f; - } - if (!npc.wet && !Main.player[npc.target].Calamity().royalGel) - { - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; - float num15 = Main.player[npc.target].position.Y - vector3.Y; - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) - { + public override void AI() + { + if (spikeTimer > 0f) + { + spikeTimer -= 1f; + } + if (!npc.wet && !Main.player[npc.target].Calamity().royalGel) + { + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; + float num15 = Main.player[npc.target].position.Y - vector3.Y; + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) + { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); for (int n = 0; n < 5; n++) - { - Vector2 vector4 = new Vector2((float)(n - 2), -4f); - vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Normalize(); - vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; - Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("PlagueStingerGoliathV2"), 25, 0f, Main.myPlayer, 0f, 0f); - spikeTimer = 30f; - } - } - } - else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) - { + { + Vector2 vector4 = new Vector2((float)(n - 2), -4f); + vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Normalize(); + vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; + Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("PlagueStingerGoliathV2"), 25, 0f, Main.myPlayer, 0f, 0f); + spikeTimer = 30f; + } + } + } + else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) + { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); - num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - num16 = 6.5f / num16; - num14 *= num16; - num15 *= num16; - spikeTimer = 50f; - Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("PlagueStingerGoliathV2"), 22, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } + num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + num16 = 6.5f / num16; + num14 *= num16; + num15 *= num16; + spikeTimer = 50f; + Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("PlagueStingerGoliathV2"), 22, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { @@ -115,28 +114,28 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { + public override void NPCLoot() + { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); } - public override void OnHitPlayer(Player player, int damage, bool crit) - { + public override void OnHitPlayer(Player player, int damage, bool crit) + { player.AddBuff(mod.BuffType("Plague"), 300, true); } - } + } } diff --git a/NPCs/NormalNPCs/PlaguedTortoise.cs b/NPCs/NormalNPCs/PlaguedTortoise.cs index aef0d5af1f..4ec405857c 100644 --- a/NPCs/NormalNPCs/PlaguedTortoise.cs +++ b/NPCs/NormalNPCs/PlaguedTortoise.cs @@ -1,34 +1,32 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class PlaguedTortoise : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plagueshell"); - Main.npcFrameCount[npc.type] = 8; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plagueshell"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.npcSlots = 2f; - npc.damage = 80; - npc.aiStyle = 39; - npc.width = 46; - npc.height = 32; - npc.defense = 32; - npc.lifeMax = 800; - npc.knockBackResist = 0.2f; - animationType = 153; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.noGravity = false; + public override void SetDefaults() + { + npc.npcSlots = 2f; + npc.damage = 80; + npc.aiStyle = 39; + npc.width = 46; + npc.height = 32; + npc.defense = 32; + npc.lifeMax = 800; + npc.knockBackResist = 0.2f; + animationType = 153; + npc.value = Item.buyPrice(0, 0, 20, 0); + npc.HitSound = SoundID.NPCHit24; + npc.DeathSound = SoundID.NPCDeath27; + npc.noGravity = false; npc.buffImmune[189] = true; npc.buffImmune[153] = true; npc.buffImmune[70] = true; @@ -40,24 +38,24 @@ namespace CalamityMod.NPCs.NormalNPCs npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; npc.buffImmune[mod.BuffType("HolyLight")] = true; npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("PlagueshellBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("PlagueshellBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { @@ -70,12 +68,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(mod.BuffType("Plague"), 300, true); - } + player.AddBuff(mod.BuffType("Plague"), 300, true); + } - public override void NPCLoot() - { + public override void NPCLoot() + { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(3, 5)); } - } + } } diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index adddb13030..9eb750d7eb 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -1,85 +1,84 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class ProfanedEnergyBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Energy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Energy"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.npcSlots = 3f; - npc.width = 72; - npc.height = 36; - npc.defense = 50; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.npcSlots = 3f; + npc.width = 72; + npc.height = 36; + npc.defense = 50; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 6000; - npc.knockBackResist = 0f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.lavaImmune = true; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - banner = npc.type; - bannerItem = mod.ItemType("ProfanedEnergyBanner"); - } + npc.lifeMax = 6000; + npc.knockBackResist = 0f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.lavaImmune = true; + npc.noGravity = true; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + banner = npc.type; + bannerItem = mod.ItemType("ProfanedEnergyBanner"); + } - public override void AI() - { - CalamityGlobalNPC.energyFlame = npc.whoAmI; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - for (int num723 = 0; num723 < 2; num723++) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("ProfanedEnergyLantern"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - } + public override void AI() + { + CalamityGlobalNPC.energyFlame = npc.whoAmI; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + for (int num723 = 0; num723 < 2; num723++) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("ProfanedEnergyLantern"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedMoonlord || NPC.AnyNPCs(npc.type)) - { - return 0f; - } - if (SpawnCondition.Underworld.Chance > 0f) - { - return SpawnCondition.Underworld.Chance / 6f; - } - return SpawnCondition.OverworldHallow.Chance / 6f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord || NPC.AnyNPCs(npc.type)) + { + return 0f; + } + if (SpawnCondition.Underworld.Chance > 0f) + { + return SpawnCondition.Underworld.Chance / 6f; + } + return SpawnCondition.OverworldHallow.Chance / 6f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { + public override void NPCLoot() + { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); - } - } + } + } } diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 16c8127228..5404afdbb8 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,171 +8,171 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class ProfanedEnergyLantern : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Energy"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Energy"); Main.npcFrameCount[npc.type] = 6; } - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 60; - npc.width = 30; - npc.height = 30; - npc.lifeMax = 1; - aiType = -1; - npc.lavaImmune = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 60; + npc.width = 30; + npc.height = 30; + npc.lifeMax = 1; + aiType = -1; + npc.lavaImmune = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } - public override void AI() - { - if (CalamityGlobalNPC.energyFlame < 0 || !Main.npc[CalamityGlobalNPC.energyFlame].active) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.energyFlame; - if (npc.ai[3] > 0f) - { - num750 = (int)npc.ai[3] - 1; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - npc.TargetClosest(true); - float num751 = 0.1f; - float num752 = 500f; - if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.25) - { - num752 += 50f; - } - if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.1) - { - num752 += 50f; - } - if (Main.expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 200f; - num751 += 0.15f; - } - if (!Main.npc[num750].active || CalamityGlobalNPC.energyFlame < 0) - { - npc.active = false; - return; - } - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (npc.position.X < num754 + num758) - { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - else if (npc.position.X > num754 + num758) - { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (npc.position.Y < num755 + num759) - { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - else if (npc.position.Y > num755 + num759) - { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - if (npc.velocity.Y > 8f) - { - npc.velocity.Y = 8f; - } - if (npc.velocity.Y < -8f) - { - npc.velocity.Y = -8f; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!Main.player[npc.target].dead) - { - npc.localAI[1] += (float)Main.rand.Next(1, 6); - if (npc.localAI[1] >= 600f) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - float num196 = 11f; - vector22 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num189 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector22.X + (float)Main.rand.Next(-10, 11); - float num197 = Math.Abs(num189 * 0.1f); - if (num190 > 0f) - { - num197 = 0f; - } - num190 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector22.Y + (float)Main.rand.Next(-10, 11) - num197; - num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - num191 = num196 / num191; - num189 *= num191; - num190 *= num191; - int num9 = mod.ProjectileType("HolyBomb"); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num189, num190, num9, 40, 0f, Main.myPlayer, 0f, 0f); - npc.localAI[1] = 0f; - return; - } - npc.localAI[1] = 250f; - } - } - } - } + public override void AI() + { + if (CalamityGlobalNPC.energyFlame < 0 || !Main.npc[CalamityGlobalNPC.energyFlame].active) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + npc.netUpdate = true; + return; + } + int num750 = CalamityGlobalNPC.energyFlame; + if (npc.ai[3] > 0f) + { + num750 = (int)npc.ai[3] - 1; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(120, 480); + npc.ai[0] = (float)Main.rand.Next(-100, 101); + npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + npc.TargetClosest(true); + float num751 = 0.1f; + float num752 = 500f; + if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.25) + { + num752 += 50f; + } + if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.1) + { + num752 += 50f; + } + if (Main.expertMode) + { + float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + num752 += num753 * 200f; + num751 += 0.15f; + } + if (!Main.npc[num750].active || CalamityGlobalNPC.energyFlame < 0) + { + npc.active = false; + return; + } + Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); + float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + Vector2 vector93 = new Vector2(num754, num755); + float num756 = num754 + npc.ai[0]; + float num757 = num755 + npc.ai[1]; + float num758 = num756 - vector93.X; + float num759 = num757 - vector93.Y; + float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + num760 = num752 / num760; + num758 *= num760; + num759 *= num760; + if (npc.position.X < num754 + num758) + { + npc.velocity.X = npc.velocity.X + num751; + if (npc.velocity.X < 0f && num758 > 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + else if (npc.position.X > num754 + num758) + { + npc.velocity.X = npc.velocity.X - num751; + if (npc.velocity.X > 0f && num758 < 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (npc.position.Y < num755 + num759) + { + npc.velocity.Y = npc.velocity.Y + num751; + if (npc.velocity.Y < 0f && num759 > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + else if (npc.position.Y > num755 + num759) + { + npc.velocity.Y = npc.velocity.Y - num751; + if (npc.velocity.Y > 0f && num759 < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + if (npc.velocity.Y > 8f) + { + npc.velocity.Y = 8f; + } + if (npc.velocity.Y < -8f) + { + npc.velocity.Y = -8f; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!Main.player[npc.target].dead) + { + npc.localAI[1] += (float)Main.rand.Next(1, 6); + if (npc.localAI[1] >= 600f) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + float num196 = 11f; + vector22 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num189 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector22.X + (float)Main.rand.Next(-10, 11); + float num197 = Math.Abs(num189 * 0.1f); + if (num190 > 0f) + { + num197 = 0f; + } + num190 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector22.Y + (float)Main.rand.Next(-10, 11) - num197; + num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + num191 = num196 / num191; + num189 *= num191; + num190 *= num191; + int num9 = mod.ProjectileType("HolyBomb"); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num189, num190, num9, 40, 0f, Main.myPlayer, 0f, 0f); + npc.localAI[1] = 0f; + return; + } + npc.localAI[1] = 250f; + } + } + } + } public override void FindFrame(int frameHeight) { @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.NormalNPCs } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { + { if (CalamityGlobalNPC.energyFlame != -1) { Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); @@ -216,18 +216,18 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - return true; - } + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 9b764f0c04..1079ae6280 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -1,70 +1,68 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class SandTortoise : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Tortoise"); - Main.npcFrameCount[npc.type] = 8; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Tortoise"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.npcSlots = 2f; - npc.damage = 110; - npc.aiStyle = 39; - npc.width = 46; - npc.height = 32; - npc.defense = 30; + public override void SetDefaults() + { + npc.npcSlots = 2f; + npc.damage = 110; + npc.aiStyle = 39; + npc.width = 46; + npc.height = 32; + npc.defense = 30; npc.Calamity().RevPlusDR(0.25f); npc.scale = 1.5f; - npc.lifeMax = 580; - npc.knockBackResist = 0.2f; - animationType = 153; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.noGravity = false; - banner = npc.type; - bannerItem = mod.ItemType("SandTortoiseBanner"); - } + npc.lifeMax = 580; + npc.knockBackResist = 0.2f; + animationType = 153; + npc.value = Item.buyPrice(0, 0, 15, 0); + npc.HitSound = SoundID.NPCHit24; + npc.DeathSound = SoundID.NPCDeath27; + npc.noGravity = false; + banner = npc.type; + bannerItem = mod.ItemType("SandTortoiseBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.05f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.05f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(10)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); + } + } + } } diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 83f2487b7a..2578d019a6 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -1,5 +1,4 @@ using System; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,182 +6,182 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class ScornEater : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scorn Eater"); - Main.npcFrameCount[npc.type] = 7; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scorn Eater"); + Main.npcFrameCount[npc.type] = 7; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 90; - npc.width = 160; - npc.height = 160; - npc.defense = 38; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 90; + npc.width = 160; + npc.height = 160; + npc.defense = 38; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = 16000; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.lavaImmune = true; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath26; - banner = npc.type; - bannerItem = mod.ItemType("ScornEaterBanner"); - } + npc.lifeMax = 16000; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.lavaImmune = true; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath26; + banner = npc.type; + bannerItem = mod.ItemType("ScornEaterBanner"); + } - public override void AI() - { - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else if (npc.velocity.Y == 0f) - { - npc.ai[2] += 1f; - int num321 = 20; - if (npc.ai[1] == 0f) - { - num321 = 12; - } - if (npc.ai[2] < (float)num321) - { - npc.velocity.X = npc.velocity.X * 0.9f; - return; - } - npc.ai[2] = 0f; - npc.TargetClosest(true); - if (npc.direction == 0) - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.ai[1] += 1f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 4f) - { - npc.ai[3] = 0f; - if (npc.ai[1] == 2f) - { - npc.velocity.X = (float)npc.direction * 15f; - npc.velocity.Y = -12f; - npc.ai[1] = 0f; - } - else - { - npc.velocity.X = (float)npc.direction * 21f; - npc.velocity.Y = -6f; - } - } - npc.netUpdate = true; - return; - } - else - { - if (npc.direction == 1 && npc.velocity.X < 1f) - { - npc.velocity.X = npc.velocity.X + 0.1f; - return; - } - if (npc.direction == -1 && npc.velocity.X > -1f) - { - npc.velocity.X = npc.velocity.X - 0.1f; - return; - } - } - } + public override void AI() + { + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) + { + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else if (npc.velocity.Y == 0f) + { + npc.ai[2] += 1f; + int num321 = 20; + if (npc.ai[1] == 0f) + { + num321 = 12; + } + if (npc.ai[2] < (float)num321) + { + npc.velocity.X = npc.velocity.X * 0.9f; + return; + } + npc.ai[2] = 0f; + npc.TargetClosest(true); + if (npc.direction == 0) + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.ai[1] += 1f; + npc.ai[3] += 1f; + if (npc.ai[3] >= 4f) + { + npc.ai[3] = 0f; + if (npc.ai[1] == 2f) + { + npc.velocity.X = (float)npc.direction * 15f; + npc.velocity.Y = -12f; + npc.ai[1] = 0f; + } + else + { + npc.velocity.X = (float)npc.direction * 21f; + npc.velocity.Y = -6f; + } + } + npc.netUpdate = true; + return; + } + else + { + if (npc.direction == 1 && npc.velocity.X < 1f) + { + npc.velocity.X = npc.velocity.X + 0.1f; + return; + } + if (npc.direction == -1 && npc.velocity.X > -1f) + { + npc.velocity.X = npc.velocity.X - 0.1f; + return; + } + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (Math.Abs(npc.velocity.X) <= 1f) - { - if (npc.frameCounter > 9.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter > 9.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y < frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - if (npc.frame.Y >= frameHeight * 7) - { - npc.frame.Y = frameHeight * 5; - } - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (Math.Abs(npc.velocity.X) <= 1f) + { + if (npc.frameCounter > 9.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter > 9.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y < frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + if (npc.frame.Y >= frameHeight * 7) + { + npc.frame.Y = frameHeight * 5; + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedMoonlord) - { - return 0f; - } - if (SpawnCondition.Underworld.Chance > 0f) - { - return SpawnCondition.Underworld.Chance / 4f; - } - return SpawnCondition.OverworldHallow.Chance / 4f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord) + { + return 0f; + } + if (SpawnCondition.Underworld.Chance > 0f) + { + return SpawnCondition.Underworld.Chance / 4f; + } + return SpawnCondition.OverworldHallow.Chance / 4f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater6"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater6"), 1f); + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); + } + } } diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 42c5d56cb9..fcefe4aa2d 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,573 +7,573 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class ShockstormShuttle : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shockstorm Shuttle"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shockstorm Shuttle"); + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 30; - npc.width = 64; - npc.height = 38; - npc.defense = 15; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 30; + npc.width = 64; + npc.height = 38; + npc.defense = 15; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 150; - npc.aiStyle = -1; + npc.lifeMax = 150; + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; - bannerItem = mod.ItemType("ShockstormShuttleBanner"); - } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + banner = npc.type; + bannerItem = mod.ItemType("ShockstormShuttleBanner"); + } - public override void AI() - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times - if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = 12f; //speed of projectile - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 30; //projectile damage - if (Main.expertMode) - { - num184 = 22; - } - int num185 = 435; //projectile ID - if (Main.rand.NextBool(8)) - { - num185 = 449; //more powerful projectile ID - } - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); //projectile spreadX - num182 += (float)Main.rand.Next(-20, 21); //projectile spreadY - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[3] = 1f; - } - Vector2 center16 = npc.Center; - Player player8 = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player8.dead || !player8.active) - { - npc.TargetClosest(true); - player8 = Main.player[npc.target]; - npc.netUpdate = true; - } - if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] = -1f; - } - if (npc.ai[0] == 2f) - { - npc.ai[0] = -2f; - } - npc.netUpdate = true; - } - if (npc.ai[0] == -1f || npc.ai[0] == -2f) - { - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (!player8.dead) - { - npc.timeLeft = 300; - if (npc.ai[0] == -2f) - { - npc.ai[0] = 2f; - } - if (npc.ai[0] == 0f) - { - npc.ai[0] = 0f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 0f) - { - int num1580 = 0; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - npc.ai[3] += 1f; - if (npc.ai[3] >= 600f) - { - npc.ai[3] = 0f; - } - int num1581 = num1580; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - if (num1580 != num1581) - { - if (num1580 == 0) - { - npc.ai[2] = 0f; - } - if (num1580 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - } - if (num1580 == 2) - { - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - if (num1580 == 0) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; - if (vector196.Length() < 50f) - { - npc.ai[3] = 19f; - } - else - { - vector196.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); - } - } - if (num1580 == 1) - { - int num1582 = (int)npc.Center.X / 16; - int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1584 = 0; - bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; - if (flag149) - { - num1584 = 1; - } - else - { - while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) - { - int num1585 = num1583 + num1584; - bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; - if (flag150) - { - num1584--; - break; - } - num1584++; - } - } - float num1586 = (float)(num1584 * 16); - float num1587 = 250f; - if (num1586 < num1587) - { - float num1588 = -4f; - if (-num1588 > num1586) - { - num1588 = -num1586; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 3.5f * npc.ai[2]; - } - if (num1580 == 2) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; - int num1589 = (int)npc.Center.X / 16; - int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1591 = 0; - bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; - if (flag151) - { - num1591 = 1; - } - else - { - while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) - { - int num1592 = num1590 + num1591; - bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; - if (flag152) - { - num1591--; - break; - } - num1591++; - } - } - float num1593 = (float)(num1591 * 16); - float num1594 = 170f; - if (num1593 < num1594) - { - vector197.Y -= num1594 - num1593; - } - if (vector197.Length() < 70f) - { - npc.ai[3] = 279f; - } - else - { - vector197.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); - } - } - else if (num1580 == 3) - { - float num1595 = 0.85f; - int num1596 = (int)npc.Center.X / 16; - int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1598 = 0; - bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; - if (flag153) - { - num1598 = 1; - } - else - { - while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) - { - int num1599 = num1597 + num1598; - bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; - if (flag154) - { - num1598--; - break; - } - num1598++; - } - } - float num1600 = (float)(num1598 * 16); - float num1601 = 170f; - if (num1600 < num1601) - { - float num1602 = -4f; - if (-num1602 > num1600) - { - num1602 = -num1600; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * num1595; - } - npc.velocity.X = npc.velocity.X * num1595; - } - if (num1580 == 4) - { - Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; - if (vector198.Length() < 50f) - { - npc.ai[3] = 439f; - return; - } - vector198.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); - return; - } - else if (num1580 == 5) - { - npc.velocity *= 0.85f; - return; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity *= 0.96f; - float num1603 = 150f; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1603) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.rotation = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] < 40f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * 6.28318548f), default).Y * 0.2f; - return; - } - if (npc.ai[1] < 80f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * 6.28318548f), default).Y * 0.3f; - return; - } - if (npc.ai[1] < 120f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * 6.28318548f), default).Y * 0.4f; - return; - } - npc.rotation = (npc.ai[1] - 120f) / 30f * 6.28318548f; - return; - } - else if (npc.ai[0] == 2f) - { - float num1605 = 3600f; - float num1606 = 120f; - float num1607 = 60f; - int num1608 = 0; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - int num1609 = num1608; - num1608 = 0; - npc.ai[3] += 1f; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - if (num1608 != num1609) - { - if (num1608 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - if (Main.netMode != NetmodeID.MultiplayerClient) //second projectile being shot. Didn't use this - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = 11f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 50; - if (Main.expertMode) - { - num184 = 28; - } - if (Main.hardMode) - { - num184 = 40; - if (NPC.downedMoonlord) - { - num184 = 80; - if (Main.expertMode) - { - num184 = 45; - } - } - } - int num185 = 449; - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); - num182 += (float)Main.rand.Next(-20, 21); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - Main.PlaySound(2, (int)npc.Center.X, (int)npc.Center.Y, 12); - } - npc.netUpdate = true; - } - if (npc.ai[3] >= num1605) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - else if (num1608 == 0) - { - Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; - vector199.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); - } - else - { - int num1610 = (int)npc.Center.X / 16; - int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1612 = 0; - bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; - if (flag155) - { - num1612 = 1; - } - else - { - while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) - { - int num1613 = num1611 + num1612; - bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; - if (flag156) - { - num1612--; - break; - } - num1612++; - } - } - float num1614 = (float)(num1612 * 16); - float num1615 = 250f; - if (num1614 < num1615) - { - float num1616 = -4f; - if (-num1616 > num1614) - { - num1616 = -num1614; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 8f * npc.ai[2]; - } - npc.rotation = 0f; - return; - } - } + public override void AI() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times + if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num179 = 12f; //speed of projectile + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = 30; //projectile damage + if (Main.expertMode) + { + num184 = 22; + } + int num185 = 435; //projectile ID + if (Main.rand.NextBool(8)) + { + num185 = 449; //more powerful projectile ID + } + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = 12f / num183; + num180 += (float)Main.rand.Next(-20, 21); //projectile spreadX + num182 += (float)Main.rand.Next(-20, 21); //projectile spreadY + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[3] = 1f; + } + Vector2 center16 = npc.Center; + Player player8 = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player8.dead || !player8.active) + { + npc.TargetClosest(true); + player8 = Main.player[npc.target]; + npc.netUpdate = true; + } + if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = -1f; + } + if (npc.ai[0] == 2f) + { + npc.ai[0] = -2f; + } + npc.netUpdate = true; + } + if (npc.ai[0] == -1f || npc.ai[0] == -2f) + { + npc.velocity.Y = npc.velocity.Y - 0.4f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (!player8.dead) + { + npc.timeLeft = 300; + if (npc.ai[0] == -2f) + { + npc.ai[0] = 2f; + } + if (npc.ai[0] == 0f) + { + npc.ai[0] = 0f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 0f) + { + int num1580 = 0; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + npc.ai[3] += 1f; + if (npc.ai[3] >= 600f) + { + npc.ai[3] = 0f; + } + int num1581 = num1580; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + if (num1580 != num1581) + { + if (num1580 == 0) + { + npc.ai[2] = 0f; + } + if (num1580 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + } + if (num1580 == 2) + { + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + if (num1580 == 0) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; + if (vector196.Length() < 50f) + { + npc.ai[3] = 19f; + } + else + { + vector196.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); + } + } + if (num1580 == 1) + { + int num1582 = (int)npc.Center.X / 16; + int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1584 = 0; + bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; + if (flag149) + { + num1584 = 1; + } + else + { + while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) + { + int num1585 = num1583 + num1584; + bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; + if (flag150) + { + num1584--; + break; + } + num1584++; + } + } + float num1586 = (float)(num1584 * 16); + float num1587 = 250f; + if (num1586 < num1587) + { + float num1588 = -4f; + if (-num1588 > num1586) + { + num1588 = -num1586; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 3.5f * npc.ai[2]; + } + if (num1580 == 2) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; + int num1589 = (int)npc.Center.X / 16; + int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1591 = 0; + bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; + if (flag151) + { + num1591 = 1; + } + else + { + while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) + { + int num1592 = num1590 + num1591; + bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; + if (flag152) + { + num1591--; + break; + } + num1591++; + } + } + float num1593 = (float)(num1591 * 16); + float num1594 = 170f; + if (num1593 < num1594) + { + vector197.Y -= num1594 - num1593; + } + if (vector197.Length() < 70f) + { + npc.ai[3] = 279f; + } + else + { + vector197.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); + } + } + else if (num1580 == 3) + { + float num1595 = 0.85f; + int num1596 = (int)npc.Center.X / 16; + int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1598 = 0; + bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; + if (flag153) + { + num1598 = 1; + } + else + { + while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) + { + int num1599 = num1597 + num1598; + bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; + if (flag154) + { + num1598--; + break; + } + num1598++; + } + } + float num1600 = (float)(num1598 * 16); + float num1601 = 170f; + if (num1600 < num1601) + { + float num1602 = -4f; + if (-num1602 > num1600) + { + num1602 = -num1600; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * num1595; + } + npc.velocity.X = npc.velocity.X * num1595; + } + if (num1580 == 4) + { + Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; + if (vector198.Length() < 50f) + { + npc.ai[3] = 439f; + return; + } + vector198.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); + return; + } + else if (num1580 == 5) + { + npc.velocity *= 0.85f; + return; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity *= 0.96f; + float num1603 = 150f; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1603) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.rotation = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] < 40f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * 6.28318548f), default).Y * 0.2f; + return; + } + if (npc.ai[1] < 80f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * 6.28318548f), default).Y * 0.3f; + return; + } + if (npc.ai[1] < 120f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * 6.28318548f), default).Y * 0.4f; + return; + } + npc.rotation = (npc.ai[1] - 120f) / 30f * 6.28318548f; + return; + } + else if (npc.ai[0] == 2f) + { + float num1605 = 3600f; + float num1606 = 120f; + float num1607 = 60f; + int num1608 = 0; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + int num1609 = num1608; + num1608 = 0; + npc.ai[3] += 1f; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + if (num1608 != num1609) + { + if (num1608 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + if (Main.netMode != NetmodeID.MultiplayerClient) //second projectile being shot. Didn't use this + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num179 = 11f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = 50; + if (Main.expertMode) + { + num184 = 28; + } + if (Main.hardMode) + { + num184 = 40; + if (NPC.downedMoonlord) + { + num184 = 80; + if (Main.expertMode) + { + num184 = 45; + } + } + } + int num185 = 449; + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; num186++) + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = 12f / num183; + num180 += (float)Main.rand.Next(-20, 21); + num182 += (float)Main.rand.Next(-20, 21); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + Main.PlaySound(2, (int)npc.Center.X, (int)npc.Center.Y, 12); + } + npc.netUpdate = true; + } + if (npc.ai[3] >= num1605) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + else if (num1608 == 0) + { + Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; + vector199.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); + } + else + { + int num1610 = (int)npc.Center.X / 16; + int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1612 = 0; + bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; + if (flag155) + { + num1612 = 1; + } + else + { + while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) + { + int num1613 = num1611 + num1612; + bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; + if (flag156) + { + num1612--; + break; + } + num1612++; + } + } + float num1614 = (float)(num1612 * 16); + float num1615 = 250f; + if (num1614 < num1615) + { + float num1616 = -4f; + if (-num1616 > num1614) + { + num1616 = -num1614; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 8f * npc.ai[2]; + } + npc.rotation = 0f; + return; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Sky.Chance * 0.1f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode) + { + return 0f; + } + return SpawnCondition.Sky.Chance * 0.1f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 120, true); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MartianConduitPlating, Main.rand.Next(10, 30)); - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MartianConduitPlating, Main.rand.Next(10, 30)); + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + } } diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index b8142232f9..5fde98d3f5 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -1,71 +1,69 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class StormlionCharger : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stormlion"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stormlion"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 20; - npc.aiStyle = 3; - npc.width = 33; - npc.height = 31; - npc.defense = 8; - npc.lifeMax = 80; - npc.knockBackResist = 0.2f; - animationType = 508; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit31; - npc.DeathSound = SoundID.NPCDeath34; - banner = npc.type; - bannerItem = mod.ItemType("StormlionBanner"); - } + public override void SetDefaults() + { + npc.damage = 20; + npc.aiStyle = 3; + npc.width = 33; + npc.height = 31; + npc.defense = 8; + npc.lifeMax = 80; + npc.knockBackResist = 0.2f; + animationType = 508; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit31; + npc.DeathSound = SoundID.NPCDeath34; + banner = npc.type; + bannerItem = mod.ItemType("StormlionBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.2f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.2f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 90, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 90, true); + } - public override void NPCLoot() - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormlionMandible")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormlionMandible")); + } + } + } } diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index e749c8eb0f..eea52831da 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -1,36 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class SunBat : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sun Bat"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sun Bat"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = 14; + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = 14; aiType = 151; - npc.damage = 35; - npc.width = 26; - npc.height = 20; - npc.defense = 10; - npc.lifeMax = 120; - npc.knockBackResist = 0.65f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath4; - banner = npc.type; - bannerItem = mod.ItemType("SunBatBanner"); - } + npc.damage = 35; + npc.width = 26; + npc.height = 20; + npc.defense = 10; + npc.lifeMax = 120; + npc.knockBackResist = 0.65f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath4; + banner = npc.type; + bannerItem = mod.ItemType("SunBatBanner"); + } public override void FindFrame(int frameHeight) { @@ -46,42 +44,42 @@ namespace CalamityMod.NPCs.NormalNPCs } public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.12f; - } + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || + spawnInfo.player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.12f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 120, true); - player.AddBuff(mod.BuffType("HolyLight"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 120, true); + player.AddBuff(mod.BuffType("HolyLight"), 120, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + } } diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 113831ac04..1eea91a41a 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,47 +7,47 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class Sunskater : ModNPC - { + { private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sunskater"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunskater"); Main.npcFrameCount[npc.type] = 4; } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 20; - npc.width = 58; - npc.height = 22; - npc.defense = 4; - npc.lifeMax = 100; + npc.lavaImmune = true; + npc.damage = 20; + npc.width = 58; + npc.height = 22; + npc.defense = 4; + npc.lifeMax = 100; npc.aiStyle = -1; - aiType = -1; + aiType = -1; npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater"); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater"); npc.knockBackResist = 0.7f; - banner = npc.type; - bannerItem = mod.ItemType("SunskaterBanner"); - } + banner = npc.type; + bannerItem = mod.ItemType("SunskaterBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() + public override void AI() { npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); npc.noGravity = true; @@ -240,18 +239,18 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); - } - } - } - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/NormalNPCs/SuperDummy.cs b/NPCs/NormalNPCs/SuperDummy.cs index 0c62eb0adb..6d71a689ed 100644 --- a/NPCs/NormalNPCs/SuperDummy.cs +++ b/NPCs/NormalNPCs/SuperDummy.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class SuperDummy : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + } - public override void SetDefaults() - { - npc.width = 18; - npc.height = 48; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 9999999; - npc.HitSound = SoundID.NPCHit15; - npc.DeathSound = SoundID.NPCDeath2; - npc.value = 0f; - npc.knockBackResist = 0f; - } + public override void SetDefaults() + { + npc.width = 18; + npc.height = 48; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 9999999; + npc.HitSound = SoundID.NPCHit15; + npc.DeathSound = SoundID.NPCDeath2; + npc.value = 0f; + npc.knockBackResist = 0f; + } - public override void UpdateLifeRegen (ref int damage) - { - npc.lifeRegen += 2000000; - } + public override void UpdateLifeRegen(ref int damage) + { + npc.lifeRegen += 2000000; + } - public override bool? DrawHealthBar (byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override bool CheckDead () - { - if (npc.lifeRegen < 0) - { - npc.life = npc.lifeMax; - return false; - } - return true; - } - } + public override bool CheckDead() + { + if (npc.lifeRegen < 0) + { + npc.life = npc.lifeMax; + return false; + } + return true; + } + } } diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 050e58a196..c79ef2e807 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -1,246 +1,246 @@ -using System; -using System.Collections.Generic; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { public class ThiccWaifu : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud Elemental"); - Main.npcFrameCount[npc.type] = 8; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud Elemental"); + Main.npcFrameCount[npc.type] = 8; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 38; - npc.width = 80; - npc.height = 140; - npc.defense = 18; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 38; + npc.width = 80; + npc.height = 140; + npc.defense = 18; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = 6000; - if (CalamityWorld.downedProvidence) - { - npc.damage = 190; - npc.defense = 60; - npc.lifeMax = 30000; - } - npc.knockBackResist = 0.05f; - npc.value = Item.buyPrice(0, 1, 50, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; - npc.buffImmune[20] = true; - npc.buffImmune[44] = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("CloudElementalBanner"); - } + npc.lifeMax = 6000; + if (CalamityWorld.downedProvidence) + { + npc.damage = 190; + npc.defense = 60; + npc.lifeMax = 30000; + } + npc.knockBackResist = 0.05f; + npc.value = Item.buyPrice(0, 1, 50, 0); + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath39; + npc.buffImmune[20] = true; + npc.buffImmune[44] = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("CloudElementalBanner"); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.375f, 0.5f, 0.625f); + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.375f, 0.5f, 0.625f); - float num1457 = 0.1f; - float num1458 = 2f; - float num1460 = -4f; - float num1461 = 4f; - float num1462 = 0.1f; - bool flag116 = false; - float scaleFactor26 = 0.96f; - bool flag117 = true; + float num1457 = 0.1f; + float num1458 = 2f; + float num1460 = -4f; + float num1461 = 4f; + float num1462 = 0.1f; + bool flag116 = false; + float scaleFactor26 = 0.96f; + bool flag117 = true; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - float num1465 = (float)npc.life / (float)npc.lifeMax; - num1461 += (1f - num1465) * 6f; - num1462 += (1f - num1465) * 0.02f; + float num1465 = (float)npc.life / (float)npc.lifeMax; + num1461 += (1f - num1465) * 6f; + num1462 += (1f - num1465) * 0.02f; - if (num1465 < 0.5f) - npc.knockBackResist = 0f; + if (num1465 < 0.5f) + npc.knockBackResist = 0f; - npc.localAI[2] = 0f; + npc.localAI[2] = 0f; - if (npc.ai[0] < 0f) - npc.ai[0] = MathHelper.Min(npc.ai[0] + 1f, 0f); + if (npc.ai[0] < 0f) + npc.ai[0] = MathHelper.Min(npc.ai[0] + 1f, 0f); - if (npc.ai[0] > 0f) - { - flag117 = false; - flag116 = true; - npc.ai[0] += 1f; - if (npc.ai[0] >= 135f) - { - npc.ai[0] = -300f; - npc.netUpdate = true; - } - Vector2 vector = npc.Center; - vector = Vector2.UnitX * (float)npc.direction * 200f; - Vector2 vector223 = npc.Center + Vector2.UnitX * (float)npc.direction * 50f - Vector2.UnitY * 6f; - if (npc.ai[0] == 54f && Main.netMode != NetmodeID.MultiplayerClient) - { - List list4 = new List(); - Vector2 vec5 = Main.player[npc.target].Center + new Vector2(Main.player[npc.target].velocity.X * 30f, 0f); - Point point14 = vec5.ToTileCoordinates(); - int num1468 = 0; - while (num1468 < 1000 && list4.Count < 3) - { - bool flag118 = false; - int num1469 = Main.rand.Next(point14.X - 30, point14.X + 30 + 1); - foreach (Point current in list4) - { - if (Math.Abs(current.X - num1469) < 10) - { - flag118 = true; - break; - } - } - if (!flag118) - { - int startY = point14.Y - 20; - int num1470; - int num1471; - Collision.ExpandVertically(num1469, startY, out num1470, out num1471, 1, 51); - list4.Add(new Point(num1469, num1471 - 15)); - } - num1468++; - } - foreach (Point current2 in list4) - { - Projectile.NewProjectile((float)(current2.X * 16), (float)(current2.Y * 16), 0f, 0f, mod.ProjectileType("StormMarkHostile"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - new Vector2(0.9f, 2f); - if (npc.ai[0] < 114f && npc.ai[0] > 0f) - { - List list5 = new List(); - for (int num1472 = 0; num1472 < 1000; num1472++) - { - Projectile projectile9 = Main.projectile[num1472]; - if (projectile9.active && projectile9.type == mod.ProjectileType("StormMarkHostile")) - { - list5.Add(projectile9.Center); - } - } - } - } + if (npc.ai[0] > 0f) + { + flag117 = false; + flag116 = true; + npc.ai[0] += 1f; + if (npc.ai[0] >= 135f) + { + npc.ai[0] = -300f; + npc.netUpdate = true; + } + Vector2 vector = npc.Center; + vector = Vector2.UnitX * (float)npc.direction * 200f; + Vector2 vector223 = npc.Center + Vector2.UnitX * (float)npc.direction * 50f - Vector2.UnitY * 6f; + if (npc.ai[0] == 54f && Main.netMode != NetmodeID.MultiplayerClient) + { + List list4 = new List(); + Vector2 vec5 = Main.player[npc.target].Center + new Vector2(Main.player[npc.target].velocity.X * 30f, 0f); + Point point14 = vec5.ToTileCoordinates(); + int num1468 = 0; + while (num1468 < 1000 && list4.Count < 3) + { + bool flag118 = false; + int num1469 = Main.rand.Next(point14.X - 30, point14.X + 30 + 1); + foreach (Point current in list4) + { + if (Math.Abs(current.X - num1469) < 10) + { + flag118 = true; + break; + } + } + if (!flag118) + { + int startY = point14.Y - 20; + int num1470; + int num1471; + Collision.ExpandVertically(num1469, startY, out num1470, out num1471, 1, 51); + list4.Add(new Point(num1469, num1471 - 15)); + } + num1468++; + } + foreach (Point current2 in list4) + { + Projectile.NewProjectile((float)(current2.X * 16), (float)(current2.Y * 16), 0f, 0f, mod.ProjectileType("StormMarkHostile"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + new Vector2(0.9f, 2f); + if (npc.ai[0] < 114f && npc.ai[0] > 0f) + { + List list5 = new List(); + for (int num1472 = 0; num1472 < 1000; num1472++) + { + Projectile projectile9 = Main.projectile[num1472]; + if (projectile9.active && projectile9.type == mod.ProjectileType("StormMarkHostile")) + { + list5.Add(projectile9.Center); + } + } + } + } - if (npc.ai[0] == 0f) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - flag116 = true; - } + if (npc.ai[0] == 0f) + { + npc.ai[0] = 1f; + npc.netUpdate = true; + flag116 = true; + } - if (npc.justHit) - npc.localAI[2] = 0f; + if (npc.justHit) + npc.localAI[2] = 0f; - if (npc.localAI[2] >= 0f) - { - float num1477 = 16f; - bool flag119 = false; - bool flag120 = false; - if (npc.position.X > npc.localAI[0] - num1477 && npc.position.X < npc.localAI[0] + num1477) - { - flag119 = true; - } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) - { - flag119 = true; - num1477 += 24f; - } - if (npc.position.Y > npc.localAI[1] - num1477 && npc.position.Y < npc.localAI[1] + num1477) - { - flag120 = true; - } - if (flag119 && flag120) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 60f) - { - npc.localAI[2] = -180f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; - } - } - else - { - npc.localAI[0] = npc.position.X; - npc.localAI[1] = npc.position.Y; - npc.localAI[2] = 0f; - } - if (flag117) - { - npc.TargetClosest(true); - } - } - else - { - npc.localAI[2] += 1f; - npc.direction = ((Main.player[npc.target].Center.X > npc.Center.X) ? 1 : -1); - } + if (npc.localAI[2] >= 0f) + { + float num1477 = 16f; + bool flag119 = false; + bool flag120 = false; + if (npc.position.X > npc.localAI[0] - num1477 && npc.position.X < npc.localAI[0] + num1477) + { + flag119 = true; + } + else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + { + flag119 = true; + num1477 += 24f; + } + if (npc.position.Y > npc.localAI[1] - num1477 && npc.position.Y < npc.localAI[1] + num1477) + { + flag120 = true; + } + if (flag119 && flag120) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 60f) + { + npc.localAI[2] = -180f; + npc.direction *= -1; + npc.velocity.X = npc.velocity.X * -1f; + npc.collideX = false; + } + } + else + { + npc.localAI[0] = npc.position.X; + npc.localAI[1] = npc.position.Y; + npc.localAI[2] = 0f; + } + if (flag117) + { + npc.TargetClosest(true); + } + } + else + { + npc.localAI[2] += 1f; + npc.direction = ((Main.player[npc.target].Center.X > npc.Center.X) ? 1 : -1); + } - // Slow down when spawning tornadoes - if (flag116) - { - npc.velocity *= scaleFactor26; - return; - } + // Slow down when spawning tornadoes + if (flag116) + { + npc.velocity *= scaleFactor26; + return; + } - // Float up or down towards target - if (npc.position.Y > Main.player[npc.target].position.Y - 50f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.99f; + // Float up or down towards target + if (npc.position.Y > Main.player[npc.target].position.Y - 50f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y * 0.99f; - npc.velocity.Y = npc.velocity.Y - num1457; + npc.velocity.Y = npc.velocity.Y - num1457; - if (npc.velocity.Y > num1458) - npc.velocity.Y = num1458; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.99f; + if (npc.velocity.Y > num1458) + npc.velocity.Y = num1458; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = npc.velocity.Y * 0.99f; - npc.velocity.Y = npc.velocity.Y + num1457; + npc.velocity.Y = npc.velocity.Y + num1457; - if (npc.velocity.Y < num1460) - npc.velocity.Y = num1460; - } + if (npc.velocity.Y < num1460) + npc.velocity.Y = num1460; + } - // Float back and forth near target - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 50f) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.99f; + // Float back and forth near target + if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 50f) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X * 0.99f; - npc.velocity.X = npc.velocity.X - num1462; + npc.velocity.X = npc.velocity.X - num1462; - if (npc.velocity.X > num1461) - npc.velocity.X = num1461; - } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 50f) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.99f; + if (npc.velocity.X > num1461) + npc.velocity.X = num1461; + } + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 50f) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X * 0.99f; - npc.velocity.X = npc.velocity.X + num1462; + npc.velocity.X = npc.velocity.X + num1462; - if (npc.velocity.X < -num1461) - npc.velocity.X = -num1461; - } - } + if (npc.velocity.X < -num1461) + npc.velocity.X = -num1461; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { @@ -271,52 +271,52 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || !Main.raining) - { - return 0f; - } - return SpawnCondition.Sky.Chance * 0.1f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || !Main.raining) + { + return 0f; + } + return SpawnCondition.Sky.Chance * 0.1f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 16, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 16, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 16, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 16, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(2, 4)); - if (Main.rand.NextBool(100) && CalamityWorld.downedProvidence) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Thunderstorm")); - } - if (Main.expertMode) - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); - } - } - else if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); - } - if (Main.rand.NextBool(5)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSaber")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(2, 4)); + if (Main.rand.NextBool(100) && CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Thunderstorm")); + } + if (Main.expertMode) + { + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); + } + } + else if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); + } + if (Main.rand.NextBool(5)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSaber")); + } + } + } } diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 00d51dc6f8..43aaad47e9 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -1,42 +1,40 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class WulfrumDrone : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Drone"); - Main.npcFrameCount[npc.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Drone"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.damage = 10; - npc.aiStyle = 3; - aiType = 73; - npc.width = 40; - npc.height = 30; - npc.defense = 4; - npc.lifeMax = 22; - npc.knockBackResist = 0.35f; - npc.value = Item.buyPrice(0, 0, 0, 50); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("WulfrumDroneBanner"); - } + public override void SetDefaults() + { + npc.damage = 10; + npc.aiStyle = 3; + aiType = 73; + npc.width = 40; + npc.height = 30; + npc.defense = 4; + npc.lifeMax = 22; + npc.knockBackResist = 0.35f; + npc.value = Item.buyPrice(0, 0, 0, 50); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("WulfrumDroneBanner"); + } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -44,37 +42,37 @@ namespace CalamityMod.NPCs.NormalNPCs npc.frame.Y = frame * frameHeight; } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f); - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard"), Main.rand.Next(1, 4)); - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard"), Main.rand.Next(1, 4)); + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); + } + } + } } diff --git a/NPCs/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs index 59f1416f65..4e2356dd56 100644 --- a/NPCs/NormalNPCs/WulfrumSlime.cs +++ b/NPCs/NormalNPCs/WulfrumSlime.cs @@ -1,71 +1,69 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class WulfrumSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Slime"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 8; - npc.width = 30; - npc.height = 22; - npc.defense = 2; - npc.lifeMax = 12; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("WulfrumSlimeBanner"); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 8; + npc.width = 30; + npc.height = 22; + npc.defense = 2; + npc.lifeMax = 12; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("WulfrumSlimeBanner"); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.08f : 0.33f); - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.08f : 0.33f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); - } - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); + if (Main.expertMode && Main.rand.NextBool(2)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); + } + } + } } diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index b8b69c30a8..ff91da9440 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -1,107 +1,107 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { public class PerforatorBodyLarge : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } - public override void SetDefaults() - { - npc.damage = 24; - npc.npcSlots = 5f; - npc.width = 60; - npc.height = 60; - npc.defense = 8; - npc.lifeMax = 2500; + public override void SetDefaults() + { + npc.damage = 24; + npc.npcSlots = 5f; + npc.width = 60; + npc.height = 60; + npc.defense = 8; + npc.lifeMax = 2500; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(5500, 20000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - num942 += (float)Main.rand.Next(-50, 51) * 0.05f; - num943 += (float)Main.rand.Next(-50, 51) * 0.05f; - int num945 = expertMode ? 12 : 15; - int num946 = mod.ProjectileType("BloodClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shoot = revenge ? 5 : 4; + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(5500, 20000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num941 = revenge ? 9f : 8f; + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + num942 += (float)Main.rand.Next(-50, 51) * 0.05f; + num943 += (float)Main.rand.Next(-50, 51) * 0.05f; + int num945 = expertMode ? 12 : 15; + int num946 = mod.ProjectileType("BloodClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; if (Main.rand.NextBool(2)) { int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num947].timeLeft = 160; } - npc.netUpdate = true; - } - } - } - if (!Main.npc[(int)npc.ai[1]].active) + npc.netUpdate = true; + } + } + } + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { @@ -112,43 +112,43 @@ namespace CalamityMod.NPCs.Perforator } public override bool CheckActive() - { - return false; - } + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf3"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), 1f); } - } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 180, true); + player.AddBuff(BuffID.Bleeding, 180, true); + } + } } diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 508ad423c0..203ad87880 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -1,139 +1,139 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { public class PerforatorBodyMedium : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } - public override void SetDefaults() - { - npc.damage = 21; - npc.npcSlots = 5f; - npc.width = 54; - npc.height = 54; - npc.defense = 6; - npc.lifeMax = 2000; + public override void SetDefaults() + { + npc.damage = 21; + npc.npcSlots = 5f; + npc.width = 54; + npc.height = 54; + npc.defense = 6; + npc.lifeMax = 2000; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 900000 : 700000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(4000, 12000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - num942 += (float)Main.rand.Next(-50, 51) * 0.05f; - num943 += (float)Main.rand.Next(-50, 51) * 0.05f; - int num945 = expertMode ? 12 : 15; - int num946 = mod.ProjectileType("BloodClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shoot = revenge ? 5 : 4; + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(4000, 12000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num941 = revenge ? 9f : 8f; + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + num942 += (float)Main.rand.Next(-50, 51) * 0.05f; + num943 += (float)Main.rand.Next(-50, 51) * 0.05f; + int num945 = expertMode ? 12 : 15; + int num946 = mod.ProjectileType("BloodClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; if (Main.rand.NextBool(2)) { int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num947].timeLeft = 160; } - npc.netUpdate = true; - } - } - } - if (!Main.npc[(int)npc.ai[1]].active) + npc.netUpdate = true; + } + } + } + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); } - } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } public override void OnHitPlayer(Player player, int damage, bool crit) { diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index a527b1849a..06969b4199 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -1,138 +1,138 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { public class PerforatorBodySmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } - public override void SetDefaults() - { - npc.damage = 18; - npc.npcSlots = 5f; - npc.width = 42; - npc.height = 42; - npc.defense = 4; - npc.lifeMax = 1250; + public override void SetDefaults() + { + npc.damage = 18; + npc.npcSlots = 5f; + npc.width = 42; + npc.height = 42; + npc.defense = 4; + npc.lifeMax = 1250; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 600000 : 500000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(1500, 6000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - num942 += (float)Main.rand.Next(-50, 51) * 0.05f; - num943 += (float)Main.rand.Next(-50, 51) * 0.05f; - int num945 = expertMode ? 12 : 15; - int num946 = mod.ProjectileType("BloodClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shoot = revenge ? 5 : 4; + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(1500, 6000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num941 = revenge ? 9f : 8f; + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + num942 += (float)Main.rand.Next(-50, 51) * 0.05f; + num943 += (float)Main.rand.Next(-50, 51) * 0.05f; + int num945 = expertMode ? 12 : 15; + int num946 = mod.ProjectileType("BloodClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; if (Main.rand.NextBool(2)) { int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num947].timeLeft = 160; } - npc.netUpdate = true; - } - } - } - if (!Main.npc[(int)npc.ai[1]].active) + npc.netUpdate = true; + } + } + } + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf2"), 1f); } - } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } public override void OnHitPlayer(Player player, int damage, bool crit) { diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index 99e5f34f06..faa03d7598 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { public class PerforatorCyst : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perforator Cyst"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforator Cyst"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 0; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit13; - npc.rarity = 2; - } + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 0; + npc.lifeMax = 1000; + npc.knockBackResist = 0f; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit13; + npc.rarity = 2; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -38,43 +38,43 @@ namespace CalamityMod.NPCs.Perforator npc.frame.Y = frame * frameHeight; } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("PerforatorCyst")) || NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) - { - return 0f; - } - else if (NPC.downedBoss2 && !CalamityWorld.downedPerforator) - { - return SpawnCondition.Crimson.Chance * 1.5f; - } - return SpawnCondition.Crimson.Chance * (Main.hardMode ? 0.05f : 0.5f); - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("PerforatorCyst")) || NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) + { + return 0f; + } + else if (NPC.downedBoss2 && !CalamityWorld.downedPerforator) + { + return SpawnCondition.Crimson.Chance * 1.5f; + } + return SpawnCondition.Crimson.Chance * (Main.hardMode ? 0.05f : 0.5f); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 2000; - npc.damage = 0; - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 2000; + npc.damage = 0; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("PerforatorHive")) < 1) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("PerforatorHive")); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(mod.NPCType("PerforatorHive")) < 1) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("PerforatorHive")); + } + } + } + } } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index aca27e6757..a062d7a8e7 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] - public class PerforatorHeadLarge : ModNPC - { + public class PerforatorHeadLarge : ModNPC + { private bool flies = false; private float speed = 17f; private float turnSpeed = 0.15f; @@ -16,378 +16,378 @@ namespace CalamityMod.NPCs.Perforator private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 8 : 16; private bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 45; - npc.npcSlots = 5f; - npc.width = 70; - npc.height = 84; - npc.defense = 4; - npc.lifeMax = 2500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); } - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.425f; - if (CalamityWorld.bossRushActive) - speedMult = 3f; + public override void SetDefaults() + { + npc.damage = 45; + npc.npcSlots = 5f; + npc.width = 70; + npc.height = 84; + npc.defense = 4; + npc.lifeMax = 2500; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = 17f * (speedMult - (life / totalLife)); - turnSpeed = 0.15f * (speedMult - (life / totalLife)); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyLarge"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailLarge"), npc.whoAmI); - } - if (num36 % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - } - 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 400; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - } + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.425f; + if (CalamityWorld.bossRushActive) + speedMult = 3f; + + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = 17f * (speedMult - (life / totalLife)); + turnSpeed = 0.15f * (speedMult - (life / totalLife)); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyLarge"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailLarge"), npc.whoAmI); + } + if (num36 % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + } + 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 400; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 0.05f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + } + else if (npc.velocity.Y == num188) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + bool flag21 = false; + if (!flag21) + { + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } + } public override bool CheckActive() { @@ -395,48 +395,48 @@ namespace CalamityMod.NPCs.Perforator } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); } - } + } - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Large Perforator"; - potionType = ItemID.HealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Large Perforator"; + potionType = ItemID.HealingPotion; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(4, 9)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(3, 6)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 5)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(4, 9)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(3, 6)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 5)); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 300, true); + player.AddBuff(BuffID.Bleeding, 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + } } diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 63499cfb1b..2ea50b9dfa 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] - public class PerforatorHeadMedium : ModNPC - { + public class PerforatorHeadMedium : ModNPC + { private bool flies = false; private float speed = 19f; private float turnSpeed = 0.17f; @@ -16,375 +16,375 @@ namespace CalamityMod.NPCs.Perforator private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 6 : 11; private bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 35; - npc.npcSlots = 5f; - npc.width = 58; - npc.height = 68; - npc.defense = 2; - npc.lifeMax = 2000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 900000 : 700000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - animationType = 10; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); } - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.425f; - if (CalamityWorld.bossRushActive) - speedMult = 3f; + public override void SetDefaults() + { + npc.damage = 35; + npc.npcSlots = 5f; + npc.width = 58; + npc.height = 68; + npc.defense = 2; + npc.lifeMax = 2000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 900000 : 700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; + aiType = -1; + animationType = 10; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = 15f * (speedMult - (life / totalLife)); - turnSpeed = 0.13f * (speedMult - (life / totalLife)); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyMedium"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailMedium"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 200; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.7f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - } + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.425f; + if (CalamityWorld.bossRushActive) + speedMult = 3f; + + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = 15f * (speedMult - (life / totalLife)); + turnSpeed = 0.13f * (speedMult - (life / totalLife)); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyMedium"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailMedium"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 200; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 0.05f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.7f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + } + else if (npc.velocity.Y == num188) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + bool flag21 = false; + if (!flag21) + { + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } + } public override bool CheckActive() { @@ -392,48 +392,48 @@ namespace CalamityMod.NPCs.Perforator } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); } - } + } - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Medium Perforator"; - potionType = ItemID.HealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Medium Perforator"; + potionType = ItemID.HealingPotion; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(3, 8)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(2, 5)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 4)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(3, 8)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(2, 5)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 4)); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 240, true); + player.AddBuff(BuffID.Bleeding, 240, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + } } diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index ca74a0e499..565372d33d 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] - public class PerforatorHeadSmall : ModNPC - { + public class PerforatorHeadSmall : ModNPC + { private bool flies = false; private float speed = 21f; private float turnSpeed = 0.19f; @@ -16,373 +16,373 @@ namespace CalamityMod.NPCs.Perforator private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 4 : 7; private bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 30; - npc.npcSlots = 5f; - npc.width = 42; - npc.height = 62; - npc.lifeMax = 1250; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 600000 : 500000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); } - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.425f; - if (CalamityWorld.bossRushActive) - speedMult = 3f; + public override void SetDefaults() + { + npc.damage = 30; + npc.npcSlots = 5f; + npc.width = 42; + npc.height = 62; + npc.lifeMax = 1250; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 600000 : 500000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = 13f * (speedMult - (life / totalLife)); - turnSpeed = 0.11f * (speedMult - (life / totalLife)); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodySmall"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailSmall"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 100; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.9f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - } + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.425f; + if (CalamityWorld.bossRushActive) + speedMult = 3f; + + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = 13f * (speedMult - (life / totalLife)); + turnSpeed = 0.11f * (speedMult - (life / totalLife)); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodySmall"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailSmall"), 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(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 100; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 0.05f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.9f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + } + else if (npc.velocity.Y == num188) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + bool flag21 = false; + if (!flag21) + { + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } + } public override bool CheckActive() { @@ -390,47 +390,47 @@ namespace CalamityMod.NPCs.Perforator } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf"), 1f); } - } + } - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Small Perforator"; - potionType = ItemID.HealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Small Perforator"; + potionType = ItemID.HealingPotion; + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(2, 6)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(1, 3)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(2, 6)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(1, 3)); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 180, true); + player.AddBuff(BuffID.Bleeding, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index a9ecb0805f..9f6aff8276 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -1,290 +1,290 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Perforator { - [AutoloadBossHead] - public class PerforatorHive : ModNPC - { - private bool small = false; - private bool medium = false; - private bool large = false; + [AutoloadBossHead] + public class PerforatorHive : ModNPC + { + private bool small = false; + private bool medium = false; + private bool large = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator Hive"); - Main.npcFrameCount[npc.type] = 10; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator Hive"); + Main.npcFrameCount[npc.type] = 10; + } - public override void SetDefaults() - { - npc.npcSlots = 18f; - npc.damage = 30; - npc.width = 110; - npc.height = 100; - npc.defense = 4; - npc.lifeMax = CalamityWorld.revenge ? 5400 : 3750; - if (CalamityWorld.death) - { - npc.lifeMax = 7600; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 3000000 : 2700000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 6, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath19; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - else - music = MusicID.Boss2; - bossBag = mod.ItemType("PerforatorBag"); - } + public override void SetDefaults() + { + npc.npcSlots = 18f; + npc.damage = 30; + npc.width = 110; + npc.height = 100; + npc.defense = 4; + npc.lifeMax = CalamityWorld.revenge ? 5400 : 3750; + if (CalamityWorld.death) + { + npc.lifeMax = 7600; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 3000000 : 2700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 6, 0, 0); + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath19; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + else + music = MusicID.Boss2; + bossBag = mod.ItemType("PerforatorBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() - { - CalamityGlobalNPC.perfHive = npc.whoAmI; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1.5f, 0f, 0f); - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - bool isCrimson = player.ZoneCrimson || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - if (Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, 10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - bool wormAlive = false; - if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) - { - wormAlive = true; - } - if (wormAlive) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = isCrimson ? false : true; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 6 : 4; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - shoot += 3; - } - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(300, 900)) - { - npc.localAI[0] = 0f; - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 20); - for (int num621 = 0; num621 < 8; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 16; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - float num179 = 8f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 14 : 18; - int num185 = (Main.rand.NextBool(2) ? mod.ProjectileType("IchorShot") : mod.ProjectileType("BloodGeyser")); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 20; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-180, 181); - num180 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.position.Y > player.position.Y - 160f) //200 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - } - else if (npc.position.Y < player.position.Y - 400f) //500 - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y < -3f) - { - npc.velocity.Y = -3f; - } - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 80f) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 80f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - } - if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.3); - if ((float)(npc.life + num660) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - int wormType = mod.NPCType("PerforatorHeadSmall"); - if (!small) - { - small = true; - } - else if (!medium) - { - medium = true; - wormType = mod.NPCType("PerforatorHeadMedium"); - } - else if (!large) - { - large = true; - wormType = mod.NPCType("PerforatorHeadLarge"); - } - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), wormType); - return; - } - } - } - } + public override void AI() + { + CalamityGlobalNPC.perfHive = npc.whoAmI; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1.5f, 0f, 0f); + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + bool isCrimson = player.ZoneCrimson || CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + if (Vector2.Distance(player.Center, npc.Center) > 5600f) + { + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, 10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + bool wormAlive = false; + if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) + { + wormAlive = true; + } + if (wormAlive) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = isCrimson ? false : true; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shoot = revenge ? 6 : 4; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + shoot += 3; + } + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(300, 900)) + { + npc.localAI[0] = 0f; + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 20); + for (int num621 = 0; num621 < 8; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.25f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 16; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + float num179 = 8f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 14 : 18; + int num185 = (Main.rand.NextBool(2) ? mod.ProjectileType("IchorShot") : mod.ProjectileType("BloodGeyser")); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 20; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-180, 181); + num180 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.position.Y > player.position.Y - 160f) //200 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + } + else if (npc.position.Y < player.position.Y - 400f) //500 + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y < -3f) + { + npc.velocity.Y = -3f; + } + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 80f) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 80f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + } + if (npc.ai[3] == 0f && npc.life > 0) + { + npc.ai[3] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.3); + if ((float)(npc.life + num660) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + int wormType = mod.NPCType("PerforatorHeadSmall"); + if (!small) + { + small = true; + } + else if (!medium) + { + medium = true; + wormType = mod.NPCType("PerforatorHeadMedium"); + } + else if (!large) + { + large = true; + wormType = mod.NPCType("PerforatorHeadLarge"); + } + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), wormType); + return; + } + } + } + } - public override bool CheckDead() - { - if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) - { - return false; - } - return true; - } + public override bool CheckDead() + { + if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) + { + return false; + } + return true; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.HealingPotion; + } - public override void NPCLoot() - { + public override void NPCLoot() + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("PerforatorTrophy"), 10); @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.Perforator // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Materials DropHelper.DropItemSpray(npc, mod.ItemType("BloodSample"), 7, 14); DropHelper.DropItemSpray(npc, ItemID.CrimtaneBar, 2, 5); @@ -313,8 +313,8 @@ namespace CalamityMod.NPCs.Perforator // Vanity DropHelper.DropItemChance(npc, mod.ItemType("PerforatorMask"), 7); - DropHelper.DropItemChance(npc, mod.ItemType("BloodyVein"), 10); - } + DropHelper.DropItemChance(npc, mod.ItemType("BloodyVein"), 10); + } // If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore if (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) @@ -334,43 +334,43 @@ namespace CalamityMod.NPCs.Perforator CalamityMod.UpdateServerBoolean(); } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index b2cb23d4d8..5f933526b7 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -1,103 +1,103 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { public class PerforatorTailLarge : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } - public override void SetDefaults() - { - npc.damage = 18; - npc.npcSlots = 5f; - npc.width = 60; - npc.height = 78; - npc.defense = 12; - npc.lifeMax = 2500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + public override void SetDefaults() + { + npc.damage = 18; + npc.npcSlots = 5f; + npc.width = 60; + npc.height = 78; + npc.defense = 12; + npc.lifeMax = 2500; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf5"), 1f); } - } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } public override void OnHitPlayer(Player player, int damage, bool crit) { diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index c9599a23b8..9d46967fad 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -1,103 +1,103 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { public class PerforatorTailMedium : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } - public override void SetDefaults() - { - npc.damage = 14; - npc.npcSlots = 5f; - npc.width = 44; - npc.height = 58; - npc.defense = 10; - npc.lifeMax = 2000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 900000 : 700000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + public override void SetDefaults() + { + npc.damage = 14; + npc.npcSlots = 5f; + npc.width = 44; + npc.height = 58; + npc.defense = 10; + npc.lifeMax = 2000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 900000 : 700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf4"), 1f); } - } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } public override void OnHitPlayer(Player player, int damage, bool crit) { diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index ea6fd6bdb4..a4d432ae5b 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -1,103 +1,103 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { public class PerforatorTailSmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } - public override void SetDefaults() - { - npc.damage = 10; - npc.npcSlots = 5f; - npc.width = 40; - npc.height = 34; - npc.defense = 8; - npc.lifeMax = 1250; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 600000 : 500000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + public override void SetDefaults() + { + npc.damage = 10; + npc.npcSlots = 5f; + npc.width = 40; + npc.height = 34; + npc.defense = 8; + npc.lifeMax = 1250; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 600000 : 500000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 0.9f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.scale = 0.9f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf3"), 1f); } - } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } public override void OnHitPlayer(Player player, int damage, bool crit) { diff --git a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs index 0da166a206..4710384930 100644 --- a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs +++ b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.PlaguebringerGoliath { - public class PbGScreenShaderData : ScreenShaderData - { - private int PbGIndex; + public class PbGScreenShaderData : ScreenShaderData + { + private int PbGIndex; - public PbGScreenShaderData(string passName) - : base(passName) - { - } + public PbGScreenShaderData(string passName) + : base(passName) + { + } - private void UpdatePbGIndex() - { - int PbGType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); - if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) - { - return; - } - PbGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == PbGType) - { - PbGIndex = i; - break; - } - } - } + private void UpdatePbGIndex() + { + int PbGType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) + { + return; + } + PbGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == PbGType) + { + PbGIndex = i; + break; + } + } + } - public override void Apply() - { - UpdatePbGIndex(); - if (PbGIndex != -1) - { - UseTargetPosition(Main.npc[PbGIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdatePbGIndex(); + if (PbGIndex != -1) + { + UseTargetPosition(Main.npc[PbGIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/PlaguebringerGoliath/PbGSky.cs b/NPCs/PlaguebringerGoliath/PbGSky.cs index 79ad3a90e2..9215dfc332 100644 --- a/NPCs/PlaguebringerGoliath/PbGSky.cs +++ b/NPCs/PlaguebringerGoliath/PbGSky.cs @@ -6,96 +6,96 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.PlaguebringerGoliath { - public class PbGSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int PbGIndex = -1; + public class PbGSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int PbGIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdatePbGIndex()) - { - float x = 0f; - if (this.PbGIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } + private float GetIntensity() + { + if (this.UpdatePbGIndex()) + { + float x = 0f; + if (this.PbGIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdatePbGIndex() - { - int PbGType = ModLoader.GetMod("CalamityMod").NPCType("PlaguebringerGoliath"); - if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) - { - return true; - } - PbGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == PbGType) - { - PbGIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return PbGIndex != -1; - } + private bool UpdatePbGIndex() + { + int PbGType = ModLoader.GetMod("CalamityMod").NPCType("PlaguebringerGoliath"); + if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) + { + return true; + } + PbGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == PbGType) + { + PbGIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return PbGIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index 0533194519..d6de7e2475 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -1,233 +1,233 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueBeeG : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 60; - npc.width = 36; - npc.height = 30; - npc.defense = 15; - npc.scale = 0.75f; - npc.lifeMax = 300; + public override void SetDefaults() + { + npc.damage = 60; + npc.width = 36; + npc.height = 30; + npc.defense = 15; + npc.scale = 0.75f; + npc.lifeMax = 300; if (CalamityWorld.bossRushActive) { npc.lifeMax = 50000; } npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.9f; - animationType = 210; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - } + aiType = -1; + npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.9f; + animationType = 210; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.015f, 0.1f, 0f); - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 8f : 7f; - float num2 = revenge ? 0.2f : 0.15f; - if (CalamityWorld.bossRushActive) - { - num *= 1.5f; - num2 *= 1.5f; - } + public override void AI() + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.015f, 0.1f, 0f); + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 8f : 7f; + float num2 = revenge ? 0.2f : 0.15f; + if (CalamityWorld.bossRushActive) + { + num *= 1.5f; + num2 *= 1.5f; + } - npc.localAI[0] += 1f; - float num3 = (npc.localAI[0] - 60f) / 60f; - if (num3 > 1f) - { - num3 = 1f; - } - else - { - if (npc.velocity.X > 6f) - { - npc.velocity.X = 6f; - } - if (npc.velocity.X < -6f) - { - npc.velocity.X = -6f; - } - if (npc.velocity.Y > 6f) - { - npc.velocity.Y = 6f; - } - if (npc.velocity.Y < -6f) - { - npc.velocity.Y = -6f; - } - } - num2 *= num3; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - if (npc.velocity.X < 0f && num4 > 0f) - { - npc.velocity.X = npc.velocity.X + num2; - } - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - if (npc.velocity.X > 0f && num4 < 0f) - { - npc.velocity.X = npc.velocity.X - num2; - } - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - if (npc.velocity.Y < 0f && num5 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - if (npc.velocity.Y > 0f && num5 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + npc.localAI[0] += 1f; + float num3 = (npc.localAI[0] - 60f) / 60f; + if (num3 > 1f) + { + num3 = 1f; + } + else + { + if (npc.velocity.X > 6f) + { + npc.velocity.X = 6f; + } + if (npc.velocity.X < -6f) + { + npc.velocity.X = -6f; + } + if (npc.velocity.Y > 6f) + { + npc.velocity.Y = 6f; + } + if (npc.velocity.Y < -6f) + { + npc.velocity.Y = -6f; + } + } + num2 *= num3; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + if (npc.velocity.X < 0f && num4 > 0f) + { + npc.velocity.X = npc.velocity.X + num2; + } + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + if (npc.velocity.X > 0f && num4 < 0f) + { + npc.velocity.X = npc.velocity.X - num2; + } + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + if (npc.velocity.Y < 0f && num5 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + if (npc.velocity.Y > 0f && num5 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 120, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index fa1b39143e..2294591ff0 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -1,53 +1,53 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueBeeLargeG : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 65; - npc.width = 36; - npc.height = 30; - npc.defense = 20; - npc.lifeMax = 400; + public override void SetDefaults() + { + npc.damage = 65; + npc.width = 36; + npc.height = 30; + npc.defense = 20; + npc.lifeMax = 400; if (CalamityWorld.bossRushActive) { npc.lifeMax = 100000; } npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.95f; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - } + aiType = -1; + npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.95f; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -55,71 +55,71 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.frame.Y = frame * frameHeight; } - public override void AI() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.025f, 0.15f, 0.015f); - Player player = Main.player[npc.target]; - if (player.dead) - { - npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y + 3f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 3f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.TargetClosest(true); - Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - float num1258 = Main.player[npc.target].Center.X - vector145.X; - float num1259 = Main.player[npc.target].Center.Y - vector145.Y; - float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); - float num1261 = revenge ? 22f : 20f; - if (CalamityWorld.bossRushActive) - num1261 = 30f; + public override void AI() + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.025f, 0.15f, 0.015f); + Player player = Main.player[npc.target]; + if (player.dead) + { + npc.TargetClosest(false); + npc.velocity.Y = npc.velocity.Y + 3f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 3f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.TargetClosest(true); + Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); + float num1258 = Main.player[npc.target].Center.X - vector145.X; + float num1259 = Main.player[npc.target].Center.Y - vector145.Y; + float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); + float num1261 = revenge ? 22f : 20f; + if (CalamityWorld.bossRushActive) + num1261 = 30f; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; - } + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index f40c96d98b..068d62df96 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -1,51 +1,51 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueHomingMissile : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Homing Missile"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Homing Missile"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 90; - npc.width = 22; - npc.height = 22; - npc.defense = 10; - npc.lifeMax = CalamityWorld.bossRushActive ? 20000 : 200; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - } + public override void SetDefaults() + { + npc.damage = 90; + npc.width = 22; + npc.height = 22; + npc.defense = 10; + npc.lifeMax = CalamityWorld.bossRushActive ? 20000 : 200; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.015f, 0.1f, 0f); + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.015f, 0.1f, 0f); if (Math.Abs(npc.velocity.X) >= 3f || Math.Abs(npc.velocity.Y) >= 3f) { float num247 = 0f; @@ -188,28 +188,28 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index ceaf768557..2f07b8bf8a 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -1,68 +1,68 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueMine : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Mine"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Mine"); + } - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 1f; - npc.width = 42; - npc.height = 42; - npc.defense = 10; - npc.lifeMax = CalamityWorld.bossRushActive ? 10000 : 100; - npc.aiStyle = -1; + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 1f; + npc.width = 42; + npc.height = 42; + npc.defense = 10; + npc.lifeMax = CalamityWorld.bossRushActive ? 10000 : 100; + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - Player player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - return; - } - } - else if (npc.timeLeft > 600) - { - npc.timeLeft = 600; - } + public override void AI() + { + Player player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + return; + } + } + else if (npc.timeLeft > 600) + { + npc.timeLeft = 600; + } Vector2 vector = Main.player[npc.target].Center - npc.Center; if (vector.Length() < 90f || npc.ai[3] >= 900f) { @@ -79,45 +79,45 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity.X *= 0.985f; return; } - npc.TargetClosest(true); - float num1372 = CalamityWorld.bossRushActive ? 10f : 7f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } + npc.TargetClosest(true); + float num1372 = CalamityWorld.bossRushActive ? 10f : 7f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } public override bool CheckDead() { @@ -150,5 +150,5 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } return true; } - } + } } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index ee0884ead6..e1017514a8 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1,1009 +1,1021 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.PlaguebringerGoliath { [AutoloadBossHead] - public class PlaguebringerGoliath : ModNPC - { - private const float MissileAngleSpread = 90; - private const int MissileProjectiles = 5; - private int MissileCountdown = 0; - private int despawnTimer = 480; - private int chargeDistance = 0; - private bool charging = false; - private bool halfLife = false; - private bool canDespawn = false; - private bool flyingFrame2 = false; + public class PlaguebringerGoliath : ModNPC + { + private const float MissileAngleSpread = 90; + private const int MissileProjectiles = 5; + private int MissileCountdown = 0; + private int despawnTimer = 480; + private int chargeDistance = 0; + private bool charging = false; + private bool halfLife = false; + private bool canDespawn = false; + private bool flyingFrame2 = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Plaguebringer Goliath"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Plaguebringer Goliath"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 64f; - npc.width = 198; - npc.height = 198; - npc.defense = 40; + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 64f; + npc.width = 198; + npc.height = 198; + npc.defense = 40; npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = CalamityWorld.revenge ? 77275 : 58500; - if (CalamityWorld.death) - { - npc.lifeMax = 110000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4000000 : 3700000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.boss = true; - npc.value = Item.buyPrice(0, 25, 0, 0); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("PlaguebringerGoliathBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(halfLife); - writer.Write(canDespawn); - writer.Write(flyingFrame2); - writer.Write(MissileCountdown); - writer.Write(despawnTimer); - writer.Write(chargeDistance); - writer.Write(charging); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - halfLife = reader.ReadBoolean(); - canDespawn = reader.ReadBoolean(); - flyingFrame2 = reader.ReadBoolean(); - MissileCountdown = reader.ReadInt32(); - despawnTimer = reader.ReadInt32(); - chargeDistance = reader.ReadInt32(); - charging = reader.ReadBoolean(); - } - - public override void AI() - { - // Mode variables - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - - // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.15f, 0.35f, 0.05f); - - // Show message - if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.death || CalamityWorld.bossRushActive)) - { - string key = "Mods.CalamityMod.PlagueBossText"; - Color messageColor = Color.Lime; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - - halfLife = true; - } - - // Missile countdown - if (halfLife && MissileCountdown == 0) - MissileCountdown = 600; - if (MissileCountdown > 1) - MissileCountdown--; - - // Count nearby players - int num1038 = 0; - for (int num1039 = 0; num1039 < 255; num1039++) - { - if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) - num1038++; - } - - // Defense gain - if (expertMode) - { - int num1040 = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + num1040; - } - - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); - - // Distance from target - Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; - - // Enrage - bool aboveGroundEnrage = ((double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || - Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; - - bool jungleEnrage = false; - if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) - jungleEnrage = true; - - // Despawn - if (jungleEnrage || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) - { - if (despawnTimer > 0) - despawnTimer--; - } - else - despawnTimer = 480; - - canDespawn = (despawnTimer <= 0); - if (canDespawn) - { - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - - // Phase switch - if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num595 = npc.ai[1]; - int num596; - do - { - num596 = Main.rand.Next(3); - if (MissileCountdown == 1) - num596 = 4; - else if (num596 == 1) - num596 = 2; - else if (num596 == 2) - num596 = 3; - } - - while ((float)num596 == num595); - if (num596 == 0 && ((double)npc.life <= (double)npc.lifeMax * 0.8 || CalamityWorld.death || CalamityWorld.bossRushActive) && distFromPlayer.Length() < 1800f) - { - switch (Main.rand.Next(3)) - { - case 0: chargeDistance = 0; break; - case 1: chargeDistance = 400; break; - case 2: chargeDistance = -400; break; - } - } - - npc.ai[0] = (float)num596; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - - // Charge phase - else if (npc.ai[0] == 0f) - { - int num1043 = 2; - if ((npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - - // Charge - if (npc.ai[1] % 2f == 0f) - { - npc.TargetClosest(true); - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) < 40f) - { - switch (Main.rand.Next(3)) - { - case 0: chargeDistance = 0; break; - case 1: chargeDistance = 400; break; - case 2: chargeDistance = -400; break; - } - - charging = true; - - npc.ai[1] += 1f; - npc.ai[2] = 0f; - - float num1044 = revenge ? 24f : 22f; - if (aboveGroundEnrage) - num1044 += 6f; - if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) - num1044 += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - num1044 += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) - num1044 += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - num1044 += 2f; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num1044 += 2f; - - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - return; - } - - charging = false; - - float num1048 = revenge ? 16f : 14f; - float num1049 = revenge ? 0.2f : 0.18f; - if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) - { - num1048 += 1f; - num1049 += 0.05f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - num1048 += 1f; - num1049 += 0.05f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) - { - num1048 += 2f; - num1049 += 0.05f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num1048 += 2f; - num1049 += 0.1f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1048 += 2f; - num1049 += 0.1f; - } - - if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) - npc.velocity.Y = npc.velocity.Y + num1049; - else - npc.velocity.Y = npc.velocity.Y - num1049; - - if (npc.velocity.Y < -num1048) - npc.velocity.Y = -num1048; - if (npc.velocity.Y > num1048) - npc.velocity.Y = num1048; - - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - else - npc.velocity.X = npc.velocity.X * 0.8f; - - if (npc.velocity.X < -20f) - npc.velocity.X = -20f; - if (npc.velocity.X > 20f) - npc.velocity.X = 20f; - - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - } - - // Slow down after charge - else - { - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - int num1050 = 600; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num1050 = 250; - else if (aboveGroundEnrage) - num1050 = 350; - else if (CalamityWorld.death || CalamityWorld.bossRushActive) - num1050 = 400; - else if ((double)npc.life < (double)npc.lifeMax * 0.1) - num1050 = revenge ? 425 : 450; - else if ((double)npc.life < (double)npc.lifeMax * 0.25) - num1050 = revenge ? 450 : 475; - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - num1050 = 500; - else if ((double)npc.life < (double)npc.lifeMax * 0.75) - num1050 = 550; - - int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - num1051 = -1; - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - npc.ai[2] = 1f; - - if (npc.ai[2] != 1f) - { - charging = true; - return; - } - - npc.TargetClosest(true); - - npc.spriteDirection = npc.direction; - - charging = false; - - npc.velocity *= 0.9f; - float num1052 = revenge ? 0.12f : 0.1f; - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - if (npc.life < npc.lifeMax / 3 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - - // Move closer if too far away - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; - float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); - if (num1057 < 600f) - { - npc.ai[0] = (((double)npc.life <= (double)npc.lifeMax * 0.66 || CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 1f); - npc.ai[1] = 0f; - npc.netUpdate = true; - return; - } - - // Move closer - Movement(100f, 350f, 450f); - } - - // Spawn bees - else if (npc.ai[0] == 1f) - { - charging = false; - - npc.TargetClosest(true); - - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(80 * npc.direction), npc.position.Y + (float)npc.height * 1.2f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) - npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - npc.ai[1] += 0.25f; - - bool flag103 = false; - if (npc.ai[1] > 40f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - - if (flag103) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int randomAmt = expertMode ? 2 : 4; - if (Main.rand.Next(randomAmt) == 0) - randomAmt = mod.NPCType("PlagueBeeLargeG"); - else - randomAmt = mod.NPCType("PlagueBeeG"); - - if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 4 : 2)) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); - - if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < (aboveGroundEnrage ? 2 : 1)) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); - - if (NPC.CountNPCS(mod.NPCType("PlagueBeeLargeG")) < 2) - { - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, randomAmt, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); - Main.npc[num1062].localAI[0] = 60f; - Main.npc[num1062].netUpdate = true; - } - } - } - - // Move closer if too far away - if (num1060 > 600f) - Movement(100f, 350f, 450f); - else - npc.velocity *= 0.9f; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - - if (npc.ai[2] > 2f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - - // Missile spawn - else if (npc.ai[0] == 5f) - { - charging = false; - - npc.TargetClosest(true); - - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(80 * npc.direction), npc.position.Y + (float)npc.height * 1.2f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - bool flag103 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) - npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - npc.ai[1] += 0.25f; - - if (npc.ai[1] > 40f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - - if (flag103) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 6 : 4)) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); - - if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < 1 && aboveGroundEnrage) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); - - float projectileSpeed = revenge ? 6f : 5f; - float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector119.X; - float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector119.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - - num1073 = projectileSpeed / num1073; - num1071 *= num1073; - num1072 *= num1073; - - if (NPC.CountNPCS(mod.NPCType("PlagueHomingMissile")) < (aboveGroundEnrage ? 8 : 5)) - { - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueHomingMissile"), 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = num1071; - Main.npc[num1062].velocity.Y = num1072; - Main.npc[num1062].netUpdate = true; - } - } - } - - // Move closer if too far away - if (num1060 > 600f) - Movement(100f, 350f, 450f); - else - npc.velocity *= 0.9f; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - - if (npc.ai[2] > 2f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - - // Stinger phase - else if (npc.ai[0] == 3f) - { - Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(80 * npc.direction), npc.position.Y + (float)npc.height * 1.2f); - - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - if (npc.ai[1] % 10f == 9f) - flag104 = true; - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death || CalamityWorld.bossRushActive || aboveGroundEnrage) - { - if (npc.ai[1] % 20f == 19f) - flag104 = true; - } - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - if (npc.ai[1] % 25f == 24f) - flag104 = true; - } - else if (npc.ai[1] % 30f == 29f) - flag104 = true; - - if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float projectileSpeed = revenge ? 6.5f : 6f; - if (jungleEnrage || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - projectileSpeed += 10f; - if (CalamityWorld.bossRushActive) - projectileSpeed *= 1.5f; - - float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X; - float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = projectileSpeed / num1073; - num1071 *= num1073; - num1072 *= num1073; - - int num1074 = 40; - int num1075 = (Main.rand.NextBool(2) ? mod.ProjectileType("PlagueStingerGoliath") : mod.ProjectileType("PlagueStingerGoliathV2")); - if (expertMode) - { - num1074 = 32; - int damageBoost = (int)(6f * (1f - (float)npc.life / (float)npc.lifeMax)); - num1074 += damageBoost; - - if (Main.rand.NextBool(6)) - { - num1074 += 8; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - } - else - { - if (Main.rand.NextBool(9)) - { - num1074 = 50; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - } - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); - } - } - - Movement(100f, 400f, 500f); - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - - if (npc.ai[1] >= 300f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } - - // Missile charge - else if (npc.ai[0] == 4f) - { - int num1043 = 2; - if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) - { - MissileCountdown = 0; - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - - // Charge - if (npc.ai[1] % 2f == 0f) - { - npc.TargetClosest(true); - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) < 40f) - { - if (MissileCountdown == 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 116); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int speed = revenge ? 6 : 5; - if (CalamityWorld.bossRushActive) - speed = 9; - - float spawnX = npc.Center.X; - float spawnY = npc.Center.Y; - int damage = expertMode ? 48 : 60; - - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed; - - for (int i = 0; i < MissileProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (MissileProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / (float)MissileProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("HiveBombGoliath"), damage, 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); - } - } - } - - charging = true; - - npc.ai[1] += 1f; - npc.ai[2] = 0f; - - float num1044 = revenge ? 28f : 26f; - if (CalamityWorld.bossRushActive) - num1044 = 32f; - - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = (Main.player[npc.target].position.Y - 500f) + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - return; - } - - charging = false; - - float num1048 = revenge ? 16f : 14f; - float num1049 = revenge ? 0.2f : 0.18f; - if (CalamityWorld.bossRushActive) - { - num1048 *= 1.5f; - num1049 *= 1.5f; - } - - if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) - npc.velocity.Y = npc.velocity.Y + num1049; - else - npc.velocity.Y = npc.velocity.Y - num1049; - - if (npc.velocity.Y < -num1048) - npc.velocity.Y = -num1048; - if (npc.velocity.Y > num1048) - npc.velocity.Y = num1048; - - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - else - npc.velocity.X = npc.velocity.X * 0.8f; - - if (npc.velocity.X < -20f) - npc.velocity.X = -20f; - if (npc.velocity.X > 20f) - npc.velocity.X = 20f; - - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - } - - // Slow down after charge - else - { - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - int num1050 = 600; - int num1051 = 1; - - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - num1051 = -1; - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - npc.ai[2] = 1f; - - if (npc.ai[2] != 1f) - { - charging = true; - return; - } - - npc.TargetClosest(true); - - npc.spriteDirection = npc.direction; - - charging = false; - - npc.velocity *= 0.9f; - float num1052 = revenge ? 0.12f : 0.1f; - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - if (npc.life < npc.lifeMax / 3 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - } - - private void Movement(float xPos, float yPos, float yPos2) - { - if (npc.position.Y > Main.player[npc.target].position.Y - yPos) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - yPos2) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; - npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + xPos) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - xPos) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - } - - public override bool CheckActive() - { - return canDespawn; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 2f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - if (charging) - { - texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); - } - else - { - if (!flyingFrame2) - { - texture = Main.npcTexture[npc.type]; - } - else - { - texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex"); - } - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 4) - { - npc.frame.Y = 0; - if (!charging) - { - flyingFrame2 = !flyingFrame2; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { + if (CalamityWorld.death) + { + npc.lifeMax = 110000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4000000 : 3700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.boss = true; + npc.value = Item.buyPrice(0, 25, 0, 0); + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("PlaguebringerGoliathBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(halfLife); + writer.Write(canDespawn); + writer.Write(flyingFrame2); + writer.Write(MissileCountdown); + writer.Write(despawnTimer); + writer.Write(chargeDistance); + writer.Write(charging); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + halfLife = reader.ReadBoolean(); + canDespawn = reader.ReadBoolean(); + flyingFrame2 = reader.ReadBoolean(); + MissileCountdown = reader.ReadInt32(); + despawnTimer = reader.ReadInt32(); + chargeDistance = reader.ReadInt32(); + charging = reader.ReadBoolean(); + } + + public override void AI() + { + // Mode variables + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + + // Light + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.15f, 0.35f, 0.05f); + + // Show message + if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.death || CalamityWorld.bossRushActive)) + { + string key = "Mods.CalamityMod.PlagueBossText"; + Color messageColor = Color.Lime; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + + halfLife = true; + } + + // Missile countdown + if (halfLife && MissileCountdown == 0) + MissileCountdown = 600; + if (MissileCountdown > 1) + MissileCountdown--; + + // Count nearby players + int num1038 = 0; + for (int num1039 = 0; num1039 < 255; num1039++) + { + if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) + num1038++; + } + + // Defense gain + if (expertMode) + { + int num1040 = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense + num1040; + } + + // Target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); + + // Distance from target + Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; + + // Enrage + bool aboveGroundEnrage = ((double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || + Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; + + bool jungleEnrage = false; + if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) + jungleEnrage = true; + + // Despawn + if (jungleEnrage || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) + { + if (despawnTimer > 0) + despawnTimer--; + } + else + despawnTimer = 480; + + canDespawn = (despawnTimer <= 0); + if (canDespawn) + { + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + + // Phase switch + if (npc.ai[0] == -1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num595 = npc.ai[1]; + int num596; + do + { + num596 = Main.rand.Next(3); + if (MissileCountdown == 1) + num596 = 4; + else if (num596 == 1) + num596 = 2; + else if (num596 == 2) + num596 = 3; + } + + while ((float)num596 == num595); + if (num596 == 0 && ((double)npc.life <= (double)npc.lifeMax * 0.8 || CalamityWorld.death || CalamityWorld.bossRushActive) && distFromPlayer.Length() < 1800f) + { + switch (Main.rand.Next(3)) + { + case 0: + chargeDistance = 0; + break; + case 1: + chargeDistance = 400; + break; + case 2: + chargeDistance = -400; + break; + } + } + + npc.ai[0] = (float)num596; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + + // Charge phase + else if (npc.ai[0] == 0f) + { + int num1043 = 2; + if ((npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + + // Charge + if (npc.ai[1] % 2f == 0f) + { + npc.TargetClosest(true); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) < 40f) + { + switch (Main.rand.Next(3)) + { + case 0: + chargeDistance = 0; + break; + case 1: + chargeDistance = 400; + break; + case 2: + chargeDistance = -400; + break; + } + + charging = true; + + npc.ai[1] += 1f; + npc.ai[2] = 0f; + + float num1044 = revenge ? 24f : 22f; + if (aboveGroundEnrage) + num1044 += 6f; + if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) + num1044 += 2f; + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + num1044 += 2f; + if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + num1044 += 2f; + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + num1044 += 2f; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num1044 += 2f; + + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + return; + } + + charging = false; + + float num1048 = revenge ? 16f : 14f; + float num1049 = revenge ? 0.2f : 0.18f; + if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) + { + num1048 += 1f; + num1049 += 0.05f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + num1048 += 1f; + num1049 += 0.05f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + { + num1048 += 2f; + num1049 += 0.05f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num1048 += 2f; + num1049 += 0.1f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1048 += 2f; + num1049 += 0.1f; + } + + if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) + npc.velocity.Y = npc.velocity.Y + num1049; + else + npc.velocity.Y = npc.velocity.Y - num1049; + + if (npc.velocity.Y < -num1048) + npc.velocity.Y = -num1048; + if (npc.velocity.Y > num1048) + npc.velocity.Y = num1048; + + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + else + npc.velocity.X = npc.velocity.X * 0.8f; + + if (npc.velocity.X < -20f) + npc.velocity.X = -20f; + if (npc.velocity.X > 20f) + npc.velocity.X = 20f; + + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + } + + // Slow down after charge + else + { + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + int num1050 = 600; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num1050 = 250; + else if (aboveGroundEnrage) + num1050 = 350; + else if (CalamityWorld.death || CalamityWorld.bossRushActive) + num1050 = 400; + else if ((double)npc.life < (double)npc.lifeMax * 0.1) + num1050 = revenge ? 425 : 450; + else if ((double)npc.life < (double)npc.lifeMax * 0.25) + num1050 = revenge ? 450 : 475; + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + num1050 = 500; + else if ((double)npc.life < (double)npc.lifeMax * 0.75) + num1050 = 550; + + int num1051 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + num1051 = -1; + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + npc.ai[2] = 1f; + + if (npc.ai[2] != 1f) + { + charging = true; + return; + } + + npc.TargetClosest(true); + + npc.spriteDirection = npc.direction; + + charging = false; + + npc.velocity *= 0.9f; + float num1052 = revenge ? 0.12f : 0.1f; + if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + if (npc.life < npc.lifeMax / 3 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + + // Move closer if too far away + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + + Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; + float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; + float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + if (num1057 < 600f) + { + npc.ai[0] = (((double)npc.life <= (double)npc.lifeMax * 0.66 || CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 1f); + npc.ai[1] = 0f; + npc.netUpdate = true; + return; + } + + // Move closer + Movement(100f, 350f, 450f); + } + + // Spawn bees + else if (npc.ai[0] == 1f) + { + charging = false; + + npc.TargetClosest(true); + + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(80 * npc.direction), npc.position.Y + (float)npc.height * 1.2f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + + npc.ai[1] += 1f; + npc.ai[1] += (float)(num1038 / 2); + if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) + npc.ai[1] += 0.25f; + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + npc.ai[1] += 0.25f; + + bool flag103 = false; + if (npc.ai[1] > 40f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + + if (flag103) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int randomAmt = expertMode ? 2 : 4; + if (Main.rand.Next(randomAmt) == 0) + randomAmt = mod.NPCType("PlagueBeeLargeG"); + else + randomAmt = mod.NPCType("PlagueBeeG"); + + if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 4 : 2)) + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); + + if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < (aboveGroundEnrage ? 2 : 1)) + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); + + if (NPC.CountNPCS(mod.NPCType("PlagueBeeLargeG")) < 2) + { + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, randomAmt, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); + Main.npc[num1062].localAI[0] = 60f; + Main.npc[num1062].netUpdate = true; + } + } + } + + // Move closer if too far away + if (num1060 > 600f) + Movement(100f, 350f, 450f); + else + npc.velocity *= 0.9f; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + + if (npc.ai[2] > 2f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + + // Missile spawn + else if (npc.ai[0] == 5f) + { + charging = false; + + npc.TargetClosest(true); + + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(80 * npc.direction), npc.position.Y + (float)npc.height * 1.2f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + + npc.ai[1] += 1f; + npc.ai[1] += (float)(num1038 / 2); + bool flag103 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + npc.ai[1] += 0.25f; + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + npc.ai[1] += 0.25f; + + if (npc.ai[1] > 40f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + + if (flag103) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 6 : 4)) + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); + + if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < 1 && aboveGroundEnrage) + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); + + float projectileSpeed = revenge ? 6f : 5f; + float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector119.X; + float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector119.Y; + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + + num1073 = projectileSpeed / num1073; + num1071 *= num1073; + num1072 *= num1073; + + if (NPC.CountNPCS(mod.NPCType("PlagueHomingMissile")) < (aboveGroundEnrage ? 8 : 5)) + { + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueHomingMissile"), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = num1071; + Main.npc[num1062].velocity.Y = num1072; + Main.npc[num1062].netUpdate = true; + } + } + } + + // Move closer if too far away + if (num1060 > 600f) + Movement(100f, 350f, 450f); + else + npc.velocity *= 0.9f; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + + if (npc.ai[2] > 2f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + + // Stinger phase + else if (npc.ai[0] == 3f) + { + Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(80 * npc.direction), npc.position.Y + (float)npc.height * 1.2f); + + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + if (npc.ai[1] % 10f == 9f) + flag104 = true; + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death || CalamityWorld.bossRushActive || aboveGroundEnrage) + { + if (npc.ai[1] % 20f == 19f) + flag104 = true; + } + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + if (npc.ai[1] % 25f == 24f) + flag104 = true; + } + else if (npc.ai[1] % 30f == 29f) + flag104 = true; + + if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileSpeed = revenge ? 6.5f : 6f; + if (jungleEnrage || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + projectileSpeed += 10f; + if (CalamityWorld.bossRushActive) + projectileSpeed *= 1.5f; + + float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X; + float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y; + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = projectileSpeed / num1073; + num1071 *= num1073; + num1072 *= num1073; + + int num1074 = 40; + int num1075 = (Main.rand.NextBool(2) ? mod.ProjectileType("PlagueStingerGoliath") : mod.ProjectileType("PlagueStingerGoliathV2")); + if (expertMode) + { + num1074 = 32; + int damageBoost = (int)(6f * (1f - (float)npc.life / (float)npc.lifeMax)); + num1074 += damageBoost; + + if (Main.rand.NextBool(6)) + { + num1074 += 8; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + } + else + { + if (Main.rand.NextBool(9)) + { + num1074 = 50; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + } + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); + } + } + + Movement(100f, 400f, 500f); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + + if (npc.ai[1] >= 300f) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } + + // Missile charge + else if (npc.ai[0] == 4f) + { + int num1043 = 2; + if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) + { + MissileCountdown = 0; + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + + // Charge + if (npc.ai[1] % 2f == 0f) + { + npc.TargetClosest(true); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) < 40f) + { + if (MissileCountdown == 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 116); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int speed = revenge ? 6 : 5; + if (CalamityWorld.bossRushActive) + speed = 9; + + float spawnX = npc.Center.X; + float spawnY = npc.Center.Y; + int damage = expertMode ? 48 : 60; + + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity *= speed; + + for (int i = 0; i < MissileProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X = spawn.X + i * 30 - (MissileProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / (float)MissileProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("HiveBombGoliath"), damage, 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); + } + } + } + + charging = true; + + npc.ai[1] += 1f; + npc.ai[2] = 0f; + + float num1044 = revenge ? 28f : 26f; + if (CalamityWorld.bossRushActive) + num1044 = 32f; + + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = (Main.player[npc.target].position.Y - 500f) + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + return; + } + + charging = false; + + float num1048 = revenge ? 16f : 14f; + float num1049 = revenge ? 0.2f : 0.18f; + if (CalamityWorld.bossRushActive) + { + num1048 *= 1.5f; + num1049 *= 1.5f; + } + + if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) + npc.velocity.Y = npc.velocity.Y + num1049; + else + npc.velocity.Y = npc.velocity.Y - num1049; + + if (npc.velocity.Y < -num1048) + npc.velocity.Y = -num1048; + if (npc.velocity.Y > num1048) + npc.velocity.Y = num1048; + + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + else + npc.velocity.X = npc.velocity.X * 0.8f; + + if (npc.velocity.X < -20f) + npc.velocity.X = -20f; + if (npc.velocity.X > 20f) + npc.velocity.X = 20f; + + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + } + + // Slow down after charge + else + { + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + int num1050 = 600; + int num1051 = 1; + + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + num1051 = -1; + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + npc.ai[2] = 1f; + + if (npc.ai[2] != 1f) + { + charging = true; + return; + } + + npc.TargetClosest(true); + + npc.spriteDirection = npc.direction; + + charging = false; + + npc.velocity *= 0.9f; + float num1052 = revenge ? 0.12f : 0.1f; + if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + if (npc.life < npc.lifeMax / 3 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; + } + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + } + + private void Movement(float xPos, float yPos, float yPos2) + { + if (npc.position.Y > Main.player[npc.target].position.Y - yPos) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - yPos2) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y = npc.velocity.Y + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + xPos) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X - (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - xPos) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X = npc.velocity.X + (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + } + } + + public override bool CheckActive() + { + return canDespawn; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 2f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + if (charging) + { + texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); + } + else + { + if (!flyingFrame2) + { + texture = Main.npcTexture[npc.type]; + } + else + { + texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex"); + } + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 4) + { + npc.frame.Y = 0; + if (!charging) + { + flyingFrame2 = !flyingFrame2; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("PlaguebringerGoliathTrophy"), 10); @@ -1012,7 +1024,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Materials DropHelper.DropItemSpray(npc, mod.ItemType("PlagueCellCluster"), 10, 14); @@ -1031,27 +1043,27 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Vanity DropHelper.DropItemChance(npc, mod.ItemType("PlaguebringerGoliathMask"), 7); - } + } // Mark PBG as dead CalamityWorld.downedPlaguebringer = true; CalamityMod.UpdateServerBoolean(); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } + } } diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.cs b/NPCs/PlaguebringerShade/PlaguebringerShade.cs index 103e75b694..9cbbf31fa7 100644 --- a/NPCs/PlaguebringerShade/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerShade/PlaguebringerShade.cs @@ -1,632 +1,632 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.PlaguebringerShade { public class PlaguebringerShade : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plaguebringer"); - Main.npcFrameCount[npc.type] = 12; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer"); + Main.npcFrameCount[npc.type] = 12; + } - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 8f; - npc.width = 66; - npc.height = 66; - npc.defense = 30; + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 8f; + npc.width = 66; + npc.height = 66; + npc.defense = 30; npc.Calamity().RevPlusDR(0.2f); npc.lifeMax = CalamityWorld.death ? 4000 : 3000; - npc.value = Item.buyPrice(0, 1, 50, 0); - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 200000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - animationType = NPCID.QueenBee; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; - bannerItem = mod.ItemType("PlaguebringerBanner"); - } + npc.value = Item.buyPrice(0, 1, 50, 0); + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 200000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + animationType = NPCID.QueenBee; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + banner = npc.type; + bannerItem = mod.ItemType("PlaguebringerBanner"); + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.05f, 0.15f, 0.025f); - bool flag113 = false; - if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) - { - flag113 = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - } - else - { - if (npc.timeLeft < 750) - { - npc.timeLeft = 750; - } - } - int num1038 = 0; - for (int num1039 = 0; num1039 < 255; num1039++) - { - if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) - { - num1038++; - } - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - bool dead4 = Main.player[npc.target].dead; - if (dead4 && Main.expertMode) - { - if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) - { - npc.velocity.Y = npc.velocity.Y + 0.04f; - } - if (npc.position.X < (float)(Main.maxTilesX * 8)) - { - npc.velocity.X = npc.velocity.X - 0.04f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.04f; - } - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return; - } - } - else if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num1041 = npc.ai[1]; - int num1042; - do - { - num1042 = Main.rand.Next(3); - if (num1042 == 1) - { - num1042 = 2; - } - else if (num1042 == 2) - { - num1042 = 3; - } - } - while ((float)num1042 == num1041); - npc.ai[0] = (float)num1042; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - } - else if (npc.ai[0] == 0f) - { - int num1043 = 2; //2 - if (flag113) - { - num1043 += 1; - } - if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] % 2f == 0f) - { - npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) - { - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num1044 = 15f; - if (flag113) - { - num1044 += 2f; - } - if (CalamityWorld.bossRushActive) - { - num1044 *= 1.5f; - } - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.spriteDirection = npc.direction; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - return; - } - npc.localAI[0] = 0f; - float num1048 = 12.25f; - float num1049 = 0.155f; - if (flag113) - { - num1048 += 1f; - num1049 += 0.075f; - } - if (CalamityWorld.bossRushActive) - { - num1048 *= 1.5f; - num1049 *= 1.5f; - } - if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) - { - npc.velocity.Y = npc.velocity.Y + num1049; - } - else - { - npc.velocity.Y = npc.velocity.Y - num1049; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -num1048; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = num1048; - } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.8f; - } - if (npc.velocity.X < -16f) - { - npc.velocity.X = -16f; - } - if (npc.velocity.X > 16f) - { - npc.velocity.X = 16f; - } - npc.spriteDirection = npc.direction; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - int num1050 = CalamityWorld.bossRushActive ? 400 : 500; - int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - num1051 = -1; - } - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - { - npc.ai[2] = 1f; - } - if (npc.ai[2] != 1f) - { - npc.localAI[0] = 1f; - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - npc.velocity *= 0.9f; - float num1052 = 0.105f; - if (flag113 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.075f; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - float num1053 = 12f; - float num1054 = 0.1f; - if (flag113) - { - num1054 = 0.12f; - } - if (CalamityWorld.bossRushActive) - { - num1053 *= 1.5f; - num1054 *= 1.5f; - } - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; - float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); - if (num1057 < 400f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return; - } - num1057 = num1053 / num1057; - if (npc.velocity.X < num1055) - { - npc.velocity.X = npc.velocity.X + num1054; - if (npc.velocity.X < 0f && num1055 > 0f) - { - npc.velocity.X = npc.velocity.X + num1054; - } - } - else if (npc.velocity.X > num1055) - { - npc.velocity.X = npc.velocity.X - num1054; - if (npc.velocity.X > 0f && num1055 < 0f) - { - npc.velocity.X = npc.velocity.X - num1054; - } - } - if (npc.velocity.Y < num1056) - { - npc.velocity.Y = npc.velocity.Y + num1054; - if (npc.velocity.Y < 0f && num1056 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1054; - } - } - else if (npc.velocity.Y > num1056) - { - npc.velocity.Y = npc.velocity.Y - num1054; - if (npc.velocity.Y > 0f && num1056 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1054; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(40 * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - bool flag103 = false; - if (npc.ai[1] > 10f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num1061; - if (Main.rand.NextBool(4)) - { - num1061 = mod.NPCType("PlagueBeeLargeG"); - } - else - { - num1061 = mod.NPCType("PlagueBeeG"); - } - if (NPC.CountNPCS(mod.NPCType("PlagueBeeG")) < 3) - { - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, num1061, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.005f; - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.005f; - Main.npc[num1062].localAI[0] = 60f; - Main.npc[num1062].netUpdate = true; - } - } - } - if (num1060 > 400f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num1063 = 14.5f; - float num1064 = 0.105f; - if (CalamityWorld.bossRushActive) - { - num1063 *= 1.5f; - num1064 *= 1.5f; - } - vector120 = vector119; - num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) - { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - { - npc.velocity.X = npc.velocity.X + num1064; - } - } - else if (npc.velocity.X > num1058) - { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - { - npc.velocity.X = npc.velocity.X - num1064; - } - } - if (npc.velocity.Y < num1059) - { - npc.velocity.Y = npc.velocity.Y + num1064; - if (npc.velocity.Y < 0f && num1059 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1064; - } - } - else if (npc.velocity.Y > num1059) - { - npc.velocity.Y = npc.velocity.Y - num1064; - if (npc.velocity.Y > 0f && num1059 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1064; - } - } - } - else - { - npc.velocity *= 0.9f; //changed from 0.9 - } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 2f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - float num1065 = 7f; - float num1066 = 0.075f; - if (flag113) - { - num1066 = 0.09f; - num1065 = 8f; - } - if (CalamityWorld.bossRushActive) - { - num1065 *= 1.5f; - num1066 *= 1.5f; - } - Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(40 * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector122 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; - float num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector122.Y; - float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.ai[1] % 35f == 34f) - { - flag104 = true; - } - if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num1070 = 6f; - if (flag113) - { - num1070 += 2f; - } - float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X; - float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - int num1074 = 26; - int num1075 = mod.ProjectileType("PlagueStingerGoliathV2"); - if (Main.rand.NextBool(15)) - { - num1074 = 33; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); - } - } - if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - num1066 = CalamityWorld.bossRushActive ? 0.12f : 0.105f; - vector122 = vector121; - num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; - num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector122.Y; - if (npc.velocity.X < num1067) - { - npc.velocity.X = npc.velocity.X + num1066; - if (npc.velocity.X < 0f && num1067 > 0f) - { - npc.velocity.X = npc.velocity.X + num1066; - } - } - else if (npc.velocity.X > num1067) - { - npc.velocity.X = npc.velocity.X - num1066; - if (npc.velocity.X > 0f && num1067 < 0f) - { - npc.velocity.X = npc.velocity.X - num1066; - } - } - if (npc.velocity.Y < num1068) - { - npc.velocity.Y = npc.velocity.Y + num1066; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1066; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num1066; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1066; - } - } - } - else if (num1069 > 100f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - num1069 = num1065 / num1069; - if (npc.velocity.X < num1067) - { - npc.velocity.X = npc.velocity.X + num1066; - if (npc.velocity.X < 0f && num1067 > 0f) - { - npc.velocity.X = npc.velocity.X + num1066 * 2f; - } - } - else if (npc.velocity.X > num1067) - { - npc.velocity.X = npc.velocity.X - num1066; - if (npc.velocity.X > 0f && num1067 < 0f) - { - npc.velocity.X = npc.velocity.X - num1066 * 2f; - } - } - if (npc.velocity.Y < num1068) - { - npc.velocity.Y = npc.velocity.Y + num1066; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1066 * 2f; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num1066; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1066 * 2f; - } - } - } - if (npc.ai[1] > 600f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.05f, 0.15f, 0.025f); + bool flag113 = false; + if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) + { + flag113 = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + } + else + { + if (npc.timeLeft < 750) + { + npc.timeLeft = 750; + } + } + int num1038 = 0; + for (int num1039 = 0; num1039 < 255; num1039++) + { + if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) + { + num1038++; + } + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + bool dead4 = Main.player[npc.target].dead; + if (dead4 && Main.expertMode) + { + if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) + { + npc.velocity.Y = npc.velocity.Y + 0.04f; + } + if (npc.position.X < (float)(Main.maxTilesX * 8)) + { + npc.velocity.X = npc.velocity.X - 0.04f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.04f; + } + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return; + } + } + else if (npc.ai[0] == -1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num1041 = npc.ai[1]; + int num1042; + do + { + num1042 = Main.rand.Next(3); + if (num1042 == 1) + { + num1042 = 2; + } + else if (num1042 == 2) + { + num1042 = 3; + } + } + while ((float)num1042 == num1041); + npc.ai[0] = (float)num1042; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + return; + } + } + else if (npc.ai[0] == 0f) + { + int num1043 = 2; //2 + if (flag113) + { + num1043 += 1; + } + if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] % 2f == 0f) + { + npc.TargetClosest(true); + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) + { + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num1044 = 15f; + if (flag113) + { + num1044 += 2f; + } + if (CalamityWorld.bossRushActive) + { + num1044 *= 1.5f; + } + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + npc.spriteDirection = npc.direction; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + return; + } + npc.localAI[0] = 0f; + float num1048 = 12.25f; + float num1049 = 0.155f; + if (flag113) + { + num1048 += 1f; + num1049 += 0.075f; + } + if (CalamityWorld.bossRushActive) + { + num1048 *= 1.5f; + num1049 *= 1.5f; + } + if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) + { + npc.velocity.Y = npc.velocity.Y + num1049; + } + else + { + npc.velocity.Y = npc.velocity.Y - num1049; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -num1048; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = num1048; + } + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + { + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + } + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + { + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.8f; + } + if (npc.velocity.X < -16f) + { + npc.velocity.X = -16f; + } + if (npc.velocity.X > 16f) + { + npc.velocity.X = 16f; + } + npc.spriteDirection = npc.direction; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + int num1050 = CalamityWorld.bossRushActive ? 400 : 500; + int num1051 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + num1051 = -1; + } + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + { + npc.ai[2] = 1f; + } + if (npc.ai[2] != 1f) + { + npc.localAI[0] = 1f; + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + npc.velocity *= 0.9f; + float num1052 = 0.105f; + if (flag113 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.075f; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + float num1053 = 12f; + float num1054 = 0.1f; + if (flag113) + { + num1054 = 0.12f; + } + if (CalamityWorld.bossRushActive) + { + num1053 *= 1.5f; + num1054 *= 1.5f; + } + Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; + float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; + float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + if (num1057 < 400f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return; + } + num1057 = num1053 / num1057; + if (npc.velocity.X < num1055) + { + npc.velocity.X = npc.velocity.X + num1054; + if (npc.velocity.X < 0f && num1055 > 0f) + { + npc.velocity.X = npc.velocity.X + num1054; + } + } + else if (npc.velocity.X > num1055) + { + npc.velocity.X = npc.velocity.X - num1054; + if (npc.velocity.X > 0f && num1055 < 0f) + { + npc.velocity.X = npc.velocity.X - num1054; + } + } + if (npc.velocity.Y < num1056) + { + npc.velocity.Y = npc.velocity.Y + num1054; + if (npc.velocity.Y < 0f && num1056 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1054; + } + } + else if (npc.velocity.Y > num1056) + { + npc.velocity.Y = npc.velocity.Y - num1054; + if (npc.velocity.Y > 0f && num1056 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1054; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(40 * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + npc.ai[1] += 1f; + npc.ai[1] += (float)(num1038 / 2); + bool flag103 = false; + if (npc.ai[1] > 10f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num1061; + if (Main.rand.NextBool(4)) + { + num1061 = mod.NPCType("PlagueBeeLargeG"); + } + else + { + num1061 = mod.NPCType("PlagueBeeG"); + } + if (NPC.CountNPCS(mod.NPCType("PlagueBeeG")) < 3) + { + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, num1061, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.005f; + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.005f; + Main.npc[num1062].localAI[0] = 60f; + Main.npc[num1062].netUpdate = true; + } + } + } + if (num1060 > 400f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num1063 = 14.5f; + float num1064 = 0.105f; + if (CalamityWorld.bossRushActive) + { + num1063 *= 1.5f; + num1064 *= 1.5f; + } + vector120 = vector119; + num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1060 = num1063 / num1060; + if (npc.velocity.X < num1058) + { + npc.velocity.X = npc.velocity.X + num1064; + if (npc.velocity.X < 0f && num1058 > 0f) + { + npc.velocity.X = npc.velocity.X + num1064; + } + } + else if (npc.velocity.X > num1058) + { + npc.velocity.X = npc.velocity.X - num1064; + if (npc.velocity.X > 0f && num1058 < 0f) + { + npc.velocity.X = npc.velocity.X - num1064; + } + } + if (npc.velocity.Y < num1059) + { + npc.velocity.Y = npc.velocity.Y + num1064; + if (npc.velocity.Y < 0f && num1059 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1064; + } + } + else if (npc.velocity.Y > num1059) + { + npc.velocity.Y = npc.velocity.Y - num1064; + if (npc.velocity.Y > 0f && num1059 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1064; + } + } + } + else + { + npc.velocity *= 0.9f; //changed from 0.9 + } + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 2f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + float num1065 = 7f; + float num1066 = 0.075f; + if (flag113) + { + num1066 = 0.09f; + num1065 = 8f; + } + if (CalamityWorld.bossRushActive) + { + num1065 *= 1.5f; + num1066 *= 1.5f; + } + Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(40 * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector122 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; + float num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector122.Y; + float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.ai[1] % 35f == 34f) + { + flag104 = true; + } + if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num1070 = 6f; + if (flag113) + { + num1070 += 2f; + } + float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X; + float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y; + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + int num1074 = 26; + int num1075 = mod.ProjectileType("PlagueStingerGoliathV2"); + if (Main.rand.NextBool(15)) + { + num1074 = 33; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); + } + } + if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + num1066 = CalamityWorld.bossRushActive ? 0.12f : 0.105f; + vector122 = vector121; + num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; + num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector122.Y; + if (npc.velocity.X < num1067) + { + npc.velocity.X = npc.velocity.X + num1066; + if (npc.velocity.X < 0f && num1067 > 0f) + { + npc.velocity.X = npc.velocity.X + num1066; + } + } + else if (npc.velocity.X > num1067) + { + npc.velocity.X = npc.velocity.X - num1066; + if (npc.velocity.X > 0f && num1067 < 0f) + { + npc.velocity.X = npc.velocity.X - num1066; + } + } + if (npc.velocity.Y < num1068) + { + npc.velocity.Y = npc.velocity.Y + num1066; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1066; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num1066; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1066; + } + } + } + else if (num1069 > 100f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + num1069 = num1065 / num1069; + if (npc.velocity.X < num1067) + { + npc.velocity.X = npc.velocity.X + num1066; + if (npc.velocity.X < 0f && num1067 > 0f) + { + npc.velocity.X = npc.velocity.X + num1066 * 2f; + } + } + else if (npc.velocity.X > num1067) + { + npc.velocity.X = npc.velocity.X - num1066; + if (npc.velocity.X > 0f && num1067 < 0f) + { + npc.velocity.X = npc.velocity.X - num1066 * 2f; + } + } + if (npc.velocity.Y < num1068) + { + npc.velocity.Y = npc.velocity.Y + num1066; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1066 * 2f; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num1066; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1066 * 2f; + } + } + } + if (npc.ai[1] > 600f) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.02f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.02f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(8, 13)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(8, 13)); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 120, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 120, true); + } + } } diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index ca0710d8ee..ed52b0a93a 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -1,68 +1,68 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Polterghast { - public class PhantomFuckYou : ModNPC - { - private bool start = true; + public class PhantomFuckYou : ModNPC + { + private bool start = true; private int timer = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 30; - npc.height = 30; - npc.noGravity = true; - npc.noTileCollide = true; - npc.damage = 0; - npc.lifeMax = 1500; - npc.dontTakeDamage = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 30; + npc.height = 30; + npc.noGravity = true; + npc.noTileCollide = true; + npc.damage = 0; + npc.lifeMax = 1500; + npc.dontTakeDamage = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(start); - writer.Write(timer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(start); + writer.Write(timer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - start = reader.ReadBoolean(); - timer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + start = reader.ReadBoolean(); + timer = reader.ReadInt32(); + } - public override bool PreAI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + public override bool PreAI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (start) - { - start = false; + if (start) + { + start = false; - for (int num621 = 0; num621 < 5; num621++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + for (int num621 = 0; num621 < 5; num621++) + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); - npc.ai[1] = npc.ai[0]; - } + npc.ai[1] = npc.ai[0]; + } if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { @@ -73,10 +73,10 @@ namespace CalamityMod.NPCs.Polterghast npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 9f; + npc.rotation = direction.ToRotation(); timer++; if (CalamityWorld.death || CalamityWorld.bossRushActive) @@ -94,44 +94,44 @@ namespace CalamityMod.NPCs.Polterghast } Player player = Main.player[npc.target]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 500; - npc.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 0.5f; //1f - return false; - } + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 500; + npc.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 0.5f; //1f + return false; + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index d41a97506a..ad5f14edec 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -1,303 +1,303 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Polterghast { - public class PolterPhantom : ModNPC - { - private int despawnTimer = 600; + public class PolterPhantom : ModNPC + { + private int despawnTimer = 600; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.damage = 210; - npc.width = 90; - npc.height = 120; - npc.lifeMax = CalamityWorld.revenge ? 150000 : 130000; - if (CalamityWorld.death) - { - npc.lifeMax = 225000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - } + public override void SetDefaults() + { + npc.damage = 210; + npc.width = 90; + npc.height = 120; + npc.lifeMax = CalamityWorld.revenge ? 150000 : 130000; + if (CalamityWorld.death) + { + npc.lifeMax = 225000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(despawnTimer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(despawnTimer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - despawnTimer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + despawnTimer = reader.ReadInt32(); + } - public override void AI() - { - CalamityGlobalNPC.ghostBossClone = npc.whoAmI; + public override void AI() + { + CalamityGlobalNPC.ghostBossClone = npc.whoAmI; - npc.alpha -= 5; - if (npc.alpha < 50) - npc.alpha = 50; + npc.alpha -= 5; + if (npc.alpha < 50) + npc.alpha = 50; - if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } + if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); - npc.TargetClosest(true); + npc.TargetClosest(true); - Vector2 vector = npc.Center; + Vector2 vector = npc.Center; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) - npc.active = false; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) + npc.active = false; - bool speedBoost1 = false; - bool despawnBoost = false; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool speedBoost1 = false; + bool despawnBoost = false; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (npc.timeLeft < 1500) - npc.timeLeft = 1500; + if (npc.timeLeft < 1500) + npc.timeLeft = 1500; - int[] array2 = new int[4]; - float num730 = 0f; - float num731 = 0f; - int num732 = 0; - int num; - for (int num733 = 0; num733 < 200; num733 = num + 1) - { - if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) - { - num730 += Main.npc[num733].Center.X; - num731 += Main.npc[num733].Center.Y; - array2[num732] = num733; - num732++; - if (num732 > 3) - break; - } - num = num733; - } - num730 /= (float)num732; - num731 /= (float)num732; + int[] array2 = new int[4]; + float num730 = 0f; + float num731 = 0f; + int num732 = 0; + int num; + for (int num733 = 0; num733 < 200; num733 = num + 1) + { + if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) + { + num730 += Main.npc[num733].Center.X; + num731 += Main.npc[num733].Center.Y; + array2[num732] = num733; + num732++; + if (num732 > 3) + break; + } + num = num733; + } + num730 /= (float)num732; + num731 /= (float)num732; - float num734 = 3f; - float num735 = 0.03f; - if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0) - { - despawnTimer--; - if (despawnTimer <= 0) - despawnBoost = true; + float num734 = 3f; + float num735 = 0.03f; + if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0) + { + despawnTimer--; + if (despawnTimer <= 0) + despawnBoost = true; - speedBoost1 = true; - num734 += 8f; - num735 = 0.15f; - } - else - despawnTimer++; + speedBoost1 = true; + num734 += 8f; + num735 = 0.15f; + } + else + despawnTimer++; - if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) - { - num734 = 18f; - num735 = 0.12f; - } + if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) + { + num734 = 18f; + num735 = 0.12f; + } - if (expertMode) - { - num734 += revenge ? 1.5f : 1f; - num734 *= revenge ? 1.25f : 1.1f; - num735 += revenge ? 0.015f : 0.01f; - num735 *= revenge ? 1.2f : 1.1f; - } + if (expertMode) + { + num734 += revenge ? 1.5f : 1f; + num734 *= revenge ? 1.25f : 1.1f; + num735 += revenge ? 0.015f : 0.01f; + num735 *= revenge ? 1.2f : 1.1f; + } - Vector2 vector91 = new Vector2(num730, num731); - float num736 = Main.player[npc.target].Center.X - vector91.X; - float num737 = Main.player[npc.target].Center.Y - vector91.Y; + Vector2 vector91 = new Vector2(num730, num731); + float num736 = Main.player[npc.target].Center.X - vector91.X; + float num737 = Main.player[npc.target].Center.Y - vector91.Y; - if (despawnBoost) - { - num737 *= -1f; - num736 *= -1f; - num734 += 8f; - } + if (despawnBoost) + { + num737 *= -1f; + num736 *= -1f; + num734 += 8f; + } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - int num739 = 500; - if (speedBoost1) - num739 += 500; - if (expertMode) - num739 += 150; + float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + int num739 = 500; + if (speedBoost1) + num739 += 500; + if (expertMode) + num739 += 150; - if (num738 >= (float)num739) - { - num738 = (float)num739 / num738; - num736 *= num738; - num737 *= num738; - } + if (num738 >= (float)num739) + { + num738 = (float)num739 / num738; + num736 *= num738; + num737 *= num738; + } - num730 += num736; - num731 += num737; - vector91 = new Vector2(vector.X, vector.Y); - num736 = num730 - vector91.X; - num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + num730 += num736; + num731 += num737; + vector91 = new Vector2(vector.X, vector.Y); + num736 = num730 - vector91.X; + num737 = num731 - vector91.Y; + num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - if (num738 < num734) - { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; - } - else - { - num738 = num734 / num738; - num736 *= num738; - num737 *= num738; - } + if (num738 < num734) + { + num736 = npc.velocity.X; + num737 = npc.velocity.Y; + } + else + { + num738 = num734 / num738; + num736 *= num738; + num737 *= num738; + } - if (npc.velocity.X < num736) - { - npc.velocity.X = npc.velocity.X + num735; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X = npc.velocity.X + num735 * 2f; - } - else if (npc.velocity.X > num736) - { - npc.velocity.X = npc.velocity.X - num735; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X = npc.velocity.X - num735 * 2f; - } - if (npc.velocity.Y < num737) - { - npc.velocity.Y = npc.velocity.Y + num735; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y = npc.velocity.Y + num735 * 2f; - } - else if (npc.velocity.Y > num737) - { - npc.velocity.Y = npc.velocity.Y - num735; - if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y = npc.velocity.Y - num735 * 2f; - } + if (npc.velocity.X < num736) + { + npc.velocity.X = npc.velocity.X + num735; + if (npc.velocity.X < 0f && num736 > 0f) + npc.velocity.X = npc.velocity.X + num735 * 2f; + } + else if (npc.velocity.X > num736) + { + npc.velocity.X = npc.velocity.X - num735; + if (npc.velocity.X > 0f && num736 < 0f) + npc.velocity.X = npc.velocity.X - num735 * 2f; + } + if (npc.velocity.Y < num737) + { + npc.velocity.Y = npc.velocity.Y + num735; + if (npc.velocity.Y < 0f && num737 > 0f) + npc.velocity.Y = npc.velocity.Y + num735 * 2f; + } + else if (npc.velocity.Y > num737) + { + npc.velocity.Y = npc.velocity.Y - num735; + if (npc.velocity.Y > 0f && num737 < 0f) + npc.velocity.Y = npc.velocity.Y - num735 * 2f; + } - Vector2 vector92 = new Vector2(vector.X, vector.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + Vector2 vector92 = new Vector2(vector.X, vector.Y); + float num740 = Main.player[npc.target].Center.X - vector92.X; + float num741 = Main.player[npc.target].Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; - npc.damage = npc.defDamage; + npc.damage = npc.defDamage; - if (speedBoost1) - { - npc.damage *= 2; - } - } + if (speedBoost1) + { + npc.damage *= 2; + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 150, 255, npc.alpha); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 150, 255, npc.alpha); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(mod.BuffType("Horror"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + player.AddBuff(mod.BuffType("Horror"), 180, true); + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 90; - npc.height = 90; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 90; + npc.height = 90; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index ce6976012e..89b29d4620 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1,681 +1,682 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; +using CalamityMod.Utilities; using CalamityMod.World; -using CalamityMod.Utilities; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.NPCs.Polterghast { [AutoloadBossHead] - public class Polterghast : ModNPC - { - private int despawnTimer = 600; - private bool spawnGhost = false; + public class Polterghast : ModNPC + { + private int despawnTimer = 600; + private bool spawnGhost = false; - private bool boostDR = false; + private bool boostDR = false; public static float phase1DR = 0.1f; public static float phase2DR = 0.15f; public static float phase3DR = 0.2f; public static float cloneDRBoost = 0.6f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast"); - Main.npcFrameCount[npc.type] = 12; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast"); + Main.npcFrameCount[npc.type] = 12; + } - public override void SetDefaults() - { - npc.npcSlots = 50f; - npc.damage = 150; - npc.width = 90; - npc.height = 120; - npc.defense = 90; + public override void SetDefaults() + { + npc.npcSlots = 50f; + npc.damage = 150; + npc.width = 90; + npc.height = 120; + npc.defense = 90; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.1f; global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.88f); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.lifeMax = CalamityWorld.revenge ? 495000 : 412500; - if (CalamityWorld.death) - { - npc.lifeMax = 660000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2800000 : 2500000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.value = Item.buyPrice(0, 60, 0, 0); - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); - else - music = MusicID.Plantera; - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath39; - bossBag = mod.ItemType("PolterghastBag"); - } + npc.lifeMax = CalamityWorld.revenge ? 495000 : 412500; + if (CalamityWorld.death) + { + npc.lifeMax = 660000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2800000 : 2500000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.value = Item.buyPrice(0, 60, 0, 0); + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); + else + music = MusicID.Plantera; + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath39; + bossBag = mod.ItemType("PolterghastBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawnGhost); - writer.Write(boostDR); - writer.Write(despawnTimer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawnGhost); + writer.Write(boostDR); + writer.Write(despawnTimer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - spawnGhost = reader.ReadBoolean(); - boostDR = reader.ReadBoolean(); - despawnTimer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + spawnGhost = reader.ReadBoolean(); + boostDR = reader.ReadBoolean(); + despawnTimer = reader.ReadInt32(); + } - public override void AI() - { - // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 1.25f, 1.25f); + public override void AI() + { + // Emit light + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 1.25f, 1.25f); - // whoAmI variable - CalamityGlobalNPC.ghostBoss = npc.whoAmI; + // whoAmI variable + CalamityGlobalNPC.ghostBoss = npc.whoAmI; - // Detect clone - bool cloneAlive = false; - if (CalamityGlobalNPC.ghostBossClone != -1) - cloneAlive = Main.npc[CalamityGlobalNPC.ghostBossClone].active; + // Detect clone + bool cloneAlive = false; + if (CalamityGlobalNPC.ghostBossClone != -1) + cloneAlive = Main.npc[CalamityGlobalNPC.ghostBossClone].active; - // Variables - Vector2 vector = npc.Center; - bool speedBoost1 = false; - bool despawnBoost = false; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool phase2 = (double)npc.life < (double)npc.lifeMax * 0.75; //hooks fire beams - bool phase3 = (double)npc.life < (double)npc.lifeMax * (revenge ? 0.5 : 0.33); //hooks stop shooting and polter begins charging with ghosts spinning around player - bool phase4 = (double)npc.life < (double)npc.lifeMax * (revenge ? 0.33 : 0.2); //starts spitting ghost dudes - bool phase5 = (double)npc.life < (double)npc.lifeMax * (revenge ? 0.1 : 0.05); //starts moving incredibly fast + // Variables + Vector2 vector = npc.Center; + bool speedBoost1 = false; + bool despawnBoost = false; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool phase2 = (double)npc.life < (double)npc.lifeMax * 0.75; //hooks fire beams + bool phase3 = (double)npc.life < (double)npc.lifeMax * (revenge ? 0.5 : 0.33); //hooks stop shooting and polter begins charging with ghosts spinning around player + bool phase4 = (double)npc.life < (double)npc.lifeMax * (revenge ? 0.33 : 0.2); //starts spitting ghost dudes + bool phase5 = (double)npc.life < (double)npc.lifeMax * (revenge ? 0.1 : 0.05); //starts moving incredibly fast - // Target - npc.TargetClosest(true); + // Target + npc.TargetClosest(true); - // Stop rain + // Stop rain CalamityMod.StopRain(); - // Set time left - if (npc.timeLeft < 1500) - npc.timeLeft = 1500; + // Set time left + if (npc.timeLeft < 1500) + npc.timeLeft = 1500; - // Spawn hooks - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - int num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } + // Spawn hooks + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 1f; + int num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } - int[] array2 = new int[4]; - float num730 = 0f; - float num731 = 0f; - int num732 = 0; - int num; - for (int num733 = 0; num733 < 200; num733 = num + 1) - { - if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) - { - num730 += Main.npc[num733].Center.X; - num731 += Main.npc[num733].Center.Y; - array2[num732] = num733; - num732++; - if (num732 > 3) - break; - } - num = num733; - } - num730 /= (float)num732; - num731 /= (float)num732; + int[] array2 = new int[4]; + float num730 = 0f; + float num731 = 0f; + int num732 = 0; + int num; + for (int num733 = 0; num733 < 200; num733 = num + 1) + { + if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) + { + num730 += Main.npc[num733].Center.X; + num731 += Main.npc[num733].Center.Y; + array2[num732] = num733; + num732++; + if (num732 > 3) + break; + } + num = num733; + } + num730 /= (float)num732; + num731 /= (float)num732; - // Velocity and acceleration - float num734 = 2.5f; - float num735 = 0.025f; - if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0) - { - despawnTimer--; - if (despawnTimer <= 0) - despawnBoost = true; + // Velocity and acceleration + float num734 = 2.5f; + float num735 = 0.025f; + if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0) + { + despawnTimer--; + if (despawnTimer <= 0) + despawnBoost = true; - speedBoost1 = true; - num734 += 2f; - num735 += 0.025f; - } - else - despawnTimer++; + speedBoost1 = true; + num734 += 2f; + num735 += 0.025f; + } + else + despawnTimer++; - // Despawn - if (Vector2.Distance(Main.player[npc.target].Center, vector) > (despawnBoost ? 1500f : 6000f)) - npc.active = false; + // Despawn + if (Vector2.Distance(Main.player[npc.target].Center, vector) > (despawnBoost ? 1500f : 6000f)) + npc.active = false; - if (phase2) - { - num734 += 1.5f; - num735 += 0.01f; - } + if (phase2) + { + num734 += 1.5f; + num735 += 0.01f; + } - if (phase3) - { - if (cloneAlive) - { - boostDR = true; + if (phase3) + { + if (cloneAlive) + { + boostDR = true; - if (npc.ai[2] >= 300f) - { - num734 += phase5 ? 14.5f : 8.5f; - num735 += phase5 ? 0.085f : 0.045f; - } - else - { - if (phase5) - { - num734 += 1.5f; - num735 += 0.015f; - } - else if (phase4) - { - num734 += 1f; - num735 += 0.01f; - } - else - { - num734 += 0.5f; - num735 += 0.005f; - } - } + if (npc.ai[2] >= 300f) + { + num734 += phase5 ? 14.5f : 8.5f; + num735 += phase5 ? 0.085f : 0.045f; + } + else + { + if (phase5) + { + num734 += 1.5f; + num735 += 0.015f; + } + else if (phase4) + { + num734 += 1f; + num735 += 0.01f; + } + else + { + num734 += 0.5f; + num735 += 0.005f; + } + } - npc.ai[2] += 1f; - if (npc.ai[2] >= 600f) - { - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else - { - boostDR = false; - num734 += phase5 ? 18.5f : 14.5f; - num735 += phase5 ? 0.115f : 0.085f; + npc.ai[2] += 1f; + if (npc.ai[2] >= 600f) + { + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else + { + boostDR = false; + num734 += phase5 ? 18.5f : 14.5f; + num735 += phase5 ? 0.115f : 0.085f; - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 600f) - { - npc.localAI[2] = 0f; + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 600f) + { + npc.localAI[2] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } // Set DR based on phase and boostDR variable float dr = phase3 ? phase3DR : phase2 ? phase2DR : phase1DR; - if (boostDR) dr += cloneDRBoost; + if (boostDR) + dr += cloneDRBoost; npc.Calamity().DR = dr; - if (expertMode) - { - num734 += revenge ? 1.5f : 1f; - num734 *= revenge ? 1.25f : 1.1f; - num735 += revenge ? 0.015f : 0.01f; - num735 *= revenge ? 1.2f : 1.1f; - } + if (expertMode) + { + num734 += revenge ? 1.5f : 1f; + num734 *= revenge ? 1.25f : 1.1f; + num735 += revenge ? 0.015f : 0.01f; + num735 *= revenge ? 1.2f : 1.1f; + } - Vector2 vector91 = new Vector2(num730, num731); - float num736 = Main.player[npc.target].Center.X - vector91.X; - float num737 = Main.player[npc.target].Center.Y - vector91.Y; + Vector2 vector91 = new Vector2(num730, num731); + float num736 = Main.player[npc.target].Center.X - vector91.X; + float num737 = Main.player[npc.target].Center.Y - vector91.Y; - if (despawnBoost) - { - num737 *= -1f; - num736 *= -1f; - num734 += 10f; - } + if (despawnBoost) + { + num737 *= -1f; + num736 *= -1f; + num734 += 10f; + } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - int num739 = 500; - if (speedBoost1) - num739 += 250; - if (expertMode) - num739 += 150; + float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + int num739 = 500; + if (speedBoost1) + num739 += 250; + if (expertMode) + num739 += 150; - if (num738 >= (float)num739) - { - num738 = (float)num739 / num738; - num736 *= num738; - num737 *= num738; - } + if (num738 >= (float)num739) + { + num738 = (float)num739 / num738; + num736 *= num738; + num737 *= num738; + } - num730 += num736; - num731 += num737; - vector91 = new Vector2(vector.X, vector.Y); - num736 = num730 - vector91.X; - num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + num730 += num736; + num731 += num737; + vector91 = new Vector2(vector.X, vector.Y); + num736 = num730 - vector91.X; + num737 = num731 - vector91.Y; + num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - if (num738 < num734) - { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; - } - else - { - num738 = num734 / num738; - num736 *= num738; - num737 *= num738; - } + if (num738 < num734) + { + num736 = npc.velocity.X; + num737 = npc.velocity.Y; + } + else + { + num738 = num734 / num738; + num736 *= num738; + num737 *= num738; + } - Vector2 vector92 = new Vector2(vector.X, vector.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + Vector2 vector92 = new Vector2(vector.X, vector.Y); + float num740 = Main.player[npc.target].Center.X - vector92.X; + float num741 = Main.player[npc.target].Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; - if (npc.velocity.X < num736) - { - npc.velocity.X = npc.velocity.X + num735; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X = npc.velocity.X + num735 * 2f; - } - else if (npc.velocity.X > num736) - { - npc.velocity.X = npc.velocity.X - num735; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X = npc.velocity.X - num735 * 2f; - } - if (npc.velocity.Y < num737) - { - npc.velocity.Y = npc.velocity.Y + num735; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y = npc.velocity.Y + num735 * 2f; - } - else if (npc.velocity.Y > num737) - { - npc.velocity.Y = npc.velocity.Y - num735; - if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y = npc.velocity.Y - num735 * 2f; - } + if (npc.velocity.X < num736) + { + npc.velocity.X = npc.velocity.X + num735; + if (npc.velocity.X < 0f && num736 > 0f) + npc.velocity.X = npc.velocity.X + num735 * 2f; + } + else if (npc.velocity.X > num736) + { + npc.velocity.X = npc.velocity.X - num735; + if (npc.velocity.X > 0f && num736 < 0f) + npc.velocity.X = npc.velocity.X - num735 * 2f; + } + if (npc.velocity.Y < num737) + { + npc.velocity.Y = npc.velocity.Y + num735; + if (npc.velocity.Y < 0f && num737 > 0f) + npc.velocity.Y = npc.velocity.Y + num735 * 2f; + } + else if (npc.velocity.Y > num737) + { + npc.velocity.Y = npc.velocity.Y - num735; + if (npc.velocity.Y > 0f && num737 < 0f) + npc.velocity.Y = npc.velocity.Y - num735 * 2f; + } - if (!phase2 && !phase3) - { - npc.damage = npc.defDamage; - npc.defense = npc.defDefense; + if (!phase2 && !phase3) + { + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; - if (speedBoost1) - { - npc.defense *= 2; - npc.damage *= 2; - } + if (speedBoost1) + { + npc.defense *= 2; + npc.damage *= 2; + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += (expertMode ? 1.5f : 1f); - if (speedBoost1 || CalamityWorld.bossRushActive) - npc.localAI[1] += 3f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += (expertMode ? 1.5f : 1f); + if (speedBoost1 || CalamityWorld.bossRushActive) + npc.localAI[1] += 3f; - if (npc.localAI[1] >= 40f) - { - npc.localAI[1] = 0f; + if (npc.localAI[1] >= 40f) + { + npc.localAI[1] = 0f; - bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[3] > 0f) - { - flag47 = true; - npc.localAI[3] = 0f; - } + bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (npc.localAI[3] > 0f) + { + flag47 = true; + npc.localAI[3] = 0f; + } - if (flag47) - { - float num742 = 6f; - if (expertMode) - num742 += 1f; - if (CalamityWorld.bossRushActive) - num742 = 13f; - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; + if (flag47) + { + float num742 = 6f; + if (expertMode) + num742 += 1f; + if (CalamityWorld.bossRushActive) + num742 = 13f; + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; - int num746 = expertMode ? 48 : 60; - int num747 = mod.ProjectileType("PhantomShot"); + int num746 = expertMode ? 48 : 60; + int num747 = mod.ProjectileType("PhantomShot"); - if (Main.rand.NextBool(3)) - { - num746 = expertMode ? 60 : 70; - npc.localAI[1] = -30f; - num747 = mod.ProjectileType("PhantomBlast"); - } + if (Main.rand.NextBool(3)) + { + num746 = expertMode ? 60 : 70; + npc.localAI[1] = -30f; + num747 = mod.ProjectileType("PhantomBlast"); + } - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num746 *= 2; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = (num747 == mod.ProjectileType("PhantomBlast") ? 300 : 1200); - } - else - { - float num742 = 11f; - if (expertMode) - num742 += 1f; - if (CalamityWorld.bossRushActive) - num742 = 18f; - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; + int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num748].timeLeft = (num747 == mod.ProjectileType("PhantomBlast") ? 300 : 1200); + } + else + { + float num742 = 11f; + if (expertMode) + num742 += 1f; + if (CalamityWorld.bossRushActive) + num742 = 18f; + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; - int num746 = expertMode ? 60 : 70; - int num747 = mod.ProjectileType("PhantomBlast"); - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + int num746 = expertMode ? 60 : 70; + int num747 = mod.ProjectileType("PhantomBlast"); + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num746 *= 2; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 180; - } - } - } - } - else if (!phase3) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] += 1f; + int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num748].timeLeft = 180; + } + } + } + } + else if (!phase3) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] += 1f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - npc.GivenName = "Necroghast"; + npc.GivenName = "Necroghast"; - npc.damage = (int)((float)npc.defDamage * 1.2f); - npc.defense = (int)((float)npc.defDefense * 0.8f); + npc.damage = (int)((float)npc.defDamage * 1.2f); + npc.defense = (int)((float)npc.defDefense * 0.8f); - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.defense *= 2; - npc.damage *= 2; - } + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.defense *= 2; + npc.damage *= 2; + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += (expertMode ? 1.5f : 1f); - if (speedBoost1 || CalamityWorld.bossRushActive) - npc.localAI[1] += 3f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += (expertMode ? 1.5f : 1f); + if (speedBoost1 || CalamityWorld.bossRushActive) + npc.localAI[1] += 3f; - if (npc.localAI[1] >= 36f) - { - npc.localAI[1] = 0f; + if (npc.localAI[1] >= 36f) + { + npc.localAI[1] = 0f; - bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[3] > 0f) - { - flag47 = true; - npc.localAI[3] = 0f; - } + bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (npc.localAI[3] > 0f) + { + flag47 = true; + npc.localAI[3] = 0f; + } - if (flag47) - { - float num742 = 6f; - if (expertMode) - num742 += 1f; - if (CalamityWorld.bossRushActive) - num742 = 13f; - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; + if (flag47) + { + float num742 = 6f; + if (expertMode) + num742 += 1f; + if (CalamityWorld.bossRushActive) + num742 = 13f; + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; - int num746 = expertMode ? 53 : 65; - int num747 = mod.ProjectileType("PhantomShot2"); + int num746 = expertMode ? 53 : 65; + int num747 = mod.ProjectileType("PhantomShot2"); - if (Main.rand.NextBool(3)) - { - num746 = expertMode ? 65 : 75; - npc.localAI[1] = -30f; - num747 = mod.ProjectileType("PhantomBlast2"); - } + if (Main.rand.NextBool(3)) + { + num746 = expertMode ? 65 : 75; + npc.localAI[1] = -30f; + num747 = mod.ProjectileType("PhantomBlast2"); + } - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num746 *= 2; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = (num747 == mod.ProjectileType("PhantomBlast2") ? 300 : 1200); - } - else - { - float num742 = 11f; - if (expertMode) - num742 += 1f; - if (CalamityWorld.bossRushActive) - num742 = 18f; - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; + int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num748].timeLeft = (num747 == mod.ProjectileType("PhantomBlast2") ? 300 : 1200); + } + else + { + float num742 = 11f; + if (expertMode) + num742 += 1f; + if (CalamityWorld.bossRushActive) + num742 = 18f; + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; - int num746 = expertMode ? 65 : 75; - int num747 = mod.ProjectileType("PhantomBlast2"); + int num746 = expertMode ? 65 : 75; + int num747 = mod.ProjectileType("PhantomBlast2"); - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num746 *= 2; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 240; - } - } - } - } - else - { - npc.HitSound = SoundID.NPCHit36; + int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num748].timeLeft = 240; + } + } + } + } + else + { + npc.HitSound = SoundID.NPCHit36; - if (!spawnGhost) - { - spawnGhost = true; + if (!spawnGhost) + { + spawnGhost = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); - for (int I = 0; I < 3; I++) - { - int Phantom = NPC.NewNPC((int)(Main.player[npc.target].Center.X + (Math.Sin(I * 120) * 500)), - (int)(Main.player[npc.target].Center.Y + (Math.Cos(I * 120) * 500)), mod.NPCType("PhantomFuckYou"), 0, 0, 0, 0, -1); - NPC Eye = Main.npc[Phantom]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; - } - } + for (int I = 0; I < 3; I++) + { + int Phantom = NPC.NewNPC((int)(Main.player[npc.target].Center.X + (Math.Sin(I * 120) * 500)), + (int)(Main.player[npc.target].Center.Y + (Math.Cos(I * 120) * 500)), mod.NPCType("PhantomFuckYou"), 0, 0, 0, 0, -1); + NPC Eye = Main.npc[Phantom]; + Eye.ai[0] = I * 120; + Eye.ai[3] = I * 120; + } + } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - npc.GivenName = "Necroplasm"; + npc.GivenName = "Necroplasm"; - npc.damage = (int)((float)npc.defDamage * 1.4f); - npc.defense = (int)((float)npc.defDefense * 0.5f); + npc.damage = (int)((float)npc.defDamage * 1.4f); + npc.defense = (int)((float)npc.defDefense * 0.5f); - if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.defense *= 2; - npc.damage *= 2; - } + if (speedBoost1 || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.defense *= 2; + npc.damage *= 2; + } - if (phase4) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 150f) - { - npc.localAI[1] = 0f; + if (phase4) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 150f) + { + npc.localAI[1] = 0f; - float num757 = 8f; - Vector2 vector94 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num758 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector94.X + (float)Main.rand.Next(-10, 11); - float num759 = Math.Abs(num758 * 0.2f); - float num760 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector94.Y + (float)Main.rand.Next(-10, 11); - if (num760 > 0f) - num759 = 0f; + float num757 = 8f; + Vector2 vector94 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num758 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector94.X + (float)Main.rand.Next(-10, 11); + float num759 = Math.Abs(num758 * 0.2f); + float num760 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector94.Y + (float)Main.rand.Next(-10, 11); + if (num760 > 0f) + num759 = 0f; - num760 -= num759; - float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); - num761 = num757 / num761; - num758 *= num761; - num760 *= num761; + num760 -= num759; + float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); + num761 = num757 / num761; + num758 *= num761; + num760 *= num761; - if (NPC.CountNPCS(mod.NPCType("PhantomSpiritL")) < (revenge ? 3 : 2) && Main.netMode != NetmodeID.MultiplayerClient) - { - int num762 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PhantomSpiritL"), 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num762].velocity.X = num758; - Main.npc[num762].velocity.Y = num760; - Main.npc[num762].netUpdate = true; - } - } - } - } - } + if (NPC.CountNPCS(mod.NPCType("PhantomSpiritL")) < (revenge ? 3 : 2) && Main.netMode != NetmodeID.MultiplayerClient) + { + int num762 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PhantomSpiritL"), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num762].velocity.X = num758; + Main.npc[num762].velocity.Y = num760; + Main.npc[num762].netUpdate = true; + } + } + } + } + } public override void BossLoot(ref string name, ref int potionType) { @@ -683,7 +684,7 @@ namespace CalamityMod.NPCs.Polterghast } public override void NPCLoot() - { + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("PolterghastTrophy"), 10); @@ -692,7 +693,7 @@ namespace CalamityMod.NPCs.Polterghast // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Materials DropHelper.DropItem(npc, mod.ItemType("RuinousSoul"), 5, 8); @@ -704,7 +705,7 @@ namespace CalamityMod.NPCs.Polterghast DropHelper.DropItemChance(npc, mod.ItemType("GhastlyVisage"), 4); DropHelper.DropItemChance(npc, mod.ItemType("EtherealSubjugator"), 4); DropHelper.DropItemChance(npc, mod.ItemType("GhoulishGouger"), 4); - } + } // If Polterghast has not been killed, notify players about the Abyss minibosses now dropping items if (!CalamityWorld.downedPolterghast) @@ -723,94 +724,94 @@ namespace CalamityMod.NPCs.Polterghast CalamityMod.UpdateServerBoolean(); } - public override void FindFrame(int frameHeight) - { - bool phase2 = (double)npc.life >= (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33); - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if ((double)npc.life >= (double)npc.lifeMax * 0.75) - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - else if (phase2) - { - if (npc.frame.Y < frameHeight * 4) - { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y > frameHeight * 7) - { - npc.frame.Y = frameHeight * 4; - } - } - else - { - if (npc.frame.Y < frameHeight * 8) - { - npc.frame.Y = frameHeight * 8; - } - if (npc.frame.Y > frameHeight * 11) - { - npc.frame.Y = frameHeight * 8; - } - } - } + public override void FindFrame(int frameHeight) + { + bool phase2 = (double)npc.life >= (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33); + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if ((double)npc.life >= (double)npc.lifeMax * 0.75) + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + else if (phase2) + { + if (npc.frame.Y < frameHeight * 4) + { + npc.frame.Y = frameHeight * 4; + } + if (npc.frame.Y > frameHeight * 7) + { + npc.frame.Y = frameHeight * 4; + } + } + else + { + if (npc.frame.Y < frameHeight * 8) + { + npc.frame.Y = frameHeight * 8; + } + if (npc.frame.Y > frameHeight * 11) + { + npc.frame.Y = frameHeight * 8; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(mod.BuffType("Horror"), 300, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + player.AddBuff(mod.BuffType("Horror"), 300, true); + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 90; - npc.height = 90; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 90; + npc.height = 90; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index d95e5bf1b5..86aada4c6b 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -1,384 +1,383 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Polterghast { - public class PolterghastHook : ModNPC - { - private int despawnTimer = 300; - private bool phase2 = false; + public class PolterghastHook : ModNPC + { + private int despawnTimer = 300; + private bool phase2 = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast Hook"); - Main.npcFrameCount[npc.type] = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast Hook"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 40; - npc.height = 40; - npc.lifeMax = 50000; - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit34; - npc.DeathSound = SoundID.NPCDeath39; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 40; + npc.height = 40; + npc.lifeMax = 50000; + npc.dontTakeDamage = true; + npc.noGravity = true; + npc.noTileCollide = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit34; + npc.DeathSound = SoundID.NPCDeath39; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(phase2); - writer.Write(despawnTimer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(phase2); + writer.Write(despawnTimer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - phase2 = reader.ReadBoolean(); - despawnTimer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + phase2 = reader.ReadBoolean(); + despawnTimer = reader.ReadInt32(); + } - public override void AI() - { - // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 1f, 1f); + public override void AI() + { + // Emit light + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 1f, 1f); - // Bools - bool speedBoost1 = false; - bool despawnBoost = false; + // Bools + bool speedBoost1 = false; + bool despawnBoost = false; - // Despawn if Polter is gone - if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } + // Despawn if Polter is gone + if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } - // Percent life remaining, Polter - float lifeRatio = (float)Main.npc[CalamityGlobalNPC.ghostBoss].life / (float)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; + // Percent life remaining, Polter + float lifeRatio = (float)Main.npc[CalamityGlobalNPC.ghostBoss].life / (float)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; - // Despawn - if (CalamityGlobalNPC.ghostBoss != -1 && !Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].ZoneDungeon && - (double)Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].position.Y < Main.worldSurface * 16.0 && !CalamityWorld.bossRushActive) - { - despawnTimer--; - if (despawnTimer <= 0) - despawnBoost = true; + // Despawn + if (CalamityGlobalNPC.ghostBoss != -1 && !Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].ZoneDungeon && + (double)Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].position.Y < Main.worldSurface * 16.0 && !CalamityWorld.bossRushActive) + { + despawnTimer--; + if (despawnTimer <= 0) + despawnBoost = true; - npc.localAI[0] -= 6f; - speedBoost1 = true; - } - else - despawnTimer++; + npc.localAI[0] -= 6f; + speedBoost1 = true; + } + else + despawnTimer++; - // Phase 2 - if (lifeRatio < 0.75f && lifeRatio >= ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 0.5 : 0.33)) - { - phase2 = true; + // Phase 2 + if (lifeRatio < 0.75f && lifeRatio >= ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 0.5 : 0.33)) + { + phase2 = true; - npc.TargetClosest(true); + npc.TargetClosest(true); - Movement(phase2, (Main.expertMode || CalamityWorld.bossRushActive), (CalamityWorld.revenge || CalamityWorld.bossRushActive), speedBoost1, despawnBoost, lifeRatio); + Movement(phase2, (Main.expertMode || CalamityWorld.bossRushActive), (CalamityWorld.revenge || CalamityWorld.bossRushActive), speedBoost1, despawnBoost, lifeRatio); - // Fire projectiles - Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; - float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; - float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); + // Fire projectiles + Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; + float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; + float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); - num149 = 4f / num149; - num147 *= num149; - num148 *= num149; + num149 = 4f / num149; + num147 *= num149; + num148 *= num149; - if (num149 > 1200f) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } + if (num149 > 1200f) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } - npc.ai[2] += 1f; - if (npc.ai[3] == 0f) - { - if (npc.ai[2] > 120f) - { - npc.ai[2] = 0f; - npc.ai[3] = 1f; - npc.netUpdate = true; - } - } - else - { - if (npc.ai[2] > 40f) - npc.ai[3] = 0f; + npc.ai[2] += 1f; + if (npc.ai[3] == 0f) + { + if (npc.ai[2] > 120f) + { + npc.ai[2] = 0f; + npc.ai[3] = 1f; + npc.netUpdate = true; + } + } + else + { + if (npc.ai[2] > 40f) + npc.ai[3] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 20f) - { - float num151 = CalamityWorld.bossRushActive ? 7.5f : 5f; - int num152 = Main.expertMode ? 48 : 60; - int num153 = mod.ProjectileType("PhantomHookShot"); - num149 = num151 / num149; - num147 *= num149; - num148 *= num149; - Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); - } - } - return; - } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 20f) + { + float num151 = CalamityWorld.bossRushActive ? 7.5f : 5f; + int num152 = Main.expertMode ? 48 : 60; + int num153 = mod.ProjectileType("PhantomHookShot"); + num149 = num151 / num149; + num147 *= num149; + num148 *= num149; + Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); + } + } + return; + } - // Phase 1 or 3 - phase2 = false; - Movement(phase2, (Main.expertMode || CalamityWorld.bossRushActive), (CalamityWorld.revenge || CalamityWorld.bossRushActive), speedBoost1, despawnBoost, lifeRatio); - } + // Phase 1 or 3 + phase2 = false; + Movement(phase2, (Main.expertMode || CalamityWorld.bossRushActive), (CalamityWorld.revenge || CalamityWorld.bossRushActive), speedBoost1, despawnBoost, lifeRatio); + } - private void Movement(bool phase2, bool expertMode, bool revenge, bool speedBoost1, bool despawnBoost, float lifeRatio) - { - if (phase2) - { - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; - } + private void Movement(bool phase2, bool expertMode, bool revenge, bool speedBoost1, bool despawnBoost, float lifeRatio) + { + if (phase2) + { + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = Main.player[npc.target].Center.X - vector92.X; + float num741 = Main.player[npc.target].Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f) - npc.ai[0] = (float)((int)(npc.Center.X / 16f)); - if (npc.ai[1] == 0f) - npc.ai[1] = (float)((int)(npc.Center.X / 16f)); - } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f) + npc.ai[0] = (float)((int)(npc.Center.X / 16f)); + if (npc.ai[1] == 0f) + npc.ai[1] = (float)((int)(npc.Center.X / 16f)); + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f || npc.ai[1] == 0f) - npc.localAI[0] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f || npc.ai[1] == 0f) + npc.localAI[0] = 0f; - npc.localAI[0] -= 1f + (2f * (1f - lifeRatio)); - if (speedBoost1) - npc.localAI[0] -= 6f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - npc.localAI[0] -= 0.5f; + npc.localAI[0] -= 1f + (2f * (1f - lifeRatio)); + if (speedBoost1) + npc.localAI[0] -= 6f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.localAI[0] -= 0.5f; - if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) - { - for (int num763 = 0; num763 < 200; num763++) - { - if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) - npc.localAI[0] = (float)Main.rand.Next(30, 121); - } - } + if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) + { + for (int num763 = 0; num763 < 200; num763++) + { + if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) + npc.localAI[0] = (float)Main.rand.Next(30, 121); + } + } - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(150, 301); - bool flag50 = false; - int num764 = 0; - while (!flag50 && num764 <= 1000) - { - num764++; - int num765 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X / 16f); - int num766 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y / 16f); - if (npc.ai[0] == 0f) - { - num765 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); - num766 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); - } - if (despawnBoost) - { - num765 = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; - num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; - } - int num767 = 20; - num767 += (int)(100f * ((float)num764 / 1000f)); - int num768 = num765 + Main.rand.Next(-num767, num767 + 1); - int num769 = num766 + Main.rand.Next(-num767, num767 + 1); - try - { - if (WorldGen.SolidTile(num768, num769) || Main.tile[num768, num769].wall > 0) - { - flag50 = true; - npc.ai[0] = (float)num768; - npc.ai[1] = (float)num769; - npc.netUpdate = true; - } - } - catch - { - } - } - } - } + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(150, 301); + bool flag50 = false; + int num764 = 0; + while (!flag50 && num764 <= 1000) + { + num764++; + int num765 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X / 16f); + int num766 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y / 16f); + if (npc.ai[0] == 0f) + { + num765 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); + num766 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); + } + if (despawnBoost) + { + num765 = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; + num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; + } + int num767 = 20; + num767 += (int)(100f * ((float)num764 / 1000f)); + int num768 = num765 + Main.rand.Next(-num767, num767 + 1); + int num769 = num766 + Main.rand.Next(-num767, num767 + 1); + try + { + if (WorldGen.SolidTile(num768, num769) || Main.tile[num768, num769].wall > 0) + { + flag50 = true; + npc.ai[0] = (float)num768; + npc.ai[1] = (float)num769; + npc.netUpdate = true; + } + } catch + { + } + } + } + } - if (npc.ai[0] > 0f && npc.ai[1] > 0f) - { - float velocity = 8f + (2f * (1f - lifeRatio)); - if (expertMode) - velocity += 1f; - if (revenge) - velocity += 1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - velocity += 1f; - if (speedBoost1) - velocity *= 2f; - if (despawnBoost) - velocity *= 2f; + if (npc.ai[0] > 0f && npc.ai[1] > 0f) + { + float velocity = 8f + (2f * (1f - lifeRatio)); + if (expertMode) + velocity += 1f; + if (revenge) + velocity += 1f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + velocity += 1f; + if (speedBoost1) + velocity *= 2f; + if (despawnBoost) + velocity *= 2f; - Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); - float num773 = npc.ai[0] * 16f - 8f - vector95.X; - float num774 = npc.ai[1] * 16f - 8f - vector95.Y; - float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); - if (num775 < 12f + velocity) - { - npc.velocity.X = num773; - npc.velocity.Y = num774; - } - else - { - num775 = velocity / num775; - npc.velocity.X = num773 * num775; - npc.velocity.Y = num774 * num775; - } + Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); + float num773 = npc.ai[0] * 16f - 8f - vector95.X; + float num774 = npc.ai[1] * 16f - 8f - vector95.Y; + float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); + if (num775 < 12f + velocity) + { + npc.velocity.X = num773; + npc.velocity.Y = num774; + } + else + { + num775 = velocity / num775; + npc.velocity.X = num773 * num775; + npc.velocity.Y = num774 * num775; + } - if (!phase2) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num776 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - vector96.X; - float num777 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - vector96.Y; - npc.rotation = (float)Math.Atan2((double)num777, (double)num776) - 1.57f; - } - } - } + if (!phase2) + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num776 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - vector96.X; + float num777 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - vector96.Y; + npc.rotation = (float)Math.Atan2((double)num777, (double)num776) - 1.57f; + } + } + } - public override void FindFrame(int frameHeight) - { - if (phase2) - { - if (npc.ai[3] == 0f) - { - if (npc.frame.Y < 1) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - } - } - else if (npc.frame.Y > 0) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y - frameHeight; - } - } - return; - } - if (npc.velocity.X == 0f && npc.velocity.Y == 0f) - { - if (npc.frame.Y < 1) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - } - } - else if (npc.frame.Y > 0) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y - frameHeight; - } - } - } + public override void FindFrame(int frameHeight) + { + if (phase2) + { + if (npc.ai[3] == 0f) + { + if (npc.frame.Y < 1) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + } + } + else if (npc.frame.Y > 0) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y - frameHeight; + } + } + return; + } + if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + { + if (npc.frame.Y < 1) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + } + } + else if (npc.frame.Y > 0) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y - frameHeight; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (Main.npc[CalamityGlobalNPC.ghostBoss].active && !phase2) - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; - float bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - float rotation2 = (float)Math.Atan2((double)bossCenterY, (double)bossCenterX) - 1.57f; - bool draw = true; - while (draw) - { - int chainWidth = 20; //16 24 - int chainHeight = 52; //32 16 - float num10 = (float)Math.Sqrt((double)(bossCenterX * bossCenterX + bossCenterY * bossCenterY)); - if (num10 < (float)chainHeight) - { - chainWidth = (int)num10 - chainHeight + chainWidth; - draw = false; - } - num10 = (float)chainWidth / num10; - bossCenterX *= num10; - bossCenterY *= num10; - center.X += bossCenterX; - center.Y += bossCenterY; - bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; - bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - Microsoft.Xna.Framework.Color color2 = new Color(100, 100, 100, 0); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Polterghast/PolterghastChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Polterghast/PolterghastChain").Width, chainWidth)), color2, rotation2, - new Vector2((float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); - } - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (Main.npc[CalamityGlobalNPC.ghostBoss].active && !phase2) + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; + float bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; + float rotation2 = (float)Math.Atan2((double)bossCenterY, (double)bossCenterX) - 1.57f; + bool draw = true; + while (draw) + { + int chainWidth = 20; //16 24 + int chainHeight = 52; //32 16 + float num10 = (float)Math.Sqrt((double)(bossCenterX * bossCenterX + bossCenterY * bossCenterY)); + if (num10 < (float)chainHeight) + { + chainWidth = (int)num10 - chainHeight + chainWidth; + draw = false; + } + num10 = (float)chainWidth / num10; + bossCenterX *= num10; + bossCenterY *= num10; + center.X += bossCenterX; + center.Y += bossCenterY; + bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; + bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; + Microsoft.Xna.Framework.Color color2 = new Color(100, 100, 100, 0); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Polterghast/PolterghastChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Polterghast/PolterghastChain").Width, chainWidth)), color2, rotation2, + new Vector2((float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + } + } + return true; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(mod.BuffType("Horror"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + player.AddBuff(mod.BuffType("Horror"), 180, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs index 39a6fb3060..864d226d07 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -1,89 +1,89 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.ProfanedGuardianBoss { [AutoloadBossHead] public class ProfanedGuardianBoss : ModNPC - { - private int spearType = 0; - private int dustTimer = 3; + { + private int spearType = 0; + private int dustTimer = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 20f; - npc.aiStyle = -1; - npc.damage = 140; - npc.width = 100; - npc.height = 80; - npc.defense = 50; + public override void SetDefaults() + { + npc.npcSlots = 20f; + npc.aiStyle = -1; + npc.damage = 140; + npc.width = 100; + npc.height = 80; + npc.defense = 50; npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = 102500; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 600000 : 500000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - npc.boss = true; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + npc.boss = true; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); else music = MusicID.Boss1; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spearType); - writer.Write(dustTimer); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spearType); + writer.Write(dustTimer); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - spearType = reader.ReadInt32(); - dustTimer = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + spearType = reader.ReadInt32(); + dustTimer = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -91,31 +91,31 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.frame.Y = frame * frameHeight; } - public override void AI() - { - CalamityGlobalNPC.doughnutBoss = npc.whoAmI; + public override void AI() + { + CalamityGlobalNPC.doughnutBoss = npc.whoAmI; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - Player player = Main.player[npc.target]; - Vector2 vector = npc.Center; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] == 0f) - { - npc.localAI[1] = 1f; - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss2"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss3"), 0, 0f, 0f, 0f, 0f, 255); - } - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool isHoly = player.ZoneHoly; - bool isHell = player.ZoneUnderworldHeight; - npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 50 : 99999; - Vector2 vectorCenter = npc.Center; - npc.TargetClosest(false); - if (!Main.dayTime || !player.active || player.dead) - { - npc.TargetClosest(false); + Player player = Main.player[npc.target]; + Vector2 vector = npc.Center; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] == 0f) + { + npc.localAI[1] = 1f; + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss2"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss3"), 0, 0f, 0f, 0f, 0f, 255); + } + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool isHoly = player.ZoneHoly; + bool isHell = player.ZoneUnderworldHeight; + npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 50 : 99999; + Vector2 vectorCenter = npc.Center; + npc.TargetClosest(false); + if (!Main.dayTime || !player.active || player.dead) + { + npc.TargetClosest(false); player = Main.player[npc.target]; if (!Main.dayTime || !player.active || player.dead) { @@ -126,304 +126,304 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss } return; } - } - if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - bool flag100 = false; - for (int num569 = 0; num569 < 200; num569++) - { - if ((Main.npc[num569].active && Main.npc[num569].type == (mod.NPCType("ProfanedGuardianBoss2"))) || (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("ProfanedGuardianBoss3"))) - { - flag100 = true; - } - } - if (flag100) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = ((lifeRatio < 0.75f || CalamityWorld.death || CalamityWorld.bossRushActive) ? 14f : 16f); - if (revenge) - { - num1000 *= 1.15f; - } - float num1001 = 5f; - float scaleFactor4 = 0.8f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = ((lifeRatio < 0.75f || CalamityWorld.death || CalamityWorld.bossRushActive) ? 14f : 16f); - if (revenge) - { - num1005 *= 1.15f; - } - float num1006 = 0.333333343f; - float num1007 = 8f; - num1006 *= num1005; - int num1009 = (npc.ai[0] == 2f) ? 2 : 1; - int num1010 = (npc.ai[0] == 2f) ? 80 : 60; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f + (2f * (1f - lifeRatio)); - if (npc.localAI[0] >= (CalamityWorld.bossRushActive ? 210f : 240f)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); + } + if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + bool flag100 = false; + for (int num569 = 0; num569 < 200; num569++) + { + if ((Main.npc[num569].active && Main.npc[num569].type == (mod.NPCType("ProfanedGuardianBoss2"))) || (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("ProfanedGuardianBoss3"))) + { + flag100 = true; + } + } + if (flag100) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = ((lifeRatio < 0.75f || CalamityWorld.death || CalamityWorld.bossRushActive) ? 14f : 16f); + if (revenge) + { + num1000 *= 1.15f; + } + float num1001 = 5f; + float scaleFactor4 = 0.8f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = ((lifeRatio < 0.75f || CalamityWorld.death || CalamityWorld.bossRushActive) ? 14f : 16f); + if (revenge) + { + num1005 *= 1.15f; + } + float num1006 = 0.333333343f; + float num1007 = 8f; + num1006 *= num1005; + int num1009 = (npc.ai[0] == 2f) ? 2 : 1; + int num1010 = (npc.ai[0] == 2f) ? 80 : 60; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f + (2f * (1f - lifeRatio)); + if (npc.localAI[0] >= (CalamityWorld.bossRushActive ? 210f : 240f)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); - Main.PlaySound(SoundID.Item20, npc.position); + Main.PlaySound(SoundID.Item20, npc.position); - Vector2 center = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - int totalProjectiles = 18; - float spread = MathHelper.ToRadians(20); - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle = 0D; - float velocity = 5f; - int i = 0; - int damage = expertMode ? 50 : 60; - int projectileType = mod.ProjectileType("ProfanedSpear"); + Vector2 center = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + int totalProjectiles = 18; + float spread = MathHelper.ToRadians(20); + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 + double offsetAngle = 0D; + float velocity = 5f; + int i = 0; + int damage = expertMode ? 50 : 60; + int projectileType = mod.ProjectileType("ProfanedSpear"); - switch (spearType) - { - case 0: - for (i = 0; i < 9; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 - Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } - break; - case 1: - totalProjectiles = 12; - spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - velocity = 5.5f; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 - Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } - break; - case 2: - totalProjectiles = 8; - spread = MathHelper.ToRadians(45); // 30 degrees in radians = 0.523599 - startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - velocity = 6f; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 - Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } - break; - default: - break; - } + switch (spearType) + { + case 0: + for (i = 0; i < 9; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 + Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + } + break; + case 1: + totalProjectiles = 12; + spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 + startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 + velocity = 5.5f; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 + Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + } + break; + case 2: + totalProjectiles = 8; + spread = MathHelper.ToRadians(45); // 30 degrees in radians = 0.523599 + startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 + velocity = 6f; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; // Used to be 32 + Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + } + break; + default: + break; + } - spearType++; - if (spearType > 2) - spearType = 0; - } - } - if (npc.ai[0] == 0f) - { - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = Main.player[npc.target].Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); - if (num1013 > num999 || !flag64) - { - npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - npc.ai[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (npc.ai[0] == 2f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - dustTimer--; - if ((lifeRatio < 0.5f || CalamityWorld.death) && dustTimer <= 0) - { - Main.PlaySound(SoundID.Item20, npc.position); - int damage = expertMode ? 55 : 70; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed - Main.projectile[projectile].timeLeft = 120; - Main.projectile[projectile].velocity.X = 0f; - Main.projectile[projectile].velocity.Y = 0f; - dustTimer = 3; - } - } - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - npc.ai[0] = 3f; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = Main.player[npc.target].Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; - } - } - else if (npc.ai[0] == 3f) - { - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.98f; - } - } + spearType++; + if (spearType > 2) + spearType = 0; + } + } + if (npc.ai[0] == 0f) + { + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = Main.player[npc.target].Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); + if (num1013 > num999 || !flag64) + { + npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + npc.ai[0] = 1f; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (npc.ai[0] == 2f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + dustTimer--; + if ((lifeRatio < 0.5f || CalamityWorld.death) && dustTimer <= 0) + { + Main.PlaySound(SoundID.Item20, npc.position); + int damage = expertMode ? 55 : 70; + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed + Main.projectile[projectile].timeLeft = 120; + Main.projectile[projectile].velocity.X = 0f; + Main.projectile[projectile].velocity.Y = 0f; + dustTimer = 3; + } + } + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + npc.ai[0] = 3f; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = Main.player[npc.target].Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; + } + } + else if (npc.ai[0] == 3f) + { + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.98f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void BossLoot(ref string name, ref int potionType) - { - name = "A Profaned Guardian"; - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + name = "A Profaned Guardian"; + potionType = ItemID.GreaterHealingPotion; + } - public override void NPCLoot() - { + public override void NPCLoot() + { // Profaned Guardians have no actual drops and no treasure bag DropHelper.DropItem(npc, mod.ItemType("ProfanedCore")); DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeProfanedGuardians"), true, !CalamityWorld.downedGuardians); @@ -434,34 +434,34 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss CalamityMod.UpdateServerBoolean(); } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs index 42f61fa4a6..fffa5ea6e2 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs @@ -1,67 +1,67 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.ProfanedGuardianBoss { [AutoloadBossHead] public class ProfanedGuardianBoss2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 110; - npc.width = 100; - npc.height = 80; - npc.defense = 50; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 110; + npc.width = 100; + npc.height = 80; + npc.defense = 50; npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = 40000; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 400000 : 300000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - aiType = -1; - npc.boss = true; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + aiType = -1; + npc.boss = true; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); else music = MusicID.Boss1; for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + { + npc.buffImmune[k] = true; } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -69,184 +69,184 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.frame.Y = frame * frameHeight; } - public override void AI() - { - bool expertMode = Main.expertMode; - bool isHoly = Main.player[npc.target].ZoneHoly; - bool isHell = Main.player[npc.target].ZoneUnderworldHeight; - npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 40 : 99999; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 160; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 90f) - { - num786 = 24f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f - { - npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f - npc.velocity.X = npc.velocity.X * 1.15f; //1.05f - } - if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 24f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 27f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 100f; - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 700f) - { - npc.ai[0] = 0f; - return; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += expertMode ? 2f : 1f; - if (npc.localAI[0] >= 420f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 50 : 60; - int projectileShot = mod.ProjectileType("ProfanedSpear"); - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + bool isHoly = Main.player[npc.target].ZoneHoly; + bool isHell = Main.player[npc.target].ZoneUnderworldHeight; + npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 40 : 99999; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 160; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.ai[0] == 0f) + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 90f) + { + num786 = 24f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f + { + npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f + npc.velocity.X = npc.velocity.X * 1.15f; //1.05f + } + if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = 24f / num786; //8f + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= 27f; //9f + npc.velocity = (npc.velocity * 99f + value4) / 100f; + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + if (num789 > 700f) + { + npc.ai[0] = 0f; + return; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += expertMode ? 2f : 1f; + if (npc.localAI[0] >= 420f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 50 : 60; + int projectileShot = mod.ProjectileType("ProfanedSpear"); + int i; + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void BossLoot(ref string name, ref int potionType) - { - name = "A Profaned Guardian"; - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + name = "A Profaned Guardian"; + potionType = ItemID.GreaterHealingPotion; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs index 3ac343a567..73aefaada5 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs @@ -1,67 +1,67 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.ProfanedGuardianBoss { [AutoloadBossHead] public class ProfanedGuardianBoss3 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 90; - npc.width = 100; - npc.height = 80; - npc.defense = 35; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 90; + npc.width = 100; + npc.height = 80; + npc.defense = 35; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = 25000; + npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 240000 : 200000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - aiType = -1; - npc.boss = true; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + aiType = -1; + npc.boss = true; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); else music = MusicID.Boss1; for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + { + npc.buffImmune[k] = true; } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -69,186 +69,186 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.frame.Y = frame * frameHeight; } - public override void AI() - { - bool expertMode = Main.expertMode; - bool isHoly = Main.player[npc.target].ZoneHoly; - bool isHell = Main.player[npc.target].ZoneUnderworldHeight; - npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 25 : 99999; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 107; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 90f) - { - num786 = 24f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f - { - npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f - npc.velocity.X = npc.velocity.X * 1.15f; //1.05f - } - if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 24f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 27f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 100f; - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 700f) - { - npc.ai[0] = 0f; - return; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += expertMode ? 2f : 1f; - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = 0; - int projectileShot = mod.ProjectileType("HealOrbProv"); - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + bool isHoly = Main.player[npc.target].ZoneHoly; + bool isHell = Main.player[npc.target].ZoneUnderworldHeight; + npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 25 : 99999; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 107; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.ai[0] == 0f) + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 90f) + { + num786 = 24f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f + { + npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f + npc.velocity.X = npc.velocity.X * 1.15f; //1.05f + } + if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = 24f / num786; //8f + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= 27f; //9f + npc.velocity = (npc.velocity * 99f + value4) / 100f; + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + if (num789 > 700f) + { + npc.ai[0] = 0f; + return; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += expertMode ? 2f : 1f; + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = 0; + int projectileShot = mod.ProjectileType("HealOrbProv"); + int i; + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void BossLoot(ref string name, ref int potionType) - { - name = "A Profaned Guardian"; - potionType = ItemID.GreaterHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + name = "A Profaned Guardian"; + potionType = ItemID.GreaterHealingPotion; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Providence/ProvScreenShaderData.cs b/NPCs/Providence/ProvScreenShaderData.cs index bc25ab2aea..e32df5e51c 100644 --- a/NPCs/Providence/ProvScreenShaderData.cs +++ b/NPCs/Providence/ProvScreenShaderData.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Providence { - public class ProvScreenShaderData : ScreenShaderData - { - private int ProvIndex; + public class ProvScreenShaderData : ScreenShaderData + { + private int ProvIndex; - public ProvScreenShaderData(string passName) - : base(passName) - { - } + public ProvScreenShaderData(string passName) + : base(passName) + { + } - private void UpdatePIndex() - { - int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); - if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) - { - return; - } - ProvIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ProvType) - { - ProvIndex = i; - break; - } - } - } + private void UpdatePIndex() + { + int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); + if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) + { + return; + } + ProvIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ProvType) + { + ProvIndex = i; + break; + } + } + } - public override void Apply() - { - UpdatePIndex(); - if (ProvIndex != -1) - { - UseTargetPosition(Main.npc[ProvIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdatePIndex(); + if (ProvIndex != -1) + { + UseTargetPosition(Main.npc[ProvIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/Providence/ProvSky.cs b/NPCs/Providence/ProvSky.cs index 908143a187..abe581a651 100644 --- a/NPCs/Providence/ProvSky.cs +++ b/NPCs/Providence/ProvSky.cs @@ -6,95 +6,95 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Providence { - public class ProvSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int ProvIndex = -1; + public class ProvSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int ProvIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdatePIndex()) - { - float x = 0f; - if (this.ProvIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.ProvIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.25f; - } - return 0f; //0.5 - } + private float GetIntensity() + { + if (this.UpdatePIndex()) + { + float x = 0f; + if (this.ProvIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.ProvIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.25f; + } + return 0f; //0.5 + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdatePIndex() - { - int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); - if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) - { - return true; - } - ProvIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ProvType) - { - ProvIndex = i; - break; - } - } - return ProvIndex != -1; - } + private bool UpdatePIndex() + { + int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); + if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) + { + return true; + } + ProvIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ProvType) + { + ProvIndex = i; + break; + } + } + return ProvIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(255, 200, 100) * intensity); - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(255, 200, 100) * intensity); + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 79d1128805..04d1cfb019 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -1,59 +1,59 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Providence { public class ProvSpawnDefense : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("A Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("A Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 100; - npc.height = 80; - npc.defense = 50; + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 100; + npc.width = 100; + npc.height = 80; + npc.defense = 50; npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 360000 : 300000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -61,47 +61,47 @@ namespace CalamityMod.NPCs.Providence npc.frame.Y = frame * frameHeight; } - public override void AI() - { - CalamityGlobalNPC.holyBossDefender = npc.whoAmI; - bool expertMode = Main.expertMode; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); + public override void AI() + { + CalamityGlobalNPC.holyBossDefender = npc.whoAmI; + bool expertMode = Main.expertMode; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); if (!Main.npc[CalamityGlobalNPC.holyBoss].active) { npc.active = false; npc.netUpdate = true; return; } - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 160; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 160; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } npc.TargetClosest(true); float num1372 = 9f; Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Providence npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; } - } + } public override bool CheckActive() { @@ -140,27 +140,27 @@ namespace CalamityMod.NPCs.Providence } public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index eeec304d22..ecef8892f6 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,59 +1,59 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Providence { public class ProvSpawnHealer : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("A Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("A Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 100; - npc.height = 80; - npc.defense = 35; + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 100; + npc.height = 80; + npc.defense = 35; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 40000; + npc.lifeMax = 40000; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 500000 : 400000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -61,100 +61,100 @@ namespace CalamityMod.NPCs.Providence npc.frame.Y = frame * frameHeight; } - public override void AI() - { - CalamityGlobalNPC.holyBossHealer = npc.whoAmI; - bool expertMode = Main.expertMode; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); + public override void AI() + { + CalamityGlobalNPC.holyBossHealer = npc.whoAmI; + bool expertMode = Main.expertMode; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); if (!Main.npc[CalamityGlobalNPC.holyBoss].active) { npc.active = false; npc.netUpdate = true; return; } - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 107; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 107; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 360f) - { - num786 = 8f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f - { - npc.velocity.Y = npc.velocity.Y * 1.05f; //1.05f - npc.velocity.X = npc.velocity.X * 1.05f; //1.05f - } - if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(2000)) || Main.rand.NextBool(1000))) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 24f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - } - else - { - if (expertMode) - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 9f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 99f; //100 - } - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 700f || npc.justHit) - { - npc.ai[0] = 0f; - } - } - } + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 360f) + { + num786 = 8f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f + { + npc.velocity.Y = npc.velocity.Y * 1.05f; //1.05f + npc.velocity.X = npc.velocity.X * 1.05f; //1.05f + } + if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(2000)) || Main.rand.NextBool(1000))) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = 24f / num786; //8f + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + } + else + { + if (expertMode) + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= 9f; //9f + npc.velocity = (npc.velocity * 99f + value4) / 99f; //100 + } + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + if (num789 > 700f || npc.justHit) + { + npc.ai[0] = 0f; + } + } + } public override bool CheckActive() { @@ -162,34 +162,34 @@ namespace CalamityMod.NPCs.Providence } public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + { + cooldownSlot = 1; + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 731021df60..c92676eeb4 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,64 +1,64 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Providence { public class ProvSpawnOffense : ModNPC - { - public int dustTimer = 3; + { + public int dustTimer = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("A Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("A Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 120; - npc.width = 100; - npc.height = 80; - npc.defense = 40; + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 120; + npc.width = 100; + npc.height = 80; + npc.defense = 40; npc.Calamity().RevPlusDR(0.3f); npc.lifeMax = 42500; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 500000 : 400000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -66,251 +66,251 @@ namespace CalamityMod.NPCs.Providence npc.frame.Y = frame * frameHeight; } - public override void AI() - { - CalamityGlobalNPC.holyBossAttacker = npc.whoAmI; - bool fireDust = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool expertMode = Main.expertMode; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); + public override void AI() + { + CalamityGlobalNPC.holyBossAttacker = npc.whoAmI; + bool fireDust = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool expertMode = Main.expertMode; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); if (!Main.npc[CalamityGlobalNPC.holyBoss].active) { npc.active = false; npc.netUpdate = true; return; } - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = 60f; - float num1001 = 5f; - float scaleFactor4 = 0.8f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = 60f; - float num1006 = 0.333333343f; - float num1007 = 8f; - num1006 *= num1005; - int num1009 = (npc.ai[0] == 2f) ? 2 : 1; - int num1010 = (npc.ai[0] == 2f) ? 80 : 60; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (npc.ai[0] == 0f) - { - npc.knockBackResist = 0f; - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = Main.player[npc.target].Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); - if (num1013 > num999 || !flag64) - { - npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - npc.ai[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.knockBackResist = 0f; - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (npc.ai[0] == 2f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - dustTimer--; - if (fireDust && dustTimer <= 0) - { - Main.PlaySound(SoundID.Item20, npc.position); - int damage = expertMode ? 40 : 59; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed - Main.projectile[projectile].timeLeft = 120; - Main.projectile[projectile].velocity.X = 0f; - Main.projectile[projectile].velocity.Y = 0f; - dustTimer = 3; - } - } - npc.knockBackResist = 0f; - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - npc.ai[0] = 3f; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = Main.player[npc.target].Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; - } - } - else if (npc.ai[0] == 3f) - { - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.98f; - } - } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = 60f; + float num1001 = 5f; + float scaleFactor4 = 0.8f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = 60f; + float num1006 = 0.333333343f; + float num1007 = 8f; + num1006 *= num1005; + int num1009 = (npc.ai[0] == 2f) ? 2 : 1; + int num1010 = (npc.ai[0] == 2f) ? 80 : 60; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (npc.ai[0] == 0f) + { + npc.knockBackResist = 0f; + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = Main.player[npc.target].Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); + if (num1013 > num999 || !flag64) + { + npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + npc.ai[0] = 1f; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.knockBackResist = 0f; + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (npc.ai[0] == 2f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + dustTimer--; + if (fireDust && dustTimer <= 0) + { + Main.PlaySound(SoundID.Item20, npc.position); + int damage = expertMode ? 40 : 59; + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed + Main.projectile[projectile].timeLeft = 120; + Main.projectile[projectile].velocity.X = 0f; + Main.projectile[projectile].velocity.Y = 0f; + dustTimer = 3; + } + } + npc.knockBackResist = 0f; + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + npc.ai[0] = 3f; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = Main.player[npc.target].Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; + } + } + else if (npc.ai[0] == 3f) + { + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.98f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + return false; + } - public override bool CheckActive() + public override bool CheckActive() { return false; } public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + { + cooldownSlot = 1; + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + player.AddBuff(BuffID.OnFire, 600, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index bb1ce80bc9..183fc519f4 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1,1024 +1,1078 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Providence { - [AutoloadBossHead] - public class Providence : ModNPC - { - private bool text = false; - private bool useDefenseFrames = false; - private float bossLife; - private int biomeType = 0; - private int flightPath = 0; - private int phaseChange = 0; - private int immuneTimer = 300; - private int frameUsed = 0; - private int healTimer = 0; + [AutoloadBossHead] + public class Providence : ModNPC + { + private bool text = false; + private bool useDefenseFrames = false; + private float bossLife; + private int biomeType = 0; + private int flightPath = 0; + private int phaseChange = 0; + private int immuneTimer = 300; + private int frameUsed = 0; + private int healTimer = 0; public static float normalDR = 0.25f; public static float cocoonDR = 0.9f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence, the Profaned Goddess"); - Main.npcFrameCount[npc.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence, the Profaned Goddess"); + Main.npcFrameCount[npc.type] = 3; + } - public override void SetDefaults() - { - npc.npcSlots = 36f; - npc.damage = 100; - npc.width = 600; - npc.height = 450; - npc.defense = 50; + public override void SetDefaults() + { + npc.npcSlots = 36f; + npc.damage = 100; + npc.width = 600; + npc.height = 450; + npc.defense = 50; CalamityGlobalNPC global = npc.Calamity(); global.DR = normalDR; global.customDR = true; global.flatDRReductions.Add(BuffID.Ichor, 0.05f); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); - npc.lifeMax = CalamityWorld.revenge ? 500000 : 440000; - if (CalamityWorld.death) - { - npc.lifeMax = 715000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 15000000 : 12500000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 50, 0, 0); - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.chaseable = true; - npc.canGhostHeal = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); - else - music = MusicID.LunarBoss; - npc.HitSound = SoundID.NPCHit44; - npc.DeathSound = SoundID.NPCDeath46; - bossBag = mod.ItemType("ProvidenceBag"); - } + npc.lifeMax = CalamityWorld.revenge ? 500000 : 440000; + if (CalamityWorld.death) + { + npc.lifeMax = 715000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 15000000 : 12500000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 50, 0, 0); + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + npc.chaseable = true; + npc.canGhostHeal = false; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); + else + music = MusicID.LunarBoss; + npc.HitSound = SoundID.NPCHit44; + npc.DeathSound = SoundID.NPCDeath46; + bossBag = mod.ItemType("ProvidenceBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(text); - writer.Write(useDefenseFrames); - writer.Write(biomeType); - writer.Write(phaseChange); - writer.Write(immuneTimer); - writer.Write(frameUsed); - writer.Write(healTimer); - writer.Write(flightPath); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(npc.canGhostHeal); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(text); + writer.Write(useDefenseFrames); + writer.Write(biomeType); + writer.Write(phaseChange); + writer.Write(immuneTimer); + writer.Write(frameUsed); + writer.Write(healTimer); + writer.Write(flightPath); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + writer.Write(npc.canGhostHeal); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - text = reader.ReadBoolean(); - useDefenseFrames = reader.ReadBoolean(); - biomeType = reader.ReadInt32(); - phaseChange = reader.ReadInt32(); - immuneTimer = reader.ReadInt32(); - frameUsed = reader.ReadInt32(); - healTimer = reader.ReadInt32(); - flightPath = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.canGhostHeal = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + text = reader.ReadBoolean(); + useDefenseFrames = reader.ReadBoolean(); + biomeType = reader.ReadInt32(); + phaseChange = reader.ReadInt32(); + immuneTimer = reader.ReadInt32(); + frameUsed = reader.ReadInt32(); + healTimer = reader.ReadInt32(); + flightPath = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.canGhostHeal = reader.ReadBoolean(); + } - public override void AI() - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // whoAmI variable for Guardians and other things - CalamityGlobalNPC.holyBoss = npc.whoAmI; + // whoAmI variable for Guardians and other things + CalamityGlobalNPC.holyBoss = npc.whoAmI; - // Rotation - npc.rotation = npc.velocity.X * 0.004f; + // Rotation + npc.rotation = npc.velocity.X * 0.004f; - // Target variable and boss center - Player player = Main.player[npc.target]; - Vector2 vector = npc.Center; + // Target variable and boss center + Player player = Main.player[npc.target]; + Vector2 vector = npc.Center; - // Difficulty bools - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + // Difficulty bools + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - // Target's current biome - bool isHoly = player.ZoneHoly; - bool isHell = player.ZoneUnderworldHeight; + // Target's current biome + bool isHoly = player.ZoneHoly; + bool isHell = player.ZoneUnderworldHeight; - // Fire projectiles at normal rate or not - bool normalAttackRate = true; + // Fire projectiles at normal rate or not + bool normalAttackRate = true; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Phases - bool ignoreGuardianAmt = lifeRatio < 0.15f; - bool phase2 = lifeRatio < 0.75f; + // Phases + bool ignoreGuardianAmt = lifeRatio < 0.15f; + bool phase2 = lifeRatio < 0.75f; - // Projectile fire rate multiplier - double attackRateMult = 1.0; + // Projectile fire rate multiplier + double attackRateMult = 1.0; - // Distance X needed from target in order to fire holy or molten blasts - float distanceNeededToShoot = revenge ? 360f : 420f; + // Distance X needed from target in order to fire holy or molten blasts + float distanceNeededToShoot = revenge ? 360f : 420f; - // Inflict Holy Inferno if target is too far away - if (Vector2.Distance(player.Center, vector) > 2800f) - { - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("HolyInferno"), 2); - } + // Inflict Holy Inferno if target is too far away + if (Vector2.Distance(player.Center, vector) > 2800f) + { + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("HolyInferno"), 2); + } - // Count the remaining Guardians, healer especially because it allows the boss to heal - int guardianAmt = 0; - bool healerAlive = false; - if (CalamityGlobalNPC.holyBossAttacker != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) - guardianAmt++; - } - if (CalamityGlobalNPC.holyBossDefender != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBossDefender].active) - guardianAmt++; - } - if (CalamityGlobalNPC.holyBossHealer != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBossHealer].active) - { - guardianAmt++; - healerAlive = true; - } - } + // Count the remaining Guardians, healer especially because it allows the boss to heal + int guardianAmt = 0; + bool healerAlive = false; + if (CalamityGlobalNPC.holyBossAttacker != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) + guardianAmt++; + } + if (CalamityGlobalNPC.holyBossDefender != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossDefender].active) + guardianAmt++; + } + if (CalamityGlobalNPC.holyBossHealer != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossHealer].active) + { + guardianAmt++; + healerAlive = true; + } + } - // Change projectile fire rate depending on Guardian amount - if (guardianAmt > 0) - { - normalAttackRate = ignoreGuardianAmt; - if (!normalAttackRate) - { - switch (guardianAmt) - { - case 1: - attackRateMult = 1.25; - break; - case 2: - attackRateMult = 1.5; - break; - case 3: - attackRateMult = 2.0; - break; - default: - break; - } - } - } + // Change projectile fire rate depending on Guardian amount + if (guardianAmt > 0) + { + normalAttackRate = ignoreGuardianAmt; + if (!normalAttackRate) + { + switch (guardianAmt) + { + case 1: + attackRateMult = 1.25; + break; + case 2: + attackRateMult = 1.5; + break; + case 3: + attackRateMult = 2.0; + break; + default: + break; + } + } + } - // Whether the boss can be homed in on or healed off of - npc.chaseable = normalAttackRate && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f; - npc.canGhostHeal = npc.chaseable; + // Whether the boss can be homed in on or healed off of + npc.chaseable = normalAttackRate && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f; + npc.canGhostHeal = npc.chaseable; - // Prevent lag by stopping rain - CalamityMod.StopRain(); + // Prevent lag by stopping rain + CalamityMod.StopRain(); - // Set target biome type - if (biomeType == 0) - { - if (isHoly) - biomeType = 1; - else if (isHell) - biomeType = 2; - } + // Set target biome type + if (biomeType == 0) + { + if (isHoly) + biomeType = 1; + else if (isHell) + biomeType = 2; + } - // Become immune over time if target isn't in hell or hallow - if (!isHoly && !isHell && !CalamityWorld.bossRushActive) - { - if (immuneTimer > 0) - immuneTimer--; - } - else - immuneTimer = 300; + // Become immune over time if target isn't in hell or hallow + if (!isHoly && !isHell && !CalamityWorld.bossRushActive) + { + if (immuneTimer > 0) + immuneTimer--; + } + else + immuneTimer = 300; - // Take damage or not - npc.dontTakeDamage = (immuneTimer <= 0); + // Take damage or not + npc.dontTakeDamage = (immuneTimer <= 0); - // Heal - if (healerAlive) - { - float heal = revenge ? 90f : 120f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - heal = 30f; + // Heal + if (healerAlive) + { + float heal = revenge ? 90f : 120f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + heal = 30f; - switch (guardianAmt) - { - case 1: - heal *= 2f; - break; - case 2: - break; - case 3: - heal *= 0.5f; - break; - default: - break; - } + switch (guardianAmt) + { + case 1: + heal *= 2f; + break; + case 2: + break; + case 3: + heal *= 0.5f; + break; + default: + break; + } - healTimer++; - if (healTimer >= heal) - { - healTimer = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = npc.lifeMax / 200; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; + healTimer++; + if (healTimer >= heal) + { + healTimer = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = npc.lifeMax / 200; + if (healAmt > npc.lifeMax - npc.life) + healAmt = npc.lifeMax - npc.life; - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } - // Despawn - if ((!Main.dayTime && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f) || player.dead) - { - if (npc.timeLeft > 10) - npc.timeLeft = 10; + // Despawn + if ((!Main.dayTime && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f) || player.dead) + { + if (npc.timeLeft > 10) + npc.timeLeft = 10; - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + 0.25f; - else - npc.velocity.X = npc.velocity.X - 0.25f; + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + 0.25f; + else + npc.velocity.X = npc.velocity.X - 0.25f; - npc.velocity.Y = npc.velocity.Y - 0.25f; - } - else if (npc.timeLeft < 3600) - npc.timeLeft = 3600; + npc.velocity.Y = npc.velocity.Y - 0.25f; + } + else if (npc.timeLeft < 3600) + npc.timeLeft = 3600; - // Guardian spawn - if (bossLife == 0f && npc.life > 0) - bossLife = (float)npc.lifeMax; - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.66); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - NPC.NewNPC(x - 100, y - 100, mod.NPCType("ProvSpawnDefense"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC(x + 100, y - 100, mod.NPCType("ProvSpawnHealer"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC(x, y + 100, mod.NPCType("ProvSpawnOffense"), 0, 0f, 0f, 0f, 0f, 255); - } - } - } + // Guardian spawn + if (bossLife == 0f && npc.life > 0) + bossLife = (float)npc.lifeMax; + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.66); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + NPC.NewNPC(x - 100, y - 100, mod.NPCType("ProvSpawnDefense"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(x + 100, y - 100, mod.NPCType("ProvSpawnHealer"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(x, y + 100, mod.NPCType("ProvSpawnOffense"), 0, 0f, 0f, 0f, 0f, 255); + } + } + } // Set DR based on current attack phase npc.Calamity().DR = (npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f) ? cocoonDR : normalDR; // Movement if (npc.ai[0] != 2f && npc.ai[0] != 5f) - { - // Firing holy ray or not - bool firingLaser = npc.ai[0] == 7f; - - // Change X direction of movement - if (flightPath == 0) - { - npc.TargetClosest(true); - if (vector.X < player.Center.X) - { - flightPath = 1; - calamityGlobalNPC.newAI[0] = 0f; - } - else - { - flightPath = -1; - calamityGlobalNPC.newAI[0] = 0f; - } - } - - // Get a target - npc.TargetClosest(true); - - // Increase speed over time if flying in same direction for too long - if (revenge) - calamityGlobalNPC.newAI[0] += 1f; - - // Distance needed from target to change direction - float num851 = 800f; - - // Increase distance from target when firing molten blasts or holy bombs - bool stayAwayFromTarget = npc.ai[0] == 3f || npc.ai[0] == 4f; - if (stayAwayFromTarget) - num851 += (revenge ? 200f : 100f); - - // Change X movement path if far enough away from target - float num852 = Math.Abs(vector.X - player.Center.X); - if (vector.X < player.Center.X && flightPath < 0 && num852 > num851) - flightPath = 0; - if (vector.X > player.Center.X && flightPath > 0 && num852 > num851) - flightPath = 0; - - // Velocity and acceleration - bool increaseSpeed = calamityGlobalNPC.newAI[0] > 150f; - float acceleration = (expertMode ? 1.1f : 1.05f) + (0.2f * (1f - lifeRatio)); - float velocity = (expertMode ? 16f : 15f) + (4f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - { - acceleration = 1.3f; - velocity = 20f; - } - if (firingLaser) - { - acceleration *= normalAttackRate ? 0.4f : 0.2f; - velocity *= normalAttackRate ? 0.4f : 0.2f; - } - else if (increaseSpeed) - { - velocity += (calamityGlobalNPC.newAI[0] - 150f) * 0.04f; - if (velocity > 30f) - velocity = 30f; - } - - npc.velocity.X = npc.velocity.X + (float)flightPath * acceleration; - if (npc.velocity.X > velocity) - npc.velocity.X = velocity; - if (npc.velocity.X < -velocity) - npc.velocity.X = -velocity; - - float num855 = player.position.Y - (npc.position.Y + (float)npc.height); - if (num855 < (firingLaser ? 150f : 200f)) // 150 - npc.velocity.Y = npc.velocity.Y - 0.2f; - if (num855 > (firingLaser ? 200f : 250f)) // 200 - npc.velocity.Y = npc.velocity.Y + 0.2f; - - float speedVariance = normalAttackRate ? 2f : 1f; - if (npc.velocity.Y > (firingLaser ? speedVariance : 6f)) - npc.velocity.Y = firingLaser ? speedVariance : 6f; - if (npc.velocity.Y < (firingLaser ? -speedVariance : -6f)) - npc.velocity.Y = firingLaser ? -speedVariance : -6f; - } - - // Phase switch - if (npc.ai[0] == -1f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - phaseChange++; - if (phaseChange > 14) - phaseChange = 0; - - int phase = 0; // 0 = blasts 1 = holy fire 2 = shell heal 3 = molten blobs 4 = holy bombs 5 = shell spears 6 = crystal 7 = laser - - // Holy ray in hallow, Crystal in hell - bool useLaser = (phase2 && biomeType == 1) || CalamityWorld.bossRushActive; - bool useCrystal = (phase2 && biomeType == 2) || CalamityWorld.bossRushActive; - - // Unique pattern for Death Mode and Boss Rush - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - switch (phaseChange) - { - case 0: phase = 4; break; // 1575 or 1500 - case 1: phase = 5; break; // 1875 or 1800 - case 2: phase = 0; break; // 2175 or 2100 - case 3: phase = useCrystal ? 6 : 1; break; - case 4: phase = 2; break; // 600 - case 5: phase = 4; break; // 900 - case 6: phase = 1; break; // 1200 - case 7: phase = 5; break; // 1500 - case 8: - phase = useLaser ? 7 : 3; // 1875 or 1800 - if (useLaser) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 9: phase = 3; break; // 2175 or 2100 - case 10: phase = useCrystal ? 6 : 2; break; - case 11: phase = 4; break; // 300 - case 12: - phase = useLaser ? 7 : 4; // 675 or 600 - if (useLaser) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 13: phase = 5; break; // 975 or 900 - case 14: phase = 0; break; // 1275 or 1200 - default: break; - } - } - else - { - switch (phaseChange) - { - case 0: phase = 0; break; // 3375 or 3300 - case 1: - phase = useLaser ? 7 : 1; // 3750 or 3600 - if (useLaser) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 2: phase = 3; break; // 4050 or 3900 - case 3: phase = 4; break; // 4350 or 4200 - case 4: phase = 5; break; // 4650 or 4500 - case 5: phase = useCrystal ? 6 : 4; break; - case 6: phase = 3; break; // 300 - case 7: phase = 1; break; // 600 - case 8: phase = 0; break; // 900 - case 9: phase = 2; break; // 1500 - case 10: phase = 4; break; // 1800 - case 11: - phase = useLaser ? 7 : 0; //2175 or 2100 - if (useLaser) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 12: phase = 3; break; // 2475 or 2400 - case 13: phase = 1; break; // 2775 or 2700 - case 14: phase = 5; break; // 3075 or 3000 - default: break; - } - } - - // Pick a target - npc.TargetClosest(true); - - // If too far from target, set phase to 0 - if (Math.Abs(vector.X - player.Center.X) > 5600f) - phase = 0; - - // Reset arrays - npc.ai[0] = (float)phase; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - // Holy blasts - else if (npc.ai[0] == 0f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - float num852 = Math.Abs(vector.X - player.Center.X); - if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) - { - npc.ai[3] += 1f; - - int num856 = (expertMode ? 24 : 26) - (int)(4f * (1f - lifeRatio)); - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num856 = 19; - - num856 = (int)((double)num856 * attackRateMult); - - if (npc.ai[3] >= (float)num856) - npc.ai[3] = (float)(-(float)num856); - - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - vector.X += npc.velocity.X * 7f; - float num857 = player.position.X + (float)player.width * 0.5f - vector.X; - float num858 = player.Center.Y - vector.Y; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); - - float num860 = (expertMode ? 10.25f : 9f) + (2.5f * (1f - lifeRatio)); - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num860 = 12.75f; - - if (revenge) - num860 *= 1.15f; - - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; - - int holyDamage = expertMode ? 52 : 65; - Projectile.NewProjectile(vector.X, vector.Y, num857, num858, mod.ProjectileType("HolyBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (npc.ai[3] < 0f) - npc.ai[3] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) - npc.ai[0] = -1f; - } - } - - // Holy fire - else if (npc.ai[0] == 1f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - - int num864 = (expertMode ? 36 : 39) - (int)(8f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - num864 = 29; - - num864 = (int)((double)num864 * attackRateMult); - - if (npc.ai[3] >= (float)num864) - { - npc.ai[3] = 0f; - - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + (float)npc.height - 14f); - - float num865 = npc.velocity.Y; - if (num865 < 0f) - num865 = 0f; - - num865 += expertMode ? 4f : 3f; - - int fireDamage = expertMode ? 48 : 60; - Projectile.NewProjectile(vector113.X, vector113.Y, npc.velocity.X * 0.25f, num865, mod.ProjectileType("HolyFire"), fireDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) - npc.ai[0] = -1f; - } - } - - // Cocoon flames - else if (npc.ai[0] == 2f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - npc.TargetClosest(true); - - Vector2 vector114 = new Vector2(vector.X, vector.Y + 20f); - float num866 = (float)Main.rand.Next(-1000, 1001); - float num867 = (float)Main.rand.Next(-1000, 1001); - float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); - float num869 = 3f; - - npc.velocity *= 0.95f; - - num868 = num869 / num868; - num866 *= num868; - num867 *= num868; - vector114.X += num866 * 32f; - vector114.Y += num867 * 32f; - - npc.ai[3] += 1f; - - int num870 = (expertMode ? 3 : 4) - (int)(4f * (1f - lifeRatio)); - num870 = (int)((double)num870 * attackRateMult); - - if (CalamityWorld.bossRushActive) - num870 /= 2; - - if (npc.ai[3] >= (float)num870) - { - npc.ai[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Main.rand.NextBool(4) && !CalamityWorld.death && !CalamityWorld.bossRushActive) - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyLight"), 0, 0f, Main.myPlayer, 0f, 0f); - else - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyBurnOrb"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - - // Air is burning text - npc.ai[1] += 1f; - if (npc.ai[1] >= 450f && !text) - { - text = true; - string key = "Mods.CalamityMod.ProfanedBossText"; - Color messageColor = Color.Orange; - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - - // Inflict Icarus Folly - if (npc.ai[1] >= 600f) - { - if (Main.netMode != NetmodeID.Server) - { - Player player2 = Main.player[Main.myPlayer]; - bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; - - if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f && !inLiquid) - { - Main.PlaySound(SoundID.Item20, player2.position); - player2.AddBuff(mod.BuffType("ExtremeGravity"), 3000, true); - - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - text = false; - npc.ai[0] = -1f; - } - } - - // Molten blasts - else if (npc.ai[0] == 3f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - float num852 = Math.Abs(vector.X - player.Center.X); - if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) - { - npc.ai[3] += 1f; - - int num856 = (expertMode ? 16 : 18) - (int)(3f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - num856 = 14; - - num856 = (int)((double)num856 * attackRateMult); - - if (npc.ai[3] >= (float)num856) - npc.ai[3] = (float)(-(float)num856); - - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - vector.X += npc.velocity.X * 7f; - float num857 = player.position.X + (float)player.width * 0.5f - vector.X; - float num858 = player.Center.Y - vector.Y; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); - - float num860 = (expertMode ? 10.25f : 9f) + (2.5f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - num860 = 12.75f; - - if (revenge) - num860 *= 1.15f; - - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; - - int holyDamage = expertMode ? 42 : 55; - Projectile.NewProjectile(vector.X, vector.Y, num857 * 0.1f, num858, mod.ProjectileType("MoltenBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (npc.ai[3] < 0f) - npc.ai[3] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) - npc.ai[0] = -1f; - } - } - - // Holy bombs - else if (npc.ai[0] == 4f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - - int num864 = (expertMode ? 73 : 77) - (int)(15f * (1f - lifeRatio)); - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num864 = 59; - - num864 = (int)((double)num864 * attackRateMult); - - if (npc.ai[3] >= (float)num864) - { - npc.ai[3] = 0f; - - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + (float)npc.height - 14f); - - float num865 = npc.velocity.Y; - if (num865 < 0f) - num865 = 0f; - - num865 += expertMode ? 4f : 3f; - - int fireDamage = expertMode ? 48 : 60; - Projectile.NewProjectile(vector113.X, vector113.Y, npc.velocity.X * 0.25f, num865, mod.ProjectileType("HolyBomb"), fireDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) - npc.ai[0] = -1f; - } - } - - // Cocoon spears - else if (npc.ai[0] == 5f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - npc.TargetClosest(true); - - npc.velocity *= 0.95f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f) + (2f * (1f - lifeRatio)); - - if (CalamityWorld.bossRushActive) - npc.ai[2] += 1f; - - double count = 24D * attackRateMult; - if (npc.ai[2] >= (float)count) - { - npc.ai[2] = 0f; - - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = expertMode ? 12f : 10f; - float num743 = player.position.X + (float)player.width * 0.5f - vector93.X; - float num744 = player.position.Y + (float)player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - - int num746 = expertMode ? 52 : 65; - int num747 = mod.ProjectileType("HolyShot"); - Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + (float)Main.rand.Next(-100, 100), 0f, 0f, mod.ProjectileType("HolySpear"), num746, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) - npc.ai[0] = -1f; - } - } - - // Crystal - else if (npc.ai[0] == 6f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - npc.TargetClosest(true); - - npc.velocity *= 0.95f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) - { - int damage = expertMode ? 57 : 70; - Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, mod.ProjectileType("ProvidenceCrystal"), damage, 0f, player.whoAmI, 0f, 0f); - npc.ai[0] = -1f; - } - } - } - - // Holy ray - else if (npc.ai[0] == 7f) - { - npc.noGravity = true; - npc.noTileCollide = true; - - Vector2 value19 = new Vector2(27f, 59f); - - float rotation = 450f + (float)(guardianAmt * 18); - - npc.ai[2] += 1f; - if (npc.ai[2] < 120f) - { - npc.localAI[1] -= 0.07f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - - if (npc.ai[2] >= 40f) - { - int num1220 = 0; - if (npc.ai[2] >= 80f) - num1220 = 1; - - for (int num1221 = 0; num1221 < 1 + num1220; num1221++) - { - int num1222 = 244; - float num1223 = 1.2f; - if (num1221 % 2 == 1) - num1223 = 2.8f; - - Vector2 vector199 = vector + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; - int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); - Main.dust[num1224].velocity = Vector2.Normalize(vector - vector199) * 3.5f * (10f - (float)num1220 * 2f) / 10f; - Main.dust[num1224].noGravity = true; - Main.dust[num1224].scale = num1223; - } - } - } - else if (npc.ai[2] < (revenge ? 220f : 300f)) - { - if (npc.ai[2] == 120f) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 2800f) - Main.PlaySound(29, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 104, 1f, 0f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(false); - - Vector2 vector200 = player.Center - vector; - vector200.Normalize(); - - float num1225 = -1f; - if (vector200.X < 0f) - num1225 = 1f; - - vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default); - Projectile.NewProjectile(vector.X, vector.Y - 32f, vector200.X, vector200.Y, mod.ProjectileType("ProvidenceHolyRay"), 100, 0f, Main.myPlayer, num1225 * 6.28318548f / rotation, (float)npc.whoAmI); - - if (revenge) - Projectile.NewProjectile(vector.X, vector.Y - 32f, -vector200.X, -vector200.Y, mod.ProjectileType("ProvidenceHolyRay"), 100, 0f, Main.myPlayer, -num1225 * 6.28318548f / rotation, (float)npc.whoAmI); - - npc.ai[3] = (vector200.ToRotation() + 9.424778f) * num1225; - npc.netUpdate = true; - } - } - - npc.localAI[1] += 0.05f; - if (npc.localAI[1] > 1f) - npc.localAI[1] = 1f; - - float num1226 = (float)(npc.ai[3] >= 0f).ToDirectionInt(); - float num1227 = npc.ai[3]; - if (num1227 < 0f) - num1227 *= -1f; - num1227 += -9.424778f; - num1227 += num1226 * 6.28318548f / rotation; - - npc.localAI[0] = num1227; - } - else - { - npc.localAI[1] -= 0.07f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= (revenge ? 235f : 315f)) - npc.ai[0] = -1f; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return false; - } - - public override void NPCLoot() - { - DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, mod.ItemType("ProvidenceTrophy"), 10); + { + // Firing holy ray or not + bool firingLaser = npc.ai[0] == 7f; + + // Change X direction of movement + if (flightPath == 0) + { + npc.TargetClosest(true); + if (vector.X < player.Center.X) + { + flightPath = 1; + calamityGlobalNPC.newAI[0] = 0f; + } + else + { + flightPath = -1; + calamityGlobalNPC.newAI[0] = 0f; + } + } + + // Get a target + npc.TargetClosest(true); + + // Increase speed over time if flying in same direction for too long + if (revenge) + calamityGlobalNPC.newAI[0] += 1f; + + // Distance needed from target to change direction + float num851 = 800f; + + // Increase distance from target when firing molten blasts or holy bombs + bool stayAwayFromTarget = npc.ai[0] == 3f || npc.ai[0] == 4f; + if (stayAwayFromTarget) + num851 += (revenge ? 200f : 100f); + + // Change X movement path if far enough away from target + float num852 = Math.Abs(vector.X - player.Center.X); + if (vector.X < player.Center.X && flightPath < 0 && num852 > num851) + flightPath = 0; + if (vector.X > player.Center.X && flightPath > 0 && num852 > num851) + flightPath = 0; + + // Velocity and acceleration + bool increaseSpeed = calamityGlobalNPC.newAI[0] > 150f; + float acceleration = (expertMode ? 1.1f : 1.05f) + (0.2f * (1f - lifeRatio)); + float velocity = (expertMode ? 16f : 15f) + (4f * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) + { + acceleration = 1.3f; + velocity = 20f; + } + if (firingLaser) + { + acceleration *= normalAttackRate ? 0.4f : 0.2f; + velocity *= normalAttackRate ? 0.4f : 0.2f; + } + else if (increaseSpeed) + { + velocity += (calamityGlobalNPC.newAI[0] - 150f) * 0.04f; + if (velocity > 30f) + velocity = 30f; + } + + npc.velocity.X = npc.velocity.X + (float)flightPath * acceleration; + if (npc.velocity.X > velocity) + npc.velocity.X = velocity; + if (npc.velocity.X < -velocity) + npc.velocity.X = -velocity; + + float num855 = player.position.Y - (npc.position.Y + (float)npc.height); + if (num855 < (firingLaser ? 150f : 200f)) // 150 + npc.velocity.Y = npc.velocity.Y - 0.2f; + if (num855 > (firingLaser ? 200f : 250f)) // 200 + npc.velocity.Y = npc.velocity.Y + 0.2f; + + float speedVariance = normalAttackRate ? 2f : 1f; + if (npc.velocity.Y > (firingLaser ? speedVariance : 6f)) + npc.velocity.Y = firingLaser ? speedVariance : 6f; + if (npc.velocity.Y < (firingLaser ? -speedVariance : -6f)) + npc.velocity.Y = firingLaser ? -speedVariance : -6f; + } + + // Phase switch + if (npc.ai[0] == -1f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + phaseChange++; + if (phaseChange > 14) + phaseChange = 0; + + int phase = 0; // 0 = blasts 1 = holy fire 2 = shell heal 3 = molten blobs 4 = holy bombs 5 = shell spears 6 = crystal 7 = laser + + // Holy ray in hallow, Crystal in hell + bool useLaser = (phase2 && biomeType == 1) || CalamityWorld.bossRushActive; + bool useCrystal = (phase2 && biomeType == 2) || CalamityWorld.bossRushActive; + + // Unique pattern for Death Mode and Boss Rush + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + switch (phaseChange) + { + case 0: + phase = 4; + break; // 1575 or 1500 + case 1: + phase = 5; + break; // 1875 or 1800 + case 2: + phase = 0; + break; // 2175 or 2100 + case 3: + phase = useCrystal ? 6 : 1; + break; + case 4: + phase = 2; + break; // 600 + case 5: + phase = 4; + break; // 900 + case 6: + phase = 1; + break; // 1200 + case 7: + phase = 5; + break; // 1500 + case 8: + phase = useLaser ? 7 : 3; // 1875 or 1800 + if (useLaser) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + num1219 = 1f; + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + num1219 = 1f; + + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 9: + phase = 3; + break; // 2175 or 2100 + case 10: + phase = useCrystal ? 6 : 2; + break; + case 11: + phase = 4; + break; // 300 + case 12: + phase = useLaser ? 7 : 4; // 675 or 600 + if (useLaser) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + num1219 = 1f; + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + num1219 = 1f; + + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 13: + phase = 5; + break; // 975 or 900 + case 14: + phase = 0; + break; // 1275 or 1200 + default: + break; + } + } + else + { + switch (phaseChange) + { + case 0: + phase = 0; + break; // 3375 or 3300 + case 1: + phase = useLaser ? 7 : 1; // 3750 or 3600 + if (useLaser) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + num1219 = 1f; + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + num1219 = 1f; + + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 2: + phase = 3; + break; // 4050 or 3900 + case 3: + phase = 4; + break; // 4350 or 4200 + case 4: + phase = 5; + break; // 4650 or 4500 + case 5: + phase = useCrystal ? 6 : 4; + break; + case 6: + phase = 3; + break; // 300 + case 7: + phase = 1; + break; // 600 + case 8: + phase = 0; + break; // 900 + case 9: + phase = 2; + break; // 1500 + case 10: + phase = 4; + break; // 1800 + case 11: + phase = useLaser ? 7 : 0; //2175 or 2100 + if (useLaser) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + num1219 = 1f; + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + num1219 = 1f; + + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 12: + phase = 3; + break; // 2475 or 2400 + case 13: + phase = 1; + break; // 2775 or 2700 + case 14: + phase = 5; + break; // 3075 or 3000 + default: + break; + } + } + + // Pick a target + npc.TargetClosest(true); + + // If too far from target, set phase to 0 + if (Math.Abs(vector.X - player.Center.X) > 5600f) + phase = 0; + + // Reset arrays + npc.ai[0] = (float)phase; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + // Holy blasts + else if (npc.ai[0] == 0f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + float num852 = Math.Abs(vector.X - player.Center.X); + if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) + { + npc.ai[3] += 1f; + + int num856 = (expertMode ? 24 : 26) - (int)(4f * (1f - lifeRatio)); + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num856 = 19; + + num856 = (int)((double)num856 * attackRateMult); + + if (npc.ai[3] >= (float)num856) + npc.ai[3] = (float)(-(float)num856); + + if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + vector.X += npc.velocity.X * 7f; + float num857 = player.position.X + (float)player.width * 0.5f - vector.X; + float num858 = player.Center.Y - vector.Y; + float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + + float num860 = (expertMode ? 10.25f : 9f) + (2.5f * (1f - lifeRatio)); + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num860 = 12.75f; + + if (revenge) + num860 *= 1.15f; + + num859 = num860 / num859; + num857 *= num859; + num858 *= num859; + + int holyDamage = expertMode ? 52 : 65; + Projectile.NewProjectile(vector.X, vector.Y, num857, num858, mod.ProjectileType("HolyBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (npc.ai[3] < 0f) + npc.ai[3] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 300f) + npc.ai[0] = -1f; + } + } + + // Holy fire + else if (npc.ai[0] == 1f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[3] += 1f; + + int num864 = (expertMode ? 36 : 39) - (int)(8f * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) + num864 = 29; + + num864 = (int)((double)num864 * attackRateMult); + + if (npc.ai[3] >= (float)num864) + { + npc.ai[3] = 0f; + + Vector2 vector113 = new Vector2(vector.X, npc.position.Y + (float)npc.height - 14f); + + float num865 = npc.velocity.Y; + if (num865 < 0f) + num865 = 0f; + + num865 += expertMode ? 4f : 3f; + + int fireDamage = expertMode ? 48 : 60; + Projectile.NewProjectile(vector113.X, vector113.Y, npc.velocity.X * 0.25f, num865, mod.ProjectileType("HolyFire"), fireDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 300f) + npc.ai[0] = -1f; + } + } + + // Cocoon flames + else if (npc.ai[0] == 2f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + npc.TargetClosest(true); + + Vector2 vector114 = new Vector2(vector.X, vector.Y + 20f); + float num866 = (float)Main.rand.Next(-1000, 1001); + float num867 = (float)Main.rand.Next(-1000, 1001); + float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); + float num869 = 3f; + + npc.velocity *= 0.95f; + + num868 = num869 / num868; + num866 *= num868; + num867 *= num868; + vector114.X += num866 * 32f; + vector114.Y += num867 * 32f; + + npc.ai[3] += 1f; + + int num870 = (expertMode ? 3 : 4) - (int)(4f * (1f - lifeRatio)); + num870 = (int)((double)num870 * attackRateMult); + + if (CalamityWorld.bossRushActive) + num870 /= 2; + + if (npc.ai[3] >= (float)num870) + { + npc.ai[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Main.rand.NextBool(4) && !CalamityWorld.death && !CalamityWorld.bossRushActive) + Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyLight"), 0, 0f, Main.myPlayer, 0f, 0f); + else + Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyBurnOrb"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + + // Air is burning text + npc.ai[1] += 1f; + if (npc.ai[1] >= 450f && !text) + { + text = true; + string key = "Mods.CalamityMod.ProfanedBossText"; + Color messageColor = Color.Orange; + + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + + // Inflict Icarus Folly + if (npc.ai[1] >= 600f) + { + if (Main.netMode != NetmodeID.Server) + { + Player player2 = Main.player[Main.myPlayer]; + bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; + + if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f && !inLiquid) + { + Main.PlaySound(SoundID.Item20, player2.position); + player2.AddBuff(mod.BuffType("ExtremeGravity"), 3000, true); + + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + text = false; + npc.ai[0] = -1f; + } + } + + // Molten blasts + else if (npc.ai[0] == 3f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + float num852 = Math.Abs(vector.X - player.Center.X); + if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) + { + npc.ai[3] += 1f; + + int num856 = (expertMode ? 16 : 18) - (int)(3f * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) + num856 = 14; + + num856 = (int)((double)num856 * attackRateMult); + + if (npc.ai[3] >= (float)num856) + npc.ai[3] = (float)(-(float)num856); + + if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + vector.X += npc.velocity.X * 7f; + float num857 = player.position.X + (float)player.width * 0.5f - vector.X; + float num858 = player.Center.Y - vector.Y; + float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + + float num860 = (expertMode ? 10.25f : 9f) + (2.5f * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) + num860 = 12.75f; + + if (revenge) + num860 *= 1.15f; + + num859 = num860 / num859; + num857 *= num859; + num858 *= num859; + + int holyDamage = expertMode ? 42 : 55; + Projectile.NewProjectile(vector.X, vector.Y, num857 * 0.1f, num858, mod.ProjectileType("MoltenBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (npc.ai[3] < 0f) + npc.ai[3] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 300f) + npc.ai[0] = -1f; + } + } + + // Holy bombs + else if (npc.ai[0] == 4f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[3] += 1f; + + int num864 = (expertMode ? 73 : 77) - (int)(15f * (1f - lifeRatio)); + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num864 = 59; + + num864 = (int)((double)num864 * attackRateMult); + + if (npc.ai[3] >= (float)num864) + { + npc.ai[3] = 0f; + + Vector2 vector113 = new Vector2(vector.X, npc.position.Y + (float)npc.height - 14f); + + float num865 = npc.velocity.Y; + if (num865 < 0f) + num865 = 0f; + + num865 += expertMode ? 4f : 3f; + + int fireDamage = expertMode ? 48 : 60; + Projectile.NewProjectile(vector113.X, vector113.Y, npc.velocity.X * 0.25f, num865, mod.ProjectileType("HolyBomb"), fireDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 300f) + npc.ai[0] = -1f; + } + } + + // Cocoon spears + else if (npc.ai[0] == 5f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + npc.TargetClosest(true); + + npc.velocity *= 0.95f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[2] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f) + (2f * (1f - lifeRatio)); + + if (CalamityWorld.bossRushActive) + npc.ai[2] += 1f; + + double count = 24D * attackRateMult; + if (npc.ai[2] >= (float)count) + { + npc.ai[2] = 0f; + + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = expertMode ? 12f : 10f; + float num743 = player.position.X + (float)player.width * 0.5f - vector93.X; + float num744 = player.position.Y + (float)player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + + int num746 = expertMode ? 52 : 65; + int num747 = mod.ProjectileType("HolyShot"); + Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + (float)Main.rand.Next(-100, 100), 0f, 0f, mod.ProjectileType("HolySpear"), num746, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 300f) + npc.ai[0] = -1f; + } + } + + // Crystal + else if (npc.ai[0] == 6f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + npc.TargetClosest(true); + + npc.velocity *= 0.95f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) + { + int damage = expertMode ? 57 : 70; + Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, mod.ProjectileType("ProvidenceCrystal"), damage, 0f, player.whoAmI, 0f, 0f); + npc.ai[0] = -1f; + } + } + } + + // Holy ray + else if (npc.ai[0] == 7f) + { + npc.noGravity = true; + npc.noTileCollide = true; + + Vector2 value19 = new Vector2(27f, 59f); + + float rotation = 450f + (float)(guardianAmt * 18); + + npc.ai[2] += 1f; + if (npc.ai[2] < 120f) + { + npc.localAI[1] -= 0.07f; + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + + if (npc.ai[2] >= 40f) + { + int num1220 = 0; + if (npc.ai[2] >= 80f) + num1220 = 1; + + for (int num1221 = 0; num1221 < 1 + num1220; num1221++) + { + int num1222 = 244; + float num1223 = 1.2f; + if (num1221 % 2 == 1) + num1223 = 2.8f; + + Vector2 vector199 = vector + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; + int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + Main.dust[num1224].velocity = Vector2.Normalize(vector - vector199) * 3.5f * (10f - (float)num1220 * 2f) / 10f; + Main.dust[num1224].noGravity = true; + Main.dust[num1224].scale = num1223; + } + } + } + else if (npc.ai[2] < (revenge ? 220f : 300f)) + { + if (npc.ai[2] == 120f) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 2800f) + Main.PlaySound(29, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 104, 1f, 0f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(false); + + Vector2 vector200 = player.Center - vector; + vector200.Normalize(); + + float num1225 = -1f; + if (vector200.X < 0f) + num1225 = 1f; + + vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default); + Projectile.NewProjectile(vector.X, vector.Y - 32f, vector200.X, vector200.Y, mod.ProjectileType("ProvidenceHolyRay"), 100, 0f, Main.myPlayer, num1225 * 6.28318548f / rotation, (float)npc.whoAmI); + + if (revenge) + Projectile.NewProjectile(vector.X, vector.Y - 32f, -vector200.X, -vector200.Y, mod.ProjectileType("ProvidenceHolyRay"), 100, 0f, Main.myPlayer, -num1225 * 6.28318548f / rotation, (float)npc.whoAmI); + + npc.ai[3] = (vector200.ToRotation() + 9.424778f) * num1225; + npc.netUpdate = true; + } + } + + npc.localAI[1] += 0.05f; + if (npc.localAI[1] > 1f) + npc.localAI[1] = 1f; + + float num1226 = (float)(npc.ai[3] >= 0f).ToDirectionInt(); + float num1227 = npc.ai[3]; + if (num1227 < 0f) + num1227 *= -1f; + num1227 += -9.424778f; + num1227 += num1226 * 6.28318548f / rotation; + + npc.localAI[0] = num1227; + } + else + { + npc.localAI[1] -= 0.07f; + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= (revenge ? 235f : 315f)) + npc.ai[0] = -1f; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return false; + } + + public override void NPCLoot() + { + DropHelper.DropBags(npc); + DropHelper.DropItemChance(npc, mod.ItemType("ProvidenceTrophy"), 10); DropHelper.DropItemCondition(npc, mod.ItemType("KnowledgeProvidence"), true, !CalamityWorld.downedProvidence); DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedProvidence, 5, 2, 1); - DropHelper.DropItemCondition(npc, mod.ItemType("ElysianWings"), biomeType != 2); - DropHelper.DropItemCondition(npc, mod.ItemType("ElysianAegis"), biomeType == 2); + DropHelper.DropItemCondition(npc, mod.ItemType("ElysianWings"), biomeType != 2); + DropHelper.DropItemCondition(npc, mod.ItemType("ElysianAegis"), biomeType == 2); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Materials DropHelper.DropItemSpray(npc, mod.ItemType("UnholyEssence"), 20, 30); DropHelper.DropItemSpray(npc, mod.ItemType("DivineGeode"), 10, 15); @@ -1039,12 +1093,12 @@ namespace CalamityMod.NPCs.Providence // Other DropHelper.DropItem(npc, mod.ItemType("RuneofCos")); - } + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - SpawnLootBox(); - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + SpawnLootBox(); + } // If Providence has not been killed, notify players of Uelibloom Ore if (!CalamityWorld.downedProvidence) @@ -1073,165 +1127,165 @@ namespace CalamityMod.NPCs.Providence CalamityMod.UpdateServerBoolean(); } - private void SpawnLootBox() - { - int tileCenterX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int tileCenterY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - int halfBox = npc.width / 2 / 16 + 1; - for (int x = tileCenterX - halfBox; x <= tileCenterX + halfBox; x++) - { - for (int y = tileCenterY - halfBox; y <= tileCenterY + halfBox; y++) - { - if ((x == tileCenterX - halfBox || x == tileCenterX + halfBox || y == tileCenterY - halfBox || y == tileCenterY + halfBox) + private void SpawnLootBox() + { + int tileCenterX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int tileCenterY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int halfBox = npc.width / 2 / 16 + 1; + for (int x = tileCenterX - halfBox; x <= tileCenterX + halfBox; x++) + { + for (int y = tileCenterY - halfBox; y <= tileCenterY + halfBox; y++) + { + if ((x == tileCenterX - halfBox || x == tileCenterX + halfBox || y == tileCenterY - halfBox || y == tileCenterY + halfBox) && !Main.tile[x, y].active()) - { - Main.tile[x, y].type = (ushort)mod.TileType("ProfanedRock"); - Main.tile[x, y].active(true); - } - Main.tile[x, y].lava(false); - Main.tile[x, y].liquid = 0; + { + Main.tile[x, y].type = (ushort)mod.TileType("ProfanedRock"); + Main.tile[x, y].active(true); + } + Main.tile[x, y].lava(false); + Main.tile[x, y].liquid = 0; - if (Main.netMode == NetmodeID.Server) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - else - WorldGen.SquareTileFrame(x, y, true); - } - } - } + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + else + WorldGen.SquareTileFrame(x, y, true); + } + } + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; - if (npc.ai[0] == 2f || npc.ai[0] == 5f) - { - if (!useDefenseFrames) - texture = mod.GetTexture("NPCs/Providence/ProvidenceDefense"); - else - texture = mod.GetTexture("NPCs/Providence/ProvidenceDefenseAlt"); - } - else - { - if (frameUsed == 0) - texture = Main.npcTexture[npc.type]; - else if (frameUsed == 1) - texture = mod.GetTexture("NPCs/Providence/ProvidenceAlt"); - else if (frameUsed == 2) - texture = mod.GetTexture("NPCs/Providence/ProvidenceAttack"); - else - texture = mod.GetTexture("NPCs/Providence/ProvidenceAttackAlt"); - } + if (npc.ai[0] == 2f || npc.ai[0] == 5f) + { + if (!useDefenseFrames) + texture = mod.GetTexture("NPCs/Providence/ProvidenceDefense"); + else + texture = mod.GetTexture("NPCs/Providence/ProvidenceDefenseAlt"); + } + else + { + if (frameUsed == 0) + texture = Main.npcTexture[npc.type]; + else if (frameUsed == 1) + texture = mod.GetTexture("NPCs/Providence/ProvidenceAlt"); + else if (frameUsed == 2) + texture = mod.GetTexture("NPCs/Providence/ProvidenceAttack"); + else + texture = mod.GetTexture("NPCs/Providence/ProvidenceAttackAlt"); + } - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - return false; - } + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + return false; + } - public override void FindFrame(int frameHeight) //9 total frames - { - if (npc.ai[0] == 2f || npc.ai[0] == 5f) - { - if (!useDefenseFrames) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 5.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - useDefenseFrames = true; - } - } - else - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 5.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 2) - npc.frame.Y = frameHeight * 2; - } - } - else - { - if (useDefenseFrames) - useDefenseFrames = false; + public override void FindFrame(int frameHeight) //9 total frames + { + if (npc.ai[0] == 2f || npc.ai[0] == 5f) + { + if (!useDefenseFrames) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 5.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + useDefenseFrames = true; + } + } + else + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 5.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 2) + npc.frame.Y = frameHeight * 2; + } + } + else + { + if (useDefenseFrames) + useDefenseFrames = false; - npc.frameCounter += 1.0; - if (npc.frameCounter > 5.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 3) //6 - { - npc.frame.Y = 0; - frameUsed++; - } - if (frameUsed > 3) - frameUsed = 0; - } - } + npc.frameCounter += 1.0; + if (npc.frameCounter > 5.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 3) //6 + { + npc.frame.Y = 0; + frameUsed++; + } + if (frameUsed > 3) + frameUsed = 0; + } + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 2f; - return null; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 15; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 15; k++) + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-50, 50) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 400; - npc.height = 350; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 60; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 90; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-50, 50) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 400; + npc.height = 350; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 60; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 90; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/Scavenger/FlamePillar.cs b/NPCs/Scavenger/FlamePillar.cs index 7c33f02324..bdc5792d1c 100644 --- a/NPCs/Scavenger/FlamePillar.cs +++ b/NPCs/Scavenger/FlamePillar.cs @@ -1,38 +1,38 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class FlamePillar : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame Pillar"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame Pillar"); Main.npcFrameCount[npc.type] = 4; } - public override void SetDefaults() - { - npc.damage = 0; - npc.width = 40; - npc.height = 150; - npc.lifeMax = 100; + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 40; + npc.height = 150; + npc.lifeMax = 100; npc.alpha = 255; - npc.aiStyle = -1; + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } public override void FindFrame(int frameHeight) { @@ -90,11 +90,11 @@ namespace CalamityMod.NPCs.Scavenger npc.localAI[0] += 1f; float SpeedX = (float)Main.rand.Next(-6, 7); float SpeedY = (float)Main.rand.Next(-12, -8); - if (CalamityWorld.bossRushActive) - { - SpeedX *= 1.5f; - SpeedY *= 1.5f; - } + if (CalamityWorld.bossRushActive) + { + SpeedX *= 1.5f; + SpeedY *= 1.5f; + } if (npc.localAI[0] >= 60f) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -132,35 +132,35 @@ namespace CalamityMod.NPCs.Scavenger } } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 180; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 135, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 180; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/Scavenger/RockPillar.cs b/NPCs/Scavenger/RockPillar.cs index 10c5bf8bf0..104b9c168e 100644 --- a/NPCs/Scavenger/RockPillar.cs +++ b/NPCs/Scavenger/RockPillar.cs @@ -1,39 +1,39 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class RockPillar : ModNPC - { + { int tileCollideCounter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock Pillar"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock Pillar"); + } - public override void SetDefaults() - { - npc.damage = 0; - npc.width = 60; - npc.height = 300; - npc.lifeMax = 100; + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 60; + npc.height = 300; + npc.lifeMax = 100; npc.alpha = 255; - npc.aiStyle = -1; + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } public override void AI() { @@ -166,35 +166,35 @@ namespace CalamityMod.NPCs.Scavenger } } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 80; - npc.height = 360; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 80; + npc.height = 360; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs index 7e635ec640..3a63dff404 100644 --- a/NPCs/Scavenger/ScavengerBody.cs +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -1,593 +1,593 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.Scavenger { [AutoloadBossHead] - public class ScavengerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - Main.npcFrameCount[npc.type] = 7; - } + public class ScavengerBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + Main.npcFrameCount[npc.type] = 7; + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.npcSlots = 20f; - npc.aiStyle = -1; - npc.damage = 120; - npc.width = 332; - npc.height = 214; - npc.defense = 55; + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.npcSlots = 20f; + npc.aiStyle = -1; + npc.damage = 120; + npc.width = 332; + npc.height = 214; + npc.defense = 55; npc.Calamity().RevPlusDR(0.4f); npc.lifeMax = CalamityWorld.revenge ? 53500 : 42700; - if (CalamityWorld.death) - { - npc.lifeMax = 90000; - } - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.boss = true; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); - else - music = MusicID.Boss4; - bossBag = mod.ItemType("RavagerBag"); - if (CalamityWorld.downedProvidence) - { - npc.defense = 180; - npc.lifeMax = 350000; - npc.value = Item.buyPrice(0, 35, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 2100000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + if (CalamityWorld.death) + { + npc.lifeMax = 90000; + } + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.boss = true; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); + else + music = MusicID.Boss4; + bossBag = mod.ItemType("RavagerBag"); + if (CalamityWorld.downedProvidence) + { + npc.defense = 180; + npc.lifeMax = 350000; + npc.value = Item.buyPrice(0, 35, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2300000 : 2100000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Large fire light - Lighting.AddLight((int)(npc.Center.X - 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); - Lighting.AddLight((int)(npc.Center.X + 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); + // Large fire light + Lighting.AddLight((int)(npc.Center.X - 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); + Lighting.AddLight((int)(npc.Center.X + 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); - // Small fire light - Lighting.AddLight((int)(npc.Center.X - 40f) / 16, (int)(npc.Center.Y - 60f) / 16, 0f, 0.25f, 1f); - Lighting.AddLight((int)(npc.Center.X + 40f) / 16, (int)(npc.Center.Y - 60f) / 16, 0f, 0.25f, 1f); + // Small fire light + Lighting.AddLight((int)(npc.Center.X - 40f) / 16, (int)(npc.Center.Y - 60f) / 16, 0f, 0.25f, 1f); + Lighting.AddLight((int)(npc.Center.X + 40f) / 16, (int)(npc.Center.Y - 60f) / 16, 0f, 0.25f, 1f); - CalamityGlobalNPC.scavenger = npc.whoAmI; + CalamityGlobalNPC.scavenger = npc.whoAmI; - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - NPC.NewNPC((int)npc.Center.X - 70, (int)npc.Center.Y + 88, mod.NPCType("ScavengerLegLeft"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 70, (int)npc.Center.Y + 88, mod.NPCType("ScavengerLegRight"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X - 120, (int)npc.Center.Y + 50, mod.NPCType("ScavengerClawLeft"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 120, (int)npc.Center.Y + 50, mod.NPCType("ScavengerClawRight"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 1, (int)npc.Center.Y - 20, mod.NPCType("ScavengerHead"), 0, 0f, 0f, 0f, 0f, 255); - } + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 1f; + NPC.NewNPC((int)npc.Center.X - 70, (int)npc.Center.Y + 88, mod.NPCType("ScavengerLegLeft"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + 70, (int)npc.Center.Y + 88, mod.NPCType("ScavengerLegRight"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X - 120, (int)npc.Center.Y + 50, mod.NPCType("ScavengerClawLeft"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + 120, (int)npc.Center.Y + 50, mod.NPCType("ScavengerClawRight"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + 1, (int)npc.Center.Y - 20, mod.NPCType("ScavengerHead"), 0, 0f, 0f, 0f, 0f, 255); + } - if (npc.target >= 0 && Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - npc.noTileCollide = true; - } + if (npc.target >= 0 && Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + npc.noTileCollide = true; + } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; - npc.ai[1] = 0f; - } + npc.ai[1] = 0f; + } - bool leftLegActive = false; - bool rightLegActive = false; - bool headActive = false; - bool rightClawActive = false; - bool leftClawActive = false; + bool leftLegActive = false; + bool rightLegActive = false; + bool headActive = false; + bool rightClawActive = false; + bool leftClawActive = false; - for (int num619 = 0; num619 < 200; num619++) - { - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerHead")) - headActive = true; - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawRight")) - rightClawActive = true; - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawLeft")) - leftClawActive = true; - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegRight")) - rightLegActive = true; - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegLeft")) - leftLegActive = true; - } + for (int num619 = 0; num619 < 200; num619++) + { + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerHead")) + headActive = true; + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawRight")) + rightClawActive = true; + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawLeft")) + leftClawActive = true; + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegRight")) + rightLegActive = true; + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegLeft")) + leftLegActive = true; + } - bool enrage = false; - if (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) > npc.position.Y + (float)(npc.height / 2) + 10f) - enrage = true; + bool enrage = false; + if (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) > npc.position.Y + (float)(npc.height / 2) + 10f) + enrage = true; - if (headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive) - npc.dontTakeDamage = true; - else - { - npc.dontTakeDamage = false; - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - Main.player[Main.myPlayer].AddBuff(mod.BuffType("WeakPetrification"), 2); - } - } + if (headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive) + npc.dontTakeDamage = true; + else + { + npc.dontTakeDamage = false; + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + Main.player[Main.myPlayer].AddBuff(mod.BuffType("WeakPetrification"), 2); + } + } - if (!headActive) - { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 5, 0f, 0f, 100, default, 2.5f); - Main.dust[rightDust].alpha += Main.rand.Next(100); - Main.dust[rightDust].velocity *= 0.2f; + if (!headActive) + { + int rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 5, 0f, 0f, 100, default, 2.5f); + Main.dust[rightDust].alpha += Main.rand.Next(100); + Main.dust[rightDust].velocity *= 0.2f; - Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.Y -= (3f + (float)Main.rand.Next(10) * 0.1f); - Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr = Main.dust[rightDust]; + rightDustExpr.velocity.Y -= (3f + (float)Main.rand.Next(10) * 0.1f); + Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); - if (Main.rand.Next(20) != 0) - { - Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.Y -= 4f; - } - } + if (Main.rand.NextBool(10)) + { + rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); + if (Main.rand.Next(20) != 0) + { + Main.dust[rightDust].noGravity = true; + Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr2 = Main.dust[rightDust]; + rightDustExpr2.velocity.Y -= 4f; + } + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += (enrage ? 6f : 1f); - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int laserDamage = 45; - float velocity = CalamityWorld.bossRushActive ? 10f : 7f; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += (enrage ? 6f : 1f); + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int laserDamage = 45; + float velocity = CalamityWorld.bossRushActive ? 10f : 7f; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } - if (!rightClawActive) - { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default, 3f); - Main.dust[rightDust].alpha += Main.rand.Next(100); - Main.dust[rightDust].velocity *= 0.2f; + if (!rightClawActive) + { + int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default, 3f); + Main.dust[rightDust].alpha += Main.rand.Next(100); + Main.dust[rightDust].velocity *= 0.2f; - Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.X += (3f + (float)Main.rand.Next(10) * 0.1f); - Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr = Main.dust[rightDust]; + rightDustExpr.velocity.X += (3f + (float)Main.rand.Next(10) * 0.1f); + Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 6, 0f, 0f, 0, default, 2f); - if (Main.rand.Next(20) != 0) - { - Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.X += 4f; - } - } + if (Main.rand.NextBool(10)) + { + rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 6, 0f, 0f, 0, default, 2f); + if (Main.rand.Next(20) != 0) + { + Main.dust[rightDust].noGravity = true; + Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr2 = Main.dust[rightDust]; + rightDustExpr2.velocity.X += 4f; + } + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[2] += (enrage ? 2f : 1f); - if (npc.localAI[2] >= 480f) - { - Main.PlaySound(SoundID.Item20, npc.position); - npc.localAI[2] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f); - int damage = 40; - float velocity = CalamityWorld.bossRushActive ? 18f : 12f; - int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, velocity, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[2] += (enrage ? 2f : 1f); + if (npc.localAI[2] >= 480f) + { + Main.PlaySound(SoundID.Item20, npc.position); + npc.localAI[2] = 0f; + Vector2 shootFromVector = new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f); + int damage = 40; + float velocity = CalamityWorld.bossRushActive ? 18f : 12f; + int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, velocity, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } - if (!leftClawActive) - { - int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default, 3f); - Main.dust[leftDust].alpha += Main.rand.Next(100); - Main.dust[leftDust].velocity *= 0.2f; + if (!leftClawActive) + { + int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default, 3f); + Main.dust[leftDust].alpha += Main.rand.Next(100); + Main.dust[leftDust].velocity *= 0.2f; - Dust leftDustExpr = Main.dust[leftDust]; - leftDustExpr.velocity.X -= (3f + (float)Main.rand.Next(10) * 0.1f); - Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + Dust leftDustExpr = Main.dust[leftDust]; + leftDustExpr.velocity.X -= (3f + (float)Main.rand.Next(10) * 0.1f); + Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, 6, 0f, 0f, 0, default, 2f); - if (Main.rand.Next(20) != 0) - { - Main.dust[leftDust].noGravity = true; - Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust leftDustExpr2 = Main.dust[leftDust]; - leftDustExpr2.velocity.X -= 4f; - } - } + if (Main.rand.NextBool(10)) + { + leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, 6, 0f, 0f, 0, default, 2f); + if (Main.rand.Next(20) != 0) + { + Main.dust[leftDust].noGravity = true; + Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust leftDustExpr2 = Main.dust[leftDust]; + leftDustExpr2.velocity.X -= 4f; + } + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[3] += (enrage ? 2f : 1f); - if (npc.localAI[3] >= 480f) - { - Main.PlaySound(SoundID.Item20, npc.position); - npc.localAI[3] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f); - int damage = 40; - float velocity = CalamityWorld.bossRushActive ? -18f : -12f; - int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, velocity, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[3] += (enrage ? 2f : 1f); + if (npc.localAI[3] >= 480f) + { + Main.PlaySound(SoundID.Item20, npc.position); + npc.localAI[3] = 0f; + Vector2 shootFromVector = new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f); + int damage = 40; + float velocity = CalamityWorld.bossRushActive ? -18f : -12f; + int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, velocity, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } - if (!rightLegActive) - { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default, 2f); - Main.dust[rightDust].alpha += Main.rand.Next(100); - Main.dust[rightDust].velocity *= 0.2f; + if (!rightLegActive) + { + int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default, 2f); + Main.dust[rightDust].alpha += Main.rand.Next(100); + Main.dust[rightDust].velocity *= 0.2f; - Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.Y += (0.5f + (float)Main.rand.Next(10) * 0.1f); - Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr = Main.dust[rightDust]; + rightDustExpr.velocity.Y += (0.5f + (float)Main.rand.Next(10) * 0.1f); + Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); - if (Main.rand.Next(20) != 0) - { - Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.Y += 1f; - } - } + if (Main.rand.NextBool(10)) + { + rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); + if (Main.rand.Next(20) != 0) + { + Main.dust[rightDust].noGravity = true; + Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr2 = Main.dust[rightDust]; + rightDustExpr2.velocity.Y += 1f; + } + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[2] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f); - int damage = 35; - int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[fire].timeLeft = 180; - } - } - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[2] = 0f; + Vector2 shootFromVector = new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f); + int damage = 35; + int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[fire].timeLeft = 180; + } + } + } - if (!leftLegActive) - { - int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default, 2f); - Main.dust[leftDust].alpha += Main.rand.Next(100); - Main.dust[leftDust].velocity *= 0.2f; + if (!leftLegActive) + { + int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default, 2f); + Main.dust[leftDust].alpha += Main.rand.Next(100); + Main.dust[leftDust].velocity *= 0.2f; - Dust leftDustExpr = Main.dust[leftDust]; - leftDustExpr.velocity.Y += (0.5f + (float)Main.rand.Next(10) * 0.1f); - Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + Dust leftDustExpr = Main.dust[leftDust]; + leftDustExpr.velocity.Y += (0.5f + (float)Main.rand.Next(10) * 0.1f); + Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); - if (Main.rand.Next(20) != 0) - { - Main.dust[leftDust].noGravity = true; - Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust leftDustExpr2 = Main.dust[leftDust]; - leftDustExpr2.velocity.Y += 1f; - } - } + if (Main.rand.NextBool(10)) + { + leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); + if (Main.rand.Next(20) != 0) + { + Main.dust[leftDust].noGravity = true; + Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust leftDustExpr2 = Main.dust[leftDust]; + leftDustExpr2.velocity.Y += 1f; + } + } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 300f) - { - npc.ai[3] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f); - int damage = 35; - int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[fire].timeLeft = 180; - } - } - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 300f) + { + npc.ai[3] = 0f; + Vector2 shootFromVector = new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f); + int damage = 35; + int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[fire].timeLeft = 180; + } + } + } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = false; + if (npc.ai[0] == 0f) + { + npc.noTileCollide = false; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.8f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 0f) - { - if ((!rightClawActive && !leftClawActive) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - npc.ai[1] += 1f; - if (!headActive || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - npc.ai[1] += 1f; - if ((!rightLegActive && !leftLegActive) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - npc.ai[1] += 1f; - } + npc.ai[1] += 1f; + if (npc.ai[1] > 0f) + { + if ((!rightClawActive && !leftClawActive) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + npc.ai[1] += 1f; + if (!headActive || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + npc.ai[1] += 1f; + if ((!rightLegActive && !leftLegActive) || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + npc.ai[1] += 1f; + } - if (npc.ai[1] >= 300f) - npc.ai[1] = -20f; - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(true); + if (npc.ai[1] >= 300f) + npc.ai[1] = -20f; + else if (npc.ai[1] == -1f) + { + npc.TargetClosest(true); - float velocityX = ((enrage || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8f : 4f) + (4f * (1f - lifeRatio)); - npc.velocity.X = velocityX * (float)npc.direction; + float velocityX = ((enrage || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8f : 4f) + (4f * (1f - lifeRatio)); + npc.velocity.X = velocityX * (float)npc.direction; - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) - npc.velocity.Y = -15.2f; - else - npc.velocity.Y = 1f; + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) + npc.velocity.Y = -15.2f; + else + npc.velocity.Y = 1f; - npc.noTileCollide = true; - } - else - npc.velocity.Y = -15.2f; + npc.noTileCollide = true; + } + else + npc.velocity.Y = -15.2f; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - } - } - else if (npc.ai[0] == 1f) - { - if (npc.velocity.Y == 0f) - { - Main.PlaySound(SoundID.Item14, npc.position); + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + } + } + else if (npc.ai[0] == 1f) + { + if (npc.velocity.Y == 0f) + { + Main.PlaySound(SoundID.Item14, npc.position); - npc.ai[0] = 0f; + npc.ai[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (NPC.CountNPCS(mod.NPCType("RockPillar")) < 2) - { - NPC.NewNPC((int)npc.Center.X - 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.CountNPCS(mod.NPCType("RockPillar")) < 2) + { + NPC.NewNPC((int)npc.Center.X - 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); + } - if (NPC.CountNPCS(mod.NPCType("FlamePillar")) < 2) - { - NPC.NewNPC((int)Main.player[npc.target].Center.X - 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)Main.player[npc.target].Center.X + 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); - } - } + if (NPC.CountNPCS(mod.NPCType("FlamePillar")) < 2) + { + NPC.NewNPC((int)Main.player[npc.target].Center.X - 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)Main.player[npc.target].Center.X + 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); + } + } - for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) - { - for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) - { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 31, 0f, 0f, 100, default, 1.5f); - Main.dust[stompDust].velocity *= 0.2f; - } + for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) + { + for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) + { + int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 31, 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } - int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), npc.position.Y + (float)npc.height - 12f), default, Main.rand.Next(61, 64), 1f); - Main.gore[stompGore].velocity *= 0.4f; - } - } - else - { - npc.TargetClosest(true); + int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), npc.position.Y + (float)npc.height - 12f), default, Main.rand.Next(61, 64), 1f); + Main.gore[stompGore].velocity *= 0.4f; + } + } + else + { + npc.TargetClosest(true); - // Fall through - if (npc.target >= 0 && CalamityWorld.revenge && - ((Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f))) - npc.noTileCollide = true; - else if (!Main.player[npc.target].dead) - npc.noTileCollide = false; + // Fall through + if (npc.target >= 0 && CalamityWorld.revenge && + ((Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f))) + npc.noTileCollide = true; + else if (!Main.player[npc.target].dead) + npc.noTileCollide = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - { - npc.velocity.X = npc.velocity.X * 0.9f; + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + { + npc.velocity.X = npc.velocity.X * 0.9f; - if (Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height) - { - float fallSpeed = 0.6f + (0.6f * (1f - lifeRatio)); - npc.velocity.Y = npc.velocity.Y + fallSpeed; - } - } - else - { - if (npc.direction < 0) - npc.velocity.X = npc.velocity.X - 0.2f; - else if (npc.direction > 0) - npc.velocity.X = npc.velocity.X + 0.2f; + if (Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height) + { + float fallSpeed = 0.6f + (0.6f * (1f - lifeRatio)); + npc.velocity.Y = npc.velocity.Y + fallSpeed; + } + } + else + { + if (npc.direction < 0) + npc.velocity.X = npc.velocity.X - 0.2f; + else if (npc.direction > 0) + npc.velocity.X = npc.velocity.X + 0.2f; - float velocityX = 3f + (4f * (1f - lifeRatio)); - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - velocityX += 3f; - if (!rightClawActive) - velocityX += 1f; - if (!leftClawActive) - velocityX += 1f; - if (!headActive) - velocityX += 1f; - if (!rightLegActive) - velocityX += 1f; - if (!leftLegActive) - velocityX += 1f; + float velocityX = 3f + (4f * (1f - lifeRatio)); + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + velocityX += 3f; + if (!rightClawActive) + velocityX += 1f; + if (!leftClawActive) + velocityX += 1f; + if (!headActive) + velocityX += 1f; + if (!rightLegActive) + velocityX += 1f; + if (!leftLegActive) + velocityX += 1f; - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - } - } + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; + } + } + } - if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); + if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) + npc.TargetClosest(true); - int distanceFromTarget = 3000; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) - { - npc.TargetClosest(true); - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) - { - npc.active = false; - npc.netUpdate = true; - return; - } - } - } + int distanceFromTarget = 3000; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) + { + npc.TargetClosest(true); + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) + { + npc.active = false; + npc.netUpdate = true; + return; + } + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Width, (float)(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerLegRight"), new Vector2(center.X - Main.screenPosition.X + 28f, center.Y - Main.screenPosition.Y + 20f), //72 - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Height)), - color2, 0f, default, 1f, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft"), new Vector2(center.X - Main.screenPosition.X - 112f, center.Y - Main.screenPosition.Y + 20f), //72 - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Height)), - color2, 0f, default, 1f, SpriteEffects.None, 0f); - if (NPC.CountNPCS(mod.NPCType("ScavengerHead")) > 0) - { - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerHead"), new Vector2(center.X - Main.screenPosition.X - 70f, center.Y - Main.screenPosition.Y - 75f), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Width, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Height)), - color2, 0f, default, 1f, SpriteEffects.None, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Width, (float)(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerLegRight"), new Vector2(center.X - Main.screenPosition.X + 28f, center.Y - Main.screenPosition.Y + 20f), //72 + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Height)), + color2, 0f, default, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft"), new Vector2(center.X - Main.screenPosition.X - 112f, center.Y - Main.screenPosition.Y + 20f), //72 + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Height)), + color2, 0f, default, 1f, SpriteEffects.None, 0f); + if (NPC.CountNPCS(mod.NPCType("ScavengerHead")) > 0) + { + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerHead"), new Vector2(center.X - Main.screenPosition.X - 70f, center.Y - Main.screenPosition.Y - 75f), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Width, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Height)), + color2, 0f, default, 1f, SpriteEffects.None, 0f); + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody5"), 1f); - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody5"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, true); + } + } public override void BossLoot(ref string name, ref int potionType) { @@ -596,7 +596,7 @@ namespace CalamityMod.NPCs.Scavenger } public override void NPCLoot() - { + { DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, mod.ItemType("RavagerTrophy"), 10); @@ -638,5 +638,5 @@ namespace CalamityMod.NPCs.Scavenger CalamityWorld.downedScavenger = true; CalamityMod.UpdateServerBoolean(); } - } + } } diff --git a/NPCs/Scavenger/ScavengerClawLeft.cs b/NPCs/Scavenger/ScavengerClawLeft.cs index bc4338dd97..6306578b9b 100644 --- a/NPCs/Scavenger/ScavengerClawLeft.cs +++ b/NPCs/Scavenger/ScavengerClawLeft.cs @@ -1,329 +1,329 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class ScavengerClawLeft : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 80; - npc.width = 80; - npc.height = 40; - npc.defense = 40; + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 80; + npc.width = 80; + npc.height = 40; + npc.defense = 40; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 11120; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.damage = 200; - npc.defense = 120; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 300000 : 260000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = 11120; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.alpha = 255; + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.damage = 200; + npc.defense = 120; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 300000 : 260000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void AI() - { - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = true; - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 1f; - } - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 50f; - num660 -= 120f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - npc.ai[1] += 1f; - if (npc.life < npc.lifeMax / 2) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - npc.ai[1] += 10f; - } - if (npc.ai[1] >= 60f) - { - npc.TargetClosest(true); - if ((npc.Center.X + 100f > Main.player[npc.target].Center.X)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - return; - } - npc.ai[1] = 0f; - return; - } - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - } - } - else if (npc.ai[0] == 1f) - { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; - float num663 = 12f; - if (npc.life < npc.lifeMax / 2) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 3) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 5) - { - num663 += 10f; - } - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); - num666 = num663 / num666; - npc.velocity.X = num664 * num666; - npc.velocity.Y = num665 * num666; - npc.ai[0] = 2f; - npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); - } - else if (npc.ai[0] == 2f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) - { - npc.noTileCollide = false; - } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) - { - npc.noTileCollide = false; - } - } - else - { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) - { - npc.noTileCollide = false; - } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) - { - npc.noTileCollide = false; - } - } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; - num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; - num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; - num668 += 40f; - num667 -= 110f; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - float num671 = 12f; - float num672 = 0.4f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (npc.velocity.X < num673) - { - npc.velocity.X = npc.velocity.X + num672; - if (npc.velocity.X < 0f && num673 > 0f) - { - npc.velocity.X = npc.velocity.X + num672 * 2f; - } - } - else if (npc.velocity.X > num673) - { - npc.velocity.X = npc.velocity.X - num672; - if (npc.velocity.X > 0f && num673 < 0f) - { - npc.velocity.X = npc.velocity.X - num672 * 2f; - } - } - if (npc.velocity.Y < num674) - { - npc.velocity.Y = npc.velocity.Y + num672; - if (npc.velocity.Y < 0f && num674 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num672 * 2f; - } - } - else if (npc.velocity.Y > num674) - { - npc.velocity.Y = npc.velocity.Y - num672; - if (npc.velocity.Y > 0f && num674 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num672 * 2f; - } - } - npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); - } - } + public override void AI() + { + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (npc.ai[0] == 0f) + { + npc.noTileCollide = true; + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 1f; + } + Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 50f; + num660 -= 120f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 12f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + npc.ai[1] += 1f; + if (npc.life < npc.lifeMax / 2) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + npc.ai[1] += 10f; + } + if (npc.ai[1] >= 60f) + { + npc.TargetClosest(true); + if ((npc.Center.X + 100f > Main.player[npc.target].Center.X)) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + return; + } + npc.ai[1] = 0f; + return; + } + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + } + } + else if (npc.ai[0] == 1f) + { + npc.noTileCollide = true; + npc.collideX = false; + npc.collideY = false; + float num663 = 12f; + if (npc.life < npc.lifeMax / 2) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 3) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 5) + { + num663 += 10f; + } + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num664 = Main.player[npc.target].Center.X - vector80.X; + float num665 = Main.player[npc.target].Center.Y - vector80.Y; + float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + num666 = num663 / num666; + npc.velocity.X = num664 * num666; + npc.velocity.Y = num665 * num666; + npc.ai[0] = 2f; + npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); + } + else if (npc.ai[0] == 2f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + { + npc.noTileCollide = false; + } + if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + { + npc.noTileCollide = false; + } + } + else + { + if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + { + npc.noTileCollide = false; + } + if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + { + npc.noTileCollide = false; + } + } + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; + float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; + num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; + num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; + num668 += 40f; + num667 -= 110f; + float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); + if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + float num671 = 12f; + float num672 = 0.4f; + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); + float num673 = Main.player[npc.target].Center.X - vector82.X; + float num674 = Main.player[npc.target].Center.Y - vector82.Y; + float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); + num675 = num671 / num675; + num673 *= num675; + num674 *= num675; + if (npc.velocity.X < num673) + { + npc.velocity.X = npc.velocity.X + num672; + if (npc.velocity.X < 0f && num673 > 0f) + { + npc.velocity.X = npc.velocity.X + num672 * 2f; + } + } + else if (npc.velocity.X > num673) + { + npc.velocity.X = npc.velocity.X - num672; + if (npc.velocity.X > 0f && num673 < 0f) + { + npc.velocity.X = npc.velocity.X - num672 * 2f; + } + } + if (npc.velocity.Y < num674) + { + npc.velocity.Y = npc.velocity.Y + num672; + if (npc.velocity.Y < 0f && num674 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num672 * 2f; + } + } + else if (npc.velocity.Y > num674) + { + npc.velocity.Y = npc.velocity.Y - num672; + if (npc.velocity.Y > 0f && num674 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num672 * 2f; + } + } + npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - drawPositionY += 30f; - drawPositionX -= 70f; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; - bool draw = true; - while (draw) - { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); - if (totalDrawDistance < 16f) - { - draw = false; - } - else - { - totalDrawDistance = 16f / totalDrawDistance; - drawPositionX *= totalDrawDistance; - drawPositionY *= totalDrawDistance; - center.X += drawPositionX; - center.Y += drawPositionY; - drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - drawPositionY += 30f; - drawPositionX -= 70f; - Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, - new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); - } - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + drawPositionY += 30f; + drawPositionX -= 70f; + float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + bool draw = true; + while (draw) + { + float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + if (totalDrawDistance < 16f) + { + draw = false; + } + else + { + totalDrawDistance = 16f / totalDrawDistance; + drawPositionX *= totalDrawDistance; + drawPositionY *= totalDrawDistance; + center.X += drawPositionX; + center.Y += drawPositionY; + drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + drawPositionY += 30f; + drawPositionX -= 70f; + Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, + new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + } + } + return true; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); - num285++; - } - } - else - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft3"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + int num285 = 0; + while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); + num285++; + } + } + else + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft3"), 1f); + } + } + } } diff --git a/NPCs/Scavenger/ScavengerClawRight.cs b/NPCs/Scavenger/ScavengerClawRight.cs index 6a9148d555..0d5571925f 100644 --- a/NPCs/Scavenger/ScavengerClawRight.cs +++ b/NPCs/Scavenger/ScavengerClawRight.cs @@ -1,329 +1,329 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class ScavengerClawRight : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 88; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 88; + npc.width = 80; //324 + npc.height = 40; //216 + npc.defense = 50; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 11120; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.damage = 200; - npc.defense = 120; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 300000 : 260000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = 11120; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.damage = 200; + npc.defense = 120; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 300000 : 260000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void AI() - { - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = true; - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 1f; - } - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 50f; - num660 += 120f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - npc.ai[1] += 1f; - if (npc.life < npc.lifeMax / 2) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - npc.ai[1] += 10f; - } - if (npc.ai[1] >= 60f) - { - npc.TargetClosest(true); - if ((npc.Center.X - 100f < Main.player[npc.target].Center.X)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - return; - } - npc.ai[1] = 0f; - return; - } - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); - } - } - else if (npc.ai[0] == 1f) - { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; - float num663 = 12f; - if (npc.life < npc.lifeMax / 2) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 3) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 5) - { - num663 += 10f; - } - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); - num666 = num663 / num666; - npc.velocity.X = num664 * num666; - npc.velocity.Y = num665 * num666; - npc.ai[0] = 2f; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - } - else if (npc.ai[0] == 2f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) - { - npc.noTileCollide = false; - } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) - { - npc.noTileCollide = false; - } - } - else - { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) - { - npc.noTileCollide = false; - } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) - { - npc.noTileCollide = false; - } - } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; - num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; - num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; - num668 += 40f; - num667 += 110f; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - float num671 = 12f; - float num672 = 0.4f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (npc.velocity.X < num673) - { - npc.velocity.X = npc.velocity.X + num672; - if (npc.velocity.X < 0f && num673 > 0f) - { - npc.velocity.X = npc.velocity.X + num672 * 2f; - } - } - else if (npc.velocity.X > num673) - { - npc.velocity.X = npc.velocity.X - num672; - if (npc.velocity.X > 0f && num673 < 0f) - { - npc.velocity.X = npc.velocity.X - num672 * 2f; - } - } - if (npc.velocity.Y < num674) - { - npc.velocity.Y = npc.velocity.Y + num672; - if (npc.velocity.Y < 0f && num674 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num672 * 2f; - } - } - else if (npc.velocity.Y > num674) - { - npc.velocity.Y = npc.velocity.Y - num672; - if (npc.velocity.Y > 0f && num674 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num672 * 2f; - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - } - } + public override void AI() + { + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (npc.ai[0] == 0f) + { + npc.noTileCollide = true; + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 1f; + } + Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 50f; + num660 += 120f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 12f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + npc.ai[1] += 1f; + if (npc.life < npc.lifeMax / 2) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + npc.ai[1] += 10f; + } + if (npc.ai[1] >= 60f) + { + npc.TargetClosest(true); + if ((npc.Center.X - 100f < Main.player[npc.target].Center.X)) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + return; + } + npc.ai[1] = 0f; + return; + } + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); + } + } + else if (npc.ai[0] == 1f) + { + npc.noTileCollide = true; + npc.collideX = false; + npc.collideY = false; + float num663 = 12f; + if (npc.life < npc.lifeMax / 2) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 3) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 5) + { + num663 += 10f; + } + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num664 = Main.player[npc.target].Center.X - vector80.X; + float num665 = Main.player[npc.target].Center.Y - vector80.Y; + float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + num666 = num663 / num666; + npc.velocity.X = num664 * num666; + npc.velocity.Y = num665 * num666; + npc.ai[0] = 2f; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + } + else if (npc.ai[0] == 2f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + { + npc.noTileCollide = false; + } + if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + { + npc.noTileCollide = false; + } + } + else + { + if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + { + npc.noTileCollide = false; + } + if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + { + npc.noTileCollide = false; + } + } + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; + float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; + num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; + num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; + num668 += 40f; + num667 += 110f; + float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); + if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + float num671 = 12f; + float num672 = 0.4f; + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); + float num673 = Main.player[npc.target].Center.X - vector82.X; + float num674 = Main.player[npc.target].Center.Y - vector82.Y; + float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); + num675 = num671 / num675; + num673 *= num675; + num674 *= num675; + if (npc.velocity.X < num673) + { + npc.velocity.X = npc.velocity.X + num672; + if (npc.velocity.X < 0f && num673 > 0f) + { + npc.velocity.X = npc.velocity.X + num672 * 2f; + } + } + else if (npc.velocity.X > num673) + { + npc.velocity.X = npc.velocity.X - num672; + if (npc.velocity.X > 0f && num673 < 0f) + { + npc.velocity.X = npc.velocity.X - num672 * 2f; + } + } + if (npc.velocity.Y < num674) + { + npc.velocity.Y = npc.velocity.Y + num672; + if (npc.velocity.Y < 0f && num674 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num672 * 2f; + } + } + else if (npc.velocity.Y > num674) + { + npc.velocity.Y = npc.velocity.Y - num672; + if (npc.velocity.Y > 0f && num674 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num672 * 2f; + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - drawPositionY += 30f; - drawPositionX += 70f; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; - bool draw = true; - while (draw) - { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); - if (totalDrawDistance < 16f) - { - draw = false; - } - else - { - totalDrawDistance = 16f / totalDrawDistance; - drawPositionX *= totalDrawDistance; - drawPositionY *= totalDrawDistance; - center.X += drawPositionX; - center.Y += drawPositionY; - drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - drawPositionY += 30f; - drawPositionX += 70f; - Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, - new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); - } - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + drawPositionY += 30f; + drawPositionX += 70f; + float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + bool draw = true; + while (draw) + { + float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + if (totalDrawDistance < 16f) + { + draw = false; + } + else + { + totalDrawDistance = 16f / totalDrawDistance; + drawPositionX *= totalDrawDistance; + drawPositionY *= totalDrawDistance; + center.X += drawPositionX; + center.Y += drawPositionY; + drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + drawPositionY += 30f; + drawPositionX += 70f; + Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, + new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + } + } + return true; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); - num285++; - } - } - else - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight2"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + int num285 = 0; + while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); + num285++; + } + } + else + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight2"), 1f); + } + } + } } diff --git a/NPCs/Scavenger/ScavengerHead.cs b/NPCs/Scavenger/ScavengerHead.cs index a2a578a0b1..d8de61d5ce 100644 --- a/NPCs/Scavenger/ScavengerHead.cs +++ b/NPCs/Scavenger/ScavengerHead.cs @@ -1,155 +1,155 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class ScavengerHead : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 80; - npc.height = 80; - npc.defense = 50; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 80; + npc.height = 80; + npc.defense = 50; npc.Calamity().RevPlusDR(0.1f); - npc.lifeMax = 32705; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = null; - if (CalamityWorld.downedProvidence) - { - npc.defense = 150; - npc.lifeMax = 260000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 500000 : 450000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = 32705; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = null; + if (CalamityWorld.downedProvidence) + { + npc.defense = 150; + npc.lifeMax = 260000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 500000 : 450000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - float speed = 12f; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float centerX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - float centerY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - centerY -= 20f; - centerX += 1f; - float totalSpeed = (float)Math.Sqrt((double)(centerX * centerX + centerY * centerY)); - if (totalSpeed < 20f) - { - npc.rotation = 0f; - npc.velocity.X = centerX; - npc.velocity.Y = centerY; - } - else - { - totalSpeed = speed / totalSpeed; - npc.velocity.X = centerX * totalSpeed; - npc.velocity.Y = centerY * totalSpeed; - npc.rotation = npc.velocity.X * 0.1f; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 30f; - } - npc.ai[1] += 1f; - int nukeTimer = 450; - if (npc.ai[1] >= (float)nukeTimer) - { - Main.PlaySound(SoundID.Item62, npc.position); - npc.TargetClosest(true); - npc.ai[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X, npc.Center.Y - 20f); - float nukeSpeed = 1f; - float playerDistanceX = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - float playerDistanceY = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; - float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); - totalPlayerDistance = nukeSpeed / totalPlayerDistance; - playerDistanceX *= totalPlayerDistance; - playerDistanceY *= totalPlayerDistance; - int nukeDamage = expertMode ? 45 : 60; - int projectileType = mod.ProjectileType("ScavengerNuke"); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int nuke = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerDistanceX, playerDistanceY, projectileType, nukeDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[nuke].velocity.Y = -15f; - } - } - } + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + float speed = 12f; + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float centerX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + float centerY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + centerY -= 20f; + centerX += 1f; + float totalSpeed = (float)Math.Sqrt((double)(centerX * centerX + centerY * centerY)); + if (totalSpeed < 20f) + { + npc.rotation = 0f; + npc.velocity.X = centerX; + npc.velocity.Y = centerY; + } + else + { + totalSpeed = speed / totalSpeed; + npc.velocity.X = centerX * totalSpeed; + npc.velocity.Y = centerY * totalSpeed; + npc.rotation = npc.velocity.X * 0.1f; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 30f; + } + npc.ai[1] += 1f; + int nukeTimer = 450; + if (npc.ai[1] >= (float)nukeTimer) + { + Main.PlaySound(SoundID.Item62, npc.position); + npc.TargetClosest(true); + npc.ai[1] = 0f; + Vector2 shootFromVector = new Vector2(npc.Center.X, npc.Center.Y - 20f); + float nukeSpeed = 1f; + float playerDistanceX = player.position.X + (float)player.width * 0.5f - shootFromVector.X; + float playerDistanceY = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; + float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); + totalPlayerDistance = nukeSpeed / totalPlayerDistance; + playerDistanceX *= totalPlayerDistance; + playerDistanceY *= totalPlayerDistance; + int nukeDamage = expertMode ? 45 : 60; + int projectileType = mod.ProjectileType("ScavengerNuke"); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int nuke = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerDistanceX, playerDistanceY, projectileType, nukeDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[nuke].velocity.Y = -15f; + } + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); - num285++; - } - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("ScavengerHead2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + int num285 = 0; + while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); + num285++; + } + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("ScavengerHead2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } } diff --git a/NPCs/Scavenger/ScavengerHead2.cs b/NPCs/Scavenger/ScavengerHead2.cs index da0d1709fc..3e423e8aa4 100644 --- a/NPCs/Scavenger/ScavengerHead2.cs +++ b/NPCs/Scavenger/ScavengerHead2.cs @@ -1,42 +1,42 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class ScavengerHead2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 80; - npc.height = 80; - npc.lifeMax = 100; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 80; + npc.height = 80; + npc.lifeMax = 100; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + } - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { npc.dontTakeDamage = false; @@ -46,87 +46,87 @@ namespace CalamityMod.NPCs.Scavenger return; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - float num = 5f; - float num2 = 0.1f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } + { + npc.TargetClosest(true); + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + float num = 5f; + float num2 = 0.1f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } npc.ai[1] += 1f; int nukeTimer = 720; if (npc.ai[1] >= (float)nukeTimer) @@ -150,131 +150,131 @@ namespace CalamityMod.NPCs.Scavenger } } npc.localAI[0] += 1f; - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.3) - { - npc.localAI[0] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.1) - { - npc.localAI[0] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.5) - { - npc.localAI[1] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.25) - { - npc.localAI[1] += 1f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 900f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(SoundID.Item33, npc.position); - int num8 = 40; - int num9 = mod.ProjectileType("ScavengerLaser"); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] >= 30f) - { - npc.localAI[1] = 0f; - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - int num8 = 45; - int num9 = 259; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.3) + { + npc.localAI[0] += 1f; + } + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.1) + { + npc.localAI[0] += 1f; + } + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.5) + { + npc.localAI[1] += 1f; + } + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.25) + { + npc.localAI[1] += 1f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 900f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(SoundID.Item33, npc.position); + int num8 = 40; + int num9 = mod.ProjectileType("ScavengerLaser"); + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] >= 30f) + { + npc.localAI[1] = 0f; + if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + int num8 = 45; + int num9 = 259; + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead3"), 1f); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead3"), 1f); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/Scavenger/ScavengerLegLeft.cs b/NPCs/Scavenger/ScavengerLegLeft.cs index ba2657f44b..dfb3746fd7 100644 --- a/NPCs/Scavenger/ScavengerLegLeft.cs +++ b/NPCs/Scavenger/ScavengerLegLeft.cs @@ -1,145 +1,145 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class ScavengerLegLeft : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 60; - npc.height = 60; - npc.defense = 40; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 60; + npc.height = 60; + npc.defense = 40; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 22010; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.defense = 135; - npc.lifeMax = 200000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 450000 : 400000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = 22010; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.alpha = 255; + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.defense = 135; + npc.lifeMax = 200000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 450000 : 400000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Vector2 center = npc.Center; - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (npc.ai[0] == 0f) - { - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 8f; - } - Vector2 vector79 = new Vector2(center.X, center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 88f; - num660 -= 70f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - } - } - } + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Vector2 center = npc.Center; + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (npc.ai[0] == 0f) + { + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 8f; + } + Vector2 vector79 = new Vector2(center.X, center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 88f; + num660 -= 70f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 12f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + } + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/Scavenger/ScavengerLegRight.cs b/NPCs/Scavenger/ScavengerLegRight.cs index abc2b85493..7a31210be4 100644 --- a/NPCs/Scavenger/ScavengerLegRight.cs +++ b/NPCs/Scavenger/ScavengerLegRight.cs @@ -1,145 +1,145 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Scavenger { public class ScavengerLegRight : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 60; - npc.height = 60; - npc.defense = 40; + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 60; + npc.height = 60; + npc.defense = 40; npc.Calamity().RevPlusDR(0.15f); - npc.lifeMax = 21010; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.defense = 135; - npc.lifeMax = 200000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 450000 : 400000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } + npc.lifeMax = 21010; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.alpha = 255; + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.defense = 135; + npc.lifeMax = 200000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 450000 : 400000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Vector2 center = npc.Center; - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (npc.ai[0] == 0f) - { - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 8f; - } - Vector2 vector79 = new Vector2(center.X, center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 88f; - num660 += 70f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - } - } - } + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Vector2 center = npc.Center; + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (npc.ai[0] == 0f) + { + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 8f; + } + Vector2 vector79 = new Vector2(center.X, center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 88f; + num660 += 70f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 12f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + } + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight2"), 1f); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight2"), 1f); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 34ec729c27..6f8197038e 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -1,30 +1,30 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] - public class SlimeGod : ModNPC - { + public class SlimeGod : ModNPC + { private float bossLife; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ebonian Slime God"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ebonian Slime God"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 45; - npc.width = 150; - npc.height = 92; - npc.scale = 1.1f; - npc.defense = 10; + public override void SetDefaults() + { + npc.damage = 45; + npc.width = 150; + npc.height = 92; + npc.scale = 1.1f; + npc.defense = 10; npc.lifeMax = CalamityWorld.revenge ? 5500 : 4000; if (CalamityWorld.death) { @@ -34,18 +34,18 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 2500000 : 2200000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; - animationType = 50; - npc.value = 0f; - npc.alpha = 60; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + animationType = 50; + npc.value = 0f; + npc.alpha = 60; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); @@ -54,11 +54,11 @@ namespace CalamityMod.NPCs.SlimeGod bossBag = mod.ItemType("SlimeGodBag"); } - public override void AI() - { - CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + public override void AI() + { + CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); Vector2 vector = npc.Center; if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5400f) { @@ -77,93 +77,93 @@ namespace CalamityMod.NPCs.SlimeGod } bool flag100 = false; bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - flag100 = true; - } - } + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + flag100 = true; + } + } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { flag100 = false; hyperMode = true; } if (Main.netMode != NetmodeID.MultiplayerClient) - { + { npc.localAI[0] += flag100 ? 1f : 2f; if (expertMode && Main.rand.NextBool(2)) - { - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = (CalamityWorld.bossRushActive ? 12f : 8f); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 24; - int num185 = mod.ProjectileType("AbyssMine"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 3; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-60, 61); - num182 += (float)Main.rand.Next(-60, 61); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = (CalamityWorld.bossRushActive ? 12f : 8f); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 17 : 21; - int num185 = mod.ProjectileType("AbyssBallVolley"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 4; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-60, 61); - num182 += (float)Main.rand.Next(-60, 61); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } + { + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num179 = (CalamityWorld.bossRushActive ? 12f : 8f); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = 24; + int num185 = mod.ProjectileType("AbyssMine"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 3; num186++) + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-60, 61); + num182 += (float)Main.rand.Next(-60, 61); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num179 = (CalamityWorld.bossRushActive ? 12f : 8f); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 17 : 21; + int num185 = mod.ProjectileType("AbyssBallVolley"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 4; num186++) + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-60, 61); + num182 += (float)Main.rand.Next(-60, 61); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } npc.aiAction = 0; npc.knockBackResist = 0.2f * Main.knockBackMultiplier; npc.noTileCollide = false; @@ -181,9 +181,9 @@ namespace CalamityMod.NPCs.SlimeGod } } else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } + { + npc.timeLeft = 1800; + } if (npc.ai[0] == 0f) { npc.TargetClosest(true); @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.SlimeGod } else if (npc.ai[0] == 1f) { - npc.ai[1] += 1f; + npc.ai[1] += 1f; if (npc.ai[1] > 18f) { npc.ai[0] = 2f; @@ -369,7 +369,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (npc.ai[0] == 5f) { - npc.localAI[0] += (float)Main.rand.Next(4, 9); + npc.localAI[0] += (float)Main.rand.Next(4, 9); if (npc.velocity.X > 0f) { npc.direction = 1; @@ -470,9 +470,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.alpha += 7; if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } + { + npc.timeLeft = 10; + } if (npc.alpha > 255) { npc.alpha = 255; @@ -480,101 +480,101 @@ namespace CalamityMod.NPCs.SlimeGod npc.velocity.X = npc.velocity.X * 0.98f; } } - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.15); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = Main.rand.Next(1, 3); - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("SlimeSpawnCorrupt"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.15); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = Main.rand.Next(1, 3); + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("SlimeSpawnCorrupt"); + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } public override void BossLoot(ref string name, ref int potionType) { potionType = ItemID.HealingPotion; } - // If the un-split Ebonian Slime God gets one-shotted last, it should drop the boss loot - public override void NPCLoot() - { + // If the un-split Ebonian Slime God gets one-shotted last, it should drop the boss loot + public override void NPCLoot() + { bool otherSlimeGodsAlive = NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) || NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); - if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); - } + if (!otherSlimeGodsAlive) + SlimeGodCore.DropSlimeGodLoot(npc); + } public override bool CheckActive() { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } return true; } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 180, true); + } + } } diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index a1b207d559..126cd37232 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -1,31 +1,31 @@ -using System; +using CalamityMod.CalPlayer; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] - public class SlimeGodCore : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Slime God"); - } + public class SlimeGodCore : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Slime God"); + } - public override void SetDefaults() - { - npc.damage = 40; - npc.npcSlots = 10f; - npc.width = 44; - npc.height = 44; - npc.defense = 6; - npc.lifeMax = CalamityWorld.revenge ? 3750 : 3000; + public override void SetDefaults() + { + npc.damage = 40; + npc.npcSlots = 10f; + npc.width = 44; + npc.height = 44; + npc.defense = 6; + npc.lifeMax = CalamityWorld.revenge ? 3750 : 3000; if (CalamityWorld.death) { npc.lifeMax = 5250; @@ -34,74 +34,74 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 2700000 : 2500000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.aiStyle = -1; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + npc.aiStyle = -1; aiType = -1; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 8, 0, 0); npc.alpha = 80; - animationType = 10; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + animationType = 10; + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else music = MusicID.Boss1; bossBag = mod.ItemType("SlimeGodBag"); - } + } - public override void AI() - { - CalamityGlobalNPC.slimeGod = npc.whoAmI; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - Player player = Main.player[npc.target]; - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 173; - } - else - { - randomDust = 260; - } - int num658 = Dust.NewDust(npc.position, npc.width, npc.height, randomDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); - Main.dust[num658].noGravity = true; - Main.dust[num658].velocity *= 0.5f; - bool flag100 = false; - if (!CalamityWorld.bossRushActive) - { - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - flag100 = true; - } - } - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - flag100 = true; - } - } - } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, 30f); + public override void AI() + { + CalamityGlobalNPC.slimeGod = npc.whoAmI; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + Player player = Main.player[npc.target]; + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 173; + } + else + { + randomDust = 260; + } + int num658 = Dust.NewDust(npc.position, npc.width, npc.height, randomDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); + Main.dust[num658].noGravity = true; + Main.dust[num658].velocity *= 0.5f; + bool flag100 = false; + if (!CalamityWorld.bossRushActive) + { + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + flag100 = true; + } + } + if (CalamityGlobalNPC.slimeGodPurple != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + flag100 = true; + } + } + } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, 30f); if ((double)npc.position.Y > Main.rockLayer * 16.0) { for (int x = 0; x < 200; x++) @@ -117,119 +117,119 @@ namespace CalamityMod.NPCs.SlimeGod npc.netUpdate = true; } return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (!flag100) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (!flag100) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { npc.localAI[1] += ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if (expertMode && Main.rand.NextBool(2)) { if (npc.localAI[0] >= 75f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num179 = revenge ? 2f : 3f; - if (CalamityWorld.bossRushActive) - num179 = 12f; + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num179 = revenge ? 2f : 3f; + if (CalamityWorld.bossRushActive) + num179 = 12f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 24; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = mod.ProjectileType("AbyssMine"); - } - else - { - num185 = mod.ProjectileType("AbyssMine2"); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = 24; + int num185 = Main.rand.Next(2); + if (num185 == 0) + { + num185 = mod.ProjectileType("AbyssMine"); + } + else + { + num185 = mod.ProjectileType("AbyssMine2"); num184 = 22; } - value9.X += num180; - value9.Y += num182; - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - else if (npc.localAI[1] >= 75f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num179 = revenge ? 6f : 5f; - if (CalamityWorld.bossRushActive) - num179 = 12f; + value9.X += num180; + value9.Y += num182; + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + else if (npc.localAI[1] >= 75f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num179 = revenge ? 6f : 5f; + if (CalamityWorld.bossRushActive) + num179 = 12f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 17 : 21; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = mod.ProjectileType("AbyssBallVolley"); - } - else - { - num185 = mod.ProjectileType("AbyssBallVolley2"); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 17 : 21; + int num185 = Main.rand.Next(2); + if (num185 == 0) + { + num185 = mod.ProjectileType("AbyssBallVolley"); + } + else + { + num185 = mod.ProjectileType("AbyssBallVolley2"); num184 = expertMode ? 16 : 19; } - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-30, 31); - num182 += (float)Main.rand.Next(-30, 31); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - npc.TargetClosest(true); - float num1372 = 6f; - if (!flag100) - { - num1372 = 14f; - } - else if (revenge) - { - num1372 = 10f; - } + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-30, 31); + num182 += (float)Main.rand.Next(-30, 31); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + npc.TargetClosest(true); + float num1372 = 6f; + if (!flag100) + { + num1372 = 14f; + } + else if (revenge) + { + num1372 = 10f; + } if (CalamityWorld.bossRushActive || player.gravDir == -1f) { num1372 = 22f; @@ -238,103 +238,103 @@ namespace CalamityMod.NPCs.SlimeGod { num1372 += 8f; } - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + return false; + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.HealingPotion; + } - public override void NPCLoot() - { + public override void NPCLoot() + { bool otherSlimeGodsAlive = - NPC.AnyNPCs(mod.NPCType("SlimeGod")) || + NPC.AnyNPCs(mod.NPCType("SlimeGod")) || NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) || NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); - if (!otherSlimeGodsAlive) - DropSlimeGodLoot(npc); - } + if (!otherSlimeGodsAlive) + DropSlimeGodLoot(npc); + } // This loot code is shared with every other Slime God component. public static void DropSlimeGodLoot(NPC npc) @@ -384,53 +384,53 @@ namespace CalamityMod.NPCs.SlimeGod } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 40; - npc.height = 40; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 40; + npc.height = 40; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.VortexDebuff, 240, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 120, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.VortexDebuff, 240, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 120, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + } } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 635336f19a..621e9df7f4 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -1,30 +1,30 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] - public class SlimeGodRun : ModNPC - { + public class SlimeGodRun : ModNPC + { private float bossLife; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimulan Slime God"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimulan Slime God"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 50; - npc.width = 150; - npc.height = 92; - npc.scale = 1.1f; - npc.defense = 12; + public override void SetDefaults() + { + npc.damage = 50; + npc.width = 150; + npc.height = 92; + npc.scale = 1.1f; + npc.defense = 12; npc.lifeMax = CalamityWorld.revenge ? 4813 : 3500; if (CalamityWorld.death) { @@ -34,34 +34,34 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 2000000 : 1600000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - animationType = 50; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.value = 0f; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + animationType = 50; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.value = 0f; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else music = MusicID.Boss1; npc.aiStyle = -1; - aiType = -1; - bossBag = mod.ItemType("SlimeGodBag"); - } + aiType = -1; + bossBag = mod.ItemType("SlimeGodBag"); + } - public override void AI() - { - CalamityGlobalNPC.slimeGodRed = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + public override void AI() + { + CalamityGlobalNPC.slimeGodRed = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); Vector2 vector = npc.Center; if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5400f) { @@ -80,26 +80,26 @@ namespace CalamityMod.NPCs.SlimeGod } bool flag100 = false; bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - flag100 = true; - } - } + if (CalamityGlobalNPC.slimeGodPurple != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + flag100 = true; + } + } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { hyperMode = true; flag100 = false; } if (!flag100) - { - npc.defense = npc.defDefense * 2; - } - else - { - npc.defense = npc.defDefense; - } + { + npc.defense = npc.defDefense * 2; + } + else + { + npc.defense = npc.defDefense; + } if (Main.netMode != NetmodeID.MultiplayerClient) { if (!flag100) @@ -207,9 +207,9 @@ namespace CalamityMod.NPCs.SlimeGod } } else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } + { + npc.timeLeft = 1800; + } if (npc.ai[0] == 0f) { npc.TargetClosest(true); @@ -495,9 +495,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.alpha += 7; if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } + { + npc.timeLeft = 10; + } if (npc.alpha > 255) { npc.alpha = 255; @@ -506,104 +506,104 @@ namespace CalamityMod.NPCs.SlimeGod } } int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); - Main.dust[num658].noGravity = true; - Main.dust[num658].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = 1; - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("SlimeSpawnCrimson"); - if (Main.rand.NextBool(3)) - { - num663 = mod.NPCType("SlimeSpawnCrimson2"); - } - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } + Main.dust[num658].noGravity = true; + Main.dust[num658].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = 1; + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("SlimeSpawnCrimson"); + if (Main.rand.NextBool(3)) + { + num663 = mod.NPCType("SlimeSpawnCrimson2"); + } + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } public override void BossLoot(ref string name, ref int potionType) { potionType = ItemID.HealingPotion; } - // If the un-split Crimulan Slime God gets one-shotted last, it should drop the boss loot - public override void NPCLoot() - { + // If the un-split Crimulan Slime God gets one-shotted last, it should drop the boss loot + public override void NPCLoot() + { bool otherSlimeGodsAlive = NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || NPC.AnyNPCs(mod.NPCType("SlimeGod")) || NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); - if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); - } + NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); + if (!otherSlimeGodsAlive) + SlimeGodCore.DropSlimeGodLoot(npc); + } public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } + { + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Cursed, 90, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Cursed, 90, true); + } + } } diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 489080af26..3dcbc5d7b5 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -1,25 +1,25 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] public class SlimeGodRunSplit : ModNPC - { + { private float bossLife; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimulan Slime God"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimulan Slime God"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.lifeMax = CalamityWorld.revenge ? 2407 : 1750; if (CalamityWorld.death) { @@ -29,63 +29,63 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.damage = 45; - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 10; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - animationType = 50; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.damage = 45; + npc.width = 150; + npc.height = 92; + npc.scale = 0.8f; + npc.defense = 10; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + animationType = 50; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else music = MusicID.Boss1; npc.aiStyle = -1; - aiType = -1; - bossBag = mod.ItemType("SlimeGodBag"); - } + aiType = -1; + bossBag = mod.ItemType("SlimeGodBag"); + } - public override void AI() - { - CalamityGlobalNPC.slimeGodRed = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + public override void AI() + { + CalamityGlobalNPC.slimeGodRed = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); Vector2 vector = npc.Center; bool flag100 = false; bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - flag100 = true; - } - } + if (CalamityGlobalNPC.slimeGodPurple != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + flag100 = true; + } + } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { hyperMode = true; flag100 = false; } - if (!flag100) - { - npc.defense = npc.defDefense * 2; - } - else - { - npc.defense = npc.defDefense; - } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (!flag100) + { + npc.defense = npc.defDefense * 2; + } + else + { + npc.defense = npc.defDefense; + } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!flag100) { @@ -165,7 +165,7 @@ namespace CalamityMod.NPCs.SlimeGod } } } - npc.aiAction = 0; + npc.aiAction = 0; npc.knockBackResist = 0.2f * Main.knockBackMultiplier; npc.noTileCollide = false; npc.noGravity = false; @@ -182,9 +182,9 @@ namespace CalamityMod.NPCs.SlimeGod } } else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } + { + npc.timeLeft = 1800; + } if (npc.ai[0] == 0f) { npc.TargetClosest(true); @@ -470,9 +470,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.alpha += 7; if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } + { + npc.timeLeft = 10; + } if (npc.alpha > 255) { npc.alpha = 255; @@ -481,126 +481,126 @@ namespace CalamityMod.NPCs.SlimeGod } } int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); - Main.dust[num658].noGravity = true; - Main.dust[num658].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659 * 0.75f; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = 1; - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("SlimeSpawnCrimson"); - if (Main.rand.NextBool(3)) - { - num663 = mod.NPCType("SlimeSpawnCrimson2"); - } - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } + Main.dust[num658].noGravity = true; + Main.dust[num658].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659 * 0.75f; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = 1; + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("SlimeSpawnCrimson"); + if (Main.rand.NextBool(3)) + { + num663 = mod.NPCType("SlimeSpawnCrimson2"); + } + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } - public override void NPCLoot() - { + public override void NPCLoot() + { bool otherSlimeGodsAlive = NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || NPC.AnyNPCs(mod.NPCType("SlimeGod")) || NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || - NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) > 1; // the other crimulan split is alive - if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); - } + NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || + NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) > 1; // the other crimulan split is alive + if (!otherSlimeGodsAlive) + SlimeGodCore.DropSlimeGodLoot(npc); + } public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } + { + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Cursed, 90, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Cursed, 90, true); + } + } } diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 431807db4a..e6a9992e5b 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -1,25 +1,25 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] public class SlimeGodSplit : ModNPC - { + { private float bossLife; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ebonian Slime God"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ebonian Slime God"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.lifeMax = CalamityWorld.revenge ? 2750 : 2000; if (CalamityWorld.death) { @@ -29,26 +29,26 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 1250000 : 1100000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.damage = 40; - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 8; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - animationType = 50; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.damage = 40; + npc.width = 150; + npc.height = 92; + npc.scale = 0.8f; + npc.defense = 8; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + animationType = 50; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); @@ -57,35 +57,35 @@ namespace CalamityMod.NPCs.SlimeGod bossBag = mod.ItemType("SlimeGodBag"); } - public override void AI() - { - CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + public override void AI() + { + CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); Vector2 vector = npc.Center; bool flag100 = false; bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - flag100 = true; - } - } + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + flag100 = true; + } + } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { hyperMode = true; flag100 = false; } if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += flag100 ? 1f : 2f; + { + npc.localAI[0] += flag100 ? 1f : 2f; if (expertMode && Main.rand.NextBool(2)) - { - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); + { + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { float num179 = (CalamityWorld.bossRushActive ? 12f : 8f); @@ -112,44 +112,44 @@ namespace CalamityMod.NPCs.SlimeGod num182 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); } - } - } - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = (CalamityWorld.bossRushActive ? 12f : 8f); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 17 : 21; - int num185 = mod.ProjectileType("AbyssBallVolley"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-20, 21); - num182 += (float)Main.rand.Next(-20, 21); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - npc.aiAction = 0; + } + } + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num179 = (CalamityWorld.bossRushActive ? 12f : 8f); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 17 : 21; + int num185 = mod.ProjectileType("AbyssBallVolley"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; num186++) + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-20, 21); + num182 += (float)Main.rand.Next(-20, 21); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + npc.aiAction = 0; npc.knockBackResist = 0.2f * Main.knockBackMultiplier; npc.noTileCollide = false; npc.noGravity = false; @@ -166,9 +166,9 @@ namespace CalamityMod.NPCs.SlimeGod } } else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } + { + npc.timeLeft = 1800; + } if (npc.ai[0] == 0f) { npc.TargetClosest(true); @@ -178,7 +178,7 @@ namespace CalamityMod.NPCs.SlimeGod } else if (npc.ai[0] == 1f) { - npc.ai[1] += 1f; + npc.ai[1] += 1f; if (npc.ai[1] > 12f) { npc.ai[0] = 2f; @@ -354,7 +354,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (npc.ai[0] == 5f) { - npc.localAI[0] += (float)Main.rand.Next(4, 9); + npc.localAI[0] += (float)Main.rand.Next(4, 9); if (npc.velocity.X > 0f) { npc.direction = 1; @@ -455,9 +455,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.alpha += 7; if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } + { + npc.timeLeft = 10; + } if (npc.alpha > 255) { npc.alpha = 255; @@ -465,123 +465,123 @@ namespace CalamityMod.NPCs.SlimeGod npc.velocity.X = npc.velocity.X * 0.98f; } } - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659 * 0.75f; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.15); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = 1; - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("SlimeSpawnCorrupt"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659 * 0.75f; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.15); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = 1; + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("SlimeSpawnCorrupt"); + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } - public override void NPCLoot() - { + public override void NPCLoot() + { bool otherSlimeGodsAlive = NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || NPC.AnyNPCs(mod.NPCType("SlimeGod")) || - NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) > 1 || // the other ebonian split is alive - NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || + NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) > 1 || // the other ebonian split is alive + NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); - if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); - } + if (!otherSlimeGodsAlive) + SlimeGodCore.DropSlimeGodLoot(npc); + } public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } + { + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 180, true); + } + } } diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs index 77348099cd..67f8d76c22 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs @@ -1,42 +1,42 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { public class SlimeSpawnCorrupt : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corrupt Slime Spawn"); - Main.npcFrameCount[npc.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrupt Slime Spawn"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.aiStyle = 14; - npc.damage = 40; - npc.width = 40; - npc.height = 30; - npc.defense = 6; - npc.lifeMax = 160; + public override void SetDefaults() + { + npc.aiStyle = 14; + npc.damage = 40; + npc.width = 40; + npc.height = 30; + npc.defense = 6; + npc.lifeMax = 160; if (CalamityWorld.bossRushActive) { npc.lifeMax = 100000; } npc.knockBackResist = 0f; - animationType = 121; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } + animationType = 121; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } public override void AI() { @@ -46,26 +46,26 @@ namespace CalamityMod.NPCs.SlimeGod } public override bool PreNPCLoot() - { - return false; - } + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.life <= 0) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("SlimeSpawnCorrupt2")); - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (Main.netMode != NetmodeID.MultiplayerClient && npc.life <= 0) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("SlimeSpawnCorrupt2")); + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 90, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 90, true); + } + } } diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs index bbd69b6e43..0f67833f1b 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs @@ -1,66 +1,65 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { public class SlimeSpawnCorrupt2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corrupt Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrupt Slime Spawn"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 40; - npc.height = 30; - npc.defense = 4; - npc.lifeMax = 90; + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 40; + npc.height = 30; + npc.defense = 4; + npc.lifeMax = 90; if (CalamityWorld.bossRushActive) { npc.lifeMax = 50000; } npc.knockBackResist = 0f; - animationType = 81; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } + animationType = 81; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + } + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 90, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 90, true); + } + } } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index a99e07fb62..f65009d95d 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -1,76 +1,75 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { public class SlimeSpawnCrimson : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimson Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Slime Spawn"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 35; - npc.width = 40; - npc.height = 30; - npc.defense = 4; - npc.lifeMax = 110; + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 35; + npc.width = 40; + npc.height = 30; + npc.defense = 4; + npc.lifeMax = 110; if (CalamityWorld.bossRushActive) { npc.lifeMax = 100000; } npc.knockBackResist = 0f; - animationType = 81; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } + animationType = 81; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.expertMode) - { - if (Main.rand.NextBool(50)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - else if (Main.rand.NextBool(100)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } + public override void NPCLoot() + { + if (Main.expertMode) + { + if (Main.rand.NextBool(50)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + else if (Main.rand.NextBool(100)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Cursed, 60, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Cursed, 60, true); + } + } } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index 8b64ca8207..cf1c71275d 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -1,133 +1,133 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SlimeGod { public class SlimeSpawnCrimson2 : ModNPC - { - public float spikeTimer = 60f; + { + public float spikeTimer = 60f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimson Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Slime Spawn"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 45; - npc.width = 40; - npc.height = 30; - npc.defense = 6; - npc.lifeMax = 130; + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 45; + npc.width = 40; + npc.height = 30; + npc.defense = 6; + npc.lifeMax = 130; if (CalamityWorld.bossRushActive) { npc.lifeMax = 120000; } npc.knockBackResist = 0f; - animationType = 81; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } + animationType = 81; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } - public override void AI() - { - if (spikeTimer > 0f) - { - spikeTimer -= 1f; - } - if (!npc.wet) - { - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; - float num15 = Main.player[npc.target].position.Y - vector3.Y; - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) - { - for (int n = 0; n < 5; n++) - { - Vector2 vector4 = new Vector2((float)(n - 2), -4f); - vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Normalize(); - vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; - Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("CrimsonSpike"), 13, 0f, Main.myPlayer, 0f, 0f); - spikeTimer = 30f; - } - } - } - else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) - { - num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); - num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - num16 = 6.5f / num16; - num14 *= num16; - num15 *= num16; - spikeTimer = 50f; - Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("CrimsonSpike"), 12, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } + public override void AI() + { + if (spikeTimer > 0f) + { + spikeTimer -= 1f; + } + if (!npc.wet) + { + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; + float num15 = Main.player[npc.target].position.Y - vector3.Y; + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) + { + for (int n = 0; n < 5; n++) + { + Vector2 vector4 = new Vector2((float)(n - 2), -4f); + vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Normalize(); + vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; + Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("CrimsonSpike"), 13, 0f, Main.myPlayer, 0f, 0f); + spikeTimer = 30f; + } + } + } + else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) + { + num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); + num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + num16 = 6.5f / num16; + num14 *= num16; + num15 *= num16; + spikeTimer = 50f; + Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("CrimsonSpike"), 12, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - if (Main.expertMode) - { - if (Main.rand.NextBool(50)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - else if (Main.rand.NextBool(100)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } + public override void NPCLoot() + { + if (Main.expertMode) + { + if (Main.rand.NextBool(50)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + else if (Main.rand.NextBool(100)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Cursed, 60, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Cursed, 60, true); + } + } } diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index 3d6208f28a..a386ae50ac 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -1,27 +1,27 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.StormWeaver { public class StasisProbe : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stasis Probe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stasis Probe"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 70; - npc.width = 30; - npc.height = 30; - npc.defense = 60; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 70; + npc.width = 30; + npc.height = 30; + npc.defense = 60; npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = 1200; if (CalamityWorld.bossRushActive) @@ -29,252 +29,252 @@ namespace CalamityMod.NPCs.StormWeaver npc.lifeMax = 25000; } npc.knockBackResist = 0.9f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[24] = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.buffImmune[24] = true; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 12f : 9f; - float num2 = revenge ? 0.15f : 0.12f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 12f : 9f; + float num2 = revenge ? 0.15f : 0.12f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + npc.localAI[0] += 1f; if (npc.justHit) { npc.localAI[0] = 0f; } if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 90f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - int num8 = Main.expertMode ? 50 : 60; - int num9 = 84; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].timeLeft = 200; - } - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + int num8 = Main.expertMode ? 50 : 60; + int num9 = 84; + int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].timeLeft = 200; + } + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs index 91ae906c2c..ca68500ae3 100644 --- a/NPCs/StormWeaver/StasisProbeNaked.cs +++ b/NPCs/StormWeaver/StasisProbeNaked.cs @@ -1,280 +1,280 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.StormWeaver { public class StasisProbeNaked : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stasis Probe"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stasis Probe"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 10f; - npc.damage = 80; - npc.width = 30; - npc.height = 30; - npc.defense = 30; - npc.lifeMax = 1500; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.npcSlots = 10f; + npc.damage = 80; + npc.width = 30; + npc.height = 30; + npc.defense = 30; + npc.lifeMax = 1500; if (CalamityWorld.bossRushActive) { npc.lifeMax = 25000; } npc.knockBackResist = 0.925f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath19; - npc.buffImmune[24] = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath19; + npc.buffImmune[24] = true; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 14f : 10f; - float num2 = revenge ? 0.18f : 0.15f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 14f : 10f; + float num2 = revenge ? 0.18f : 0.15f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + npc.localAI[0] += 1f; if (npc.justHit) { npc.localAI[0] = 0f; } if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - int num8 = Main.expertMode ? 50 : 60; - int num9 = 84; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].timeLeft = 200; - } - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + int num8 = Main.expertMode ? 50 : 60; + int num9 = 84; + int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].timeLeft = 200; + } + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index c70e71b3b4..c6054299a2 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -1,254 +1,253 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverBody : ModNPC - { - private int spawn = 0; + { + private int spawn = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 40; - npc.height = 40; + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 5f; + npc.width = 40; + npc.height = 40; npc.defense = 0; npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = 20000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.boss = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.chaseable = false; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.boss = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.chaseable = false; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) - npc.defense = 99999; - else - npc.defense = 0; + public override void AI() + { + if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) + npc.defense = 99999; + else + npc.defense = 0; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.penetrate == -1 && !projectile.minion) + { + projectile.penetrate = 1; + } + else if (projectile.penetrate >= 1) + { + projectile.penetrate = 1; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - if (NPC.CountNPCS(mod.NPCType("StasisProbe")) < 3) - { - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(15)) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbe"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + if (NPC.CountNPCS(mod.NPCType("StasisProbe")) < 3) + { + if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(15)) + { + spawn = 1; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbe"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 100e286e80..5c3162ac0f 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -1,317 +1,316 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverBodyNaked : ModNPC - { - private int spawn = 14; - private int invinceTime = 180; + { + private int spawn = 14; + private int invinceTime = 180; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } - public override void SetDefaults() - { - npc.damage = 120; - npc.npcSlots = 5f; - npc.width = 40; - npc.height = 40; - npc.lifeMax = 100000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 600000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.boss = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + public override void SetDefaults() + { + npc.damage = 120; + npc.npcSlots = 5f; + npc.width = 40; + npc.height = 40; + npc.lifeMax = 100000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 600000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.boss = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - bool expertMode = Main.expertMode; - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = npc.defDamage; + npc.dontTakeDamage = false; + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - if (NPC.CountNPCS(mod.NPCType("StasisProbeNaked")) < 3) - { - spawn--; - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn <= 0) - { - spawn = 14; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbeNaked"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + if (NPC.CountNPCS(mod.NPCType("StasisProbeNaked")) < 3) + { + spawn--; + if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn <= 0) + { + spawn = 14; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbeNaked"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 4f24af6e75..d87ae9de06 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -1,587 +1,587 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.StormWeaver { [AutoloadBossHead] - public class StormWeaverHead : ModNPC - { - private const float BoltAngleSpread = 170; - private int BoltCountdown = 0; - private const float speed = 10f; - private const float turnSpeed = 0.3f; - private bool tail = false; - private const int minLength = 30; - private const int maxLength = 31; + public class StormWeaverHead : ModNPC + { + private const float BoltAngleSpread = 170; + private int BoltCountdown = 0; + private const float speed = 10f; + private const float turnSpeed = 0.3f; + private bool tail = false; + private const int minLength = 30; + private const int maxLength = 31; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } - public override void SetDefaults() - { - npc.damage = 140; - npc.npcSlots = 5f; - npc.width = 74; - npc.height = 74; + public override void SetDefaults() + { + npc.damage = 140; + npc.npcSlots = 5f; + npc.width = 74; + npc.height = 74; npc.defense = 0; npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = 20000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.boss = true; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(BoltCountdown); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(BoltCountdown); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - BoltCountdown = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + BoltCountdown = reader.ReadInt32(); + } - public override void AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.defense = 99999; - } - else - { - npc.defense = 0; - } - if (!Main.raining && !CalamityWorld.bossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) - { - RainStart(); - } - int BoltProjectiles = 1; - bool expertMode = Main.expertMode; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTail"), 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; - npc.netUpdate = true; - Previous = lol; - } - tail = true; - } - int damage = expertMode ? 62 : 75; - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 360f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - float xPos = (Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - if (BoltCountdown == 0) - { - BoltCountdown = 600; - } - if (BoltCountdown > 0) - { - BoltCountdown--; - if (BoltCountdown == 0) - { - int speed2 = revenge ? 8 : 7; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed2 += 1; - } - float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; - float spawnY2 = -1000f + Main.player[npc.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - for (int i = 0; i < BoltProjectiles; i++) - { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - spawn2; - float ai = (float)Main.rand.Next(100); - Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); - } - } - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y - 10f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 10f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - 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); - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 800); - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 600f; - } - else - { - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - else - { - num188 = revenge ? 14f : 13f; - num189 = revenge ? 0.44f : 0.4f; - if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0) - { - num188 *= 2f; - num189 *= 2f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.defense = 99999; + } + else + { + npc.defense = 0; + } + if (!Main.raining && !CalamityWorld.bossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) + { + RainStart(); + } + int BoltProjectiles = 1; + bool expertMode = Main.expertMode; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tail && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTail"), 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; + npc.netUpdate = true; + Previous = lol; + } + tail = true; + } + int damage = expertMode ? 62 : 75; + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 360f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + float xPos = (Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + if (BoltCountdown == 0) + { + BoltCountdown = 600; + } + if (BoltCountdown > 0) + { + BoltCountdown--; + if (BoltCountdown == 0) + { + int speed2 = revenge ? 8 : 7; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed2 += 1; + } + float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; + float spawnY2 = -1000f + Main.player[npc.target].Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); + Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity *= speed2; + for (int i = 0; i < BoltProjectiles; i++) + { + Vector2 spawn2 = baseSpawn; + spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + Vector2 vector94 = Main.player[npc.target].Center - spawn2; + float ai = (float)Main.rand.Next(100); + Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + } + } + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + npc.velocity.Y = npc.velocity.Y - 10f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 10f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + 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); + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 800); + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 600f; + } + else + { + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + } + else + { + num188 = revenge ? 14f : 13f; + num189 = revenge ? 0.44f : 0.4f; + if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0) + { + num188 *= 2f; + num189 *= 2f; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - private void RainStart() - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.NextBool(3)) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.NextBool(4)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(5)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(6)) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.NextBool(7)) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.NextBool(8)) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.NextBool(2)) - { - num3 += 0.05f; - } - if (Main.rand.NextBool(3)) - { - num3 += 0.1f; - } - if (Main.rand.NextBool(4)) - { - num3 += 0.15f; - } - if (Main.rand.NextBool(5)) - { - num3 += 0.2f; - } - Main.rainTime = (int)((float)Main.rainTime * num3); - Main.raining = true; - CalamityMod.UpdateServerBoolean(); - } + private void RainStart() + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.NextBool(3)) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.NextBool(4)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(5)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(6)) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.NextBool(7)) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.NextBool(8)) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.NextBool(2)) + { + num3 += 0.05f; + } + if (Main.rand.NextBool(3)) + { + num3 += 0.1f; + } + if (Main.rand.NextBool(4)) + { + num3 += 0.15f; + } + if (Main.rand.NextBool(5)) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + CalamityMod.UpdateServerBoolean(); + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckDead() - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.SpawnOnPlayer(Main.LocalPlayer.whoAmI, mod.NPCType("StormWeaverHeadNaked")); - } - return true; - } + public override bool CheckDead() + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.SpawnOnPlayer(Main.LocalPlayer.whoAmI, mod.NPCType("StormWeaverHeadNaked")); + } + return true; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + } } diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 3de8acbac8..bc72cc7b8b 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -1,604 +1,604 @@ -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.StormWeaver { [AutoloadBossHead] - public class StormWeaverHeadNaked : ModNPC - { - private const float BoltAngleSpread = 280; - private int BoltCountdown = 0; - private const float speed = 13f; - private const float turnSpeed = 0.35f; - private bool tail = false; - private int minLength = 40; - private int maxLength = 41; - private int invinceTime = 180; + public class StormWeaverHeadNaked : ModNPC + { + private const float BoltAngleSpread = 280; + private int BoltCountdown = 0; + private const float speed = 13f; + private const float turnSpeed = 0.35f; + private bool tail = false; + private int minLength = 40; + private int maxLength = 41; + private int invinceTime = 180; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } - public override void SetDefaults() - { - npc.damage = 180; - npc.npcSlots = 5f; - npc.width = 74; - npc.height = 74; - npc.lifeMax = 100000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 600000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } + public override void SetDefaults() + { + npc.damage = 180; + npc.npcSlots = 5f; + npc.width = 74; + npc.height = 74; + npc.lifeMax = 100000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.value = Item.buyPrice(0, 35, 0, 0); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 600000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.boss = true; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(BoltCountdown); - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(BoltCountdown); + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - BoltCountdown = reader.ReadInt32(); - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + BoltCountdown = reader.ReadInt32(); + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; - } - if (!Main.raining && !CalamityWorld.bossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) - { - RainStart(); - } - double lifeRatio = (double)npc.life / (double)npc.lifeMax; - int lifePercentage = (int)(100.0 * lifeRatio); - int BoltProjectiles = 2; - if (lifePercentage < 33) - { - BoltProjectiles = 4; - } - else if (lifePercentage < 66) - { - BoltProjectiles = 3; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBodyNaked"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTailNaked"), 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; - npc.netUpdate = true; - Previous = lol; - } - tail = true; - } - int damage = expertMode ? 62 : 75; - npc.localAI[0] += 1f; - if (npc.localAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 180f : 300f)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - float xPos = (Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - if (BoltCountdown == 0) - { - BoltCountdown = 600; - } - if (BoltCountdown > 0) - { - BoltCountdown--; - if (BoltCountdown == 0) - { - int speed2 = revenge ? 8 : 7; - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed2 += 1; - } - float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; - float spawnY2 = -1000f + Main.player[npc.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - for (int i = 0; i < BoltProjectiles; i++) - { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - spawn2; - float ai = (float)Main.rand.Next(100); - Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); - } - } - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y - 10f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 10f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - 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); - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - num188 = revenge ? 14f : 13f; - num189 = revenge ? 0.44f : 0.4f; - if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0) - { - num188 *= 2f; - num189 *= 2f; - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = npc.defDamage; + npc.dontTakeDamage = false; + } + if (!Main.raining && !CalamityWorld.bossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) + { + RainStart(); + } + double lifeRatio = (double)npc.life / (double)npc.lifeMax; + int lifePercentage = (int)(100.0 * lifeRatio); + int BoltProjectiles = 2; + if (lifePercentage < 33) + { + BoltProjectiles = 4; + } + else if (lifePercentage < 66) + { + BoltProjectiles = 3; + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tail && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBodyNaked"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTailNaked"), 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; + npc.netUpdate = true; + Previous = lol; + } + tail = true; + } + int damage = expertMode ? 62 : 75; + npc.localAI[0] += 1f; + if (npc.localAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 180f : 300f)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + float xPos = (Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + if (BoltCountdown == 0) + { + BoltCountdown = 600; + } + if (BoltCountdown > 0) + { + BoltCountdown--; + if (BoltCountdown == 0) + { + int speed2 = revenge ? 8 : 7; + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed2 += 1; + } + float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; + float spawnY2 = -1000f + Main.player[npc.target].Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); + Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity *= speed2; + for (int i = 0; i < BoltProjectiles; i++) + { + Vector2 spawn2 = baseSpawn; + spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + Vector2 vector94 = Main.player[npc.target].Center - spawn2; + float ai = (float)Main.rand.Next(100); + Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + } + } + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + npc.velocity.Y = npc.velocity.Y - 10f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 10f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + 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); + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + num188 = revenge ? 14f : 13f; + num189 = revenge ? 0.44f : 0.4f; + if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0) + { + num188 *= 2f; + num189 *= 2f; + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - private void RainStart() - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.NextBool(3)) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.NextBool(4)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(5)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(6)) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.NextBool(7)) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.NextBool(8)) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.NextBool(2)) - { - num3 += 0.05f; - } - if (Main.rand.NextBool(3)) - { - num3 += 0.1f; - } - if (Main.rand.NextBool(4)) - { - num3 += 0.15f; - } - if (Main.rand.NextBool(5)) - { - num3 += 0.2f; - } - Main.rainTime = (int)((float)Main.rainTime * num3); - Main.raining = true; - CalamityMod.UpdateServerBoolean(); - } + private void RainStart() + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.NextBool(3)) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.NextBool(4)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(5)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(6)) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.NextBool(7)) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.NextBool(8)) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.NextBool(2)) + { + num3 += 0.05f; + } + if (Main.rand.NextBool(3)) + { + num3 += 0.1f; + } + if (Main.rand.NextBool(4)) + { + num3 += 0.15f; + } + if (Main.rand.NextBool(5)) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + CalamityMod.UpdateServerBoolean(); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + } + } - public override bool CheckDead() - { - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("StormWeaverBodyNaked") || Main.npc[num569].type == mod.NPCType("StormWeaverTailNaked"))) - { - Main.npc[num569].active = false; - } - } - return true; - } + public override bool CheckDead() + { + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("StormWeaverBodyNaked") || Main.npc[num569].type == mod.NPCType("StormWeaverTailNaked"))) + { + Main.npc[num569].active = false; + } + } + return true; + } public override void BossLoot(ref string name, ref int potionType) { @@ -606,7 +606,7 @@ namespace CalamityMod.NPCs.StormWeaver } public override bool SpecialNPCLoot() - { + { int closestSegmentID = DropHelper.FindClosestWormSegment(npc, mod.NPCType("StormWeaverHeadNaked"), mod.NPCType("StormWeaverBodyNaked"), @@ -655,8 +655,8 @@ namespace CalamityMod.NPCs.StormWeaver } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - } + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + } } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index e1d425e756..4e3908f19c 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -1,223 +1,222 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } - public override void SetDefaults() - { - npc.damage = 80; - npc.npcSlots = 5f; - npc.width = 48; - npc.height = 80; - npc.lifeMax = 20000; + public override void SetDefaults() + { + npc.damage = 80; + npc.npcSlots = 5f; + npc.width = 48; + npc.height = 80; + npc.lifeMax = 20000; npc.defense = 0; npc.takenDamageMultiplier = CalamityWorld.death ? 3f : 10f; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.boss = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.boss = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 63a4ac8061..0b2aa2d3e8 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -1,303 +1,302 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverTailNaked : ModNPC - { - private int invinceTime = 180; + { + private int invinceTime = 180; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 48; - npc.height = 80; - npc.lifeMax = 100000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 600000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.boss = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 5f; + npc.width = 48; + npc.height = 80; + npc.lifeMax = 100000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 600000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.boss = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = npc.defDamage; + npc.dontTakeDamage = false; + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + } } diff --git a/NPCs/SunkenSeaNPCs/BlindedAngler.cs b/NPCs/SunkenSeaNPCs/BlindedAngler.cs index 2af398eb51..5495ea83c9 100644 --- a/NPCs/SunkenSeaNPCs/BlindedAngler.cs +++ b/NPCs/SunkenSeaNPCs/BlindedAngler.cs @@ -1,285 +1,284 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class BlindedAngler : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blinded Angler"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blinded Angler"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 150; - npc.width = 56; - npc.height = 44; - npc.defense = 30; + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 150; + npc.width = 56; + npc.height = 44; + npc.defense = 30; npc.Calamity().RevPlusDR(0.2f); 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 = mod.ItemType("BlindedAnglerBanner"); - } + 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 = mod.ItemType("BlindedAnglerBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = 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); - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.wet) - { - bool flag14; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - (Main.player[npc.target].Center - npc.Center).Length() < 100f) - { - flag14 = true; - } - else - { - flag14 = false; - } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 3f) - { - npc.velocity.X = 3f; - } - if (npc.velocity.X < -3f) - { - npc.velocity.X = -3f; - } - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - if (npc.velocity.Y < -3f) - { - npc.velocity.Y = -3f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.2) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.2) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (npc.wet ? 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, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + 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); + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; - } - return 0f; - } + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.wet) + { + bool flag14; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + (Main.player[npc.target].Center - npc.Center).Length() < 100f) + { + flag14 = true; + } + else + { + flag14 = false; + } + if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 3f) + { + npc.velocity.X = 3f; + } + if (npc.velocity.X < -3f) + { + npc.velocity.X = -3f; + } + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + if (npc.velocity.Y < -3f) + { + npc.velocity.Y = -3f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.2) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.2) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } - public override void NPCLoot() - { - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EutrophicScimitar")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(5, 10)); - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (npc.wet ? 0.15f : 0f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore4"), 1f); - } - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + 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 NPCLoot() + { + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EutrophicScimitar")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(5, 10)); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore4"), 1f); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/Clam.cs b/NPCs/SunkenSeaNPCs/Clam.cs index 7ee84ec3bf..ff9e936033 100644 --- a/NPCs/SunkenSeaNPCs/Clam.cs +++ b/NPCs/SunkenSeaNPCs/Clam.cs @@ -1,228 +1,226 @@ using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class Clam : ModNPC - { - private int hitAmount = 0; - private bool hasBeenHit = false; - private bool statChange = false; + { + private int hitAmount = 0; + private bool hasBeenHit = false; + private bool statChange = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clam"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clam"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 56; - npc.height = 38; - npc.defense = 9999; + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 56; + npc.height = 38; + npc.defense = 9999; npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = Main.hardMode ? 300 : 150; - if (Main.expertMode) - { - npc.lifeMax *= 2; - } - npc.aiStyle = -1; - aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 10, 0) : Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit4; - npc.knockBackResist = 0.05f; - banner = npc.type; - bannerItem = mod.ItemType("ClamBanner"); - } + if (Main.expertMode) + { + npc.lifeMax *= 2; + } + npc.aiStyle = -1; + aiType = -1; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 10, 0) : Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit4; + npc.knockBackResist = 0.05f; + banner = npc.type; + bannerItem = mod.ItemType("ClamBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hitAmount); - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - writer.Write(statChange); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hitAmount); + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + writer.Write(statChange); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - hitAmount = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - statChange = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hitAmount = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + statChange = reader.ReadBoolean(); + } - public override void AI() - { - npc.TargetClosest(true); - if (Main.player[npc.target].Calamity().clamity) - { - hitAmount = 3; - hasBeenHit = true; - } - if (npc.justHit && hitAmount < 3) - { - ++hitAmount; - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (hitAmount == 3) - { - if (!statChange) - { - npc.defense = 6; - npc.damage = Main.expertMode ? 60 : 30; - if (Main.hardMode) - { - npc.defense = 15; - npc.damage = Main.expertMode ? 120 : 60; - } - statChange = true; - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else if (npc.velocity.Y == 0f) - { - npc.ai[2] += 1f; - int num321 = 20; - if (npc.ai[1] == 0f) - { - num321 = 12; - } - if (npc.ai[2] < (float)num321) - { - npc.velocity.X = npc.velocity.X * 0.9f; - return; - } - npc.ai[2] = 0f; - npc.TargetClosest(true); - if (npc.direction == 0) - { - npc.direction = -1; - } - npc.spriteDirection = -npc.direction; - npc.ai[1] += 1f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 4f) - { - npc.ai[3] = 0f; - if (npc.ai[1] == 2f) - { - float multiplierX = (float)Main.rand.Next(3, 7); - npc.velocity.X = (float)npc.direction * multiplierX; - npc.velocity.Y = -8f; - npc.ai[1] = 0f; - } - else - { - float multiplierX = (float)Main.rand.Next(5, 9); - npc.velocity.X = (float)npc.direction * multiplierX; - npc.velocity.Y = -4f; - } - } - npc.netUpdate = true; - return; - } - else - { - if (npc.direction == 1 && npc.velocity.X < 1f) - { - npc.velocity.X = npc.velocity.X + 0.1f; - return; - } - if (npc.direction == -1 && npc.velocity.X > -1f) - { - npc.velocity.X = npc.velocity.X - 0.1f; - return; - } - } - } - else - { - npc.damage = 0; - } - } + public override void AI() + { + npc.TargetClosest(true); + if (Main.player[npc.target].Calamity().clamity) + { + hitAmount = 3; + hasBeenHit = true; + } + if (npc.justHit && hitAmount < 3) + { + ++hitAmount; + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (hitAmount == 3) + { + if (!statChange) + { + npc.defense = 6; + npc.damage = Main.expertMode ? 60 : 30; + if (Main.hardMode) + { + npc.defense = 15; + npc.damage = Main.expertMode ? 120 : 60; + } + statChange = true; + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) + { + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else if (npc.velocity.Y == 0f) + { + npc.ai[2] += 1f; + int num321 = 20; + if (npc.ai[1] == 0f) + { + num321 = 12; + } + if (npc.ai[2] < (float)num321) + { + npc.velocity.X = npc.velocity.X * 0.9f; + return; + } + npc.ai[2] = 0f; + npc.TargetClosest(true); + if (npc.direction == 0) + { + npc.direction = -1; + } + npc.spriteDirection = -npc.direction; + npc.ai[1] += 1f; + npc.ai[3] += 1f; + if (npc.ai[3] >= 4f) + { + npc.ai[3] = 0f; + if (npc.ai[1] == 2f) + { + float multiplierX = (float)Main.rand.Next(3, 7); + npc.velocity.X = (float)npc.direction * multiplierX; + npc.velocity.Y = -8f; + npc.ai[1] = 0f; + } + else + { + float multiplierX = (float)Main.rand.Next(5, 9); + npc.velocity.X = (float)npc.direction * multiplierX; + npc.velocity.Y = -4f; + } + } + npc.netUpdate = true; + return; + } + else + { + if (npc.direction == 1 && npc.velocity.X < 1f) + { + npc.velocity.X = npc.velocity.X + 0.1f; + return; + } + if (npc.direction == -1 && npc.velocity.X > -1f) + { + npc.velocity.X = npc.velocity.X - 0.1f; + return; + } + } + } + else + { + npc.damage = 0; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (hitAmount < 3) - { - npc.frame.Y = frameHeight * 4; - } - else - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (hitAmount < 3) + { + npc.frame.Y = frameHeight * 4; + } + else + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam3"), 1f); - } - } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Navystone"), Main.rand.Next(8, 13)); - if (Main.rand.NextBool(2) && Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MolluskHusk")); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam3"), 1f); + } + } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Navystone"), Main.rand.Next(8, 13)); + if (Main.rand.NextBool(2) && Main.hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MolluskHusk")); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/EutrophicRay.cs b/NPCs/SunkenSeaNPCs/EutrophicRay.cs index e84de45fa5..633dfacf0f 100644 --- a/NPCs/SunkenSeaNPCs/EutrophicRay.cs +++ b/NPCs/SunkenSeaNPCs/EutrophicRay.cs @@ -1,222 +1,221 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class EutrophicRay : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eutrophic Ray"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eutrophic Ray"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 116; - npc.height = 36; - npc.defense = Main.hardMode ? 15 : 5; + public override void SetDefaults() + { + npc.damage = 20; + npc.width = 116; + npc.height = 36; + npc.defense = Main.hardMode ? 15 : 5; npc.Calamity().RevPlusDR(0.05f); - npc.lifeMax = Main.hardMode ? 500 : 150; - npc.aiStyle = -1; - aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath55; - npc.knockBackResist = 0f; - banner = npc.type; - bannerItem = mod.ItemType("EutrophicRayBanner"); - } + npc.lifeMax = Main.hardMode ? 500 : 150; + npc.aiStyle = -1; + aiType = -1; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath55; + npc.knockBackResist = 0f; + banner = npc.type; + bannerItem = mod.ItemType("EutrophicRayBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } - public override void AI() - { - npc.TargetClosest(true); - if (npc.velocity.X > 0.25f) - { - npc.spriteDirection = 1; - } - else if (npc.velocity.X < 0.25f) - { - npc.spriteDirection = -1; - } - if (npc.justHit && !hasBeenHit) - { - hasBeenHit = true; - npc.damage = Main.expertMode ? 40 : 20; - if (Main.hardMode) - { - npc.damage = Main.expertMode ? 100 : 50; - } - npc.noTileCollide = true; - npc.noGravity = true; - if ((npc.Center.X) < Main.player[npc.target].Center.X) - { - npc.ai[0] = 1f; - } - else - { - npc.ai[0] = 2f; - } - } - npc.chaseable = hasBeenHit; - if (hasBeenHit) - { - float AccelerationY = Main.hardMode ? 0.4f : 0.2f; - float MaxSpeedY = Main.hardMode ? 4f : 2.5f; - float Rotation = 0; - if ((npc.Center.Y + 0.4f) > Main.player[npc.target].Center.Y) - { - npc.velocity.Y -= AccelerationY; - if (npc.velocity.Y < -MaxSpeedY) - { - npc.velocity.Y = -MaxSpeedY; - } - } - else if ((npc.Center.Y - 0.4f) < Main.player[npc.target].Center.Y) - { - npc.velocity.Y += AccelerationY; - if (npc.velocity.Y > MaxSpeedY) - { - npc.velocity.Y = MaxSpeedY; - } - } - float AccelerationX = Main.hardMode ? 0.4f : 0.25f; - float MaxSpeedX = Main.hardMode ? 6f : 4f; + public override void AI() + { + npc.TargetClosest(true); + if (npc.velocity.X > 0.25f) + { + npc.spriteDirection = 1; + } + else if (npc.velocity.X < 0.25f) + { + npc.spriteDirection = -1; + } + if (npc.justHit && !hasBeenHit) + { + hasBeenHit = true; + npc.damage = Main.expertMode ? 40 : 20; + if (Main.hardMode) + { + npc.damage = Main.expertMode ? 100 : 50; + } + npc.noTileCollide = true; + npc.noGravity = true; + if ((npc.Center.X) < Main.player[npc.target].Center.X) + { + npc.ai[0] = 1f; + } + else + { + npc.ai[0] = 2f; + } + } + npc.chaseable = hasBeenHit; + if (hasBeenHit) + { + float AccelerationY = Main.hardMode ? 0.4f : 0.2f; + float MaxSpeedY = Main.hardMode ? 4f : 2.5f; + float Rotation = 0; + if ((npc.Center.Y + 0.4f) > Main.player[npc.target].Center.Y) + { + npc.velocity.Y -= AccelerationY; + if (npc.velocity.Y < -MaxSpeedY) + { + npc.velocity.Y = -MaxSpeedY; + } + } + else if ((npc.Center.Y - 0.4f) < Main.player[npc.target].Center.Y) + { + npc.velocity.Y += AccelerationY; + if (npc.velocity.Y > MaxSpeedY) + { + npc.velocity.Y = MaxSpeedY; + } + } + float AccelerationX = Main.hardMode ? 0.4f : 0.25f; + float MaxSpeedX = Main.hardMode ? 6f : 4f; - if (npc.ai[0] == 1f) - { - Rotation = -0.05f; - npc.velocity.X -= AccelerationX; - if (npc.velocity.X < -MaxSpeedX) - { - npc.velocity.X = -MaxSpeedX; - } + if (npc.ai[0] == 1f) + { + Rotation = -0.05f; + npc.velocity.X -= AccelerationX; + if (npc.velocity.X < -MaxSpeedX) + { + npc.velocity.X = -MaxSpeedX; + } - if ((npc.Center.X + 300f) < Main.player[npc.target].Center.X) - { - npc.ai[0] = 2f; - } - } - else if (npc.ai[0] == 2f) - { - Rotation = 0.05f; - npc.velocity.X += AccelerationX; - if (npc.velocity.X > MaxSpeedX) - { - npc.velocity.X = MaxSpeedX; - } + if ((npc.Center.X + 300f) < Main.player[npc.target].Center.X) + { + npc.ai[0] = 2f; + } + } + else if (npc.ai[0] == 2f) + { + Rotation = 0.05f; + npc.velocity.X += AccelerationX; + if (npc.velocity.X > MaxSpeedX) + { + npc.velocity.X = MaxSpeedX; + } - if ((npc.Center.X - 300f) > Main.player[npc.target].Center.X) - { - npc.ai[0] = 1f; - } - } + if ((npc.Center.X - 300f) > Main.player[npc.target].Center.X) + { + npc.ai[0] = 1f; + } + } - npc.rotation = npc.velocity.Y * Rotation; - if ((double)npc.rotation < -0.1) - { - npc.rotation = -0.1f; - } - if ((double)npc.rotation > 0.1) - { - npc.rotation = 0.1f; - return; - } - } - else - { - npc.damage = 0; - } - } + npc.rotation = npc.velocity.Y * Rotation; + if ((double)npc.rotation < -0.1) + { + npc.rotation = -0.1f; + } + if ((double)npc.rotation > 0.1) + { + npc.rotation = 0.1f; + return; + } + } + else + { + npc.damage = 0; + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 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, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EutrophicShank")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(3)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EutrophicShank")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore4"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore4"), 1f); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/GhostBell.cs b/NPCs/SunkenSeaNPCs/GhostBell.cs index b40bdfb998..bf75235b09 100644 --- a/NPCs/SunkenSeaNPCs/GhostBell.cs +++ b/NPCs/SunkenSeaNPCs/GhostBell.cs @@ -1,162 +1,161 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class GhostBell : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghost Bell"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghost Bell"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.aiStyle = -1; - aiType = -1; - npc.damage = Main.hardMode ? 75 : 25; - npc.width = 54; - npc.height = 76; - npc.defense = Main.hardMode ? 10 : 0; - npc.lifeMax = Main.hardMode ? 400 : 120; - npc.knockBackResist = 0f; - npc.alpha = 100; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 20, 0) : Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("GhostBellBanner"); - } + public override void SetDefaults() + { + npc.noGravity = true; + npc.aiStyle = -1; + aiType = -1; + npc.damage = Main.hardMode ? 75 : 25; + npc.width = 54; + npc.height = 76; + npc.defense = Main.hardMode ? 10 : 0; + npc.lifeMax = Main.hardMode ? 400 : 120; + npc.knockBackResist = 0f; + npc.alpha = 100; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 20, 0) : Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("GhostBellBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } - public override void AI() - { - Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1.5f) / 255f, ((255 - npc.alpha) * 1.5f) / 255f); - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - if (npc.wet) - { - npc.noGravity = true; - if (npc.localAI[2] > 0f) - { - npc.localAI[2] -= 1f; - } - if (npc.localAI[2] <= 0f) - { - if (npc.velocity.Y == 0f) - { - npc.localAI[1] += 1f; - } - else - { - npc.localAI[1] = 0f; - } - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 3f || npc.localAI[1] >= 6f) - { - npc.velocity.Y = -3f; - } - } - } - else - { - npc.noGravity = false; - npc.velocity.Y = 2f; - npc.localAI[2] = 75f; - npc.netUpdate = true; - } - } + public override void AI() + { + Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1.5f) / 255f, ((255 - npc.alpha) * 1.5f) / 255f); + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + if (npc.wet) + { + npc.noGravity = true; + if (npc.localAI[2] > 0f) + { + npc.localAI[2] -= 1f; + } + if (npc.localAI[2] <= 0f) + { + if (npc.velocity.Y == 0f) + { + npc.localAI[1] += 1f; + } + else + { + npc.localAI[1] = 0f; + } + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 3f || npc.localAI[1] >= 6f) + { + npc.velocity.Y = -3f; + } + } + } + else + { + npc.noGravity = false; + npc.velocity.Y = 2f; + npc.localAI[2] = 75f; + npc.netUpdate = true; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 0f; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 120, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 120, true); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs index 879001c406..e185531b5f 100644 --- a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs +++ b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs @@ -1,138 +1,137 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class GhostBellSmall : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Baby Ghost Bell"); - Main.npcFrameCount[npc.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baby Ghost Bell"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.noGravity = true; - npc.chaseable = false; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 28; - npc.height = 36; - npc.defense = 0; - npc.lifeMax = 5; - npc.knockBackResist = 1f; - npc.alpha = 100; - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("GhostBellSmallBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.noGravity = true; + npc.chaseable = false; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 28; + npc.height = 36; + npc.defense = 0; + npc.lifeMax = 5; + npc.knockBackResist = 1f; + npc.alpha = 100; + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("GhostBellSmallBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } - public override void AI() - { - Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1f) / 255f, ((255 - npc.alpha) * 1f) / 255f); - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; - } - if (npc.wet) - { - npc.noGravity = true; - if (npc.velocity.Y < 0f) - { - npc.velocity.Y += 0.1f; - } - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.noGravity = false; - } - } + public override void AI() + { + Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1f) / 255f, ((255 - npc.alpha) * 1f) / 255f); + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + if (npc.wet) + { + npc.noGravity = true; + if (npc.velocity.Y < 0f) + { + npc.velocity.Y += 0.1f; + } + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.noGravity = false; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 1.5f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 1.5f; + } + return 0f; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/GiantClam.cs b/NPCs/SunkenSeaNPCs/GiantClam.cs index c71edfd5b9..359da9360b 100644 --- a/NPCs/SunkenSeaNPCs/GiantClam.cs +++ b/NPCs/SunkenSeaNPCs/GiantClam.cs @@ -1,402 +1,401 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class GiantClam : ModNPC - { - private int hitAmount = 0; - private int attack = -1; //-1 doing nothing, 0 = shell hiding, 1 = telestomp, 2 = pearl burst, 3 = pearl rain - private bool attackAnim = false; - private bool hasBeenHit = false; - private bool statChange = false; - private bool hide = false; + { + private int hitAmount = 0; + private int attack = -1; //-1 doing nothing, 0 = shell hiding, 1 = telestomp, 2 = pearl burst, 3 = pearl rain + private bool attackAnim = false; + private bool hasBeenHit = false; + private bool statChange = false; + private bool hide = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Clam"); - Main.npcFrameCount[npc.type] = 12; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Clam"); + Main.npcFrameCount[npc.type] = 12; + } - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.npcSlots = 5f; - npc.damage = 50; - npc.width = 160; - npc.height = 120; - npc.defense = 9999; + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.npcSlots = 5f; + npc.damage = 50; + npc.width = 160; + npc.height = 120; + npc.defense = 9999; npc.Calamity().RevPlusDR(0.3f); npc.lifeMax = Main.hardMode ? 7500 : 1250; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.aiStyle = -1; - aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 10, 0, 0) : Item.buyPrice(0, 1, 0, 0); - npc.HitSound = SoundID.NPCHit4; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("GiantClamBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hitAmount); - writer.Write(attack); - writer.Write(attackAnim); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - writer.Write(statChange); - writer.Write(hide); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hitAmount = reader.ReadInt32(); - attack = reader.ReadInt32(); - attackAnim = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - statChange = reader.ReadBoolean(); - hide = reader.ReadBoolean(); - } - - public override void AI() - { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (npc.justHit && hitAmount < 5) - { - ++hitAmount; - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (hitAmount == 5) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - player.AddBuff(mod.BuffType("Clamity"), 2); //CLAM INVASION - } - } - - if (!hide) - Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 2.5f) / 255f, ((255 - npc.alpha) * 2.5f) / 255f); - - if (!statChange) - { - npc.defense = 10; - npc.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - npc.defense = 35; - npc.damage = Main.expertMode ? 200 : 100; - } - statChange = true; - } - - if (npc.ai[0] < 240f) - { - npc.ai[0] += 1f; - hide = false; - } - else - { - if (attack == -1) - { - attack = Main.rand.Next(2); - if (attack == 0) - { - attack = Main.rand.Next(2); //rarer chance of doing the hiding clam - } - } - else if (attack == 0) - { - hide = true; - npc.defense = 9999; - npc.ai[1] += 1f; - if (npc.ai[1] >= 90f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - hide = false; - attack = -1; - npc.defense = Main.hardMode ? 35 : 10; - NPC.NewNPC((int)(npc.Center.X + 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)(npc.Center.X), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)(npc.Center.X - 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); - } - } - else if (attack == 1) - { - if (npc.ai[2] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(true); - npc.ai[2] = 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 1f) - { - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.alpha += Main.hardMode ? 8 : 5; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = player.Center.X - (float)(npc.width / 2); - npc.position.Y = player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 200f; - npc.position.X = npc.position.X - 15f; - npc.position.Y = npc.position.Y - 100f; - npc.ai[2] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - if (Main.rand.NextBool(2)) - { - int num5 = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 200, default, 1.5f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-200, 201), (float)Main.rand.Next(-200, 201)); - vector.Normalize(); - vector *= (float)Main.rand.Next(100, 200) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = npc.Center - vector; - } - npc.alpha -= Main.hardMode ? 7 : 4; - if (npc.alpha <= 0) - { - npc.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - npc.damage = Main.expertMode ? 200 : 100; - } - npc.chaseable = true; - npc.dontTakeDamage = false; - npc.alpha = 0; - npc.ai[2] = 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 3f) - { - npc.velocity.Y += 0.8f; - attackAnim = true; - if ((npc.Center.Y) > (player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 15f)) - { - npc.noTileCollide = false; - npc.ai[2] = 4f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 4f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.netUpdate = true; - npc.noGravity = false; - attack = -1; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)npc.position.X, (int)npc.position.Y); - for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) - { - for (int stompDustAmount = 0; stompDustAmount < 5; stompDustAmount++) - { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 33, 0f, 0f, 100, default, 1.5f); - Main.dust[stompDust].velocity *= 0.2f; - } - int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), npc.position.Y + (float)npc.height - 12f), default, Main.rand.Next(61, 64), 1f); - Main.gore[stompGore].velocity *= 0.4f; - } - } - npc.velocity.Y += 0.8f; - } - } - } - - if (npc.ai[3] < 180f && Main.hardMode) - { - npc.ai[3] += 1f; - } - else if (Main.hardMode) - { - if (attack == -1) - { - attack = Main.rand.Next(2, 4); - } - else if (attack == 2) - { - Main.PlaySound(SoundID.Item67, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int projectileShot = mod.ProjectileType("PearlBurst"); - int damage = Main.expertMode ? 28 : 35; - float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - for (int i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - attack = -1; - npc.ai[3] = 0f; - } - else if (attack == 3) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(SoundID.Item68, npc.position); - int damage = Main.expertMode ? 28 : 35; - float shotSpacing = 750f; - for (int i = 0; i < 11; i++) - { - Projectile.NewProjectile(player.Center.X + shotSpacing, player.Center.Y - 750f, 0f, 8f, mod.ProjectileType("PearlRain"), damage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing -= 150f; - } - } - attack = -1; - npc.ai[3] = 0f; - } - } - } - } - - public override bool CheckActive() - { - return Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f; - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > (attackAnim ? 2.0 : 5.0)) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (hitAmount < 5 || hide) - { - npc.frame.Y = frameHeight * 11; - } - else if (attackAnim) - { - if (npc.frame.Y < frameHeight * 3) - { - npc.frame.Y = frameHeight * 3; - } - if (npc.frame.Y > frameHeight * 10) - { - hide = true; - attackAnim = false; - } - } - else - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(mod.NPCType("GiantClam"))) + for (int k = 0; k < npc.buffImmune.Length; k++) { - return SpawnCondition.CaveJellyfish.Chance * 0.12f; - } - return 0f; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.aiStyle = -1; + aiType = -1; + npc.value = Main.hardMode ? Item.buyPrice(0, 10, 0, 0) : Item.buyPrice(0, 1, 0, 0); + npc.HitSound = SoundID.NPCHit4; + npc.knockBackResist = 0f; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("GiantClamBanner"); + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam5"), 1f); - } - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hitAmount); + writer.Write(attack); + writer.Write(attackAnim); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + writer.Write(statChange); + writer.Write(hide); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Texture2D texture = Main.npcTexture[npc.type]; - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - return false; - } + public override void ReceiveExtraAI(BinaryReader reader) + { + hitAmount = reader.ReadInt32(); + attack = reader.ReadInt32(); + attackAnim = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + statChange = reader.ReadBoolean(); + hide = reader.ReadBoolean(); + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void AI() + { + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + if (npc.justHit && hitAmount < 5) + { + ++hitAmount; + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (hitAmount == 5) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[npc.target].dead && Main.player[npc.target].active) + { + player.AddBuff(mod.BuffType("Clamity"), 2); //CLAM INVASION + } + } - public override void NPCLoot() - { + if (!hide) + Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 2.5f) / 255f, ((255 - npc.alpha) * 2.5f) / 255f); + + if (!statChange) + { + npc.defense = 10; + npc.damage = Main.expertMode ? 100 : 50; + if (Main.hardMode) + { + npc.defense = 35; + npc.damage = Main.expertMode ? 200 : 100; + } + statChange = true; + } + + if (npc.ai[0] < 240f) + { + npc.ai[0] += 1f; + hide = false; + } + else + { + if (attack == -1) + { + attack = Main.rand.Next(2); + if (attack == 0) + { + attack = Main.rand.Next(2); //rarer chance of doing the hiding clam + } + } + else if (attack == 0) + { + hide = true; + npc.defense = 9999; + npc.ai[1] += 1f; + if (npc.ai[1] >= 90f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + hide = false; + attack = -1; + npc.defense = Main.hardMode ? 35 : 10; + NPC.NewNPC((int)(npc.Center.X + 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)(npc.Center.X), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)(npc.Center.X - 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); + } + } + else if (attack == 1) + { + if (npc.ai[2] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(true); + npc.ai[2] = 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 1f) + { + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.alpha += Main.hardMode ? 8 : 5; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = player.Center.X - (float)(npc.width / 2); + npc.position.Y = player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 200f; + npc.position.X = npc.position.X - 15f; + npc.position.Y = npc.position.Y - 100f; + npc.ai[2] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + if (Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 200, default, 1.5f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-200, 201), (float)Main.rand.Next(-200, 201)); + vector.Normalize(); + vector *= (float)Main.rand.Next(100, 200) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = npc.Center - vector; + } + npc.alpha -= Main.hardMode ? 7 : 4; + if (npc.alpha <= 0) + { + npc.damage = Main.expertMode ? 100 : 50; + if (Main.hardMode) + { + npc.damage = Main.expertMode ? 200 : 100; + } + npc.chaseable = true; + npc.dontTakeDamage = false; + npc.alpha = 0; + npc.ai[2] = 3f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 3f) + { + npc.velocity.Y += 0.8f; + attackAnim = true; + if ((npc.Center.Y) > (player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 15f)) + { + npc.noTileCollide = false; + npc.ai[2] = 4f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 4f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[2] = 0f; + npc.ai[0] = 0f; + npc.netUpdate = true; + npc.noGravity = false; + attack = -1; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)npc.position.X, (int)npc.position.Y); + for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) + { + for (int stompDustAmount = 0; stompDustAmount < 5; stompDustAmount++) + { + int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 33, 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), npc.position.Y + (float)npc.height - 12f), default, Main.rand.Next(61, 64), 1f); + Main.gore[stompGore].velocity *= 0.4f; + } + } + npc.velocity.Y += 0.8f; + } + } + } + + if (npc.ai[3] < 180f && Main.hardMode) + { + npc.ai[3] += 1f; + } + else if (Main.hardMode) + { + if (attack == -1) + { + attack = Main.rand.Next(2, 4); + } + else if (attack == 2) + { + Main.PlaySound(SoundID.Item67, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int projectileShot = mod.ProjectileType("PearlBurst"); + int damage = Main.expertMode ? 28 : 35; + float speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + for (int i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + attack = -1; + npc.ai[3] = 0f; + } + else if (attack == 3) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(SoundID.Item68, npc.position); + int damage = Main.expertMode ? 28 : 35; + float shotSpacing = 750f; + for (int i = 0; i < 11; i++) + { + Projectile.NewProjectile(player.Center.X + shotSpacing, player.Center.Y - 750f, 0f, 8f, mod.ProjectileType("PearlRain"), damage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing -= 150f; + } + } + attack = -1; + npc.ai[3] = 0f; + } + } + } + } + + public override bool CheckActive() + { + return Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > (attackAnim ? 2.0 : 5.0)) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (hitAmount < 5 || hide) + { + npc.frame.Y = frameHeight * 11; + } + else if (attackAnim) + { + if (npc.frame.Y < frameHeight * 3) + { + npc.frame.Y = frameHeight * 3; + } + if (npc.frame.Y > frameHeight * 10) + { + hide = true; + attackAnim = false; + } + } + else + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(mod.NPCType("GiantClam"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.12f; + } + return 0f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam5"), 1f); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void NPCLoot() + { // Spawn Amidias if he isn't in the world int amidiasNPC = NPC.FindFirstNPC(mod.NPCType("SEAHOE")); if (amidiasNPC == -1 && Main.netMode != NetmodeID.MultiplayerClient) @@ -424,5 +423,5 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs CalamityWorld.downedCLAM = true; CalamityMod.UpdateServerBoolean(); } - } + } } diff --git a/NPCs/SunkenSeaNPCs/PrismTurtle.cs b/NPCs/SunkenSeaNPCs/PrismTurtle.cs index 44ed5579a3..11573276ea 100644 --- a/NPCs/SunkenSeaNPCs/PrismTurtle.cs +++ b/NPCs/SunkenSeaNPCs/PrismTurtle.cs @@ -1,293 +1,292 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class PrismTurtle : ModNPC - { - public bool hasBeenHit = false; + { + public bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism-Back"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism-Back"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = Main.hardMode ? 40 : 20; //normal damage - npc.width = 72; - npc.height = 58; - npc.defense = Main.hardMode ? 25 : 10; + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = Main.hardMode ? 40 : 20; //normal damage + npc.width = 72; + npc.height = 58; + npc.defense = Main.hardMode ? 25 : 10; npc.Calamity().RevPlusDR(0.25f); npc.lifeMax = Main.hardMode ? 1000 : 350; - npc.aiStyle = -1; - aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.knockBackResist = 0.15f; - banner = npc.type; - bannerItem = mod.ItemType("PrismTurtleBanner"); - } + npc.aiStyle = -1; + aiType = -1; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit24; + npc.DeathSound = SoundID.NPCDeath27; + npc.knockBackResist = 0.15f; + banner = npc.type; + bannerItem = mod.ItemType("PrismTurtleBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } - public override void AI() - { - if ((npc.Center.Y + 10f) > Main.player[npc.target].Center.Y) - { - if (CalamityWorld.death) //gotta do damage scaling directly - { - npc.damage = Main.hardMode ? 240 : 120; - } - else if (CalamityWorld.revenge) - { - npc.damage = Main.hardMode ? 168 : 84; - } - else if (Main.expertMode) - { - npc.damage = Main.hardMode ? 160 : 80; - } - else - { - npc.damage = Main.hardMode ? 80 : 40; - } - } - else - { - if (CalamityWorld.death) //gotta do damage scaling directly - { - npc.damage = Main.hardMode ? 120 : 60; - } - else if (CalamityWorld.revenge) - { - npc.damage = Main.hardMode ? 84 : 42; - } - else if (Main.expertMode) - { - npc.damage = Main.hardMode ? 80 : 40; - } - else - { - npc.damage = Main.hardMode ? 40 : 20; - } - } - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f); - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - if (npc.collideX || npc.velocity.X == 0f) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2f || npc.velocity.X > 2f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - if (npc.velocity.Y < -1f) - { - npc.velocity.Y = -1f; - ++npc.ai[1]; - if (npc.ai[1] >= 120) - { - npc.ai[1] = 0; - npc.ai[0] = 1f; - } - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 1f) - { - npc.velocity.Y = 1f; - ++npc.ai[1]; - if (npc.ai[1] >= 120) - { - npc.ai[1] = 0; - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - npc.ai[0] = 1f; - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } + public override void AI() + { + if ((npc.Center.Y + 10f) > Main.player[npc.target].Center.Y) + { + if (CalamityWorld.death) //gotta do damage scaling directly + { + npc.damage = Main.hardMode ? 240 : 120; + } + else if (CalamityWorld.revenge) + { + npc.damage = Main.hardMode ? 168 : 84; + } + else if (Main.expertMode) + { + npc.damage = Main.hardMode ? 160 : 80; + } + else + { + npc.damage = Main.hardMode ? 80 : 40; + } + } + else + { + if (CalamityWorld.death) //gotta do damage scaling directly + { + npc.damage = Main.hardMode ? 120 : 60; + } + else if (CalamityWorld.revenge) + { + npc.damage = Main.hardMode ? 84 : 42; + } + else if (Main.expertMode) + { + npc.damage = Main.hardMode ? 80 : 40; + } + else + { + npc.damage = Main.hardMode ? 40 : 20; + } + } + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f); + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + if (npc.collideX || npc.velocity.X == 0f) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2f || npc.velocity.X > 2f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + if (npc.velocity.Y < -1f) + { + npc.velocity.Y = -1f; + ++npc.ai[1]; + if (npc.ai[1] >= 120) + { + npc.ai[1] = 0; + npc.ai[0] = 1f; + } + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y > 1f) + { + npc.velocity.Y = 1f; + ++npc.ai[1]; + if (npc.ai[1] >= 120) + { + npc.ai[1] = 0; + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + npc.ai[0] = 1f; + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (npc.wet ? 0.1f : 0f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (npc.wet ? 0.1f : 0f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 0f; + } - public override void NPCLoot() - { - if (CalamityWorld.downedDesertScourge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(1, 4)); - } - } + public override void NPCLoot() + { + if (CalamityWorld.downedDesertScourge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(1, 4)); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore5"), 1f); - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore5"), 1f); + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/SeaFloaty.cs b/NPCs/SunkenSeaNPCs/SeaFloaty.cs index 2ec45d95b2..79f8821011 100644 --- a/NPCs/SunkenSeaNPCs/SeaFloaty.cs +++ b/NPCs/SunkenSeaNPCs/SeaFloaty.cs @@ -1,154 +1,152 @@ using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class SeaFloaty : ModNPC - { - private bool hasBeenHit = false; + { + private bool hasBeenHit = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Floaty"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Floaty"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.npcSlots = 0.5f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 5; - npc.width = 72; - npc.height = 22; - npc.defense = 0; - npc.lifeMax = 50; - npc.knockBackResist = 0.5f; - npc.value = Item.buyPrice(0, 0, 0, 50); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("SeaFloatyBanner"); - } + public override void SetDefaults() + { + npc.npcSlots = 0.5f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 5; + npc.width = 72; + npc.height = 22; + npc.defense = 0; + npc.lifeMax = 50; + npc.knockBackResist = 0.5f; + npc.value = Item.buyPrice(0, 0, 0, 50); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("SeaFloatyBanner"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } - public override void AI() - { - if (npc.velocity.X > 0.25f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X < 0.25f) - { - npc.spriteDirection = 1; - } - if (npc.ai[0] == 0f) - { - npc.direction = 1; - npc.ai[0] = 1f; - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } + public override void AI() + { + if (npc.velocity.X > 0.25f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X < 0.25f) + { + npc.spriteDirection = 1; + } + if (npc.ai[0] == 0f) + { + npc.direction = 1; + npc.ai[0] = 1f; + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } - if (npc.justHit && !hasBeenHit) - { - hasBeenHit = true; - npc.noTileCollide = true; - npc.noGravity = true; - } - npc.chaseable = hasBeenHit; - if (hasBeenHit) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X - (float)npc.direction * 0.5f; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.3f; - if (npc.velocity.X > 10f) - { - npc.velocity.X = 10f; - } - if (npc.velocity.X < -10f) - { - npc.velocity.X = -10f; - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - if (npc.velocity.Y < -10f) - { - npc.velocity.Y = -10f; - } - npc.direction *= -1; - npc.rotation = npc.velocity.X * 0.1f; - if ((double)npc.rotation < -0.3) - { - npc.rotation = -0.3f; - } - if ((double)npc.rotation > 0.3) - { - npc.rotation = 0.3f; - return; - } - } - } + if (npc.justHit && !hasBeenHit) + { + hasBeenHit = true; + npc.noTileCollide = true; + npc.noGravity = true; + } + npc.chaseable = hasBeenHit; + if (hasBeenHit) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X - (float)npc.direction * 0.5f; + npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.3f; + if (npc.velocity.X > 10f) + { + npc.velocity.X = 10f; + } + if (npc.velocity.X < -10f) + { + npc.velocity.X = -10f; + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + if (npc.velocity.Y < -10f) + { + npc.velocity.Y = -10f; + } + npc.direction *= -1; + npc.rotation = npc.velocity.X * 0.1f; + if ((double)npc.rotation < -0.3) + { + npc.rotation = -0.3f; + } + if ((double)npc.rotation > 0.3) + { + npc.rotation = 0.3f; + return; + } + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.3f : 0.15f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.3f : 0.15f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + return 0f; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore3"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore3"), 1f); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/SeaMinnow.cs b/NPCs/SunkenSeaNPCs/SeaMinnow.cs index fbb87a7508..5dc5db266f 100644 --- a/NPCs/SunkenSeaNPCs/SeaMinnow.cs +++ b/NPCs/SunkenSeaNPCs/SeaMinnow.cs @@ -1,43 +1,41 @@ using System; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { public class SeaMinnow : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Minnow"); + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Minnow"); Main.npcFrameCount[npc.type] = 4; } - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.noGravity = true; + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.noGravity = true; npc.damage = 0; - npc.width = 36; - npc.height = 22; - npc.defense = 0; - npc.lifeMax = 5; + npc.width = 36; + npc.height = 22; + npc.defense = 0; + npc.lifeMax = 5; npc.aiStyle = -1; - aiType = -1; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("SeaMinnowBanner"); - npc.chaseable = false; - } + aiType = -1; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("SeaMinnowBanner"); + npc.chaseable = false; + } public override void AI() { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - bool flag14 = false; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + bool flag14 = false; if (npc.direction == 0) { npc.TargetClosest(true); @@ -100,7 +98,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs { npc.velocity.Y = -6f; } - npc.direction *= -1; + npc.direction *= -1; } else { @@ -200,19 +198,19 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - return 0f; + return 0f; } public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); - } - } - } + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent1.cs b/NPCs/SunkenSeaNPCs/SeaSerpent1.cs index 3de6181541..0c40db0041 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent1.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent1.cs @@ -1,371 +1,370 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.SunkenSeaNPCs { - public class SeaSerpent1 : ModNPC - { - public const int maxLength = 9; - public float speed = 6f; - public float turnSpeed = 0.125f; - bool TailSpawned = false; + public class SeaSerpent1 : ModNPC + { + public const int maxLength = 9; + public float speed = 6f; + public float turnSpeed = 0.125f; + bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } - 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); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("SeaSerpentBanner"); - } + 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); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("SeaSerpentBanner"); + } - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - 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((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent2"), npc.whoAmI); - } - else if (segment == 2 || segment == 3 || segment == 6) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent3"), npc.whoAmI); - } - else if (segment == 7) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent4"), npc.whoAmI); - } - else if (segment == 8) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent5"), 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(23, -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.AnyNPCs(mod.NPCType("SeaSerpent5"))) - { - npc.active = false; - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 200); //800 - if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 300f; - } - else - { - num191 = Main.player[npc.target].Center.X - 300f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + 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((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent2"), npc.whoAmI); + } + else if (segment == 2 || segment == 3 || segment == 6) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent3"), npc.whoAmI); + } + else if (segment == 7) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent4"), npc.whoAmI); + } + else if (segment == 8) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent5"), 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(23, -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.AnyNPCs(mod.NPCType("SeaSerpent5"))) + { + npc.active = false; + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 200); //800 + if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 300f; + } + else + { + num191 = Main.player[npc.target].Center.X - 300f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + 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(mod.NPCType("SeaSerpent1")) && !spawnInfo.player.Calamity().clamity && !spawnInfo.playerSafe) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && + !NPC.AnyNPCs(mod.NPCType("SeaSerpent1")) && !spawnInfo.player.Calamity().clamity && !spawnInfo.playerSafe) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } - public override void NPCLoot() - { - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Serpentine")); - } - } + public override void NPCLoot() + { + if (Main.rand.NextBool(4)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Serpentine")); + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore1"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore1"), 1f); + } + } - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - } + public override bool CheckActive() + { + if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == NetmodeID.Server) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + } } diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent2.cs b/NPCs/SunkenSeaNPCs/SeaSerpent2.cs index 5209fde852..4055beb158 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent2.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent2.cs @@ -5,164 +5,163 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SunkenSeaNPCs { - public class SeaSerpent2 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; + public class SeaSerpent2 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } - 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; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - 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 = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } + 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; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + 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 = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore2"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore2"), 1f); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent3.cs b/NPCs/SunkenSeaNPCs/SeaSerpent3.cs index 71f258a126..dbaa4af9f1 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent3.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent3.cs @@ -5,161 +5,160 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SunkenSeaNPCs { - public class SeaSerpent3 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } + public class SeaSerpent3 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } - 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; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - 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 = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } + 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; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + 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 = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore3"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore3"), 1f); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent4.cs b/NPCs/SunkenSeaNPCs/SeaSerpent4.cs index c1ba4d7760..030a904345 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent4.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent4.cs @@ -5,161 +5,160 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SunkenSeaNPCs { - public class SeaSerpent4 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } + public class SeaSerpent4 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } - 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; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - 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 = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } + 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; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + 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 = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore4"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore4"), 1f); + } + } + } } diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent5.cs b/NPCs/SunkenSeaNPCs/SeaSerpent5.cs index a8e86032b0..a3f4402560 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent5.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent5.cs @@ -5,161 +5,160 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SunkenSeaNPCs { - public class SeaSerpent5 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } + public class SeaSerpent5 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } - 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; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - 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 = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } + 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; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + 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 = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!NPC.AnyNPCs(mod.NPCType("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore5"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore5"), 1f); + } + } + } } diff --git a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs b/NPCs/SupremeCalamitas/SCalScreenShaderData.cs index f397096078..da72a3af8e 100644 --- a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs +++ b/NPCs/SupremeCalamitas/SCalScreenShaderData.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { - public class SCalScreenShaderData : ScreenShaderData - { - private int SCalIndex; + public class SCalScreenShaderData : ScreenShaderData + { + private int SCalIndex; - public SCalScreenShaderData(string passName) - : base(passName) - { - } + public SCalScreenShaderData(string passName) + : base(passName) + { + } - private void UpdateSCalIndex() - { - int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); - if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) - { - return; - } - SCalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == SCalType) - { - SCalIndex = i; - break; - } - } - } + private void UpdateSCalIndex() + { + int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); + if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + { + return; + } + SCalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == SCalType) + { + SCalIndex = i; + break; + } + } + } - public override void Apply() - { - UpdateSCalIndex(); - if (SCalIndex != -1) - { - UseTargetPosition(Main.npc[SCalIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdateSCalIndex(); + if (SCalIndex != -1) + { + UseTargetPosition(Main.npc[SCalIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/SupremeCalamitas/SCalSky.cs b/NPCs/SupremeCalamitas/SCalSky.cs index 4a0712ac8c..7f33d9fb4e 100644 --- a/NPCs/SupremeCalamitas/SCalSky.cs +++ b/NPCs/SupremeCalamitas/SCalSky.cs @@ -6,96 +6,96 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { - public class SCalSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int SCalIndex = -1; + public class SCalSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int SCalIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdateSCalIndex()) - { - float x = 0f; - if (this.SCalIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } + private float GetIntensity() + { + if (this.UpdateSCalIndex()) + { + float x = 0f; + if (this.SCalIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdateSCalIndex() - { - int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); - if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) - { - return true; - } - SCalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == SCalType) - { - SCalIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return SCalIndex != -1; - } + private bool UpdateSCalIndex() + { + int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); + if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + { + return true; + } + SCalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == SCalType) + { + SCalIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return SCalIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index 0b01037523..ae5d253e7c 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -1,27 +1,27 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormBody : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sepulcher"); - } + { + DisplayName.SetDefault("Sepulcher"); + } - public override void SetDefaults() - { - npc.damage = 0; //70 - npc.npcSlots = 5f; - npc.width = 26; //28 - npc.height = 18; //28 - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 0; //70 + npc.npcSlots = 5f; + npc.width = 26; //28 + npc.height = 18; //28 + npc.defense = 0; npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) @@ -30,70 +30,70 @@ namespace CalamityMod.NPCs.SupremeCalamitas } npc.aiStyle = 6; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; npc.chaseable = false; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.localAI[3]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[3]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.localAI[3] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[3] = reader.ReadSingle(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - projectile.penetrate = 1; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Mod mod = ModLoader.GetMod("CalamityMod"); Texture2D texture = mod.GetTexture("NPCs/SupremeCalamitas/SCalWormBodyAlt"); @@ -102,44 +102,44 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override bool CheckActive() - { - return false; - } + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { + public override void HitEffect(int hitDirection, double damage) + { if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index 17764f6cf2..cf5e96d6cc 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -1,27 +1,27 @@ -using System.IO; +using CalamityMod.World; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormBodyWeak : ModNPC - { + { public double damageTaken = 0.0; public int invinceTime = 360; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Heart"); - } + { + DisplayName.SetDefault("Brimstone Heart"); + } - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 14; - npc.height = 12; + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 14; + npc.height = 12; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) { @@ -29,40 +29,40 @@ namespace CalamityMod.NPCs.SupremeCalamitas } npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; + npc.knockBackResist = 0f; npc.takenDamageMultiplier = 1E-6f; npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; npc.chaseable = false; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[0] = reader.ReadSingle(); + } - public override void AI() + public override void AI() { if (Main.npc[(int)npc.ai[1]].alpha < 128) { @@ -94,22 +94,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - projectile.penetrate = 1; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 38523c07b7..a02757014c 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -1,15 +1,15 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormHead : ModNPC - { + { private const int minLength = 51; private const int maxLength = 52; private float speed = 10f; @@ -17,18 +17,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas private float passedVar = 0f; private bool TailSpawned = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sepulcher"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sepulcher"); + } - public override void SetDefaults() - { - npc.damage = 0; //150 - npc.npcSlots = 5f; - npc.width = 56; //324 - npc.height = 62; //216 - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 0; //150 + npc.npcSlots = 5f; + npc.width = 56; //324 + npc.height = 62; //216 + npc.defense = 0; npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) @@ -37,382 +37,382 @@ namespace CalamityMod.NPCs.SupremeCalamitas } npc.aiStyle = 6; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[0] = reader.ReadSingle(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } - public override void AI() - { - CalamityGlobalNPC.SCalWorm = npc.whoAmI; - if (!NPC.AnyNPCs(mod.NPCType("SCalWormHeart")) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength && num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBodyWeak"), npc.whoAmI); - Main.npc[lol].localAI[0] += passedVar; - passedVar += 36f; - } - else if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBody"), npc.whoAmI); - if (npc.localAI[0] % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - npc.localAI[0] = 1f; - } - else - { - npc.localAI[0] = 2f; - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormTail"), 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; - Previous = lol; - } - TailSpawned = true; - } - if (!npc.active && Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - npc.alpha += 5; - if (npc.alpha >= 255) - { - npc.alpha = 255; - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - else - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 400); //800 - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 600f; - } - else - { - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + public override void AI() + { + CalamityGlobalNPC.SCalWorm = npc.whoAmI; + if (!NPC.AnyNPCs(mod.NPCType("SCalWormHeart")) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength && num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBodyWeak"), npc.whoAmI); + Main.npc[lol].localAI[0] += passedVar; + passedVar += 36f; + } + else if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBody"), npc.whoAmI); + if (npc.localAI[0] % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + npc.localAI[0] = 1f; + } + else + { + npc.localAI[0] = 2f; + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormTail"), 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; + Previous = lol; + } + TailSpawned = true; + } + if (!npc.active && Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + npc.alpha += 5; + if (npc.alpha >= 255) + { + npc.alpha = 255; + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + else + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 400); //800 + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 600f; + } + else + { + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - projectile.penetrate = 1; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs index caedd2e967..8107a57148 100644 --- a/NPCs/SupremeCalamitas/SCalWormHeart.cs +++ b/NPCs/SupremeCalamitas/SCalWormHeart.cs @@ -1,23 +1,23 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormHeart : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Heart"); - } + { + DisplayName.SetDefault("Brimstone Heart"); + } - public override void SetDefaults() - { - npc.damage = 0; //70 - npc.width = 24; //324 - npc.height = 24; //216 - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 0; //70 + npc.width = 24; //324 + npc.height = 24; //216 + npc.defense = 0; npc.lifeMax = CalamityWorld.revenge ? 180000 : 160000; if (CalamityWorld.death) { @@ -29,18 +29,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas } npc.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } public override void AI() { @@ -66,13 +66,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override bool CheckActive() - { - return false; - } + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index b0c31f50fe..aab19b1618 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -1,25 +1,25 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sepulcher"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sepulcher"); + } - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 26; //324 - npc.height = 46; //216 - npc.defense = 0; + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 26; //324 + npc.height = 46; //216 + npc.defense = 0; npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) @@ -28,35 +28,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas } npc.aiStyle = 6; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; npc.chaseable = false; npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { + public override void AI() + { if (!Main.npc[(int)npc.ai[1]].active) { npc.life = 0; @@ -73,53 +73,53 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - projectile.penetrate = 1; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 640681492c..d314c8d139 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -1,93 +1,93 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { - public class SoulSeekerSupreme : ModNPC - { - private int timer = 0; - private bool start = true; + public class SoulSeekerSupreme : ModNPC + { + private int timer = 0; + private bool start = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Seeker"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Seeker"); + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 40; - npc.height = 40; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 0; - npc.defense = 80; + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 40; + npc.height = 40; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.damage = 0; + npc.defense = 80; npc.Calamity().RevPlusDR(0.35f); npc.lifeMax = Main.expertMode ? 90000 : 50000; if (CalamityWorld.revenge) { npc.lifeMax = CalamityWorld.death ? 100000 : 170000; } - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override bool PreAI() - { - bool expertMode = Main.expertMode; - if (start) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); - timer++; - if (timer > 180) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 150 : 200; //600 500 + public override bool PreAI() + { + bool expertMode = Main.expertMode; + if (start) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 9f; + npc.rotation = direction.ToRotation(); + timer++; + if (timer > 180) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = expertMode ? 150 : 200; //600 500 Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("BrimstoneBarrage"), damage, 1f, npc.target); - } - timer = 0; - } - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; + } + timer = 0; + } + if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("SupremeCalamitas"))]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 300; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 0.5f; //2 - return false; - } + return false; + } + Player player = Main.player[npc.target]; + NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("SupremeCalamitas"))]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 300; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 0.5f; //2 + return false; + } public override bool PreNPCLoot() { @@ -95,66 +95,66 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + { + cooldownSlot = 1; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 80f7211d4f..163401306f 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,382 +1,381 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.SupremeCalamitas { [AutoloadBossHead] - public class SupremeCalamitas : ModNPC - { - private float bossLife; - private float uDieLul = 1f; - private float passedVar = 0f; + public class SupremeCalamitas : ModNPC + { + private float bossLife; + private float uDieLul = 1f; + private float passedVar = 0f; - private bool protectionBoost = false; - private bool canDespawn = false; - private bool despawnProj = false; - private bool startText = false; - private bool startBattle = false; //100% - private bool startSecondAttack = false; //80% - private bool startThirdAttack = false; //60% - private bool halfLife = false; //40% - private bool startFourthAttack = false; //30% - private bool secondStage = false; //20% - private bool startFifthAttack = false; //10% - private bool gettingTired = false; //8% - private bool gettingTired2 = false; //6% - private bool gettingTired3 = false; //4% - private bool gettingTired4 = false; //2% - private bool gettingTired5 = false; //1% - private bool willCharge = false; - private bool canFireSplitingFireball = true; - private bool spawnArena = false; + private bool protectionBoost = false; + private bool canDespawn = false; + private bool despawnProj = false; + private bool startText = false; + private bool startBattle = false; //100% + private bool startSecondAttack = false; //80% + private bool startThirdAttack = false; //60% + private bool halfLife = false; //40% + private bool startFourthAttack = false; //30% + private bool secondStage = false; //20% + private bool startFifthAttack = false; //10% + private bool gettingTired = false; //8% + private bool gettingTired2 = false; //6% + private bool gettingTired3 = false; //4% + private bool gettingTired4 = false; //2% + private bool gettingTired5 = false; //1% + private bool willCharge = false; + private bool canFireSplitingFireball = true; + private bool spawnArena = false; - private int giveUpCounter = 1200; - private int lootTimer = 0; //900 * 5 = 4500 - private int phaseChange = 0; - private int spawnX = 0; - private int spawnX2 = 0; - private int spawnXReset = 0; - private int spawnXReset2 = 0; - private int spawnXAdd = 200; - private int spawnY = 0; - private int spawnYReset = 0; - private int spawnYAdd = 0; - private int bulletHellCounter = 0; - private int bulletHellCounter2 = 0; + private int giveUpCounter = 1200; + private int lootTimer = 0; //900 * 5 = 4500 + private int phaseChange = 0; + private int spawnX = 0; + private int spawnX2 = 0; + private int spawnXReset = 0; + private int spawnXReset2 = 0; + private int spawnXAdd = 200; + private int spawnY = 0; + private int spawnYReset = 0; + private int spawnYAdd = 0; + private int bulletHellCounter = 0; + private int bulletHellCounter2 = 0; - private Rectangle safeBox = default; + private Rectangle safeBox = default; public static float normalDR = 0.7f; public static float deathDR = 0.75f; public static float bossRushDR = 0.6f; public static float enragedDR = 0.99f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Calamitas"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Calamitas"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 350; - npc.npcSlots = 50f; - npc.width = 120; - npc.height = 120; - npc.defense = 120; + public override void SetDefaults() + { + npc.damage = 350; + npc.npcSlots = 50f; + npc.width = 120; + npc.height = 120; + npc.defense = 120; CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.bossRushActive ? bossRushDR : CalamityWorld.death ? deathDR : normalDR; global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.9f); global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); npc.value = Item.buyPrice(10, 0, 0, 0); - npc.lifeMax = CalamityWorld.revenge ? 5500000 : 5000000; - if (CalamityWorld.death) - { - npc.lifeMax = 6250000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 2100000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.boss = true; - npc.canGhostHeal = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCG"); - else - music = MusicID.Boss2; - } + npc.lifeMax = CalamityWorld.revenge ? 5500000 : 5000000; + if (CalamityWorld.death) + { + npc.lifeMax = 6250000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2300000 : 2100000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.boss = true; + npc.canGhostHeal = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCG"); + else + music = MusicID.Boss2; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(protectionBoost); - writer.Write(canDespawn); - writer.Write(despawnProj); - writer.Write(startText); - writer.Write(startBattle); - writer.Write(startSecondAttack); - writer.Write(startThirdAttack); - writer.Write(startFourthAttack); - writer.Write(startFifthAttack); - writer.Write(halfLife); - writer.Write(secondStage); - writer.Write(gettingTired); - writer.Write(gettingTired2); - writer.Write(gettingTired3); - writer.Write(gettingTired4); - writer.Write(gettingTired5); - writer.Write(willCharge); - writer.Write(canFireSplitingFireball); - writer.Write(spawnArena); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(protectionBoost); + writer.Write(canDespawn); + writer.Write(despawnProj); + writer.Write(startText); + writer.Write(startBattle); + writer.Write(startSecondAttack); + writer.Write(startThirdAttack); + writer.Write(startFourthAttack); + writer.Write(startFifthAttack); + writer.Write(halfLife); + writer.Write(secondStage); + writer.Write(gettingTired); + writer.Write(gettingTired2); + writer.Write(gettingTired3); + writer.Write(gettingTired4); + writer.Write(gettingTired5); + writer.Write(willCharge); + writer.Write(canFireSplitingFireball); + writer.Write(spawnArena); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); - writer.Write(giveUpCounter); - writer.Write(lootTimer); - writer.Write(phaseChange); - writer.Write(spawnX); - writer.Write(spawnX2); - writer.Write(spawnXReset); - writer.Write(spawnXReset2); - writer.Write(spawnXAdd); - writer.Write(spawnY); - writer.Write(spawnYReset); - writer.Write(spawnYAdd); - writer.Write(bulletHellCounter); - writer.Write(bulletHellCounter2); - } + writer.Write(giveUpCounter); + writer.Write(lootTimer); + writer.Write(phaseChange); + writer.Write(spawnX); + writer.Write(spawnX2); + writer.Write(spawnXReset); + writer.Write(spawnXReset2); + writer.Write(spawnXAdd); + writer.Write(spawnY); + writer.Write(spawnYReset); + writer.Write(spawnYAdd); + writer.Write(bulletHellCounter); + writer.Write(bulletHellCounter2); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - protectionBoost = reader.ReadBoolean(); - canDespawn = reader.ReadBoolean(); - despawnProj = reader.ReadBoolean(); - startText = reader.ReadBoolean(); - startBattle = reader.ReadBoolean(); - startSecondAttack = reader.ReadBoolean(); - startThirdAttack = reader.ReadBoolean(); - startFourthAttack = reader.ReadBoolean(); - startFifthAttack = reader.ReadBoolean(); - halfLife = reader.ReadBoolean(); - secondStage = reader.ReadBoolean(); - gettingTired = reader.ReadBoolean(); - gettingTired2 = reader.ReadBoolean(); - gettingTired3 = reader.ReadBoolean(); - gettingTired4 = reader.ReadBoolean(); - gettingTired5 = reader.ReadBoolean(); - willCharge = reader.ReadBoolean(); - canFireSplitingFireball = reader.ReadBoolean(); - spawnArena = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + public override void ReceiveExtraAI(BinaryReader reader) + { + protectionBoost = reader.ReadBoolean(); + canDespawn = reader.ReadBoolean(); + despawnProj = reader.ReadBoolean(); + startText = reader.ReadBoolean(); + startBattle = reader.ReadBoolean(); + startSecondAttack = reader.ReadBoolean(); + startThirdAttack = reader.ReadBoolean(); + startFourthAttack = reader.ReadBoolean(); + startFifthAttack = reader.ReadBoolean(); + halfLife = reader.ReadBoolean(); + secondStage = reader.ReadBoolean(); + gettingTired = reader.ReadBoolean(); + gettingTired2 = reader.ReadBoolean(); + gettingTired3 = reader.ReadBoolean(); + gettingTired4 = reader.ReadBoolean(); + gettingTired5 = reader.ReadBoolean(); + willCharge = reader.ReadBoolean(); + canFireSplitingFireball = reader.ReadBoolean(); + spawnArena = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); - giveUpCounter = reader.ReadInt32(); - lootTimer = reader.ReadInt32(); - phaseChange = reader.ReadInt32(); - spawnX = reader.ReadInt32(); - spawnX2 = reader.ReadInt32(); - spawnXReset = reader.ReadInt32(); - spawnXReset2 = reader.ReadInt32(); - spawnXAdd = reader.ReadInt32(); - spawnY = reader.ReadInt32(); - spawnYReset = reader.ReadInt32(); - spawnYAdd = reader.ReadInt32(); - bulletHellCounter = reader.ReadInt32(); - bulletHellCounter2 = reader.ReadInt32(); - } + giveUpCounter = reader.ReadInt32(); + lootTimer = reader.ReadInt32(); + phaseChange = reader.ReadInt32(); + spawnX = reader.ReadInt32(); + spawnX2 = reader.ReadInt32(); + spawnXReset = reader.ReadInt32(); + spawnXReset2 = reader.ReadInt32(); + spawnXAdd = reader.ReadInt32(); + spawnY = reader.ReadInt32(); + spawnYReset = reader.ReadInt32(); + spawnYAdd = reader.ReadInt32(); + bulletHellCounter = reader.ReadInt32(); + bulletHellCounter2 = reader.ReadInt32(); + } - public override void AI() - { - #region StartUp - CalamityGlobalNPC.SCal = npc.whoAmI; - lootTimer++; + public override void AI() + { + #region StartUp + CalamityGlobalNPC.SCal = npc.whoAmI; + lootTimer++; - bool wormAlive = false; - if (CalamityGlobalNPC.SCalWorm != -1) - { - wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active; - } - bool cataclysmAlive = false; - if (CalamityGlobalNPC.SCalCataclysm != -1) - { - cataclysmAlive = Main.npc[CalamityGlobalNPC.SCalCataclysm].active; - } - bool catastropheAlive = false; - if (CalamityGlobalNPC.SCalCatastrophe != -1) - { - catastropheAlive = Main.npc[CalamityGlobalNPC.SCalCatastrophe].active; - } + bool wormAlive = false; + if (CalamityGlobalNPC.SCalWorm != -1) + { + wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active; + } + bool cataclysmAlive = false; + if (CalamityGlobalNPC.SCalCataclysm != -1) + { + cataclysmAlive = Main.npc[CalamityGlobalNPC.SCalCataclysm].active; + } + bool catastropheAlive = false; + if (CalamityGlobalNPC.SCalCatastrophe != -1) + { + catastropheAlive = Main.npc[CalamityGlobalNPC.SCalCatastrophe].active; + } - if (Main.slimeRain) - { - Main.StopSlimeRain(true); - CalamityMod.UpdateServerBoolean(); - } + if (Main.slimeRain) + { + Main.StopSlimeRain(true); + CalamityMod.UpdateServerBoolean(); + } CalamityMod.StopRain(); - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - Player player = Main.player[npc.target]; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + Player player = Main.player[npc.target]; - if (!startText) - { - if (Main.LocalPlayer.Calamity().sCalKillCount == 4) - { - string key = "Mods.CalamityMod.SupremeBossText12"; //kill SCal 4 times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (Main.LocalPlayer.Calamity().sCalKillCount == 1) - { - string key = "Mods.CalamityMod.SupremeBossText11"; //kill SCal once - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (Main.LocalPlayer.Calamity().sCalDeathCount < 51) - { - if (Main.LocalPlayer.Calamity().sCalDeathCount == 50) - { - string key = "Mods.CalamityMod.SupremeBossText15"; //die 50 or more times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (Main.LocalPlayer.Calamity().sCalDeathCount > 19) - { - string key = "Mods.CalamityMod.SupremeBossText14"; //die 20 or more times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (Main.LocalPlayer.Calamity().sCalDeathCount > 4) - { - string key = "Mods.CalamityMod.SupremeBossText13"; //die 5 or more times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - startText = true; - } - #endregion - #region ArenaCreation - if (!spawnArena) - { - spawnArena = true; - Vector2 vectorPlayer = new Vector2(player.position.X, player.position.Y); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1000f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1000f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1000f); - safeBox.Width = 2000; - safeBox.Height = 2000; - spawnYAdd = 100; - } - else - { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1250f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1250f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1250f); - safeBox.Width = 2500; - safeBox.Height = 2500; - spawnYAdd = 125; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; - int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; - int num54 = safeBox.Width / 2 / 16 + 1; - for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) - { - for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) - { - if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) - { - Main.tile[num55, num56].type = (ushort)mod.TileType("ArenaTile"); - Main.tile[num55, num56].active(true); - } - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, num55, num56, 1, TileChangeType.None); - } - else - { - WorldGen.SquareTileFrame(num55, num56, true); - } - } - } - } - } + if (!startText) + { + if (Main.LocalPlayer.Calamity().sCalKillCount == 4) + { + string key = "Mods.CalamityMod.SupremeBossText12"; //kill SCal 4 times + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (Main.LocalPlayer.Calamity().sCalKillCount == 1) + { + string key = "Mods.CalamityMod.SupremeBossText11"; //kill SCal once + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (Main.LocalPlayer.Calamity().sCalDeathCount < 51) + { + if (Main.LocalPlayer.Calamity().sCalDeathCount == 50) + { + string key = "Mods.CalamityMod.SupremeBossText15"; //die 50 or more times + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (Main.LocalPlayer.Calamity().sCalDeathCount > 19) + { + string key = "Mods.CalamityMod.SupremeBossText14"; //die 20 or more times + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (Main.LocalPlayer.Calamity().sCalDeathCount > 4) + { + string key = "Mods.CalamityMod.SupremeBossText13"; //die 5 or more times + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + startText = true; + } + #endregion + #region ArenaCreation + if (!spawnArena) + { + spawnArena = true; + Vector2 vectorPlayer = new Vector2(player.position.X, player.position.Y); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1000f); + spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1000f); + safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1000f); + safeBox.Width = 2000; + safeBox.Height = 2000; + spawnYAdd = 100; + } + else + { + safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1250f); + spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1250f); + safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1250f); + safeBox.Width = 2500; + safeBox.Height = 2500; + spawnYAdd = 125; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; + int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; + int num54 = safeBox.Width / 2 / 16 + 1; + for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) + { + for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) + { + if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) + { + Main.tile[num55, num56].type = (ushort)mod.TileType("ArenaTile"); + Main.tile[num55, num56].active(true); + } + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, num55, num56, 1, TileChangeType.None); + } + else + { + WorldGen.SquareTileFrame(num55, num56, true); + } + } + } + } + } #endregion #region Enrage and DR if (!player.Hitbox.Intersects(safeBox)) - { - if (uDieLul < 3f) - { - uDieLul *= 1.01f; - } - else if (uDieLul > 3f) - { - uDieLul = 3f; - } - protectionBoost = true; - } - else - { - if (uDieLul > 1f) - { - uDieLul *= 0.99f; - } - else if (uDieLul < 1f) - { - uDieLul = 1f; - } - protectionBoost = false; - } + { + if (uDieLul < 3f) + { + uDieLul *= 1.01f; + } + else if (uDieLul > 3f) + { + uDieLul = 3f; + } + protectionBoost = true; + } + else + { + if (uDieLul > 1f) + { + uDieLul *= 0.99f; + } + else if (uDieLul < 1f) + { + uDieLul = 1f; + } + protectionBoost = false; + } // Set DR to be 99% and unbreakable if enraged. Boost DR during the 5th attack. CalamityGlobalNPC global = npc.Calamity(); - if(protectionBoost) + if (protectionBoost) { global.DR = enragedDR; global.unbreakableDR = true; @@ -388,1611 +387,1723 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (startFifthAttack) global.DR *= 1.2f; } - #endregion - #region Despawn - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -50f); - canDespawn = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - canDespawn = false; - } - #endregion - #region FirstAttack - if (bulletHellCounter2 < 900) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = player.Center.X - vector92.X; - float num741 = player.Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4 : 6)) - { - bulletHellCounter = 0; - int damage = expertMode ? 200 : 250; //800 500 - if (bulletHellCounter2 < 300) //blasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 600) //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from above, left, and right - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - else if (!startBattle) - { - string key = "Mods.CalamityMod.SupremeBossText3"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - spawnY += 250; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - spawnY -= 50; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); - } - startBattle = true; - } - #endregion - #region SecondAttack - if (bulletHellCounter2 < 1800 && startSecondAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = player.Center.X - vector92.X; - float num741 = player.Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 150 : 200; //600 400 - if (bulletHellCounter2 < 1200) - { - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) - { - if (bulletHellCounter2 % 180 == 0) //blasts from right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -5f * uDieLul, 0f, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (bulletHellCounter2 > 1500) - { - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 7 : 9)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 1200) //blasts from below - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 1500) //blasts from left - { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from left and right - { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startSecondAttack && ((double)npc.life <= (double)npc.lifeMax * 0.75)) - { - string key = "Mods.CalamityMod.SupremeBossText4"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - startSecondAttack = true; - return; - } - #endregion - #region ThirdAttack - if (bulletHellCounter2 < 2700 && startThirdAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = player.Center.X - vector92.X; - float num741 = player.Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 240 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9 : 11)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 2100) //blasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 2400) //blasts from right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startThirdAttack && ((double)npc.life <= (double)npc.lifeMax * 0.5)) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCL"); - else - music = MusicID.Boss3; - string key = "Mods.CalamityMod.SupremeBossText5"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - startThirdAttack = true; - return; - } - #endregion - #region FourthAttack - if (bulletHellCounter2 < 3600 && startFourthAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = player.Center.X - vector92.X; - float num741 = player.Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) //more clustered attack - { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 240 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); - } - if (bulletHellCounter2 % 450 == 0) //giant homing fireballs - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); - passedVar += 1f; - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 13 : 15)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 3000) //blasts from below - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 3300) //blasts from left - { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startFourthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.3)) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCE"); - else - music = MusicID.LunarBoss; - string key = "Mods.CalamityMod.SupremeBossText7"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - startFourthAttack = true; - return; - } - #endregion - #region FifthAttack - if (bulletHellCounter2 < 4500 && startFifthAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = player.Center.X - vector92.X; - float num741 = player.Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 240 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 360 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); - } - if (bulletHellCounter2 % 450 == 0) //giant homing fireballs - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); - passedVar += 1f; - } - if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-500, 500), -10f * uDieLul, 0f, mod.ProjectileType("BrimstoneWave"), damage, 0f, Main.myPlayer, 0f, 0f); - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 16 : 18)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 3900) //blasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 4200) //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from above, left, and right - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startFifthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.1)) - { - string key = "Mods.CalamityMod.SupremeBossText9"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - startFifthAttack = true; - return; - } - #endregion - #region EndSections - if (startFifthAttack) - { - if (gettingTired5) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCA"); - else - music = MusicID.Eerie; - npc.noGravity = false; - npc.noTileCollide = false; - npc.damage = 0; - npc.velocity.X *= 0.98f; - Vector2 vector2 = new Vector2(npc.Center.X, npc.Center.Y); - float num = player.Center.X - vector2.X; - float num1 = player.Center.Y - vector2.Y; - npc.rotation = (float)Math.Atan2((double)num1, (double)num) - 1.57f; - if (CalamityWorld.downedSCal) //after first time you kill her - { - if (giveUpCounter == 900) - { - string key = "Mods.CalamityMod.SupremeBossText27"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - giveUpCounter--; - npc.chaseable = (giveUpCounter < 900) ? true : false; - npc.dontTakeDamage = (giveUpCounter < 900) ? false : true; - return; - } - if (giveUpCounter == 600) - { - string key = "Mods.CalamityMod.SupremeBossText25"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (giveUpCounter == 300) - { - string key = "Mods.CalamityMod.SupremeBossText26"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (giveUpCounter <= 0) - { - npc.chaseable = true; - npc.dontTakeDamage = false; - return; - } - giveUpCounter--; - npc.chaseable = false; - npc.dontTakeDamage = true; - return; - } - if (!gettingTired5 && ((double)npc.life <= (double)npc.lifeMax * 0.01)) - { - string key = "Mods.CalamityMod.SupremeBossText24"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - gettingTired5 = true; - return; - } - else if (!gettingTired4 && ((double)npc.life <= (double)npc.lifeMax * 0.02)) - { - string key = "Mods.CalamityMod.SupremeBossText23"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - gettingTired4 = true; - return; - } - else if (!gettingTired3 && ((double)npc.life <= (double)npc.lifeMax * 0.04)) - { - string key = "Mods.CalamityMod.SupremeBossText22"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - gettingTired3 = true; - return; - } - else if (!gettingTired2 && ((double)npc.life <= (double)npc.lifeMax * 0.06)) - { - string key = "Mods.CalamityMod.SupremeBossText21"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - gettingTired2 = true; - return; - } - else if (!gettingTired && ((double)npc.life <= (double)npc.lifeMax * 0.08)) - { - string key = "Mods.CalamityMod.SupremeBossText20"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - spawnY += 250; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - spawnY -= 50; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); - } - gettingTired = true; - return; - } - } - #endregion - #region DespawnProjectiles - if (bulletHellCounter2 % 900 == 0 && despawnProj) - { - int proj; - for (int x = 0; x < 1000; x = proj + 1) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == mod.ProjectileType("BrimstoneHellblast2") || - projectile.type == mod.ProjectileType("BrimstoneBarrage") || - projectile.type == mod.ProjectileType("BrimstoneWave")) - { - projectile.Kill(); - } - else if (projectile.type == mod.ProjectileType("BrimstoneGigaBlast") || - projectile.type == mod.ProjectileType("BrimstoneFireblast")) - { - projectile.active = false; - } - } - proj = x; - } - despawnProj = false; - } - #endregion - #region TransformSeekerandBrotherTriggers - if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.4)) - { - string key = "Mods.CalamityMod.SupremeBossText"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - halfLife = true; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.2) - { - if (secondStage == false) - { - string key = "Mods.CalamityMod.SupremeBossText8"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 20; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 18) * 300)), (int)(npc.Center.Y + (Math.Cos(I * 18) * 300)), mod.NPCType("SoulSeekerSupreme"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 18; - Eye.ai[3] = I * 18; - } - } - secondStage = true; - } - } - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)((double)npc.lifeMax * 0.55); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCataclysm")); - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCatastrophe")); - string key = "Mods.CalamityMod.SupremeBossText6"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - return; - } - } - } - #endregion - #region TargetandRotation - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; - if (num803 < 0f) - { - num803 += 6.283f; - } - else if ((double)num803 > 6.283) - { - num803 -= 6.283f; - } - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((double)(num803 - npc.rotation) > 3.1415) - { - npc.rotation -= num804; - } - else - { - npc.rotation += num804; - } - } - else if (npc.rotation > num803) - { - if ((double)(npc.rotation - num803) > 3.1415) - { - npc.rotation += num804; - } - else - { - npc.rotation -= num804; - } - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - #endregion - #region FirstStage - if (npc.ai[0] == 0f) - { - npc.damage = npc.defDamage; - if (wormAlive) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - if (cataclysmAlive || catastropheAlive) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.damage = 0; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = player.Center.X - vector92.X; - float num741 = player.Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - return; - } - else - { - npc.dontTakeDamage = false; - npc.chaseable = true; - } - } - if (npc.ai[1] == 0f) - { - float num823 = 12f; - float num824 = 0.12f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 90f) - { - npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - int num829 = expertMode ? 150 : 200; //600 400 - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; - int randomShot = Main.rand.Next(6); //0 to 5 - if (randomShot == 0 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneFireblast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneGigaBlast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else - { - canFireSplitingFireball = true; - randomShot = mod.ProjectileType("BrimstoneBarrage"); - for (int num186 = 1; num186 <= 8; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - } - return; - } - } - } - else if (npc.ai[1] == 1f) - { - npc.rotation = num803; //change - float num383 = wormAlive ? 26f : 30f; - if ((double)npc.life < (double)npc.lifeMax * 0.95) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.85) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.7) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.6) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num383 += 1f; - } - Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num384 = player.position.X + (float)(player.width / 2) - vector37.X; - float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); - num386 = num383 / num386; - npc.velocity.X = num384 * num386; - npc.velocity.Y = num385 * num386; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) - { - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.Y = npc.velocity.Y * 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num803; - if (npc.ai[3] >= 2f) - { - npc.ai[1] = -1f; - } - else - { - npc.ai[1] = 1f; - } - } - } - else if (npc.ai[1] == 3f) - { - npc.TargetClosest(true); - float num412 = 32f; - float num413 = 1.2f; - int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num414 = -1; - } - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; - if (npc.velocity.X < num415) - { - npc.velocity.X = npc.velocity.X + num413; - if (npc.velocity.X < 0f && num415 > 0f) - { - npc.velocity.X = npc.velocity.X + num413; - } - } - else if (npc.velocity.X > num415) - { - npc.velocity.X = npc.velocity.X - num413; - if (npc.velocity.X > 0f && num415 < 0f) - { - npc.velocity.X = npc.velocity.X - num413; - } - } - if (npc.velocity.Y < num416) - { - npc.velocity.Y = npc.velocity.Y + num413; - if (npc.velocity.Y < 0f && num416 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num413; - } - } - else if (npc.velocity.Y > num416) - { - npc.velocity.Y = npc.velocity.Y - num413; - if (npc.velocity.Y > 0f && num416 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num413; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 480f) - { - npc.ai[1] = -1f; - npc.target = 255; - npc.netUpdate = true; - } - else - { - if (!player.dead) - { - npc.ai[3] += wormAlive ? 0.5f : 1f; - } - if (npc.ai[3] >= 20f) - { - npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num418 = 10f * uDieLul; - int num419 = expertMode ? 150 : 200; //600 500 - int num420 = mod.ProjectileType("BrimstoneHellblast"); - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.ai[1] == 4f) - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num831 = -1; - } - float num832 = 32f; - float num833 = 1.2f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - { - npc.velocity.X = npc.velocity.X + num833; - } - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - { - npc.velocity.X = npc.velocity.X - num833; - } - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num833; - } - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num833; - } - } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 140f) - { - npc.localAI[1] = 0f; - float num837 = 5f * uDieLul; - int num838 = expertMode ? 150 : 200; //600 500 - int num839 = mod.ProjectileType("BrimstoneFireblast"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - return; - } - } - if (npc.ai[1] == -1f) - { - phaseChange++; - if (phaseChange > 23) - { - phaseChange = 0; - } - int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts - switch (phaseChange) - { - case 0: phase = 0; willCharge = false; break; //0341 - case 1: phase = 3; break; - case 2: phase = 4; willCharge = true; break; - case 3: phase = 1; break; - case 4: phase = 1; break; //1430 - case 5: phase = 4; willCharge = false; break; - case 6: phase = 3; break; - case 7: phase = 0; willCharge = true; break; - case 8: phase = 1; break; //1034 - case 9: phase = 0; willCharge = false; break; - case 10: phase = 3; break; - case 11: phase = 4; break; - case 12: phase = 4; break; //4310 - case 13: phase = 3; willCharge = true; break; - case 14: phase = 1; break; - case 15: phase = 0; willCharge = false; break; - case 16: phase = 4; break; //4411 - case 17: phase = 4; willCharge = true; break; - case 18: phase = 1; break; - case 19: phase = 1; break; - case 20: phase = 0; break; //0101 - case 21: phase = 1; break; - case 22: phase = 0; break; - case 23: phase = 1; break; - } - npc.ai[1] = (float)phase; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - if ((double)npc.life < (double)npc.lifeMax * 0.4) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - #endregion - #region Transition - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - { - npc.ai[2] = 0.5f; - } - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - { - npc.ai[2] = 0f; - } - } - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - for (int num388 = 0; num388 < 50; num388++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - } - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - } - Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.Y = npc.velocity.Y * 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - return; - } - } - #endregion - #region LastStage - else - { - npc.damage = npc.defDamage; - if (wormAlive) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - if (NPC.AnyNPCs(mod.NPCType("SoulSeekerSupreme"))) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - npc.dontTakeDamage = false; - npc.chaseable = true; - } - } - if (npc.ai[1] == 0f) - { - float num823 = 12f; - float num824 = 0.12f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 240f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 60f) - { - npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - int num829 = expertMode ? 150 : 200; //600 500 - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; - int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneFireblast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneGigaBlast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else - { - canFireSplitingFireball = true; - randomShot = mod.ProjectileType("BrimstoneBarrage"); - for (int num186 = 1; num186 <= 8; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - } - return; - } - } - } - else if (npc.ai[1] == 1f) - { - npc.rotation = num803; //change - float num383 = wormAlive ? 31f : 35f; - if ((double)npc.life < (double)npc.lifeMax * 0.3) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.2) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num383 += 1f; - } - Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num384 = player.position.X + (float)(player.width / 2) - vector37.X; - float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); - num386 = num383 / num386; - npc.velocity.X = num384 * num386; - npc.velocity.Y = num385 * num386; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) - { - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.Y = npc.velocity.Y * 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num803; //change - if (npc.ai[3] >= 1f) - { - npc.ai[1] = -1f; - } - else - { - npc.ai[1] = 1f; - } - } - } - else if (npc.ai[1] == 3f) - { - npc.TargetClosest(true); - float num412 = 32f; - float num413 = 1.2f; - int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num414 = -1; - } - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; - if (npc.velocity.X < num415) - { - npc.velocity.X = npc.velocity.X + num413; - if (npc.velocity.X < 0f && num415 > 0f) - { - npc.velocity.X = npc.velocity.X + num413; - } - } - else if (npc.velocity.X > num415) - { - npc.velocity.X = npc.velocity.X - num413; - if (npc.velocity.X > 0f && num415 < 0f) - { - npc.velocity.X = npc.velocity.X - num413; - } - } - if (npc.velocity.Y < num416) - { - npc.velocity.Y = npc.velocity.Y + num413; - if (npc.velocity.Y < 0f && num416 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num413; - } - } - else if (npc.velocity.Y > num416) - { - npc.velocity.Y = npc.velocity.Y - num413; - if (npc.velocity.Y > 0f && num416 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num413; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = -1f; - npc.target = 255; - npc.netUpdate = true; - } - else - { - if (!player.dead) - { - npc.ai[3] += wormAlive ? 0.5f : 1f; - } - if (npc.ai[3] >= 24f) - { - npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num418 = 10f * uDieLul; - int num419 = expertMode ? 150 : 200; //600 500 - int num420 = mod.ProjectileType("BrimstoneHellblast"); - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.ai[1] == 4f) - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num831 = -1; - } - float num832 = 32f; - float num833 = 1.2f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - { - npc.velocity.X = npc.velocity.X + num833; - } - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - { - npc.velocity.X = npc.velocity.X - num833; - } - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num833; - } - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num833; - } - } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 100f) - { - npc.localAI[1] = 0f; - float num837 = 5f * uDieLul; - int num838 = expertMode ? 150 : 200; //600 500 - int num839 = mod.ProjectileType("BrimstoneFireblast"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; - int shot = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 240f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - return; - } - } - if (npc.ai[1] == -1f) - { - phaseChange++; - if (phaseChange > 23) - { - phaseChange = 0; - } - int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts - switch (phaseChange) - { - case 0: phase = 0; willCharge = false; break; //0341 - case 1: phase = 3; break; - case 2: phase = 4; willCharge = true; break; - case 3: phase = 1; break; - case 4: phase = 1; break; //1430 - case 5: phase = 4; willCharge = false; break; - case 6: phase = 3; break; - case 7: phase = 0; willCharge = true; break; - case 8: phase = 1; break; //1034 - case 9: phase = 0; willCharge = false; break; - case 10: phase = 3; break; - case 11: phase = 4; break; - case 12: phase = 4; break; //4310 - case 13: phase = 3; willCharge = true; break; - case 14: phase = 1; break; - case 15: phase = 0; willCharge = false; break; - case 16: phase = 4; break; //4411 - case 17: phase = 4; willCharge = true; break; - case 18: phase = 1; break; - case 19: phase = 1; break; - case 20: phase = 0; break; //0101 - case 21: phase = 1; break; - case 22: phase = 0; break; - case 23: phase = 1; break; - } - npc.ai[1] = (float)phase; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - } - #endregion - } + #endregion + #region Despawn + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -50f); + canDespawn = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + canDespawn = false; + } + #endregion + #region FirstAttack + if (bulletHellCounter2 < 900) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = player.Center.X - vector92.X; + float num741 = player.Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4 : 6)) + { + bulletHellCounter = 0; + int damage = expertMode ? 200 : 250; //800 500 + if (bulletHellCounter2 < 300) //blasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 600) //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from above, left, and right + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + else if (!startBattle) + { + string key = "Mods.CalamityMod.SupremeBossText3"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + spawnY += 250; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + spawnY -= 50; + } + for (int x = 0; x < 5; x++) + { + NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX += spawnXAdd; + NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX2 -= spawnXAdd; + spawnY += spawnYAdd; + } + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); + } + startBattle = true; + } + #endregion + #region SecondAttack + if (bulletHellCounter2 < 1800 && startSecondAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = player.Center.X - vector92.X; + float num741 = player.Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = expertMode ? 150 : 200; //600 400 + if (bulletHellCounter2 < 1200) + { + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) + { + if (bulletHellCounter2 % 180 == 0) //blasts from right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -5f * uDieLul, 0f, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (bulletHellCounter2 > 1500) + { + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 7 : 9)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 1200) //blasts from below + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 1500) //blasts from left + { + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from left and right + { + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startSecondAttack && ((double)npc.life <= (double)npc.lifeMax * 0.75)) + { + string key = "Mods.CalamityMod.SupremeBossText4"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + startSecondAttack = true; + return; + } + #endregion + #region ThirdAttack + if (bulletHellCounter2 < 2700 && startThirdAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = player.Center.X - vector92.X; + float num741 = player.Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = expertMode ? 150 : 200; + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (bulletHellCounter2 % 240 == 0) //fireblasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9 : 11)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 2100) //blasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 2400) //blasts from right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startThirdAttack && ((double)npc.life <= (double)npc.lifeMax * 0.5)) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCL"); + else + music = MusicID.Boss3; + string key = "Mods.CalamityMod.SupremeBossText5"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + startThirdAttack = true; + return; + } + #endregion + #region FourthAttack + if (bulletHellCounter2 < 3600 && startFourthAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = player.Center.X - vector92.X; + float num741 = player.Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) //more clustered attack + { + int damage = expertMode ? 150 : 200; + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (bulletHellCounter2 % 240 == 0) //fireblasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); + } + if (bulletHellCounter2 % 450 == 0) //giant homing fireballs + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); + passedVar += 1f; + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 13 : 15)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 3000) //blasts from below + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 3300) //blasts from left + { + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startFourthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.3)) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCE"); + else + music = MusicID.LunarBoss; + string key = "Mods.CalamityMod.SupremeBossText7"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + startFourthAttack = true; + return; + } + #endregion + #region FifthAttack + if (bulletHellCounter2 < 4500 && startFifthAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = player.Center.X - vector92.X; + float num741 = player.Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = expertMode ? 150 : 200; + if (bulletHellCounter2 % 240 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (bulletHellCounter2 % 360 == 0) //fireblasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); + } + if (bulletHellCounter2 % 450 == 0) //giant homing fireballs + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); + passedVar += 1f; + } + if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-500, 500), -10f * uDieLul, 0f, mod.ProjectileType("BrimstoneWave"), damage, 0f, Main.myPlayer, 0f, 0f); + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 16 : 18)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 3900) //blasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 4200) //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from above, left, and right + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startFifthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.1)) + { + string key = "Mods.CalamityMod.SupremeBossText9"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + startFifthAttack = true; + return; + } + #endregion + #region EndSections + if (startFifthAttack) + { + if (gettingTired5) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCA"); + else + music = MusicID.Eerie; + npc.noGravity = false; + npc.noTileCollide = false; + npc.damage = 0; + npc.velocity.X *= 0.98f; + Vector2 vector2 = new Vector2(npc.Center.X, npc.Center.Y); + float num = player.Center.X - vector2.X; + float num1 = player.Center.Y - vector2.Y; + npc.rotation = (float)Math.Atan2((double)num1, (double)num) - 1.57f; + if (CalamityWorld.downedSCal) //after first time you kill her + { + if (giveUpCounter == 900) + { + string key = "Mods.CalamityMod.SupremeBossText27"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + giveUpCounter--; + npc.chaseable = (giveUpCounter < 900) ? true : false; + npc.dontTakeDamage = (giveUpCounter < 900) ? false : true; + return; + } + if (giveUpCounter == 600) + { + string key = "Mods.CalamityMod.SupremeBossText25"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (giveUpCounter == 300) + { + string key = "Mods.CalamityMod.SupremeBossText26"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (giveUpCounter <= 0) + { + npc.chaseable = true; + npc.dontTakeDamage = false; + return; + } + giveUpCounter--; + npc.chaseable = false; + npc.dontTakeDamage = true; + return; + } + if (!gettingTired5 && ((double)npc.life <= (double)npc.lifeMax * 0.01)) + { + string key = "Mods.CalamityMod.SupremeBossText24"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + gettingTired5 = true; + return; + } + else if (!gettingTired4 && ((double)npc.life <= (double)npc.lifeMax * 0.02)) + { + string key = "Mods.CalamityMod.SupremeBossText23"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + gettingTired4 = true; + return; + } + else if (!gettingTired3 && ((double)npc.life <= (double)npc.lifeMax * 0.04)) + { + string key = "Mods.CalamityMod.SupremeBossText22"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + gettingTired3 = true; + return; + } + else if (!gettingTired2 && ((double)npc.life <= (double)npc.lifeMax * 0.06)) + { + string key = "Mods.CalamityMod.SupremeBossText21"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + gettingTired2 = true; + return; + } + else if (!gettingTired && ((double)npc.life <= (double)npc.lifeMax * 0.08)) + { + string key = "Mods.CalamityMod.SupremeBossText20"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + spawnY += 250; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + spawnY -= 50; + } + for (int x = 0; x < 5; x++) + { + NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX += spawnXAdd; + NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX2 -= spawnXAdd; + spawnY += spawnYAdd; + } + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); + } + gettingTired = true; + return; + } + } + #endregion + #region DespawnProjectiles + if (bulletHellCounter2 % 900 == 0 && despawnProj) + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == mod.ProjectileType("BrimstoneHellblast2") || + projectile.type == mod.ProjectileType("BrimstoneBarrage") || + projectile.type == mod.ProjectileType("BrimstoneWave")) + { + projectile.Kill(); + } + else if (projectile.type == mod.ProjectileType("BrimstoneGigaBlast") || + projectile.type == mod.ProjectileType("BrimstoneFireblast")) + { + projectile.active = false; + } + } + proj = x; + } + despawnProj = false; + } + #endregion + #region TransformSeekerandBrotherTriggers + if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.4)) + { + string key = "Mods.CalamityMod.SupremeBossText"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + halfLife = true; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.2) + { + if (secondStage == false) + { + string key = "Mods.CalamityMod.SupremeBossText8"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 20; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 18) * 300)), (int)(npc.Center.Y + (Math.Cos(I * 18) * 300)), mod.NPCType("SoulSeekerSupreme"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 18; + Eye.ai[3] = I * 18; + } + } + secondStage = true; + } + } + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)((double)npc.lifeMax * 0.55); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCataclysm")); + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCatastrophe")); + string key = "Mods.CalamityMod.SupremeBossText6"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + return; + } + } + } + #endregion + #region TargetandRotation + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; + if (num803 < 0f) + { + num803 += 6.283f; + } + else if ((double)num803 > 6.283) + { + num803 -= 6.283f; + } + float num804 = 0.1f; + if (npc.rotation < num803) + { + if ((double)(num803 - npc.rotation) > 3.1415) + { + npc.rotation -= num804; + } + else + { + npc.rotation += num804; + } + } + else if (npc.rotation > num803) + { + if ((double)(npc.rotation - num803) > 3.1415) + { + npc.rotation += num804; + } + else + { + npc.rotation -= num804; + } + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + #endregion + #region FirstStage + if (npc.ai[0] == 0f) + { + npc.damage = npc.defDamage; + if (wormAlive) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + if (cataclysmAlive || catastropheAlive) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.damage = 0; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = player.Center.X - vector92.X; + float num741 = player.Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + return; + } + else + { + npc.dontTakeDamage = false; + npc.chaseable = true; + } + } + if (npc.ai[1] == 0f) + { + float num823 = 12f; + float num824 = 0.12f; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 90f) + { + npc.localAI[1] = 0f; + float num828 = 10f * uDieLul; + int num829 = expertMode ? 150 : 200; //600 400 + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; + int randomShot = Main.rand.Next(6); //0 to 5 + if (randomShot == 0 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneFireblast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else if (randomShot == 1 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneGigaBlast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else + { + canFireSplitingFireball = true; + randomShot = mod.ProjectileType("BrimstoneBarrage"); + for (int num186 = 1; num186 <= 8; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + } + return; + } + } + } + else if (npc.ai[1] == 1f) + { + npc.rotation = num803; //change + float num383 = wormAlive ? 26f : 30f; + if ((double)npc.life < (double)npc.lifeMax * 0.95) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.85) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.7) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.6) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num383 += 1f; + } + Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num384 = player.position.X + (float)(player.width / 2) - vector37.X; + float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; + float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); + num386 = num383 / num386; + npc.velocity.X = num384 * num386; + npc.velocity.Y = num385 * num386; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 25f) + { + npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.Y = npc.velocity.Y * 0.96f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + if (npc.ai[2] >= 70f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num803; + if (npc.ai[3] >= 2f) + { + npc.ai[1] = -1f; + } + else + { + npc.ai[1] = 1f; + } + } + } + else if (npc.ai[1] == 3f) + { + npc.TargetClosest(true); + float num412 = 32f; + float num413 = 1.2f; + int num414 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num414 = -1; + } + Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; + float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num412 / num417; + num415 *= num417; + num416 *= num417; + if (npc.velocity.X < num415) + { + npc.velocity.X = npc.velocity.X + num413; + if (npc.velocity.X < 0f && num415 > 0f) + { + npc.velocity.X = npc.velocity.X + num413; + } + } + else if (npc.velocity.X > num415) + { + npc.velocity.X = npc.velocity.X - num413; + if (npc.velocity.X > 0f && num415 < 0f) + { + npc.velocity.X = npc.velocity.X - num413; + } + } + if (npc.velocity.Y < num416) + { + npc.velocity.Y = npc.velocity.Y + num413; + if (npc.velocity.Y < 0f && num416 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num413; + } + } + else if (npc.velocity.Y > num416) + { + npc.velocity.Y = npc.velocity.Y - num413; + if (npc.velocity.Y > 0f && num416 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num413; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 480f) + { + npc.ai[1] = -1f; + npc.target = 255; + npc.netUpdate = true; + } + else + { + if (!player.dead) + { + npc.ai[3] += wormAlive ? 0.5f : 1f; + } + if (npc.ai[3] >= 20f) + { + npc.ai[3] = 0f; + vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num415 = player.position.X + (float)(player.width / 2) - vector40.X; + num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num418 = 10f * uDieLul; + int num419 = expertMode ? 150 : 200; //600 500 + int num420 = mod.ProjectileType("BrimstoneHellblast"); + num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num418 / num417; + num415 *= num417; + num416 *= num417; + vector40.X += num415 * 4f; + vector40.Y += num416 * 4f; + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.ai[1] == 4f) + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num831 = -1; + } + float num832 = 32f; + float num833 = 1.2f; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + { + npc.velocity.X = npc.velocity.X + num833; + } + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + { + npc.velocity.X = npc.velocity.X - num833; + } + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num833; + } + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num833; + } + } + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 140f) + { + npc.localAI[1] = 0f; + float num837 = 5f * uDieLul; + int num838 = expertMode ? 150 : 200; //600 500 + int num839 = mod.ProjectileType("BrimstoneFireblast"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 15f; + vector83.Y += num835 * 15f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + return; + } + } + if (npc.ai[1] == -1f) + { + phaseChange++; + if (phaseChange > 23) + { + phaseChange = 0; + } + int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts + switch (phaseChange) + { + case 0: + phase = 0; + willCharge = false; + break; //0341 + case 1: + phase = 3; + break; + case 2: + phase = 4; + willCharge = true; + break; + case 3: + phase = 1; + break; + case 4: + phase = 1; + break; //1430 + case 5: + phase = 4; + willCharge = false; + break; + case 6: + phase = 3; + break; + case 7: + phase = 0; + willCharge = true; + break; + case 8: + phase = 1; + break; //1034 + case 9: + phase = 0; + willCharge = false; + break; + case 10: + phase = 3; + break; + case 11: + phase = 4; + break; + case 12: + phase = 4; + break; //4310 + case 13: + phase = 3; + willCharge = true; + break; + case 14: + phase = 1; + break; + case 15: + phase = 0; + willCharge = false; + break; + case 16: + phase = 4; + break; //4411 + case 17: + phase = 4; + willCharge = true; + break; + case 18: + phase = 1; + break; + case 19: + phase = 1; + break; + case 20: + phase = 0; + break; //0101 + case 21: + phase = 1; + break; + case 22: + phase = 0; + break; + case 23: + phase = 1; + break; + } + npc.ai[1] = (float)phase; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + if ((double)npc.life < (double)npc.lifeMax * 0.4) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + #endregion + #region Transition + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + { + npc.ai[2] = 0.5f; + } + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + { + npc.ai[2] = 0f; + } + } + npc.rotation += npc.ai[2]; + npc.ai[1] += 1f; + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + for (int num388 = 0; num388 < 50; num388++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + } + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + } + Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.Y = npc.velocity.Y * 0.98f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + return; + } + } + #endregion + #region LastStage + else + { + npc.damage = npc.defDamage; + if (wormAlive) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + if (NPC.AnyNPCs(mod.NPCType("SoulSeekerSupreme"))) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + npc.dontTakeDamage = false; + npc.chaseable = true; + } + } + if (npc.ai[1] == 0f) + { + float num823 = 12f; + float num824 = 0.12f; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 240f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 60f) + { + npc.localAI[1] = 0f; + float num828 = 10f * uDieLul; + int num829 = expertMode ? 150 : 200; //600 500 + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; + int randomShot = Main.rand.Next(6); + if (randomShot == 0 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneFireblast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else if (randomShot == 1 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneGigaBlast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else + { + canFireSplitingFireball = true; + randomShot = mod.ProjectileType("BrimstoneBarrage"); + for (int num186 = 1; num186 <= 8; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + } + return; + } + } + } + else if (npc.ai[1] == 1f) + { + npc.rotation = num803; //change + float num383 = wormAlive ? 31f : 35f; + if ((double)npc.life < (double)npc.lifeMax * 0.3) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.2) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num383 += 1f; + } + Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num384 = player.position.X + (float)(player.width / 2) - vector37.X; + float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; + float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); + num386 = num383 / num386; + npc.velocity.X = num384 * num386; + npc.velocity.Y = num385 * num386; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 25f) + { + npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.Y = npc.velocity.Y * 0.96f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + if (npc.ai[2] >= 70f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num803; //change + if (npc.ai[3] >= 1f) + { + npc.ai[1] = -1f; + } + else + { + npc.ai[1] = 1f; + } + } + } + else if (npc.ai[1] == 3f) + { + npc.TargetClosest(true); + float num412 = 32f; + float num413 = 1.2f; + int num414 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num414 = -1; + } + Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; + float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num412 / num417; + num415 *= num417; + num416 *= num417; + if (npc.velocity.X < num415) + { + npc.velocity.X = npc.velocity.X + num413; + if (npc.velocity.X < 0f && num415 > 0f) + { + npc.velocity.X = npc.velocity.X + num413; + } + } + else if (npc.velocity.X > num415) + { + npc.velocity.X = npc.velocity.X - num413; + if (npc.velocity.X > 0f && num415 < 0f) + { + npc.velocity.X = npc.velocity.X - num413; + } + } + if (npc.velocity.Y < num416) + { + npc.velocity.Y = npc.velocity.Y + num413; + if (npc.velocity.Y < 0f && num416 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num413; + } + } + else if (npc.velocity.Y > num416) + { + npc.velocity.Y = npc.velocity.Y - num413; + if (npc.velocity.Y > 0f && num416 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num413; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = -1f; + npc.target = 255; + npc.netUpdate = true; + } + else + { + if (!player.dead) + { + npc.ai[3] += wormAlive ? 0.5f : 1f; + } + if (npc.ai[3] >= 24f) + { + npc.ai[3] = 0f; + vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num415 = player.position.X + (float)(player.width / 2) - vector40.X; + num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num418 = 10f * uDieLul; + int num419 = expertMode ? 150 : 200; //600 500 + int num420 = mod.ProjectileType("BrimstoneHellblast"); + num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num418 / num417; + num415 *= num417; + num416 *= num417; + vector40.X += num415 * 4f; + vector40.Y += num416 * 4f; + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.ai[1] == 4f) + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num831 = -1; + } + float num832 = 32f; + float num833 = 1.2f; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + { + npc.velocity.X = npc.velocity.X + num833; + } + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + { + npc.velocity.X = npc.velocity.X - num833; + } + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num833; + } + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num833; + } + } + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 100f) + { + npc.localAI[1] = 0f; + float num837 = 5f * uDieLul; + int num838 = expertMode ? 150 : 200; //600 500 + int num839 = mod.ProjectileType("BrimstoneFireblast"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 15f; + vector83.Y += num835 * 15f; + int shot = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 240f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + return; + } + } + if (npc.ai[1] == -1f) + { + phaseChange++; + if (phaseChange > 23) + { + phaseChange = 0; + } + int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts + switch (phaseChange) + { + case 0: + phase = 0; + willCharge = false; + break; //0341 + case 1: + phase = 3; + break; + case 2: + phase = 4; + willCharge = true; + break; + case 3: + phase = 1; + break; + case 4: + phase = 1; + break; //1430 + case 5: + phase = 4; + willCharge = false; + break; + case 6: + phase = 3; + break; + case 7: + phase = 0; + willCharge = true; + break; + case 8: + phase = 1; + break; //1034 + case 9: + phase = 0; + willCharge = false; + break; + case 10: + phase = 3; + break; + case 11: + phase = 4; + break; + case 12: + phase = 4; + break; //4310 + case 13: + phase = 3; + willCharge = true; + break; + case 14: + phase = 1; + break; + case 15: + phase = 0; + willCharge = false; + break; + case 16: + phase = 4; + break; //4411 + case 17: + phase = 4; + willCharge = true; + break; + case 18: + phase = 1; + break; + case 19: + phase = 1; + break; + case 20: + phase = 0; + break; //0101 + case 21: + phase = 1; + break; + case 22: + phase = 0; + break; + case 23: + phase = 1; + break; + } + npc.ai[1] = (float)phase; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + } + #endregion + } #region Loot public override void BossLoot(ref string name, ref int potionType) @@ -2022,39 +2133,39 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override void NPCLoot() - { + { DeathMessage(); // Incrase the player's SCal kill count if (Main.player[npc.target].Calamity().sCalKillCount < 5) - Main.player[npc.target].Calamity().sCalKillCount++; + Main.player[npc.target].Calamity().sCalKillCount++; // Materials int essenceMin = Main.expertMode ? 30 : 20; int essenceMax = Main.expertMode ? 40 : 30; DropHelper.DropItem(npc, mod.ItemType("CalamitousEssence"), true, essenceMin, essenceMax); - // Weapons - // All non-hybrid weapons are listed twice so that the drop rates are actually equal between each unique weapon - DropHelper.DropItemFromSetCondition(npc, Main.expertMode, - mod.ItemType("Animus"), mod.ItemType("Animus"), - mod.ItemType("Azathoth"), mod.ItemType("Azathoth"), - mod.ItemType("Contagion"), mod.ItemType("Contagion"), - mod.ItemType("CrystylCrusher"), mod.ItemType("CrystylCrusher"), - mod.ItemType("DraconicDestruction"), mod.ItemType("DraconicDestruction"), - mod.ItemType("Earth"), mod.ItemType("Earth"), - mod.ItemType("Fabstaff"), mod.ItemType("Fabstaff"), - mod.ItemType("RoyalKnivesMelee"), mod.ItemType("RoyalKnives"), // Illustrious Knives - mod.ItemType("NanoblackReaperMelee"), mod.ItemType("NanoblackReaperRogue"), - mod.ItemType("RedSun"), mod.ItemType("RedSun"), - mod.ItemType("ScarletDevil"), mod.ItemType("ScarletDevil"), - mod.ItemType("SomaPrime"), mod.ItemType("SomaPrime"), - mod.ItemType("BlushieStaff"), mod.ItemType("BlushieStaff"), // Staff of Blushie - mod.ItemType("Svantechnical"), mod.ItemType("Svantechnical"), - mod.ItemType("Judgement"), mod.ItemType("Judgement"), // The Dance of Light - mod.ItemType("TriactisTruePaladinianMageHammerofMightMelee"), mod.ItemType("TriactisTruePaladinianMageHammerofMight"), - mod.ItemType("Megafleet"), mod.ItemType("Megafleet") // Voidragon - ); + // Weapons + // All non-hybrid weapons are listed twice so that the drop rates are actually equal between each unique weapon + DropHelper.DropItemFromSetCondition(npc, Main.expertMode, + mod.ItemType("Animus"), mod.ItemType("Animus"), + mod.ItemType("Azathoth"), mod.ItemType("Azathoth"), + mod.ItemType("Contagion"), mod.ItemType("Contagion"), + mod.ItemType("CrystylCrusher"), mod.ItemType("CrystylCrusher"), + mod.ItemType("DraconicDestruction"), mod.ItemType("DraconicDestruction"), + mod.ItemType("Earth"), mod.ItemType("Earth"), + mod.ItemType("Fabstaff"), mod.ItemType("Fabstaff"), + mod.ItemType("RoyalKnivesMelee"), mod.ItemType("RoyalKnives"), // Illustrious Knives + mod.ItemType("NanoblackReaperMelee"), mod.ItemType("NanoblackReaperRogue"), + mod.ItemType("RedSun"), mod.ItemType("RedSun"), + mod.ItemType("ScarletDevil"), mod.ItemType("ScarletDevil"), + mod.ItemType("SomaPrime"), mod.ItemType("SomaPrime"), + mod.ItemType("BlushieStaff"), mod.ItemType("BlushieStaff"), // Staff of Blushie + mod.ItemType("Svantechnical"), mod.ItemType("Svantechnical"), + mod.ItemType("Judgement"), mod.ItemType("Judgement"), // The Dance of Light + mod.ItemType("TriactisTruePaladinianMageHammerofMightMelee"), mod.ItemType("TriactisTruePaladinianMageHammerofMight"), + mod.ItemType("Megafleet"), mod.ItemType("Megafleet") // Voidragon + ); DropHelper.DropItemCondition(npc, mod.ItemType("Vehemenc"), CalamityWorld.revenge); // Vanity @@ -2111,142 +2222,142 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("AngryChicken")) - { - damage /= 2; - } - } + { + if (projectile.type == mod.ProjectileType("AngryChicken")) + { + damage /= 2; + } + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { return !CalamityUtils.AntiButcher(npc, ref damage, 0.1f); - } + } - public override bool CheckActive() - { - return canDespawn; - } + public override bool CheckActive() + { + return canDespawn; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 1.5f; - return null; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 1.5f; + return null; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - if (npc.ai[0] > 1f) - { - texture = mod.GetTexture("NPCs/SupremeCalamitas/SupremeCalamitas2"); - } - else - { - texture = Main.npcTexture[npc.type]; - } - Color newColor = (willCharge ? new Color(100, 0, 0, 0) : drawColor); - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.ai[0] > 1f) + { + texture = mod.GetTexture("NPCs/SupremeCalamitas/SupremeCalamitas2"); + } + else + { + texture = Main.npcTexture[npc.type]; + } + Color newColor = (willCharge ? new Color(100, 0, 0, 0) : drawColor); + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("VulnerabilityHex"), 600, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, true); - } - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("VulnerabilityHex"), 600, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, true); + } + } + } } diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 7cdbe0c5ca..d04481c2cc 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,72 +1,72 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { [AutoloadBossHead] - public class SupremeCataclysm : ModNPC - { - private int distanceY = -375; + public class SupremeCataclysm : ModNPC + { + private int distanceY = -375; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; - npc.defense = 100; + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 120; + npc.height = 120; + npc.defense = 100; CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.9f); global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); npc.lifeMax = CalamityWorld.revenge ? 2100000 : 1800000; - if (CalamityWorld.death) - { - npc.lifeMax = 1500000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; + if (CalamityWorld.death) + { + npc.lifeMax = 1500000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + npc.knockBackResist = 0f; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(distanceY); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(distanceY); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - distanceY = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + distanceY = reader.ReadInt32(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -75,9 +75,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override void AI() - { - CalamityGlobalNPC.SCalCataclysm = npc.whoAmI; - bool expertMode = Main.expertMode; + { + CalamityGlobalNPC.SCalCataclysm = npc.whoAmI; + bool expertMode = Main.expertMode; if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { npc.active = false; @@ -85,122 +85,122 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } npc.TargetClosest(true); - float num676 = 60f; - float num677 = 1.5f; - float distanceX = 750f; - if (npc.ai[3] < 750f) - { - npc.ai[3] += 1f; - distanceY += 1; - } - else if (npc.ai[3] < 1500f) - { - npc.ai[3] += 1f; - distanceY -= 1; - } - if (npc.ai[3] >= 1500f) - { - npc.ai[3] = 0f; - } - Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); - float num678 = Main.player[npc.target].Center.X - vector83.X + distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y + (float)distanceY; + float num676 = 60f; + float num677 = 1.5f; + float distanceX = 750f; + if (npc.ai[3] < 750f) + { + npc.ai[3] += 1f; + distanceY += 1; + } + else if (npc.ai[3] < 1500f) + { + npc.ai[3] += 1f; + distanceY -= 1; + } + if (npc.ai[3] >= 1500f) + { + npc.ai[3] = 0f; + } + Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); + float num678 = Main.player[npc.target].Center.X - vector83.X + distanceX; + float num679 = Main.player[npc.target].Center.Y - vector83.Y + (float)distanceY; npc.rotation = 1.57f; float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - num680 = num676 / num680; - num678 *= num680; - num679 *= num680; - if (npc.velocity.X < num678) - { - npc.velocity.X = npc.velocity.X + num677; - if (npc.velocity.X < 0f && num678 > 0f) - { - npc.velocity.X = npc.velocity.X + num677; - } - } - else if (npc.velocity.X > num678) - { - npc.velocity.X = npc.velocity.X - num677; - if (npc.velocity.X > 0f && num678 < 0f) - { - npc.velocity.X = npc.velocity.X - num677; - } - } - if (npc.velocity.Y < num679) - { - npc.velocity.Y = npc.velocity.Y + num677; - if (npc.velocity.Y < 0f && num679 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num677; - } - } - else if (npc.velocity.Y > num679) - { - npc.velocity.Y = npc.velocity.Y - num677; - if (npc.velocity.Y > 0f && num679 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num677; - } - } - if (npc.localAI[0] < 120f) - { - npc.localAI[0] += 1f; - } - if (npc.localAI[0] >= 120f) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) - { - npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = -8f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = mod.ProjectileType("BrimstoneWave"); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (!NPC.AnyNPCs(mod.NPCType("SupremeCatastrophe"))) - { - npc.ai[2] += 2f; - } - if (npc.ai[2] >= 300f) - { - npc.ai[2] = 0f; - float num689 = 7f; - int num690 = expertMode ? 150 : 200; //600 500 - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * num689), (float)(Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); - } - } - for (int dust = 0; dust <= 5; dust++) - { - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 235, 0f, 0f); - } - } - } - } + num680 = num676 / num680; + num678 *= num680; + num679 *= num680; + if (npc.velocity.X < num678) + { + npc.velocity.X = npc.velocity.X + num677; + if (npc.velocity.X < 0f && num678 > 0f) + { + npc.velocity.X = npc.velocity.X + num677; + } + } + else if (npc.velocity.X > num678) + { + npc.velocity.X = npc.velocity.X - num677; + if (npc.velocity.X > 0f && num678 < 0f) + { + npc.velocity.X = npc.velocity.X - num677; + } + } + if (npc.velocity.Y < num679) + { + npc.velocity.Y = npc.velocity.Y + num677; + if (npc.velocity.Y < 0f && num679 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num677; + } + } + else if (npc.velocity.Y > num679) + { + npc.velocity.Y = npc.velocity.Y - num677; + if (npc.velocity.Y > 0f && num679 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num677; + } + } + if (npc.localAI[0] < 120f) + { + npc.localAI[0] += 1f; + } + if (npc.localAI[0] >= 120f) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) + { + npc.ai[1] = 0f; + Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); + float num689 = -8f; + int num690 = expertMode ? 150 : 200; //600 500 + int num691 = mod.ProjectileType("BrimstoneWave"); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (!NPC.AnyNPCs(mod.NPCType("SupremeCatastrophe"))) + { + npc.ai[2] += 2f; + } + if (npc.ai[2] >= 300f) + { + npc.ai[2] = 0f; + float num689 = 7f; + int num690 = expertMode ? 150 : 200; //600 500 + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * num689), (float)(Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + } + } + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 235, 0f, 0f); + } + } + } + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("AngryChicken")) - { - damage /= 2; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("AngryChicken")) + { + damage /= 2; + } + } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { @@ -208,47 +208,47 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CheckActive() + public override bool CheckActive() { return false; } @@ -259,34 +259,34 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index d76ab601b3..52630f19db 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,32 +1,32 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.SupremeCalamitas { [AutoloadBossHead] - public class SupremeCatastrophe : ModNPC - { - private int distanceY = 375; + public class SupremeCatastrophe : ModNPC + { + private int distanceY = 375; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe"); + Main.npcFrameCount[npc.type] = 6; + } - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; - npc.defense = 100; + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 120; + npc.height = 120; + npc.defense = 100; CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; global.customDR = true; @@ -37,36 +37,36 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.lifeMax = 1500000; } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(distanceY); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(distanceY); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - distanceY = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + distanceY = reader.ReadInt32(); + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -74,181 +74,181 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.frame.Y = frame * frameHeight; } - public override void AI() - { - CalamityGlobalNPC.SCalCatastrophe = npc.whoAmI; - bool expertMode = Main.expertMode; - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); - float num676 = 60f; - float num677 = 1.5f; - float distanceX = 750f; - if (npc.ai[3] < 750f) - { - npc.ai[3] += 1f; - distanceY -= 1; - } - else if (npc.ai[3] < 1500f) - { - npc.ai[3] += 1f; - distanceY += 1; - } - if (npc.ai[3] >= 1500f) - { - npc.ai[3] = 0f; - } - Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); - float num678 = Main.player[npc.target].Center.X - vector83.X - distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y + (float)distanceY; - npc.rotation = 4.71f; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - num680 = num676 / num680; - num678 *= num680; - num679 *= num680; - if (npc.velocity.X < num678) - { - npc.velocity.X = npc.velocity.X + num677; - if (npc.velocity.X < 0f && num678 > 0f) - { - npc.velocity.X = npc.velocity.X + num677; - } - } - else if (npc.velocity.X > num678) - { - npc.velocity.X = npc.velocity.X - num677; - if (npc.velocity.X > 0f && num678 < 0f) - { - npc.velocity.X = npc.velocity.X - num677; - } - } - if (npc.velocity.Y < num679) - { - npc.velocity.Y = npc.velocity.Y + num677; - if (npc.velocity.Y < 0f && num679 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num677; - } - } - else if (npc.velocity.Y > num679) - { - npc.velocity.Y = npc.velocity.Y - num677; - if (npc.velocity.Y > 0f && num679 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num677; - } - } - if (npc.localAI[0] < 120f) - { - npc.localAI[0] += 1f; - } - if (npc.localAI[0] >= 120f) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - { - npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = 4f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = mod.ProjectileType("BrimstoneHellblast2"); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (!NPC.AnyNPCs(mod.NPCType("SupremeCataclysm"))) - { - npc.ai[2] += 2f; - } - if (npc.ai[2] >= 300f) - { - npc.ai[2] = 0f; - float num689 = 7f; - int num690 = expertMode ? 150 : 200; //600 500 - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * num689), (float)(Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); - } - } - for (int dust = 0; dust <= 5; dust++) - { - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 235, 0f, 0f); - } - } - } - } + public override void AI() + { + CalamityGlobalNPC.SCalCatastrophe = npc.whoAmI; + bool expertMode = Main.expertMode; + if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); + float num676 = 60f; + float num677 = 1.5f; + float distanceX = 750f; + if (npc.ai[3] < 750f) + { + npc.ai[3] += 1f; + distanceY -= 1; + } + else if (npc.ai[3] < 1500f) + { + npc.ai[3] += 1f; + distanceY += 1; + } + if (npc.ai[3] >= 1500f) + { + npc.ai[3] = 0f; + } + Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); + float num678 = Main.player[npc.target].Center.X - vector83.X - distanceX; + float num679 = Main.player[npc.target].Center.Y - vector83.Y + (float)distanceY; + npc.rotation = 4.71f; + float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); + num680 = num676 / num680; + num678 *= num680; + num679 *= num680; + if (npc.velocity.X < num678) + { + npc.velocity.X = npc.velocity.X + num677; + if (npc.velocity.X < 0f && num678 > 0f) + { + npc.velocity.X = npc.velocity.X + num677; + } + } + else if (npc.velocity.X > num678) + { + npc.velocity.X = npc.velocity.X - num677; + if (npc.velocity.X > 0f && num678 < 0f) + { + npc.velocity.X = npc.velocity.X - num677; + } + } + if (npc.velocity.Y < num679) + { + npc.velocity.Y = npc.velocity.Y + num677; + if (npc.velocity.Y < 0f && num679 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num677; + } + } + else if (npc.velocity.Y > num679) + { + npc.velocity.Y = npc.velocity.Y - num677; + if (npc.velocity.Y > 0f && num679 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num677; + } + } + if (npc.localAI[0] < 120f) + { + npc.localAI[0] += 1f; + } + if (npc.localAI[0] >= 120f) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 30f) + { + npc.ai[1] = 0f; + Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); + float num689 = 4f; + int num690 = expertMode ? 150 : 200; //600 500 + int num691 = mod.ProjectileType("BrimstoneHellblast2"); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (!NPC.AnyNPCs(mod.NPCType("SupremeCataclysm"))) + { + npc.ai[2] += 2f; + } + if (npc.ai[2] >= 300f) + { + npc.ai[2] = 0f; + float num689 = 7f; + int num690 = expertMode ? 150 : 200; //600 500 + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * num689), (float)(Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + } + } + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 235, 0f, 0f); + } + } + } + } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("AngryChicken")) - { - damage /= 2; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("AngryChicken")) + { + damage /= 2; + } + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); - } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } - public override bool CheckActive() + public override bool CheckActive() { return false; } @@ -259,34 +259,34 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs index 2971d71baa..e0e1fb91c7 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -1,279 +1,278 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.TheDevourerofGods { public class DevourerofGodsBody : ModNPC - { - private int invinceTime = 360; + { + private int invinceTime = 360; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } - public override void SetDefaults() - { - npc.damage = 180; - npc.npcSlots = 5f; - npc.width = 56; - npc.height = 56; - npc.defense = 70; + public override void SetDefaults() + { + npc.damage = 180; + npc.npcSlots = 5f; + npc.width = 56; + npc.height = 56; + npc.defense = 70; CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.death ? 0.95f : 0.925f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; - if (CalamityWorld.death) - { - npc.lifeMax = 1300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; - } + npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; + if (CalamityWorld.death) + { + npc.lifeMax = 1300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - bool expertMode = Main.expertMode; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += (expertMode ? 2f : 1f); - int projectileType = mod.ProjectileType("DoGNebulaShot"); - int damage = expertMode ? 58 : 70; - float num941 = 5f; - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 16000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += (expertMode ? 2f : 1f); + int projectileType = mod.ProjectileType("DoGNebulaShot"); + int damage = expertMode ? 58 : 70; + float num941 = 5f; + if (npc.localAI[0] >= (float)Main.rand.Next(1400, 16000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 0; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 0; + return true; + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); - } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody3"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody3"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 240, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Darkness, 240, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 240, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Darkness, 240, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs index 90fca530dc..91eb2d4042 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs @@ -1,5 +1,5 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,63 +7,63 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.TheDevourerofGods { public class DevourerofGodsBody2 : ModNPC - { + { public int invinceTime = 180; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Guardian"); - } + { + DisplayName.SetDefault("Cosmic Guardian"); + } - public override void SetDefaults() - { - npc.damage = 130; - npc.npcSlots = 5f; - npc.width = 34; - npc.height = 34; - npc.defense = 60; + public override void SetDefaults() + { + npc.damage = 130; + npc.npcSlots = 5f; + npc.width = 34; + npc.height = 34; + npc.defense = 60; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.5f; global.unbreakableDR = true; npc.lifeMax = 100000; npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); if (invinceTime > 0) { invinceTime--; @@ -81,79 +81,79 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { if (npc.alpha != 0) { int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + { + cooldownSlot = 1; + return true; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 1f); npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); - player.AddBuff(BuffID.Frostburn, 120, true); - player.AddBuff(BuffID.Darkness, 120, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Darkness, 120, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs index 071eee28f2..3b07cf3b06 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -1,267 +1,266 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.TheDevourerofGods { [AutoloadBossHead] - public class DevourerofGodsBodyS : ModNPC - { - private int invinceTime = 360; - private bool setAlpha = false; + public class DevourerofGodsBodyS : ModNPC + { + private int invinceTime = 360; + private bool setAlpha = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } - public override void SetDefaults() - { - npc.damage = 220; - npc.npcSlots = 5f; - npc.width = 70; - npc.height = 70; - npc.defense = 70; + public override void SetDefaults() + { + npc.damage = 220; + npc.npcSlots = 5f; + npc.width = 70; + npc.height = 70; + npc.defense = 70; CalamityGlobalNPC global = npc.Calamity(); global.DR = CalamityWorld.death ? 0.97f : 0.955f; global.unbreakableDR = true; npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; - if (CalamityWorld.death) - { - npc.lifeMax = 2100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; - npc.dontCountMe = true; - } + if (CalamityWorld.death) + { + npc.lifeMax = 2100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(setAlpha); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(setAlpha); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - setAlpha = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + setAlpha = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) - { - npc.alpha -= 42; - if (npc.alpha <= 0 && invinceTime <= 0) - { - setAlpha = true; - npc.alpha = 0; - } - } - else - { - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + { + npc.alpha -= 42; + if (npc.alpha <= 0 && invinceTime <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 0; - return (npc.alpha == 0 && invinceTime <= 0); - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 0; + return (npc.alpha == 0 && invinceTime <= 0); + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); - } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 240, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Darkness, 240, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 240, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Darkness, 240, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs index af0463faf0..dd7814206b 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -1,709 +1,709 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.TheDevourerofGods { - [AutoloadBossHead] - public class DevourerofGodsHead : ModNPC - { - private bool tail = false; - private const int minLength = 80; - private const int maxLength = 81; - private bool halfLife = false; - private bool halfLife2 = false; - private int spawnDoGCountdown = 0; - private int phaseSwitch = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 250; - npc.npcSlots = 5f; - npc.width = 104; - npc.height = 104; - npc.defense = 50; - npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; - if (CalamityWorld.death) - { - npc.lifeMax = 1300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.takenDamageMultiplier = 1.25f; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(0, 75, 0, 0); - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(halfLife); - writer.Write(halfLife2); - writer.Write(spawnDoGCountdown); - writer.Write(phaseSwitch); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - halfLife = reader.ReadBoolean(); - halfLife2 = reader.ReadBoolean(); - spawnDoGCountdown = reader.ReadInt32(); - phaseSwitch = reader.ReadInt32(); - } - - public override void AI() - { - // whoAmI variable - CalamityGlobalNPC.DoGHead = npc.whoAmI; - - // Stop rain - CalamityMod.StopRain(); - - // Variables - Vector2 vector = npc.Center; - bool flies = npc.ai[2] == 0f; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - - // Worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); - - // Spawn Guardians - if (lifeRatio < 0.2f) - { - if (!halfLife) - { - if (CalamityWorld.revenge) - spawnDoGCountdown = 10; - - string key = "Mods.CalamityMod.EdgyBossText"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - - halfLife = true; - } - if (spawnDoGCountdown > 0) - { - spawnDoGCountdown--; - if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < 2; i++) - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); - } - } - } - else if (lifeRatio < 0.6f) - { - if (!halfLife2) - { - if (CalamityWorld.revenge) - spawnDoGCountdown = 10; - - halfLife2 = true; - } - if (spawnDoGCountdown > 0) - { - spawnDoGCountdown--; - if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); - } - } - - // Velocity - npc.velocity.Length(); - - // Spawn dust - if (npc.alpha != 0) - { - for (int spawnDust = 0; spawnDust < 2; spawnDust++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - - // Alpha - npc.alpha -= 12; - if (npc.alpha < 0) - npc.alpha = 0; - - // Spawn segments - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) - { - int segment = 0; - if (segmentSpawn >= 0 && segmentSpawn < minLength) - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody"), npc.whoAmI); - else - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail"), npc.whoAmI); - - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; - NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); - Previous = segment; - } - tail = true; - } - } - - // Despawn - if (Main.player[npc.target].dead) - { - flies = true; - - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y = npc.velocity.Y - 3f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].type == mod.NPCType("DevourerofGodsHead") || Main.npc[a].type == mod.NPCType("DevourerofGodsBody") || Main.npc[a].type == mod.NPCType("DevourerofGodsTail")) - Main.npc[a].active = false; - } - } - } - - // Movement - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - - if (num180 < 0) - num180 = 0; - if (num181 > Main.maxTilesX) - num181 = Main.maxTilesX; - if (num182 < 0) - num182 = 0; - if (num183 > Main.maxTilesY) - num183 = Main.maxTilesY; - - 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); - - // Flight - if (npc.ai[2] == 0f) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) - Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); - } - - // Flying movement - phaseSwitch += 1 + (int)(9f * (1f - lifeRatio)); - npc.localAI[1] = 0f; - - float speed = (CalamityWorld.death ? 18f : 15f) + (3f * (1f - lifeRatio)); - float turnSpeed = (CalamityWorld.death ? 0.33f : 0.3f) + (0.06f * (1f - lifeRatio)); - float homingSpeed = (CalamityWorld.death ? 22f : 18f) + (9f * (1f - lifeRatio)); - float homingTurnSpeed = (CalamityWorld.death ? 0.36f : 0.33f) + (0.15f * (1f - lifeRatio)); - - // Go to ground phase sooner - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) - phaseSwitch += 10; - - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - break; - } - - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 800); - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - num191 = Main.player[npc.target].Center.X + 600f; - else - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - else - { - num188 = homingSpeed; - num189 = homingTurnSpeed; - } - - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + num189; - else - { - if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - num189; - } - - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + num189; - else - { - if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - num189; - } - - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - else - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num189 * 2f; - else - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num189; - else - npc.velocity.Y = npc.velocity.Y - num189; - } - } - else - { - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num189; - else - npc.velocity.X = npc.velocity.X - num189; - } - } - } - - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - - if (phaseSwitch > 900) - { - npc.ai[2] = 1f; - phaseSwitch = 0; - npc.netUpdate = true; - } - } - - // Ground - else - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) - Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); - } - - phaseSwitch += 1; - - float fallSpeed = 16f + ((CalamityWorld.death ? 5f : 3.5f) * (1f - lifeRatio)); - float speed = (CalamityWorld.death ? 0.2f : 0.18f) + (0.08f * (1f - lifeRatio)); - float turnSpeed = (CalamityWorld.death ? 0.14f : 0.12f) + (0.12f * (1f - lifeRatio)); - bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; - - // Enrage - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) - { - speed *= 4f; - turnSpeed *= 6f; - } - else if (increaseSpeed) - { - speed *= 2f; - turnSpeed *= 3f; - } - - if (!flies) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - - if (!flies) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 1000 - (int)(500f * (1f - lifeRatio)); - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - flies = true; - } - } - else - npc.localAI[1] = 0f; - - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - - if (!flies) - { - npc.TargetClosest(true); - - npc.velocity.Y = npc.velocity.Y + turnSpeed; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 1.8) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X - speed * 1.1f; - else - npc.velocity.X = npc.velocity.X + speed * 1.1f; - } - else if (npc.velocity.Y == fallSpeed) - { - if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + speed; - else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - speed; - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X + speed * 0.9f; - else - npc.velocity.X = npc.velocity.X - speed * 0.9f; - } - } - else - { - double maximumSpeed1 = (increaseSpeed ? 1.2 : 0.4) + (double)((CalamityWorld.death ? 0.1f : 0.08f) * (1f - lifeRatio)); - double maximumSpeed2 = (increaseSpeed ? 3.0 : 1.0) + (double)((CalamityWorld.death ? 0.2f : 0.16f) * (1f - lifeRatio)); - - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = fallSpeed / num22; - num20 *= num27; - num21 *= num27; - - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) - { - if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + turnSpeed * 1.3f; - else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - turnSpeed * 1.3f; - - if (npc.velocity.Y < num21) - npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.3f; - else if (npc.velocity.Y > num21) - npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.3f; - } - - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) - { - if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + speed; - else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - speed; - if (npc.velocity.Y < num21) - npc.velocity.Y = npc.velocity.Y + speed; - else if (npc.velocity.Y > num21) - npc.velocity.Y = npc.velocity.Y - speed; - - if ((double)Math.Abs(num21) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + speed * 2f; - else - npc.velocity.Y = npc.velocity.Y - speed * 2f; - } - if ((double)Math.Abs(num20) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + speed * 2f; - else - npc.velocity.X = npc.velocity.X - speed * 2f; - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num20) - npc.velocity.X = npc.velocity.X + speed * 1.1f; - else if (npc.velocity.X > num20) - npc.velocity.X = npc.velocity.X - speed * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + speed; - else - npc.velocity.Y = npc.velocity.Y - speed; - } - } - else - { - if (npc.velocity.Y < num21) - npc.velocity.Y = npc.velocity.Y + speed * 1.1f; - else if (npc.velocity.Y > num21) - npc.velocity.Y = npc.velocity.Y - speed * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + speed; - else - npc.velocity.X = npc.velocity.X - speed; - } - } - } - - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - - if (flies) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - - if (phaseSwitch > 900) - { - npc.ai[2] = 0f; - phaseSwitch = 0; - npc.netUpdate = true; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.None; - } - - // DoG phase 1 does not drop loot, but starts the sentinel phase of the fight. - public override void NPCLoot() - { - // Skip the sentinel phase entirely if DoG has already been killed - CalamityWorld.DoGSecondStageCountdown = CalamityWorld.downedDoG ? 600 : 21600; - - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if(CalamityUtils.AntiButcher(npc, ref damage, 0.5f)) + [AutoloadBossHead] + public class DevourerofGodsHead : ModNPC + { + private bool tail = false; + private const int minLength = 80; + private const int maxLength = 81; + private bool halfLife = false; + private bool halfLife2 = false; + private int spawnDoGCountdown = 0; + private int phaseSwitch = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 250; + npc.npcSlots = 5f; + npc.width = 104; + npc.height = 104; + npc.defense = 50; + npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; + if (CalamityWorld.death) + { + npc.lifeMax = 1300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.takenDamageMultiplier = 1.25f; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.boss = true; + npc.value = Item.buyPrice(0, 75, 0, 0); + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(halfLife); + writer.Write(halfLife2); + writer.Write(spawnDoGCountdown); + writer.Write(phaseSwitch); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + halfLife = reader.ReadBoolean(); + halfLife2 = reader.ReadBoolean(); + spawnDoGCountdown = reader.ReadInt32(); + phaseSwitch = reader.ReadInt32(); + } + + public override void AI() + { + // whoAmI variable + CalamityGlobalNPC.DoGHead = npc.whoAmI; + + // Stop rain + CalamityMod.StopRain(); + + // Variables + Vector2 vector = npc.Center; + bool flies = npc.ai[2] == 0f; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Light + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + + // Worm variable + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + + // Target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + npc.TargetClosest(true); + + // Spawn Guardians + if (lifeRatio < 0.2f) + { + if (!halfLife) + { + if (CalamityWorld.revenge) + spawnDoGCountdown = 10; + + string key = "Mods.CalamityMod.EdgyBossText"; + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + + halfLife = true; + } + if (spawnDoGCountdown > 0) + { + spawnDoGCountdown--; + if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 2; i++) + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); + } + } + } + else if (lifeRatio < 0.6f) + { + if (!halfLife2) + { + if (CalamityWorld.revenge) + spawnDoGCountdown = 10; + + halfLife2 = true; + } + if (spawnDoGCountdown > 0) + { + spawnDoGCountdown--; + if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); + } + } + + // Velocity + npc.velocity.Length(); + + // Spawn dust + if (npc.alpha != 0) + { + for (int spawnDust = 0; spawnDust < 2; spawnDust++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + + // Alpha + npc.alpha -= 12; + if (npc.alpha < 0) + npc.alpha = 0; + + // Spawn segments + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tail && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) + { + int segment = 0; + if (segmentSpawn >= 0 && segmentSpawn < minLength) + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody"), npc.whoAmI); + else + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail"), npc.whoAmI); + + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[2] = (float)npc.whoAmI; + Main.npc[segment].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)segment; + NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); + Previous = segment; + } + tail = true; + } + } + + // Despawn + if (Main.player[npc.target].dead) + { + flies = true; + + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y = npc.velocity.Y - 3f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == mod.NPCType("DevourerofGodsHead") || Main.npc[a].type == mod.NPCType("DevourerofGodsBody") || Main.npc[a].type == mod.NPCType("DevourerofGodsTail")) + Main.npc[a].active = false; + } + } + } + + // Movement + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + + if (num180 < 0) + num180 = 0; + if (num181 > Main.maxTilesX) + num181 = Main.maxTilesX; + if (num182 < 0) + num182 = 0; + if (num183 > Main.maxTilesY) + num183 = Main.maxTilesY; + + 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); + + // Flight + if (npc.ai[2] == 0f) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); + } + + // Flying movement + phaseSwitch += 1 + (int)(9f * (1f - lifeRatio)); + npc.localAI[1] = 0f; + + float speed = (CalamityWorld.death ? 18f : 15f) + (3f * (1f - lifeRatio)); + float turnSpeed = (CalamityWorld.death ? 0.33f : 0.3f) + (0.06f * (1f - lifeRatio)); + float homingSpeed = (CalamityWorld.death ? 22f : 18f) + (9f * (1f - lifeRatio)); + float homingTurnSpeed = (CalamityWorld.death ? 0.36f : 0.33f) + (0.15f * (1f - lifeRatio)); + + // Go to ground phase sooner + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) + phaseSwitch += 10; + + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + break; + } + + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 800); + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + num191 = Main.player[npc.target].Center.X + 600f; + else + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + else + { + num188 = homingSpeed; + num189 = homingTurnSpeed; + } + + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + num189; + else + { + if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - num189; + } + + if (npc.velocity.Y < num192) + npc.velocity.Y = npc.velocity.Y + num189; + else + { + if (npc.velocity.Y > num192) + npc.velocity.Y = npc.velocity.Y - num189; + } + + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + else + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + num189 * 2f; + else + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + else if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + num189; + else + npc.velocity.Y = npc.velocity.Y - num189; + } + } + else + { + if (npc.velocity.Y < num192) + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + else if (npc.velocity.Y > num192) + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + num189; + else + npc.velocity.X = npc.velocity.X - num189; + } + } + } + + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + + if (phaseSwitch > 900) + { + npc.ai[2] = 1f; + phaseSwitch = 0; + npc.netUpdate = true; + } + } + + // Ground + else + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); + } + + phaseSwitch += 1; + + float fallSpeed = 16f + ((CalamityWorld.death ? 5f : 3.5f) * (1f - lifeRatio)); + float speed = (CalamityWorld.death ? 0.2f : 0.18f) + (0.08f * (1f - lifeRatio)); + float turnSpeed = (CalamityWorld.death ? 0.14f : 0.12f) + (0.12f * (1f - lifeRatio)); + bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; + + // Enrage + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) + { + speed *= 4f; + turnSpeed *= 6f; + } + else if (increaseSpeed) + { + speed *= 2f; + turnSpeed *= 3f; + } + + if (!flies) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flies = true; + break; + } + } + } + } + } + + if (!flies) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 1000 - (int)(500f * (1f - lifeRatio)); + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + flies = true; + } + } + else + npc.localAI[1] = 0f; + + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + + if (!flies) + { + npc.TargetClosest(true); + + npc.velocity.Y = npc.velocity.Y + turnSpeed; + if (npc.velocity.Y > fallSpeed) + npc.velocity.Y = fallSpeed; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 1.8) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X - speed * 1.1f; + else + npc.velocity.X = npc.velocity.X + speed * 1.1f; + } + else if (npc.velocity.Y == fallSpeed) + { + if (npc.velocity.X < num20) + npc.velocity.X = npc.velocity.X + speed; + else if (npc.velocity.X > num20) + npc.velocity.X = npc.velocity.X - speed; + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X + speed * 0.9f; + else + npc.velocity.X = npc.velocity.X - speed * 0.9f; + } + } + else + { + double maximumSpeed1 = (increaseSpeed ? 1.2 : 0.4) + (double)((CalamityWorld.death ? 0.1f : 0.08f) * (1f - lifeRatio)); + double maximumSpeed2 = (increaseSpeed ? 3.0 : 1.0) + (double)((CalamityWorld.death ? 0.2f : 0.16f) * (1f - lifeRatio)); + + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = fallSpeed / num22; + num20 *= num27; + num21 *= num27; + + if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + { + if (npc.velocity.X < num20) + npc.velocity.X = npc.velocity.X + turnSpeed * 1.3f; + else if (npc.velocity.X > num20) + npc.velocity.X = npc.velocity.X - turnSpeed * 1.3f; + + if (npc.velocity.Y < num21) + npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.3f; + else if (npc.velocity.Y > num21) + npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.3f; + } + + if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + { + if (npc.velocity.X < num20) + npc.velocity.X = npc.velocity.X + speed; + else if (npc.velocity.X > num20) + npc.velocity.X = npc.velocity.X - speed; + if (npc.velocity.Y < num21) + npc.velocity.Y = npc.velocity.Y + speed; + else if (npc.velocity.Y > num21) + npc.velocity.Y = npc.velocity.Y - speed; + + if ((double)Math.Abs(num21) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + speed * 2f; + else + npc.velocity.Y = npc.velocity.Y - speed * 2f; + } + if ((double)Math.Abs(num20) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + speed * 2f; + else + npc.velocity.X = npc.velocity.X - speed * 2f; + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + npc.velocity.X = npc.velocity.X + speed * 1.1f; + else if (npc.velocity.X > num20) + npc.velocity.X = npc.velocity.X - speed * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + speed; + else + npc.velocity.Y = npc.velocity.Y - speed; + } + } + else + { + if (npc.velocity.Y < num21) + npc.velocity.Y = npc.velocity.Y + speed * 1.1f; + else if (npc.velocity.Y > num21) + npc.velocity.Y = npc.velocity.Y - speed * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + speed; + else + npc.velocity.X = npc.velocity.X - speed; + } + } + } + + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + + if (flies) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + + if (phaseSwitch > 900) + { + npc.ai[2] = 0f; + phaseSwitch = 0; + npc.netUpdate = true; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.None; + } + + // DoG phase 1 does not drop loot, but starts the sentinel phase of the fight. + public override void NPCLoot() + { + // Skip the sentinel phase entirely if DoG has already been killed + CalamityWorld.DoGSecondStageCountdown = CalamityWorld.downedDoG ? 600 : 21600; + + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (CalamityUtils.AntiButcher(npc, ref damage, 0.5f)) { string key = "Mods.CalamityMod.EdgyBossText2"; Color messageColor = Color.Cyan; @@ -714,97 +714,97 @@ namespace CalamityMod.NPCs.TheDevourerofGods return false; } return true; - } + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 1.5f; - return null; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 1.5f; + return null; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGHead"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGHead"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 300, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); - if (CalamityWorld.death) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 300, true); - player.AddBuff(BuffID.Darkness, 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 300, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); + if (CalamityWorld.death) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + int num = Main.rand.Next(5); + string key = "Mods.CalamityMod.EdgyBossText3"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText3"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText4"; + } + else if (num == 2) + { + key = "Mods.CalamityMod.EdgyBossText5"; + } + else if (num == 3) + { + key = "Mods.CalamityMod.EdgyBossText6"; + } + else if (num == 4) + { + key = "Mods.CalamityMod.EdgyBossText7"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 300, true); + player.AddBuff(BuffID.Darkness, 300, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs index 7f7e6f263b..19792d1de0 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,482 +8,482 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.TheDevourerofGods { public class DevourerofGodsHead2 : ModNPC - { - private bool tail = false; + { + private bool tail = false; private bool flies = false; - private const int minLength = 15; - private const int maxLength = 16; + private const int minLength = 15; + private const int maxLength = 16; private int invinceTime = 180; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Guardian"); - } + { + DisplayName.SetDefault("Cosmic Guardian"); + } - public override void SetDefaults() - { - npc.damage = 180; - npc.npcSlots = 5f; - npc.width = 64; - npc.height = 76; - npc.defense = 40; + public override void SetDefaults() + { + npc.damage = 180; + npc.npcSlots = 5f; + npc.width = 64; + npc.height = 76; + npc.defense = 40; npc.lifeMax = 100000; npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() - { - bool expertMode = Main.expertMode; - float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); - if (playerRunAcceleration <= 1f) - { - playerRunAcceleration = 1f; - } - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; - } - Vector2 vector = npc.Center; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.alpha != 0) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) - { - int segment = 0; - if (segmentSpawn >= 0 && segmentSpawn < minLength) - { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody2"), npc.whoAmI); - } - else - { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail2"), npc.whoAmI); - } - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; - npc.netUpdate = true; - Previous = segment; - } - tail = true; - } - if (!npc.active && Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("DevourerofGodsHead2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsBody2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsTail2"))) - { - Main.npc[num569].active = false; - } - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - flies = true; - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 3f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].aiStyle == npc.aiStyle) - { - Main.npc[a].active = false; - } - } - } - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - float speed = playerRunAcceleration * 16f; - float turnSpeed = playerRunAcceleration * 0.23f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 3000f) //RAGE - { - speed = playerRunAcceleration * 60f; - turnSpeed = playerRunAcceleration * 0.8f; - } - if (!flies) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - if (!flies) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 1000; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flies = true; - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flies) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flies) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); + if (playerRunAcceleration <= 1f) + { + playerRunAcceleration = 1f; + } + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = npc.defDamage; + npc.dontTakeDamage = false; + } + Vector2 vector = npc.Center; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.alpha != 0) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tail && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) + { + int segment = 0; + if (segmentSpawn >= 0 && segmentSpawn < minLength) + { + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody2"), npc.whoAmI); + } + else + { + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail2"), npc.whoAmI); + } + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[2] = (float)npc.whoAmI; + Main.npc[segment].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)segment; + npc.netUpdate = true; + Previous = segment; + } + tail = true; + } + if (!npc.active && Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) + { + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("DevourerofGodsHead2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsBody2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsTail2"))) + { + Main.npc[num569].active = false; + } + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + flies = true; + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 3f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].aiStyle == npc.aiStyle) + { + Main.npc[a].active = false; + } + } + } + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + float speed = playerRunAcceleration * 16f; + float turnSpeed = playerRunAcceleration * 0.23f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 3000f) //RAGE + { + speed = playerRunAcceleration * 60f; + turnSpeed = playerRunAcceleration * 0.8f; + } + if (!flies) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flies = true; + break; + } + } + } + } + } + if (!flies) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 1000; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flies = true; + } + } + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (!flies) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + } + else if (npc.velocity.Y == num188) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flies) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.None; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.None; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 1.5f; - return null; - } + { + scale = 1.5f; + return null; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoT"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoT"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); - player.AddBuff(BuffID.Frostburn, 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index d6a8e59d9c..400b8e22f7 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -1,851 +1,851 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.NPCs.TheDevourerofGods { - [AutoloadBossHead] - public class DevourerofGodsHeadS : ModNPC - { - private bool tail = false; - private const int minLength = 100; - private const int maxLength = 101; - private bool halfLife = false; - private int laserShoot = 0; - private int phaseSwitch = 0; - private int[] shotSpacing = new int[4] { 1050, 1050, 1050, 1050 }; - private const int spacingVar = 105; - private const int totalShots = 20; - private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - public int laserWallPhase = 0; - private int laserWallCounter = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 300; - npc.npcSlots = 5f; - npc.width = 186; - npc.height = 186; - npc.defense = 50; - npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; - if (CalamityWorld.death) - { - npc.lifeMax = 2100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.takenDamageMultiplier = 1.25f; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(1, 0, 0, 0); - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; - bossBag = mod.ItemType("DevourerofGodsBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(halfLife); - writer.Write(laserShoot); - writer.Write(phaseSwitch); - writer.Write(shotSpacing[0]); - writer.Write(shotSpacing[1]); - writer.Write(shotSpacing[2]); - writer.Write(shotSpacing[3]); - writer.Write(idleCounter); - writer.Write(laserWallPhase); - writer.Write(laserWallCounter); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - halfLife = reader.ReadBoolean(); - laserShoot = reader.ReadInt32(); - phaseSwitch = reader.ReadInt32(); - shotSpacing[0] = reader.ReadInt32(); - shotSpacing[1] = reader.ReadInt32(); - shotSpacing[2] = reader.ReadInt32(); - shotSpacing[3] = reader.ReadInt32(); - idleCounter = reader.ReadInt32(); - laserWallPhase = reader.ReadInt32(); - laserWallCounter = reader.ReadInt32(); - } - - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } - - public override void AI() - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // whoAmI variable - CalamityGlobalNPC.DoGHead = npc.whoAmI; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Variables - Vector2 vector = npc.Center; - bool flies = npc.ai[2] == 0f; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool speedBoost = lifeRatio < 0.6 || (CalamityWorld.bossRushActive && lifeRatio < 0.9); - bool speedBoost2 = lifeRatio < 0.2; - bool breathFireMore = lifeRatio < 0.15; - - // Laser walls - if (speedBoost && !speedBoost2) - { - if (laserWallPhase == 0) //start laser wall phase - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - laserWallCounter += 1; - if (laserWallCounter >= 720) - { - laserWallCounter = 0; - laserWallPhase = 1; - } - } - } - else if (laserWallPhase == 1) //turn invisible and fire laser walls - { - npc.alpha += 5; - if (npc.alpha == 255) - laserShoot = 0; - - if (npc.alpha >= 255) - { - npc.alpha = 255; - idleCounter--; - if (idleCounter <= 0) - { - laserWallPhase = 2; - idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - } - } - } - else if (laserWallPhase == 2) //turn visible - { - npc.alpha -= 1; - if (npc.alpha <= 0) - { - npc.alpha = 0; - laserWallPhase = 0; - } - } - } - else - { - npc.alpha -= 6; - if (npc.alpha < 0) - npc.alpha = 0; - - if (laserWallPhase > 0) - laserWallPhase = 0; - } - - // Anger message - if (speedBoost2) - { - if (!halfLife) - { - string key = "Mods.CalamityMod.EdgyBossText11"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - - halfLife = true; - } - } - - // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - - // Worm shit again - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); - - // Velocity - npc.velocity.Length(); - - // Spawn segments and fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Segments - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) - { - int segment = 0; - if (segmentSpawn >= 0 && segmentSpawn < minLength) - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBodyS"), npc.whoAmI); - else - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTailS"), npc.whoAmI); - - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; - NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); - Previous = segment; - } - tail = true; - } - - int projectileDamage = expertMode ? 69 : 80; - - // Fireballs - if (npc.alpha <= 0 && Vector2.Distance(Main.player[npc.target].Center, vector) > 500f && expertMode) - { - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (breathFireMore ? 60f : 120f) == 0f) - { - Vector2 vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector44.X; - float num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num430 = 16f; - int num432 = mod.ProjectileType("DoGFire"); - - float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - num428 += npc.velocity.Y * 0.5f; - num427 += npc.velocity.X * 0.5f; - vector44.X -= num427 * 1f; - vector44.Y -= num428 * 1f; - - Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, projectileDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - else if (Vector2.Distance(Main.player[npc.target].Center, vector) < 250f) - calamityGlobalNPC.newAI[0] = 0f; - - // Laser walls - if (!speedBoost2 && (laserWallPhase == 1 || calamityGlobalNPC.enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive))) - { - laserShoot += 1; - - float speed = 4f; - int divisor = CalamityWorld.bossRushActive ? 90 : (CalamityWorld.death ? 105 : 120); - - if (laserShoot % divisor == 0) - { - Main.PlaySound(2, (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y, 12); - - float targetPosY = Main.player[npc.target].position.Y + (Main.rand.NextBool(2) ? 50f : 0f); - - // Side walls - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + (float)shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[0] -= spacingVar; - } - - if (Main.rand.NextBool(2) && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - for (int x = 0; x < 10; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + (float)shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[3] -= (Main.rand.NextBool(2) ? 180 : 200); - } - shotSpacing[3] = 1050; - } - shotSpacing[0] = 1050; - - // Lower wall - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + (float)shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[1] -= spacingVar; - } - shotSpacing[1] = 1050; - - // Upper wall - if (lifeRatio < 0.4f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - if (shotSpacing[2] < 2100) - shotSpacing[2] = 2100; - - for (int x = 0; x < 40; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + (float)shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[2] -= spacingVar; - } - shotSpacing[2] = 2100; - } - else - { - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + (float)shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[2] -= spacingVar; - } - shotSpacing[2] = 1050; - } - } - } - } - - // Despawn - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) - npc.active = false; - - float fallSpeed = 16f; - if (Main.player[npc.target].dead) - { - flies = true; - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 3f; - fallSpeed = 32f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[a].type == mod.NPCType("DevourerofGodsBodyS") || Main.npc[a].type == mod.NPCType("DevourerofGodsTailS")) - Main.npc[a].active = false; - } - } - } - fallSpeed += ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (1f - lifeRatio); - - // Movement - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - - if (num180 < 0) - num180 = 0; - if (num181 > Main.maxTilesX) - num181 = Main.maxTilesX; - if (num182 < 0) - num182 = 0; - if (num183 > Main.maxTilesY) - num183 = Main.maxTilesY; - - 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); - - // Flight - if (npc.ai[2] == 0f) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) - Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); - } - - phaseSwitch += 1; - - int phaseLimit = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900) / (1 + (int)(5f * (1f - lifeRatio))); - - npc.localAI[1] = 0f; - - float speed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 18f : 15f) + (3f * (1f - lifeRatio)); - float turnSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.3f) + (0.06f * (1f - lifeRatio)); - float homingSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 28f : 24f) + (12f * (1f - lifeRatio)); - float homingTurnSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.36f : 0.33f) + (0.15f * (1f - lifeRatio)); - - // Go to ground phase sooner - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) - phaseSwitch += 10; - - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - - // Charge at target for 1.5 seconds - bool flyAtTarget = (!speedBoost || speedBoost2) && phaseSwitch > phaseLimit - 90 && (CalamityWorld.revenge || CalamityWorld.bossRushActive); - - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - break; - } - - if (!flyAtTarget) - { - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 800); - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - num191 = Main.player[npc.target].Center.X + 600f; - else - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - else - { - num188 = homingSpeed; - num189 = homingTurnSpeed; - } - - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - - if (!flyAtTarget) - { - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + num189; - else - { - if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - num189; - } - - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + num189; - else - { - if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - num189; - } - - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - else - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num189 * 2f; - else - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num189; - else - npc.velocity.Y = npc.velocity.Y - num189; - } - } - else - { - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num189; - else - npc.velocity.X = npc.velocity.X - num189; - } - } - } - - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - - if (phaseSwitch > phaseLimit) - { - npc.ai[2] = 1f; - phaseSwitch = 0; - npc.netUpdate = true; - } - } - - // Ground - else - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) - Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); - } - - phaseSwitch += 1; - - float turnSpeed = 0.18f + (((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.14f : 0.12f) * (1f - lifeRatio)); - bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; - - // Enrage - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) - turnSpeed *= 6f; - else if (increaseSpeed) - turnSpeed *= 3f; - - if (!flies) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - - if (!flies) - { - npc.localAI[1] = 1f; - - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 1200; - if (lifeRatio < 0.8f && lifeRatio > 0.2f) - num954 = 1400; - - num954 -= (int)(150f * (1f - lifeRatio)); - - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - 1000, (int)Main.player[num955].position.Y - 1000, 2000, num954); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - flies = true; - } - } - else - npc.localAI[1] = 0f; - - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - - if (!flies) - { - npc.TargetClosest(true); - - npc.velocity.Y = npc.velocity.Y + turnSpeed; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; - - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 2.2) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - else - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.Y == fallSpeed) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + num189; - else if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - num189; - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - else - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - else - { - double maximumSpeed1 = (increaseSpeed ? 1.2 : 0.4) + (double)(((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.14f : 0.12f) * (1f - lifeRatio)); - double maximumSpeed2 = (increaseSpeed ? 3.0 : 1.0) + (double)(((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.3f : 0.25f) * (1f - lifeRatio)); - - num193 = (float)Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num25 = Math.Abs(num191); - float num26 = Math.Abs(num192); - float num27 = fallSpeed / num193; - num191 *= num27; - num192 *= num27; - - if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + turnSpeed * 1.5f; - else if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - turnSpeed * 1.5f; - - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.5f; - else if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.5f; - } - - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + turnSpeed; - else if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - turnSpeed; - - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + turnSpeed; - else if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - turnSpeed; - - if ((double)Math.Abs(num192) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + turnSpeed * 2f; - else - npc.velocity.Y = npc.velocity.Y - turnSpeed * 2f; - } - - if ((double)Math.Abs(num191) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + turnSpeed * 2f; - else - npc.velocity.X = npc.velocity.X - turnSpeed * 2f; - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + turnSpeed * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - turnSpeed * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + turnSpeed; - else - npc.velocity.Y = npc.velocity.Y - turnSpeed; - } - } - else - { - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) - { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + turnSpeed; - else - npc.velocity.X = npc.velocity.X - turnSpeed; - } - } - } - - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - - if (flies) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - - if (phaseSwitch > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900)) - { - npc.ai[2] = 0f; - phaseSwitch = 0; - npc.netUpdate = true; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("CosmiliteBrick"); - } - - public override bool SpecialNPCLoot() - { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, - mod.NPCType("DevourerofGodsHeadS"), - mod.NPCType("DevourerofGodsBodyS"), - mod.NPCType("DevourerofGodsTailS")); - npc.position = Main.npc[closestSegmentID].position; + [AutoloadBossHead] + public class DevourerofGodsHeadS : ModNPC + { + private bool tail = false; + private const int minLength = 100; + private const int maxLength = 101; + private bool halfLife = false; + private int laserShoot = 0; + private int phaseSwitch = 0; + private int[] shotSpacing = new int[4] { 1050, 1050, 1050, 1050 }; + private const int spacingVar = 105; + private const int totalShots = 20; + private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + public int laserWallPhase = 0; + private int laserWallCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 300; + npc.npcSlots = 5f; + npc.width = 186; + npc.height = 186; + npc.defense = 50; + npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; + if (CalamityWorld.death) + { + npc.lifeMax = 2100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.takenDamageMultiplier = 1.25f; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.boss = true; + npc.value = Item.buyPrice(1, 0, 0, 0); + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; + bossBag = mod.ItemType("DevourerofGodsBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(halfLife); + writer.Write(laserShoot); + writer.Write(phaseSwitch); + writer.Write(shotSpacing[0]); + writer.Write(shotSpacing[1]); + writer.Write(shotSpacing[2]); + writer.Write(shotSpacing[3]); + writer.Write(idleCounter); + writer.Write(laserWallPhase); + writer.Write(laserWallCounter); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + halfLife = reader.ReadBoolean(); + laserShoot = reader.ReadInt32(); + phaseSwitch = reader.ReadInt32(); + shotSpacing[0] = reader.ReadInt32(); + shotSpacing[1] = reader.ReadInt32(); + shotSpacing[2] = reader.ReadInt32(); + shotSpacing[3] = reader.ReadInt32(); + idleCounter = reader.ReadInt32(); + laserWallPhase = reader.ReadInt32(); + laserWallCounter = reader.ReadInt32(); + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // whoAmI variable + CalamityGlobalNPC.DoGHead = npc.whoAmI; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Variables + Vector2 vector = npc.Center; + bool flies = npc.ai[2] == 0f; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool speedBoost = lifeRatio < 0.6 || (CalamityWorld.bossRushActive && lifeRatio < 0.9); + bool speedBoost2 = lifeRatio < 0.2; + bool breathFireMore = lifeRatio < 0.15; + + // Laser walls + if (speedBoost && !speedBoost2) + { + if (laserWallPhase == 0) //start laser wall phase + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + laserWallCounter += 1; + if (laserWallCounter >= 720) + { + laserWallCounter = 0; + laserWallPhase = 1; + } + } + } + else if (laserWallPhase == 1) //turn invisible and fire laser walls + { + npc.alpha += 5; + if (npc.alpha == 255) + laserShoot = 0; + + if (npc.alpha >= 255) + { + npc.alpha = 255; + idleCounter--; + if (idleCounter <= 0) + { + laserWallPhase = 2; + idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + } + } + } + else if (laserWallPhase == 2) //turn visible + { + npc.alpha -= 1; + if (npc.alpha <= 0) + { + npc.alpha = 0; + laserWallPhase = 0; + } + } + } + else + { + npc.alpha -= 6; + if (npc.alpha < 0) + npc.alpha = 0; + + if (laserWallPhase > 0) + laserWallPhase = 0; + } + + // Anger message + if (speedBoost2) + { + if (!halfLife) + { + string key = "Mods.CalamityMod.EdgyBossText11"; + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + + halfLife = true; + } + } + + // Light + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + + // Worm shit again + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + + // Target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + npc.TargetClosest(true); + + // Velocity + npc.velocity.Length(); + + // Spawn segments and fire projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Segments + if (!tail && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) + { + int segment = 0; + if (segmentSpawn >= 0 && segmentSpawn < minLength) + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBodyS"), npc.whoAmI); + else + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTailS"), npc.whoAmI); + + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[2] = (float)npc.whoAmI; + Main.npc[segment].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)segment; + NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); + Previous = segment; + } + tail = true; + } + + int projectileDamage = expertMode ? 69 : 80; + + // Fireballs + if (npc.alpha <= 0 && Vector2.Distance(Main.player[npc.target].Center, vector) > 500f && expertMode) + { + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (breathFireMore ? 60f : 120f) == 0f) + { + Vector2 vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num427 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector44.X; + float num428 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector44.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num430 = 16f; + int num432 = mod.ProjectileType("DoGFire"); + + float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); + num429 = num430 / num429; + num427 *= num429; + num428 *= num429; + num428 += npc.velocity.Y * 0.5f; + num427 += npc.velocity.X * 0.5f; + vector44.X -= num427 * 1f; + vector44.Y -= num428 * 1f; + + Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, projectileDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + else if (Vector2.Distance(Main.player[npc.target].Center, vector) < 250f) + calamityGlobalNPC.newAI[0] = 0f; + + // Laser walls + if (!speedBoost2 && (laserWallPhase == 1 || calamityGlobalNPC.enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive))) + { + laserShoot += 1; + + float speed = 4f; + int divisor = CalamityWorld.bossRushActive ? 90 : (CalamityWorld.death ? 105 : 120); + + if (laserShoot % divisor == 0) + { + Main.PlaySound(2, (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y, 12); + + float targetPosY = Main.player[npc.target].position.Y + (Main.rand.NextBool(2) ? 50f : 0f); + + // Side walls + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + (float)shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[0] -= spacingVar; + } + + if (Main.rand.NextBool(2) && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + for (int x = 0; x < 10; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + (float)shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[3] -= (Main.rand.NextBool(2) ? 180 : 200); + } + shotSpacing[3] = 1050; + } + shotSpacing[0] = 1050; + + // Lower wall + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + (float)shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[1] -= spacingVar; + } + shotSpacing[1] = 1050; + + // Upper wall + if (lifeRatio < 0.4f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + if (shotSpacing[2] < 2100) + shotSpacing[2] = 2100; + + for (int x = 0; x < 40; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + (float)shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[2] -= spacingVar; + } + shotSpacing[2] = 2100; + } + else + { + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + (float)shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[2] -= spacingVar; + } + shotSpacing[2] = 1050; + } + } + } + } + + // Despawn + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) + npc.active = false; + + float fallSpeed = 16f; + if (Main.player[npc.target].dead) + { + flies = true; + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 3f; + fallSpeed = 32f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[a].type == mod.NPCType("DevourerofGodsBodyS") || Main.npc[a].type == mod.NPCType("DevourerofGodsTailS")) + Main.npc[a].active = false; + } + } + } + fallSpeed += ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (1f - lifeRatio); + + // Movement + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + + if (num180 < 0) + num180 = 0; + if (num181 > Main.maxTilesX) + num181 = Main.maxTilesX; + if (num182 < 0) + num182 = 0; + if (num183 > Main.maxTilesY) + num183 = Main.maxTilesY; + + 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); + + // Flight + if (npc.ai[2] == 0f) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); + } + + phaseSwitch += 1; + + int phaseLimit = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900) / (1 + (int)(5f * (1f - lifeRatio))); + + npc.localAI[1] = 0f; + + float speed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 18f : 15f) + (3f * (1f - lifeRatio)); + float turnSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.3f) + (0.06f * (1f - lifeRatio)); + float homingSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 28f : 24f) + (12f * (1f - lifeRatio)); + float homingTurnSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.36f : 0.33f) + (0.15f * (1f - lifeRatio)); + + // Go to ground phase sooner + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) + phaseSwitch += 10; + + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + + // Charge at target for 1.5 seconds + bool flyAtTarget = (!speedBoost || speedBoost2) && phaseSwitch > phaseLimit - 90 && (CalamityWorld.revenge || CalamityWorld.bossRushActive); + + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + break; + } + + if (!flyAtTarget) + { + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 800); + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + num191 = Main.player[npc.target].Center.X + 600f; + else + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + } + else + { + num188 = homingSpeed; + num189 = homingTurnSpeed; + } + + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + + if (!flyAtTarget) + { + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + num189; + else + { + if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - num189; + } + + if (npc.velocity.Y < num192) + npc.velocity.Y = npc.velocity.Y + num189; + else + { + if (npc.velocity.Y > num192) + npc.velocity.Y = npc.velocity.Y - num189; + } + + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + else + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + num189 * 2f; + else + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + else if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + num189; + else + npc.velocity.Y = npc.velocity.Y - num189; + } + } + else + { + if (npc.velocity.Y < num192) + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + else if (npc.velocity.Y > num192) + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + num189; + else + npc.velocity.X = npc.velocity.X - num189; + } + } + } + + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + + if (phaseSwitch > phaseLimit) + { + npc.ai[2] = 1f; + phaseSwitch = 0; + npc.netUpdate = true; + } + } + + // Ground + else + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); + } + + phaseSwitch += 1; + + float turnSpeed = 0.18f + (((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.14f : 0.12f) * (1f - lifeRatio)); + bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; + + // Enrage + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) + turnSpeed *= 6f; + else if (increaseSpeed) + turnSpeed *= 3f; + + if (!flies) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flies = true; + break; + } + } + } + } + } + + if (!flies) + { + npc.localAI[1] = 1f; + + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 1200; + if (lifeRatio < 0.8f && lifeRatio > 0.2f) + num954 = 1400; + + num954 -= (int)(150f * (1f - lifeRatio)); + + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - 1000, (int)Main.player[num955].position.Y - 1000, 2000, num954); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + flies = true; + } + } + else + npc.localAI[1] = 0f; + + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + if (!flies) + { + npc.TargetClosest(true); + + npc.velocity.Y = npc.velocity.Y + turnSpeed; + if (npc.velocity.Y > fallSpeed) + npc.velocity.Y = fallSpeed; + + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 2.2) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + else + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.Y == fallSpeed) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + num189; + else if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - num189; + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + else + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + else + { + double maximumSpeed1 = (increaseSpeed ? 1.2 : 0.4) + (double)(((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.14f : 0.12f) * (1f - lifeRatio)); + double maximumSpeed2 = (increaseSpeed ? 3.0 : 1.0) + (double)(((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.3f : 0.25f) * (1f - lifeRatio)); + + num193 = (float)Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num25 = Math.Abs(num191); + float num26 = Math.Abs(num192); + float num27 = fallSpeed / num193; + num191 *= num27; + num192 *= num27; + + if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + turnSpeed * 1.5f; + else if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - turnSpeed * 1.5f; + + if (npc.velocity.Y < num192) + npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.5f; + else if (npc.velocity.Y > num192) + npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.5f; + } + + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + turnSpeed; + else if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - turnSpeed; + + if (npc.velocity.Y < num192) + npc.velocity.Y = npc.velocity.Y + turnSpeed; + else if (npc.velocity.Y > num192) + npc.velocity.Y = npc.velocity.Y - turnSpeed; + + if ((double)Math.Abs(num192) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + turnSpeed * 2f; + else + npc.velocity.Y = npc.velocity.Y - turnSpeed * 2f; + } + + if ((double)Math.Abs(num191) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + turnSpeed * 2f; + else + npc.velocity.X = npc.velocity.X - turnSpeed * 2f; + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num191) + npc.velocity.X = npc.velocity.X + turnSpeed * 1.1f; + else if (npc.velocity.X > num191) + npc.velocity.X = npc.velocity.X - turnSpeed * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = npc.velocity.Y + turnSpeed; + else + npc.velocity.Y = npc.velocity.Y - turnSpeed; + } + } + else + { + if (npc.velocity.Y < num192) + npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.1f; + else if (npc.velocity.Y > num192) + npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + { + if (npc.velocity.X > 0f) + npc.velocity.X = npc.velocity.X + turnSpeed; + else + npc.velocity.X = npc.velocity.X - turnSpeed; + } + } + } + + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + + if (flies) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + + if (phaseSwitch > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900)) + { + npc.ai[2] = 0f; + phaseSwitch = 0; + npc.netUpdate = true; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("CosmiliteBrick"); + } + + public override bool SpecialNPCLoot() + { + int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + mod.NPCType("DevourerofGodsHeadS"), + mod.NPCType("DevourerofGodsBodyS"), + mod.NPCType("DevourerofGodsTailS")); + npc.position = Main.npc[closestSegmentID].position; return false; - } + } public override void NPCLoot() { @@ -903,64 +903,67 @@ namespace CalamityMod.NPCs.TheDevourerofGods CalamityMod.UpdateServerBoolean(); } - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; + // Can only hit the target if within certain distance + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; - Rectangle targetHitbox = target.Hitbox; + Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; - return minDist <= 80f && npc.alpha == 0; - } + return minDist <= 80f && npc.alpha == 0; + } - // Projectiles can only hit within certain distance - /*public override bool? CanBeHitByProjectile(Projectile projectile) - { - Rectangle projectileHitbox = projectile.Hitbox; + // Projectiles can only hit within certain distance + /*public override bool? CanBeHitByProjectile(Projectile projectile) + { + Rectangle projectileHitbox = projectile.Hitbox; - float dist1 = Vector2.Distance(npc.Center, projectileHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, projectileHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, projectileHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, projectileHitbox.BottomRight()); + float dist1 = Vector2.Distance(npc.Center, projectileHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, projectileHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, projectileHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, projectileHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) minDist = dist2; + if (dist3 < minDist) minDist = dist3; + if (dist4 < minDist) minDist = dist4; - return minDist <= 80f; - }*/ + return minDist <= 80f; + }*/ - // Melee hitboxes are fucked so I have no clue what to do here - /*public override bool? CanBeHitByItem(Player player, Item item) - { - Rectangle targetHitbox = target.Hitbox; + // Melee hitboxes are fucked so I have no clue what to do here + /*public override bool? CanBeHitByItem(Player player, Item item) + { + Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) minDist = dist2; + if (dist3 < minDist) minDist = dist3; + if (dist4 < minDist) minDist = dist4; - return minDist <= 80f && npc.alpha == 0; - }*/ + return minDist <= 80f && npc.alpha == 0; + }*/ - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { if (CalamityUtils.AntiButcher(npc, ref damage, 0.5f)) { string key = "Mods.CalamityMod.EdgyBossText2"; @@ -972,98 +975,98 @@ namespace CalamityMod.NPCs.TheDevourerofGods return false; } return true; - } + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 2f; - return null; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS2"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS2"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 300, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); - if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.alpha <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 300, true); - player.AddBuff(BuffID.Darkness, 300, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 300, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); + if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.alpha <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + int num = Main.rand.Next(5); + string key = "Mods.CalamityMod.EdgyBossText3"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText3"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText4"; + } + else if (num == 2) + { + key = "Mods.CalamityMod.EdgyBossText5"; + } + else if (num == 3) + { + key = "Mods.CalamityMod.EdgyBossText6"; + } + else if (num == 4) + { + key = "Mods.CalamityMod.EdgyBossText7"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 300, true); + player.AddBuff(BuffID.Darkness, 300, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs index 268d54428e..96abf933d9 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs @@ -1,241 +1,240 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.TheDevourerofGods { [AutoloadBossHead] - public class DevourerofGodsTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } + public class DevourerofGodsTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } - public override void SetDefaults() - { - npc.damage = 150; - npc.npcSlots = 5f; - npc.width = 66; - npc.height = 66; - npc.defense = 50; - npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; - if (CalamityWorld.death) - { - npc.lifeMax = 1300000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - npc.takenDamageMultiplier = 1.25f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; - } + public override void SetDefaults() + { + npc.damage = 150; + npc.npcSlots = 5f; + npc.width = 66; + npc.height = 66; + npc.defense = 50; + npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; + if (CalamityWorld.death) + { + npc.lifeMax = 1300000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + npc.takenDamageMultiplier = 1.25f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 0; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 0; + return true; + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGTail"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGTail"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); + int num = Main.rand.Next(2); + string key = "Mods.CalamityMod.EdgyBossText8"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText8"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText9"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs index 95cc086b20..e2ca9e9069 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs @@ -1,5 +1,5 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,60 +7,60 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.TheDevourerofGods { public class DevourerofGodsTail2 : ModNPC - { + { public int invinceTime = 180; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Guardian"); - } + { + DisplayName.SetDefault("Cosmic Guardian"); + } - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 30; - npc.height = 50; - npc.defense = 70; + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 5f; + npc.width = 30; + npc.height = 50; + npc.defense = 70; npc.lifeMax = 100000; npc.aiStyle = 6; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); if (invinceTime > 0) { invinceTime--; @@ -78,79 +78,79 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.HitEffect(0, 10.0); npc.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { if (npc.alpha != 0) { int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + { + cooldownSlot = 1; + return true; + } public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { + { + if (npc.life <= 0) + { float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 1f); npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); - player.AddBuff(BuffID.Frostburn, 90, true); - player.AddBuff(BuffID.Darkness, 90, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); + player.AddBuff(BuffID.Frostburn, 90, true); + player.AddBuff(BuffID.Darkness, 90, true); + } } } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs index d1981eb5f6..aec1832345 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs @@ -1,315 +1,316 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.TheDevourerofGods { [AutoloadBossHead] - public class DevourerofGodsTailS : ModNPC - { - private int invinceTime = 720; - private bool setAlpha = false; + public class DevourerofGodsTailS : ModNPC + { + private int invinceTime = 720; + private bool setAlpha = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } - public override void SetDefaults() - { - npc.damage = 180; - npc.npcSlots = 5f; - npc.width = 80; - npc.height = 140; - npc.defense = 50; - npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; - if (CalamityWorld.death) - { - npc.lifeMax = 2100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.takenDamageMultiplier = 1.25f; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; - npc.dontCountMe = true; - } + public override void SetDefaults() + { + npc.damage = 180; + npc.npcSlots = 5f; + npc.width = 80; + npc.height = 140; + npc.defense = 50; + npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; + if (CalamityWorld.death) + { + npc.lifeMax = 2100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.takenDamageMultiplier = 1.25f; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; + npc.dontCountMe = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(setAlpha); - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(setAlpha); + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - setAlpha = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + setAlpha = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } - public override void AI() - { - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - npc.active = false; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) - { - npc.alpha -= 42; - if (npc.alpha <= 0 && invinceTime <= 0) - { - setAlpha = true; - npc.alpha = 0; - } - } - else - { - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + public override void AI() + { + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) + { + npc.active = false; + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + { + npc.alpha -= 42; + if (npc.alpha <= 0 && invinceTime <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 0; + // Can only hit the target if within certain distance + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 0; - Rectangle targetHitbox = target.Hitbox; + Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; - return minDist <= 70f && npc.alpha == 0; - } + return minDist <= 70f && npc.alpha == 0; + } - // Projectiles can only hit within certain distance - /*public override bool? CanBeHitByProjectile(Projectile projectile) - { - Rectangle projectileHitbox = projectile.Hitbox; + // Projectiles can only hit within certain distance + /*public override bool? CanBeHitByProjectile(Projectile projectile) + { + Rectangle projectileHitbox = projectile.Hitbox; - float dist1 = Vector2.Distance(npc.Center, projectileHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, projectileHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, projectileHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, projectileHitbox.BottomRight()); + float dist1 = Vector2.Distance(npc.Center, projectileHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, projectileHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, projectileHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, projectileHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) minDist = dist2; + if (dist3 < minDist) minDist = dist3; + if (dist4 < minDist) minDist = dist4; - return minDist <= 70f; - }*/ + return minDist <= 70f; + }*/ - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS6"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS6"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); - } + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() + { + return false; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); + int num = Main.rand.Next(2); + string key = "Mods.CalamityMod.EdgyBossText8"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText8"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText9"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } + } } diff --git a/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs b/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs index 005e931c60..b866d85b99 100644 --- a/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs +++ b/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.TheDevourerofGods { - public class DoGScreenShaderDataS : ScreenShaderData - { - private int DoGIndex; + public class DoGScreenShaderDataS : ScreenShaderData + { + private int DoGIndex; - public DoGScreenShaderDataS(string passName) - : base(passName) - { - } + public DoGScreenShaderDataS(string passName) + : base(passName) + { + } - private void UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - } + private void UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + } - public override void Apply() - { - UpdateDoGIndex(); - if (DoGIndex != -1) - { - UseTargetPosition(Main.npc[DoGIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdateDoGIndex(); + if (DoGIndex != -1) + { + UseTargetPosition(Main.npc[DoGIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/TheDevourerofGods/DoGScreenShaderData.cs b/NPCs/TheDevourerofGods/DoGScreenShaderData.cs index 2a0487febf..8513eacb24 100644 --- a/NPCs/TheDevourerofGods/DoGScreenShaderData.cs +++ b/NPCs/TheDevourerofGods/DoGScreenShaderData.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.TheDevourerofGods { - public class DoGScreenShaderData : ScreenShaderData - { - private int DoGIndex; + public class DoGScreenShaderData : ScreenShaderData + { + private int DoGIndex; - public DoGScreenShaderData(string passName) - : base(passName) - { - } + public DoGScreenShaderData(string passName) + : base(passName) + { + } - private void UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - } + private void UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + } - public override void Apply() - { - UpdateDoGIndex(); - if (DoGIndex != -1) - { - UseTargetPosition(Main.npc[DoGIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdateDoGIndex(); + if (DoGIndex != -1) + { + UseTargetPosition(Main.npc[DoGIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/TheDevourerofGods/DoGSky.cs b/NPCs/TheDevourerofGods/DoGSky.cs index 837345943d..b748f8b7d2 100644 --- a/NPCs/TheDevourerofGods/DoGSky.cs +++ b/NPCs/TheDevourerofGods/DoGSky.cs @@ -1,113 +1,113 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Effects; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.TheDevourerofGods { - public class DoGSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int DoGIndex = -1; + public class DoGSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int DoGIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdateDoGIndex()) - { - float x = 0f; - if (this.DoGIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; - } - return 0.5f; - } + private float GetIntensity() + { + if (this.UpdateDoGIndex()) + { + float x = 0f; + if (this.DoGIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; + } + return 0.5f; + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return true; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - return DoGIndex != -1; - } + private bool UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return true; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + return DoGIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) - { - if (Main.npc[CalamityGlobalNPC.DoGHead].active) - { - float intensity = this.GetIntensity(); - if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - Color.Black * (intensity + 0.5f)); - } - else - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); - } - } - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) + { + if (Main.npc[CalamityGlobalNPC.DoGHead].active) + { + float intensity = this.GetIntensity(); + if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + Color.Black * (intensity + 0.5f)); + } + else + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); + } + } + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/TheDevourerofGods/DoGSkyS.cs b/NPCs/TheDevourerofGods/DoGSkyS.cs index 35af303ef9..cac586d9d3 100644 --- a/NPCs/TheDevourerofGods/DoGSkyS.cs +++ b/NPCs/TheDevourerofGods/DoGSkyS.cs @@ -1,113 +1,113 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Effects; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.TheDevourerofGods { - public class DoGSkyS : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int DoGIndex = -1; + public class DoGSkyS : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int DoGIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdateDoGIndex()) - { - float x = 0f; - if (this.DoGIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; - } - return 0.5f; - } + private float GetIntensity() + { + if (this.UpdateDoGIndex()) + { + float x = 0f; + if (this.DoGIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; + } + return 0.5f; + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return true; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - return DoGIndex != -1; - } + private bool UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return true; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + return DoGIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) - { - if (Main.npc[CalamityGlobalNPC.DoGHead].active) - { - float intensity = this.GetIntensity(); - if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - Color.Black * (intensity + 0.5f)); - } - else - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); - } - } - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) + { + if (Main.npc[CalamityGlobalNPC.DoGHead].active) + { + float intensity = this.GetIntensity(); + if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + Color.Black * (intensity + 0.5f)); + } + else + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); + } + } + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index 74277e204f..b37d4204e8 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -1,13 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using CalamityMod.World; using System.Collections.Generic; using System.Linq; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.TownNPCs { @@ -24,8 +21,8 @@ namespace CalamityMod.NPCs.TownNPCs "Amber", "Anne", "Indiana", }; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bandit"); + { + DisplayName.SetDefault("Bandit"); Main.npcFrameCount[npc.type] = 23; //yell at Cobalion about this plz kthx NPCID.Sets.ExtraFramesCount[npc.type] = 9; @@ -36,12 +33,12 @@ namespace CalamityMod.NPCs.TownNPCs NPCID.Sets.AttackAverageChance[npc.type] = 10; } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.townNPC = true; npc.friendly = true; - npc.lavaImmune = false; - npc.width = 40; + npc.lavaImmune = false; + npc.width = 40; npc.height = 40; npc.aiStyle = 7; npc.damage = 10; @@ -190,31 +187,31 @@ namespace CalamityMod.NPCs.TownNPCs return "Sorry, I got nothing."; } - public override void SetChatButtons(ref string button, ref string button2) + public override void SetChatButtons(ref string button, ref string button2) { button = Language.GetTextValue("LegacyInterface.28"); - button2 = "Refund"; - } + button2 = "Refund"; + } public override void OnChatButtonClicked(bool firstButton, ref bool shop) { - if (firstButton) - { - shop = true; - } - else - { - shop = false; - Main.npcChatText = Refund(); - } - } + if (firstButton) + { + shop = true; + } + else + { + shop = false; + Main.npcChatText = Refund(); + } + } public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original item value { shop.item[nextSlot].SetDefaults(mod.ItemType("Cinquedea")); shop.item[nextSlot].shopCustomPrice = mod.GetItem("Cinquedea").item.value; nextSlot++; - } + } public override void TownNPCAttackStrength(ref int damage, ref float knockback) { diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 82b8e86acc..92381a6c28 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -1,191 +1,190 @@ +using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.GameContent.Events; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.TownNPCs { - [AutoloadHead] - public class DILF : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Archmage"); + [AutoloadHead] + public class DILF : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Archmage"); - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 9; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 90; - NPCID.Sets.AttackAverageChance[npc.type] = 30; - } + Main.npcFrameCount[npc.type] = 25; + NPCID.Sets.ExtraFramesCount[npc.type] = 9; + NPCID.Sets.AttackFrameCount[npc.type] = 4; + NPCID.Sets.DangerDetectRange[npc.type] = 700; + NPCID.Sets.AttackType[npc.type] = 0; + NPCID.Sets.AttackTime[npc.type] = 90; + NPCID.Sets.AttackAverageChance[npc.type] = 30; + } - public override void SetDefaults() - { - npc.townNPC = true; - npc.friendly = true; - npc.lavaImmune = true; - npc.width = 18; - npc.height = 40; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 20000; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.8f; - animationType = NPCID.Guide; - } + public override void SetDefaults() + { + npc.townNPC = true; + npc.friendly = true; + npc.lavaImmune = true; + npc.width = 18; + npc.height = 40; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 15; + npc.lifeMax = 20000; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.8f; + animationType = NPCID.Guide; + } - public override bool CanTownNPCSpawn(int numTownNPCs, int money) - { - return CalamityWorld.downedCryogen; - } + public override bool CanTownNPCSpawn(int numTownNPCs, int money) + { + return CalamityWorld.downedCryogen; + } - public override string TownNPCName() - { - return "Permafrost"; - } + public override string TownNPCName() + { + return "Permafrost"; + } - public override string GetChat() - { - if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) - { - if (Main.rand.NextBool(2)) - return "I deeply appreciate you rescuing me from being trapped within my frozen castle…. It's been many, many years..."; - else - return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; - } + public override string GetChat() + { + if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) + { + if (Main.rand.NextBool(2)) + return "I deeply appreciate you rescuing me from being trapped within my frozen castle…. It's been many, many years..."; + else + return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; + } - IList dialogue = new List(); + IList dialogue = new List(); - if (Main.dayTime) - { - dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste..."); - dialogue.Add("My dear! What is it you would like to talk about today?"); - dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!"); - dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry..."); - dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it..."); - dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs..."); - } - else - { - dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); - dialogue.Add("You could break the icy stillness in the air tonight."); - dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon..."); - dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure..."); - dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive..."); - dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do..."); - } + if (Main.dayTime) + { + dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste..."); + dialogue.Add("My dear! What is it you would like to talk about today?"); + dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!"); + dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry..."); + dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it..."); + dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs..."); + } + else + { + dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); + dialogue.Add("You could break the icy stillness in the air tonight."); + dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon..."); + dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure..."); + dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive..."); + dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do..."); + } - dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted."); + dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted."); - if (BirthdayParty.PartyIsUp) - dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies."); + if (BirthdayParty.PartyIsUp) + dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies."); - if (NPC.downedMoonlord) - { - dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you..."); - dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?"); - } + if (NPC.downedMoonlord) + { + dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you..."); + dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?"); + } - if (CalamityWorld.downedPolterghast) - dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss..."); + if (CalamityWorld.downedPolterghast) + dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss..."); - if (CalamityWorld.downedYharon) - dialogue.Add("...Where is Lord Yharim? He must be up to something..."); + if (CalamityWorld.downedYharon) + dialogue.Add("...Where is Lord Yharim? He must be up to something..."); - int dryad = NPC.FindFirstNPC(NPCID.Dryad); - if (dryad != -1) - dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); + int dryad = NPC.FindFirstNPC(NPCID.Dryad); + if (dryad != -1) + dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); - if (Main.player[Main.myPlayer].Calamity().chibii) - dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); + if (Main.player[Main.myPlayer].Calamity().chibii) + dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); - if (Main.player[Main.myPlayer].Calamity().cryogenSoul) - dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); + if (Main.player[Main.myPlayer].Calamity().cryogenSoul) + dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); - if (Main.hardMode) - dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you..."); + if (Main.hardMode) + dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you..."); - return dialogue[Main.rand.Next(dialogue.Count)]; - } + return dialogue[Main.rand.Next(dialogue.Count)]; + } - public override void SetChatButtons(ref string button, ref string button2) - { - button = Language.GetTextValue("LegacyInterface.28"); - } + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("LegacyInterface.28"); + } - public override void OnChatButtonClicked(bool firstButton, ref bool shop) - { - if (firstButton) - shop = true; - } + public override void OnChatButtonClicked(bool firstButton, ref bool shop) + { + if (firstButton) + shop = true; + } - public override void SetupShop(Chest shop, ref int nextSlot) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("ColdheartIcicle")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("AbsoluteZero")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("FrostbiteBlaster")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("EternalBlizzard")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("WintersFury")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("ArcticBearPaw")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleTrident")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("FrostyFlare")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("CryogenicStaff")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("PermafrostsConcoction")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("IcyBullet")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleArrow")); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.SuperManaPotion); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("DeliciousMeat")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("EnchantedMetal")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("BearEye")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("Popo")); - nextSlot++; - } + public override void SetupShop(Chest shop, ref int nextSlot) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("ColdheartIcicle")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("AbsoluteZero")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("FrostbiteBlaster")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("EternalBlizzard")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("WintersFury")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("ArcticBearPaw")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleTrident")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("FrostyFlare")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("CryogenicStaff")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("PermafrostsConcoction")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("IcyBullet")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleArrow")); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.SuperManaPotion); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("DeliciousMeat")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("EnchantedMetal")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("BearEye")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("Popo")); + nextSlot++; + } - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 20; - knockback = 9f; - } + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 20; + knockback = 9f; + } - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 10; - randExtraCooldown = 50; - } + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 10; + randExtraCooldown = 50; + } - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = mod.ProjectileType("DarkIce"); - attackDelay = 1; - } + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = mod.ProjectileType("DarkIce"); + attackDelay = 1; + } - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 2f; - } - } + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 2f; + } + } } diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 5243ea352f..955787801b 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -1,21 +1,20 @@ +using CalamityMod.World; using System.Collections.Generic; using Terraria; -using Terraria.GameContent.Events; -using Terraria.Localization; using Terraria.DataStructures; +using Terraria.GameContent.Events; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] public class FAP : ModNPC - { + { public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drunk Princess"); + { + DisplayName.SetDefault("Drunk Princess"); Main.npcFrameCount[npc.type] = 25; NPCID.Sets.ExtraFramesCount[npc.type] = 9; @@ -26,12 +25,12 @@ namespace CalamityMod.NPCs.TownNPCs NPCID.Sets.AttackAverageChance[npc.type] = 15; } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.townNPC = true; npc.friendly = true; - npc.lavaImmune = true; - npc.width = 18; + npc.lavaImmune = true; + npc.width = 18; npc.height = 40; npc.aiStyle = 7; npc.damage = 10; @@ -197,46 +196,46 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("If I was a magical horse in this reality I'd be out in space swirling cocktails as I watch space worms battle for my enjoyment."); } - int donorAmt = CalamityMod.donatorList.Count; - string firstDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + int donorAmt = CalamityMod.donatorList.Count; + string firstDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; - string secondDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; - while (secondDonor == firstDonor) - secondDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + string secondDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + while (secondDonor == firstDonor) + secondDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; - string thirdDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; - while (thirdDonor == firstDonor || thirdDonor == secondDonor) - thirdDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + string thirdDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + while (thirdDonor == firstDonor || thirdDonor == secondDonor) + thirdDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; - dialogue.Add("Hey " + firstDonor + ", " + secondDonor + ", and " + thirdDonor + "! You're all pretty good! ...wait, who are you?"); + dialogue.Add("Hey " + firstDonor + ", " + secondDonor + ", and " + thirdDonor + "! You're all pretty good! ...wait, who are you?"); return dialogue[Main.rand.Next(dialogue.Count)]; } - public string Death() - { - return "You have failed " + Main.player[Main.myPlayer].Calamity().deathCount + - (Main.player[Main.myPlayer].Calamity().deathCount == 1 ? " time." : " times."); - } + public string Death() + { + return "You have failed " + Main.player[Main.myPlayer].Calamity().deathCount + + (Main.player[Main.myPlayer].Calamity().deathCount == 1 ? " time." : " times."); + } - public override void SetChatButtons(ref string button, ref string button2) + public override void SetChatButtons(ref string button, ref string button2) { button = Language.GetTextValue("LegacyInterface.28"); - button2 = "Death Count"; - } + button2 = "Death Count"; + } public override void OnChatButtonClicked(bool firstButton, ref bool shop) { - if (firstButton) - { - shop = true; - } - else - { - shop = false; - Main.npcChatText = Death(); - } - } + if (firstButton) + { + shop = true; + } + else + { + shop = false; + Main.npcChatText = Death(); + } + } public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original item value { @@ -326,26 +325,26 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 35, 0, 0); nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("BlueCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("BlueCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("PinkCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("PinkCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("PurpleCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("PurpleCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("YellowCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("YellowCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("OddMushroom")); + shop.item[nextSlot].SetDefaults(mod.ItemType("OddMushroom")); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(3, 0, 0, 0); nextSlot++; - } + } public override void TownNPCAttackStrength(ref int damage, ref float knockback) { diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 95426ac14a..580549498a 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -1,305 +1,304 @@ +using CalamityMod.World; using System.Collections.Generic; using Terraria; -using Terraria.Localization; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class SEAHOE : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea King"); + public class SEAHOE : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea King"); - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 5; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 90; - NPCID.Sets.AttackAverageChance[npc.type] = 30; - } + Main.npcFrameCount[npc.type] = 25; + NPCID.Sets.ExtraFramesCount[npc.type] = 5; + NPCID.Sets.AttackFrameCount[npc.type] = 4; + NPCID.Sets.DangerDetectRange[npc.type] = 700; + NPCID.Sets.AttackType[npc.type] = 0; + NPCID.Sets.AttackTime[npc.type] = 90; + NPCID.Sets.AttackAverageChance[npc.type] = 30; + } - public override void SetDefaults() - { - npc.townNPC = true; - npc.friendly = true; - npc.width = 30; - npc.height = 58; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 25; - npc.lifeMax = 7500; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.65f; - animationType = NPCID.Guide; - } + public override void SetDefaults() + { + npc.townNPC = true; + npc.friendly = true; + npc.width = 30; + npc.height = 58; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 25; + npc.lifeMax = 7500; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.65f; + animationType = NPCID.Guide; + } - public override bool CanTownNPCSpawn(int numTownNPCs, int money) - { - return CalamityWorld.downedCLAM && CalamityWorld.downedDesertScourge; - } + public override bool CanTownNPCSpawn(int numTownNPCs, int money) + { + return CalamityWorld.downedCLAM && CalamityWorld.downedDesertScourge; + } - public override string TownNPCName() - { - return "Amidias"; - } + public override string TownNPCName() + { + return "Amidias"; + } - public override void AI() - { - npc.breath += 2; - } + public override void AI() + { + npc.breath += 2; + } - public override string GetChat() - { - IList dialogue = new List(); - Player player = Main.player[Main.myPlayer]; + public override string GetChat() + { + IList dialogue = new List(); + Player player = Main.player[Main.myPlayer]; - if (npc.homeless) - { - if (Main.rand.NextBool(2)) - return "Is this...what the world is like now? It seems so much more lifeless than when I saw it before I disappeared."; - else - return "Thank you for your service, my child, but I am afraid I am without a home now."; - } - if (Main.dayTime) - { - dialogue.Add("My homeland may have dried up but the memories of my people still remain. I will not let them be in vain."); - dialogue.Add("There is a lot that you do not know about this world, specifically regarding the past. Much of it has been lost to history due to the many wars that plagued it."); - dialogue.Add("How can I survive on land? Ah, that is a secret. No, actually...I can breathe air like you!"); - dialogue.Add("Why do you ask if it's the males that carry the young? Don't your males carry their young?"); - } - else - { - dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); - dialogue.Add("Most creatures look up at the moon and admire it. I look up and fear it."); - dialogue.Add("Oh, me? I don't sleep, it's part of my nature."); - } + if (npc.homeless) + { + if (Main.rand.NextBool(2)) + return "Is this...what the world is like now? It seems so much more lifeless than when I saw it before I disappeared."; + else + return "Thank you for your service, my child, but I am afraid I am without a home now."; + } + if (Main.dayTime) + { + dialogue.Add("My homeland may have dried up but the memories of my people still remain. I will not let them be in vain."); + dialogue.Add("There is a lot that you do not know about this world, specifically regarding the past. Much of it has been lost to history due to the many wars that plagued it."); + dialogue.Add("How can I survive on land? Ah, that is a secret. No, actually...I can breathe air like you!"); + dialogue.Add("Why do you ask if it's the males that carry the young? Don't your males carry their young?"); + } + else + { + dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); + dialogue.Add("Most creatures look up at the moon and admire it. I look up and fear it."); + dialogue.Add("Oh, me? I don't sleep, it's part of my nature."); + } - int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl); - if (partyGirl != -1) - { - dialogue.Add(Main.npc[partyGirl].GivenName + " asked if my nose could be used as a vuvuzela. What is a vuvuzela?"); - } + int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl); + if (partyGirl != -1) + { + dialogue.Add(Main.npc[partyGirl].GivenName + " asked if my nose could be used as a vuvuzela. What is a vuvuzela?"); + } - int lilBitch = NPC.FindFirstNPC(NPCID.Angler); - if (lilBitch != -1) - { - dialogue.Add("Meet me at " + Main.npc[lilBitch].GivenName + "'s house at night. We're going to throw him to the Trashers."); - dialogue.Add("Not sure how " + Main.npc[lilBitch].GivenName + " has not been roasted and digested by now, hanging around the sulphuric seas for so long. Peharps it got to his head."); - } + int lilBitch = NPC.FindFirstNPC(NPCID.Angler); + if (lilBitch != -1) + { + dialogue.Add("Meet me at " + Main.npc[lilBitch].GivenName + "'s house at night. We're going to throw him to the Trashers."); + dialogue.Add("Not sure how " + Main.npc[lilBitch].GivenName + " has not been roasted and digested by now, hanging around the sulphuric seas for so long. Peharps it got to his head."); + } - int cirrus = NPC.FindFirstNPC(mod.NPCType("FAP")); - if (cirrus != -1) - dialogue.Add("Rumor has it " + Main.npc[cirrus].GivenName + " drinks to forget her troubled past."); + int cirrus = NPC.FindFirstNPC(mod.NPCType("FAP")); + if (cirrus != -1) + dialogue.Add("Rumor has it " + Main.npc[cirrus].GivenName + " drinks to forget her troubled past."); - if (Main.bloodMoon) - { - dialogue.Add("I'm never keen on these nights. They're so violent."); - } + if (Main.bloodMoon) + { + dialogue.Add("I'm never keen on these nights. They're so violent."); + } - /* - int yharim = NPC.FindFirstNPC(NPCID.Yharim); - if (yharim != -1) - { - dialogue.Add("Oh, Yharim... did he ever realize what he was doing? He seems so...calm, as if his rage had been satiated."); - }*/ + /* + int yharim = NPC.FindFirstNPC(NPCID.Yharim); + if (yharim != -1) + { + dialogue.Add("Oh, Yharim... did he ever realize what he was doing? He seems so...calm, as if his rage had been satiated."); + }*/ - if (Main.player[Main.myPlayer].Calamity().sirenPet) - { - dialogue.Add("Ah, nice duds, my child!"); - } + if (Main.player[Main.myPlayer].Calamity().sirenPet) + { + dialogue.Add("Ah, nice duds, my child!"); + } - if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) || - (Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide)) - { - dialogue.Add("Shouldn't you be wearing a clam bra?"); - } + if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) || + (Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide)) + { + dialogue.Add("Shouldn't you be wearing a clam bra?"); + } - if (Main.hardMode) - { - dialogue.Add("The balance between light and dark is tipping. Stay strong, my child."); - dialogue.Add("Ah, you are starting to realize just how complicated this world is now. You are learning the story of what became of him."); - } + if (Main.hardMode) + { + dialogue.Add("The balance between light and dark is tipping. Stay strong, my child."); + dialogue.Add("Ah, you are starting to realize just how complicated this world is now. You are learning the story of what became of him."); + } - if (NPC.downedMoonlord) - { - dialogue.Add("Do you ever get the feeling that something out there is watching you very carefully? Whatever it is, it's very small and sly, I think."); - dialogue.Add("I must admit, I am quite shaken up now. Never would I have imagined that I would see one of the dark gods again. Not in this lifetime anyhow."); - dialogue.Add("Times like this I wish my home was still in one piece instead of evaporated away. I don't blame the witch for anything, it's just...oh, never mind."); - } + if (NPC.downedMoonlord) + { + dialogue.Add("Do you ever get the feeling that something out there is watching you very carefully? Whatever it is, it's very small and sly, I think."); + dialogue.Add("I must admit, I am quite shaken up now. Never would I have imagined that I would see one of the dark gods again. Not in this lifetime anyhow."); + dialogue.Add("Times like this I wish my home was still in one piece instead of evaporated away. I don't blame the witch for anything, it's just...oh, never mind."); + } - if (CalamityWorld.downedDoG) - { - dialogue.Add("I suppose that witch was mistaken. Defeating the Ceaseless Void and the Devourer has not caused our world to collapse… but I would not lower my guard if I were you."); - } + if (CalamityWorld.downedDoG) + { + dialogue.Add("I suppose that witch was mistaken. Defeating the Ceaseless Void and the Devourer has not caused our world to collapse… but I would not lower my guard if I were you."); + } - /*if (CalamityWorld.downedYharon) - { - dialogue.Add("I'm worried for Lord Yharim. He was not in a particular good mood once we found out you defeated his close friend."); - }*/ + /*if (CalamityWorld.downedYharon) + { + dialogue.Add("I'm worried for Lord Yharim. He was not in a particular good mood once we found out you defeated his close friend."); + }*/ - return dialogue[Main.rand.Next(dialogue.Count)]; - } + return dialogue[Main.rand.Next(dialogue.Count)]; + } - public string Lore() - { - IList dialogue = new List(); - string worldEvil = WorldGen.crimson ? "Crimson" : "Corruption"; + public string Lore() + { + IList dialogue = new List(); + string worldEvil = WorldGen.crimson ? "Crimson" : "Corruption"; - if (CalamityWorld.downedYharon) - { - dialogue.Add("Pockets of ore have appeared once more in the land. This will allow you to create the most powerful weaponry and armor imagined!"); - dialogue.Add("Lord Yharim possesses god-like strength. He may not even fight you at full power which is fortunate for you. His attacks may just kill you in one hit, so be careful."); - dialogue.Add("Draedon's style of confrontation is very...alien and hands-off. You may be more likely to fight any one of his mechs before taking him down."); - } - else if (CalamityWorld.downedDoG) - { - dialogue.Add("The Devourer of God’s cosmic armor is unique in that it is capable of not only protecting his body from tearing itself apart when ripping through the fabric of space and time, but also allows him to control his powers."); - dialogue.Add("With the cosmic steel you can fashion many of your weapons into much more powerful forms."); - dialogue.Add("The Devourer of Gods is extremely powerful. However, he is young, foolhardy, and very lazy. Perhaps if he had been given time to develop he would have turned into quite the threat."); - dialogue.Add("Ah, the dragon Yharon is fickle. You may find that he will refuse to use his full power unless you are strong enough to unleash the power of the Dark Sun."); - } - else if (CalamityWorld.downedProvidence) - { - dialogue.Add("The Rune of Kos holds a significant portion of Providence’s brand of magic, easily distinguishable from all others. Activating it in certain places would have some...risky consequences."); - dialogue.Add("Ironic, is it not, that Statis was defeated by the very Sentinel his people fashioned their art of stealth from. Fate so often weaves cruel tales."); - dialogue.Add("The Dungeon seems to be more active now. You may hear the faint whisperings of angry spirits who have not left to the Void...I would recommend searching there before taking on the Sentinels."); - } - else if (NPC.downedMoonlord) - { - dialogue.Add("Your adventure focuses to the jungle it seems. Clearing out the infestation of Bumblebirbs that have cropped up is an excellent idea."); - dialogue.Add("Ah...I can sense a powerful change in the weather. You may want to venture to the Sulphurous Seas once more during the rain to experience it."); - dialogue.Add("Profaned creatures now lurk in the Hallow and in Hell. If you destroy enough and gather their essence together you shall be able to capture the attention of the Profaned Guardians."); - dialogue.Add("The Profaned Guardians will do anything to protect their goddess. Makes sense they would die for her since they can be revived just as quickly."); - dialogue.Add("Touching Providence's offerings is usually a death wish. Shame that Yharim didn't think to just mess with her things to get her out of hiding."); - dialogue.Add("Providence is as much the sun goddess as much as the Moon Lord is the moon god. They are two sides of the same coin, choosing to remain neutral amongst our petty squabbles."); - dialogue.Add("The stories have it that when Providence faced and defeated Yharim and his forces she lost a lot of energy and reverted to a more skeletal form. She's merely a fraction of the power she was before."); - } - else if (NPC.downedGolemBoss) - { - dialogue.Add("The men at the front of the dungeon are performing a ritual to keep the Moon Lord contained in his prison. In order to gain Yharim's attention, however, you may need to defeat them."); - dialogue.Add("The Abyss has become far more active than before. You might be able to mine some of the volcanic rubble contained within."); - dialogue.Add("The plague was just one of the many experiments authorized by Yharim to raze towns to the ground. This is probably one of the few he shelved for being too terrible."); - } - else if (CalamityWorld.downedCryogen) - { - dialogue.Add("You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."); - dialogue.Add("I would recommend saving some of your old items. You never know if you can engineer them into stronger weapons in the future."); - dialogue.Add("Once those mechanical creations have been defeated you would do well to seek out the crippled clone of the witch, Calamitas. It might provide some useful weaponry."); - dialogue.Add("If you take an idol down to the Brimstone Crags you might be able to see just what is lurking in the shadows."); - dialogue.Add("The Brimstone Crags...Yharim despised that place, and did everything he could to raze it to the ground. It might explain a few things about him."); - dialogue.Add("The witch just might offer you an opportunity for a challenge if you are willing to fight during the night."); - dialogue.Add("If you’ve gathered the souls used to power those automatons head once more to the jungle. You will find a powerful enemy to fight, which will unleash the full fervor of the jungle once defeated. Do not underestimate it!"); - dialogue.Add("Be careful when defeating Plantera and the Golem. You might accidentally unleash a new threat in the jungle that needs to be quelled."); - dialogue.Add("When exploring the jungle temple be careful. You may not wish to disturb the Lihzard’s idol, the Golem. It’s quite the destructive force."); - } - else if (Main.hardMode) - { - dialogue.Add("Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed."); - } - else - { - dialogue.Add("There are rumors of ores that lay in latency. When you defeat certain bosses you will undo the ancient magic which conceals those materials."); - dialogue.Add("Have you heard of the Brimstone Crags? It was once a grand kingdom, not too different from my own. However, it also met a similar fate. I would not advise going down there, unless you seek a painful death."); - dialogue.Add("Ah yes, the Abyss. That trench is full of powerful creatures that could devour you in a heartbeat. I would explore the dungeon first."); - dialogue.Add("The Sulphurous Seas are dangerous. The toxic waters will burn your skin, but if you can brave them you will be able to reach the Abyss, where there are powerful weapons and dangers aplenty."); - dialogue.Add("The Sulphurous Seas were created long ago, when Yharim’s dungeon could no longer hold as many corpses as it needed to. Many of the bodies were dumped into the ocean. This, along with severe pollution from the heydays of Draedon's experiments have turned a paradise into a wasteland."); - dialogue.Add("Be careful what you attack in the " + worldEvil + ". You might just unveil a greater threat than what was there before."); - dialogue.Add("Scattered across the lands are shrines dedicated to the gods. You can take whatever is in them, but a few items you may not be able to use until much later."); - dialogue.Add("I’m assuming you’ve heard the legends that speak of the ninja, Statis? There are some who say that if you were able to defeat the gods which his clan once worshipped you would be able to harness some of his powers."); - dialogue.Add("The dungeon is a dark place. None of us know of its true purpose, however, the ancient Eidolist cultists used it for worship before Lord Yharim took it over."); - dialogue.Add("The " + worldEvil + " used to be easily manageable and controlled by nature. However, the recent wars and pollution have tipped the balance out of favor."); - } + if (CalamityWorld.downedYharon) + { + dialogue.Add("Pockets of ore have appeared once more in the land. This will allow you to create the most powerful weaponry and armor imagined!"); + dialogue.Add("Lord Yharim possesses god-like strength. He may not even fight you at full power which is fortunate for you. His attacks may just kill you in one hit, so be careful."); + dialogue.Add("Draedon's style of confrontation is very...alien and hands-off. You may be more likely to fight any one of his mechs before taking him down."); + } + else if (CalamityWorld.downedDoG) + { + dialogue.Add("The Devourer of God’s cosmic armor is unique in that it is capable of not only protecting his body from tearing itself apart when ripping through the fabric of space and time, but also allows him to control his powers."); + dialogue.Add("With the cosmic steel you can fashion many of your weapons into much more powerful forms."); + dialogue.Add("The Devourer of Gods is extremely powerful. However, he is young, foolhardy, and very lazy. Perhaps if he had been given time to develop he would have turned into quite the threat."); + dialogue.Add("Ah, the dragon Yharon is fickle. You may find that he will refuse to use his full power unless you are strong enough to unleash the power of the Dark Sun."); + } + else if (CalamityWorld.downedProvidence) + { + dialogue.Add("The Rune of Kos holds a significant portion of Providence’s brand of magic, easily distinguishable from all others. Activating it in certain places would have some...risky consequences."); + dialogue.Add("Ironic, is it not, that Statis was defeated by the very Sentinel his people fashioned their art of stealth from. Fate so often weaves cruel tales."); + dialogue.Add("The Dungeon seems to be more active now. You may hear the faint whisperings of angry spirits who have not left to the Void...I would recommend searching there before taking on the Sentinels."); + } + else if (NPC.downedMoonlord) + { + dialogue.Add("Your adventure focuses to the jungle it seems. Clearing out the infestation of Bumblebirbs that have cropped up is an excellent idea."); + dialogue.Add("Ah...I can sense a powerful change in the weather. You may want to venture to the Sulphurous Seas once more during the rain to experience it."); + dialogue.Add("Profaned creatures now lurk in the Hallow and in Hell. If you destroy enough and gather their essence together you shall be able to capture the attention of the Profaned Guardians."); + dialogue.Add("The Profaned Guardians will do anything to protect their goddess. Makes sense they would die for her since they can be revived just as quickly."); + dialogue.Add("Touching Providence's offerings is usually a death wish. Shame that Yharim didn't think to just mess with her things to get her out of hiding."); + dialogue.Add("Providence is as much the sun goddess as much as the Moon Lord is the moon god. They are two sides of the same coin, choosing to remain neutral amongst our petty squabbles."); + dialogue.Add("The stories have it that when Providence faced and defeated Yharim and his forces she lost a lot of energy and reverted to a more skeletal form. She's merely a fraction of the power she was before."); + } + else if (NPC.downedGolemBoss) + { + dialogue.Add("The men at the front of the dungeon are performing a ritual to keep the Moon Lord contained in his prison. In order to gain Yharim's attention, however, you may need to defeat them."); + dialogue.Add("The Abyss has become far more active than before. You might be able to mine some of the volcanic rubble contained within."); + dialogue.Add("The plague was just one of the many experiments authorized by Yharim to raze towns to the ground. This is probably one of the few he shelved for being too terrible."); + } + else if (CalamityWorld.downedCryogen) + { + dialogue.Add("You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."); + dialogue.Add("I would recommend saving some of your old items. You never know if you can engineer them into stronger weapons in the future."); + dialogue.Add("Once those mechanical creations have been defeated you would do well to seek out the crippled clone of the witch, Calamitas. It might provide some useful weaponry."); + dialogue.Add("If you take an idol down to the Brimstone Crags you might be able to see just what is lurking in the shadows."); + dialogue.Add("The Brimstone Crags...Yharim despised that place, and did everything he could to raze it to the ground. It might explain a few things about him."); + dialogue.Add("The witch just might offer you an opportunity for a challenge if you are willing to fight during the night."); + dialogue.Add("If you’ve gathered the souls used to power those automatons head once more to the jungle. You will find a powerful enemy to fight, which will unleash the full fervor of the jungle once defeated. Do not underestimate it!"); + dialogue.Add("Be careful when defeating Plantera and the Golem. You might accidentally unleash a new threat in the jungle that needs to be quelled."); + dialogue.Add("When exploring the jungle temple be careful. You may not wish to disturb the Lihzard’s idol, the Golem. It’s quite the destructive force."); + } + else if (Main.hardMode) + { + dialogue.Add("Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed."); + } + else + { + dialogue.Add("There are rumors of ores that lay in latency. When you defeat certain bosses you will undo the ancient magic which conceals those materials."); + dialogue.Add("Have you heard of the Brimstone Crags? It was once a grand kingdom, not too different from my own. However, it also met a similar fate. I would not advise going down there, unless you seek a painful death."); + dialogue.Add("Ah yes, the Abyss. That trench is full of powerful creatures that could devour you in a heartbeat. I would explore the dungeon first."); + dialogue.Add("The Sulphurous Seas are dangerous. The toxic waters will burn your skin, but if you can brave them you will be able to reach the Abyss, where there are powerful weapons and dangers aplenty."); + dialogue.Add("The Sulphurous Seas were created long ago, when Yharim’s dungeon could no longer hold as many corpses as it needed to. Many of the bodies were dumped into the ocean. This, along with severe pollution from the heydays of Draedon's experiments have turned a paradise into a wasteland."); + dialogue.Add("Be careful what you attack in the " + worldEvil + ". You might just unveil a greater threat than what was there before."); + dialogue.Add("Scattered across the lands are shrines dedicated to the gods. You can take whatever is in them, but a few items you may not be able to use until much later."); + dialogue.Add("I’m assuming you’ve heard the legends that speak of the ninja, Statis? There are some who say that if you were able to defeat the gods which his clan once worshipped you would be able to harness some of his powers."); + dialogue.Add("The dungeon is a dark place. None of us know of its true purpose, however, the ancient Eidolist cultists used it for worship before Lord Yharim took it over."); + dialogue.Add("The " + worldEvil + " used to be easily manageable and controlled by nature. However, the recent wars and pollution have tipped the balance out of favor."); + } - return dialogue[Main.rand.Next(dialogue.Count)]; + return dialogue[Main.rand.Next(dialogue.Count)]; - } + } - public override void SetChatButtons(ref string button, ref string button2) - { - button = Language.GetTextValue("LegacyInterface.28"); - button2 = "Help"; - } + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("LegacyInterface.28"); + button2 = "Help"; + } - public override void OnChatButtonClicked(bool firstButton, ref bool shop) - { - if (firstButton) - { - shop = true; - } - else - { - shop = false; - Main.npcChatText = Lore(); - Player player = Main.player[Main.myPlayer]; - player.AddBuff(mod.BuffType("AmidiasBlessing"), 36000); - } - } + public override void OnChatButtonClicked(bool firstButton, ref bool shop) + { + if (firstButton) + { + shop = true; + } + else + { + shop = false; + Main.npcChatText = Lore(); + Player player = Main.player[Main.myPlayer]; + player.AddBuff(mod.BuffType("AmidiasBlessing"), 36000); + } + } - public override void SetupShop(Chest shop, ref int nextSlot) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("Shellshooter")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("SnapClam")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("SandDollar")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("Waywasher")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("CoralCannon")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("UrchinFlail")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("AmidiasTrident")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("MagicalConch")); - nextSlot++; - if (NPC.downedFishron) - { - shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0); - nextSlot++; - } - } + public override void SetupShop(Chest shop, ref int nextSlot) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("Shellshooter")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("SnapClam")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("SandDollar")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("Waywasher")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("CoralCannon")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("UrchinFlail")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("AmidiasTrident")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("MagicalConch")); + nextSlot++; + if (NPC.downedFishron) + { + shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0); + nextSlot++; + } + } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias4"), 1f); - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias4"), 1f); + } + } - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 30; - knockback = 2f; - } + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 30; + knockback = 2f; + } - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 5; - } + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 5; + } - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = mod.ProjectileType("SnapClamProj"); - attackDelay = 1; - } + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = mod.ProjectileType("SnapClamProj"); + attackDelay = 1; + } - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 16f; - gravityCorrection = 10f; - } - } + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 16f; + gravityCorrection = 10f; + } + } } diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs index 10465b0d49..880db71f9c 100644 --- a/NPCs/Yharon/DetonatingFlare.cs +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -1,225 +1,249 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Yharon { public class DetonatingFlare : ModNPC - { + { float num = 0f; float num2 = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Detonating Flame"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Detonating Flame"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 100; - npc.width = 50; - npc.height = 50; - npc.defense = 50; - npc.lifeMax = 10000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.alpha = 255; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 100; + npc.width = 50; + npc.height = 50; + npc.defense = 50; + npc.lifeMax = 10000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + npc.alpha = 255; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - npc.alpha -= 3; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - if (npc.localAI[1] == 0f) + public override void AI() + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + npc.alpha -= 3; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + if (npc.localAI[1] == 0f) { switch (Main.rand.Next(8)) { - case 0: num = 5f; num2 = 0.15f; break; - case 1: num = 5.5f; num2 = 0.16f; break; - case 2: num = 6f; num2 = 0.17f; break; - case 3: num = 6.5f; num2 = 0.18f; break; - case 4: num = 7f; num2 = 0.19f; break; - case 5: num = 7.5f; num2 = 0.20f; break; - case 6: num = 8f; num2 = 0.21f; break; - case 7: num = 8.5f; num2 = 0.22f; break; + case 0: + num = 5f; + num2 = 0.15f; + break; + case 1: + num = 5.5f; + num2 = 0.16f; + break; + case 2: + num = 6f; + num2 = 0.17f; + break; + case 3: + num = 6.5f; + num2 = 0.18f; + break; + case 4: + num = 7f; + num2 = 0.19f; + break; + case 5: + num = 7.5f; + num2 = 0.20f; + break; + case 6: + num = 8f; + num2 = 0.21f; + break; + case 7: + num = 8.5f; + num2 = 0.22f; + break; } npc.localAI[1] = 1f; } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - int shoot = revenge ? 4 : 3; - npc.localAI[0] += (float)(Main.rand.Next(shoot)); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + int shoot = revenge ? 4 : 3; + npc.localAI[0] += (float)(Main.rand.Next(shoot)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { int num8 = Main.expertMode ? 75 : 90; int num9 = 467; Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); } - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(255, Main.DiscoG, 53, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, Main.DiscoG, 53, 0); + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -227,9 +251,9 @@ namespace CalamityMod.NPCs.Yharon npc.frame.Y = frame * frameHeight; } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index 1accd581b3..68b3136a45 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -1,91 +1,103 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.NPCs.Yharon { public class DetonatingFlare2 : ModNPC - { + { float speed = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Detonating Flame"); - Main.npcFrameCount[npc.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Detonating Flame"); + Main.npcFrameCount[npc.type] = 5; + } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 220; - npc.width = 50; - npc.height = 50; - npc.defense = 75; - npc.lifeMax = 13000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.alpha = 255; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 220; + npc.width = 50; + npc.height = 50; + npc.defense = 75; + npc.lifeMax = 13000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + npc.alpha = 255; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - npc.alpha -= 3; - npc.TargetClosest(true); - Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); - float num790 = Main.player[npc.target].Center.X - vector98.X; - float num791 = Main.player[npc.target].Center.Y - vector98.Y; - float num792 = (float)Math.Sqrt((double)(num790 * num790 + num791 * num791)); + public override void AI() + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + npc.alpha -= 3; + npc.TargetClosest(true); + Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); + float num790 = Main.player[npc.target].Center.X - vector98.X; + float num791 = Main.player[npc.target].Center.Y - vector98.Y; + float num792 = (float)Math.Sqrt((double)(num790 * num790 + num791 * num791)); if (npc.localAI[3] == 0f) { switch (Main.rand.Next(6)) { - case 0: speed = 10f; break; - case 1: speed = 11.5f; break; - case 2: speed = 13f; break; - case 3: speed = 14.5f; break; - case 4: speed = 16f; break; - case 5: speed = 17.5f; break; + case 0: + speed = 10f; + break; + case 1: + speed = 11.5f; + break; + case 2: + speed = 13f; + break; + case 3: + speed = 14.5f; + break; + case 4: + speed = 16f; + break; + case 5: + speed = 17.5f; + break; } npc.localAI[3] = 1f; } - float num793 = speed + (revenge ? 1f : 0f); - num792 = num793 / num792; - num790 *= num792; - num791 *= num792; - npc.velocity.X = (npc.velocity.X * 100f + num790) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num791) / 101f; - npc.rotation = (float)Math.Atan2((double)num791, (double)num790) - 1.57f; - } + float num793 = speed + (revenge ? 1f : 0f); + num792 = num793 / num792; + num790 *= num792; + num791 *= num792; + npc.velocity.X = (npc.velocity.X * 100f + num790) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num791) / 101f; + npc.rotation = (float)Math.Atan2((double)num791, (double)num790) - 1.57f; + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(255, Main.DiscoG, 53, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, Main.DiscoG, 53, 0); + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 300); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 300); + } + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -93,9 +105,9 @@ namespace CalamityMod.NPCs.Yharon npc.frame.Y = frame * frameHeight; } - public override bool PreNPCLoot() - { - return false; - } - } + public override bool PreNPCLoot() + { + return false; + } + } } diff --git a/NPCs/Yharon/YScreenShader.cs b/NPCs/Yharon/YScreenShader.cs index d3ab0b4012..e5c0d28c3f 100644 --- a/NPCs/Yharon/YScreenShader.cs +++ b/NPCs/Yharon/YScreenShader.cs @@ -4,41 +4,41 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Yharon { - public class YScreenShaderData : ScreenShaderData - { - private int YIndex; + public class YScreenShaderData : ScreenShaderData + { + private int YIndex; - public YScreenShaderData(string passName) - : base(passName) - { - } + public YScreenShaderData(string passName) + : base(passName) + { + } - private void UpdateYIndex() - { - int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); - if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) - { - return; - } - YIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == YType) - { - YIndex = i; - break; - } - } - } + private void UpdateYIndex() + { + int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); + if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) + { + return; + } + YIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == YType) + { + YIndex = i; + break; + } + } + } - public override void Apply() - { - UpdateYIndex(); - if (YIndex != -1) - { - UseTargetPosition(Main.npc[YIndex].Center); - } - base.Apply(); - } - } + public override void Apply() + { + UpdateYIndex(); + if (YIndex != -1) + { + UseTargetPosition(Main.npc[YIndex].Center); + } + base.Apply(); + } + } } diff --git a/NPCs/Yharon/YSky.cs b/NPCs/Yharon/YSky.cs index 605f14ba4a..4d38d51b26 100644 --- a/NPCs/Yharon/YSky.cs +++ b/NPCs/Yharon/YSky.cs @@ -6,96 +6,96 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Yharon { - public class YSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int YIndex = -1; + public class YSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int YIndex = -1; - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } - private float GetIntensity() - { - if (this.UpdateYIndex()) - { - float x = 0f; - if (this.YIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.66f; - } - return 0.66f; - } + private float GetIntensity() + { + if (this.UpdateYIndex()) + { + float x = 0f; + if (this.YIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.66f; + } + return 0.66f; + } - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } - private bool UpdateYIndex() - { - int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); - if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) - { - return true; - } - YIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == YType) - { - YIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return YIndex != -1; - } + private bool UpdateYIndex() + { + int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); + if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) + { + return true; + } + YIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == YType) + { + YIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return YIndex != -1; + } - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(77, 19, 0) * intensity); - } - } + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(77, 19, 0) * intensity); + } + } - public override float GetCloudAlpha() - { - return 0f; - } + public override float GetCloudAlpha() + { + return 0f; + } - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } - public override void Deactivate(params object[] args) - { - isActive = false; - } + public override void Deactivate(params object[] args) + { + isActive = false; + } - public override void Reset() - { - isActive = false; - } + public override void Reset() + { + isActive = false; + } - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 447810871e..0a10649789 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -1,78 +1,78 @@ -using System; -using System.IO; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.Utilities; using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; +using Terraria.Utilities; namespace CalamityMod.NPCs.Yharon { [AutoloadBossHead] - public class Yharon : ModNPC - { - private Rectangle safeBox = default; - private bool protectionBoost = false; - private bool moveCloser = false; - private bool phaseOneLoot = false; - private bool dropLoot = false; - private bool useTornado = true; - private int healCounter = 0; - private int secondPhasePhase = 1; - private int teleportLocation = 0; - private bool startSecondAI = false; - private bool spawnArena = false; - private int invincibilityCounter = 0; + public class Yharon : ModNPC + { + private Rectangle safeBox = default; + private bool protectionBoost = false; + private bool moveCloser = false; + private bool phaseOneLoot = false; + private bool dropLoot = false; + private bool useTornado = true; + private int healCounter = 0; + private int secondPhasePhase = 1; + private int teleportLocation = 0; + private bool startSecondAI = false; + private bool spawnArena = false; + private int invincibilityCounter = 0; public static float Phase1_DR = 0.17f; public static float Phase2_DR = 0.22f; public static float EnragedDR = 0.9f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jungle Dragon, Yharon"); - Main.npcFrameCount[npc.type] = 7; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jungle Dragon, Yharon"); + Main.npcFrameCount[npc.type] = 7; + } - public override void SetDefaults() - { - npc.npcSlots = 50f; - npc.damage = 330; - npc.width = 200; - npc.height = 200; - npc.defense = 100; - npc.lifeMax = CalamityWorld.revenge ? 2525000 : 2275000; - if (CalamityWorld.death) - { - npc.lifeMax = 3025000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4000000 : 3700000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(1, 50, 0, 0); - npc.boss = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; + public override void SetDefaults() + { + npc.npcSlots = 50f; + npc.damage = 330; + npc.width = 200; + npc.height = 200; + npc.defense = 100; + npc.lifeMax = CalamityWorld.revenge ? 2525000 : 2275000; + if (CalamityWorld.death) + { + npc.lifeMax = 3025000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4000000 : 3700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(1, 50, 0, 0); + npc.boss = true; + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; CalamityGlobalNPC global = npc.Calamity(); global.DR = Phase1_DR; @@ -80,2670 +80,2670 @@ namespace CalamityMod.NPCs.Yharon global.flatDRReductions.Add(BuffID.Ichor, 0.05f); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); - else - music = MusicID.Boss1; - if (CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); - else - music = MusicID.Boss3; - } - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - bossBag = mod.ItemType("YharonBag"); - } + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); + else + music = MusicID.Boss1; + if (CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); + else + music = MusicID.Boss3; + } + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + bossBag = mod.ItemType("YharonBag"); + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(protectionBoost); - writer.Write(moveCloser); - writer.Write(phaseOneLoot); - writer.Write(dropLoot); - writer.Write(useTornado); - writer.Write(healCounter); - writer.Write(secondPhasePhase); - writer.Write(teleportLocation); - writer.Write(startSecondAI); - writer.Write(spawnArena); - writer.Write(invincibilityCounter); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(protectionBoost); + writer.Write(moveCloser); + writer.Write(phaseOneLoot); + writer.Write(dropLoot); + writer.Write(useTornado); + writer.Write(healCounter); + writer.Write(secondPhasePhase); + writer.Write(teleportLocation); + writer.Write(startSecondAI); + writer.Write(spawnArena); + writer.Write(invincibilityCounter); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - protectionBoost = reader.ReadBoolean(); - moveCloser = reader.ReadBoolean(); - phaseOneLoot = reader.ReadBoolean(); - dropLoot = reader.ReadBoolean(); - useTornado = reader.ReadBoolean(); - healCounter = reader.ReadInt32(); - secondPhasePhase = reader.ReadInt32(); - teleportLocation = reader.ReadInt32(); - startSecondAI = reader.ReadBoolean(); - spawnArena = reader.ReadBoolean(); - invincibilityCounter = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + protectionBoost = reader.ReadBoolean(); + moveCloser = reader.ReadBoolean(); + phaseOneLoot = reader.ReadBoolean(); + dropLoot = reader.ReadBoolean(); + useTornado = reader.ReadBoolean(); + healCounter = reader.ReadInt32(); + secondPhasePhase = reader.ReadInt32(); + teleportLocation = reader.ReadInt32(); + startSecondAI = reader.ReadBoolean(); + spawnArena = reader.ReadBoolean(); + invincibilityCounter = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } - public override void AI() - { - // Disable loot drop - dropLoot = (double)npc.life <= (double)npc.lifeMax * 0.1; + public override void AI() + { + // Disable loot drop + dropLoot = (double)npc.life <= (double)npc.lifeMax * 0.1; - // Stop rain + // Stop rain CalamityMod.StopRain(); - // Start phase 2 or not - if (startSecondAI) - { - // Despawn and drop phase 1 loot - if (!CalamityWorld.downedBuffedMothron && !CalamityWorld.bossRushActive) - { - phaseOneLoot = true; + // Start phase 2 or not + if (startSecondAI) + { + // Despawn and drop phase 1 loot + if (!CalamityWorld.downedBuffedMothron && !CalamityWorld.bossRushActive) + { + phaseOneLoot = true; - npc.DeathSound = null; - npc.dontTakeDamage = true; - npc.chaseable = false; + npc.DeathSound = null; + npc.dontTakeDamage = true; + npc.chaseable = false; - npc.velocity.Y = npc.velocity.Y - 0.4f; + npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.alpha < 255) - { - npc.alpha += 5; - if (npc.alpha > 255) - npc.alpha = 255; - } + if (npc.alpha < 255) + { + npc.alpha += 5; + if (npc.alpha > 255) + npc.alpha = 255; + } - if (npc.timeLeft > 55) - npc.timeLeft = 55; + if (npc.timeLeft > 55) + npc.timeLeft = 55; - if (npc.timeLeft < 5) - { - string key = "Mods.CalamityMod.DargonBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (npc.timeLeft < 5) + { + string key = "Mods.CalamityMod.DargonBossText2"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } - startSecondAI = false; + startSecondAI = false; - npc.boss = false; - npc.life = 0; + npc.boss = false; + npc.life = 0; - if (dropLoot) - npc.NPCLoot(); + if (dropLoot) + npc.NPCLoot(); - npc.active = false; - npc.netUpdate = true; - } + npc.active = false; + npc.netUpdate = true; + } - return; - } + return; + } - // Don't drop phase 1 loot - phaseOneLoot = false; + // Don't drop phase 1 loot + phaseOneLoot = false; - // Start second AI - Yharon_AI2(); + // Start second AI + Yharon_AI2(); - return; - } + return; + } - // Phase bools - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool phase2Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.85 : 0.7); - bool phase3Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.6 : 0.4); - bool phase4Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.25 : 0.2); - if (CalamityWorld.death && !CalamityWorld.bossRushActive) - { - phase2Check = (double)npc.life <= (double)npc.lifeMax * 0.9; - phase3Check = (double)npc.life <= (double)npc.lifeMax * 0.8; - phase4Check = (double)npc.life <= (double)npc.lifeMax * 0.3; - } - bool phase5Check = (double)npc.life <= (double)npc.lifeMax * 0.1; - bool phase2Change = npc.ai[0] > 5f; - bool phase3Change = npc.ai[0] > 12f; - bool phase4Change = npc.ai[0] > 20f; - bool isCharging = npc.ai[3] < 20f; + // Phase bools + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool phase2Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.85 : 0.7); + bool phase3Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.6 : 0.4); + bool phase4Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.25 : 0.2); + if (CalamityWorld.death && !CalamityWorld.bossRushActive) + { + phase2Check = (double)npc.life <= (double)npc.lifeMax * 0.9; + phase3Check = (double)npc.life <= (double)npc.lifeMax * 0.8; + phase4Check = (double)npc.life <= (double)npc.lifeMax * 0.3; + } + bool phase5Check = (double)npc.life <= (double)npc.lifeMax * 0.1; + bool phase2Change = npc.ai[0] > 5f; + bool phase3Change = npc.ai[0] > 12f; + bool phase4Change = npc.ai[0] > 20f; + bool isCharging = npc.ai[3] < 20f; - // Flare limit - int flareCount = 3; + // Flare limit + int flareCount = 3; - // Velocity and acceleration - int aiChangeRate = expertMode ? 36 : 38; - float npcVelocity = expertMode ? 0.7f : 0.69f; - float scaleFactor = expertMode ? 11f : 10.8f; - if (phase4Change || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npcVelocity = 0.95f; - scaleFactor = 14f; - aiChangeRate = 25; - } - else if (phase3Change) - { - npcVelocity = 0.9f; - scaleFactor = 13f; - aiChangeRate = 25; - } - else if (phase2Change && isCharging) - { - npcVelocity = (expertMode ? 0.8f : 0.78f); - scaleFactor = (expertMode ? 12.2f : 12f); - aiChangeRate = (expertMode ? 36 : 38); - } - else if (isCharging && !phase2Change && !phase3Change && !phase4Change) - { - aiChangeRate = 25; - } + // Velocity and acceleration + int aiChangeRate = expertMode ? 36 : 38; + float npcVelocity = expertMode ? 0.7f : 0.69f; + float scaleFactor = expertMode ? 11f : 10.8f; + if (phase4Change || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npcVelocity = 0.95f; + scaleFactor = 14f; + aiChangeRate = 25; + } + else if (phase3Change) + { + npcVelocity = 0.9f; + scaleFactor = 13f; + aiChangeRate = 25; + } + else if (phase2Change && isCharging) + { + npcVelocity = (expertMode ? 0.8f : 0.78f); + scaleFactor = (expertMode ? 12.2f : 12f); + aiChangeRate = (expertMode ? 36 : 38); + } + else if (isCharging && !phase2Change && !phase3Change && !phase4Change) + { + aiChangeRate = 25; + } - int chargeTime = expertMode ? 38 : 40; - int chargeTime2 = expertMode ? 34 : 36; - float chargeSpeed = expertMode ? 22f : 20.5f; - float chargeSpeed2 = expertMode ? 37f : 34f; - if (phase4Change || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - chargeTime = 28; - chargeSpeed = 31f; - } - else if (phase3Change) - { - chargeTime = 32; - chargeTime2 = 27; - chargeSpeed = 25f; - chargeSpeed2 = 41f; - } - else if (isCharging && phase2Change) - { - chargeTime = expertMode ? 35 : 37; - chargeTime2 = expertMode ? 31 : 33; - if (expertMode) - { - chargeSpeed = 24f; - chargeSpeed2 = 39f; - } - } + int chargeTime = expertMode ? 38 : 40; + int chargeTime2 = expertMode ? 34 : 36; + float chargeSpeed = expertMode ? 22f : 20.5f; + float chargeSpeed2 = expertMode ? 37f : 34f; + if (phase4Change || npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + chargeTime = 28; + chargeSpeed = 31f; + } + else if (phase3Change) + { + chargeTime = 32; + chargeTime2 = 27; + chargeSpeed = 25f; + chargeSpeed2 = 41f; + } + else if (isCharging && phase2Change) + { + chargeTime = expertMode ? 35 : 37; + chargeTime2 = expertMode ? 31 : 33; + if (expertMode) + { + chargeSpeed = 24f; + chargeSpeed2 = 39f; + } + } - // Variables for charging and etc. - int xPos = (npc.direction == 1 ? 25 : -25); - int num1454 = 80; - int num1455 = 4; - float num1456 = 0.3f; - float scaleFactor11 = 5f; - int num1457 = 90; - int num1458 = 180; - int num1459 = 180; - int num1460 = 30; - int num1461 = 120; - int num1462 = 4; - float scaleFactor13 = 20f; - float num1463 = 6.28318548f / (float)(num1461 / 2); - int num1464 = 75; + // Variables for charging and etc. + int xPos = (npc.direction == 1 ? 25 : -25); + int num1454 = 80; + int num1455 = 4; + float num1456 = 0.3f; + float scaleFactor11 = 5f; + int num1457 = 90; + int num1458 = 180; + int num1459 = 180; + int num1460 = 30; + int num1461 = 120; + int num1462 = 4; + float scaleFactor13 = 20f; + float num1463 = 6.28318548f / (float)(num1461 / 2); + int num1464 = 75; - // Center and target - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - player = Main.player[npc.target]; - npc.netUpdate = true; - } + // Center and target + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + player = Main.player[npc.target]; + npc.netUpdate = true; + } - // Despawn - if (player.dead) - { - npc.velocity.Y = npc.velocity.Y - 0.4f; + // Despawn + if (player.dead) + { + npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.timeLeft > 150) - npc.timeLeft = 150; + if (npc.timeLeft > 150) + npc.timeLeft = 150; - if (npc.ai[0] > 12f) - npc.ai[0] = 13f; - else if (npc.ai[0] > 5f) - npc.ai[0] = 6f; - else - npc.ai[0] = 0f; + if (npc.ai[0] > 12f) + npc.ai[0] = 13f; + else if (npc.ai[0] > 5f) + npc.ai[0] = 6f; + else + npc.ai[0] = 0f; - npc.ai[2] = 0f; - } - else if (npc.timeLeft < 3600) - npc.timeLeft = 3600; + npc.ai[2] = 0f; + } + else if (npc.timeLeft < 3600) + npc.timeLeft = 3600; - // Create the arena - if (!spawnArena) - { - spawnArena = true; - safeBox.X = (int)(player.Center.X - (revenge ? 3000f : 3500f)); - safeBox.Y = (int)(player.Center.Y - (revenge ? 9000f : 10500f)); - safeBox.Width = revenge ? 6000 : 7000; - safeBox.Height = revenge ? 18000 : 21000; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(player.Center.X + (revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X - (revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } + // Create the arena + if (!spawnArena) + { + spawnArena = true; + safeBox.X = (int)(player.Center.X - (revenge ? 3000f : 3500f)); + safeBox.Y = (int)(player.Center.Y - (revenge ? 9000f : 10500f)); + safeBox.Width = revenge ? 6000 : 7000; + safeBox.Height = revenge ? 18000 : 21000; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(player.Center.X + (revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X - (revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } - // Enrage - if (!Main.player[npc.target].Hitbox.Intersects(safeBox)) - { - aiChangeRate = 15; - protectionBoost = true; - npc.damage = npc.defDamage * 5; - chargeSpeed += 25f; - } - else - { - npc.damage = npc.defDamage; - protectionBoost = false; - } + // Enrage + if (!Main.player[npc.target].Hitbox.Intersects(safeBox)) + { + aiChangeRate = 15; + protectionBoost = true; + npc.damage = npc.defDamage * 5; + chargeSpeed += 25f; + } + else + { + npc.damage = npc.defDamage; + protectionBoost = false; + } // Set DR based on protection boost (aka enrage) npc.Calamity().DR = protectionBoost ? EnragedDR : Phase1_DR; - // Trigger spawn effects - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } + // Trigger spawn effects + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } - // Rotation - float npcRotation = (float)Math.Atan2((double)(player.Center.Y - vectorCenter.Y), (double)(player.Center.X - vectorCenter.X)); - if (npc.spriteDirection == 1) - npcRotation += 3.14159274f; - if (npcRotation < 0f) - npcRotation += 6.28318548f; - if (npcRotation > 6.28318548f) - npcRotation -= 6.28318548f; - if (npc.ai[0] == -1f) - npcRotation = 0f; - if (npc.ai[0] == 3f) - npcRotation = 0f; - if (npc.ai[0] == 4f) - npcRotation = 0f; - if (npc.ai[0] == 9f) - npcRotation = 0f; - if (npc.ai[0] == 10f) - npcRotation = 0f; - if (npc.ai[0] == 16f) - npcRotation = 0f; - if (npc.ai[0] == 20f) - npcRotation = 0f; + // Rotation + float npcRotation = (float)Math.Atan2((double)(player.Center.Y - vectorCenter.Y), (double)(player.Center.X - vectorCenter.X)); + if (npc.spriteDirection == 1) + npcRotation += 3.14159274f; + if (npcRotation < 0f) + npcRotation += 6.28318548f; + if (npcRotation > 6.28318548f) + npcRotation -= 6.28318548f; + if (npc.ai[0] == -1f) + npcRotation = 0f; + if (npc.ai[0] == 3f) + npcRotation = 0f; + if (npc.ai[0] == 4f) + npcRotation = 0f; + if (npc.ai[0] == 9f) + npcRotation = 0f; + if (npc.ai[0] == 10f) + npcRotation = 0f; + if (npc.ai[0] == 16f) + npcRotation = 0f; + if (npc.ai[0] == 20f) + npcRotation = 0f; - float npcRotationSpeed = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f) - npcRotationSpeed = 0f; - if (npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f) - npcRotationSpeed = 0f; - if (npc.ai[0] == 3f) - npcRotationSpeed = 0.01f; - if (npc.ai[0] == 4f) - npcRotationSpeed = 0.01f; - if (npc.ai[0] == 9f || npc.ai[0] == 16f || npc.ai[0] == 20f) - npcRotationSpeed = 0.01f; + float npcRotationSpeed = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f) + npcRotationSpeed = 0f; + if (npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f) + npcRotationSpeed = 0f; + if (npc.ai[0] == 3f) + npcRotationSpeed = 0.01f; + if (npc.ai[0] == 4f) + npcRotationSpeed = 0.01f; + if (npc.ai[0] == 9f || npc.ai[0] == 16f || npc.ai[0] == 20f) + npcRotationSpeed = 0.01f; - if (npc.rotation < npcRotation) - { - if ((double)(npcRotation - npc.rotation) > 3.1415926535897931) - npc.rotation -= npcRotationSpeed; - else - npc.rotation += npcRotationSpeed; - } - if (npc.rotation > npcRotation) - { - if ((double)(npc.rotation - npcRotation) > 3.1415926535897931) - npc.rotation += npcRotationSpeed; - else - npc.rotation -= npcRotationSpeed; - } + if (npc.rotation < npcRotation) + { + if ((double)(npcRotation - npc.rotation) > 3.1415926535897931) + npc.rotation -= npcRotationSpeed; + else + npc.rotation += npcRotationSpeed; + } + if (npc.rotation > npcRotation) + { + if ((double)(npc.rotation - npcRotation) > 3.1415926535897931) + npc.rotation += npcRotationSpeed; + else + npc.rotation -= npcRotationSpeed; + } - if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) - npc.rotation = npcRotation; - if (npc.rotation < 0f) - npc.rotation += 6.28318548f; - if (npc.rotation > 6.28318548f) - npc.rotation -= 6.28318548f; - if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) - npc.rotation = npcRotation; + if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) + npc.rotation = npcRotation; + if (npc.rotation < 0f) + npc.rotation += 6.28318548f; + if (npc.rotation > 6.28318548f) + npc.rotation -= 6.28318548f; + if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) + npc.rotation = npcRotation; - // Alpha - if (npc.ai[0] != -1f && npc.ai[0] < 9f) - { - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); - if (colliding) - npc.alpha += 15; - else - npc.alpha -= 15; + // Alpha + if (npc.ai[0] != -1f && npc.ai[0] < 9f) + { + bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + if (colliding) + npc.alpha += 15; + else + npc.alpha -= 15; - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } - // Spawn effects - if (npc.ai[0] == -1f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; + // Spawn effects + if (npc.ai[0] == -1f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; - npc.velocity *= 0.98f; + npc.velocity *= 0.98f; - // Direction - int num1467 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1467 != 0) - { - npc.direction = num1467; - npc.spriteDirection = -npc.direction; - } + // Direction + int num1467 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1467 != 0) + { + npc.direction = num1467; + npc.spriteDirection = -npc.direction; + } - // Alpha - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - npc.alpha -= 5; + // Alpha + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + npc.alpha -= 5; - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); - if (colliding) - npc.alpha += 15; - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } + bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + if (colliding) + npc.alpha += 15; + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } - // Dust - if (npc.ai[2] == (float)(num1457 - 30)) - { - int num1468 = 72; - for (int num1469 = 0; num1469 < num1468; num1469++) - { - Vector2 vector169 = Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f; - vector169 = vector169.RotatedBy((double)((float)(num1469 - (num1468 / 2 - 1)) * 6.28318548f / (float)num1468), default) + npc.Center; - Vector2 value16 = vector169 - npc.Center; - int num1470 = Dust.NewDust(vector169 + value16, 0, 0, 244, value16.X * 2f, value16.Y * 2f, 100, default, 1.4f); - Main.dust[num1470].noGravity = true; - Main.dust[num1470].noLight = true; - Main.dust[num1470].velocity = Vector2.Normalize(value16) * 3f; - } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } + // Dust + if (npc.ai[2] == (float)(num1457 - 30)) + { + int num1468 = 72; + for (int num1469 = 0; num1469 < num1468; num1469++) + { + Vector2 vector169 = Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f; + vector169 = vector169.RotatedBy((double)((float)(num1469 - (num1468 / 2 - 1)) * 6.28318548f / (float)num1468), default) + npc.Center; + Vector2 value16 = vector169 - npc.Center; + int num1470 = Dust.NewDust(vector169 + value16, 0, 0, 244, value16.X * 2f, value16.Y * 2f, 100, default, 1.4f); + Main.dust[num1470].noGravity = true; + Main.dust[num1470].noLight = true; + Main.dust[num1470].velocity = Vector2.Normalize(value16) * 3f; + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1464) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1464) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } - #region Phase1 - else if (npc.ai[0] == 0f && !player.dead) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value17 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector170.X) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - if (npc.velocity.X < 0f && vector170.X > 0f) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - } - } - else if (npc.velocity.X > vector170.X) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - if (npc.velocity.X > 0f && vector170.X < 0f) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - } - } - if (npc.velocity.Y < vector170.Y) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - if (npc.velocity.Y < 0f && vector170.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - } - } - else if (npc.velocity.Y > vector170.Y) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - if (npc.velocity.Y > 0f && vector170.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - } - } - int num1471 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1471 != 0) - { - if (npc.ai[2] == 0f && num1471 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num1471; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) //0 2 4 6 1 3 5 7 repeat - { - case 0: - case 1: - case 2: - case 3: - case 4: - aiState = 1; //normal charges - break; - case 5: - aiState = 5; //fast charge - break; - case 6: - npc.ai[3] = 1f; - aiState = 2; //fireball attack - break; - case 7: - npc.ai[3] = 0f; - aiState = 3; //tornadoes - break; - } - if (phase2Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1471 != 0) - { - npc.direction = num1471; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 5) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1471 != 0) - { - npc.direction = num1471; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) //charge attack - { - int num1473 = 7; - for (int num1474 = 0; num1474 < num1473; num1474++) - { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + vectorCenter; - Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) //fireball attack - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value19 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector172 = Vector2.Normalize(value19 - npc.velocity) * scaleFactor11; - if (npc.velocity.X < vector172.X) - { - npc.velocity.X = npc.velocity.X + num1456; - if (npc.velocity.X < 0f && vector172.X > 0f) - { - npc.velocity.X = npc.velocity.X + num1456; - } - } - else if (npc.velocity.X > vector172.X) - { - npc.velocity.X = npc.velocity.X - num1456; - if (npc.velocity.X > 0f && vector172.X < 0f) - { - npc.velocity.X = npc.velocity.X - num1456; - } - } - if (npc.velocity.Y < vector172.Y) - { - npc.velocity.Y = npc.velocity.Y + num1456; - if (npc.velocity.Y < 0f && vector172.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1456; - } - } - else if (npc.velocity.Y > vector172.Y) - { - npc.velocity.Y = npc.velocity.Y - num1456; - if (npc.velocity.Y > 0f && vector172.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1456; - } - } - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1455 == 0f) //fire flare bombs from mouth - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) - { - NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); - } - int damage = expertMode ? 75 : 90; - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, 0f, 0f, mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - int num1476 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1476 != 0) - { - npc.direction = num1476; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1454) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) //Fire small flares - { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(npc.direction * 2), 8f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); //changed - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-(float)npc.direction * 2), 8f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 0f, 0f); //changed - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) //enter phase 2 - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1458 - 60)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1458) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f) - { - int num1473 = 14; - for (int num1474 = 0; num1474 < num1473; num1474++) - { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + vectorCenter; - Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); //changed - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - #endregion + #region Phase1 + else if (npc.ai[0] == 0f && !player.dead) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value17 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector170.X) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + if (npc.velocity.X < 0f && vector170.X > 0f) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + } + } + else if (npc.velocity.X > vector170.X) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + if (npc.velocity.X > 0f && vector170.X < 0f) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + } + } + if (npc.velocity.Y < vector170.Y) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + if (npc.velocity.Y < 0f && vector170.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + } + } + else if (npc.velocity.Y > vector170.Y) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + if (npc.velocity.Y > 0f && vector170.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + } + } + int num1471 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1471 != 0) + { + if (npc.ai[2] == 0f && num1471 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num1471; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) //0 2 4 6 1 3 5 7 repeat + { + case 0: + case 1: + case 2: + case 3: + case 4: + aiState = 1; //normal charges + break; + case 5: + aiState = 5; //fast charge + break; + case 6: + npc.ai[3] = 1f; + aiState = 2; //fireball attack + break; + case 7: + npc.ai[3] = 0f; + aiState = 3; //tornadoes + break; + } + if (phase2Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1471 != 0) + { + npc.direction = num1471; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 5) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1471 != 0) + { + npc.direction = num1471; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) //charge attack + { + int num1473 = 7; + for (int num1474 = 0; num1474 < num1473; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + vectorCenter; + Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) //fireball attack + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value19 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector172 = Vector2.Normalize(value19 - npc.velocity) * scaleFactor11; + if (npc.velocity.X < vector172.X) + { + npc.velocity.X = npc.velocity.X + num1456; + if (npc.velocity.X < 0f && vector172.X > 0f) + { + npc.velocity.X = npc.velocity.X + num1456; + } + } + else if (npc.velocity.X > vector172.X) + { + npc.velocity.X = npc.velocity.X - num1456; + if (npc.velocity.X > 0f && vector172.X < 0f) + { + npc.velocity.X = npc.velocity.X - num1456; + } + } + if (npc.velocity.Y < vector172.Y) + { + npc.velocity.Y = npc.velocity.Y + num1456; + if (npc.velocity.Y < 0f && vector172.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1456; + } + } + else if (npc.velocity.Y > vector172.Y) + { + npc.velocity.Y = npc.velocity.Y - num1456; + if (npc.velocity.Y > 0f && vector172.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1456; + } + } + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1455 == 0f) //fire flare bombs from mouth + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) + { + NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); + } + int damage = expertMode ? 75 : 90; + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, 0f, 0f, mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + int num1476 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1476 != 0) + { + npc.direction = num1476; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1454) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) //Fire small flares + { + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(npc.direction * 2), 8f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); //changed + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-(float)npc.direction * 2), 8f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 0f, 0f); //changed + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) //enter phase 2 + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1458 - 60)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1458) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f) + { + int num1473 = 14; + for (int num1474 = 0; num1474 < num1473; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + vectorCenter; + Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); //changed + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime2) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + #endregion - #region Phase2 - else if (npc.ai[0] == 6f && !player.dead) //phase 2 - { - npc.dontTakeDamage = false; - npc.chaseable = true; - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector175.X) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - if (npc.velocity.X < 0f && vector175.X > 0f) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - } - } - else if (npc.velocity.X > vector175.X) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - if (npc.velocity.X > 0f && vector175.X < 0f) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - } - } - if (npc.velocity.Y < vector175.Y) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - if (npc.velocity.Y < 0f && vector175.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - } - } - else if (npc.velocity.Y > vector175.Y) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - if (npc.velocity.Y > 0f && vector175.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - } - } - int num1477 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1477 != 0) - { - if (npc.ai[2] == 0f && num1477 != npc.direction) - { - npc.rotation = 3.14159274f; - } - npc.direction = num1477; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) //0 2 4 6 8 1 3 5 7 9 repeat - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - aiState = 1; - break; - case 6: - aiState = 5; - break; - case 7: - aiState = 6; - break; - case 8: - npc.ai[3] = 1f; - aiState = 2; - break; - case 9: - npc.ai[3] = 0f; - aiState = 3; - break; - } - if (phase3Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 5) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 6) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 7f) //charge - { - int num1479 = 7; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); //changed - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 8f) - { - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount) - { - NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); - } - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-400, 401) * 0.13f, (float)Main.rand.Next(-30, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 9f) - { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 10f) //start phase 3 - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1459) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 11f) - { - int num1479 = 14; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); //changed - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 12f) - { - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 75 : 90; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = player.position.X + (float)player.width * 0.5f - vectorShoot.X; - float playerY = player.position.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerXY = speed / playerXY; - playerX *= playerXY; - playerY *= playerXY; - Projectile.NewProjectile((int)vector173.X + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - #endregion + #region Phase2 + else if (npc.ai[0] == 6f && !player.dead) //phase 2 + { + npc.dontTakeDamage = false; + npc.chaseable = true; + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector175.X) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + if (npc.velocity.X < 0f && vector175.X > 0f) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + } + } + else if (npc.velocity.X > vector175.X) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + if (npc.velocity.X > 0f && vector175.X < 0f) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + } + } + if (npc.velocity.Y < vector175.Y) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + if (npc.velocity.Y < 0f && vector175.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + } + } + else if (npc.velocity.Y > vector175.Y) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + if (npc.velocity.Y > 0f && vector175.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + } + } + int num1477 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1477 != 0) + { + if (npc.ai[2] == 0f && num1477 != npc.direction) + { + npc.rotation = 3.14159274f; + } + npc.direction = num1477; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) //0 2 4 6 8 1 3 5 7 9 repeat + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + aiState = 1; + break; + case 6: + aiState = 5; + break; + case 7: + aiState = 6; + break; + case 8: + npc.ai[3] = 1f; + aiState = 2; + break; + case 9: + npc.ai[3] = 0f; + aiState = 3; + break; + } + if (phase3Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 5) + { + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 6) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 7f) //charge + { + int num1479 = 7; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); //changed + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 8f) + { + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount) + { + NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); + } + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-400, 401) * 0.13f, (float)Main.rand.Next(-30, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 9f) + { + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 10f) //start phase 3 + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1459 - 60)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1459) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 11f) + { + int num1479 = 14; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); //changed + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime2) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 12f) + { + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = expertMode ? 75 : 90; + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + float speed = 0.01f; + Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float playerX = player.position.X + (float)player.width * 0.5f - vectorShoot.X; + float playerY = player.position.Y - vectorShoot.Y; + float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerXY = speed / playerXY; + playerX *= playerXY; + playerY *= playerXY; + Projectile.NewProjectile((int)vector173.X + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + #endregion - #region Phase3 - else if (npc.ai[0] == 13f && !player.dead) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector175.X) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - if (npc.velocity.X < 0f && vector175.X > 0f) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - } - } - else if (npc.velocity.X > vector175.X) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - if (npc.velocity.X > 0f && vector175.X < 0f) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - } - } - if (npc.velocity.Y < vector175.Y) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - if (npc.velocity.Y < 0f && vector175.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - } - } - else if (npc.velocity.Y > vector175.Y) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - if (npc.velocity.Y > 0f && vector175.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - } - } - int num1477 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1477 != 0) - { - if (npc.ai[2] == 0f && num1477 != npc.direction) - { - npc.rotation = 3.14159274f; - } - npc.direction = num1477; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) //0 2 4 6 8 9 1 3 5 7 10 repeat - { - case 0: - case 1: - case 2: - case 3: - aiState = ((CalamityWorld.death && !CalamityWorld.bossRushActive) ? 5 : 1); //normal charges - break; - case 4: - case 5: - case 6: - aiState = 5; //fast charges - break; - case 7: - aiState = 3; //big tornado - break; - case 8: - aiState = 6; //slow flare bombs - break; - case 9: - npc.ai[3] = 1f; - aiState = 7; //small tornado - break; - case 10: - npc.ai[3] = 0f; - aiState = 2; //flare circle - break; - } - if (phase4Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 14f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 15f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 16f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 17f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 5) - { - npc.ai[0] = 18f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 6) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 19f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 7) - { - npc.ai[0] = 20f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 14f) //charge - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - int num1479 = 7; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 15f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount && NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) - { - NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, (Main.rand.NextBool(2) ? mod.NPCType("DetonatingFlare") : mod.NPCType("DetonatingFlare2")), 0, 0f, 0f, 0f, 0f, 255); - } - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-401, 401) * 0.13f, (float)Main.rand.Next(-31, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-31, 31) * 0.13f, (float)Main.rand.Next(-151, 151) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 16f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 17f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - if (npc.ai[2] < (float)(num1459 - 90)) - { - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); - if (colliding) - { - npc.alpha += 15; - } - else - { - npc.alpha -= 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - else if (npc.alpha < 255) - { - npc.alpha += 4; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1459) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 18f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - int num1479 = 14; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 19f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 75 : 90; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = player.position.X + (float)player.width * 0.5f - vectorShoot.X; - float playerY = player.position.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerXY = speed / playerXY; - playerX *= playerXY; - playerY *= playerXY; - Projectile.NewProjectile((int)vector173.X + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 20f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (CalamityWorld.death && !CalamityWorld.bossRushActive) - { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - } - else - { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - #endregion + #region Phase3 + else if (npc.ai[0] == 13f && !player.dead) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector175.X) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + if (npc.velocity.X < 0f && vector175.X > 0f) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + } + } + else if (npc.velocity.X > vector175.X) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + if (npc.velocity.X > 0f && vector175.X < 0f) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + } + } + if (npc.velocity.Y < vector175.Y) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + if (npc.velocity.Y < 0f && vector175.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + } + } + else if (npc.velocity.Y > vector175.Y) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + if (npc.velocity.Y > 0f && vector175.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + } + } + int num1477 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1477 != 0) + { + if (npc.ai[2] == 0f && num1477 != npc.direction) + { + npc.rotation = 3.14159274f; + } + npc.direction = num1477; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) //0 2 4 6 8 9 1 3 5 7 10 repeat + { + case 0: + case 1: + case 2: + case 3: + aiState = ((CalamityWorld.death && !CalamityWorld.bossRushActive) ? 5 : 1); //normal charges + break; + case 4: + case 5: + case 6: + aiState = 5; //fast charges + break; + case 7: + aiState = 3; //big tornado + break; + case 8: + aiState = 6; //slow flare bombs + break; + case 9: + npc.ai[3] = 1f; + aiState = 7; //small tornado + break; + case 10: + npc.ai[3] = 0f; + aiState = 2; //flare circle + break; + } + if (phase4Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 14f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 15f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 16f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 17f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 5) + { + npc.ai[0] = 18f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 6) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 19f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 7) + { + npc.ai[0] = 20f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 14f) //charge + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + int num1479 = 7; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 15f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount && NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) + { + NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, (Main.rand.NextBool(2) ? mod.NPCType("DetonatingFlare") : mod.NPCType("DetonatingFlare2")), 0, 0f, 0f, 0f, 0f, 255); + } + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-401, 401) * 0.13f, (float)Main.rand.Next(-31, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-31, 31) * 0.13f, (float)Main.rand.Next(-151, 151) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 16f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 3f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 17f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + if (npc.ai[2] < (float)(num1459 - 90)) + { + bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + if (colliding) + { + npc.alpha += 15; + } + else + { + npc.alpha -= 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + else if (npc.alpha < 255) + { + npc.alpha += 4; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1459 - 60)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1459) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 18f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + int num1479 = 14; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime2) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 19f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = expertMode ? 75 : 90; + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + float speed = 0.01f; + Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float playerX = player.position.X + (float)player.width * 0.5f - vectorShoot.X; + float playerY = player.position.Y - vectorShoot.Y; + float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerXY = speed / playerXY; + playerX *= playerXY; + playerY *= playerXY; + Projectile.NewProjectile((int)vector173.X + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 20f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (CalamityWorld.death && !CalamityWorld.bossRushActive) + { + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + } + else + { + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + #endregion - #region Phase4 - else if (npc.ai[0] == 21f && !player.dead) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = false; - if (npc.alpha < 255) - { - npc.alpha += 25; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - if (npc.ai[1] == 0f) - { - teleportLocation = (Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600)); - npc.ai[1] = (float)(360 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value7 = player.Center + new Vector2(npc.ai[1], (float)teleportLocation) - vectorCenter; //teleport distance - Vector2 desiredVelocity = Vector2.Normalize(value7 - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, npcVelocity); - int num32 = Math.Sign(player.Center.X - vectorCenter.X); - if (num32 != 0) - { - if (npc.ai[2] == 0f && num32 != npc.direction) - { - npc.rotation = 3.14159274f; - } - npc.direction = num32; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) - { - case 0: //skip 1 - case 2: - case 3: //skip 4 - case 5: - case 6: - case 7: //skip 8 - case 9: - case 10: - case 11: - case 12: //skip 13 - case 14: - case 15: - case 16: - case 17: - case 18: //skip 19 - aiState = 1; - break; - case 1: //+3 - case 4: //+4 - case 8: //+5 - case 13: //+6 - case 19: - aiState = 2; - break; - } - if (phase5Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 22f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num32 != 0) - { - npc.direction = num32; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.ai[0] = 23f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 24f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 25f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 22f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - npc.alpha -= 25; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - int num34 = 7; - for (int m = 0; m < num34; m++) - { - Vector2 vector11 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector11 = vector11.RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default) + vectorCenter; - Vector2 value8 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num35 = Dust.NewDust(vector11 + value8, 0, 0, 244, value8.X * 2f, value8.Y * 2f, 100, default, 1.4f); - Main.dust[num35].noGravity = true; - Main.dust[num35].noLight = true; - Main.dust[num35].velocity /= 4f; - Main.dust[num35].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 23f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1460 / 2)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1460 / 2)) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 center = player.Center + new Vector2(-npc.ai[1], teleportLocation); //teleport distance - vectorCenter = (npc.Center = center); - int num36 = Math.Sign(player.Center.X - vectorCenter.X); - if (num36 != 0) - { - if (npc.ai[2] == 0f && num36 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num36; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1460) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] == 5f && Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - if (npc.ai[3] >= 20f) //14 - { - npc.ai[3] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 24f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 25f) //start phase 5 - { - npc.alpha = 0; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1459) - { - startSecondAI = true; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - #endregion - } + #region Phase4 + else if (npc.ai[0] == 21f && !player.dead) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = false; + if (npc.alpha < 255) + { + npc.alpha += 25; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + if (npc.ai[1] == 0f) + { + teleportLocation = (Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600)); + npc.ai[1] = (float)(360 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value7 = player.Center + new Vector2(npc.ai[1], (float)teleportLocation) - vectorCenter; //teleport distance + Vector2 desiredVelocity = Vector2.Normalize(value7 - npc.velocity) * scaleFactor; + npc.SimpleFlyMovement(desiredVelocity, npcVelocity); + int num32 = Math.Sign(player.Center.X - vectorCenter.X); + if (num32 != 0) + { + if (npc.ai[2] == 0f && num32 != npc.direction) + { + npc.rotation = 3.14159274f; + } + npc.direction = num32; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) + { + case 0: //skip 1 + case 2: + case 3: //skip 4 + case 5: + case 6: + case 7: //skip 8 + case 9: + case 10: + case 11: + case 12: //skip 13 + case 14: + case 15: + case 16: + case 17: + case 18: //skip 19 + aiState = 1; + break; + case 1: //+3 + case 4: //+4 + case 8: //+5 + case 13: //+6 + case 19: + aiState = 2; + break; + } + if (phase5Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 22f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num32 != 0) + { + npc.direction = num32; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.ai[0] = 23f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 24f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 25f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 22f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + npc.alpha -= 25; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + int num34 = 7; + for (int m = 0; m < num34; m++) + { + Vector2 vector11 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector11 = vector11.RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default) + vectorCenter; + Vector2 value8 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num35 = Dust.NewDust(vector11 + value8, 0, 0, 244, value8.X * 2f, value8.Y * 2f, 100, default, 1.4f); + Main.dust[num35].noGravity = true; + Main.dust[num35].noLight = true; + Main.dust[num35].velocity /= 4f; + Main.dust[num35].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 23f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1460 / 2)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1460 / 2)) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 center = player.Center + new Vector2(-npc.ai[1], teleportLocation); //teleport distance + vectorCenter = (npc.Center = center); + int num36 = Math.Sign(player.Center.X - vectorCenter.X); + if (num36 != 0) + { + if (npc.ai[2] == 0f && num36 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num36; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1460) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + if (npc.ai[3] == 5f && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + if (npc.ai[3] >= 20f) //14 + { + npc.ai[3] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 24f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 25f) //start phase 5 + { + npc.alpha = 0; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1459 - 60)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1459) + { + startSecondAI = true; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + #endregion + } - #region AI2 - public void Yharon_AI2() - { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.75; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool phase4 = (double)npc.life <= (double)npc.lifeMax * 0.05; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - phase2 = (double)npc.life <= (double)npc.lifeMax * 0.95; - phase3 = (double)npc.life <= (double)npc.lifeMax * 0.7; - phase4 = (double)npc.life <= (double)npc.lifeMax * 0.15; - } - else if (revenge) - { - phase2 = (double)npc.life <= (double)npc.lifeMax * 0.85; - phase3 = (double)npc.life <= (double)npc.lifeMax * 0.6; - phase4 = (double)npc.life <= (double)npc.lifeMax * 0.1; - } - if (npc.ai[0] != 8f) - { - npc.alpha -= 25; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (!moveCloser) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); - else - music = MusicID.LunarBoss; - moveCloser = true; - string key = "Mods.CalamityMod.FlameText"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (invincibilityCounter < 900) - { - phase2 = phase3 = phase4 = false; - invincibilityCounter += 1; - int heal = 5; //900 / 5 = 180 - healCounter += 1; - if (healCounter >= heal) - { - healCounter = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = npc.lifeMax / 200; - if (healAmt > npc.lifeMax - npc.life) - { - healAmt = npc.lifeMax - npc.life; - } - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - else - { - npc.dontTakeDamage = npc.ai[0] == 9f; - npc.chaseable = npc.ai[0] < 8f; - } - NPCUtils.TargetClosestBetsy(npc, false, null); - NPCAimedTarget targetData = npc.GetTargetData(true); - if (!targetData.Hitbox.Intersects(safeBox)) - { - protectionBoost = true; - npc.damage = npc.defDamage * 5; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - } - else - { - npc.damage = npc.defDamage; - if (phase4) - { - npc.damage = (int)((float)npc.defDamage * 1.25f); - } - protectionBoost = false; - if (npc.timeLeft < 3600) - { - npc.timeLeft = 3600; - } - } + #region AI2 + public void Yharon_AI2() + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.75; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool phase4 = (double)npc.life <= (double)npc.lifeMax * 0.05; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + phase2 = (double)npc.life <= (double)npc.lifeMax * 0.95; + phase3 = (double)npc.life <= (double)npc.lifeMax * 0.7; + phase4 = (double)npc.life <= (double)npc.lifeMax * 0.15; + } + else if (revenge) + { + phase2 = (double)npc.life <= (double)npc.lifeMax * 0.85; + phase3 = (double)npc.life <= (double)npc.lifeMax * 0.6; + phase4 = (double)npc.life <= (double)npc.lifeMax * 0.1; + } + if (npc.ai[0] != 8f) + { + npc.alpha -= 25; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (!moveCloser) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); + else + music = MusicID.LunarBoss; + moveCloser = true; + string key = "Mods.CalamityMod.FlameText"; + Color messageColor = Color.Orange; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (invincibilityCounter < 900) + { + phase2 = phase3 = phase4 = false; + invincibilityCounter += 1; + int heal = 5; //900 / 5 = 180 + healCounter += 1; + if (healCounter >= heal) + { + healCounter = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = npc.lifeMax / 200; + if (healAmt > npc.lifeMax - npc.life) + { + healAmt = npc.lifeMax - npc.life; + } + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + else + { + npc.dontTakeDamage = npc.ai[0] == 9f; + npc.chaseable = npc.ai[0] < 8f; + } + NPCUtils.TargetClosestBetsy(npc, false, null); + NPCAimedTarget targetData = npc.GetTargetData(true); + if (!targetData.Hitbox.Intersects(safeBox)) + { + protectionBoost = true; + npc.damage = npc.defDamage * 5; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + } + else + { + npc.damage = npc.defDamage; + if (phase4) + { + npc.damage = (int)((float)npc.defDamage * 1.25f); + } + protectionBoost = false; + if (npc.timeLeft < 3600) + { + npc.timeLeft = 3600; + } + } // Set DR based on protection boost (aka enrage) npc.Calamity().DR = protectionBoost ? EnragedDR : Phase2_DR; int num = -1; - float num2 = 1f; - int num4 = expertMode ? 110 : 125; - if (phase4) - { - num4 = (int)((double)num4 * 1.25); - } - float num6 = revenge ? 0.6f : 0.55f; - float scaleFactor = revenge ? 10f : 9f; - float chargeTime = 34f; - float chargeTime2 = 30f; - float chargeSpeed = revenge ? 26f : 25f; - float chargeSpeed2 = revenge ? 40f : 38f; - float num11 = 40f; - float num12 = 80f; - float num13 = num11 + num12; - float num15 = 60f; - float scaleFactor3 = 14f; - float scaleFactor4 = revenge ? 16f : 15f; //12 - int num16 = 10; - int num17 = 6 * num16; - float num18 = 60f; - float num19 = num15 + (float)num17 + num18; - float num20 = 60f; - float num21 = 1f; - float num22 = 6.28318548f * (num21 / num20); - float scaleFactor5 = revenge ? 38f : 36.5f; //32 - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - scaleFactor = 10.5f; - chargeSpeed = 27f; - chargeSpeed2 = 41f; - scaleFactor4 = 16.5f; - scaleFactor5 = 39f; - } - if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num6 = 0.65f; - scaleFactor = 11f; - chargeSpeed = 32f; - chargeSpeed2 = 45f; - scaleFactor4 = 18f; - scaleFactor5 = 40f; - } - float num25 = 20f; - float arg_F9_0 = npc.ai[0]; - float num26; - if (npc.ai[0] == 0f) - { - float[] expr_115_cp_0 = npc.ai; - int expr_115_cp_1 = 1; - num26 = expr_115_cp_0[expr_115_cp_1] + 1f; - expr_115_cp_0[expr_115_cp_1] = num26; - if (num26 >= 10f) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)((npc.Center.X < targetData.Center.X) ? 1 : -1); - } - Vector2 destination = targetData.Center + new Vector2(-npc.ai[2] * 300f, -200f); - Vector2 desiredVelocity = npc.DirectionTo(destination) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, num6); - int num27 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.direction = (npc.spriteDirection = num27); - float[] expr_225_cp_0 = npc.ai; - int expr_225_cp_1 = 1; - num26 = expr_225_cp_0[expr_225_cp_1] + 1f; - expr_225_cp_0[expr_225_cp_1] = num26; - if (num26 >= 30f) - { - int num28 = 1; - if (phase4) - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 8; //teleport - break; - case 1: - case 2: - num28 = 7; //fast charge - break; - case 3: - num28 = 5; //fire circle + tornado (only once) + fireballs - break; - } - } - else if (phase3) - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; //tornado - break; - case 1: - num28 = 7; //fast charge - break; - case 2: - num28 = 8; //teleport - break; - case 3: - num28 = 7; //fast charge - break; - case 4: - num28 = 5; //fire circle - break; - case 5: - num28 = 4; //fireballs - break; - case 6: - num28 = 7; //fast charge - break; - case 7: - num28 = 8; //teleport - break; - case 8: - num28 = 7; //fast charge - break; - case 9: - num28 = 3; //fireballs - break; - case 10: - num28 = 6; //tornado - break; - case 11: - num28 = 7; //fast charge - break; - case 12: - num28 = 8; //teleport - break; - case 13: - num28 = 7; //fast charge - break; - case 14: - num28 = 5; //fire circle - break; - case 15: - num28 = 4; //fireballs - break; - } - } - else if (phase2) - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; //tornado - break; - case 1: - num28 = 7; //fast charge - break; - case 2: - num28 = 2; //charge - break; - case 3: - num28 = 5; //fire circle - break; - case 4: - num28 = 4; //fireballs - break; - case 5: - num28 = 7; //fast charge - break; - case 6: - num28 = 2; //charge - break; - case 7: - num28 = 3; //fireballs - break; - case 8: - num28 = 7; //fast charge - break; - case 9: - num28 = 2; //charge - break; - case 10: - num28 = 5; //fire circle - break; - } - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; //tornado - break; - case 1: - case 2: - num28 = 2; //charge - break; - case 3: - num28 = 3; //fireballs - break; - case 4: - case 5: - num28 = 2; //charge - break; - case 6: - num28 = 4; //fireballs - break; - case 7: - case 8: - num28 = 2; //charge - break; - case 9: - num28 = 5; //fire circle - break; - } - } - npc.ai[0] = (float)num28; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - switch (secondPhasePhase) - { - case 1: - if (phase2) - { - secondPhasePhase = 2; - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - break; - case 2: - if (phase3) - { - secondPhasePhase = 3; - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - break; - case 3: - if (phase4) - { - secondPhasePhase = 4; - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - break; - } - npc.netUpdate = true; - float aiLimit = 10f; - if (phase4) - { - aiLimit = 4f; - } - else if (phase3) - { - aiLimit = 16f; - } - else if (phase2) - { - aiLimit = 11f; - } - if (npc.ai[3] >= aiLimit) - { - npc.ai[3] = 0f; - } - switch (num28) - { - case 2: //charge - { - Vector2 vector = npc.DirectionTo(targetData.Center); - npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); - npc.rotation = vector.ToRotation(); - if (npc.spriteDirection == -1) - { - npc.rotation += 3.14159274f; - } - npc.velocity = vector * chargeSpeed; - break; - } - case 3: //fireballs - { - Vector2 vector2 = new Vector2((float)((targetData.Center.X > npc.Center.X) ? 1 : -1), 0f); - npc.spriteDirection = ((vector2.X > 0f) ? 1 : -1); - npc.velocity = vector2 * -2f; - break; - } - case 5: //spin move - { - Vector2 vector3 = npc.DirectionTo(targetData.Center); - npc.spriteDirection = ((vector3.X > 0f) ? 1 : -1); - npc.rotation = vector3.ToRotation(); - if (npc.spriteDirection == -1) - { - npc.rotation += 3.14159274f; - } - npc.velocity = vector3 * scaleFactor5; - break; - } - case 7: //fast charge - { - Vector2 vector = npc.DirectionTo(targetData.Center); - npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); - npc.rotation = vector.ToRotation(); - if (npc.spriteDirection == -1) - { - npc.rotation += 3.14159274f; - } - npc.velocity = vector * chargeSpeed2; - break; - } - } - } - } - else if (npc.ai[0] == 2f) - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - int num1473 = 7; - for (int num1474 = 0; num1474 < num1473; num1474++) - { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + npc.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; - } - float[] expr_498_cp_0 = npc.ai; - int expr_498_cp_1 = 1; - num26 = expr_498_cp_0[expr_498_cp_1] + 1f; - expr_498_cp_0[expr_498_cp_1] = num26; - if (num26 >= chargeTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - else if (npc.ai[0] == 3f) //fireball spit - { - npc.ai[1] += 1f; - int num29 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = (float)num29; - if (npc.ai[1] < num11) - { - Vector2 vector4 = targetData.Center + new Vector2((float)num29 * -600f, -250f); - Vector2 value = npc.DirectionTo(vector4) * 12f; - if (npc.Distance(vector4) < 12f) - { - npc.Center = vector4; - } - else - { - npc.position += value; - } - if (Vector2.Distance(vector4, npc.Center) < 16f) - { - npc.ai[1] = num11 - 1f; - } - num2 = 1.5f; - } - if (npc.ai[1] == num11) - { - int num30 = (targetData.Center.X > npc.Center.X) ? 1 : -1; - npc.velocity = new Vector2((float)num30, 0f) * 22f; //10f - npc.direction = (npc.spriteDirection = num30); - } - if (npc.ai[1] >= num11) - { - if (npc.ai[1] % 8 == 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, - default); - float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = targetData.Center.X - vectorShoot.X; - float playerY = targetData.Center.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerXY = speed / playerXY; - playerX *= playerXY; - playerY *= playerXY; - Projectile.NewProjectile(position.X, position.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), num4, 0f, Main.myPlayer, 1f, 0f); - } - num2 = 1.5f; - if (Math.Abs(targetData.Center.X - npc.Center.X) > 550f && Math.Abs(npc.velocity.X) < 20f) - { - npc.velocity.X = npc.velocity.X + (float)Math.Sign(npc.velocity.X) * 0.5f; - } - } - if (npc.ai[1] >= num13) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - else if (npc.ai[0] == 4f) //fireball spit - { - int num31 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = (float)num31; - if (npc.ai[1] < num15) - { - Vector2 vector5 = targetData.Center + new Vector2((float)num31 * -1500f, -350f); - Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; - npc.velocity = Vector2.Lerp(npc.velocity, value2, 0.0333333351f); - int num32 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.direction = (npc.spriteDirection = num32); - if (Vector2.Distance(vector5, npc.Center) < 16f) - { - npc.ai[1] = num15 - 1f; - } - num2 = 1.5f; - } - else if (npc.ai[1] == num15) - { - Vector2 vector6 = npc.DirectionTo(targetData.Center); - vector6.Y *= 0.25f; - vector6 = vector6.SafeNormalize(Vector2.UnitX * (float)npc.direction); - npc.spriteDirection = ((vector6.X > 0f) ? 1 : -1); - npc.rotation = vector6.ToRotation(); - if (npc.spriteDirection == -1) - { - npc.rotation += 3.14159274f; - } - npc.velocity = vector6 * scaleFactor4; - } - else - { - npc.position.X = npc.position.X + npc.DirectionTo(targetData.Center).X * 7f; - npc.position.Y = npc.position.Y + npc.DirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; - if (npc.ai[1] <= num19 - num18) - { - num2 = 1.5f; - } - float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, - default); - int num34 = (int)(npc.ai[1] - num15 + 1f); - if (num34 <= num17 && num34 % num16 == 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); - } - } - if (npc.ai[1] > num19 - num18) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - } - npc.ai[1] += 1f; - if (npc.ai[1] >= num19) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - else if (npc.ai[0] == 5f) //spin 2 win - { - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num22 * (float)npc.direction), default); - npc.position.Y = npc.position.Y - 0.1f; - npc.position += npc.DirectionTo(targetData.Center) * 10f; - npc.rotation -= num22 * (float)npc.direction; - num2 *= 0.7f; - if (npc.ai[1] == 1f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - float[] expr_B0F_cp_0 = npc.ai; - int expr_B0F_cp_1 = 1; - num26 = expr_B0F_cp_0[expr_B0F_cp_1] + 1f; - expr_B0F_cp_0[expr_B0F_cp_1] = num26; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[1] % 12 == 0) - { - float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, - default); - Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); - if (phase4) - { - float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = targetData.Center.X - vectorShoot.X; - float playerY = targetData.Center.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerXY = speed / playerXY; - playerX *= playerXY; - playerY *= playerXY; - Projectile.NewProjectile(position.X, position.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), num4, 0f, Main.myPlayer, 0f, 0f); - } - } - if (npc.ai[1] == 45f && phase4 && useTornado) - { - useTornado = false; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare2"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - } - if (num26 >= num20) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity /= 2f; - } - } - else if (npc.ai[0] == 6f) //flare spawn - { - if (npc.ai[1] == 0f) - { - Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * scaleFactor * 2f; - npc.SimpleFlyMovement(desiredVelocity2, num6 * 2f); - int num35 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.direction = (npc.spriteDirection = num35); - npc.ai[2] += 1f; - if (npc.Distance(targetData.Center) < 1000f || npc.ai[2] >= 180f) //450f - { - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - else - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[1] < num25) - { - npc.velocity *= 0.95f; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[1] == num25) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y / 3f; - } - npc.velocity.Y = npc.velocity.Y - 3f; - } - num2 *= 0.85f; - bool flag3 = npc.ai[1] == 20f || npc.ai[1] == 45f || npc.ai[1] == 70f; - int flareCount = NPC.CountNPCS(mod.NPCType("DetonatingFlare")) + NPC.CountNPCS(mod.NPCType("DetonatingFlare2")); - if (flareCount > 5) - { - flag3 = false; - } - if (flag3 && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector7 = npc.Center + (6.28318548f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); - if (Vector2.Distance(vector7, targetData.Center) > 100f) - { - Point point2 = vector7.ToPoint(); - NPC.NewNPC(point2.X, point2.Y, mod.NPCType("DetonatingFlare"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC(point2.X, point2.Y, mod.NPCType("DetonatingFlare2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - NPC.NewNPC((int)npc.Center.X + (Main.rand.NextBool(2) ? 100 : -100), (int)npc.Center.Y - 100, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + (Main.rand.NextBool(2) ? 100 : -100), (int)npc.Center.Y - 100, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); - } - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 90f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare2"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - Boom(600, num4); - } - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - else if (npc.ai[0] == 7f) //speedee chargee - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - int num1473 = 7; - for (int num1474 = 0; num1474 < num1473; num1474++) - { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + npc.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; - } - float[] expr_498_cp_0 = npc.ai; - int expr_498_cp_1 = 1; - num26 = expr_498_cp_0[expr_498_cp_1] + 1f; - expr_498_cp_0[expr_498_cp_1] = num26; - if (num26 >= chargeTime2) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - else if (npc.ai[0] == 8f) //teleport - { - Vector2 npcCenter = npc.Center; - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == 15f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 15f) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((npcCenter - targetData.Center).X)); - } - teleportLocation = (Main.rand.NextBool(2) ? (revenge ? 600 : 700) : (revenge ? -600 : -700)); - Vector2 center = targetData.Center + new Vector2(-npc.ai[1], (float)teleportLocation); //teleport distance - npcCenter = (npc.Center = center); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 9f) //enter next phase - { - npc.chaseable = false; - npc.velocity *= 0.95f; - Vector2 vector = npc.DirectionTo(targetData.Center); - npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); - npc.rotation = vector.ToRotation(); - if (npc.spriteDirection == -1) - { - npc.rotation += 3.14159274f; - } - if (npc.ai[2] == 120f) - { - if (phase4) - { - int proj; - for (int x = 0; x < 1000; x = proj + 1) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == mod.ProjectileType("Infernado2")) - { - if (projectile.timeLeft >= 300) - projectile.active = false; - else if (projectile.timeLeft > 5) - projectile.timeLeft = (int)(5f * projectile.ai[1]); - } - else if (projectile.type == mod.ProjectileType("BigFlare2")) - projectile.active = false; - } - proj = x; - } - } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - npc.localAI[0] += num2; - if (npc.localAI[0] >= 36f) - { - npc.localAI[0] = 0f; - } - if (num != -1) - { - npc.localAI[0] = (float)(num * 4); - } - float[] expr_11FC_cp_0 = npc.localAI; - int expr_11FC_cp_1 = 1; - num26 = expr_11FC_cp_0[expr_11FC_cp_1] + 1f; - expr_11FC_cp_0[expr_11FC_cp_1] = num26; - if (num26 >= 60f) - { - npc.localAI[1] = 0f; - } - float num42 = npc.DirectionTo(targetData.Center).ToRotation(); - float num43 = 0.04f; - switch ((int)npc.ai[0]) - { - case 2: - case 5: - case 7: - case 8: - case 9: - num43 = 0f; - break; - case 3: - num43 = 0.01f; - num42 = 0f; - if (npc.spriteDirection == -1) - { - num42 -= 3.14159274f; - } - if (npc.ai[1] >= num11) - { - num42 += (float)npc.spriteDirection * 3.14159274f / 12f; - num43 = 0.05f; - } - break; - case 4: - num43 = 0.01f; - num42 = 3.14159274f; - if (npc.spriteDirection == 1) - { - num42 += 3.14159274f; - } - break; - case 6: - num43 = 0.02f; - num42 = 0f; - if (npc.spriteDirection == -1) - { - num42 -= 3.14159274f; - } - break; - } - if (npc.spriteDirection == -1) - { - num42 += 3.14159274f; - } - if (num43 != 0f) - { - npc.rotation = npc.rotation.AngleTowards(num42, num43); - } - } - #endregion + float num2 = 1f; + int num4 = expertMode ? 110 : 125; + if (phase4) + { + num4 = (int)((double)num4 * 1.25); + } + float num6 = revenge ? 0.6f : 0.55f; + float scaleFactor = revenge ? 10f : 9f; + float chargeTime = 34f; + float chargeTime2 = 30f; + float chargeSpeed = revenge ? 26f : 25f; + float chargeSpeed2 = revenge ? 40f : 38f; + float num11 = 40f; + float num12 = 80f; + float num13 = num11 + num12; + float num15 = 60f; + float scaleFactor3 = 14f; + float scaleFactor4 = revenge ? 16f : 15f; //12 + int num16 = 10; + int num17 = 6 * num16; + float num18 = 60f; + float num19 = num15 + (float)num17 + num18; + float num20 = 60f; + float num21 = 1f; + float num22 = 6.28318548f * (num21 / num20); + float scaleFactor5 = revenge ? 38f : 36.5f; //32 + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + scaleFactor = 10.5f; + chargeSpeed = 27f; + chargeSpeed2 = 41f; + scaleFactor4 = 16.5f; + scaleFactor5 = 39f; + } + if (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num6 = 0.65f; + scaleFactor = 11f; + chargeSpeed = 32f; + chargeSpeed2 = 45f; + scaleFactor4 = 18f; + scaleFactor5 = 40f; + } + float num25 = 20f; + float arg_F9_0 = npc.ai[0]; + float num26; + if (npc.ai[0] == 0f) + { + float[] expr_115_cp_0 = npc.ai; + int expr_115_cp_1 = 1; + num26 = expr_115_cp_0[expr_115_cp_1] + 1f; + expr_115_cp_0[expr_115_cp_1] = num26; + if (num26 >= 10f) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)((npc.Center.X < targetData.Center.X) ? 1 : -1); + } + Vector2 destination = targetData.Center + new Vector2(-npc.ai[2] * 300f, -200f); + Vector2 desiredVelocity = npc.DirectionTo(destination) * scaleFactor; + npc.SimpleFlyMovement(desiredVelocity, num6); + int num27 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.direction = (npc.spriteDirection = num27); + float[] expr_225_cp_0 = npc.ai; + int expr_225_cp_1 = 1; + num26 = expr_225_cp_0[expr_225_cp_1] + 1f; + expr_225_cp_0[expr_225_cp_1] = num26; + if (num26 >= 30f) + { + int num28 = 1; + if (phase4) + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 8; //teleport + break; + case 1: + case 2: + num28 = 7; //fast charge + break; + case 3: + num28 = 5; //fire circle + tornado (only once) + fireballs + break; + } + } + else if (phase3) + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + num28 = 7; //fast charge + break; + case 2: + num28 = 8; //teleport + break; + case 3: + num28 = 7; //fast charge + break; + case 4: + num28 = 5; //fire circle + break; + case 5: + num28 = 4; //fireballs + break; + case 6: + num28 = 7; //fast charge + break; + case 7: + num28 = 8; //teleport + break; + case 8: + num28 = 7; //fast charge + break; + case 9: + num28 = 3; //fireballs + break; + case 10: + num28 = 6; //tornado + break; + case 11: + num28 = 7; //fast charge + break; + case 12: + num28 = 8; //teleport + break; + case 13: + num28 = 7; //fast charge + break; + case 14: + num28 = 5; //fire circle + break; + case 15: + num28 = 4; //fireballs + break; + } + } + else if (phase2) + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + num28 = 7; //fast charge + break; + case 2: + num28 = 2; //charge + break; + case 3: + num28 = 5; //fire circle + break; + case 4: + num28 = 4; //fireballs + break; + case 5: + num28 = 7; //fast charge + break; + case 6: + num28 = 2; //charge + break; + case 7: + num28 = 3; //fireballs + break; + case 8: + num28 = 7; //fast charge + break; + case 9: + num28 = 2; //charge + break; + case 10: + num28 = 5; //fire circle + break; + } + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + case 2: + num28 = 2; //charge + break; + case 3: + num28 = 3; //fireballs + break; + case 4: + case 5: + num28 = 2; //charge + break; + case 6: + num28 = 4; //fireballs + break; + case 7: + case 8: + num28 = 2; //charge + break; + case 9: + num28 = 5; //fire circle + break; + } + } + npc.ai[0] = (float)num28; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + switch (secondPhasePhase) + { + case 1: + if (phase2) + { + secondPhasePhase = 2; + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + break; + case 2: + if (phase3) + { + secondPhasePhase = 3; + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + break; + case 3: + if (phase4) + { + secondPhasePhase = 4; + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + break; + } + npc.netUpdate = true; + float aiLimit = 10f; + if (phase4) + { + aiLimit = 4f; + } + else if (phase3) + { + aiLimit = 16f; + } + else if (phase2) + { + aiLimit = 11f; + } + if (npc.ai[3] >= aiLimit) + { + npc.ai[3] = 0f; + } + switch (num28) + { + case 2: //charge + { + Vector2 vector = npc.DirectionTo(targetData.Center); + npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); + npc.rotation = vector.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + npc.velocity = vector * chargeSpeed; + break; + } + case 3: //fireballs + { + Vector2 vector2 = new Vector2((float)((targetData.Center.X > npc.Center.X) ? 1 : -1), 0f); + npc.spriteDirection = ((vector2.X > 0f) ? 1 : -1); + npc.velocity = vector2 * -2f; + break; + } + case 5: //spin move + { + Vector2 vector3 = npc.DirectionTo(targetData.Center); + npc.spriteDirection = ((vector3.X > 0f) ? 1 : -1); + npc.rotation = vector3.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + npc.velocity = vector3 * scaleFactor5; + break; + } + case 7: //fast charge + { + Vector2 vector = npc.DirectionTo(targetData.Center); + npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); + npc.rotation = vector.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + npc.velocity = vector * chargeSpeed2; + break; + } + } + } + } + else if (npc.ai[0] == 2f) + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + int num1473 = 7; + for (int num1474 = 0; num1474 < num1473; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + npc.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + float[] expr_498_cp_0 = npc.ai; + int expr_498_cp_1 = 1; + num26 = expr_498_cp_0[expr_498_cp_1] + 1f; + expr_498_cp_0[expr_498_cp_1] = num26; + if (num26 >= chargeTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + else if (npc.ai[0] == 3f) //fireball spit + { + npc.ai[1] += 1f; + int num29 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.ai[2] = (float)num29; + if (npc.ai[1] < num11) + { + Vector2 vector4 = targetData.Center + new Vector2((float)num29 * -600f, -250f); + Vector2 value = npc.DirectionTo(vector4) * 12f; + if (npc.Distance(vector4) < 12f) + { + npc.Center = vector4; + } + else + { + npc.position += value; + } + if (Vector2.Distance(vector4, npc.Center) < 16f) + { + npc.ai[1] = num11 - 1f; + } + num2 = 1.5f; + } + if (npc.ai[1] == num11) + { + int num30 = (targetData.Center.X > npc.Center.X) ? 1 : -1; + npc.velocity = new Vector2((float)num30, 0f) * 22f; //10f + npc.direction = (npc.spriteDirection = num30); + } + if (npc.ai[1] >= num11) + { + if (npc.ai[1] % 8 == 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + float num33 = 30f; + Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, + default); + float speed = 0.01f; + Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float playerX = targetData.Center.X - vectorShoot.X; + float playerY = targetData.Center.Y - vectorShoot.Y; + float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerXY = speed / playerXY; + playerX *= playerXY; + playerY *= playerXY; + Projectile.NewProjectile(position.X, position.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), num4, 0f, Main.myPlayer, 1f, 0f); + } + num2 = 1.5f; + if (Math.Abs(targetData.Center.X - npc.Center.X) > 550f && Math.Abs(npc.velocity.X) < 20f) + { + npc.velocity.X = npc.velocity.X + (float)Math.Sign(npc.velocity.X) * 0.5f; + } + } + if (npc.ai[1] >= num13) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + else if (npc.ai[0] == 4f) //fireball spit + { + int num31 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.ai[2] = (float)num31; + if (npc.ai[1] < num15) + { + Vector2 vector5 = targetData.Center + new Vector2((float)num31 * -1500f, -350f); + Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; + npc.velocity = Vector2.Lerp(npc.velocity, value2, 0.0333333351f); + int num32 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.direction = (npc.spriteDirection = num32); + if (Vector2.Distance(vector5, npc.Center) < 16f) + { + npc.ai[1] = num15 - 1f; + } + num2 = 1.5f; + } + else if (npc.ai[1] == num15) + { + Vector2 vector6 = npc.DirectionTo(targetData.Center); + vector6.Y *= 0.25f; + vector6 = vector6.SafeNormalize(Vector2.UnitX * (float)npc.direction); + npc.spriteDirection = ((vector6.X > 0f) ? 1 : -1); + npc.rotation = vector6.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + npc.velocity = vector6 * scaleFactor4; + } + else + { + npc.position.X = npc.position.X + npc.DirectionTo(targetData.Center).X * 7f; + npc.position.Y = npc.position.Y + npc.DirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; + if (npc.ai[1] <= num19 - num18) + { + num2 = 1.5f; + } + float num33 = 30f; + Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, + default); + int num34 = (int)(npc.ai[1] - num15 + 1f); + if (num34 <= num17 && num34 % num16 == 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); + } + } + if (npc.ai[1] > num19 - num18) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + } + npc.ai[1] += 1f; + if (npc.ai[1] >= num19) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + else if (npc.ai[0] == 5f) //spin 2 win + { + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num22 * (float)npc.direction), default); + npc.position.Y = npc.position.Y - 0.1f; + npc.position += npc.DirectionTo(targetData.Center) * 10f; + npc.rotation -= num22 * (float)npc.direction; + num2 *= 0.7f; + if (npc.ai[1] == 1f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + float[] expr_B0F_cp_0 = npc.ai; + int expr_B0F_cp_1 = 1; + num26 = expr_B0F_cp_0[expr_B0F_cp_1] + 1f; + expr_B0F_cp_0[expr_B0F_cp_1] = num26; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[1] % 12 == 0) + { + float num33 = 30f; + Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, + default); + Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); + if (phase4) + { + float speed = 0.01f; + Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float playerX = targetData.Center.X - vectorShoot.X; + float playerY = targetData.Center.Y - vectorShoot.Y; + float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerXY = speed / playerXY; + playerX *= playerXY; + playerY *= playerXY; + Projectile.NewProjectile(position.X, position.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), num4, 0f, Main.myPlayer, 0f, 0f); + } + } + if (npc.ai[1] == 45f && phase4 && useTornado) + { + useTornado = false; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare2"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + } + if (num26 >= num20) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity /= 2f; + } + } + else if (npc.ai[0] == 6f) //flare spawn + { + if (npc.ai[1] == 0f) + { + Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); + Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * scaleFactor * 2f; + npc.SimpleFlyMovement(desiredVelocity2, num6 * 2f); + int num35 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.direction = (npc.spriteDirection = num35); + npc.ai[2] += 1f; + if (npc.Distance(targetData.Center) < 1000f || npc.ai[2] >= 180f) //450f + { + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + else + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[1] < num25) + { + npc.velocity *= 0.95f; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[1] == num25) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y / 3f; + } + npc.velocity.Y = npc.velocity.Y - 3f; + } + num2 *= 0.85f; + bool flag3 = npc.ai[1] == 20f || npc.ai[1] == 45f || npc.ai[1] == 70f; + int flareCount = NPC.CountNPCS(mod.NPCType("DetonatingFlare")) + NPC.CountNPCS(mod.NPCType("DetonatingFlare2")); + if (flareCount > 5) + { + flag3 = false; + } + if (flag3 && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector7 = npc.Center + (6.28318548f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); + if (Vector2.Distance(vector7, targetData.Center) > 100f) + { + Point point2 = vector7.ToPoint(); + NPC.NewNPC(point2.X, point2.Y, mod.NPCType("DetonatingFlare"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(point2.X, point2.Y, mod.NPCType("DetonatingFlare2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + NPC.NewNPC((int)npc.Center.X + (Main.rand.NextBool(2) ? 100 : -100), (int)npc.Center.Y - 100, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + (Main.rand.NextBool(2) ? 100 : -100), (int)npc.Center.Y - 100, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); + } + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 90f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare2"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + Boom(600, num4); + } + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + else if (npc.ai[0] == 7f) //speedee chargee + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + int num1473 = 7; + for (int num1474 = 0; num1474 < num1473; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default) + npc.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + float[] expr_498_cp_0 = npc.ai; + int expr_498_cp_1 = 1; + num26 = expr_498_cp_0[expr_498_cp_1] + 1f; + expr_498_cp_0[expr_498_cp_1] = num26; + if (num26 >= chargeTime2) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + else if (npc.ai[0] == 8f) //teleport + { + Vector2 npcCenter = npc.Center; + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == 15f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 15f) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((npcCenter - targetData.Center).X)); + } + teleportLocation = (Main.rand.NextBool(2) ? (revenge ? 600 : 700) : (revenge ? -600 : -700)); + Vector2 center = targetData.Center + new Vector2(-npc.ai[1], (float)teleportLocation); //teleport distance + npcCenter = (npc.Center = center); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 25f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 9f) //enter next phase + { + npc.chaseable = false; + npc.velocity *= 0.95f; + Vector2 vector = npc.DirectionTo(targetData.Center); + npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); + npc.rotation = vector.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + if (npc.ai[2] == 120f) + { + if (phase4) + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == mod.ProjectileType("Infernado2")) + { + if (projectile.timeLeft >= 300) + projectile.active = false; + else if (projectile.timeLeft > 5) + projectile.timeLeft = (int)(5f * projectile.ai[1]); + } + else if (projectile.type == mod.ProjectileType("BigFlare2")) + projectile.active = false; + } + proj = x; + } + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 180f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + npc.localAI[0] += num2; + if (npc.localAI[0] >= 36f) + { + npc.localAI[0] = 0f; + } + if (num != -1) + { + npc.localAI[0] = (float)(num * 4); + } + float[] expr_11FC_cp_0 = npc.localAI; + int expr_11FC_cp_1 = 1; + num26 = expr_11FC_cp_0[expr_11FC_cp_1] + 1f; + expr_11FC_cp_0[expr_11FC_cp_1] = num26; + if (num26 >= 60f) + { + npc.localAI[1] = 0f; + } + float num42 = npc.DirectionTo(targetData.Center).ToRotation(); + float num43 = 0.04f; + switch ((int)npc.ai[0]) + { + case 2: + case 5: + case 7: + case 8: + case 9: + num43 = 0f; + break; + case 3: + num43 = 0.01f; + num42 = 0f; + if (npc.spriteDirection == -1) + { + num42 -= 3.14159274f; + } + if (npc.ai[1] >= num11) + { + num42 += (float)npc.spriteDirection * 3.14159274f / 12f; + num43 = 0.05f; + } + break; + case 4: + num43 = 0.01f; + num42 = 3.14159274f; + if (npc.spriteDirection == 1) + { + num42 += 3.14159274f; + } + break; + case 6: + num43 = 0.02f; + num42 = 0f; + if (npc.spriteDirection == -1) + { + num42 -= 3.14159274f; + } + break; + } + if (npc.spriteDirection == -1) + { + num42 += 3.14159274f; + } + if (num43 != 0f) + { + npc.rotation = npc.rotation.AngleTowards(num42, num43); + } + } + #endregion - #region Drawing - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Texture2D texture = Main.npcTexture[npc.type]; - Microsoft.Xna.Framework.Rectangle frame6 = npc.frame; - Microsoft.Xna.Framework.Color color9 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - int num156 = texture.Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - if (startSecondAI && !phaseOneLoot) - { - bool drawAfterImage2 = (npc.ai[0] == 2f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 5f || npc.ai[0] == 7f) && Lighting.NotRetro; - SpriteEffects spriteEffects2 = spriteEffects ^ SpriteEffects.FlipHorizontally; - if (invincibilityCounter < 900) - { - color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - } - Microsoft.Xna.Framework.Color alpha16 = npc.GetAlpha(color9); - while (drawAfterImage2 && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - goto IL_6899; - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - alpha16 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha16, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects2, 0f); - goto IL_6881; - } - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects2, 0); - return false; - } - Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); - bool drawAfterImage = (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 8f || npc.ai[0] == 11f || npc.ai[0] == 12f || - npc.ai[0] == 14f || npc.ai[0] == 15f || npc.ai[0] == 18f || npc.ai[0] == 19f || npc.ai[0] == 22f) && Lighting.NotRetro; - while (drawAfterImage && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - goto IL_6899; - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - alpha15 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha15, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - return false; - } + #region Drawing + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture = Main.npcTexture[npc.type]; + Microsoft.Xna.Framework.Rectangle frame6 = npc.frame; + Microsoft.Xna.Framework.Color color9 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + int num156 = texture.Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + if (startSecondAI && !phaseOneLoot) + { + bool drawAfterImage2 = (npc.ai[0] == 2f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 5f || npc.ai[0] == 7f) && Lighting.NotRetro; + SpriteEffects spriteEffects2 = spriteEffects ^ SpriteEffects.FlipHorizontally; + if (invincibilityCounter < 900) + { + color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + } + Microsoft.Xna.Framework.Color alpha16 = npc.GetAlpha(color9); + while (drawAfterImage2 && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + goto IL_6899; + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + alpha16 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha16, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects2, 0f); + goto IL_6881; + } + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects2, 0); + return false; + } + Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); + bool drawAfterImage = (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 8f || npc.ai[0] == 11f || npc.ai[0] == 12f || + npc.ai[0] == 14f || npc.ai[0] == 15f || npc.ai[0] == 18f || npc.ai[0] == 19f || npc.ai[0] == 22f) && Lighting.NotRetro; + while (drawAfterImage && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + goto IL_6899; + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + alpha15 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha15, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + return false; + } #endregion #region Loot @@ -2753,28 +2753,28 @@ namespace CalamityMod.NPCs.Yharon } public override void NPCLoot() - { + { // If Yharon runs away in phase 1 and the Eclipse isn't buffed yet, notify players of the buffed Solar Eclipse if (!startSecondAI && !CalamityWorld.buffedEclipse) - { - CalamityWorld.buffedEclipse = true; + { + CalamityWorld.buffedEclipse = true; CalamityMod.UpdateServerBoolean(); - string key = "Mods.CalamityMod.DargonBossText"; - Color messageColor = Color.Orange; + string key = "Mods.CalamityMod.DargonBossText"; + Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } // Bags occur in either phase 1 or 2, as they don't contain phase 2 only drops DropHelper.DropBags(npc); // Phase 1 drops: Contained in the bag, so they only drop directly on Normal if (!Main.expertMode) - { + { // Weapons DropHelper.DropItemChance(npc, mod.ItemType("DragonRage"), 4); DropHelper.DropItemChance(npc, mod.ItemType("TheBurningSky"), 4); @@ -2787,7 +2787,7 @@ namespace CalamityMod.NPCs.Yharon // Vanity DropHelper.DropItemChance(npc, mod.ItemType("YharonMask"), 7); DropHelper.DropItemChance(npc, mod.ItemType("ForgottenDragonEgg"), 10); - } + } // These drops only occur in Phase 2 (where you actually kill Yharon) if (startSecondAI) @@ -2797,11 +2797,11 @@ namespace CalamityMod.NPCs.Yharon int soulFragMax = Main.expertMode ? 28 : 22; DropHelper.DropItem(npc, mod.ItemType("HellcasterFragment"), true, soulFragMin, soulFragMax); - // Equipment - DropHelper.DropItem(npc, mod.ItemType("DrewsWings")); + // Equipment + DropHelper.DropItem(npc, mod.ItemType("DrewsWings")); - // Weapons - DropHelper.DropItemChance(npc, mod.ItemType("VoidVortex"), DropHelper.RareVariantDropRateInt); + // Weapons + DropHelper.DropItemChance(npc, mod.ItemType("VoidVortex"), DropHelper.RareVariantDropRateInt); DropHelper.DropItemChance(npc, mod.ItemType("YharimsCrystal"), DropHelper.LegendaryDropRateInt); // Vanity @@ -2831,192 +2831,193 @@ namespace CalamityMod.NPCs.Yharon } } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("OmegaHealingPotion"); - } - #endregion + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("OmegaHealingPotion"); + } + #endregion - #region StrikeNPC - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (CalamityUtils.AntiButcher(npc, ref damage, 0.1f)) return false; + #region StrikeNPC + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (CalamityUtils.AntiButcher(npc, ref damage, 0.1f)) + return false; // Safeguard to prevent damage which would allow skipping phase 2. if (!startSecondAI && dropLoot) - { - damage = 0; - return false; - } + { + damage = 0; + return false; + } return true; - } - #endregion + } + #endregion - #region HPBarCooldownSlotandStats - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 2f; - return null; - } + #region HPBarCooldownSlotandStats + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - #endregion + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + #endregion - #region FindFrame - public override void FindFrame(int frameHeight) - { - if ((!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) || - (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f))) //idle - { - int num84 = 4; //5 - if (!startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) //Phase ai switch - { - num84 = 3; //4 - } - npc.frameCounter += 1.0; - if (npc.frameCounter > (double)num84) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 5) //6 - { - npc.frame.Y = 0; - } - } - if ((!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f || npc.ai[0] == 22f)) || - (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f))) //Charging or birb spawn - { - npc.frame.Y = frameHeight * 5; //6 - } - if ((!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 23f)) || - (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f))) //Fireball spit, teleport, circle, flamethrower - { - npc.frame.Y = frameHeight * 5; //6 - } - if (!startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f || npc.ai[0] == 20f || npc.ai[0] == 24f)) //Summon tornadoes - { - int num85 = 90; - if (npc.ai[2] < (float)(num85 - 30) || npc.ai[2] > (float)(num85 - 10)) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) //5 - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 5) //6 - { - npc.frame.Y = 0; - } - } - else - { - npc.frame.Y = frameHeight * 5; //6 - if (npc.ai[2] > (float)(num85 - 20) && npc.ai[2] < (float)(num85 - 15)) - { - npc.frame.Y = frameHeight * 6; //7 - } - } - } - if ((!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) || - (startSecondAI && npc.ai[0] == 9f)) //Enter new phase - { - int num86 = 180; - if (npc.ai[2] < (float)(num86 - 60) || npc.ai[2] > (float)(num86 - 20)) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) //5 - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 5) //6 - { - npc.frame.Y = 0; - } - } - else - { - npc.frame.Y = frameHeight * 5; //6 - if (npc.ai[2] > (float)(num86 - 50) && npc.ai[2] < (float)(num86 - 25)) - { - npc.frame.Y = frameHeight * 6; //7 - } - } - } - } - #endregion + #region FindFrame + public override void FindFrame(int frameHeight) + { + if ((!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) || + (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f))) //idle + { + int num84 = 4; //5 + if (!startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) //Phase ai switch + { + num84 = 3; //4 + } + npc.frameCounter += 1.0; + if (npc.frameCounter > (double)num84) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) //6 + { + npc.frame.Y = 0; + } + } + if ((!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f || npc.ai[0] == 22f)) || + (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f))) //Charging or birb spawn + { + npc.frame.Y = frameHeight * 5; //6 + } + if ((!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 23f)) || + (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f))) //Fireball spit, teleport, circle, flamethrower + { + npc.frame.Y = frameHeight * 5; //6 + } + if (!startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f || npc.ai[0] == 20f || npc.ai[0] == 24f)) //Summon tornadoes + { + int num85 = 90; + if (npc.ai[2] < (float)(num85 - 30) || npc.ai[2] > (float)(num85 - 10)) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) //5 + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) //6 + { + npc.frame.Y = 0; + } + } + else + { + npc.frame.Y = frameHeight * 5; //6 + if (npc.ai[2] > (float)(num85 - 20) && npc.ai[2] < (float)(num85 - 15)) + { + npc.frame.Y = frameHeight * 6; //7 + } + } + } + if ((!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) || + (startSecondAI && npc.ai[0] == 9f)) //Enter new phase + { + int num86 = 180; + if (npc.ai[2] < (float)(num86 - 60) || npc.ai[2] > (float)(num86 - 20)) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) //5 + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) //6 + { + npc.frame.Y = 0; + } + } + else + { + npc.frame.Y = frameHeight * 5; //6 + if (npc.ai[2] > (float)(num86 - 50) && npc.ai[2] < (float)(num86 - 25)) + { + npc.frame.Y = frameHeight * 6; //7 + } + } + } + } + #endregion - #region Boom - public void Boom(int timeLeft, int damage) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - for (iBoom = 0; iBoom < 25; iBoom++) - { - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 5f), (float)(Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 5f), (float)(-Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[boom1].timeLeft = timeLeft; - Main.projectile[boom2].timeLeft = timeLeft; - } - } - } - #endregion + #region Boom + public void Boom(int timeLeft, int damage) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + for (iBoom = 0; iBoom < 25; iBoom++) + { + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 5f), (float)(Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 5f), (float)(-Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[boom1].timeLeft = timeLeft; + Main.projectile[boom2].timeLeft = timeLeft; + } + } + } + #endregion - #region HitEffect - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - Boom(150, 1000); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 300; - npc.height = 280; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - #endregion - } + #region HitEffect + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Boom(150, 1000); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 300; + npc.height = 280; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + #endregion + } } diff --git a/Projectiles/Amidias/AmidiasTridentProj.cs b/Projectiles/Amidias/AmidiasTridentProj.cs index 6adab31e2e..fd1b07584c 100644 --- a/Projectiles/Amidias/AmidiasTridentProj.cs +++ b/Projectiles/Amidias/AmidiasTridentProj.cs @@ -5,65 +5,65 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class AmidiasTridentProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trident"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trident"); + } - public override void SetDefaults() - { - projectile.width = 70; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 70; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - } + public override void SetDefaults() + { + projectile.width = 70; + projectile.aiStyle = 19; + projectile.melee = true; + projectile.timeLeft = 90; + projectile.height = 70; + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 1f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("AmidiasWhirlpool"), projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.75f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 1f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("AmidiasWhirlpool"), projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.75f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + } } diff --git a/Projectiles/Amidias/AmidiasWhirlpool.cs b/Projectiles/Amidias/AmidiasWhirlpool.cs index 1c50aab22a..0737e762b9 100644 --- a/Projectiles/Amidias/AmidiasWhirlpool.cs +++ b/Projectiles/Amidias/AmidiasWhirlpool.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,150 +7,150 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class AmidiasWhirlpool : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Whirlpool"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Whirlpool"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 100; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 58; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.alpha = 100; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.melee = true; + } - public override void AI() - { - for (int num105 = 0; num105 < 2; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; - } - float[] var_2_2DDF8_cp_0 = projectile.ai; - int var_2_2DDF8_cp_1 = 0; - float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; - var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; - int num1013 = 0; - if (projectile.velocity.Length() <= 8f) //4 - { - num1013 = 1; - } - if (num1013 == 0) - { - projectile.rotation -= 0.104719758f; + public override void AI() + { + for (int num105 = 0; num105 < 2; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X -= num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y -= num100; + } + float[] var_2_2DDF8_cp_0 = projectile.ai; + int var_2_2DDF8_cp_1 = 0; + float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; + var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; + int num1013 = 0; + if (projectile.velocity.Length() <= 8f) //4 + { + num1013 = 1; + } + if (num1013 == 0) + { + projectile.rotation -= 0.104719758f; - if (projectile.ai[0] >= 30f) - { - projectile.velocity *= 0.98f; - projectile.rotation -= 0.0174532924f; - } - if (projectile.velocity.Length() < 8.2f) //4.1 - { - projectile.velocity.Normalize(); - projectile.velocity *= 4f; - projectile.ai[0] = 0f; - } - } - else if (num1013 == 1) - { - int num3; - projectile.rotation -= 0.104719758f; - Vector2 vector145 = projectile.Center; - float num1015 = 300f; - bool flag59 = false; - int num1016 = 0; - if (projectile.ai[1] == 0f) - { - for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) - { - if (Main.npc[num1017].CanBeChasedBy(projectile, false)) - { - Vector2 center13 = Main.npc[num1017].Center; - if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) - { - num1015 = projectile.Distance(center13); - vector145 = center13; - flag59 = true; - num1016 = num1017; - } - } - num3 = num1017; - } - if (flag59) - { - if (projectile.ai[1] != (float)(num1016 + 1)) - { - projectile.netUpdate = true; - } - projectile.ai[1] = (float)(num1016 + 1); - } - flag59 = false; - } - if (projectile.ai[1] != 0f) - { - int num1018 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) - { - flag59 = true; - vector145 = Main.npc[num1018].Center; - } - } - if (!projectile.friendly) - { - flag59 = false; - } - if (flag59) - { - float num1019 = 24f; - int num1020 = 10; - Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num1021 = vector145.X - vector146.X; - float num1022 = vector145.Y - vector146.Y; - float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); - num1023 = num1019 / num1023; - num1021 *= num1023; - num1022 *= num1023; - projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; - } - } - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.9f); - if (projectile.ai[0] >= 120f) - { - projectile.Kill(); - } - } + if (projectile.ai[0] >= 30f) + { + projectile.velocity *= 0.98f; + projectile.rotation -= 0.0174532924f; + } + if (projectile.velocity.Length() < 8.2f) //4.1 + { + projectile.velocity.Normalize(); + projectile.velocity *= 4f; + projectile.ai[0] = 0f; + } + } + else if (num1013 == 1) + { + int num3; + projectile.rotation -= 0.104719758f; + Vector2 vector145 = projectile.Center; + float num1015 = 300f; + bool flag59 = false; + int num1016 = 0; + if (projectile.ai[1] == 0f) + { + for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) + { + if (Main.npc[num1017].CanBeChasedBy(projectile, false)) + { + Vector2 center13 = Main.npc[num1017].Center; + if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) + { + num1015 = projectile.Distance(center13); + vector145 = center13; + flag59 = true; + num1016 = num1017; + } + } + num3 = num1017; + } + if (flag59) + { + if (projectile.ai[1] != (float)(num1016 + 1)) + { + projectile.netUpdate = true; + } + projectile.ai[1] = (float)(num1016 + 1); + } + flag59 = false; + } + if (projectile.ai[1] != 0f) + { + int num1018 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) + { + flag59 = true; + vector145 = Main.npc[num1018].Center; + } + } + if (!projectile.friendly) + { + flag59 = false; + } + if (flag59) + { + float num1019 = 24f; + int num1020 = 10; + Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num1021 = vector145.X - vector146.X; + float num1022 = vector145.Y - vector146.Y; + float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); + num1023 = num1019 / num1023; + num1021 *= num1023; + num1022 *= num1023; + projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; + } + } + Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.9f); + if (projectile.ai[0] >= 120f) + { + projectile.Kill(); + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(30, 255, 253); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(30, 255, 253); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); + } + } + } } diff --git a/Projectiles/Amidias/BigCoral.cs b/Projectiles/Amidias/BigCoral.cs index d0b6ea6567..9ba2ef04f1 100644 --- a/Projectiles/Amidias/BigCoral.cs +++ b/Projectiles/Amidias/BigCoral.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Amidias { public class BigCoral : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Coral"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Coral"); + } public override void SetDefaults() { @@ -23,33 +23,33 @@ namespace CalamityMod.Projectiles.Amidias public override void AI() { - projectile.velocity.X *= 0.999f; - projectile.velocity.Y = projectile.velocity.Y + 0.025f; + projectile.velocity.X *= 0.999f; + projectile.velocity.Y = projectile.velocity.Y + 0.025f; } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 32; - projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 32; + projectile.height = 32; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - } + Main.dust[num195].velocity *= 3f; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.rarity != 2 && !target.boss) - { - target.AddBuff(mod.BuffType("SilvaStun"), 15); - } + if (target.rarity != 2 && !target.boss) + { + target.AddBuff(mod.BuffType("SilvaStun"), 15); + } } } } diff --git a/Projectiles/Amidias/HermitCrab.cs b/Projectiles/Amidias/HermitCrab.cs index 113474c25b..ba9fc85004 100644 --- a/Projectiles/Amidias/HermitCrab.cs +++ b/Projectiles/Amidias/HermitCrab.cs @@ -1,351 +1,351 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Amidias { public class HermitCrab : ModProjectile - { - private int playerStill = 0; - private bool fly = false; - private bool spawnDust = true; + { + private int playerStill = 0; + private bool fly = false; + private bool spawnDust = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hermit Crab"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hermit Crab"); + Main.projFrames[projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 36; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } - public override void AI() - { - if (spawnDust) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 20; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - spawnDust = false; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("HermitCrab"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("HermitCrab"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.hCrab = false; - } - if (modPlayer.hCrab) - { - projectile.timeLeft = 2; - } - } - Vector2 vector46 = projectile.position; - if (!fly) - { - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 205f && projectile.position.X == projectile.oldPosition.X))) - { - projectile.velocity.Y = -10f; - } - projectile.velocity.Y += 0.6f; - if (projectile.velocity.X != 0f) - { - projectile.frameCounter++; - } - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num633 = 600f; - bool chaseNPC = false; - float npcPositionX = 0f; - for (int num645 = 0; num645 < 200; num645++) - { - NPC npcTarget = Main.npc[num645]; - if (npcTarget.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) - { - num633 = num646; - vector46 = npcTarget.Center; - npcPositionX = npcTarget.position.X; - chaseNPC = true; - } - } - } - if (chaseNPC) - { - if (npcPositionX - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 2)) - { + public override void AI() + { + if (spawnDust) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 20; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + spawnDust = false; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("HermitCrab"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("HermitCrab"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.hCrab = false; + } + if (modPlayer.hCrab) + { + projectile.timeLeft = 2; + } + } + Vector2 vector46 = projectile.position; + if (!fly) + { + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 205f && projectile.position.X == projectile.oldPosition.X))) + { + projectile.velocity.Y = -10f; + } + projectile.velocity.Y += 0.6f; + if (projectile.velocity.X != 0f) + { + projectile.frameCounter++; + } + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num633 = 600f; + bool chaseNPC = false; + float npcPositionX = 0f; + for (int num645 = 0; num645 < 200; num645++) + { + NPC npcTarget = Main.npc[num645]; + if (npcTarget.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) + { + num633 = num646; + vector46 = npcTarget.Center; + npcPositionX = npcTarget.position.X; + chaseNPC = true; + } + } + } + if (chaseNPC) + { + if (npcPositionX - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 2)) + { - case 1: - projectile.velocity.X += 0.10f; - break; + case 1: + projectile.velocity.X += 0.10f; + break; - case 2: - projectile.velocity.X += 0.15f; - break; - } + case 2: + projectile.velocity.X += 0.15f; + break; + } - if (projectile.velocity.X > 9f) - { - projectile.velocity.X = 9f; - } - } - else - { - switch (Main.rand.Next(1, 2)) - { + if (projectile.velocity.X > 9f) + { + projectile.velocity.X = 9f; + } + } + else + { + switch (Main.rand.Next(1, 2)) + { - case 1: - projectile.velocity.X -= 0.10f; - break; + case 1: + projectile.velocity.X -= 0.10f; + break; - case 2: - projectile.velocity.X -= 0.15f; - break; - } + case 2: + projectile.velocity.X -= 0.15f; + break; + } - if (projectile.velocity.X < -9f) - { - projectile.velocity.X = -9f; - } - } - } - else - { - if (playerDistance > 600f) - { - fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; - } - if (playerDistance > 200f) - { - if (player.position.X - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; + if (projectile.velocity.X < -9f) + { + projectile.velocity.X = -9f; + } + } + } + else + { + if (playerDistance > 600f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 200f) + { + if (player.position.X - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; - case 2: - projectile.velocity.X += 0.10f; - break; + case 2: + projectile.velocity.X += 0.10f; + break; - case 3: - projectile.velocity.X += 0.15f; - break; - } + case 3: + projectile.velocity.X += 0.15f; + break; + } - if (projectile.velocity.X > 9f) - { - projectile.velocity.X = 9f; - } - } - else - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; + if (projectile.velocity.X > 9f) + { + projectile.velocity.X = 9f; + } + } + else + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; - case 2: - projectile.velocity.X -= 0.10f; - break; + case 2: + projectile.velocity.X -= 0.10f; + break; - case 3: - projectile.velocity.X -= 0.15f; - break; - } + case 3: + projectile.velocity.X -= 0.15f; + break; + } - if (projectile.velocity.X < -9f) - { - projectile.velocity.X = -9f; - } - } - } - if (playerDistance < 200f) - { - if (projectile.velocity.X != 0f) - { - if (projectile.velocity.X > 0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; + if (projectile.velocity.X < -9f) + { + projectile.velocity.X = -9f; + } + } + } + if (playerDistance < 200f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; - case 2: - projectile.velocity.X -= 0.10f; - break; + case 2: + projectile.velocity.X -= 0.10f; + break; - case 3: - projectile.velocity.X -= 0.15f; - break; - } - } - else if (projectile.velocity.X < -0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; + case 3: + projectile.velocity.X -= 0.15f; + break; + } + } + else if (projectile.velocity.X < -0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; - case 2: - projectile.velocity.X += 0.10f; - break; + case 2: + projectile.velocity.X += 0.10f; + break; - case 3: - projectile.velocity.X += 0.15f; - break; - } - } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) - { - projectile.velocity.X = 0f; - } - } - } - } - } - else if (fly) - { - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); - float playerDistance = vector48.Length(); - vector48.Normalize(); - vector48 *= 8f; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + case 3: + projectile.velocity.X += 0.15f; + break; + } + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + } + } + else if (fly) + { + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); + float playerDistance = vector48.Length(); + vector48.Normalize(); + vector48 *= 8f; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 4; - } - if (playerDistance > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (playerDistance < 100f) - { - if (player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; - } - } - } - if ((double)projectile.velocity.X > 0.25) - { - projectile.spriteDirection = 1; - } - else if ((double)projectile.velocity.X < -0.25) - { - projectile.spriteDirection = -1; - } - } + projectile.rotation = projectile.velocity.X * 0.03f; + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 4; + } + if (playerDistance > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + projectile.rotation = 0; + } + } + } + if ((double)projectile.velocity.X > 0.25) + { + projectile.spriteDirection = 1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.spriteDirection = -1; + } + } - private bool HoleBelow() - { - int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) - { - tileX += tileWidth; - } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); - for (int y = tileY; y < tileY + 2; y++) - { - for (int x = tileX; x < tileX + tileWidth; x++) - { - if (Main.tile[x, y].active()) - { - return false; - } - } - } - return true; - } + private bool HoleBelow() + { + int tileWidth = 4; + int tileX = (int)(projectile.Center.X / 16f) - tileWidth; + if (projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].active()) + { + return false; + } + } + } + return true; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } } diff --git a/Projectiles/Amidias/SandDollarProj.cs b/Projectiles/Amidias/SandDollarProj.cs index 224adeef34..e7a3231e1d 100644 --- a/Projectiles/Amidias/SandDollarProj.cs +++ b/Projectiles/Amidias/SandDollarProj.cs @@ -4,37 +4,37 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class SandDollarProj : ModProjectile - { + { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Dollar"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Dollar"); + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 28; - projectile.Calamity().rogue = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 272; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 28; + projectile.Calamity().rogue = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 272; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + } } diff --git a/Projectiles/Amidias/Shell.cs b/Projectiles/Amidias/Shell.cs index 048a4db5e3..830c6a71f8 100644 --- a/Projectiles/Amidias/Shell.cs +++ b/Projectiles/Amidias/Shell.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class Shell : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shell"); + } - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 18; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.aiStyle = 1; - } + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 18; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 5; + projectile.aiStyle = 1; + } - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y *= 0.9995f; - } + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y *= 0.9995f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 34; - projectile.height = 18; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 34; + projectile.height = 18; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + } + } + } } diff --git a/Projectiles/Amidias/SmallCoral.cs b/Projectiles/Amidias/SmallCoral.cs index ebdf4fbc36..78474d6ad0 100644 --- a/Projectiles/Amidias/SmallCoral.cs +++ b/Projectiles/Amidias/SmallCoral.cs @@ -5,43 +5,43 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class SmallCoral : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Small Coral"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Small Coral"); + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 22; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 22; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + } - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y = projectile.velocity.Y + 0.01f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 16; - projectile.height = 16; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 16; + projectile.height = 16; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Amidias/SnapClamProj.cs b/Projectiles/Amidias/SnapClamProj.cs index 48abfc5f6f..56f1629ff4 100644 --- a/Projectiles/Amidias/SnapClamProj.cs +++ b/Projectiles/Amidias/SnapClamProj.cs @@ -5,208 +5,208 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class SnapClamProj : ModProjectile - { - public int clamCounter = 0; - public bool openClam = true; - public bool onEnemy = false; + { + public int clamCounter = 0; + public bool openClam = true; + public bool onEnemy = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snap Clam"); - Main.projFrames[projectile.type] = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snap Clam"); + Main.projFrames[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 13; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 13; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + } - public override void AI() - { - if (openClam && !onEnemy) - { - ++clamCounter; - if (clamCounter >= 30) - { - openClam = false; - projectile.damage = (int)(projectile.damage * 0.8); - } - } - if (projectile.ai[0] == 0f) - { - float[] var0 = projectile.ai; - int var1 = 1; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - projectile.ai[1] = 45f; - projectile.velocity.X = projectile.velocity.X * 0.99f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.rotation += 0.4f * (float)projectile.direction; - projectile.spriteDirection = projectile.direction; - } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 6; - bool flag54 = false; - bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - if (openClam && !onEnemy) - { - projectile.frame = 1; - } - else - { - projectile.frame = 0; - } - } + public override void AI() + { + if (openClam && !onEnemy) + { + ++clamCounter; + if (clamCounter >= 30) + { + openClam = false; + projectile.damage = (int)(projectile.damage * 0.8); + } + } + if (projectile.ai[0] == 0f) + { + float[] var0 = projectile.ai; + int var1 = 1; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + projectile.ai[1] = 45f; + projectile.velocity.X = projectile.velocity.X * 0.99f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + projectile.rotation += 0.4f * (float)projectile.direction; + projectile.spriteDirection = projectile.direction; + } + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + int num988 = 6; + bool flag54 = false; + bool flag55 = false; + float[] var0 = projectile.localAI; + int var1 = 0; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60 * num988)) + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) + { + projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[num989].gfxOffY; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.Kill(); + } + } + if (openClam && !onEnemy) + { + projectile.frame = 1; + } + else + { + projectile.frame = 0; + } + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (openClam) - { - onEnemy = true; - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (openClam) + { + onEnemy = true; + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || + (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 6; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 13; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 13; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("SnapClamDebuff"), 240); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("SnapClamDebuff"), 240); + } + } } diff --git a/Projectiles/Amidias/UrchinBall.cs b/Projectiles/Amidias/UrchinBall.cs index 630372ae26..22ebaf2e51 100644 --- a/Projectiles/Amidias/UrchinBall.cs +++ b/Projectiles/Amidias/UrchinBall.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,151 +8,151 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class UrchinBall : ModProjectile - { - public bool spike = false; + { + public bool spike = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("UrchinBall"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("UrchinBall"); + } - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.alpha = 255; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; - if (vector62.X < 0f) - { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; - } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); - if (projectile.ai[0] == 0f && vector62.Length() > 400f) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) - { - if (spike) - { - spike = false; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("UrchinBallSpike"), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); - } - projectile.usesLocalNPCImmunity = false; - float num693 = vector62.Length(); - if (num693 > 1500f) - { - projectile.Kill(); - return; - } - if (num693 > 600f) - { - projectile.ai[0] = 2f; - } - projectile.tileCollide = false; - float num694 = 20f; - if (projectile.ai[0] == 2f) - { - num694 = 40f; - } - projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) - { - projectile.Kill(); - return; - } - } - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - } + public override void AI() + { + Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; + projectile.rotation = vector62.ToRotation() - 1.57f; + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + Main.player[projectile.owner].itemAnimation = 10; + Main.player[projectile.owner].itemTime = 10; + float arg_1DC8F_0 = vector62.X; + if (vector62.X < 0f) + { + Main.player[projectile.owner].ChangeDir(1); + projectile.direction = 1; + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + projectile.direction = -1; + } + Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); + projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); + if (projectile.ai[0] == 0f && vector62.Length() > 400f) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + { + if (spike) + { + spike = false; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("UrchinBallSpike"), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + } + projectile.usesLocalNPCImmunity = false; + float num693 = vector62.Length(); + if (num693 > 1500f) + { + projectile.Kill(); + return; + } + if (num693 > 600f) + { + projectile.ai[0] = 2f; + } + projectile.tileCollide = false; + float num694 = 20f; + if (projectile.ai[0] == 2f) + { + num694 = 40f; + } + projectile.velocity = Vector2.Normalize(vector62) * num694; + if (vector62.Length() < num694) + { + projectile.Kill(); + return; + } + } + float[] var_2_1DE21_cp_0 = projectile.ai; + int var_2_1DE21_cp_1 = 1; + float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; + var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/UrchinFlailChain"); - Vector2 vector17 = projectile.Center; - Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) - { - flag13 = false; - } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) - { - flag13 = false; - } - while (flag13) - { - if (vector18.Length() < num91 + 1f) - { - flag13 = false; - } - else - { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); - } - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/UrchinFlailChain"); + Vector2 vector17 = projectile.Center; + Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); + float num91 = (float)texture2D2.Height; + Vector2 vector18 = mountedCenter - vector17; + float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; + bool flag13 = true; + if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + { + flag13 = false; + } + if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + { + flag13 = false; + } + while (flag13) + { + if (vector18.Length() < num91 + 1f) + { + flag13 = false; + } + else + { + Vector2 value2 = vector18; + value2.Normalize(); + vector17 += value2 * num91; + vector18 = mountedCenter - vector17; + Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); + } + } + return true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - spike = true; - projectile.ai[0] = 1f; - projectile.netUpdate = true; - target.AddBuff(BuffID.Venom, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + spike = true; + projectile.ai[0] = 1f; + projectile.netUpdate = true; + target.AddBuff(BuffID.Venom, 300); + } + } } diff --git a/Projectiles/Amidias/UrchinBallSpike.cs b/Projectiles/Amidias/UrchinBallSpike.cs index b92e24c0e9..bd77f163e4 100644 --- a/Projectiles/Amidias/UrchinBallSpike.cs +++ b/Projectiles/Amidias/UrchinBallSpike.cs @@ -6,183 +6,183 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class UrchinBallSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = -1; - aiType = 598; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 18; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = -1; + aiType = 598; + } - public override void AI() - { - if (projectile.ai[0] == 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.rotation += 0.4f * (float)projectile.direction; - projectile.spriteDirection = projectile.direction; - } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 6; - bool flag54 = false; - bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - } + public override void AI() + { + if (projectile.ai[0] == 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + projectile.rotation += 0.4f * (float)projectile.direction; + projectile.spriteDirection = projectile.direction; + } + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + int num988 = 6; + bool flag54 = false; + bool flag55 = false; + float[] var0 = projectile.localAI; + int var1 = 0; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60 * num988)) + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) + { + projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[num989].gfxOffY; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.Kill(); + } + } + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || + (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 6; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 13; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 13; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.KingSlime || target.type == NPCID.WallofFlesh || target.type == NPCID.WallofFleshEye || - target.type == NPCID.SkeletronHead || target.type == NPCID.SkeletronHand) - { - target.buffImmune[BuffID.Venom] = false; - } - target.AddBuff(BuffID.Venom, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.KingSlime || target.type == NPCID.WallofFlesh || target.type == NPCID.WallofFleshEye || + target.type == NPCID.SkeletronHead || target.type == NPCID.SkeletronHand) + { + target.buffImmune[BuffID.Venom] = false; + } + target.AddBuff(BuffID.Venom, 300); + } + } } diff --git a/Projectiles/Amidias/WaywasherProj.cs b/Projectiles/Amidias/WaywasherProj.cs index 38cc9e902c..8c02fd3c49 100644 --- a/Projectiles/Amidias/WaywasherProj.cs +++ b/Projectiles/Amidias/WaywasherProj.cs @@ -5,69 +5,69 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Amidias { public class WaywasherProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Waywasher Blast"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Waywasher Blast"); + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.timeLeft = 300; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 2; + projectile.timeLeft = 300; + projectile.magic = true; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); - for (int num105 = 0; num105 < 2; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; - } - if (Main.rand.NextBool(5)) - { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); + for (int num105 = 0; num105 < 2; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X -= num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y -= num100; + } + if (Main.rand.NextBool(5)) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); + } + } + } } diff --git a/Projectiles/Astral/AstralCannonProjectile.cs b/Projectiles/Astral/AstralCannonProjectile.cs index 89881983fb..e7837c1588 100644 --- a/Projectiles/Astral/AstralCannonProjectile.cs +++ b/Projectiles/Astral/AstralCannonProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,99 +8,99 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class AstralCannonProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Crystal"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Crystal"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 5; - } - else - { - projectile.alpha = 0; - projectile.tileCollide = true; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - projectile.velocity *= 1.075f; - } + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 5; + } + else + { + projectile.alpha = 0; + projectile.tileCollide = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + projectile.velocity *= 1.075f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 192); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103, 1f, 0f); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 50, default, 1f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 192); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103, 1f, 0f); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 50, default, 1f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 0, default, 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 50, default, 1f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Astral/AstralScytheProjectile.cs b/Projectiles/Astral/AstralScytheProjectile.cs index cc70cf5232..a0447661e5 100644 --- a/Projectiles/Astral/AstralScytheProjectile.cs +++ b/Projectiles/Astral/AstralScytheProjectile.cs @@ -7,70 +7,70 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class AstralScytheProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Ring"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Ring"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 72; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 300; - projectile.penetrate = 8; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 72; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.timeLeft = 300; + projectile.penetrate = 8; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void AI() - { - projectile.velocity *= 1.03f; + public override void AI() + { + projectile.velocity *= 1.03f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame > 2) - { - projectile.frame = 0; - } - } - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame > 2) + { + projectile.frame = 0; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item1, projectile.Center); + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item1, projectile.Center); - for (int i = 0; i < 60; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - Vector2 angleVec = angle.ToRotationVector2(); - float distance = Main.rand.NextFloat(14f, 36f); - Vector2 off = angleVec * distance; - off.Y *= ((float)projectile.height / projectile.width); - Vector2 pos = projectile.Center + off; - Dust d = Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), angleVec * Main.rand.NextFloat(2f, 4f)); - d.customData = true; - } - } + for (int i = 0; i < 60; i++) + { + float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + Vector2 angleVec = angle.ToRotationVector2(); + float distance = Main.rand.NextFloat(14f, 36f); + Vector2 off = angleVec * distance; + off.Y *= ((float)projectile.height / projectile.width); + Vector2 pos = projectile.Center + off; + Dust d = Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), angleVec * Main.rand.NextFloat(2f, 4f)); + d.customData = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Astral/AstralachneaFang.cs b/Projectiles/Astral/AstralachneaFang.cs index a300962205..ea91d87488 100644 --- a/Projectiles/Astral/AstralachneaFang.cs +++ b/Projectiles/Astral/AstralachneaFang.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,95 +8,95 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class AstralachneaFang : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fang"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fang"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.tileCollide = true; - projectile.timeLeft = 240; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.magic = true; + projectile.tileCollide = true; + projectile.timeLeft = 240; + } - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - if (projectile.velocity.X < 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - else - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 250f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 13f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 25f + num484) / 26f; - projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; - } - } + public override void AI() + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + if (projectile.velocity.X < 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + else + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 250f; + bool homeIn = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 13f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 25f + num484) / 26f; + projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f); - } - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f); + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Astral/HeavenfallenEnergy.cs b/Projectiles/Astral/HeavenfallenEnergy.cs index 10c887b0dd..96e5ec3f43 100644 --- a/Projectiles/Astral/HeavenfallenEnergy.cs +++ b/Projectiles/Astral/HeavenfallenEnergy.cs @@ -5,47 +5,47 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class HeavenfallenEnergy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavenfallen Energy"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heavenfallen Energy"); + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void AI() - { - int num154 = 14; - int coolDust; - projectile.ai[0] += 1; - if (projectile.ai[0] % 2 == 0) - { - if (projectile.ai[0] % 4 == 0) - { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1.5f); - } - else - { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); - } - Main.dust[coolDust].noGravity = true; - Main.dust[coolDust].velocity *= 0.1f; - Main.dust[coolDust].velocity += projectile.velocity * 0.5f; - } - } + public override void AI() + { + int num154 = 14; + int coolDust; + projectile.ai[0] += 1; + if (projectile.ai[0] % 2 == 0) + { + if (projectile.ai[0] % 4 == 0) + { + coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1.5f); + } + else + { + coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); + } + Main.dust[coolDust].noGravity = true; + Main.dust[coolDust].velocity *= 0.1f; + Main.dust[coolDust].velocity += projectile.velocity * 0.5f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); + } + } } diff --git a/Projectiles/Astral/HeavenfallenStardisk.cs b/Projectiles/Astral/HeavenfallenStardisk.cs index d77b2c8a87..435ab27111 100644 --- a/Projectiles/Astral/HeavenfallenStardisk.cs +++ b/Projectiles/Astral/HeavenfallenStardisk.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,178 +8,178 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class HeavenfallenStardisk : ModProjectile - { - private bool explode = false; + { + private bool explode = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavenfallen Stardisk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heavenfallen Stardisk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 20; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 20; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } - for (int i = 0; i < 2; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int i = 0; i < 2; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + for (int i = 0; i < 2; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int i = 0; i < 2; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } - projectile.rotation += 0.5f; + projectile.rotation += 0.5f; - if (Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y && projectile.ai[0] == 0f) - { - explode = true; - } + if (Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y && projectile.ai[0] == 0f) + { + explode = true; + } - projectile.ai[0] += 1f; + projectile.ai[0] += 1f; - if (Main.myPlayer == projectile.owner && projectile.ai[0] == 20f) - { - if (Main.player[projectile.owner].channel) - { - float num115 = 20f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > num115) - { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - else - { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - } - else if (projectile.ai[0] == 20f) - { - projectile.netUpdate = true; - float num127 = 20f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) - { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; - } - } - } + if (Main.myPlayer == projectile.owner && projectile.ai[0] == 20f) + { + if (Main.player[projectile.owner].channel) + { + float num115 = 20f; + Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; + float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + } + float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + if (num118 > num115) + { + num118 = num115 / num118; + num116 *= num118; + num117 *= num118; + int num119 = (int)(num116 * 1000f); + int num120 = (int)(projectile.velocity.X * 1000f); + int num121 = (int)(num117 * 1000f); + int num122 = (int)(projectile.velocity.Y * 1000f); + if (num119 != num120 || num121 != num122) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + else + { + int num123 = (int)(num116 * 1000f); + int num124 = (int)(projectile.velocity.X * 1000f); + int num125 = (int)(num117 * 1000f); + int num126 = (int)(projectile.velocity.Y * 1000f); + if (num123 != num124 || num125 != num126) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + } + else if (projectile.ai[0] == 20f) + { + projectile.netUpdate = true; + float num127 = 20f; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f || projectile.ai[0] < 0f) + { + vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } + num130 = num127 / num130; + num128 *= num130; + num129 *= num130; + projectile.velocity.X = num128; + projectile.velocity.Y = num129; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int i = 0; i < 10; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int i = 0; i < 10; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int i = 0; i < 10; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int i = 0; i < 10; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } - if (explode && Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } + if (explode && Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y) + { + if (projectile.owner == Main.myPlayer) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Astral/Hive.cs b/Projectiles/Astral/Hive.cs index 6661295f91..85799dd259 100644 --- a/Projectiles/Astral/Hive.cs +++ b/Projectiles/Astral/Hive.cs @@ -5,124 +5,124 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class Hive : ModProjectile - { + { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive"); - Main.projFrames[projectile.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 60; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; - } + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 60; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - projectile.velocity.Y += 0.5f; + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } - int target = 0; - float num633 = 800f; - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (Main.player[projectile.owner].HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - target = npc.whoAmI; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - target = num645; - } - } - } - } - if (projectile.owner == Main.myPlayer && flag25) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - projectile.ai[1] += 1f; - if ((projectile.ai[1] % 15f) == 0f) - { - float velocityX = Main.rand.NextFloat(-0.4f, 0.4f); - float velocityY = Main.rand.NextFloat(-0.3f, -0.5f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocityX, velocityY, mod.ProjectileType("Hiveling"), projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); - } - } - } + int target = 0; + float num633 = 800f; + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (Main.player[projectile.owner].HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + target = npc.whoAmI; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + target = num645; + } + } + } + } + if (projectile.owner == Main.myPlayer && flag25) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + projectile.ai[1] += 1f; + if ((projectile.ai[1] % 15f) == 0f) + { + float velocityX = Main.rand.NextFloat(-0.4f, 0.4f); + float velocityY = Main.rand.NextFloat(-0.3f, -0.5f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocityX, velocityY, mod.ProjectileType("Hiveling"), projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); + } + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Astral/Hiveling.cs b/Projectiles/Astral/Hiveling.cs index 7bbf294acf..6e371623c7 100644 --- a/Projectiles/Astral/Hiveling.cs +++ b/Projectiles/Astral/Hiveling.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +9,13 @@ namespace CalamityMod.Projectiles.Astral { public class Hiveling : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hiveling"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hiveling"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -23,14 +23,14 @@ namespace CalamityMod.Projectiles.Astral projectile.height = 24; projectile.friendly = true; projectile.minion = true; - projectile.tileCollide = false; + projectile.tileCollide = false; projectile.penetrate = 1; projectile.timeLeft = 300; } public override void AI() { - projectile.frameCounter++; + projectile.frameCounter++; if (projectile.frameCounter > 3) { projectile.frame++; @@ -40,63 +40,63 @@ namespace CalamityMod.Projectiles.Astral { projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - projectile.spriteDirection = -projectile.direction; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.spriteDirection = -projectile.direction; projectile.rotation = projectile.velocity.X * 0.05f; - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1200f; - bool homeIn = false; - int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - if (homeIn) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; - projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; - } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 1200f; + bool homeIn = false; + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + if (homeIn) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; + projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 60); - } - - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - for (int k = 0; k < 3; k++) + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 60); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } - for (int k = 0; k < 3; k++) + for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Astral/Quasar.cs b/Projectiles/Astral/Quasar.cs index f4f0e70e01..90135de615 100644 --- a/Projectiles/Astral/Quasar.cs +++ b/Projectiles/Astral/Quasar.cs @@ -1,113 +1,113 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Astral { public class Quasar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Quasar"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Quasar"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - if (Main.npc[num475].position.X < num472) - { - Main.npc[num475].velocity.X += 0.25f; - } - else - { - Main.npc[num475].velocity.X -= 0.25f; - } - if (Main.npc[num475].position.Y < num473) - { - Main.npc[num475].velocity.Y += 0.25f; - } - else - { - Main.npc[num475].velocity.Y -= 0.25f; - } - } - } - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 25f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - speed.Normalize(); - speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2.5f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Quasar2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("RadiantExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.active = false; - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.25f; + } + else + { + Main.npc[num475].velocity.X -= 0.25f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.25f; + } + else + { + Main.npc[num475].velocity.Y -= 0.25f; + } + } + } + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 25f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(50); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (speed.X == 0f && speed.Y == 0f) + { + speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + speed.Normalize(); + speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2.5f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Quasar2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("RadiantExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.active = false; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Astral/Quasar2.cs b/Projectiles/Astral/Quasar2.cs index 5ed0e94a6b..223513dd65 100644 --- a/Projectiles/Astral/Quasar2.cs +++ b/Projectiles/Astral/Quasar2.cs @@ -1,91 +1,91 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Astral { public class Quasar2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Quasar"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Quasar"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; - float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) - { - npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); - if (num478 < num474) - { - if (Main.npc[num475].position.X < num472) - { - Main.npc[num475].velocity.X += 0.25f; - } - else - { - Main.npc[num475].velocity.X -= 0.25f; - } - if (Main.npc[num475].position.Y < num473) - { - Main.npc[num475].velocity.Y += 0.25f; - } - else - { - Main.npc[num475].velocity.Y -= 0.25f; - } - } - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float npcCenterX = 0f; + float npcCenterY = 0f; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + if (num478 < num474) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.25f; + } + else + { + Main.npc[num475].velocity.X -= 0.25f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.25f; + } + else + { + Main.npc[num475].velocity.Y -= 0.25f; + } + } + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Astral/RadiantExplosion.cs b/Projectiles/Astral/RadiantExplosion.cs index 418d36181b..bd1a90e194 100644 --- a/Projectiles/Astral/RadiantExplosion.cs +++ b/Projectiles/Astral/RadiantExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Astral { public class RadiantExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -22,61 +22,61 @@ namespace CalamityMod.Projectiles.Astral projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 10; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int i = 0; i < 5; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int i = 0; i < 5; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int i = 0; i < 5; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int i = 0; i < 5; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - for (int n = 0; n < 3; n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 25; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("AstralStar"); - } - else if (projectileType == 1) - { - projectileType = ProjectileID.HallowStar; - } - else - { - projectileType = ProjectileID.FallingStar; - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, (int)((double)projectile.damage * 0.75), 5f, projectile.owner, 2f, 0f); - Main.projectile[num17].ranged = false; - } + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + for (int n = 0; n < 3; n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 25; + int projectileType = Main.rand.Next(3); + if (projectileType == 0) + { + projectileType = mod.ProjectileType("AstralStar"); + } + else if (projectileType == 1) + { + projectileType = ProjectileID.HallowStar; + } + else + { + projectileType = ProjectileID.FallingStar; + } + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, (int)((double)projectile.damage * 0.75), 5f, projectile.owner, 2f, 0f); + Main.projectile[num17].ranged = false; + } } } } diff --git a/Projectiles/Astral/RadiantStar.cs b/Projectiles/Astral/RadiantStar.cs index 1b425783ff..7cd21dce84 100644 --- a/Projectiles/Astral/RadiantStar.cs +++ b/Projectiles/Astral/RadiantStar.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,109 +8,109 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class RadiantStar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Radiant Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Radiant Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - if (projectile.ai[0] == 1f) - { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !Main.npc[num475].boss) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - if (Main.npc[num475].position.X < num472) - { - Main.npc[num475].velocity.X += 0.25f; - } - else - { - Main.npc[num475].velocity.X -= 0.25f; - } - if (Main.npc[num475].position.Y < num473) - { - Main.npc[num475].velocity.Y += 0.25f; - } - else - { - Main.npc[num475].velocity.Y -= 0.25f; - } - } - } - } - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 25f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - speed.Normalize(); - speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2.5f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("RadiantStar2"), projectile.damage, projectile.knockBack, projectile.owner, - (projectile.ai[0] == 1f ? 1f : 0f), 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("RadiantExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.active = false; - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + if (projectile.ai[0] == 1f) + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !Main.npc[num475].boss) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.25f; + } + else + { + Main.npc[num475].velocity.X -= 0.25f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.25f; + } + else + { + Main.npc[num475].velocity.Y -= 0.25f; + } + } + } + } + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 25f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(50); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (speed.X == 0f && speed.Y == 0f) + { + speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + speed.Normalize(); + speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2.5f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("RadiantStar2"), projectile.damage, projectile.knockBack, projectile.owner, + (projectile.ai[0] == 1f ? 1f : 0f), 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("RadiantExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.active = false; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Astral/RadiantStar2.cs b/Projectiles/Astral/RadiantStar2.cs index 417c9ce635..06730d80ca 100644 --- a/Projectiles/Astral/RadiantStar2.cs +++ b/Projectiles/Astral/RadiantStar2.cs @@ -1,130 +1,130 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Astral { public class RadiantStar2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Radiant Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Radiant Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - if (projectile.ai[0] == 1f) - { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; - float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) - { - npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); - if (num478 < num474) - { - if (Main.npc[num475].position.X < num472) - { - Main.npc[num475].velocity.X += 0.25f; - } - else - { - Main.npc[num475].velocity.X -= 0.25f; - } - if (Main.npc[num475].position.Y < num473) - { - Main.npc[num475].velocity.Y += 0.25f; - } - else - { - Main.npc[num475].velocity.Y -= 0.25f; - } - } - } - } - } - else - { - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + if (projectile.ai[0] == 1f) + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float npcCenterX = 0f; + float npcCenterY = 0f; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + if (num478 < num474) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.25f; + } + else + { + Main.npc[num475].velocity.X -= 0.25f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.25f; + } + else + { + Main.npc[num475].velocity.Y -= 0.25f; + } + } + } + } + } + else + { + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 600f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Astral/StellarKnife.cs b/Projectiles/Astral/StellarKnife.cs index bae92f4553..65b0d0be61 100644 --- a/Projectiles/Astral/StellarKnife.cs +++ b/Projectiles/Astral/StellarKnife.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,98 +8,98 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { public class StellarKnife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stellar Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 34; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.ai[1] += 0.75f; - if (projectile.ai[1] <= 60f) - { - projectile.rotation += 1f; - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - } - else - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } - else - { - projectile.velocity.X *= 0.92f; - projectile.velocity.Y *= 0.92f; - } - } - } + public override void AI() + { + projectile.ai[1] += 0.75f; + if (projectile.ai[1] <= 60f) + { + projectile.rotation += 1f; + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + } + else + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 600f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; + projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; + } + else + { + projectile.velocity.X *= 0.92f; + projectile.velocity.Y *= 0.92f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Boss/AbyssBallVolley.cs b/Projectiles/Boss/AbyssBallVolley.cs index d8f4cb1419..f7d74023b4 100644 --- a/Projectiles/Boss/AbyssBallVolley.cs +++ b/Projectiles/Boss/AbyssBallVolley.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Boss { public class AbyssBallVolley : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Ball Volley"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Ball Volley"); + } public override void SetDefaults() { @@ -24,14 +24,14 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); } } @@ -39,13 +39,13 @@ namespace CalamityMod.Projectiles.Boss { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); } } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Weak, 120); + target.AddBuff(BuffID.Weak, 120); } } } diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs index e2a6e6283a..a38a67caac 100644 --- a/Projectiles/Boss/AbyssBallVolley2.cs +++ b/Projectiles/Boss/AbyssBallVolley2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Boss { public class AbyssBallVolley2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Ball Volley"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Ball Volley"); + } public override void SetDefaults() { @@ -24,11 +24,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } if (Main.rand.NextBool(2)) { int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); @@ -40,14 +40,14 @@ namespace CalamityMod.Projectiles.Boss { for (int k = 0; k < 5; k++) { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); Main.dust[dust].noGravity = true; } } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Cursed, 90); + target.AddBuff(BuffID.Cursed, 90); } } } diff --git a/Projectiles/Boss/AbyssMine.cs b/Projectiles/Boss/AbyssMine.cs index 0623bbd1d9..95202802bb 100644 --- a/Projectiles/Boss/AbyssMine.cs +++ b/Projectiles/Boss/AbyssMine.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class AbyssMine : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Mine"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Mine"); + } public override void SetDefaults() { @@ -26,49 +26,49 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } if (Main.rand.NextBool(6)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + projectile.Damage(); + } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Weak, 120); + target.AddBuff(BuffID.Weak, 120); } } } diff --git a/Projectiles/Boss/AbyssMine2.cs b/Projectiles/Boss/AbyssMine2.cs index 0d6391a30a..a1ffc04791 100644 --- a/Projectiles/Boss/AbyssMine2.cs +++ b/Projectiles/Boss/AbyssMine2.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class AbyssMine2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Mine"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Mine"); + } public override void SetDefaults() { @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } if (Main.rand.NextBool(6)) { int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); @@ -42,37 +42,37 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (projectile.height = 96); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = (projectile.height = 96); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + projectile.Damage(); + } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Cursed, 90); + target.AddBuff(BuffID.Cursed, 90); } } } diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 8347da1e52..c548b9eb91 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,121 +8,121 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class AstralFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Homing Flame"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Homing Flame"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 100; - projectile.penetrate = 1; - projectile.timeLeft = 485; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 100; + projectile.penetrate = 1; + projectile.timeLeft = 485; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - if (vector11.Length() < 60f) - { - projectile.Kill(); - return; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 15f) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 0.8f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - if (projectile.ai[0] >= 120f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] < 120f) - { - float scaleFactor2 = projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + if (vector11.Length() < 60f) + { + projectile.Kill(); + return; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 0.8f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + if (projectile.ai[0] >= 120f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] < 120f) + { + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 50, default, 1f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 50, default, 1f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 0, default, 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index cc22bd5402..9147aa8473 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,89 +8,89 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class AstralLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Laser Volley"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Laser Volley"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 240; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 240; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0f); - projectile.ai[0] += 1f; - if (projectile.ai[0] > 9f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 5; - } - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0f); + projectile.ai[0] += 1f; + if (projectile.ai[0] > 9f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 5; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override bool CanDamage() - { - if (projectile.timeLeft < 85) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft < 85) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } + } } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 884e413219..905629ae7e 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +9,13 @@ namespace CalamityMod.Projectiles.Boss { public class AstralShot2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Laser"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Laser"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -30,46 +30,46 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 180); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index 156ec42b49..077306feeb 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -1,23 +1,23 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class BigFlare : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Flare"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Flare"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -29,151 +29,151 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 600; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() + public override void SendExtraAI(BinaryWriter writer) { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) - { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - } + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, projectile.alpha); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - int spawnAreaY = Main.maxTilesY - num231; - for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) - { - Tile tile = Main.tile[num232, num234 + 10]; - if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int damage = Main.expertMode ? 130 : 150; - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), damage, 4f, Main.myPlayer, 11f, 20f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + int spawnAreaY = Main.maxTilesY - num231; + for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) + { + Tile tile = Main.tile[num232, num234 + 10]; + if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int damage = Main.expertMode ? 130 : 150; + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), damage, 4f, Main.myPlayer, 11f, 20f + (revenge ? 2f : 0f)); + Main.projectile[num236].netUpdate = true; + } } } } diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 0e9c693f4c..af9b57ca07 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,13 +10,13 @@ namespace CalamityMod.Projectiles.Boss { public class BigFlare2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Flare"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Flare"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -28,150 +28,150 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 600; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() + public override void SendExtraAI(BinaryWriter writer) { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) - { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - } + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, projectile.alpha); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - int spawnAreaY = Main.maxTilesY - num231; - for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) - { - Tile tile = Main.tile[num232, num234 + 10]; - if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int damage = Main.expertMode ? 130 : 150; - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado2"), damage, 4f, Main.myPlayer, 11f, 30f); - Main.projectile[num236].netUpdate = true; - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + int spawnAreaY = Main.maxTilesY - num231; + for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) + { + Tile tile = Main.tile[num232, num234 + 10]; + if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int damage = Main.expertMode ? 130 : 150; + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado2"), damage, 4f, Main.myPlayer, 11f, 30f); + Main.projectile[num236].netUpdate = true; + } } } } diff --git a/Projectiles/Boss/BloodClot.cs b/Projectiles/Boss/BloodClot.cs index 7285d4b115..10cff3a172 100644 --- a/Projectiles/Boss/BloodClot.cs +++ b/Projectiles/Boss/BloodClot.cs @@ -5,35 +5,35 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BloodClot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Clot"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = 1; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + aiType = 1; + } - public override void AI() - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.25f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + public override void AI() + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.25f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BurningBlood"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BurningBlood"), 120); + } + } } diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 0903145768..721af26403 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -1,17 +1,16 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class BloodGeyser : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Geyser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Geyser"); + } public override void SetDefaults() { @@ -27,8 +26,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.timeLeft < 180) - projectile.tileCollide = true; + if (projectile.timeLeft < 180) + projectile.tileCollide = true; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; @@ -39,7 +38,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(mod.BuffType("BurningBlood"), 120); + target.AddBuff(mod.BuffType("BurningBlood"), 120); } } } diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 8ff03d8f14..97b5e83ed1 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Boss { public class BrimstoneBall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fireball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fireball"); + } public override void SetDefaults() { @@ -22,16 +22,16 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 300; } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); } } } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 78886bd0b9..b124280237 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,64 +8,64 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneBarrage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Dart"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Dart"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) - { - projectile.velocity *= 1.01f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - } + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) + { + projectile.velocity *= 1.01f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - if (projectile.ai[0] == 0f) - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } + if (projectile.ai[0] == 0f) + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index f457659681..b5859c2b62 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -5,83 +5,83 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fire"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fire"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 235; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 1.5f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 1.5f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 235; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 1.5f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 1.5f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } } diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index 2116e08f26..709d5f528b 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -1,123 +1,123 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneFireblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Gigablast"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Gigablast"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 120; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 120; + cooldownSlot = 1; + } - public override void AI() - { - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = true; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - projectile.alpha -= 1; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 220f && projectile.ai[1] > 20f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } + public override void AI() + { + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + projectile.alpha -= 1; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 220f && projectile.ai[1] > 20f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - float spread = 12f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 30f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 30; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } - } - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + float spread = 12f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 30f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 30; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } + } + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 20e897c274..49d7442a70 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -1,125 +1,125 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class BrimstoneGigaBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fireblast"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fireblast"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 36; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 150; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 36; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 50; + projectile.timeLeft = 150; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - bool revenge = CalamityWorld.revenge; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - float num953 = revenge ? 100f : 80f; //100 - float scaleFactor12 = revenge ? 20f : 15f; //5 - float num954 = 40f; - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + bool revenge = CalamityWorld.revenge; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + float num953 = revenge ? 100f : 80f; //100 + float scaleFactor12 = revenge ? 20f : 15f; //5 + float num954 = 40f; + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } - } - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); - for (int num194 = 0; num194 < 10; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } + } + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); + for (int num194 = 0; num194 < 10; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 50, default, 1f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 8d7c7bf48c..638750d2a1 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,87 +8,87 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneHellblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellblast"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellblast"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 255; - projectile.alpha = 0; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 255; + projectile.alpha = 0; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.alpha += 1; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.velocity.X *= 1.03f; + projectile.velocity.Y *= 1.03f; + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - if (projectile.ai[0] == 0f) - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } + if (projectile.ai[0] == 0f) + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int dust = 0; dust <= 5; dust++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); + } + } + } } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index 1383e3588d..571459660c 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -1,78 +1,78 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneHellblast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellblast"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellblast"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.penetrate = -1; - projectile.timeLeft = 1500; - projectile.alpha = 0; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.penetrate = -1; + projectile.timeLeft = 1500; + projectile.alpha = 0; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.alpha += 1; + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } + } } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index fa227fcc5c..875da1ff80 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -5,52 +5,52 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneHellfireball : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellfireball"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellfireball"); + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } - public override void AI() - { - projectile.velocity.Y *= 1.01f; - projectile.velocity.X *= 1.01f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.ai[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.ai[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } + public override void AI() + { + projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.ai[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.ai[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } } diff --git a/Projectiles/Boss/BrimstoneLaser.cs b/Projectiles/Boss/BrimstoneLaser.cs index b8041495a2..e3d2897836 100644 --- a/Projectiles/Boss/BrimstoneLaser.cs +++ b/Projectiles/Boss/BrimstoneLaser.cs @@ -1,74 +1,74 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneLaser : ModProjectile - { - private int splitTimer = 60; + { + private int splitTimer = 60; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Laser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Laser"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 120; - aiType = 100; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.aiStyle = 1; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 120; + aiType = 100; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(splitTimer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(splitTimer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - splitTimer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + splitTimer = reader.ReadInt32(); + } - public override void AI() - { - splitTimer--; - if (splitTimer <= 0) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneLaserSplit"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + public override void AI() + { + splitTimer--; + if (splitTimer <= 0) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneLaserSplit"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } } diff --git a/Projectiles/Boss/BrimstoneLaserSplit.cs b/Projectiles/Boss/BrimstoneLaserSplit.cs index a943c7a350..d7e746d82c 100644 --- a/Projectiles/Boss/BrimstoneLaserSplit.cs +++ b/Projectiles/Boss/BrimstoneLaserSplit.cs @@ -1,64 +1,64 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneLaserSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Homing Laser"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Homing Laser"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.alpha = 120; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 480; + projectile.alpha = 120; + } - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 150f && projectile.ai[1] > 90f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (projectile.ai[1] >= 150f) - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.3f, 0f, 0f); - } + public override void AI() + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 150f && projectile.ai[1] > 90f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else if (projectile.ai[1] >= 150f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.3f, 0f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } } diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 7d83aba350..1926e60c99 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -1,154 +1,157 @@ -using System.IO; +using CalamityMod.CalPlayer; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Boss { public class BrimstoneMonster : ModProjectile - { - private float speedAdd = 0f; - private float speedLimit = 0f; + { + private float speedAdd = 0f; + private float speedLimit = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Monster"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Monster"); + } - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 320; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 36000; - projectile.alpha = 50; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 320; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 36000; + projectile.alpha = 50; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedAdd); - writer.Write(projectile.localAI[0]); - writer.Write(speedLimit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(speedAdd); + writer.Write(projectile.localAI[0]); + writer.Write(speedLimit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - speedAdd = reader.ReadSingle(); - projectile.localAI[0] = reader.ReadSingle(); - speedLimit = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + speedAdd = reader.ReadSingle(); + projectile.localAI[0] = reader.ReadSingle(); + speedLimit = reader.ReadSingle(); + } - public override void AI() - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - projectile.active = false; - projectile.netUpdate = true; - return; - } - int choice = (int)projectile.ai[1]; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] += 1f; - if (choice == 0) - { - speedLimit = 10f; - } - else if (choice == 1) - { - speedLimit = 20f; - } - else if (choice == 2) - { - speedLimit = 30f; - } - else - { - speedLimit = 40f; - } - } - if (speedAdd < speedLimit) - { - speedAdd += 0.04f; - } - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - float num953 = (revenge ? 5f : 4.5f) + speedAdd; //100 - float scaleFactor12 = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); //5 - float num954 = 40f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } + public override void AI() + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + int choice = (int)projectile.ai[1]; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] += 1f; + if (choice == 0) + { + speedLimit = 10f; + } + else if (choice == 1) + { + speedLimit = 20f; + } + else if (choice == 2) + { + speedLimit = 30f; + } + else + { + speedLimit = 40f; + } + } + if (speedAdd < speedLimit) + { + speedAdd += 0.04f; + } + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + float num953 = (revenge ? 5f : 4.5f) + speedAdd; //100 + float scaleFactor12 = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); //5 + float num954 = 40f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; - return minDist <= 170f; - } + return minDist <= 170f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 900); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, true); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 900); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, true); + } + } } diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index d5dab7d5fa..37e3b898ae 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -1,88 +1,88 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class BrimstoneWave : ModProjectile - { - private int x; + { + private int x; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Flame Skull"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Flame Skull"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(x); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(x); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - x = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + x = reader.ReadInt32(); + } - public override void AI() - { - x++; - projectile.velocity.Y = (float)(10.0 * Math.Sin(x / 20)); - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = 1; - } - else - { - projectile.spriteDirection = -1; - } - } + public override void AI() + { + x++; + projectile.velocity.Y = (float)(10.0 * Math.Sin(x / 20)); + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = 1; + } + else + { + projectile.spriteDirection = -1; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } + } } diff --git a/Projectiles/Boss/CosmicFlameBurst.cs b/Projectiles/Boss/CosmicFlameBurst.cs index d733a3f3e5..91380029a9 100644 --- a/Projectiles/Boss/CosmicFlameBurst.cs +++ b/Projectiles/Boss/CosmicFlameBurst.cs @@ -5,68 +5,68 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class CosmicFlameBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Flame"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Flame"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + cooldownSlot = 1; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index d2e705f110..aa3d52ab85 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -6,66 +6,66 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DarkEnergyBall : ModProjectile - { - private double timeElapsed = 0.0; - private double circleSize = 1.0; - private double circleGrowth = 0.02; + { + private double timeElapsed = 0.0; + private double circleSize = 1.0; + private double circleGrowth = 0.02; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.projFrames[projectile.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.penetrate = -1; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.penetrate = -1; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(timeElapsed); - writer.Write(circleSize); - writer.Write(circleGrowth); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(timeElapsed); + writer.Write(circleSize); + writer.Write(circleGrowth); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - timeElapsed = reader.ReadDouble(); - circleSize = reader.ReadDouble(); - circleGrowth = reader.ReadDouble(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + timeElapsed = reader.ReadDouble(); + circleSize = reader.ReadDouble(); + circleGrowth = reader.ReadDouble(); + } - public override void AI() - { - timeElapsed += 0.02; - projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); - projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); - circleSize += circleGrowth; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } + public override void AI() + { + timeElapsed += 0.02; + projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); + projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); + circleSize += circleGrowth; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 0f, 0f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 0f, 0f); + } + } + } } diff --git a/Projectiles/Boss/DestroyerHomingLaser.cs b/Projectiles/Boss/DestroyerHomingLaser.cs index ff552136fe..96253b6c9c 100644 --- a/Projectiles/Boss/DestroyerHomingLaser.cs +++ b/Projectiles/Boss/DestroyerHomingLaser.cs @@ -1,85 +1,85 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DestroyerHomingLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Laser"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homing Laser"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.scale = 1.8f; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.scale = 1.8f; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.alpha > 0) - { - projectile.alpha -= 125; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 180f) - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 270f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.alpha > 0) + { + projectile.alpha -= 125; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 180f) + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 270f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.alpha < 200) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - return Color.Transparent; - } - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha < 200) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + return Color.Transparent; + } + } } diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index 5f4f817830..d1dc873ef8 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -1,108 +1,108 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DeusMine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Mine"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Mine"); + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.alpha = 100; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 1200; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.alpha = 100; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 1200; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - } + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + } - public override bool CanDamage() - { - if (projectile.timeLeft > 1115 || projectile.timeLeft < 85) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft > 1115 || projectile.timeLeft < 85) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 1115) - { - projectile.localAI[1] += 1f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 1115) + { + projectile.localAI[1] += 1f; + byte b2 = (byte)(((int)projectile.localAI[1]) * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 1.5f; - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); - } - projectile.Damage(); - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 1.5f; + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); + } + projectile.Damage(); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); + } + } } diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 4f44e176e9..73fe8b8fca 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -1,81 +1,81 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DoGBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Portal Laser"); - Main.projFrames[projectile.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Portal Laser"); + Main.projFrames[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 960; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 960; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.3f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 120f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 20f + vector11) / 21f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.3f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 120f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 20f + vector11) / 21f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } - public override bool CanDamage() - { - if (projectile.timeLeft > 950 || projectile.timeLeft < 85) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft > 950 || projectile.timeLeft < 85) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 950) - { - return new Color(0, 0, 0, 0); - } - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 950) + { + return new Color(0, 0, 0, 0); + } + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + } } diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 485c7c60d8..77d59b0978 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -1,149 +1,149 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class DoGBeamPortal : ModProjectile - { - private int beamTimer = 180; + { + private int beamTimer = 180; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam Portal"); - Main.projFrames[projectile.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam Portal"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.penetrate = -1; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.penetrate = -1; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(beamTimer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(beamTimer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - beamTimer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + beamTimer = reader.ReadInt32(); + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.95f, 1.15f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - beamTimer--; - if (beamTimer <= 0) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float speed = 4f; - int projectileDamage = Main.expertMode ? 64 : 75; - if (CalamityWorld.death) - { - speed = 7f; - } - else if (CalamityWorld.revenge) - { - speed = 6f; - } - else if (Main.expertMode) - { - speed = 5f; - } - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - beamTimer = 180; - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - if (Vector2.Distance(Main.player[num103].Center, projectile.Center) > 2000f) - { - projectile.position.X = (float)(Main.player[num103].Center.X / 16) * 16f - (float)(projectile.width / 2); - projectile.position.Y = ((float)(Main.player[num103].Center.Y / 16) * 16f - (float)(projectile.height / 2)) - 250f; - projectile.ai[1] = 0f; - beamTimer = 90; - } - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.95f, 1.15f); + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + beamTimer--; + if (beamTimer <= 0) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + float spread = 30f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + float speed = 4f; + int projectileDamage = Main.expertMode ? 64 : 75; + if (CalamityWorld.death) + { + speed = 7f; + } + else if (CalamityWorld.revenge) + { + speed = 6f; + } + else if (Main.expertMode) + { + speed = 5f; + } + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + beamTimer = 180; + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + if (Vector2.Distance(Main.player[num103].Center, projectile.Center) > 2000f) + { + projectile.position.X = (float)(Main.player[num103].Center.X / 16) * 16f - (float)(projectile.width / 2); + projectile.position.Y = ((float)(Main.player[num103].Center.Y / 16) * 16f - (float)(projectile.height / 2)) - 250f; + projectile.ai[1] = 0f; + beamTimer = 90; + } + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool CanDamage() - { - if (projectile.timeLeft < 85) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft < 85) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + } } diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 1dd7a48163..2d9e8e492f 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,52 +1,52 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DoGDeath : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Beam"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Beam"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + cooldownSlot = 1; + } - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + } } diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index fbdcecb281..35db841f67 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,121 +8,121 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DoGFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Fire"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Fire"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 480; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 480; + cooldownSlot = 1; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (projectile.alpha > 0) + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; - int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 173, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.2f); - Main.dust[dust].noGravity = true; + int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 173, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.2f); + Main.dust[dust].noGravity = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[1] == 1f) - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.ai[0] < 300f) - { - float scaleFactor2 = projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (projectile.velocity.Length() < 24f) - { - projectile.tileCollide = true; - projectile.velocity *= 1.02f; - } - } - } - } + if (projectile.ai[1] == 1f) + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.ai[0] < 300f) + { + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else if (projectile.velocity.Length() < 24f) + { + projectile.tileCollide = true; + projectile.velocity *= 1.02f; + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - target.AddBuff(BuffID.Frostburn, 300, true); - target.AddBuff(BuffID.Darkness, 300, true); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + target.AddBuff(BuffID.Frostburn, 300, true); + target.AddBuff(BuffID.Darkness, 300, true); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Boss/DoGNebulaShot.cs b/Projectiles/Boss/DoGNebulaShot.cs index 53b8c65eb7..40928a2b94 100644 --- a/Projectiles/Boss/DoGNebulaShot.cs +++ b/Projectiles/Boss/DoGNebulaShot.cs @@ -1,112 +1,112 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DoGNebulaShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Laser"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Laser"); + } - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 4; - projectile.timeLeft = 180; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 4; + projectile.timeLeft = 180; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } + public override void AI() + { + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 100, 255, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 100, 255, 0); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } } diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index 6d8e462bbd..a79493ea0c 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -5,62 +5,62 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class EssenceDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Dust"); + } - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + cooldownSlot = 1; + } - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.975f; - Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.55f); - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.975f; + Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.55f); + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index 4192bc5e9f..90efd5365d 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -1,178 +1,178 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class Flare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) - { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - for (int num234 = num231; num234 < num231 + num233; num234++) - { - Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int num235 = Main.expertMode ? 85 : 100; - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 11f, 8f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; - } - } - } + public override void Kill(int timeLeft) + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + for (int num234 = num231; num234 < num231 + num233; num234++) + { + Tile tile = Main.tile[num232, num234]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int num235 = Main.expertMode ? 85 : 100; + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 11f, 8f + (revenge ? 2f : 0f)); + Main.projectile[num236].netUpdate = true; + } + } + } } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 3a62fe335b..00e727cc18 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -1,170 +1,170 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class FlareBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Bomb"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.scale = 1.5f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.scale = 1.5f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 50; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - float num953 = revenge ? 110f : 100f; //100 - float scaleFactor12 = revenge ? 27f : 25f; //5 - float num954 = 40f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } + public override void AI() + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + float num953 = revenge ? 110f : 100f; //100 + float scaleFactor12 = revenge ? 27f : 25f; //5 + float num954 = 40f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 8; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Damage(); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 8; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } } diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 4ea0edf4b1..e2fda63cc0 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -6,120 +6,120 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class FlareDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Dust"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Dust"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 120; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1.5f; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 120; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 80); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 8; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - projectile.damage = Main.expertMode ? 300 : 180; - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 80); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 8; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + projectile.damage = Main.expertMode ? 300 : 180; + projectile.Damage(); + } + } } diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index b356b0b44b..53b6d26deb 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -1,137 +1,137 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class FlareDust2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Bomb"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 840; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1.5f; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 840; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[0] == 1f) - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 8f && projectile.timeLeft < 630) - { - projectile.velocity *= 1.025f; - } - } - else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) - { - projectile.velocity *= 1.05f; - } - } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[0] == 1f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 8f && projectile.timeLeft < 630) + { + projectile.velocity *= 1.025f; + } + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) + { + projectile.velocity *= 1.05f; + } + } + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 8; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Damage(); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 8; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } } diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 33cefd9ed3..2e7dc50d98 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -1,150 +1,150 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class Flarenado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flarenado"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flarenado"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - int num613 = 10; - int num614 = 15; - float num615 = 1.5f; - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.timeLeft < 300) - { - projectile.velocity.X = ((projectile.ai[1] % 2 == 0) ? 10f : -10f); - return; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } + public override void AI() + { + int num613 = 10; + int num614 = 15; + float num615 = 1.5f; + int num616 = 320; + int num617 = 88; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.timeLeft < 300) + { + projectile.velocity.X = ((projectile.ai[1] % 2 == 0) ? 10f : -10f); + return; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } - public override bool CanDamage() - { - if (projectile.timeLeft > 480) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft > 480) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index e1ef077b64..81891e9114 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,138 +9,138 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class FrostMist : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Mist"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Mist"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 16f) - { - projectile.localAI[1] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 10; - if (projectile.alpha >= 100) - { - projectile.alpha = 100; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 10; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.velocity.Length() < 12f) - { - projectile.velocity *= 1.02f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 16f) + { + projectile.localAI[1] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 10; + if (projectile.alpha >= 100) + { + projectile.alpha = 100; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 10; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.velocity.Length() < 12f) + { + projectile.velocity *= 1.02f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240, true); - target.AddBuff(BuffID.Chilled, 120, true); - target.AddBuff(BuffID.Frozen, 30, true); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240, true); + target.AddBuff(BuffID.Chilled, 120, true); + target.AddBuff(BuffID.Frozen, 30, true); + } + } } diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 7e62dd1250..e34dc6d982 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,85 +9,85 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class GreatSandBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Great Sand Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Great Sand Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.aiStyle = 1; - projectile.alpha = 255; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.aiStyle = 1; + projectile.alpha = 255; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - projectile.tileCollide = projectile.timeLeft < 240; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + public override void AI() + { + projectile.tileCollide = projectile.timeLeft < 240; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.velocity.X *= 0.5f; - target.velocity.Y *= 0.5f; - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.velocity.X *= 0.5f; + target.velocity.Y *= 0.5f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs index 9f7c7adf0b..aa39cad908 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -1,17 +1,17 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ModLoader; using Terraria.DataStructures; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HealOrbProv : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -26,49 +26,49 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 2.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = -32; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - if (Main.player[num487].statLife < 0) - { - Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + int num487 = (int)projectile.ai[0]; + float num488 = 2.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = -32; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + if (Main.player[num487].statLife < 0) + { + Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } } } diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index dad6d9844a..2c5e3971cf 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -1,108 +1,108 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HellfireExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellfire Explosion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellfire Explosion"); + } - public override void SetDefaults() - { - projectile.width = 130; - projectile.height = 130; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - } + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 5643387d11..658f8aa933 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,153 +8,153 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HiveBombGoliath : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Bomb"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Bomb"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) >= 3f || Math.Abs(projectile.velocity.Y) >= 3f) - { - float num247 = 0f; - float num248 = 0f; - if (Main.rand.Next(2) == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - else if (Main.rand.NextBool(4)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) >= 3f || Math.Abs(projectile.velocity.Y) >= 3f) + { + float num247 = 0f; + float num248 = 0f; + if (Main.rand.Next(2) == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + else if (Main.rand.NextBool(4)) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 250, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(50, 250, 50, projectile.alpha); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 8; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 8; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + } + } } diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index e63ea4683c..a79a59ed95 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,124 +1,124 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Blast"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Blast"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 180; - projectile.height = 180; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 180; + projectile.height = 180; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.wet || projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - if (projectile.velocity.X < 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - else - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.wet || projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + if (projectile.velocity.X < 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + else + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Vector2 shootFromVector = new Vector2(projectile.Center.X, projectile.Center.Y); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); - } - for (int num194 = 0; num194 < 60; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Vector2 shootFromVector = new Vector2(projectile.Center.X, projectile.Center.Y); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + } + for (int num194 = 0; num194 < 60; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 240); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 240); + } + } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 73136352ec..c975459cd4 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -1,121 +1,121 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyBomb : ModProjectile - { - private int flareShootTimer = 120; + { + private int flareShootTimer = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Bomb"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Bomb"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.timeLeft = 250; - projectile.penetrate = -1; - projectile.tileCollide = false; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.timeLeft = 250; + projectile.penetrate = -1; + projectile.tileCollide = false; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(flareShootTimer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(flareShootTimer); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - flareShootTimer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + flareShootTimer = reader.ReadInt32(); + } - public override void AI() - { - flareShootTimer--; - if (flareShootTimer <= 0) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -2f, mod.ProjectileType("HolyFlare"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - flareShootTimer = 60; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + public override void AI() + { + flareShootTimer--; + if (flareShootTimer <= 0) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -2f, mod.ProjectileType("HolyFlare"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + flareShootTimer = 60; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 180); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index b6344326bb..821ff60f34 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,111 +1,111 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ModLoader; using Terraria.DataStructures; -using CalamityMod.World; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyBurnOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Orb"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Orb"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 240; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.scale = 1.5f; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 240; + } - public override void AI() - { - bool expertMode = Main.expertMode; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - int num492 = expertMode ? -150 : -100; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num492 = -200; - } - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - if (Main.player[num487].statLife < 0 || CalamityWorld.armageddon) - { - Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - projectile.Kill(); - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + int num492 = expertMode ? -150 : -100; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num492 = -200; + } + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + if (Main.player[num487].statLife < 0 || CalamityWorld.armageddon) + { + Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + projectile.Kill(); + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 60); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 60); + } + } } diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index d75afaeb60..8643260b74 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -6,110 +6,110 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Fire"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Fire"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.aiStyle = 1; - projectile.tileCollide = false; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.aiStyle = 1; + projectile.tileCollide = false; + cooldownSlot = 1; + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.alpha -= 5; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.alpha -= 5; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - int randomShot = Main.rand.Next(2); - if (randomShot == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - } - } + public override void Kill(int timeLeft) + { + int randomShot = Main.rand.Next(2); + if (randomShot == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 4af7e9c933..9245c5a1b7 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,104 +1,104 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyFire2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Fire"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Fire"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) < 7f) - { - projectile.velocity.X *= 1.05f; - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) < 7f) + { + projectile.velocity.X *= 1.05f; + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index fdd055b002..ca1021c722 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -6,110 +6,110 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Flare"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Flare"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.Y = projectile.velocity.Y + 0.02f; - if (projectile.velocity.Y > 1f) - { - projectile.velocity.Y = 1f; - } - if (projectile.position.X + (float)projectile.width < player.position.X) - { - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.98f; - } - projectile.velocity.X = projectile.velocity.X + 0.025f; - } - else if (projectile.position.X > player.position.X + (float)player.width) - { - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.98f; - } - projectile.velocity.X = projectile.velocity.X - 0.025f; - } - if (projectile.velocity.X > 5f || projectile.velocity.X < -5f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - projectile.rotation = projectile.velocity.X * 0.05f; - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.Y = projectile.velocity.Y + 0.02f; + if (projectile.velocity.Y > 1f) + { + projectile.velocity.Y = 1f; + } + if (projectile.position.X + (float)projectile.width < player.position.X) + { + if (projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.98f; + } + projectile.velocity.X = projectile.velocity.X + 0.025f; + } + else if (projectile.position.X > player.position.X + (float)player.width) + { + if (projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.98f; + } + projectile.velocity.X = projectile.velocity.X - 0.025f; + } + if (projectile.velocity.X > 5f || projectile.velocity.X < -5f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + projectile.rotation = projectile.velocity.X * 0.05f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 4f5b2fb334..fac8b9c419 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,95 +1,95 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyLight : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Light"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Light"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 240; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 240; + } - public override void AI() - { - bool expertMode = Main.expertMode; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - int num492 = expertMode ? 50 : 35; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - projectile.Kill(); - } - } + public override void AI() + { + bool expertMode = Main.expertMode; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + int num492 = expertMode ? 50 : 35; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + projectile.Kill(); + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(150, 255, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(150, 255, 0, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/HolyShot.cs b/Projectiles/Boss/HolyShot.cs index 99aee64d41..92d3d77982 100644 --- a/Projectiles/Boss/HolyShot.cs +++ b/Projectiles/Boss/HolyShot.cs @@ -1,6 +1,6 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,87 +8,87 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 100; - projectile.timeLeft = 900; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 100; + projectile.timeLeft = 900; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - } + public override void AI() + { + projectile.velocity.X *= 1.03f; + projectile.velocity.Y *= 1.03f; + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + } + } - public override bool CanDamage() - { - if (projectile.timeLeft > 883 || projectile.timeLeft < 85) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft > 883 || projectile.timeLeft < 85) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 883) - { - projectile.localAI[1] += 5f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 883) + { + projectile.localAI[1] += 5f; + byte b2 = (byte)(((int)projectile.localAI[1]) * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 647903610c..02c97d96b2 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,6 +1,6 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,99 +8,99 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolySpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 100; - projectile.timeLeft = 900; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 100; + projectile.timeLeft = 900; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.timeLeft > 815) - { - if (projectile.ai[0] == 0f) - projectile.velocity.X = 1f; - else - projectile.velocity.X = -1f; - } - else - { - if (projectile.ai[0] == 0f) - projectile.velocity.X = 15f; - else - projectile.velocity.X = -15f; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f && projectile.timeLeft < 815) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - } + public override void AI() + { + if (projectile.timeLeft > 815) + { + if (projectile.ai[0] == 0f) + projectile.velocity.X = 1f; + else + projectile.velocity.X = -1f; + } + else + { + if (projectile.ai[0] == 0f) + projectile.velocity.X = 15f; + else + projectile.velocity.X = -15f; + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + if (projectile.localAI[0] == 0f && projectile.timeLeft < 815) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + } + } - public override bool CanDamage() - { - if (projectile.timeLeft > 815 || projectile.timeLeft < 85) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft > 815 || projectile.timeLeft < 85) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 883) - { - projectile.localAI[1] += 5f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 883) + { + projectile.localAI[1] += 5f; + byte b2 = (byte)(((int)projectile.localAI[1]) * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 541945992d..dda106525e 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,76 +8,76 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class IceBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Blast"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Blast"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.penetrate = -1; - projectile.hostile = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.penetrate = -1; + projectile.hostile = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num3; - for (int num322 = 0; num322 < 2; num322 = num3 + 1) - { - int num323 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num323].noGravity = true; - Dust dust = Main.dust[num323]; - dust.velocity *= 0.3f; - num3 = num322; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item28, projectile.position); - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + int num3; + for (int num322 = 0; num322 < 2; num322 = num3 + 1) + { + int num323 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); + Main.dust[num323].noGravity = true; + Dust dust = Main.dust[num323]; + dust.velocity *= 0.3f; + num3 = num322; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item28, projectile.position); + } + } - public override void Kill(int timeLeft) - { - int num497 = 10; - Main.PlaySound(SoundID.Item27, projectile.position); - int num3; - for (int num498 = 0; num498 < num497; num498 = num3 + 1) - { - int num499 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 0, default, 1f); - if (Main.rand.Next(3) != 0) - { - Dust dust = Main.dust[num499]; - dust.velocity *= 2f; - Main.dust[num499].noGravity = true; - dust = Main.dust[num499]; - dust.scale *= 1.75f; - } - else - { - Dust dust = Main.dust[num499]; - dust.scale *= 0.5f; - } - num3 = num498; - } - } + public override void Kill(int timeLeft) + { + int num497 = 10; + Main.PlaySound(SoundID.Item27, projectile.position); + int num3; + for (int num498 = 0; num498 < num497; num498 = num3 + 1) + { + int num499 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 0, default, 1f); + if (Main.rand.Next(3) != 0) + { + Dust dust = Main.dust[num499]; + dust.velocity *= 2f; + Main.dust[num499].noGravity = true; + dust = Main.dust[num499]; + dust.scale *= 1.75f; + } + else + { + Dust dust = Main.dust[num499]; + dust.scale *= 0.5f; + } + num3 = num498; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 90, true); - target.AddBuff(BuffID.Chilled, 60, true); - target.AddBuff(BuffID.Frozen, 30, true); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 90, true); + target.AddBuff(BuffID.Chilled, 60, true); + target.AddBuff(BuffID.Frozen, 30, true); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index da12f402c2..644a2e01da 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -6,56 +6,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class IceBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Bomb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Bomb"); + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 50; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - } + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + float spread = 60f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120, true); - target.AddBuff(BuffID.Chilled, 90, true); - target.AddBuff(mod.BuffType("GlacialState"), 60); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120, true); + target.AddBuff(BuffID.Chilled, 90, true); + target.AddBuff(mod.BuffType("GlacialState"), 60); + } + } } diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index a1e679d213..cdcdec5d50 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -1,5 +1,5 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,79 +7,79 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class IceRain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Rain"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Rain"); + } - public override void SetDefaults() - { - projectile.aiStyle = 1; - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - } + public override void SetDefaults() + { + projectile.aiStyle = 1; + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.penetrate = -1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) - { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.localAI[0] = 1f; - projectile.alpha = 0; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= 255) - { - projectile.localAI[0] = 2f; - projectile.alpha = 255; - } - } - } + public override void AI() + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= 255) + { + projectile.localAI[0] = 2f; + projectile.alpha = 255; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - int num3; - for (int num373 = 0; num373 < 3; num373 = num3 + 1) - { - int num374 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 76, 0f, 0f, 0, default, 1f); - Main.dust[num374].noGravity = true; - Main.dust[num374].noLight = true; - Main.dust[num374].scale = 0.7f; - num3 = num373; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + int num3; + for (int num373 = 0; num373 < 3; num373 = num3 + 1) + { + int num374 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 76, 0f, 0f, 0, default, 1f); + Main.dust[num374].noGravity = true; + Main.dust[num374].noLight = true; + Main.dust[num374].scale = 0.7f; + num3 = num373; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 60, true); - target.AddBuff(BuffID.Chilled, 30, true); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 60, true); + target.AddBuff(BuffID.Chilled, 30, true); + } + } } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index c398e43236..b4824fe8b0 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,52 +7,52 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class IchorShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ichor Shot"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ichor Shot"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 420; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.timeLeft = 420; + projectile.penetrate = 1; + } - public override void AI() - { - if (projectile.timeLeft < 300) - projectile.tileCollide = true; + public override void AI() + { + if (projectile.timeLeft < 300) + projectile.tileCollide = true; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 100, default, 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; - projectile.velocity.Y = projectile.velocity.Y + 0.06f; - projectile.velocity.X *= 0.995f; - } + projectile.velocity.Y = projectile.velocity.Y + 0.06f; + projectile.velocity.X *= 0.995f; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + } + } } diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 319175c3c2..fe7cba8269 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -1,151 +1,151 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class Infernado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernado"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - int num613 = 30; - int num614 = 30; - float num615 = 3f; //2.5 - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); - if (projectile.ai[1] % 2 == 0) - { - projectile.damage = 0; - projectile.timeLeft /= 10; - } - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } + public override void AI() + { + int num613 = 30; + int num614 = 30; + float num615 = 3f; //2.5 + int num616 = 320; + int num617 = 88; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + if (projectile.ai[1] % 2 == 0) + { + projectile.damage = 0; + projectile.timeLeft /= 10; + } + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } - public override bool CanDamage() - { - if (projectile.timeLeft > 480) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft > 480) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index 3a0c2a5fc1..e85ba32a27 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -1,146 +1,146 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class Infernado2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernado"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 840; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 840; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - int num613 = 30; - int num614 = 30; - float num615 = 2f; //2.5 - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } + public override void AI() + { + int num613 = 30; + int num614 = 30; + float num615 = 2f; //2.5 + int num616 = 320; + int num617 = 88; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } - public override bool CanDamage() - { - if (projectile.timeLeft > 720) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft > 720) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index 5c5a1c73f0..8baf25dbd8 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -1,151 +1,151 @@ -using System; -using System.IO; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Boss { public class InfernadoRevenge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernado"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 360000; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 360000; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - projectile.active = false; - projectile.netUpdate = true; - return; - } - int num613 = 35; - int num614 = 35; - float num615 = 3.5f; - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - return; - } - } + public override void AI() + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + int num613 = 35; + int num614 = 35; + float num615 = 3.5f; + int num616 = 320; + int num617 = 88; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + return; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0, false); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0, false); + } + } } diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index ecadbf449f..21f2b8f476 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -1,92 +1,92 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class LeviathanBomb : ModProjectile - { - private bool visible = false; + { + private bool visible = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meteor Vomit"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meteor Vomit"); + } - public override void SetDefaults() - { - projectile.width = 170; - projectile.height = 170; - projectile.scale = 0.75f; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - } + public override void SetDefaults() + { + projectile.width = 170; + projectile.height = 170; + projectile.scale = 0.75f; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(visible); - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(visible); + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - visible = reader.ReadBoolean(); - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + visible = reader.ReadBoolean(); + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; - projectile.rotation += 0.1f; - if (visible && projectile.alpha > 0) - projectile.alpha -= 15; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 12f) - { - visible = true; - } - } + public override void AI() + { + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; + projectile.rotation += 0.1f; + if (visible && projectile.alpha > 0) + projectile.alpha -= 15; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 12f) + { + visible = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.Damage(); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.Damage(); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 97cfb17335..e8d1a32580 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -1,141 +1,141 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class MoltenBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Molten Blast"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Molten Blast"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 90; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 90; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.wet || projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.wet || projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + projectile.localAI[0] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - int num251 = Main.rand.Next(5, 10); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 121) * 0.1f; //70 101 - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("MoltenBlob"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } + public override void Kill(int timeLeft) + { + int num251 = Main.rand.Next(5, 10); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 121) * 0.1f; //70 101 + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("MoltenBlob"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int num193 = 0; num193 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 180); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 4ae051dfe3..e0a5d6285b 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -5,100 +5,100 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class MoltenBlob : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Molten Blob"); - Main.projFrames[projectile.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Molten Blob"); + Main.projFrames[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.scale = 1.5f; - cooldownSlot = 0; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + projectile.scale = 1.5f; + cooldownSlot = 0; + } - public override void AI() - { - projectile.velocity.X *= 0.95f; - if (projectile.wet || projectile.lavaWet) - { - projectile.velocity.Y = 0f; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - if (projectile.velocity.Y > 5f) - { - projectile.velocity.Y = 5f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - } + public override void AI() + { + projectile.velocity.X *= 0.95f; + if (projectile.wet || projectile.lavaWet) + { + projectile.velocity.Y = 0f; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + 0.1f; + if (projectile.velocity.Y > 5f) + { + projectile.velocity.Y = 5f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 90); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 90); + } + } } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 91ecbd46b8..a56177c3dc 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -5,72 +5,72 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class MushBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mushroom Shot"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mushroom Shot"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.aiStyle = 1; - aiType = 1; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 480; + projectile.aiStyle = 1; + aiType = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.timeLeft < 90) - { - projectile.tileCollide = true; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); - projectile.velocity.X *= 0.99f; - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.timeLeft < 90) + { + projectile.tileCollide = true; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); + projectile.velocity.X *= 0.99f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 601d43d573..9b68bfa7c9 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -5,73 +5,73 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class MushBombFall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Falling Mushroom"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Falling Mushroom"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.aiStyle = 1; - aiType = 1; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 480; + projectile.aiStyle = 1; + aiType = 1; + } - public override void AI() - { - projectile.velocity.Y = 5f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.timeLeft < 90) - { - projectile.tileCollide = true; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); - projectile.velocity.X *= 0.99f; - } + public override void AI() + { + projectile.velocity.Y = 5f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.timeLeft < 90) + { + projectile.tileCollide = true; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); + projectile.velocity.X *= 0.99f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/Mushmash.cs b/Projectiles/Boss/Mushmash.cs index 758f337e73..63ba36f51a 100644 --- a/Projectiles/Boss/Mushmash.cs +++ b/Projectiles/Boss/Mushmash.cs @@ -3,19 +3,19 @@ namespace CalamityMod.Projectiles.Boss { public class Mushmash : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mushmash"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mushmash"); + } - public override void SetDefaults() - { - projectile.width = 200; - projectile.height = 200; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 10; - } - } + public override void SetDefaults() + { + projectile.width = 200; + projectile.height = 200; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 10; + } + } } diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 551dcf7d41..c9644d35d7 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,125 +8,125 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PhantomBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Blast"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Blast"); + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] >= 30f) - { - projectile.ai[0] = 30f; - projectile.velocity.Y = projectile.velocity.Y + 0.035f; - } - float scaleFactor3 = 22f; - int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; - vector20.Normalize(); - vector20 *= scaleFactor3; - int num190 = 80; - projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; - if (projectile.velocity.Length() < 14f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 14f; - } - if (projectile.timeLeft > 180) - { - projectile.timeLeft = 180; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 24f) - { - projectile.localAI[1] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 180, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] >= 30f) + { + projectile.ai[0] = 30f; + projectile.velocity.Y = projectile.velocity.Y + 0.035f; + } + float scaleFactor3 = 22f; + int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - projectile.Center; + vector20.Normalize(); + vector20 *= scaleFactor3; + int num190 = 80; + projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; + if (projectile.velocity.Length() < 14f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 14f; + } + if (projectile.timeLeft > 180) + { + projectile.timeLeft = 180; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 24f) + { + projectile.localAI[1] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 180, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index bbc8d8adbd..7f86704a29 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,125 +8,125 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PhantomBlast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potent Phantom Blast"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potent Phantom Blast"); + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] >= 30f) - { - projectile.ai[0] = 30f; - projectile.velocity.Y = projectile.velocity.Y + 0.035f; - } - float scaleFactor3 = 25f; - int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; - vector20.Normalize(); - vector20 *= scaleFactor3; - int num190 = 90; - projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; - if (projectile.velocity.Length() < 14f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 14f; - } - if (projectile.timeLeft > 180) - { - projectile.timeLeft = 180; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 24f) - { - projectile.localAI[1] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] >= 30f) + { + projectile.ai[0] = 30f; + projectile.velocity.Y = projectile.velocity.Y + 0.035f; + } + float scaleFactor3 = 25f; + int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - projectile.Center; + vector20.Normalize(); + vector20 *= scaleFactor3; + int num190 = 90; + projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; + if (projectile.velocity.Length() < 14f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 14f; + } + if (projectile.timeLeft > 180) + { + projectile.timeLeft = 180; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 24f) + { + projectile.localAI[1] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 100, 100, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 100, 100, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index 80b6d55023..4a6f6c4c49 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,69 +8,69 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PhantomGhostShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potent Phantom Spirit Shot"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potent Phantom Spirit Shot"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 2; - projectile.penetrate = -1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.extraUpdates = 2; + projectile.penetrate = -1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 6f) - { - for (int num151 = 0; num151 < 40; num151++) - { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; - } - } - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - } + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 6f) + { + for (int num151 = 0; num151 < 40; num151++) + { + int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[num152].velocity *= 3f; + Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].scale *= 1.2f; + Main.dust[num152].noGravity = true; + } + } + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } + } } diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index ea6b325eaf..d3eed80dc7 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,69 +8,69 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PhantomHookShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Hook Shot"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Hook Shot"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 2; - projectile.penetrate = -1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.extraUpdates = 2; + projectile.penetrate = -1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 6f) - { - for (int num151 = 0; num151 < 40; num151++) - { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; - } - } - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - } + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 6f) + { + for (int num151 = 0; num151 < 40; num151++) + { + int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[num152].velocity *= 3f; + Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].scale *= 1.2f; + Main.dust[num152].noGravity = true; + } + } + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } + } } diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index c3f48337d9..8d5c8bc260 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -1,69 +1,69 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PhantomMine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Orb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Orb"); + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 480; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 480; + cooldownSlot = 1; + } - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 12f) - { - projectile.velocity *= 1.05f; - } - } + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 12f) + { + projectile.velocity *= 1.05f; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 401ed2e5ab..7efa9d2283 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,90 +8,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PhantomShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Shot"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Shot"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 4; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 4; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - projectile.localAI[1] -= 180f; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + projectile.localAI[1] -= 180f; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 300f) - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f) - projectile.velocity *= 1.015f; + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 300f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f) + projectile.velocity *= 1.015f; - if (projectile.localAI[1] > 480f) - { - projectile.localAI[1] = 0f; - projectile.penetrate--; - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; - } - } + if (projectile.localAI[1] > 480f) + { + projectile.localAI[1] = 0f; + projectile.penetrate--; + projectile.velocity.X = -projectile.velocity.X; + projectile.velocity.Y = -projectile.velocity.Y; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + projectile.alpha = 30; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } + } } diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index 439fee5c21..e7804f9906 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.IO; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,90 +8,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PhantomShot2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potent Phantom Shot"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potent Phantom Shot"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 5; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 5; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - projectile.localAI[1] -= 120f; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + projectile.localAI[1] -= 120f; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 240f) - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f) - projectile.velocity *= 1.015f; + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 240f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f) + projectile.velocity *= 1.015f; - if (projectile.localAI[1] > 420f) - { - projectile.localAI[1] = 0f; - projectile.penetrate--; - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; - } - } + if (projectile.localAI[1] > 420f) + { + projectile.localAI[1] = 0f; + projectile.penetrate--; + projectile.velocity.X = -projectile.velocity.X; + projectile.velocity.Y = -projectile.velocity.Y; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + projectile.alpha = 30; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 100, 100, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 100, 100, projectile.alpha); + } + } } diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index e92a2ca948..83a68d1dfa 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -1,92 +1,92 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PlagueExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Stinger Explosion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Stinger Explosion"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 0.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 0.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 240); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 240); + } + } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index bd40854d8e..c3bfe9d6cf 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -1,73 +1,73 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PlagueStingerGoliath : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Homing Stinger"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Homing Stinger"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } - public override void AI() - { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + public override void AI() + { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 110f && projectile.ai[0] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - projectile.Center; - vector17.Normalize(); - vector17 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } + int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 110f && projectile.ai[0] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector17 = Main.player[num123].Center - projectile.Center; + vector17.Normalize(); + vector17 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 180); + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); - Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow"), vector, + null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + } + } } diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 9012aa0f1c..c900c29f8b 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -1,66 +1,66 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class PlagueStingerGoliathV2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exploding Plague Stinger"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exploding Plague Stinger"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } - public override void AI() - { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + public override void AI() + { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 180); + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); - Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, + null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index cbf19fabf2..6ebc144608 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,91 +9,91 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class ProfanedSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 38; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 300; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.timeLeft < 210) - projectile.tileCollide = true; + public override void AI() + { + if (projectile.timeLeft < 210) + projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.alpha -= 3; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - { - projectile.velocity.X *= 1.1f; - projectile.velocity.Y *= 1.1f; - } - else if (projectile.ai[1] == 40f) - { - projectile.ai[1] = 0f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.alpha -= 3; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 20f) + { + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + } + else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + { + projectile.velocity.X *= 1.1f; + projectile.velocity.Y *= 1.1f; + } + else if (projectile.ai[1] == 40f) + { + projectile.ai[1] = 0f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + projectile.localAI[0] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 1deea77b17..1f7372e07d 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -1,134 +1,134 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystal : ModProjectile - { - private float speedX = -21f; - private float speedY = -3f; + { + private float speedX = -21f; + private float speedY = -3f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Crystal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Crystal"); + } - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.ignoreWater = true; - projectile.timeLeft = CalamityWorld.bossRushActive ? 1500 : (CalamityWorld.death ? 2100 : 3600); - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.penetrate = -1; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.ignoreWater = true; + projectile.timeLeft = CalamityWorld.bossRushActive ? 1500 : (CalamityWorld.death ? 2100 : 3600); + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.penetrate = -1; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedX); - writer.Write(speedY); - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(speedX); + writer.Write(speedY); + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - speedX = reader.ReadSingle(); - speedY = reader.ReadSingle(); - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + speedX = reader.ReadSingle(); + speedY = reader.ReadSingle(); + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (player.dead || NPC.CountNPCS(mod.NPCType("Providence")) < 1) - { - projectile.active = false; - projectile.netUpdate = true; - return; - } - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 360f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 400f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - projectile.velocity = Vector2.Zero; - projectile.alpha -= 5; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.direction == 0) - { - projectile.direction = Main.player[projectile.owner].direction; - } - if (projectile.alpha == 0 && Main.rand.NextBool(15)) - { - Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(255, 200, Main.DiscoB), 1f)]; - dust34.velocity.X = 0f; - dust34.noGravity = true; - dust34.fadeIn = 1f; - dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); - dust34.scale = 0.5f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 300f) - { - projectile.localAI[0] = 0f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) - { - for (int num1083 = 0; num1083 < 14; num1083++) - { - float x4 = Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, mod.ProjectileType("ProvidenceCrystalShard"), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); - speedX += 3f; // -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21 - } - } - speedX = -21f; - } - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (player.dead || NPC.CountNPCS(mod.NPCType("Providence")) < 1) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 360f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 400f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + projectile.velocity = Vector2.Zero; + projectile.alpha -= 5; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.direction == 0) + { + projectile.direction = Main.player[projectile.owner].direction; + } + if (projectile.alpha == 0 && Main.rand.NextBool(15)) + { + Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(255, 200, Main.DiscoB), 1f)]; + dust34.velocity.X = 0f; + dust34.noGravity = true; + dust34.fadeIn = 1f; + dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); + dust34.scale = 0.5f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 300f) + { + projectile.localAI[0] = 0f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); + projectile.netUpdate = true; + if (projectile.owner == Main.myPlayer) + { + for (int num1083 = 0; num1083 < 14; num1083++) + { + float x4 = Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, mod.ProjectileType("ProvidenceCrystalShard"), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); + speedX += 3f; // -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21 + } + } + speedX = -21f; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (projectile.localAI[0] / 60f))) + 3f + 3f; - for (float num286 = 0f; num286 < 4f; num286 += 1f) - { - SpriteBatch arg_F907_0 = Main.spriteBatch; - Texture2D arg_F907_1 = texture2D34; - Vector2 arg_F8CE_0 = vector59; - Vector2 arg_F8BE_0 = Vector2.UnitY; - double arg_F8BE_1 = (double)(num286 * 1.57079637f); - Vector2 center = default; - arg_F907_0.Draw(arg_F907_1, arg_F8CE_0 + arg_F8BE_0.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); - } - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin11 = rectangle17.Size() / 2f; + float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (projectile.localAI[0] / 60f))) + 3f + 3f; + for (float num286 = 0f; num286 < 4f; num286 += 1f) + { + SpriteBatch arg_F907_0 = Main.spriteBatch; + Texture2D arg_F907_1 = texture2D34; + Vector2 arg_F8CE_0 = vector59; + Vector2 arg_F8BE_0 = Vector2.UnitY; + double arg_F8BE_1 = (double)(num286 * 1.57079637f); + Vector2 center = default; + arg_F907_0.Draw(arg_F907_1, arg_F8CE_0 + arg_F8BE_0.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); + } + return false; + } + } } diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 041525e79f..b125f9e304 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -1,200 +1,200 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystalShard : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Crystal Shard"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Crystal Shard"); + } - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.timeLeft < 300) - { - projectile.tileCollide = true; - } - Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); - } - projectile.velocity.X *= 0.995f; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y *= 0.98f; - } - else - { - projectile.velocity.Y *= 1.06f; - float fallSpeed = (CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 3.5f : 3f; - if (projectile.velocity.Y > fallSpeed) - { - projectile.velocity.Y = fallSpeed; - } - } - if (projectile.velocity.Y > -0.5f && projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 0.5f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - int num3; - for (int num979 = 0; num979 < 2; num979 = num3 + 1) - { - if (Main.rand.NextBool(10)) - { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust24.noGravity = true; - dust24.noLight = true; - dust24.scale = projectile.Opacity * projectile.localAI[0]; - dust24.position = projectile.Center; - dust24.velocity = value55 * 2.5f; - } - num3 = num979; - } - for (int num980 = 0; num980 < 2; num980 = num3 + 1) - { - if (Main.rand.NextBool(10)) - { - Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); - Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust25.noGravity = true; - dust25.noLight = true; - dust25.scale = projectile.Opacity * projectile.localAI[0]; - dust25.position = projectile.Center; - dust25.velocity = value56 * 2.5f; - } - num3 = num980; - } - if (Main.rand.NextBool(10)) - { - float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; - float fadeIn = 1f + Main.rand.NextFloat(); - float num981 = 1f + Main.rand.NextFloat(); - Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector136 != Vector2.Zero) - { - vector136.Normalize(); - } - vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = projectile.Center + vector136; - Point point3 = vector137.ToTileCoordinates(); - bool flag52 = true; - if (!WorldGen.InWorld(point3.X, point3.Y, 0)) - { - flag52 = false; - } - if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) - { - flag52 = false; - } - if (flag52) - { - Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; - dust26.noGravity = true; - dust26.position = vector137; - dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust26.fadeIn = fadeIn; - dust26.scale = num981; - dust26.noLight = true; - Dust dust27 = Dust.CloneDust(dust26); - Dust dust = dust27; - dust.scale *= 0.65f; - dust = dust27; - dust.fadeIn *= 0.65f; - dust27.color = new Color(255, 255, 255, 255); - } - } - } + public override void AI() + { + if (projectile.timeLeft < 300) + { + projectile.tileCollide = true; + } + Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); + } + projectile.velocity.X *= 0.995f; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y *= 0.98f; + } + else + { + projectile.velocity.Y *= 1.06f; + float fallSpeed = (CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 3.5f : 3f; + if (projectile.velocity.Y > fallSpeed) + { + projectile.velocity.Y = fallSpeed; + } + } + if (projectile.velocity.Y > -0.5f && projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + projectile.velocity.Y = 0.5f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + int num3; + for (int num979 = 0; num979 < 2; num979 = num3 + 1) + { + if (Main.rand.NextBool(10)) + { + Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + dust24.noGravity = true; + dust24.noLight = true; + dust24.scale = projectile.Opacity * projectile.localAI[0]; + dust24.position = projectile.Center; + dust24.velocity = value55 * 2.5f; + } + num3 = num979; + } + for (int num980 = 0; num980 < 2; num980 = num3 + 1) + { + if (Main.rand.NextBool(10)) + { + Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); + Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + dust25.noGravity = true; + dust25.noLight = true; + dust25.scale = projectile.Opacity * projectile.localAI[0]; + dust25.position = projectile.Center; + dust25.velocity = value56 * 2.5f; + } + num3 = num980; + } + if (Main.rand.NextBool(10)) + { + float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; + float fadeIn = 1f + Main.rand.NextFloat(); + float num981 = 1f + Main.rand.NextFloat(); + Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); + if (vector136 != Vector2.Zero) + { + vector136.Normalize(); + } + vector136 *= 20f + Main.rand.NextFloat() * 100f; + Vector2 vector137 = projectile.Center + vector136; + Point point3 = vector137.ToTileCoordinates(); + bool flag52 = true; + if (!WorldGen.InWorld(point3.X, point3.Y, 0)) + { + flag52 = false; + } + if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) + { + flag52 = false; + } + if (flag52) + { + Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + dust26.noGravity = true; + dust26.position = vector137; + dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); + dust26.fadeIn = fadeIn; + dust26.scale = num981; + dust26.noLight = true; + Dust dust27 = Dust.CloneDust(dust26); + Dust dust = dust27; + dust.scale *= 0.65f; + dust = dust27; + dust.fadeIn *= 0.65f; + dust27.color = new Color(255, 255, 255, 255); + } + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); - float num69 = (float)Main.rand.Next(7, 13); - Vector2 value5 = new Vector2(2.1f, 2f); - Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - newColor.A = 255; - float num72; - for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) - { - int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = projectile.Center; - Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[num71].noGravity = true; - Main.dust[num71].scale = 2f; - Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust11 = Dust.CloneDust(num71); - Dust dust = dust11; - dust.scale /= 2f; - dust = dust11; - dust.fadeIn /= 2f; - dust11.color = new Color(255, 255, 255, 255); - num72 = num70; - } - for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) - { - int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = projectile.Center; - Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[num74]; - dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num74].noGravity = true; - Main.dust[num74].scale = Main.rand.NextFloat() * 1f; - Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust12 = Dust.CloneDust(num74); - dust = dust12; - dust.scale /= 2f; - dust = dust12; - dust.fadeIn /= 2f; - dust12.color = new Color(255, 255, 255, 255); - num72 = num73; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); + float num69 = (float)Main.rand.Next(7, 13); + Vector2 value5 = new Vector2(2.1f, 2f); + Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + newColor.A = 255; + float num72; + for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) + { + int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num71].position = projectile.Center; + Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[num71].noGravity = true; + Main.dust[num71].scale = 2f; + Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust11 = Dust.CloneDust(num71); + Dust dust = dust11; + dust.scale /= 2f; + dust = dust11; + dust.fadeIn /= 2f; + dust11.color = new Color(255, 255, 255, 255); + num72 = num70; + } + for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) + { + int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num74].position = projectile.Center; + Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[num74]; + dust.velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[num74].noGravity = true; + Main.dust[num74].scale = Main.rand.NextFloat() * 1f; + Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust12 = Dust.CloneDust(num74); + dust = dust12; + dust.scale /= 2f; + dust = dust12; + dust.fadeIn /= 2f; + dust12.color = new Color(255, 255, 255, 255); + num72 = num73; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + } } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 46c8f69897..663be92433 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -1,210 +1,210 @@ -using System; -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.ModLoader; using Terraria.Enums; -using CalamityMod.World; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class ProvidenceHolyRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Ray"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Ray"); + } - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - Vector2? vector78 = null; + public override void AI() + { + Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == mod.NPCType("Providence")) - { - Vector2 value21 = new Vector2(27f, 59f); - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X, Main.npc[(int)projectile.ai[1]].Center.Y - 32f); - Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); - projectile.position = fireFrom + value22 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } + if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == mod.NPCType("Providence")) + { + Vector2 value21 = new Vector2(27f, 59f); + Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X, Main.npc[(int)projectile.ai[1]].Center.Y - 32f); + Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); + projectile.position = fireFrom + value22 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } - float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 100f : 180f)) - { - projectile.Kill(); - return; - } + float num801 = 1f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 100f : 180f)) + { + projectile.Kill(); + return; + } - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 100f : 180f))) * 10f * num801; - if (projectile.scale > num801) - { - projectile.scale = num801; - } + projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 100f : 180f))) * 10f * num801; + if (projectile.scale > num801) + { + projectile.scale = num801; + } - float num804 = projectile.velocity.ToRotation(); - num804 += projectile.ai[0]; - projectile.rotation = num804 - 1.57079637f; - projectile.velocity = num804.ToRotationVector2(); + float num804 = projectile.velocity.ToRotation(); + num804 += projectile.ai[0]; + projectile.rotation = num804 - 1.57079637f; + projectile.velocity = num804.ToRotationVector2(); - float num805 = 3f; //3f - float num806 = (float)projectile.width; + float num805 = 3f; //3f + float num806 = (float)projectile.width; - Vector2 samplingPoint = projectile.Center; - if (vector78.HasValue) - { - samplingPoint = vector78.Value; - } + Vector2 samplingPoint = projectile.Center; + if (vector78.HasValue) + { + samplingPoint = vector78.Value; + } - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); - float num807 = 0f; - int num3; - for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) - { - num807 += array3[num808]; - num3 = num808; - } - num807 /= num805; + float[] array3 = new float[(int)num805]; + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + float num807 = 0f; + int num3; + for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) + { + num807 += array3[num808]; + num3 = num808; + } + num807 /= num805; - // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) - { - num807 = 2400f; - } + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) + { + num807 = 2400f; + } - float amount = 0.5f; //0.5f - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation - Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); - for (int num809 = 0; num809 < 2; num809 = num3 + 1) - { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; - float num811 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); - int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default, 1f); - Main.dust[num812].noGravity = true; - Main.dust[num812].scale = 1.7f; - num3 = num809; - } + float amount = 0.5f; //0.5f + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + for (int num809 = 0; num809 < 2; num809 = num3 + 1) + { + float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num811 = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); + int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default, 1f); + Main.dust[num812].noGravity = true; + Main.dust[num812].scale = 1.7f; + num3 = num809; + } - if (Main.rand.NextBool(5)) - { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num813]; - dust.velocity *= 0.5f; - Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); - } + if (Main.rand.NextBool(5)) + { + Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[num813]; + dust.velocity *= 0.5f; + Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); + } - DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - } + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - { - return false; - } - Texture2D texture2D19 = Main.projectileTexture[projectile.type]; - Texture2D texture2D20 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayMid"); - Texture2D texture2D21 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayEnd"); - float num223 = projectile.localAI[1]; //length of laser - Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f; - SpriteBatch arg_ABD8_0 = Main.spriteBatch; - Texture2D arg_ABD8_1 = texture2D19; - Vector2 arg_ABD8_2 = projectile.Center - Main.screenPosition; - Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; - arg_ABD8_0.Draw(arg_ABD8_1, arg_ABD8_2, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; - Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; - if (num223 > 0f) - { - float num224 = 0f; - Microsoft.Xna.Framework.Rectangle rectangle7 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); - while (num224 + 1f < num223) - { - if (num223 - num224 < (float)rectangle7.Height) - { - rectangle7.Height = (int)(num223 - num224); - } - Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += (float)rectangle7.Height * projectile.scale; - value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; - rectangle7.Y += 16; - if (rectangle7.Y + rectangle7.Height > texture2D20.Height) - { - rectangle7.Y = 0; - } - } - } - SpriteBatch arg_AE2D_0 = Main.spriteBatch; - Texture2D arg_AE2D_1 = texture2D21; - Vector2 arg_AE2D_2 = value20 - Main.screenPosition; - sourceRectangle2 = null; - arg_AE2D_0.Draw(arg_AE2D_1, arg_AE2D_2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D texture2D19 = Main.projectileTexture[projectile.type]; + Texture2D texture2D20 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayMid"); + Texture2D texture2D21 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayEnd"); + float num223 = projectile.localAI[1]; //length of laser + Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f; + SpriteBatch arg_ABD8_0 = Main.spriteBatch; + Texture2D arg_ABD8_1 = texture2D19; + Vector2 arg_ABD8_2 = projectile.Center - Main.screenPosition; + Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; + arg_ABD8_0.Draw(arg_ABD8_1, arg_ABD8_2, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; + Vector2 value20 = projectile.Center; + value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; + if (num223 > 0f) + { + float num224 = 0f; + Microsoft.Xna.Framework.Rectangle rectangle7 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + while (num224 + 1f < num223) + { + if (num223 - num224 < (float)rectangle7.Height) + { + rectangle7.Height = (int)(num223 - num224); + } + Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num224 += (float)rectangle7.Height * projectile.scale; + value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; + rectangle7.Y += 16; + if (rectangle7.Y + rectangle7.Height > texture2D20.Height) + { + rectangle7.Y = 0; + } + } + } + SpriteBatch arg_AE2D_0 = Main.spriteBatch; + Texture2D arg_AE2D_1 = texture2D21; + Vector2 arg_AE2D_2 = value20 - Main.screenPosition; + sourceRectangle2 = null; + arg_AE2D_0.Draw(arg_AE2D_1, arg_AE2D_2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) - { - return true; - } - return false; - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } } diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index 71e390f152..3642da1765 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -6,43 +6,43 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class RavagerFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blue Flame"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blue Flame"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.aiStyle = 1; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.aiStyle = 1; + } - public override void AI() - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - } + public override void AI() + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 3f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + } + } } diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 5e29b4e9a4..9dcbb891de 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,105 +8,105 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class RedLightningFeather : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lightning Feather"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lightning Feather"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } - Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); + Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 120f) - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else - projectile.tileCollide = true; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 120f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else + projectile.tileCollide = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - } - for (int num194 = 0; num194 < 10; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + } + for (int num194 = 0; num194 < 10; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index e2df1aa49c..f38d82234b 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,82 +8,82 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class SandBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + public override void AI() + { + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int dust = 0; dust <= 10; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int dust = 0; dust <= 10; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1.2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index f2a6b98bc4..11f3a41330 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -1,81 +1,81 @@ -using Terraria; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class SandPoisonCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxic Cloud"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 2100 : 1800; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 2100 : 1800; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.5f, 0.3f, 0f); + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.3f, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } - projectile.velocity *= 0.99f; + projectile.velocity *= 0.99f; - if (projectile.timeLeft < 180) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - } - else if (projectile.alpha > 30) - { - projectile.alpha -= 30; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - } + if (projectile.timeLeft < 180) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + } + else if (projectile.alpha > 30) + { + projectile.alpha -= 30; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + } - public override bool CanDamage() - { - if (projectile.timeLeft < 180) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.timeLeft < 180) + { + return false; + } + return true; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + } + } } diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 682ecb9adf..3ba66f24db 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -1,57 +1,57 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class SandTooth : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Tooth"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Tooth"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 450; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 450; + } - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 250f && projectile.ai[1] > 60f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) //18 - { - projectile.velocity *= 1.01f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - } + public override void AI() + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 250f && projectile.ai[1] > 60f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) //18 + { + projectile.velocity *= 1.01f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index c687b6959f..591c3cefbe 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -1,204 +1,204 @@ -using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class ScavengerLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Dart"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homing Dart"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 45f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; - } - projectile.velocity.X = projectile.velocity.RotatedBy(0.0, default).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - if (projectile.velocity.Y < -7f) - { - projectile.velocity.Y = -7f; - } - } - else if (projectile.ai[0] == 1f) - { - if (Main.player[(int)projectile.ai[1]].Center.Y > projectile.Center.Y + 90f) - { - projectile.ai[0] = 2f; - projectile.netUpdate = true; - } - projectile.velocity.X = projectile.velocity.RotatedBy(0.0, default).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - if (projectile.velocity.Y < -7f) - { - projectile.velocity.Y = -7f; - } - } - else if (projectile.ai[0] == 2f) - { - if (Main.player[(int)projectile.ai[1]].Center.Y < projectile.Center.Y) - { - projectile.tileCollide = true; - } - float speed = revenge ? 9f : 7.5f; - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - if (vector70.Length() < 20f) - { - projectile.Kill(); - return; - } - vector70.Normalize(); - vector70 *= 14f; - vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); - if (vector70.Y < speed) - { - vector70.Y = speed; - } - float num804 = 0.4f; - if (projectile.velocity.X < vector70.X) - { - projectile.velocity.X = projectile.velocity.X + num804; - if (projectile.velocity.X < 0f && vector70.X > 0f) - { - projectile.velocity.X = projectile.velocity.X + num804; - } - } - else if (projectile.velocity.X > vector70.X) - { - projectile.velocity.X = projectile.velocity.X - num804; - if (projectile.velocity.X > 0f && vector70.X < 0f) - { - projectile.velocity.X = projectile.velocity.X - num804; - } - } - if (projectile.velocity.Y < vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - if (projectile.velocity.Y < 0f && vector70.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - } - } - else if (projectile.velocity.Y > vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - if (projectile.velocity.Y > 0f && vector70.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - } - } - } - if (projectile.alpha < 40) - { - int num805 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 244, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); - Main.dust[num805].noGravity = true; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - } + public override void AI() + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + projectile.alpha -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 45f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 1f; + projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); + projectile.netUpdate = true; + } + projectile.velocity.X = projectile.velocity.RotatedBy(0.0, default).X; + projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + projectile.velocity.Y = projectile.velocity.Y - 0.08f; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + if (projectile.velocity.Y < -7f) + { + projectile.velocity.Y = -7f; + } + } + else if (projectile.ai[0] == 1f) + { + if (Main.player[(int)projectile.ai[1]].Center.Y > projectile.Center.Y + 90f) + { + projectile.ai[0] = 2f; + projectile.netUpdate = true; + } + projectile.velocity.X = projectile.velocity.RotatedBy(0.0, default).X; + projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + projectile.velocity.Y = projectile.velocity.Y - 0.08f; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + if (projectile.velocity.Y < -7f) + { + projectile.velocity.Y = -7f; + } + } + else if (projectile.ai[0] == 2f) + { + if (Main.player[(int)projectile.ai[1]].Center.Y < projectile.Center.Y) + { + projectile.tileCollide = true; + } + float speed = revenge ? 9f : 7.5f; + Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + if (vector70.Length() < 20f) + { + projectile.Kill(); + return; + } + vector70.Normalize(); + vector70 *= 14f; + vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); + if (vector70.Y < speed) + { + vector70.Y = speed; + } + float num804 = 0.4f; + if (projectile.velocity.X < vector70.X) + { + projectile.velocity.X = projectile.velocity.X + num804; + if (projectile.velocity.X < 0f && vector70.X > 0f) + { + projectile.velocity.X = projectile.velocity.X + num804; + } + } + else if (projectile.velocity.X > vector70.X) + { + projectile.velocity.X = projectile.velocity.X - num804; + if (projectile.velocity.X > 0f && vector70.X < 0f) + { + projectile.velocity.X = projectile.velocity.X - num804; + } + } + if (projectile.velocity.Y < vector70.Y) + { + projectile.velocity.Y = projectile.velocity.Y + num804; + if (projectile.velocity.Y < 0f && vector70.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num804; + } + } + else if (projectile.velocity.Y > vector70.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num804; + if (projectile.velocity.Y > 0f && vector70.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num804; + } + } + } + if (projectile.alpha < 40) + { + int num805 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 244, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); + Main.dust[num805].noGravity = true; + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 0, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 0, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index a5757c2a1b..8f2c821cbf 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -1,161 +1,161 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class ScavengerNuke : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Nuke"); - Main.projFrames[projectile.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homing Nuke"); + Main.projFrames[projectile.type] = 5; + } - public override void SetDefaults() - { - projectile.width = 44; - projectile.height = 44; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 720; - } + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 44; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 720; + } - public override void AI() - { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 480) - { - projectile.tileCollide = true; - } - projectile.frameCounter++; - if (projectile.frameCounter > 18) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - float num953 = revenge ? 75f : 60f; - float scaleFactor12 = revenge ? 15f : 12f; - float num954 = 40f; - if (projectile.alpha > 0) - { - projectile.alpha -= 10; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } + public override void AI() + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + projectile.ai[1] += 1f; + if (projectile.ai[1] > 480) + { + projectile.tileCollide = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 18) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + float num953 = revenge ? 75f : 60f; + float scaleFactor12 = revenge ? 15f : 12f; + float num954 = 40f; + if (projectile.alpha > 0) + { + projectile.alpha -= 10; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Damage(); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } } diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index 802048a872..295c47572a 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -4,56 +4,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class ShadeNimbusHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shade Nimbus"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shade Nimbus"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 54; - projectile.height = 28; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 360; - projectile.penetrate = -1; - } + public override void SetDefaults() + { + projectile.width = 54; + projectile.height = 28; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 360; + projectile.penetrate = -1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 300f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 8f) - { - projectile.ai[0] = 0f; - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("ShaderainHostile"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 300f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 8f) + { + projectile.ai[0] = 0f; + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("ShaderainHostile"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index d135054061..e1a61fc4ca 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -6,47 +6,47 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class ShaderainHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cursed Rain"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed Rain"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 40; - projectile.hostile = true; - projectile.extraUpdates = 1; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 40; + projectile.hostile = true; + projectile.extraUpdates = 1; + projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + } - public override void AI() - { - projectile.alpha = 50; - } + public override void AI() + { + projectile.alpha = 50; + } - public override void Kill(int timeLeft) - { - int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); - Dust expr_A0A0_cp_0 = Main.dust[num310]; - expr_A0A0_cp_0.position.X -= 2f; - Main.dust[num310].alpha = 38; - Main.dust[num310].velocity *= 0.1f; - Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; - Main.dust[num310].scale = 0.95f; - } + public override void Kill(int timeLeft) + { + int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); + Dust expr_A0A0_cp_0 = Main.dust[num310]; + expr_A0A0_cp_0.position.X -= 2f; + Main.dust[num310].alpha = 38; + Main.dust[num310].velocity *= 0.1f; + Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; + Main.dust[num310].scale = 0.95f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(102, 255, 102, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(102, 255, 102, projectile.alpha); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + } } diff --git a/Projectiles/Boss/Shadowflame.cs b/Projectiles/Boss/Shadowflame.cs index 27c2066c62..7df339a809 100644 --- a/Projectiles/Boss/Shadowflame.cs +++ b/Projectiles/Boss/Shadowflame.cs @@ -1,6 +1,4 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,87 +7,87 @@ namespace CalamityMod.Projectiles.Boss { public class Shadowflame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shadowflame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadowflame"); + } public override void SetDefaults() { projectile.width = 16; projectile.height = 16; projectile.hostile = true; - projectile.tileCollide = false; - projectile.light = 0.8f; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.scale = 1.25f; + projectile.tileCollide = false; + projectile.light = 0.8f; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 360; + projectile.scale = 1.25f; } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - - int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 27, projectile.velocity.X, projectile.velocity.Y, 100, default, 3f); - Main.dust[dust].noGravity = true; - - projectile.rotation += 0.3f * (float)projectile.direction; - - if (projectile.ai[1] == 1f) - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.ai[0] < 240f) - { - float scaleFactor2 = projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (projectile.velocity.Length() < 18f) - { - projectile.tileCollide = true; - projectile.velocity *= 1.02f; - } - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void AI() { - if (Main.rand.NextBool(6)) - target.AddBuff(mod.BuffType("Shadowflame"), 180, true); - else if (Main.rand.NextBool(4)) - target.AddBuff(mod.BuffType("Shadowflame"), 120, true); - else if (Main.rand.NextBool(2)) - target.AddBuff(mod.BuffType("Shadowflame"), 60, true); + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + + int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 27, projectile.velocity.X, projectile.velocity.Y, 100, default, 3f); + Main.dust[dust].noGravity = true; + + projectile.rotation += 0.3f * (float)projectile.direction; + + if (projectile.ai[1] == 1f) + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.ai[0] < 240f) + { + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else if (projectile.velocity.Length() < 18f) + { + projectile.tileCollide = true; + projectile.velocity *= 1.02f; + } + } + } } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num584 = 0; num584 < 20; num584 = num3 + 1) - { - int num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 2.5f); - Main.dust[num585].noGravity = true; - Dust dust = Main.dust[num585]; - dust.velocity *= 2f; - num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 1.2f); - dust = Main.dust[num585]; - dust.velocity *= 2f; - num3 = num584; - } - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (Main.rand.NextBool(6)) + target.AddBuff(mod.BuffType("Shadowflame"), 180, true); + else if (Main.rand.NextBool(4)) + target.AddBuff(mod.BuffType("Shadowflame"), 120, true); + else if (Main.rand.NextBool(2)) + target.AddBuff(mod.BuffType("Shadowflame"), 60, true); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num584 = 0; num584 < 20; num584 = num3 + 1) + { + int num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 2.5f); + Main.dust[num585].noGravity = true; + Dust dust = Main.dust[num585]; + dust.velocity *= 2f; + num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 1.2f); + dust = Main.dust[num585]; + dust.velocity *= 2f; + num3 = num584; + } + } + } } diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index 6a3e5cf3b5..1dc9237ac3 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -1,81 +1,79 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class Shadowflamethrower : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shadowflamethrower"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadowflamethrower"); + } public override void SetDefaults() { projectile.width = 6; projectile.height = 6; projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 60; - } - - public override void AI() - { - if (projectile.ai[0] > 7f) - { - float num302 = 1f; - if (projectile.ai[0] == 8f) - num302 = 0.25f; - else if (projectile.ai[0] == 9f) - num302 = 0.5f; - else if (projectile.ai[0] == 10f) - num302 = 0.75f; - - projectile.ai[0] += 1f; - if (Main.rand.NextBool(2)) - { - int num305 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust; - - if (Main.rand.Next(3) != 0 || Main.rand.NextBool(3)) - { - Main.dust[num305].noGravity = true; - dust = Main.dust[num305]; - dust.scale *= 3f; - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - } - - dust = Main.dust[num305]; - dust.scale *= 2f; - dust.velocity.X *= 1.2f; - dust.velocity.Y *= 1.2f; - dust.scale *= num302; - dust.velocity += projectile.velocity; - - if (!dust.noGravity) - dust.velocity *= 0.5f; - } - } - else - projectile.ai[0] += 1f; - - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - if (Main.rand.NextBool(6)) - target.AddBuff(mod.BuffType("Shadowflame"), 240, true); - else if (Main.rand.NextBool(4)) - target.AddBuff(mod.BuffType("Shadowflame"), 150, true); - else if (Main.rand.NextBool(2)) - target.AddBuff(mod.BuffType("Shadowflame"), 90, true); + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 60; } - } + + public override void AI() + { + if (projectile.ai[0] > 7f) + { + float num302 = 1f; + if (projectile.ai[0] == 8f) + num302 = 0.25f; + else if (projectile.ai[0] == 9f) + num302 = 0.5f; + else if (projectile.ai[0] == 10f) + num302 = 0.75f; + + projectile.ai[0] += 1f; + if (Main.rand.NextBool(2)) + { + int num305 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust; + + if (Main.rand.Next(3) != 0 || Main.rand.NextBool(3)) + { + Main.dust[num305].noGravity = true; + dust = Main.dust[num305]; + dust.scale *= 3f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + + dust = Main.dust[num305]; + dust.scale *= 2f; + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= num302; + dust.velocity += projectile.velocity; + + if (!dust.noGravity) + dust.velocity *= 0.5f; + } + } + else + projectile.ai[0] += 1f; + + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (Main.rand.NextBool(6)) + target.AddBuff(mod.BuffType("Shadowflame"), 240, true); + else if (Main.rand.NextBool(4)) + target.AddBuff(mod.BuffType("Shadowflame"), 150, true); + else if (Main.rand.NextBool(2)) + target.AddBuff(mod.BuffType("Shadowflame"), 90, true); + } + } } diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 4c51d0517b..33f0fde7cb 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,140 +9,140 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class SignusScythe : ModProjectile - { - private int counter = 0; + { + private int counter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - projectile.alpha = 100; - projectile.penetrate = -1; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 600; + projectile.alpha = 100; + projectile.penetrate = -1; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(counter); - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(counter); + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - counter = reader.ReadInt32(); - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + counter = reader.ReadInt32(); + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - projectile.rotation += 0.5f * (float)projectile.direction; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item73, projectile.position); - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 180f) - { - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - Vector2 value16 = Main.player[num625].Center - projectile.Center; - if (value16.Length() < 200f || counter > 0) - { - counter--; - if (counter <= 0 && projectile.localAI[0] == 2f) - { - projectile.Kill(); - return; - } - if (projectile.localAI[0] < 2f) - { - projectile.localAI[0] = 2f; - float speed = 30f; - Vector2 vector167 = new Vector2(projectile.Center.X + (float)(projectile.direction * 20), projectile.Center.Y + 6f); - float num1373 = Main.player[num625].position.X + (float)Main.player[num625].width * 0.5f - vector167.X; - float num1374 = Main.player[num625].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = speed / num1375; - num1373 *= num1376; - num1374 *= num1376; - projectile.velocity.X = (projectile.velocity.X * 50f + num1373) / 51f; - projectile.velocity.Y = (projectile.velocity.Y * 50f + num1374) / 51f; - counter = 90; - } - } - else - { - projectile.velocity = Vector2.Normalize(value16) * 15f; - } - } - } - } - } + public override void AI() + { + projectile.rotation += 0.5f * (float)projectile.direction; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item73, projectile.position); + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 180f) + { + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + Vector2 value16 = Main.player[num625].Center - projectile.Center; + if (value16.Length() < 200f || counter > 0) + { + counter--; + if (counter <= 0 && projectile.localAI[0] == 2f) + { + projectile.Kill(); + return; + } + if (projectile.localAI[0] < 2f) + { + projectile.localAI[0] = 2f; + float speed = 30f; + Vector2 vector167 = new Vector2(projectile.Center.X + (float)(projectile.direction * 20), projectile.Center.Y + 6f); + float num1373 = Main.player[num625].position.X + (float)Main.player[num625].width * 0.5f - vector167.X; + float num1374 = Main.player[num625].Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = speed / num1375; + num1373 *= num1376; + num1374 *= num1376; + projectile.velocity.X = (projectile.velocity.X * 50f + num1373) / 51f; + projectile.velocity.Y = (projectile.velocity.Y * 50f + num1374) / 51f; + counter = 90; + } + } + else + { + projectile.velocity = Vector2.Normalize(value16) * 15f; + } + } + } + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 515) - { - projectile.localAI[1] += 1f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)(projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 515) + { + projectile.localAI[1] += 1f; + byte b2 = (byte)(((int)projectile.localAI[1]) * 3); + byte a2 = (byte)(projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("WhisperingDeath"), 300); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("WhisperingDeath"), 300); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 462b7f1bdb..e01d2de80e 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -1,5 +1,5 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,69 +7,69 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class SirenSong : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Musical Note"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Musical Note"); + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 58; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 1800; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 58; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.timeLeft = 1800; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.01f; - if (projectile.scale >= 1.1f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.01f; - if (projectile.scale <= 0.9f) - { - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; - Main.harpNote = soundPitch; - Main.PlaySound(SoundID.Item26, projectile.position); - } - Lighting.AddLight(projectile.Center, 0.7f, 0.5f, 0f); - } + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.01f; + if (projectile.scale >= 1.1f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.01f; + if (projectile.scale <= 0.9f) + { + projectile.localAI[0] = 0f; + } + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + Main.harpNote = soundPitch; + Main.PlaySound(SoundID.Item26, projectile.position); + } + Lighting.AddLight(projectile.Center, 0.7f, 0.5f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, 0); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Confused, 120); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Confused, 120); + } + } } diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index b3f82bc178..0bbbb18cac 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -1,125 +1,125 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { public class SkyFlare : ModProjectile - { - public int blowTimer = 0; + { + public int blowTimer = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sky Flare"); - Main.projFrames[projectile.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sky Flare"); + Main.projFrames[projectile.type] = 5; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = 1; + cooldownSlot = 1; + } - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y *= 0.9995f; - int addStuff = Main.rand.Next(5); - blowTimer += addStuff; - if (blowTimer >= 900) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - } + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y *= 0.9995f; + int addStuff = Main.rand.Next(5); + blowTimer += addStuff; + if (blowTimer >= 900) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - bool revenge = CalamityWorld.revenge; - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - for (int num234 = num231; num234 < num231 + num233; num234++) - { - Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int tornadoType = Main.rand.Next(6); - if (tornadoType < 5) - { - int num235 = Main.expertMode ? 180 : 300; //720 - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); - Main.projectile[num236].netUpdate = true; - } - else - { - int num235 = Main.expertMode ? 230 : 400; //920 - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), num235, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); - Main.projectile[num236].netUpdate = true; - } - } - } - } + public override void Kill(int timeLeft) + { + bool revenge = CalamityWorld.revenge; + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + for (int num234 = num231; num234 < num231 + num233; num234++) + { + Tile tile = Main.tile[num232, num234]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int tornadoType = Main.rand.Next(6); + if (tornadoType < 5) + { + int num235 = Main.expertMode ? 180 : 300; //720 + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); + Main.projectile[num236].netUpdate = true; + } + else + { + int num235 = Main.expertMode ? 230 : 400; //920 + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), num235, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); + Main.projectile[num236].netUpdate = true; + } + } + } + } } diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index a41f127818..41fa2f11ed 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -6,71 +6,71 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class SkyFlareRevenge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sky Flare"); - Main.projFrames[projectile.type] = 5; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sky Flare"); + Main.projFrames[projectile.type] = 5; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 10; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 10; + cooldownSlot = 1; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - int num235 = 100; - int num236 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoRevenge"), num235, 4f, Main.myPlayer, 16f, 50f); - Main.projectile[num236].netUpdate = true; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num235 = 100; + int num236 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoRevenge"), num235, 4f, Main.myPlayer, 16f, 50f); + Main.projectile[num236].netUpdate = true; + } + } + } } diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index 349570163a..9f76d09c9e 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -1,6 +1,6 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,89 +9,89 @@ namespace CalamityMod.Projectiles.Boss { public class SporeGasPlantera : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spore Gas"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spore Gas"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { projectile.width = 32; projectile.height = 32; projectile.hostile = true; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.penetrate = -1; projectile.tileCollide = false; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() + public override void SendExtraAI(BinaryWriter writer) { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 570f) - projectile.localAI[0] += 10f; + writer.Write(projectile.localAI[0]); + } - if (projectile.localAI[0] > 255f) - { - projectile.Kill(); - projectile.localAI[0] = 255f; - } - - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.16f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.04f) / 255f); - - projectile.alpha = (int)(100.0 + (double)projectile.localAI[0] * 0.7); - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.rotation += (float)projectile.direction * 0.002f; - - if (projectile.velocity.Length() > 0.5f) - projectile.velocity *= 0.98f; - } - - public override bool CanDamage() - { - if (projectile.ai[1] > 570f) - { - return false; - } - return true; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - //Changes the texture of the projectile - Texture2D texture = Main.projectileTexture[projectile.type]; - switch ((int)projectile.ai[0]) - { - case 0: - break; - case 1: - texture = mod.GetTexture("Projectiles/Boss/SporeGasPlantera2"); - break; - case 2: - texture = mod.GetTexture("Projectiles/Boss/SporeGasPlantera3"); - break; - default: - break; - } - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ReceiveExtraAI(BinaryReader reader) { - target.AddBuff(BuffID.Poisoned, 240); - target.AddBuff(BuffID.Venom, 120); - } + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.ai[1] += 1f; + if (projectile.ai[1] > 570f) + projectile.localAI[0] += 10f; + + if (projectile.localAI[0] > 255f) + { + projectile.Kill(); + projectile.localAI[0] = 255f; + } + + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.16f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.04f) / 255f); + + projectile.alpha = (int)(100.0 + (double)projectile.localAI[0] * 0.7); + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.rotation += (float)projectile.direction * 0.002f; + + if (projectile.velocity.Length() > 0.5f) + projectile.velocity *= 0.98f; + } + + public override bool CanDamage() + { + if (projectile.ai[1] > 570f) + { + return false; + } + return true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Changes the texture of the projectile + Texture2D texture = Main.projectileTexture[projectile.type]; + switch ((int)projectile.ai[0]) + { + case 0: + break; + case 1: + texture = mod.GetTexture("Projectiles/Boss/SporeGasPlantera2"); + break; + case 2: + texture = mod.GetTexture("Projectiles/Boss/SporeGasPlantera3"); + break; + default: + break; + } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 240); + target.AddBuff(BuffID.Venom, 120); + } } } diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index acec63c25e..c6a95e702f 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -6,35 +6,35 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class VileClot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vile Clot"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vile Clot"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 3f) - { - int num104 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), - projectile.width, projectile.height, 75, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default, 1f); - Main.dust[num104].noGravity = true; - } - } + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 3f) + { + int num104 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), + projectile.width, projectile.height, 75, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default, 1f); + Main.dust[num104].noGravity = true; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 60); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 60); + } + } } diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index 7da791437f..74fd777f3f 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,100 +9,100 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class WaterSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } - public override void AI() - { - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 10; - if (projectile.alpha >= 100) - { - projectile.alpha = 100; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 10; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } + public override void AI() + { + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 10; + if (projectile.alpha >= 100) + { + projectile.alpha = 100; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 10; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 240); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Wet, 240); + } + } } diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 9ca4ced310..59f4779fef 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -1,6 +1,6 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,108 +8,108 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class YharonFireball : ModProjectile - { - private float speedX = -3f; - private float speedX2 = -5f; + { + private float speedX = -3f; + private float speedX2 = -5f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon Fireball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Fireball"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.aiStyle = 1; - aiType = 686; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.aiStyle = 1; + aiType = 686; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedX); - writer.Write(projectile.localAI[1]); - writer.Write(speedX2); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(speedX); + writer.Write(projectile.localAI[1]); + writer.Write(speedX2); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - speedX = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - speedX2 = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + speedX = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + speedX2 = reader.ReadSingle(); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int frameY = frameHeight * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; - if (Lighting.NotRetro) - { - for (int i = 0; i < projectile.oldPos.Length; i++) - { - Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color2 = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); - } - } + if (Lighting.NotRetro) + { + for (int i = 0; i < projectile.oldPos.Length; i++) + { + Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Color color2 = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); + } + } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight)), - projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight)), + projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + return false; + } - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - for (int x = 0; x < 3; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX, -50f, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX += 3f; - } - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX2, -75f, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX2 += 10f; - } - } - projectile.position = projectile.Center; - projectile.width = (projectile.height = 144); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + for (int x = 0; x < 3; x++) + { + Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX, -50f, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + speedX += 3f; + } + for (int x = 0; x < 2; x++) + { + Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX2, -75f, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + speedX2 += 10f; + } + } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 144); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index 140130edfc..210e31d258 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -1,6 +1,6 @@ -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,120 +8,120 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class YharonFireball2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon Fireball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Fireball"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 3600; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 3600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y *= 0.97f; - } - else - { - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 1f; - } - projectile.velocity.X *= 0.995f; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - if (projectile.ai[0] >= 2f) - { - projectile.alpha -= 25; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (Main.rand.NextBool(16)) - { - Dust expr_733B = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default, 1f); - expr_733B.scale *= 0.7f; - expr_733B.velocity += projectile.velocity * 0.25f; - } - } + public override void AI() + { + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y *= 0.97f; + } + else + { + projectile.velocity.Y *= 1.03f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + projectile.velocity.Y = 1f; + } + projectile.velocity.X *= 0.995f; + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + } + if (projectile.ai[0] >= 2f) + { + projectile.alpha -= 25; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (Main.rand.NextBool(16)) + { + Dust expr_733B = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default, 1f); + expr_733B.scale *= 0.7f; + expr_733B.velocity += projectile.velocity * 0.25f; + } + } - public override bool CanDamage() - { - if (projectile.velocity.Y < -16f) - { - return false; - } - return true; - } + public override bool CanDamage() + { + if (projectile.velocity.Y < -16f) + { + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 0.5f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 144); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 0.5f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 144); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b5ac47fb63..7a04c5b9a6 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,637 +1,635 @@ -using System; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; -using CalamityMod.Utilities; -using CalamityMod.NPCs; namespace CalamityMod.Projectiles { public class CalamityGlobalProjectile : GlobalProjectile - { - public override bool InstancePerEntity - { - get - { - return true; - } - } + { + public override bool InstancePerEntity + { + get + { + return true; + } + } - // Class Types - public bool rogue = false; - public bool trueMelee = false; + // Class Types + public bool rogue = false; + public bool trueMelee = false; - // Force Class Types - public bool forceMelee = false; - public bool forceRanged = false; - public bool forceMagic = false; - public bool forceRogue = false; - public bool forceMinion = false; - public bool forceHostile = false; + // Force Class Types + public bool forceMelee = false; + public bool forceRanged = false; + public bool forceMagic = false; + public bool forceRogue = false; + public bool forceMinion = false; + public bool forceHostile = false; - // Damage Adjusters - private bool setDamageValues = true; - public float spawnedPlayerMinionDamageValue = 1f; - public int spawnedPlayerMinionProjectileDamageValue = 0; - public int defDamage = 0; + // Damage Adjusters + private bool setDamageValues = true; + public float spawnedPlayerMinionDamageValue = 1f; + public int spawnedPlayerMinionProjectileDamageValue = 0; + public int defDamage = 0; // Rogue Stuff public bool stealthStrike = false; //Update all existing rogue weapons with this - // Iron Heart - public int ironHeartDamage = 0; + // Iron Heart + public int ironHeartDamage = 0; - // Counters and Timers - private int counter = 0; - private int counter2 = 0; + // Counters and Timers + private int counter = 0; + private int counter2 = 0; - #region SetDefaults - public override void SetDefaults(Projectile projectile) - { - switch (projectile.type) - { - case ProjectileID.Spear: - case ProjectileID.ChainKnife: - case ProjectileID.TheRottedFork: - case ProjectileID.BallOHurt: - case ProjectileID.TheMeatball: - case ProjectileID.Swordfish: - case ProjectileID.Arkhalis: - case ProjectileID.BlueMoon: - case ProjectileID.DarkLance: - case ProjectileID.Sunfury: - case ProjectileID.Anchor: - case ProjectileID.BoxingGlove: - case ProjectileID.CobaltNaginata: - case ProjectileID.PalladiumPike: - case ProjectileID.MythrilHalberd: - case ProjectileID.OrichalcumHalberd: - case ProjectileID.AdamantiteGlaive: - case ProjectileID.TitaniumTrident: - case ProjectileID.TheDaoofPow: - case ProjectileID.GolemFist: - case ProjectileID.Gungnir: - case ProjectileID.ObsidianSwordfish: - case ProjectileID.ChainGuillotine: - case ProjectileID.MonkStaffT3: - case ProjectileID.MonkStaffT1: - case ProjectileID.SolarWhipSword: - trueMelee = true; - break; - case ProjectileID.StarWrath: - projectile.penetrate = projectile.maxPenetrate = 1; - break; - default: - break; - } + #region SetDefaults + public override void SetDefaults(Projectile projectile) + { + switch (projectile.type) + { + case ProjectileID.Spear: + case ProjectileID.ChainKnife: + case ProjectileID.TheRottedFork: + case ProjectileID.BallOHurt: + case ProjectileID.TheMeatball: + case ProjectileID.Swordfish: + case ProjectileID.Arkhalis: + case ProjectileID.BlueMoon: + case ProjectileID.DarkLance: + case ProjectileID.Sunfury: + case ProjectileID.Anchor: + case ProjectileID.BoxingGlove: + case ProjectileID.CobaltNaginata: + case ProjectileID.PalladiumPike: + case ProjectileID.MythrilHalberd: + case ProjectileID.OrichalcumHalberd: + case ProjectileID.AdamantiteGlaive: + case ProjectileID.TitaniumTrident: + case ProjectileID.TheDaoofPow: + case ProjectileID.GolemFist: + case ProjectileID.Gungnir: + case ProjectileID.ObsidianSwordfish: + case ProjectileID.ChainGuillotine: + case ProjectileID.MonkStaffT3: + case ProjectileID.MonkStaffT1: + case ProjectileID.SolarWhipSword: + trueMelee = true; + break; + case ProjectileID.StarWrath: + projectile.penetrate = projectile.maxPenetrate = 1; + break; + default: + break; + } // Disable Lunatic Cultist's homing resistance globally ProjectileID.Sets.Homing[projectile.type] = false; - } - #endregion + } + #endregion - #region PreAI - public override bool PreAI(Projectile projectile) - { - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - if (projectile.type == ProjectileID.PoisonSeedPlantera) - { - projectile.frameCounter++; - if (projectile.frameCounter > 1) - { - projectile.frameCounter = 0; - projectile.frame++; + #region PreAI + public override bool PreAI(Projectile projectile) + { + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + if (projectile.type == ProjectileID.PoisonSeedPlantera) + { + projectile.frameCounter++; + if (projectile.frameCounter > 1) + { + projectile.frameCounter = 0; + projectile.frame++; - if (projectile.frame > 1) - projectile.frame = 0; - } + if (projectile.frame > 1) + projectile.frame = 0; + } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item17, projectile.position); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item17, projectile.position); + } - if (projectile.alpha > 0) - projectile.alpha -= 30; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (projectile.alpha > 0) + projectile.alpha -= 30; + if (projectile.alpha < 0) + projectile.alpha = 0; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 35f) - { - projectile.ai[0] = 35f; - projectile.velocity.Y += 0.01f; - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 35f) + { + projectile.ai[0] = 35f; + projectile.velocity.Y += 0.01f; + } - projectile.tileCollide = false; + projectile.tileCollide = false; - if (projectile.timeLeft > 300) - projectile.timeLeft = 300; + if (projectile.timeLeft > 300) + projectile.timeLeft = 300; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; - return false; - } + return false; + } - // Phase 1 sharknado - else if (projectile.type == ProjectileID.SharknadoBolt) - { - if (projectile.ai[1] < 0f) - { - float num623 = 0.209439516f; - float num624 = -2f; - float num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; + // Phase 1 sharknado + else if (projectile.type == ProjectileID.SharknadoBolt) + { + if (projectile.ai[1] < 0f) + { + float num623 = 0.209439516f; + float num624 = -2f; + float num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; - projectile.velocity.Y -= num625; + projectile.velocity.Y -= num625; - projectile.ai[0] += 1f; + projectile.ai[0] += 1f; - num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; + num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; - projectile.velocity.Y += num625; + projectile.velocity.Y += num625; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - projectile.alpha = 100; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + projectile.alpha = 100; - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - return false; - } - } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + return false; + } + } - // Large cthulhunadoes - else if (projectile.type == ProjectileID.Cthulunado) - { - int num606 = 16; - int num607 = 16; - float num608 = 2f; - int num609 = 150; - int num610 = 42; + // Large cthulhunadoes + else if (projectile.type == ProjectileID.Cthulunado) + { + int num606 = 16; + int num607 = 16; + float num608 = 2f; + int num609 = 150; + int num610 = 42; - if (projectile.velocity.X != 0f) - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + if (projectile.velocity.X != 0f) + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - int num3 = projectile.frameCounter; - projectile.frameCounter = num3 + 1; - if (projectile.frameCounter > 2) - { - num3 = projectile.frame; - projectile.frame = num3 + 1; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - projectile.frame = 0; + int num3 = projectile.frameCounter; + projectile.frameCounter = num3 + 1; + if (projectile.frameCounter > 2) + { + num3 = projectile.frame; + projectile.frame = num3 + 1; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + projectile.frame = 0; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - projectile.position.X += (float)(projectile.width / 2); - projectile.position.Y += (float)(projectile.height / 2); - projectile.scale = ((float)(num606 + num607) - projectile.ai[1]) * num608 / (float)(num607 + num606); - projectile.width = (int)((float)num609 * projectile.scale); - projectile.height = (int)((float)num610 * projectile.scale); - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); - projectile.netUpdate = true; - } + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + projectile.position.X += (float)(projectile.width / 2); + projectile.position.Y += (float)(projectile.height / 2); + projectile.scale = ((float)(num606 + num607) - projectile.ai[1]) * num608 / (float)(num607 + num606); + projectile.width = (int)((float)num609 * projectile.scale); + projectile.height = (int)((float)num610 * projectile.scale); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); + projectile.netUpdate = true; + } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num606 + num607) - projectile.ai[1]) * num608 / (float)(num607 + num606); - projectile.width = (int)((float)num609 * projectile.scale); - projectile.height = (int)((float)num610 * projectile.scale); - } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num606 + num607) - projectile.ai[1]) * num608 / (float)(num607 + num606); + projectile.width = (int)((float)num609 * projectile.scale); + projectile.height = (int)((float)num610 * projectile.scale); + } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - projectile.alpha = 60; + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + projectile.alpha = 60; - if (projectile.alpha < 100) - projectile.alpha = 100; - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - projectile.alpha = 150; - } + if (projectile.alpha < 100) + projectile.alpha = 100; + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + projectile.alpha = 150; + } - if (projectile.ai[0] > 0f) - projectile.ai[0] -= 1f; + if (projectile.ai[0] > 0f) + projectile.ai[0] -= 1f; - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num610 * projectile.scale / 2f; + Vector2 center = projectile.Center; + center.Y -= (float)num610 * projectile.scale / 2f; - float num611 = ((float)(num606 + num607) - projectile.ai[1] + 1f) * num608 / (float)(num607 + num606); - center.Y -= (float)num610 * num611 / 2f; - center.Y += 2f; + float num611 = ((float)(num606 + num607) - projectile.ai[1] + 1f) * num608 / (float)(num607 + num606); + center.Y -= (float)num610 * num611 / 2f; + center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) - { - int num614 = NPC.NewNPC((int)center.X, (int)center.Y, NPCID.Sharkron2, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num614].velocity = projectile.velocity; - Main.npc[num614].scale = 1.5f; - Main.npc[num614].netUpdate = true; - Main.npc[num614].ai[2] = (float)projectile.width; - Main.npc[num614].ai[3] = -1.5f; - } - } + if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) + { + int num614 = NPC.NewNPC((int)center.X, (int)center.Y, NPCID.Sharkron2, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num614].velocity = projectile.velocity; + Main.npc[num614].scale = 1.5f; + Main.npc[num614].netUpdate = true; + Main.npc[num614].ai[2] = (float)projectile.width; + Main.npc[num614].ai[3] = -1.5f; + } + } - if (projectile.ai[0] <= 0f) - { - float num615 = 0.104719758f; - float num616 = ((float)projectile.width / 5f) * 2.5f; - float num617 = (float)(Math.Cos((double)(num615 * -(double)projectile.ai[0])) - 0.5) * num616; + if (projectile.ai[0] <= 0f) + { + float num615 = 0.104719758f; + float num616 = ((float)projectile.width / 5f) * 2.5f; + float num617 = (float)(Math.Cos((double)(num615 * -(double)projectile.ai[0])) - 0.5) * num616; - projectile.position.X -= num617 * (float)(-(float)projectile.direction); + projectile.position.X -= num617 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; + projectile.ai[0] -= 1f; - num617 = (float)(Math.Cos((double)(num615 * -(double)projectile.ai[0])) - 0.5) * num616; - projectile.position.X += num617 * (float)(-(float)projectile.direction); - } - return false; - } + num617 = (float)(Math.Cos((double)(num615 * -(double)projectile.ai[0])) - 0.5) * num616; + projectile.position.X += num617 * (float)(-(float)projectile.direction); + } + return false; + } - // Moon Lord Deathray - else if (projectile.type == ProjectileID.PhantasmalDeathray) - { - Vector2? vector78 = null; + // Moon Lord Deathray + else if (projectile.type == ProjectileID.PhantasmalDeathray) + { + Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHead) - { - Vector2 value21 = new Vector2(27f, 59f); - Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); - projectile.position = Main.npc[(int)projectile.ai[1]].Center + value22 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } + if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHead) + { + Vector2 value21 = new Vector2(27f, 59f); + Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); + projectile.position = Main.npc[(int)projectile.ai[1]].Center + value22 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); - } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); + } - float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) - { - projectile.Kill(); - return false; - } + float num801 = 1f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 180f) + { + projectile.Kill(); + return false; + } - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / 180f)) * 10f * num801; - if (projectile.scale > num801) - { - projectile.scale = num801; - } + projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / 180f)) * 10f * num801; + if (projectile.scale > num801) + { + projectile.scale = num801; + } - float num804 = projectile.velocity.ToRotation(); - num804 += projectile.ai[0]; - projectile.rotation = num804 - 1.57079637f; - projectile.velocity = num804.ToRotationVector2(); + float num804 = projectile.velocity.ToRotation(); + num804 += projectile.ai[0]; + projectile.rotation = num804 - 1.57079637f; + projectile.velocity = num804.ToRotationVector2(); - float num805 = 3f; - float num806 = (float)projectile.width; + float num805 = 3f; + float num806 = (float)projectile.width; - Vector2 samplingPoint = projectile.Center; - if (vector78.HasValue) - { - samplingPoint = vector78.Value; - } + Vector2 samplingPoint = projectile.Center; + if (vector78.HasValue) + { + samplingPoint = vector78.Value; + } - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); - float num807 = 0f; - int num3; - for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) - { - num807 += array3[num808]; - num3 = num808; - } - num807 /= num805; + float[] array3 = new float[(int)num805]; + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + float num807 = 0f; + int num3; + for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) + { + num807 += array3[num808]; + num3 = num808; + } + num807 /= num805; - // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1) && - Main.npc[(int)projectile.ai[1]].Calamity().newAI[0] == 1f) - { - num807 = 2400f; - } + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1) && + Main.npc[(int)projectile.ai[1]].Calamity().newAI[0] == 1f) + { + num807 = 2400f; + } - float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); - Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); - for (int num809 = 0; num809 < 2; num809 = num3 + 1) - { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; - float num811 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); - int num812 = Dust.NewDust(vector79, 0, 0, 229, vector80.X, vector80.Y, 0, default, 1f); - Main.dust[num812].noGravity = true; - Main.dust[num812].scale = 1.7f; - num3 = num809; - } - if (Main.rand.Next(5) == 0) - { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num813]; - dust.velocity *= 0.5f; - Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); - } - DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + float amount = 0.5f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); + Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + for (int num809 = 0; num809 < 2; num809 = num3 + 1) + { + float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num811 = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); + int num812 = Dust.NewDust(vector79, 0, 0, 229, vector80.X, vector80.Y, 0, default, 1f); + Main.dust[num812].noGravity = true; + Main.dust[num812].scale = 1.7f; + num3 = num809; + } + if (Main.rand.Next(5) == 0) + { + Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[num813]; + dust.velocity *= 0.5f; + Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); + } + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - return false; - } - } - return true; - } - #endregion + return false; + } + } + return true; + } + #endregion - #region AI - public override void AI(Projectile projectile) - { - if (defDamage == 0) - defDamage = projectile.damage; + #region AI + public override void AI(Projectile projectile) + { + if (defDamage == 0) + defDamage = projectile.damage; - if (NPC.downedMoonlord) - { - if (CalamityMod.dungeonProjectileBuffList.Contains(projectile.type)) - { - if ((projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] == 1f) || - (NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast))) - { - projectile.damage = defDamage; - } - else - projectile.damage = defDamage + 60; - } - } + if (NPC.downedMoonlord) + { + if (CalamityMod.dungeonProjectileBuffList.Contains(projectile.type)) + { + if ((projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] == 1f) || + (NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast))) + { + projectile.damage = defDamage; + } + else + projectile.damage = defDamage + 60; + } + } - if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon)) - { - if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) - projectile.damage = defDamage + 90; - } - else if (CalamityWorld.buffedEclipse && Main.eclipse) - { - if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) - projectile.damage = defDamage + 120; - } + if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon)) + { + if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) + projectile.damage = defDamage + 90; + } + else if (CalamityWorld.buffedEclipse && Main.eclipse) + { + if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) + projectile.damage = defDamage + 120; + } - // Iron Heart damage variable will scale with projectile.damage - if (CalamityWorld.ironHeart) - { - ironHeartDamage = 0; - } + // Iron Heart damage variable will scale with projectile.damage + if (CalamityWorld.ironHeart) + { + ironHeartDamage = 0; + } - if (projectile.modProjectile != null && projectile.modProjectile.mod.Name.Equals("CalamityMod")) - goto SKIP_CALAMITY; + if (projectile.modProjectile != null && projectile.modProjectile.mod.Name.Equals("CalamityMod")) + goto SKIP_CALAMITY; - if ((projectile.minion || projectile.sentry) && !ProjectileID.Sets.StardustDragon[projectile.type]) //For all other mods and vanilla, exclude dragon due to bugs - { - if (setDamageValues) - { - spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - spawnedPlayerMinionProjectileDamageValue = projectile.damage; - setDamageValues = false; - } - if (Main.player[projectile.owner].minionDamage != spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - } - SKIP_CALAMITY: + if ((projectile.minion || projectile.sentry) && !ProjectileID.Sets.StardustDragon[projectile.type]) //For all other mods and vanilla, exclude dragon due to bugs + { + if (setDamageValues) + { + spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + spawnedPlayerMinionProjectileDamageValue = projectile.damage; + setDamageValues = false; + } + if (Main.player[projectile.owner].minionDamage != spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + } + SKIP_CALAMITY: - if (forceMelee) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = true; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - rogue = false; - } - else if (forceRanged) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = true; - projectile.magic = false; - projectile.minion = false; - rogue = false; - } - else if (forceMagic) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = true; - projectile.minion = false; - rogue = false; - } - else if (forceRogue) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - rogue = true; - } - else if (forceMinion) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = true; - rogue = false; - } - else if (forceHostile) - { - projectile.hostile = true; - projectile.friendly = false; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - rogue = false; - } + if (forceMelee) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = true; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + rogue = false; + } + else if (forceRanged) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = true; + projectile.magic = false; + projectile.minion = false; + rogue = false; + } + else if (forceMagic) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = true; + projectile.minion = false; + rogue = false; + } + else if (forceRogue) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + rogue = true; + } + else if (forceMinion) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = true; + rogue = false; + } + else if (forceHostile) + { + projectile.hostile = true; + projectile.friendly = false; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + rogue = false; + } - if (projectile.type == ProjectileID.NettleBurstRight || projectile.type == ProjectileID.NettleBurstLeft || projectile.type == ProjectileID.NettleBurstEnd) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("ThornBlossom")) - projectile.penetrate = 1; - } - else if (projectile.type == ProjectileID.VilethornBase || projectile.type == ProjectileID.VilethornTip) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("FeralthornClaymore")) - { - projectile.melee = true; - projectile.magic = false; - projectile.penetrate = 1; - } - } - else if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee) - { - if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == ItemID.BeesKnees) - { - projectile.magic = false; - projectile.ranged = true; - } - } - } - else if (projectile.type == ProjectileID.FallingStar) - projectile.ranged = true; - else if (projectile.type == ProjectileID.SoulDrain) - projectile.magic = true; + if (projectile.type == ProjectileID.NettleBurstRight || projectile.type == ProjectileID.NettleBurstLeft || projectile.type == ProjectileID.NettleBurstEnd) + { + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("ThornBlossom")) + projectile.penetrate = 1; + } + else if (projectile.type == ProjectileID.VilethornBase || projectile.type == ProjectileID.VilethornTip) + { + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("FeralthornClaymore")) + { + projectile.melee = true; + projectile.magic = false; + projectile.penetrate = 1; + } + } + else if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee) + { + if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 + { + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == ItemID.BeesKnees) + { + projectile.magic = false; + projectile.ranged = true; + } + } + } + else if (projectile.type == ProjectileID.FallingStar) + projectile.ranged = true; + else if (projectile.type == ProjectileID.SoulDrain) + projectile.magic = true; - if (Main.player[projectile.owner].Calamity().eQuiver && projectile.ranged && - projectile.friendly && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x)) - { - if (Main.rand.Next(200) > 198) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - if (projectile.owner == Main.myPlayer) - { - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(startAngle) * 8f), (float)(Math.Cos(startAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(startAngle) * 8f), (float)(-Math.Cos(startAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].ranged = false; - Main.projectile[projectile2].ranged = false; - Main.projectile[projectile1].timeLeft = 60; - Main.projectile[projectile2].timeLeft = 60; - Main.projectile[projectile1].noDropItem = true; - Main.projectile[projectile2].noDropItem = true; - } - } - } + if (Main.player[projectile.owner].Calamity().eQuiver && projectile.ranged && + projectile.friendly && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x)) + { + if (Main.rand.Next(200) > 198) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + if (projectile.owner == Main.myPlayer) + { + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(startAngle) * 8f), (float)(Math.Cos(startAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(startAngle) * 8f), (float)(-Math.Cos(startAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].ranged = false; + Main.projectile[projectile2].ranged = false; + Main.projectile[projectile1].timeLeft = 60; + Main.projectile[projectile2].timeLeft = 60; + Main.projectile[projectile1].noDropItem = true; + Main.projectile[projectile2].noDropItem = true; + } + } + } - if (Main.player[projectile.owner].Calamity().fungalSymbiote && trueMelee) - { - counter++; - if (counter >= 6) - { - counter = 0; - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ProjectileID.Mushroom] < 30) - { - if (projectile.type == mod.ProjectileType("Nebulash") || projectile.type == mod.ProjectileType("CosmicDischarge") || - projectile.type == mod.ProjectileType("Mourningstar") || projectile.type == ProjectileID.SolarWhipSword) - { - Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; - if (Main.player[projectile.owner].direction != 1) - { - vector24.X = (float)Main.player[projectile.owner].bodyFrame.Width - vector24.X; - } - if (Main.player[projectile.owner].gravDir != 1f) - { - vector24.Y = (float)Main.player[projectile.owner].bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(Main.player[projectile.owner].bodyFrame.Width - Main.player[projectile.owner].width), (float)(Main.player[projectile.owner].bodyFrame.Height - 42)) / 2f; - Vector2 newCenter = Main.player[projectile.owner].RotatedRelativePoint(Main.player[projectile.owner].position + vector24, true) + projectile.velocity; - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, - (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - else - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileID.Mushroom, - (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - } - } - } + if (Main.player[projectile.owner].Calamity().fungalSymbiote && trueMelee) + { + counter++; + if (counter >= 6) + { + counter = 0; + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ProjectileID.Mushroom] < 30) + { + if (projectile.type == mod.ProjectileType("Nebulash") || projectile.type == mod.ProjectileType("CosmicDischarge") || + projectile.type == mod.ProjectileType("Mourningstar") || projectile.type == ProjectileID.SolarWhipSword) + { + Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; + if (Main.player[projectile.owner].direction != 1) + { + vector24.X = (float)Main.player[projectile.owner].bodyFrame.Width - vector24.X; + } + if (Main.player[projectile.owner].gravDir != 1f) + { + vector24.Y = (float)Main.player[projectile.owner].bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(Main.player[projectile.owner].bodyFrame.Width - Main.player[projectile.owner].width), (float)(Main.player[projectile.owner].bodyFrame.Height - 42)) / 2f; + Vector2 newCenter = Main.player[projectile.owner].RotatedRelativePoint(Main.player[projectile.owner].position + vector24, true) + projectile.velocity; + Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, + (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + else + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileID.Mushroom, + (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + } + } + } - if (Main.player[projectile.owner].Calamity().nanotech && rogue && projectile.friendly) - { - counter++; - if (counter >= 30) - { - counter = 0; - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("Nanotech")] < 30) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Nanotech"), - (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); - } - } - } + if (Main.player[projectile.owner].Calamity().nanotech && rogue && projectile.friendly) + { + counter++; + if (counter >= 30) + { + counter = 0; + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("Nanotech")] < 30) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Nanotech"), + (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + } + } + } - if (Main.player[projectile.owner].Calamity().daedalusSplit && rogue && projectile.friendly) - { - counter2++; - if (counter2 >= 30) - { - counter2 = 0; - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[90] < 30) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 90, (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - Main.projectile[shard].ranged = false; - } - } - } - } + if (Main.player[projectile.owner].Calamity().daedalusSplit && rogue && projectile.friendly) + { + counter2++; + if (counter2 >= 30) + { + counter2 = 0; + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[90] < 30) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int shard = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 90, (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Main.projectile[shard].ranged = false; + } + } + } + } - if (Main.player[projectile.owner].Calamity().theBeeDamage > 0 && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && - (projectile.melee || projectile.ranged || projectile.magic || rogue)) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); - Main.dust[dust].noGravity = true; - } + if (Main.player[projectile.owner].Calamity().theBeeDamage > 0 && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && + (projectile.melee || projectile.ranged || projectile.magic || rogue)) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); + Main.dust[dust].noGravity = true; + } - if (Main.player[projectile.owner].Calamity().providenceLore && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && - (projectile.melee || projectile.ranged || projectile.magic || rogue)) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); - Main.dust[dust].noGravity = true; - } + if (Main.player[projectile.owner].Calamity().providenceLore && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && + (projectile.melee || projectile.ranged || projectile.magic || rogue)) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); + Main.dust[dust].noGravity = true; + } if (rogue) { @@ -644,573 +642,573 @@ namespace CalamityMod.Projectiles } } } - } - #endregion + } + #endregion - #region PostAI - public override void PostAI(Projectile projectile) - { - int x = (int)(projectile.Center.X / 16f); - int y = (int)(projectile.Center.Y / 16f); - for (int i = x - 1; i <= x + 1; i++) - { - for (int j = y - 1; j <= y + 1; j++) - { - if (projectile.type == ProjectileID.PureSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); - } - if (projectile.type == ProjectileID.CorruptSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); - } - if (projectile.type == ProjectileID.CrimsonSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); - } - if (projectile.type == ProjectileID.HallowSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); - } - } - } - } - #endregion + #region PostAI + public override void PostAI(Projectile projectile) + { + int x = (int)(projectile.Center.X / 16f); + int y = (int)(projectile.Center.Y / 16f); + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 1; j <= y + 1; j++) + { + if (projectile.type == ProjectileID.PureSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); + } + if (projectile.type == ProjectileID.CorruptSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); + } + if (projectile.type == ProjectileID.CrimsonSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); + } + if (projectile.type == ProjectileID.HallowSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); + } + } + } + } + #endregion - #region OnHitNPC - public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - if (projectile.magic && Main.player[projectile.owner].ghostHeal) - { - float num = 0.1f; - num -= (float)projectile.numHits * 0.05f; - if (num < 0f) - { - num = 0f; - } - float num2 = (float)damage * num; - Main.player[Main.myPlayer].lifeSteal -= num2; - } + #region OnHitNPC + public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + if (projectile.magic && Main.player[projectile.owner].ghostHeal) + { + float num = 0.1f; + num -= (float)projectile.numHits * 0.05f; + if (num < 0f) + { + num = 0f; + } + float num2 = (float)damage * num; + Main.player[Main.myPlayer].lifeSteal -= num2; + } - if (projectile.type == ProjectileID.VampireKnife) - { - float num = (float)damage * 0.0375f; - if (num < 0f) - { - num = 0f; - } - Main.player[Main.myPlayer].lifeSteal -= num; - } + if (projectile.type == ProjectileID.VampireKnife) + { + float num = (float)damage * 0.0375f; + if (num < 0f) + { + num = 0f; + } + Main.player[Main.myPlayer].lifeSteal -= num; + } - if (Main.player[projectile.owner].Calamity().alchFlask && - (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) && - Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("PlagueSeeker")] < 6) - { - int newDamage = (int)((double)projectile.damage * 0.25); - if (newDamage > 30) - { - newDamage = 30; - } - int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueSeeker"), newDamage, 0f, projectile.owner, 0f, 0f); - Main.projectile[plague].melee = false; - } + if (Main.player[projectile.owner].Calamity().alchFlask && + (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) && + Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("PlagueSeeker")] < 6) + { + int newDamage = (int)((double)projectile.damage * 0.25); + if (newDamage > 30) + { + newDamage = 30; + } + int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueSeeker"), newDamage, 0f, projectile.owner, 0f, 0f); + Main.projectile[plague].melee = false; + } - if (Main.player[projectile.owner].Calamity().reaverBlast && projectile.melee) - { - int newDamage = (int)((double)projectile.damage * 0.2); - if (newDamage > 30) - { - newDamage = 30; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ReaverBlast"), newDamage, 0f, projectile.owner, 0f, 0f); - } + if (Main.player[projectile.owner].Calamity().reaverBlast && projectile.melee) + { + int newDamage = (int)((double)projectile.damage * 0.2); + if (newDamage > 30) + { + newDamage = 30; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ReaverBlast"), newDamage, 0f, projectile.owner, 0f, 0f); + } - if (Main.player[projectile.owner].Calamity().auricSet && target.canGhostHeal) - { - float num11 = 0.05f; - num11 -= (float)projectile.numHits * 0.025f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AuricOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - else if (Main.player[projectile.owner].Calamity().silvaSet && target.canGhostHeal) - { - float num11 = 0.03f; - num11 -= (float)projectile.numHits * 0.015f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SilvaOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } + if (Main.player[projectile.owner].Calamity().auricSet && target.canGhostHeal) + { + float num11 = 0.05f; + num11 -= (float)projectile.numHits * 0.025f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AuricOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + else if (Main.player[projectile.owner].Calamity().silvaSet && target.canGhostHeal) + { + float num11 = 0.03f; + num11 -= (float)projectile.numHits * 0.015f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SilvaOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } - if (projectile.magic) - { - if (Main.player[projectile.owner].Calamity().silvaMage && projectile.penetrate == 1 && Main.rand.Next(0, 100) >= 97) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.damage *= (Main.player[projectile.owner].Calamity().auricSet ? 7 : 4); - projectile.Damage(); - } + if (projectile.magic) + { + if (Main.player[projectile.owner].Calamity().silvaMage && projectile.penetrate == 1 && Main.rand.Next(0, 100) >= 97) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); + for (int num193 = 0; num193 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.damage *= (Main.player[projectile.owner].Calamity().auricSet ? 7 : 4); + projectile.Damage(); + } - if (Main.player[projectile.owner].Calamity().tarraMage && target.canGhostHeal) - { - if (Main.player[projectile.owner].Calamity().tarraMageHealCooldown <= 0) - { - Main.player[projectile.owner].Calamity().tarraMageHealCooldown = 90; - float num11 = 0.03f; - num11 -= (float)projectile.numHits * 0.015f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - int healAmount = (Main.player[projectile.owner].Calamity().auricSet ? projectile.damage / 100 : projectile.damage / 50); - Player player = Main.player[projectile.owner]; - player.statLife += healAmount; - player.HealEffect(healAmount); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - } - } + if (Main.player[projectile.owner].Calamity().tarraMage && target.canGhostHeal) + { + if (Main.player[projectile.owner].Calamity().tarraMageHealCooldown <= 0) + { + Main.player[projectile.owner].Calamity().tarraMageHealCooldown = 90; + float num11 = 0.03f; + num11 -= (float)projectile.numHits * 0.015f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + int healAmount = (Main.player[projectile.owner].Calamity().auricSet ? projectile.damage / 100 : projectile.damage / 50); + Player player = Main.player[projectile.owner]; + player.statLife += healAmount; + player.HealEffect(healAmount); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + } + } - if (Main.player[projectile.owner].Calamity().reaverBurst) - { - int num251 = Main.rand.Next(2, 5); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int newDamage = (int)((double)projectile.damage * 0.15); - if (newDamage > 15) - { - newDamage = 15; - } - int proj = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), newDamage, 0f, projectile.owner, 0f, 0f); - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; - } - } - else if (Main.player[projectile.owner].Calamity().ataxiaMage && Main.player[projectile.owner].Calamity().ataxiaDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].Calamity().ataxiaDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 20f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("AtaxiaOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); - if (target.canGhostHeal) - { - float num11 = 0.1f; //0.2 - num11 -= (float)projectile.numHits * 0.05f; //0.05 - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AtaxiaHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - } - else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].Calamity().xerocDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 30f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); - if (target.canGhostHeal) - { - float num11 = 0.1f; - num11 -= (float)projectile.numHits * 0.05f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - } - else if (Main.player[projectile.owner].Calamity().godSlayerMage && Main.player[projectile.owner].Calamity().godSlayerDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].Calamity().godSlayerDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 20f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerOrb"), - (int)((double)num * (Main.player[projectile.owner].Calamity().auricSet ? 2.0 : 1.5)), 0f, projectile.owner, (float)num6, 0f); - if (target.canGhostHeal) - { - float num11 = (Main.player[projectile.owner].Calamity().auricSet ? 0.03f : 0.06f); //0.2 - num11 -= (float)projectile.numHits * 0.015f; //0.05 - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - } - } - else if (projectile.melee) - { - if (Main.player[projectile.owner].Calamity().ataxiaGeyser && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) - { - int newDamage = (int)((double)projectile.damage * 0.15); - if (newDamage > 35) - { - newDamage = 35; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), newDamage, 0f, projectile.owner, 0f, 0f); - } - else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocBlast")] < 3) - { - int newDamage = (int)((double)projectile.damage * 0.2); - if (newDamage > 40) - { - newDamage = 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocBlast"), newDamage, 0f, projectile.owner, 0f, 0f); - } - } - else if (projectile.ranged) - { - if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocFire")] < 3) - { - int newDamage = (int)((double)projectile.damage * 0.15); - if (newDamage > 40) - { - newDamage = 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocFire"), newDamage, 0f, projectile.owner, 0f, 0f); - } - } - else if (rogue) - { - if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].Calamity().xerocDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = Main.rand.Next(15, 30); - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocStar"), (int)((double)num * 1.6), 0f, projectile.owner, (float)num6, 0f); - } + if (Main.player[projectile.owner].Calamity().reaverBurst) + { + int num251 = Main.rand.Next(2, 5); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int newDamage = (int)((double)projectile.damage * 0.15); + if (newDamage > 15) + { + newDamage = 15; + } + int proj = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), newDamage, 0f, projectile.owner, 0f, 0f); + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } + } + else if (Main.player[projectile.owner].Calamity().ataxiaMage && Main.player[projectile.owner].Calamity().ataxiaDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].Calamity().ataxiaDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 20f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("AtaxiaOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); + if (target.canGhostHeal) + { + float num11 = 0.1f; //0.2 + num11 -= (float)projectile.numHits * 0.05f; //0.05 + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AtaxiaHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + } + else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].Calamity().xerocDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 30f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); + if (target.canGhostHeal) + { + float num11 = 0.1f; + num11 -= (float)projectile.numHits * 0.05f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + } + else if (Main.player[projectile.owner].Calamity().godSlayerMage && Main.player[projectile.owner].Calamity().godSlayerDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].Calamity().godSlayerDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 20f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerOrb"), + (int)((double)num * (Main.player[projectile.owner].Calamity().auricSet ? 2.0 : 1.5)), 0f, projectile.owner, (float)num6, 0f); + if (target.canGhostHeal) + { + float num11 = (Main.player[projectile.owner].Calamity().auricSet ? 0.03f : 0.06f); //0.2 + num11 -= (float)projectile.numHits * 0.015f; //0.05 + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + } + } + else if (projectile.melee) + { + if (Main.player[projectile.owner].Calamity().ataxiaGeyser && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) + { + int newDamage = (int)((double)projectile.damage * 0.15); + if (newDamage > 35) + { + newDamage = 35; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), newDamage, 0f, projectile.owner, 0f, 0f); + } + else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocBlast")] < 3) + { + int newDamage = (int)((double)projectile.damage * 0.2); + if (newDamage > 40) + { + newDamage = 40; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocBlast"), newDamage, 0f, projectile.owner, 0f, 0f); + } + } + else if (projectile.ranged) + { + if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocFire")] < 3) + { + int newDamage = (int)((double)projectile.damage * 0.15); + if (newDamage > 40) + { + newDamage = 40; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocFire"), newDamage, 0f, projectile.owner, 0f, 0f); + } + } + else if (rogue) + { + if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].Calamity().xerocDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = Main.rand.Next(15, 30); + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocStar"), (int)((double)num * 1.6), 0f, projectile.owner, (float)num6, 0f); + } if (Main.player[projectile.owner].Calamity().featherCrown && stealthStrike) { @@ -1237,324 +1235,324 @@ namespace CalamityMod.Projectiles } } } - else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) - { - if (Main.player[projectile.owner].Calamity().pArtifact) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } + else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) + { + if (Main.player[projectile.owner].Calamity().pArtifact) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } - if (Main.player[projectile.owner].Calamity().tearMinions) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 60); - } + if (Main.player[projectile.owner].Calamity().tearMinions) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 60); + } - if (Main.player[projectile.owner].Calamity().shadowMinions) - { - target.AddBuff(BuffID.ShadowFlame, 300); - } + if (Main.player[projectile.owner].Calamity().shadowMinions) + { + target.AddBuff(BuffID.ShadowFlame, 300); + } - if (Main.player[projectile.owner].Calamity().godSlayerSummon && Main.player[projectile.owner].Calamity().godSlayerDmg <= 0) - { - int num = projectile.damage / 2; - float ai1 = (Main.rand.NextFloat() + 0.5f); - Main.player[projectile.owner].Calamity().godSlayerDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 15f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerPhantom"), (int)((double)num * 2.0), 0f, projectile.owner, 0f, ai1); - } - else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].Calamity().xerocDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 15f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocBubble"), (int)((double)num * 1.2), 0f, projectile.owner, (float)num6, 0f); - } - } - } - } - #endregion + if (Main.player[projectile.owner].Calamity().godSlayerSummon && Main.player[projectile.owner].Calamity().godSlayerDmg <= 0) + { + int num = projectile.damage / 2; + float ai1 = (Main.rand.NextFloat() + 0.5f); + Main.player[projectile.owner].Calamity().godSlayerDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 15f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerPhantom"), (int)((double)num * 2.0), 0f, projectile.owner, 0f, ai1); + } + else if (Main.player[projectile.owner].Calamity().xerocSet && Main.player[projectile.owner].Calamity().xerocDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].Calamity().xerocDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 15f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocBubble"), (int)((double)num * 1.2), 0f, projectile.owner, (float)num6, 0f); + } + } + } + } + #endregion - #region CanDamage - public override bool CanDamage(Projectile projectile) - { - switch (projectile.type) - { - case ProjectileID.Sharknado: - if (projectile.timeLeft > 420) - return false; - break; + #region CanDamage + public override bool CanDamage(Projectile projectile) + { + switch (projectile.type) + { + case ProjectileID.Sharknado: + if (projectile.timeLeft > 420) + return false; + break; - case ProjectileID.Cthulunado: - if (projectile.timeLeft > 720) - return false; - break; + case ProjectileID.Cthulunado: + if (projectile.timeLeft > 720) + return false; + break; - default: - break; - } - return true; - } - #endregion + default: + break; + } + return true; + } + #endregion - #region Drawing - public override Color? GetAlpha(Projectile projectile, Color lightColor) - { - if (Main.player[Main.myPlayer].Calamity().trippy) - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + #region Drawing + public override Color? GetAlpha(Projectile projectile, Color lightColor) + { + if (Main.player[Main.myPlayer].Calamity().trippy) + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - if (projectile.type == ProjectileID.PinkLaser) - { - if (projectile.alpha < 200) - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + if (projectile.type == ProjectileID.PinkLaser) + { + if (projectile.alpha < 200) + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - return Color.Transparent; - } + return Color.Transparent; + } - return null; - } + return null; + } - public override bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) - { - if (Main.player[Main.myPlayer].Calamity().trippy) - { - Texture2D texture = Main.projectileTexture[projectile.type]; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - float num66 = 0f; - Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.projFrames[projectile.type] / 2)); - Microsoft.Xna.Framework.Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - Microsoft.Xna.Framework.Color alpha15 = projectile.GetAlpha(color9); - float num212 = 0.99f; - alpha15.R = (byte)((float)alpha15.R * num212); - alpha15.G = (byte)((float)alpha15.G * num212); - alpha15.B = (byte)((float)alpha15.B * num212); - alpha15.A = (byte)((float)alpha15.A * num212); - for (int num213 = 0; num213 < 4; num213++) - { - Vector2 position9 = projectile.position; - float num214 = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); - float num215 = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); - if (num213 == 0 || num213 == 2) - { - position9.X = Main.player[Main.myPlayer].Center.X + num214; - } - else - { - position9.X = Main.player[Main.myPlayer].Center.X - num214; - } - position9.X -= (float)(projectile.width / 2); - if (num213 == 0 || num213 == 1) - { - position9.Y = Main.player[Main.myPlayer].Center.Y + num215; - } - else - { - position9.Y = Main.player[Main.myPlayer].Center.Y - num215; - } - int frames = texture.Height / Main.projFrames[projectile.type]; - int y = frames * projectile.frame; - position9.Y -= (float)(projectile.height / 2); - Main.spriteBatch.Draw(texture, - new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + num66 + projectile.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); - } - } - return true; - } + public override bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) + { + if (Main.player[Main.myPlayer].Calamity().trippy) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + float num66 = 0f; + Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.projFrames[projectile.type] / 2)); + Microsoft.Xna.Framework.Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Microsoft.Xna.Framework.Color alpha15 = projectile.GetAlpha(color9); + float num212 = 0.99f; + alpha15.R = (byte)((float)alpha15.R * num212); + alpha15.G = (byte)((float)alpha15.G * num212); + alpha15.B = (byte)((float)alpha15.B * num212); + alpha15.A = (byte)((float)alpha15.A * num212); + for (int num213 = 0; num213 < 4; num213++) + { + Vector2 position9 = projectile.position; + float num214 = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); + float num215 = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (num213 == 0 || num213 == 2) + { + position9.X = Main.player[Main.myPlayer].Center.X + num214; + } + else + { + position9.X = Main.player[Main.myPlayer].Center.X - num214; + } + position9.X -= (float)(projectile.width / 2); + if (num213 == 0 || num213 == 1) + { + position9.Y = Main.player[Main.myPlayer].Center.Y + num215; + } + else + { + position9.Y = Main.player[Main.myPlayer].Center.Y - num215; + } + int frames = texture.Height / Main.projFrames[projectile.type]; + int y = frames * projectile.frame; + position9.Y -= (float)(projectile.height / 2); + Main.spriteBatch.Draw(texture, + new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + num66 + projectile.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); + } + } + return true; + } - public static void DrawCenteredAndAfterimage(Projectile projectile, Color lightColor, int trailingMode, int afterimageCounter, Texture2D texture = null) - { - if (texture == null) - texture = Main.projectileTexture[projectile.type]; + public static void DrawCenteredAndAfterimage(Projectile projectile, Color lightColor, int trailingMode, int afterimageCounter, Texture2D texture = null) + { + if (texture == null) + texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int frameY = frameHeight * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight); + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; - if (Lighting.NotRetro) - { - switch (trailingMode) - { - case 0: - for (int i = 0; i < projectile.oldPos.Length; i++) - { - Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); - } - break; + if (Lighting.NotRetro) + { + switch (trailingMode) + { + case 0: + for (int i = 0; i < projectile.oldPos.Length; i++) + { + Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); + } + break; - case 1: - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - int num157 = 8; - int num161 = 1; - while (num161 < num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - goto IL_6899; - IL_6881: - num161 += afterimageCounter; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Main.spriteBatch.Draw(texture, projectile.oldPos[num161] + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); - goto IL_6881; - } - break; + case 1: + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); + int num157 = 8; + int num161 = 1; + while (num161 < num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + goto IL_6899; + IL_6881: + num161 += afterimageCounter; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Main.spriteBatch.Draw(texture, projectile.oldPos[num161] + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); + goto IL_6881; + } + break; - default: - break; - } - } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); - } - #endregion + default: + break; + } + } + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, frameY, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + } + #endregion - #region Kill - public override void Kill(Projectile projectile, int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - if (Main.player[projectile.owner].Calamity().providenceLore && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int i = 0; i < 3; i++) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); - Main.dust[dust].noGravity = true; - } - } + #region Kill + public override void Kill(Projectile projectile, int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + if (Main.player[projectile.owner].Calamity().providenceLore && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int i = 0; i < 3; i++) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + Main.dust[dust].noGravity = true; + } + } - if (projectile.ranged) - { - if (Main.player[projectile.owner].Calamity().tarraRanged && Main.rand.Next(0, 100) >= 88) - { - int num251 = Main.rand.Next(2, 4); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int newDamage = (int)((double)projectile.damage * 0.33); - if (newDamage > 65) - { - newDamage = 65; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("TarraEnergy"), newDamage, 0f, projectile.owner, 0f, 0f); - } - } - } - } - } - #endregion + if (projectile.ranged) + { + if (Main.player[projectile.owner].Calamity().tarraRanged && Main.rand.Next(0, 100) >= 88) + { + int num251 = Main.rand.Next(2, 4); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int newDamage = (int)((double)projectile.damage * 0.33); + if (newDamage > 65) + { + newDamage = 65; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("TarraEnergy"), newDamage, 0f, projectile.owner, 0f, 0f); + } + } + } + } + } + #endregion - #region CanHit - public override bool CanHitPlayer(Projectile projectile, Player target) - { - if (projectile.type == ProjectileID.CultistBossLightningOrb) - { - return false; - } - return true; - } - #endregion - } + #region CanHit + public override bool CanHitPlayer(Projectile projectile, Player target) + { + if (projectile.type == ProjectileID.CultistBossLightningOrb) + { + return false; + } + return true; + } + #endregion + } } diff --git a/Projectiles/Enemy/AstralShot.cs b/Projectiles/Enemy/AstralShot.cs index e992ccf0f9..b36609ffc9 100644 --- a/Projectiles/Enemy/AstralShot.cs +++ b/Projectiles/Enemy/AstralShot.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Enemy { public class AstralShot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } public override void SetDefaults() { @@ -26,76 +26,76 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 30f; - float num56 = 1f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 30f; + float num56 = 1f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 100, 255, 0); + return new Color(255, 100, 255, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 1f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 30f; + float scaleFactor = 1f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } } } diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index b3661edf2e..8f6730b379 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Enemy { public class CrimsonSpike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } public override void SetDefaults() { @@ -25,40 +25,40 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { if (projectile.alpha == 0 && Main.rand.NextBool(3)) - { - int num67 = Dust.NewDust(projectile.position - projectile.velocity * 3f, projectile.width, projectile.height, 260, 0f, 0f, 50, new Color(255, 136, 78, 150), 1.2f); - Main.dust[num67].velocity *= 0.3f; - Main.dust[num67].velocity += projectile.velocity * 0.3f; - Main.dust[num67].noGravity = true; - } - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 17); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) - { - projectile.ai[0] = 5f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - } + { + int num67 = Dust.NewDust(projectile.position - projectile.velocity * 3f, projectile.width, projectile.height, 260, 0f, 0f, 50, new Color(255, 136, 78, 150), 1.2f); + Main.dust[num67].velocity *= 0.3f; + Main.dust[num67].velocity += projectile.velocity * 0.3f; + Main.dust[num67].noGravity = true; + } + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 17); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 5f) + { + projectile.ai[0] = 5f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + } } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Cursed, 60); + target.AddBuff(BuffID.Cursed, 60); } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 260, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 260, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 2e08f9a842..aae6a646ad 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Enemy { public class EarthRockBig : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock"); + } public override void SetDefaults() { diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 3e4faab0bf..1c30e464b0 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Enemy { public class EarthRockSmall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock"); + } public override void SetDefaults() { diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index af3b5461a3..88a6d9faf3 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -6,12 +6,12 @@ namespace CalamityMod.Projectiles.Enemy { public class FlameBurstHostile : ModProjectile { - public float count = 0; + public float count = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burst"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burst"); + } public override void SetDefaults() { @@ -25,44 +25,44 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - if (count == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].velocity *= 0f; - } - } + if (count == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].velocity *= 0f; + } + } int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; if (projectile.ai[1] < 200f && projectile.ai[1] > 40f) @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Enemy { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 6fa28682bb..80bde31a8d 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Enemy { public class HorsWaterBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } public override void SetDefaults() { @@ -25,59 +25,59 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); for (int num457 = 0; num457 < 10; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - for (int dust = 0; dust <= 40; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - } + for (int dust = 0; dust <= 40; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + } } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Wet, 300); + target.AddBuff(BuffID.Wet, 300); } } } diff --git a/Projectiles/Enemy/InkBomb.cs b/Projectiles/Enemy/InkBomb.cs index 492e0ffa57..2a2da126c9 100644 --- a/Projectiles/Enemy/InkBomb.cs +++ b/Projectiles/Enemy/InkBomb.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Enemy { public class InkBomb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Bomb"); + } public override void SetDefaults() { @@ -24,21 +24,21 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y - 0.01f; - } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y - 0.01f; + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index 008e6ae3fe..d9bc656bd4 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -6,9 +6,9 @@ namespace CalamityMod.Projectiles.Enemy { public class InkPoisonCloud : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); Main.projFrames[projectile.type] = 4; } @@ -37,30 +37,30 @@ namespace CalamityMod.Projectiles.Enemy projectile.frame = 0; } projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/InkPoisonCloud2.cs b/Projectiles/Enemy/InkPoisonCloud2.cs index ac565511cb..467b45b6ec 100644 --- a/Projectiles/Enemy/InkPoisonCloud2.cs +++ b/Projectiles/Enemy/InkPoisonCloud2.cs @@ -6,9 +6,9 @@ namespace CalamityMod.Projectiles.Enemy { public class InkPoisonCloud2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); Main.projFrames[projectile.type] = 4; } @@ -37,30 +37,30 @@ namespace CalamityMod.Projectiles.Enemy projectile.frame = 0; } projectile.velocity *= 0.995f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/InkPoisonCloud3.cs b/Projectiles/Enemy/InkPoisonCloud3.cs index 66c5881e02..40b43c2d32 100644 --- a/Projectiles/Enemy/InkPoisonCloud3.cs +++ b/Projectiles/Enemy/InkPoisonCloud3.cs @@ -6,9 +6,9 @@ namespace CalamityMod.Projectiles.Enemy { public class InkPoisonCloud3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); Main.projFrames[projectile.type] = 4; } @@ -37,30 +37,30 @@ namespace CalamityMod.Projectiles.Enemy projectile.frame = 0; } projectile.velocity *= 0.999f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/LavaChunk.cs b/Projectiles/Enemy/LavaChunk.cs index 59a6b62f50..104930847b 100644 --- a/Projectiles/Enemy/LavaChunk.cs +++ b/Projectiles/Enemy/LavaChunk.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Projectiles.Enemy { public class LavaChunk : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lava Chunk"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lava Chunk"); Main.projFrames[projectile.type] = 6; } diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index 6a75be7a83..e907554bd2 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -1,84 +1,83 @@  +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - namespace CalamityMod.Projectiles.Enemy { public class MantisRing : ModProjectile - { - public override void SetStaticDefaults() - { - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.knockBack = 3f; - projectile.width = 72; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 8; - } + public override void SetDefaults() + { + projectile.knockBack = 3f; + projectile.width = 72; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = 8; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item1, projectile.Center); + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item1, projectile.Center); - for (int i = 0; i < 60; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - Vector2 angleVec = angle.ToRotationVector2(); - float distance = Main.rand.NextFloat(14f, 36f); - Vector2 off = angleVec * distance; - off.Y *= ((float)projectile.height / projectile.width); - Vector2 pos = projectile.Center + off; - Dust d = Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), angleVec * Main.rand.NextFloat(2f, 4f)); - d.customData = true; - } - } + for (int i = 0; i < 60; i++) + { + float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + Vector2 angleVec = angle.ToRotationVector2(); + float distance = Main.rand.NextFloat(14f, 36f); + Vector2 off = angleVec * distance; + off.Y *= ((float)projectile.height / projectile.width); + Vector2 pos = projectile.Center + off; + Dust d = Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), angleVec * Main.rand.NextFloat(2f, 4f)); + d.customData = true; + } + } - public override void AI() - { - projectile.velocity *= 1.01f; + public override void AI() + { + projectile.velocity *= 1.01f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame > 2) - { - projectile.frame = 0; - } - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame > 2) + { + projectile.frame = 0; + } + } - //Dust - for (int i = 0; i < 4; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - float distance = Main.rand.NextFloat(14f, 36f); - Vector2 off = angle.ToRotationVector2() * distance; - off.Y *= ((float)projectile.height / projectile.width); - Vector2 pos = projectile.Center + off; - Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), Vector2.Zero); - } - } + //Dust + for (int i = 0; i < 4; i++) + { + float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + float distance = Main.rand.NextFloat(14f, 36f); + Vector2 off = angle.ToRotationVector2() * distance; + off.Y *= ((float)projectile.height / projectile.width); + Vector2 pos = projectile.Center + off; + Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), Vector2.Zero); + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index 99c3734077..f3d061863b 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,89 +7,89 @@ namespace CalamityMod.Projectiles.Enemy { public class PufferExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { projectile.width = 250; projectile.height = 250; projectile.friendly = true; - projectile.hostile = true; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 210; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 35); - float num464 = (float)Main.rand.Next(-30, 35); - float num465 = (float)Main.rand.Next(13, 18); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 35); + float num464 = (float)Main.rand.Next(-30, 35); + float num465 = (float)Main.rand.Next(13, 18); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index ec923f79db..f32c2e59eb 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Enemy { public class StormMarkHostile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } public override void SetDefaults() { @@ -19,142 +19,142 @@ namespace CalamityMod.Projectiles.Enemy projectile.hostile = true; projectile.tileCollide = false; projectile.timeLeft = 900; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = -1; } public override void AI() { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int num1137 = 40; - if (Main.expertMode) - { - num1137 = 25; - } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("TornadoHostile"), num1137, 3f, projectile.owner, 0f, 0f); - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - } + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int num1137 = 40; + if (Main.expertMode) + { + num1137 = 25; + } + Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("TornadoHostile"), num1137, 3f, projectile.owner, 0f, 0f); + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; } } } diff --git a/Projectiles/Enemy/SulphuricAcidCannon.cs b/Projectiles/Enemy/SulphuricAcidCannon.cs index 89c31124d4..e60c803169 100644 --- a/Projectiles/Enemy/SulphuricAcidCannon.cs +++ b/Projectiles/Enemy/SulphuricAcidCannon.cs @@ -8,9 +8,9 @@ namespace CalamityMod.Projectiles.Enemy { public class SulphuricAcidCannon : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Bubble"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bubble"); Main.projFrames[projectile.type] = 7; } diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index 4a5644349f..7977cfe15e 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Projectiles.Enemy { public class SulphuricAcidMist : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Mist"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Mist"); Main.projFrames[projectile.type] = 10; } @@ -36,21 +36,21 @@ namespace CalamityMod.Projectiles.Enemy { projectile.frame = 0; } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } projectile.ai[0] += 1f; if (projectile.ai[0] >= 180f) { @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.Venom, 120); } } } diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index 0b25dd6df7..bc7fbf3e30 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Enemy { public class TornadoHostile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } public override void SetDefaults() { @@ -24,145 +24,145 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - float num1125 = 600f; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - for (int num1133 = 0; num1133 < 1; num1133++) - { - float value75 = -0.5f; - float value76 = 0.9f; - float amount3 = Main.rand.NextFloat(); - Vector2 value77 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value75, value76, amount3)); - value77.X *= MathHelper.Lerp(2.2f, 0.6f, amount3); - value77.X *= -1f; - Vector2 value78 = new Vector2(6f, 10f); - Vector2 position3 = vector146 + value74 * value77 * 0.5f + value78; - Dust dust33 = Main.dust[Dust.NewDust(position3, 0, 0, 16, 0f, 0f, 0, default, 1.5f)]; - dust33.position = position3; - dust33.customData = vector146 + value78; - dust33.fadeIn = 1f; - dust33.scale = 0.3f; - if (value77.X > -1.2f) - { - dust33.velocity.X = 1f + Main.rand.NextFloat(); - } - dust33.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } + float num1125 = 600f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + float num1127 = 15f; + float num1128 = 15f; + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + for (int num1133 = 0; num1133 < 1; num1133++) + { + float value75 = -0.5f; + float value76 = 0.9f; + float amount3 = Main.rand.NextFloat(); + Vector2 value77 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value75, value76, amount3)); + value77.X *= MathHelper.Lerp(2.2f, 0.6f, amount3); + value77.X *= -1f; + Vector2 value78 = new Vector2(6f, 10f); + Vector2 position3 = vector146 + value74 * value77 * 0.5f + value78; + Dust dust33 = Main.dust[Dust.NewDust(position3, 0, 0, 16, 0f, 0f, 0, default, 1.5f)]; + dust33.position = position3; + dust33.customData = vector146 + value78; + dust33.fadeIn = 1f; + dust33.scale = 0.3f; + if (value77.X > -1.2f) + { + dust33.velocity.X = 1f + Main.rand.NextFloat(); + } + dust33.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; + float num226 = 600f; + float num227 = 15f; + float num228 = 15f; + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; } } } diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index c1c9a974af..e30c3c59d5 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -6,9 +6,9 @@ namespace CalamityMod.Projectiles.Enemy { public class ToxicMinnowCloud : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); Main.projFrames[projectile.type] = 4; } @@ -37,46 +37,46 @@ namespace CalamityMod.Projectiles.Enemy { projectile.frame = 0; } - if(Main.rand.NextBool(2)) - { - projectile.velocity *= 0.95f; - } - else if(Main.rand.NextBool(2)) - { - projectile.velocity *= 0.90f; - } - else if(Main.rand.NextBool(2)) - { - projectile.velocity *= 0.85f; - } - else - { - projectile.velocity *= 0.80f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 1500f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + if (Main.rand.NextBool(2)) + { + projectile.velocity *= 0.95f; + } + else if (Main.rand.NextBool(2)) + { + projectile.velocity *= 0.90f; + } + else if (Main.rand.NextBool(2)) + { + projectile.velocity *= 0.85f; + } + else + { + projectile.velocity *= 0.80f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 1500f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Enemy target.AddBuff(BuffID.Poisoned, 600); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 600); } diff --git a/Projectiles/Healing/AtaxiaHealOrb.cs b/Projectiles/Healing/AtaxiaHealOrb.cs index d85bc96978..9c582a37fc 100644 --- a/Projectiles/Healing/AtaxiaHealOrb.cs +++ b/Projectiles/Healing/AtaxiaHealOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class AtaxiaHealOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Heal Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Heal Orb"); + } public override void SetDefaults() { @@ -25,45 +25,45 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + int num487 = (int)projectile.ai[0]; + float num488 = 5.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } } } diff --git a/Projectiles/Healing/AuricOrb.cs b/Projectiles/Healing/AuricOrb.cs index e47e876c99..cb0daa3e39 100644 --- a/Projectiles/Healing/AuricOrb.cs +++ b/Projectiles/Healing/AuricOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class AuricOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Orb"); + } public override void SetDefaults() { @@ -26,66 +26,66 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - int num487 = (int)projectile.ai[0]; - float num488 = 6f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - return; + projectile.alpha -= 2; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + int num487 = (int)projectile.ai[0]; + float num488 = 6f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + return; } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, projectile.alpha); } public override void Kill(int timeLeft) { - for (int num407 = 0; num407 < 5; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(255, Main.DiscoG, 53), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; - } + for (int num407 = 0; num407 < 5; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(255, Main.DiscoG, 53), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 1.5f; + Main.dust[num408].scale = 1.5f; + } } } } diff --git a/Projectiles/Healing/BurntSienna.cs b/Projectiles/Healing/BurntSienna.cs index b7f755644c..ff37b6ddcd 100644 --- a/Projectiles/Healing/BurntSienna.cs +++ b/Projectiles/Healing/BurntSienna.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class BurntSienna : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sienna"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sienna"); + } public override void SetDefaults() { @@ -25,40 +25,40 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - int num487 = (int)projectile.ai[0]; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 3; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + int num487 = (int)projectile.ai[0]; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 3; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } } } } diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 6f09c40e38..396d3c69a3 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class CactusHealOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index 2b1c525ad3..2c3e14ab23 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class EarthHealOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -25,45 +25,45 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 8f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + int num487 = (int)projectile.ai[0]; + float num488 = 8f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } } } diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index a56bdaa6b2..f2a2f7910b 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,11 +7,11 @@ namespace CalamityMod.Projectiles.Healing { public class EssenceFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -27,73 +27,73 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num487 = (int)projectile.ai[0]; - float num488 = 3.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 8; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - return; + projectile.alpha -= 5; + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + int num487 = (int)projectile.ai[0]; + float num488 = 3.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 8; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + return; } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index 5ee2fa123e..a00b05815e 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class Exoheal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -25,45 +25,45 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 8f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + int num487 = (int)projectile.ai[0]; + float num488 = 8f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } } } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 3dbdbb70f3..e51142de11 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -1,17 +1,16 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.Items; namespace CalamityMod.Projectiles.Healing { public class FungalHeal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -25,22 +24,22 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - if (projectile.localAI[0] == 0f) - { - Player player = Main.player[projectile.owner]; - if ((player.inventory[player.selectedItem].summon && - !player.inventory[player.selectedItem].melee && - !player.inventory[player.selectedItem].ranged && - !player.inventory[player.selectedItem].magic && - !player.inventory[player.selectedItem].Calamity().rogue) || - player.inventory[player.selectedItem].hammer > 0 || - player.inventory[player.selectedItem].pick > 0 || - player.inventory[player.selectedItem].axe > 0) - { - projectile.timeLeft = 600; - } - projectile.localAI[0] += 1f; - } + if (projectile.localAI[0] == 0f) + { + Player player = Main.player[projectile.owner]; + if ((player.inventory[player.selectedItem].summon && + !player.inventory[player.selectedItem].melee && + !player.inventory[player.selectedItem].ranged && + !player.inventory[player.selectedItem].magic && + !player.inventory[player.selectedItem].Calamity().rogue) || + player.inventory[player.selectedItem].hammer > 0 || + player.inventory[player.selectedItem].pick > 0 || + player.inventory[player.selectedItem].axe > 0) + { + projectile.timeLeft = 600; + } + projectile.localAI[0] += 1f; + } int num487 = (int)projectile.ai[0]; float num488 = 5f; Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); diff --git a/Projectiles/Healing/GodSlayerHealOrb.cs b/Projectiles/Healing/GodSlayerHealOrb.cs index 8cab28aff9..0d51278ed9 100644 --- a/Projectiles/Healing/GodSlayerHealOrb.cs +++ b/Projectiles/Healing/GodSlayerHealOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class GodSlayerHealOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Heal Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Heal Orb"); + } public override void SetDefaults() { @@ -25,45 +25,45 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 6.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + int num487 = (int)projectile.ai[0]; + float num488 = 6.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } } } diff --git a/Projectiles/Healing/PhoenixHeal.cs b/Projectiles/Healing/PhoenixHeal.cs index 72d633b136..93116092c6 100644 --- a/Projectiles/Healing/PhoenixHeal.cs +++ b/Projectiles/Healing/PhoenixHeal.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class PhoenixHeal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -24,41 +24,41 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - int num487 = (int)projectile.ai[0]; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 10; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + int num487 = (int)projectile.ai[0]; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 10; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } } } diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index 4e6f373aaa..376d42a674 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class RainHeal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index 90edb8051a..3687d51cd2 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class RoyalHeal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -23,56 +23,56 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num493 = 0; num493 < 3; num493++) - { - float num494 = projectile.velocity.X * 0.334f * (float)num493; - float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; - int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.1f); - Main.dust[num496].noGravity = true; - Main.dust[num496].velocity *= 0f; - Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X -= num494; - Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y -= num495; - } - for (int num497 = 0; num497 < 5; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.3f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } + int num487 = (int)projectile.ai[0]; + float num488 = 5.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num493 = 0; num493 < 3; num493++) + { + float num494 = projectile.velocity.X * 0.334f * (float)num493; + float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; + int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.1f); + Main.dust[num496].noGravity = true; + Main.dust[num496].velocity *= 0f; + Dust expr_153E2_cp_0 = Main.dust[num496]; + expr_153E2_cp_0.position.X -= num494; + Dust expr_15401_cp_0 = Main.dust[num496]; + expr_15401_cp_0.position.Y -= num495; + } + for (int num497 = 0; num497 < 5; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.3f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } } } } diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index a1e9af07b5..fd257bd03e 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class SilvaOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Orb"); + } public override void SetDefaults() { @@ -26,66 +26,66 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - int num487 = (int)projectile.ai[0]; - float num488 = 6f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - return; + projectile.alpha -= 2; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + int num487 = (int)projectile.ai[0]; + float num488 = 6f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + return; } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + return new Color(Main.DiscoR, 203, 103, projectile.alpha); } public override void Kill(int timeLeft) { - for (int num407 = 0; num407 < 5; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; - } + for (int num407 = 0; num407 < 5; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 1.5f; + Main.dust[num408].scale = 1.5f; + } } } } diff --git a/Projectiles/Healing/Terracotta.cs b/Projectiles/Healing/Terracotta.cs index 4c10e8a994..3f80bd0f92 100644 --- a/Projectiles/Healing/Terracotta.cs +++ b/Projectiles/Healing/Terracotta.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class Terracotta : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra"); + } public override void SetDefaults() { @@ -25,55 +25,55 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - int num487 = (int)projectile.ai[0]; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 25f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 9; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + int num487 = (int)projectile.ai[0]; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 25f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 9; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } public override void Kill(int timeLeft) { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } } } } diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index 43ae26c580..54563cc332 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class TransfusionTrail : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -23,56 +23,56 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 6.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 9f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 9f + num490) / 16f; - for (int num493 = 0; num493 < 1; num493++) - { - float num494 = projectile.velocity.X * 0.334f * (float)num493; - float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; - int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.7f); - Main.dust[num496].noGravity = true; - Main.dust[num496].velocity *= 0f; - Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X -= num494; - Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y -= num495; - } - for (int num497 = 0; num497 < 2; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.9f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } + int num487 = (int)projectile.ai[0]; + float num488 = 6.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 9f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 9f + num490) / 16f; + for (int num493 = 0; num493 < 1; num493++) + { + float num494 = projectile.velocity.X * 0.334f * (float)num493; + float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; + int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.7f); + Main.dust[num496].noGravity = true; + Main.dust[num496].velocity *= 0f; + Dust expr_153E2_cp_0 = Main.dust[num496]; + expr_153E2_cp_0.position.X -= num494; + Dust expr_15401_cp_0 = Main.dust[num496]; + expr_15401_cp_0.position.Y -= num495; + } + for (int num497 = 0; num497 < 2; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.9f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } } } } diff --git a/Projectiles/Healing/XerocHealOrb.cs b/Projectiles/Healing/XerocHealOrb.cs index 9515e2b2d6..98ce7f2e10 100644 --- a/Projectiles/Healing/XerocHealOrb.cs +++ b/Projectiles/Healing/XerocHealOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Healing { public class XerocHealOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } public override void SetDefaults() { @@ -25,45 +25,45 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; - } - return; + int num487 = (int)projectile.ai[0]; + float num488 = 5.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X -= num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y -= num499; + } + return; } } } diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index 171091f1fc..aa64c6a6e8 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -4,62 +4,62 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class AbyssBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Ball"); - } + public class AbyssBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Ball"); + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = 2; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.alpha = 60; + projectile.penetrate = 2; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.magic = true; + } - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Magic/AetherBeam.cs b/Projectiles/Magic/AetherBeam.cs index d0a545fa6b..268833bf80 100644 --- a/Projectiles/Magic/AetherBeam.cs +++ b/Projectiles/Magic/AetherBeam.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Magic { public class AetherBeam : ModProjectile { - private bool split = true; + private bool split = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -32,15 +32,15 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.ai[0] == 1f) { - projectile.magic = false; - projectile.ranged = true; - } - if (projectile.ai[1] == 1f) - { - split = false; - projectile.tileCollide = false; - projectile.ai[1] = 0f; - } + projectile.magic = false; + projectile.ranged = true; + } + if (projectile.ai[1] == 1f) + { + split = false; + projectile.tileCollide = false; + projectile.ai[1] = 0f; + } projectile.damage += projectile.Calamity().defDamage / 200; if (projectile.alpha > 0) { @@ -111,34 +111,34 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - if (split) - { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); - } - } - } + if (split) + { + float random = Main.rand.Next(30, 90); + float spread = random * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); + int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); + } + } + } return true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.ShadowFlame, 60); - target.AddBuff(BuffID.Ichor, 120); - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Poisoned, 300); - } + target.AddBuff(BuffID.ShadowFlame, 60); + target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Poisoned, 300); + } } } diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index ddb9596b56..36bf2b963c 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -6,12 +6,12 @@ namespace CalamityMod.Projectiles.Magic { public class Ancient : ModProjectile { - public int addDustTimer = 0; + public int addDustTimer = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient"); + } public override void SetDefaults() { @@ -25,99 +25,99 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 6; projectile.timeLeft = 151; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 2; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.6f, 0.5f, 0f); - addDustTimer++; - if (addDustTimer >= 30) - { - int numProj = 2; - int randomSpread = Main.rand.Next(3, 19); - float rotation = MathHelper.ToRadians(randomSpread); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Ancient2"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - addDustTimer = 0; - } - if (projectile.timeLeft > 151) - { - projectile.timeLeft = 151; - } - if (projectile.ai[0] > 4f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(2)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 6f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 6f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 3f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 3f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 4f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 4f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 4f; - } - else - { - Main.dust[num299].scale *= 2.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, 0.6f, 0.5f, 0f); + addDustTimer++; + if (addDustTimer >= 30) + { + int numProj = 2; + int randomSpread = Main.rand.Next(3, 19); + float rotation = MathHelper.ToRadians(randomSpread); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Ancient2"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + addDustTimer = 0; + } + if (projectile.timeLeft > 151) + { + projectile.timeLeft = 151; + } + if (projectile.ai[0] > 4f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(2)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 6f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 6f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 3f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 3f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 4f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 4f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 4f; + } + else + { + Main.dust[num299].scale *= 2.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } } } diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index a90a908019..63d34348e6 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class Ancient2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient"); + } public override void SetDefaults() { @@ -22,79 +22,79 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 12; projectile.timeLeft = 30; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 2; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.3f, 0.25f, 0f); - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(2)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 3f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 3f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 2f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, 0.3f, 0.25f, 0f); + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(2)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 3f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 3f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 2f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } } } diff --git a/Projectiles/Magic/ApothChloro.cs b/Projectiles/Magic/ApothChloro.cs index a56beff0d6..019788cbff 100644 --- a/Projectiles/Magic/ApothChloro.cs +++ b/Projectiles/Magic/ApothChloro.cs @@ -6,29 +6,29 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class ApothChloro : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rays of Annihilation"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 70; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.hostile = false; - projectile.friendly = true; - projectile.magic = true; - projectile.light = 0.5f; - projectile.extraUpdates = 1; - } - - public override void AI() + { + public override void SetStaticDefaults() { - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + DisplayName.SetDefault("Rays of Annihilation"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.alpha = 70; + projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.hostile = false; + projectile.friendly = true; + projectile.magic = true; + projectile.light = 0.5f; + projectile.extraUpdates = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); for (int i = 0; i < 5; i++) { Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 242, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic dust4.scale = 0.8f; dust4.noLight = true; } - float num1 = (float)(projectile.position.X - projectile.velocity.X / 10.0 * 9.0); + float num1 = (float)(projectile.position.X - projectile.velocity.X / 10.0 * 9.0); float num2 = (float)(projectile.position.Y - projectile.velocity.Y / 10.0 * 9.0); float num3 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); float num4 = projectile.localAI[0]; @@ -99,24 +99,24 @@ namespace CalamityMod.Projectiles.Magic flag2 = false; if (flag2) { - double num15 = (double) num4; - Vector2 vector2 = new Vector2((float) (projectile.position.X + (double) projectile.width * 0.5), (float) (projectile.position.Y + (double) projectile.height * 0.5)); - num2 = num5 - (float) vector2.X; - num9 = num6 - (float) vector2.Y; - double num10 = Math.Sqrt((double) num2 * (double) num2 + (double) num9 * (double) num9); - float num11 = (float) (num15 / num10); + double num15 = (double)num4; + Vector2 vector2 = new Vector2((float)(projectile.position.X + (double)projectile.width * 0.5), (float)(projectile.position.Y + (double)projectile.height * 0.5)); + num2 = num5 - (float)vector2.X; + num9 = num6 - (float)vector2.Y; + double num10 = Math.Sqrt((double)num2 * (double)num2 + (double)num9 * (double)num9); + float num11 = (float)(num15 / num10); float num12 = num2 * num11; float num13 = num9 * num11; int num14 = 8; - projectile.velocity.X = (float) ((projectile.velocity.X * (double) (num14 - 1) + (double) num12) / (double) num14); - projectile.velocity.Y = (float) ((projectile.velocity.Y * (double) (num14 - 1) + (double) num13) / (double) num14); + projectile.velocity.X = (float)((projectile.velocity.X * (double)(num14 - 1) + (double)num12) / (double)num14); + projectile.velocity.Y = (float)((projectile.velocity.Y * (double)(num14 - 1) + (double)num13) / (double)num14); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); - target.AddBuff(mod.BuffType("DemonFlames"), 600, true); + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); + target.AddBuff(mod.BuffType("DemonFlames"), 600, true); } - } + } } diff --git a/Projectiles/Magic/ApothJaws.cs b/Projectiles/Magic/ApothJaws.cs index dc2233e832..9de7ebb3b8 100644 --- a/Projectiles/Magic/ApothJaws.cs +++ b/Projectiles/Magic/ApothJaws.cs @@ -4,75 +4,75 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class ApothJaws : ModProjectile - { - private const float degrees = (float)(Math.PI / 180) * 2; + public class ApothJaws : ModProjectile + { + private const float degrees = (float)(Math.PI / 180) * 2; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jaws of Annihilation"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jaws of Annihilation"); + } - public override void SetDefaults() - { - projectile.width = 144; - projectile.height = 72; - projectile.alpha = 70; - projectile.timeLeft = 240; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.light = 1.5f; - } + public override void SetDefaults() + { + projectile.width = 144; + projectile.height = 72; + projectile.alpha = 70; + projectile.timeLeft = 240; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.light = 1.5f; + } - public override void AI() - { - if (projectile.timeLeft % 8 == 0) - { - double angle = (double)(Main.rand.Next(360)) * Math.PI / 180; - float offsetX = projectile.position.X + (float)(Main.rand.Next((int)projectile.width)); - float offsetY = projectile.position.Y + (float)(Main.rand.Next((int)projectile.height)); - Projectile.NewProjectile(offsetX, offsetY, 14 * (float)(Math.Cos(angle)), 14 * (float)(Math.Sin(angle)), mod.ProjectileType("ApothChloro"), projectile.damage, projectile.knockBack / 2, Main.myPlayer); - } - if (projectile.timeLeft < 30) - projectile.alpha = projectile.alpha + 6; - else if (projectile.timeLeft < 210) - { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; - } - else if (projectile.timeLeft < 240) - { - if (projectile.ai[1] == 0) - projectile.rotation += 1.3f * degrees; - else - projectile.rotation -= 1.3f * degrees; - } - else if (projectile.timeLeft == 240) - { - if (projectile.ai[1] == 0) - projectile.rotation = projectile.ai[0] - 30 * degrees; - else - { - projectile.rotation = projectile.ai[0] + 30 * degrees + (float)Math.PI; - projectile.spriteDirection = -1; - } - } - } + public override void AI() + { + if (projectile.timeLeft % 8 == 0) + { + double angle = (double)(Main.rand.Next(360)) * Math.PI / 180; + float offsetX = projectile.position.X + (float)(Main.rand.Next((int)projectile.width)); + float offsetY = projectile.position.Y + (float)(Main.rand.Next((int)projectile.height)); + Projectile.NewProjectile(offsetX, offsetY, 14 * (float)(Math.Cos(angle)), 14 * (float)(Math.Sin(angle)), mod.ProjectileType("ApothChloro"), projectile.damage, projectile.knockBack / 2, Main.myPlayer); + } + if (projectile.timeLeft < 30) + projectile.alpha = projectile.alpha + 6; + else if (projectile.timeLeft < 210) + { + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.9f; + } + else if (projectile.timeLeft < 240) + { + if (projectile.ai[1] == 0) + projectile.rotation += 1.3f * degrees; + else + projectile.rotation -= 1.3f * degrees; + } + else if (projectile.timeLeft == 240) + { + if (projectile.ai[1] == 0) + projectile.rotation = projectile.ai[0] - 30 * degrees; + else + { + projectile.rotation = projectile.ai[0] + 30 * degrees + (float)Math.PI; + projectile.spriteDirection = -1; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); - target.AddBuff(mod.BuffType("DemonFlames"), 600, true); - target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); - if (Main.rand.NextBool(30)) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); + target.AddBuff(mod.BuffType("DemonFlames"), 600, true); + target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); + if (Main.rand.NextBool(30)) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); + } + } + } } diff --git a/Projectiles/Magic/ApothMark.cs b/Projectiles/Magic/ApothMark.cs index 3eea5aef19..f9812b156e 100644 --- a/Projectiles/Magic/ApothMark.cs +++ b/Projectiles/Magic/ApothMark.cs @@ -4,62 +4,62 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class ApothMark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jaws of Annihilation"); - } + public class ApothMark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jaws of Annihilation"); + } - public override void SetDefaults() - { - projectile.width = 123; - projectile.height = 105; - projectile.alpha = 70; - projectile.timeLeft = 240; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.light = 1.5f; - } + public override void SetDefaults() + { + projectile.width = 123; + projectile.height = 105; + projectile.alpha = 70; + projectile.timeLeft = 240; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.light = 1.5f; + } - public override void AI() - { - if (projectile.timeLeft < 30) - projectile.alpha = projectile.alpha + 6; - else if (projectile.timeLeft < 210) - { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; - } - else if (projectile.timeLeft == 240) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - double offsetHyp = Math.Sqrt(48 * 48 + 38 * 38); - double offsetRotation = Math.Atan2(-38, 48) + (double)projectile.rotation; - double offsetX = offsetHyp * Math.Cos(offsetRotation); - double offsetY = offsetHyp * Math.Sin(offsetRotation); - Projectile.NewProjectile(projectile.Center.X + (float)offsetX, projectile.Center.Y + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 0f); - offsetRotation = Math.Atan2(38, 48) + (double)projectile.rotation; - offsetX = offsetHyp * Math.Cos(offsetRotation); - offsetY = offsetHyp * Math.Sin(offsetRotation); - Projectile.NewProjectile(projectile.position.X + projectile.width / 2 + (float)offsetX, projectile.position.Y + projectile.height / 2 + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 1f); - } - } + public override void AI() + { + if (projectile.timeLeft < 30) + projectile.alpha = projectile.alpha + 6; + else if (projectile.timeLeft < 210) + { + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.9f; + } + else if (projectile.timeLeft == 240) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + double offsetHyp = Math.Sqrt(48 * 48 + 38 * 38); + double offsetRotation = Math.Atan2(-38, 48) + (double)projectile.rotation; + double offsetX = offsetHyp * Math.Cos(offsetRotation); + double offsetY = offsetHyp * Math.Sin(offsetRotation); + Projectile.NewProjectile(projectile.Center.X + (float)offsetX, projectile.Center.Y + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 0f); + offsetRotation = Math.Atan2(38, 48) + (double)projectile.rotation; + offsetX = offsetHyp * Math.Cos(offsetRotation); + offsetY = offsetHyp * Math.Sin(offsetRotation); + Projectile.NewProjectile(projectile.position.X + projectile.width / 2 + (float)offsetX, projectile.position.Y + projectile.height / 2 + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 1f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); - target.AddBuff(mod.BuffType("DemonFlames"), 600, true); - target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); - if (Main.rand.NextBool(30)) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); + target.AddBuff(mod.BuffType("DemonFlames"), 600, true); + target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); + if (Main.rand.NextBool(30)) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); + } + } + } } diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 9b4f602c7b..3a47dc48f1 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -7,120 +7,120 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class Asteroid : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Asteroid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Asteroid"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 2; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 2; + } - public override void AI() - { - if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) - { - projectile.tileCollide = true; - } - if ((double)projectile.position.Y < Main.worldSurface * 16.0) - { - projectile.tileCollide = true; - } - projectile.scale = projectile.ai[1]; - projectile.rotation += projectile.velocity.X * 2f; - Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - for (int num189 = 0; num189 < 1; num189++) - { - int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f); - Main.dust[num190].velocity *= 0.5f; - Main.dust[num190].scale *= 1.3f; - Main.dust[num190].fadeIn = 1f; - Main.dust[num190].noGravity = true; - } - } + public override void AI() + { + if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) + { + projectile.tileCollide = true; + } + if ((double)projectile.position.Y < Main.worldSurface * 16.0) + { + projectile.tileCollide = true; + } + projectile.scale = projectile.ai[1]; + projectile.rotation += projectile.velocity.X * 2f; + Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; + Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + for (int num189 = 0; num189 < 1; num189++) + { + int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f); + Main.dust[num190].velocity *= 0.5f; + Main.dust[num190].scale *= 1.3f; + Main.dust[num190].fadeIn = 1f; + Main.dust[num190].noGravity = true; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item89, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (int)(128f * projectile.scale); - projectile.height = (int)(128f * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num336 = 0; num336 < 4; num336++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); - } - for (int num337 = 0; num337 < 16; num337++) - { - int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2.5f); - Main.dust[num338].noGravity = true; - Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 1.5f); - Main.dust[num338].velocity *= 2f; - Main.dust[num338].noGravity = true; - } - for (int num339 = 0; num339 < 2; num339++) - { - int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); - Main.gore[num340].velocity *= 0.3f; - Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; - Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; - } - if (projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); - } - for (int num341 = 0; num341 < 5; num341++) - { - int num342 = Utils.SelectRandom(Main.rand, new int[] - { - 107, - 259, - 158 - }); - int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, default, 1f); - Main.dust[num343].alpha = 200; - Main.dust[num343].velocity *= 2.4f; - Main.dust[num343].scale += Main.rand.NextFloat(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item89, projectile.position); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = (int)(128f * projectile.scale); + projectile.height = (int)(128f * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num336 = 0; num336 < 4; num336++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + } + for (int num337 = 0; num337 < 16; num337++) + { + int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2.5f); + Main.dust[num338].noGravity = true; + Main.dust[num338].velocity *= 3f; + num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 1.5f); + Main.dust[num338].velocity *= 2f; + Main.dust[num338].noGravity = true; + } + for (int num339 = 0; num339 < 2; num339++) + { + int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); + Main.gore[num340].velocity *= 0.3f; + Gore expr_B4D2_cp_0 = Main.gore[num340]; + expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; + Gore expr_B502_cp_0 = Main.gore[num340]; + expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; + } + if (projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = -1f; + projectile.maxPenetrate = 0; + projectile.Damage(); + } + for (int num341 = 0; num341 < 5; num341++) + { + int num342 = Utils.SelectRandom(Main.rand, new int[] + { + 107, + 259, + 158 + }); + int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, default, 1f); + Main.dust[num343].alpha = 200; + Main.dust[num343].velocity *= 2.4f; + Main.dust[num343].scale += Main.rand.NextFloat(); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 2; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index bd6782c5a3..6f033d0e79 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -7,173 +7,173 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class AsteroidMolten : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Asteroid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Asteroid"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 2; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 2; + } - public override void AI() - { - if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) - { - projectile.tileCollide = true; - } - if ((double)projectile.position.Y < Main.worldSurface * 16.0) - { - projectile.tileCollide = true; - } - projectile.scale = projectile.ai[1]; - projectile.rotation += projectile.velocity.X * 2f; - Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - for (int num189 = 0; num189 < 1; num189++) - { - int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); - Main.dust[num190].velocity *= 0.5f; - Main.dust[num190].scale *= 1.3f; - Main.dust[num190].fadeIn = 1f; - Main.dust[num190].noGravity = true; - } - } + public override void AI() + { + if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) + { + projectile.tileCollide = true; + } + if ((double)projectile.position.Y < Main.worldSurface * 16.0) + { + projectile.tileCollide = true; + } + projectile.scale = projectile.ai[1]; + projectile.rotation += projectile.velocity.X * 2f; + Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; + Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + for (int num189 = 0; num189 < 1; num189++) + { + int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); + Main.dust[num190].velocity *= 0.5f; + Main.dust[num190].scale *= 1.3f; + Main.dust[num190].fadeIn = 1f; + Main.dust[num190].noGravity = true; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item89, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (int)(128f * projectile.scale); - projectile.height = (int)(128f * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num336 = 0; num336 < 8; num336++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); - } - for (int num337 = 0; num337 < 32; num337++) - { - int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); - Main.dust[num338].noGravity = true; - Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); - Main.dust[num338].velocity *= 2f; - Main.dust[num338].noGravity = true; - } - for (int num339 = 0; num339 < 2; num339++) - { - int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); - Main.gore[num340].velocity *= 0.3f; - Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; - Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; - } - if (projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); - } - for (int num341 = 0; num341 < 5; num341++) - { - int num342 = Utils.SelectRandom(Main.rand, new int[] - { - 244, - 259, - 158 - }); - int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); - Main.dust[num343].alpha = 200; - Main.dust[num343].velocity *= 2.4f; - Main.dust[num343].scale += Main.rand.NextFloat(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item89, projectile.position); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = (int)(128f * projectile.scale); + projectile.height = (int)(128f * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num336 = 0; num336 < 8; num336++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + } + for (int num337 = 0; num337 < 32; num337++) + { + int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); + Main.dust[num338].noGravity = true; + Main.dust[num338].velocity *= 3f; + num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + Main.dust[num338].velocity *= 2f; + Main.dust[num338].noGravity = true; + } + for (int num339 = 0; num339 < 2; num339++) + { + int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); + Main.gore[num340].velocity *= 0.3f; + Gore expr_B4D2_cp_0 = Main.gore[num340]; + expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; + Gore expr_B502_cp_0 = Main.gore[num340]; + expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; + } + if (projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = -1f; + projectile.maxPenetrate = 0; + projectile.Damage(); + } + for (int num341 = 0; num341 < 5; num341++) + { + int num342 = Utils.SelectRandom(Main.rand, new int[] + { + 244, + 259, + 158 + }); + int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); + Main.dust[num343].alpha = 200; + Main.dust[num343].velocity *= 2.4f; + Main.dust[num343].scale += Main.rand.NextFloat(); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.AddBuff(mod.BuffType("Molten"), 360); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + player.AddBuff(mod.BuffType("Molten"), 360); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - //Changes the texture of the projectile - Texture2D texture = Main.projectileTexture[projectile.type]; - switch ((int)projectile.ai[0]) - { - case 0: - break; - case 1: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten2"); - break; - case 2: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten3"); - break; - case 3: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten4"); - break; - case 4: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten5"); - break; - case 5: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten6"); - break; - default: - break; - } - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Changes the texture of the projectile + Texture2D texture = Main.projectileTexture[projectile.type]; + switch ((int)projectile.ai[0]) + { + case 0: + break; + case 1: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten2"); + break; + case 2: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten3"); + break; + case 3: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten4"); + break; + case 4: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten5"); + break; + case 5: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMolten6"); + break; + default: + break; + } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); + return false; + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow"); - switch ((int)projectile.ai[0]) - { - case 0: - break; - case 1: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow2"); - break; - case 2: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow3"); - break; - case 3: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow4"); - break; - case 4: - return; - case 5: - texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow6"); - break; - default: - break; - } - Vector2 origin = texture.Size() / 2f; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow"); + switch ((int)projectile.ai[0]) + { + case 0: + break; + case 1: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow2"); + break; + case 2: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow3"); + break; + case 3: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow4"); + break; + case 4: + return; + case 5: + texture = mod.GetTexture("Projectiles/Magic/AsteroidMoltenGlow6"); + break; + default: + break; + } + Vector2 origin = texture.Size() / 2f; + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + } } diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index 71b2fc7b48..e7f3b65344 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -8,123 +8,123 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class AstralCrystal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + projectile.magic = true; + } - public override void Kill(int timeLeft) - { - //make dust shape - bool blue = Main.rand.NextBool(); - float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); - for (float angle = 0f; angle < MathHelper.TwoPi; angle += 0.05f) - { - blue = !blue; - Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(projectile.Center, blue ? mod.DustType("AstralBlue") : mod.DustType("AstralOrange"), velocity); - d.customData = 0.025f; - } + public override void Kill(int timeLeft) + { + //make dust shape + bool blue = Main.rand.NextBool(); + float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); + for (float angle = 0f; angle < MathHelper.TwoPi; angle += 0.05f) + { + blue = !blue; + Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); + Dust d = Dust.NewDustPerfect(projectile.Center, blue ? mod.DustType("AstralBlue") : mod.DustType("AstralOrange"), velocity); + d.customData = 0.025f; + } - //chunks - for (int i = 0; i < Main.rand.Next(5, 9); i++) - { - Dust d = Dust.NewDustPerfect(projectile.Center, mod.DustType("AstralChunk")); - } + //chunks + for (int i = 0; i < Main.rand.Next(5, 9); i++) + { + Dust d = Dust.NewDustPerfect(projectile.Center, mod.DustType("AstralChunk")); + } - Main.PlaySound(SoundID.Item27, projectile.Center); + Main.PlaySound(SoundID.Item27, projectile.Center); - for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver4 / 2f) - { - Projectile.NewProjectile(projectile.Center, i.ToRotationVector2() * 9f, mod.ProjectileType("AstralCrystalInvisibleExplosion"), 50, 4f, projectile.owner); - } - } + for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver4 / 2f) + { + Projectile.NewProjectile(projectile.Center, i.ToRotationVector2() * 9f, mod.ProjectileType("AstralCrystalInvisibleExplosion"), 50, 4f, projectile.owner); + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color( - Math.Max((int)lightColor.R, 150), - Math.Max((int)lightColor.G, 150), - Math.Max((int)lightColor.B, 150)); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color( + Math.Max((int)lightColor.R, 150), + Math.Max((int)lightColor.G, 150), + Math.Max((int)lightColor.B, 150)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.Kill(); - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.Kill(); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); + } - public override void AI() - { - //FRAMING - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + public override void AI() + { + //FRAMING + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - //ROTATION - projectile.rotation = projectile.velocity.ToRotation(); + //ROTATION + projectile.rotation = projectile.velocity.ToRotation(); - //TILE COLLISION - if (projectile.Center.Y > projectile.ai[0]) - { - projectile.tileCollide = true; - } + //TILE COLLISION + if (projectile.Center.Y > projectile.ai[0]) + { + projectile.tileCollide = true; + } - //Normal astral dusts - Vector2 vect = projectile.velocity; - vect.Normalize(); - vect *= 32; - Vector2 pos = projectile.Center + vect; - Vector2 perp = new Vector2(projectile.velocity.Y, -projectile.velocity.X); - perp.Normalize(); - bool flag = Main.time % 2 == 0; - int blue = mod.DustType("AstralBlue"); - int orange = mod.DustType("AstralOrange"); - projectile.ai[1] += 0.3141f; //2pi / 20 (total frames for one loop of animation) - Vector2 posOff = perp * (float)Math.Sin(projectile.ai[1]) * 6f; - Dust d1 = Dust.NewDustPerfect(pos + posOff, flag ? blue : orange, perp * Main.rand.NextFloat(2.3f, 3.5f)); - Dust d2 = Dust.NewDustPerfect(pos - posOff, flag ? orange : blue, -perp * Main.rand.NextFloat(2.3f, 3.5f)); - d1.customData = d2.customData = 0.035f; + //Normal astral dusts + Vector2 vect = projectile.velocity; + vect.Normalize(); + vect *= 32; + Vector2 pos = projectile.Center + vect; + Vector2 perp = new Vector2(projectile.velocity.Y, -projectile.velocity.X); + perp.Normalize(); + bool flag = Main.time % 2 == 0; + int blue = mod.DustType("AstralBlue"); + int orange = mod.DustType("AstralOrange"); + projectile.ai[1] += 0.3141f; //2pi / 20 (total frames for one loop of animation) + Vector2 posOff = perp * (float)Math.Sin(projectile.ai[1]) * 6f; + Dust d1 = Dust.NewDustPerfect(pos + posOff, flag ? blue : orange, perp * Main.rand.NextFloat(2.3f, 3.5f)); + Dust d2 = Dust.NewDustPerfect(pos - posOff, flag ? orange : blue, -perp * Main.rand.NextFloat(2.3f, 3.5f)); + d1.customData = d2.customData = 0.035f; - //Astral chunk dust - if (Main.rand.NextBool(30)) - { - Dust dust = Dust.NewDustPerfect(projectile.Center, mod.DustType("AstralChunk")); - dust.velocity *= 0.3f; - } - } - } + //Astral chunk dust + if (Main.rand.NextBool(30)) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, mod.DustType("AstralChunk")); + dust.velocity *= 0.3f; + } + } + } } diff --git a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs index c7528e90f4..87f58937e5 100644 --- a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs +++ b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs @@ -1,8 +1,7 @@ -using Terraria; -using Terraria.ModLoader; - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -23,12 +22,12 @@ namespace CalamityMod.Projectiles.Magic return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); + } - public override void AI() + public override void AI() { //KILL VELOCITY projectile.ai[0]++; diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index 43b30a186f..64a763ad60 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -8,128 +8,128 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class AstralStarMagic : ModProjectile - { - private int noTileHitCounter = 120; + { + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.alpha = 50; + projectile.penetrate = 1; + projectile.tileCollide = false; + } - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 3); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - } + public override void AI() + { + int randomToSubtract = Main.rand.Next(1, 3); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 100, 250, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 100, 250, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - for (int num480 = 0; num480 < 3; num480++) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); - } - } - } + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num480 = 0; num480 < 3; num480++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } + } + } } diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 6fb3a16911..3d3f04f310 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class AtlantisSpear : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Atlantis Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Atlantis Spear"); + } public override void SetDefaults() { @@ -27,69 +27,69 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - if (Main.myPlayer == projectile.owner) - { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) - { - num48 = mod.ProjectileType("AtlantisSpear2"); - } - int num49 = projectile.damage; - float num50 = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); - NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + if (Main.myPlayer == projectile.owner) + { + int num48 = projectile.type; + if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + { + num48 = mod.ProjectileType("AtlantisSpear2"); + } + int num49 = projectile.damage; + float num50 = projectile.knockBack; + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); + NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override Color? GetAlpha(Color lightColor) { - target.immune[projectile.owner] = 6; + return new Color(200, 200, 200, projectile.alpha); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; } public override void Kill(int timeLeft) { - int numProj = 2; + int numProj = 2; float rotation = MathHelper.ToRadians(20); for (int i = 0; i < numProj; i++) { @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic } for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); } } } diff --git a/Projectiles/Magic/AtlantisSpear2.cs b/Projectiles/Magic/AtlantisSpear2.cs index 742a092117..ab80ac35d3 100644 --- a/Projectiles/Magic/AtlantisSpear2.cs +++ b/Projectiles/Magic/AtlantisSpear2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class AtlantisSpear2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Atlantis Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Atlantis Spear"); + } public override void SetDefaults() { @@ -27,54 +27,54 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); } } } diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs index 776f59f09d..69b7d41233 100644 --- a/Projectiles/Magic/AuraRain.cs +++ b/Projectiles/Magic/AuraRain.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class AuraRain : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura Rain"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura Rain"); + } public override void SetDefaults() { @@ -27,14 +27,14 @@ namespace CalamityMod.Projectiles.Magic aiType = 239; } - public override void AI() - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } + public override void AI() + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } } } diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 6d98aa84da..22def3d093 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BeamingBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beaming Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beaming Bolt"); + } public override void SetDefaults() { @@ -24,66 +24,66 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 3; dust++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.985f; + for (int dust = 0; dust < 3; dust++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } } public override void Kill(int timeLeft) { for (int k = 0; k < 6; k++) { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } + { + target.immune[projectile.owner] = 7; + } } } diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index 52f4baf56c..14c0bae20f 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class BeamingBolt2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beaming Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beaming Bolt"); + } public override void SetDefaults() { @@ -25,77 +25,77 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - for (int dust = 0; dust < 2; dust++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + for (int dust = 0; dust < 2; dust++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs index 27a759f39a..c17b1b2104 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BigBeamofDeath : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Beam of Death"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Beam of Death"); + } public override void SetDefaults() { @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 100; + projectile.localNPCHitCooldown = 100; projectile.penetrate = -1; projectile.extraUpdates = 100; projectile.timeLeft = 80; @@ -27,34 +27,34 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - int numProj = 2; + int numProj = 2; float rotation = MathHelper.ToRadians(20); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BigBeamofDeath2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BigBeamofDeath2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } } } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 206; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 3f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 206; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 3f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + } + } } } } diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs index ee4eaee749..c7623b2cb9 100644 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ b/Projectiles/Magic/BigBeamofDeath2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BigBeamofDeath2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Beam of Death"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Beam of Death"); + } public override void SetDefaults() { @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 100; + projectile.localNPCHitCooldown = 100; projectile.penetrate = -1; projectile.extraUpdates = 100; projectile.timeLeft = 80; @@ -27,21 +27,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 206; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 3f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - } - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 206; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 3f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + } + return; + } } } } diff --git a/Projectiles/Magic/BlackAnurian.cs b/Projectiles/Magic/BlackAnurian.cs index c34ca1aba0..868cdcc357 100644 --- a/Projectiles/Magic/BlackAnurian.cs +++ b/Projectiles/Magic/BlackAnurian.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class BlackAnurian : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } public override void SetDefaults() { diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index 314c76b83f..3215f4f4be 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,9 +7,9 @@ namespace CalamityMod.Projectiles.Magic { public class BlackAnurianPlankton : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plankton"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plankton"); Main.projFrames[projectile.type] = 5; } diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index d2f9a011f3..1f71666aab 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BloodBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Beam"); + } public override void SetDefaults() { @@ -25,49 +25,49 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 5; - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.25f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, 0.35f, 0f, 0f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 5; + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.25f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } } } diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index 64a492d36c..9da576e4c2 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BloodBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -27,36 +27,36 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); - for (int num92 = 0; num92 < 2; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 5, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; - } - if (Main.rand.NextBool(5)) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 5, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } + Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + for (int num92 = 0; num92 < 2; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 5, 0f, 0f, 100, default, 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X -= num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y -= num94; + } + if (Main.rand.NextBool(5)) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 5, 0f, 0f, 100, default, 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } } } } diff --git a/Projectiles/Magic/BloodBolt.cs b/Projectiles/Magic/BloodBolt.cs index ea3d382dbe..5458891f48 100644 --- a/Projectiles/Magic/BloodBolt.cs +++ b/Projectiles/Magic/BloodBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BloodBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Bolt"); + } public override void SetDefaults() { @@ -23,21 +23,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } } } } diff --git a/Projectiles/Magic/BloodOrb.cs b/Projectiles/Magic/BloodOrb.cs index 1fcf460f19..7581495d67 100644 --- a/Projectiles/Magic/BloodOrb.cs +++ b/Projectiles/Magic/BloodOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class BloodOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Orb"); + } public override void SetDefaults() { @@ -25,61 +25,61 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BloodBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BloodBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } } } } diff --git a/Projectiles/Magic/BloodRay.cs b/Projectiles/Magic/BloodRay.cs index 2756ca1822..49799d0ae9 100644 --- a/Projectiles/Magic/BloodRay.cs +++ b/Projectiles/Magic/BloodRay.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BloodRay : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Ray"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Ray"); + } public override void SetDefaults() { @@ -24,27 +24,27 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("BloodOrb"), (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("BloodOrb"), (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default, 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } } } } diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index dd260a5900..40b016cd06 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class BlueBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } public override void SetDefaults() { @@ -26,83 +26,83 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.005f; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 30; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Vector2 v2 = projectile.ai[0].ToRotationVector2(); - float num743 = projectile.velocity.ToRotation(); - float num744 = v2.ToRotation(); - double num745 = (double)(num744 - num743); - if (num745 > 3.1415926535897931) - { - num745 -= 6.2831853071795862; - } - if (num745 < -3.1415926535897931) - { - num745 += 6.2831853071795862; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.myPlayer == projectile.owner && projectile.timeLeft > 120) - { - projectile.timeLeft = 120; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + projectile.velocity.X *= 0.99f; + projectile.velocity.Y *= 0.99f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.005f; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 30; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Vector2 v2 = projectile.ai[0].ToRotationVector2(); + float num743 = projectile.velocity.ToRotation(); + float num744 = v2.ToRotation(); + double num745 = (double)(num744 - num743); + if (num745 > 3.1415926535897931) + { + num745 -= 6.2831853071795862; + } + if (num745 < -3.1415926535897931) + { + num745 += 6.2831853071795862; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.myPlayer == projectile.owner && projectile.timeLeft > 120) + { + projectile.timeLeft = 120; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 150f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 8f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 54); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } } } } diff --git a/Projectiles/Magic/BrimstoneBeam.cs b/Projectiles/Magic/BrimstoneBeam.cs index fbb234b7c5..4b70d6b5b0 100644 --- a/Projectiles/Magic/BrimstoneBeam.cs +++ b/Projectiles/Magic/BrimstoneBeam.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,50 +24,50 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - int numProj = 2; + int numProj = 2; float rotation = MathHelper.ToRadians(10); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } } } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Magic/BrimstoneBeam2.cs b/Projectiles/Magic/BrimstoneBeam2.cs index bf3555fd88..18aa449788 100644 --- a/Projectiles/Magic/BrimstoneBeam2.cs +++ b/Projectiles/Magic/BrimstoneBeam2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,50 +24,50 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - int numProj = 2; + int numProj = 2; float rotation = MathHelper.ToRadians(10); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam3"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam3"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } } } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Magic/BrimstoneBeam3.cs b/Projectiles/Magic/BrimstoneBeam3.cs index 3306e8ebb5..a147cb431b 100644 --- a/Projectiles/Magic/BrimstoneBeam3.cs +++ b/Projectiles/Magic/BrimstoneBeam3.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,50 +24,50 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - int numProj = 2; + int numProj = 2; float rotation = MathHelper.ToRadians(10); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam4"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam4"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } } } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Magic/BrimstoneBeam4.cs b/Projectiles/Magic/BrimstoneBeam4.cs index da044dd82e..14bcd4c5e1 100644 --- a/Projectiles/Magic/BrimstoneBeam4.cs +++ b/Projectiles/Magic/BrimstoneBeam4.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam4 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,50 +24,50 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - int numProj = 2; + int numProj = 2; float rotation = MathHelper.ToRadians(20); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam5"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam5"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } } } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Magic/BrimstoneBeam5.cs b/Projectiles/Magic/BrimstoneBeam5.cs index e5c228c7a0..ff0c85c422 100644 --- a/Projectiles/Magic/BrimstoneBeam5.cs +++ b/Projectiles/Magic/BrimstoneBeam5.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam5 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,36 +24,36 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index c1495c1f37..dec8afd8bd 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneFireball : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + } public override void SetDefaults() { @@ -25,41 +25,41 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - if (projectile.owner == Main.myPlayer) - { - int num251 = Main.rand.Next(3, 5); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, -51)); - while (value15.X == 0f) - { - value15.X = (float)Main.rand.Next(-100, 101); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BrimstoneHomer"), (int)((double)projectile.damage * 1.35), 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + if (projectile.owner == Main.myPlayer) + { + int num251 = Main.rand.Next(3, 5); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, -51)); + while (value15.X == 0f) + { + value15.X = (float)Main.rand.Next(-100, 101); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BrimstoneHomer"), (int)((double)projectile.damage * 1.35), 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -83,13 +83,13 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.immune[projectile.owner] = 8; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index 2f596befe5..a170fd20d4 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -5,54 +5,54 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class BrimstoneHellfireballFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellfire"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellfire"); + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = 2; - projectile.extraUpdates = 1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.penetrate = 2; + projectile.extraUpdates = 1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs index 906c3b3e17..0a3b3a0d42 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneHellfireballFriendly2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellfire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellfire"); + } public override void SetDefaults() { @@ -24,33 +24,33 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - return; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + return; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); } } } diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index 7fbb7b4129..88cd659ee7 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,73 +7,73 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneHomer : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homer"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homer"); + } public override void SetDefaults() { projectile.width = 4; projectile.height = 4; projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; + projectile.magic = true; + projectile.ignoreWater = true; projectile.penetrate = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = 1; projectile.timeLeft = 180; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 8f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } } } diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index ce073e2f85..0a3dcc4380 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneTentacle : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } public override void SetDefaults() { @@ -24,77 +24,77 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.5f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - return; - } + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.5f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + projectile.owner); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + return; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); } } } diff --git a/Projectiles/Magic/Climax.cs b/Projectiles/Magic/Climax.cs index 87be7256ed..dc2214daf9 100644 --- a/Projectiles/Magic/Climax.cs +++ b/Projectiles/Magic/Climax.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Magic { public class Climax : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Climax"); - Main.projFrames[projectile.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Climax"); + Main.projFrames[projectile.type] = 5; + } public override void SetDefaults() { @@ -28,104 +28,104 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; - if (projectile.velocity.X > 0f) - { - projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - else - { - projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 4) - { - projectile.frame = 0; - } - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int num3; - for (int num433 = 0; num433 < 1000; num433 = num3 + 1) - { - num3 = num433; - } - int[] array = new int[20]; - int num434 = 0; - float num435 = 400f; - bool flag14 = false; - for (int num436 = 0; num436 < 200; num436 = num3 + 1) - { - if (Main.npc[num436].CanBeChasedBy(projectile, false)) - { - float num437 = Main.npc[num436].position.X + (float)(Main.npc[num436].width / 2); - float num438 = Main.npc[num436].position.Y + (float)(Main.npc[num436].height / 2); - float num439 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num437) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num438); - if (num439 < num435 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num436].Center, 1, 1)) - { - if (num434 < 20) - { - array[num434] = num436; - num434++; - } - flag14 = true; - } - } - num3 = num436; - } - if (projectile.timeLeft < 30) - { - flag14 = false; - } - if (flag14) - { - int num440 = Main.rand.Next(num434); - num440 = array[num440]; - float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2); - float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - projectile.localAI[0] = 0f; - float num443 = 8f; - Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - vector33 += projectile.velocity * 4f; - float num444 = num441 - vector33.X; - float num445 = num442 - vector33.Y; - float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); - num446 = num443 / num446; - num444 *= num446; - num445 *= num446; - Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, mod.ProjectileType("ClimaxBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - return; - } - } + projectile.velocity.X *= 0.98f; + projectile.velocity.Y *= 0.98f; + if (projectile.velocity.X > 0f) + { + projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + else + { + projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int num3; + for (int num433 = 0; num433 < 1000; num433 = num3 + 1) + { + num3 = num433; + } + int[] array = new int[20]; + int num434 = 0; + float num435 = 400f; + bool flag14 = false; + for (int num436 = 0; num436 < 200; num436 = num3 + 1) + { + if (Main.npc[num436].CanBeChasedBy(projectile, false)) + { + float num437 = Main.npc[num436].position.X + (float)(Main.npc[num436].width / 2); + float num438 = Main.npc[num436].position.Y + (float)(Main.npc[num436].height / 2); + float num439 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num437) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num438); + if (num439 < num435 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num436].Center, 1, 1)) + { + if (num434 < 20) + { + array[num434] = num436; + num434++; + } + flag14 = true; + } + } + num3 = num436; + } + if (projectile.timeLeft < 30) + { + flag14 = false; + } + if (flag14) + { + int num440 = Main.rand.Next(num434); + num440 = array[num440]; + float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2); + float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + projectile.localAI[0] = 0f; + float num443 = 8f; + Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + vector33 += projectile.velocity * 4f; + float num444 = num441 - vector33.X; + float num445 = num442 - vector33.Y; + float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); + num446 = num443 / num446; + num444 *= num446; + num445 *= num446; + Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, mod.ProjectileType("ClimaxBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + return; + } + } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 30) - { - float num7 = (float)projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num7); - } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + if (projectile.timeLeft < 30) + { + float num7 = (float)projectile.timeLeft / 30f; + projectile.alpha = (int)(255f - 255f * num7); + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } } } diff --git a/Projectiles/Magic/Climax2.cs b/Projectiles/Magic/Climax2.cs index 5b204d1a27..f2b656ef7e 100644 --- a/Projectiles/Magic/Climax2.cs +++ b/Projectiles/Magic/Climax2.cs @@ -1,133 +1,133 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class Climax2 : ModProjectile - { - private double timeElapsed = 0.0; - private double circleSize = 1.0; - private double circleGrowth = 0.02; + { + private double timeElapsed = 0.0; + private double circleSize = 1.0; + private double circleGrowth = 0.02; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Climax"); - Main.projFrames[projectile.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Climax"); + Main.projFrames[projectile.type] = 5; + } - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 38; - projectile.friendly = true; - projectile.light = 0.5f; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 420; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + projectile.friendly = true; + projectile.light = 0.5f; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 420; + projectile.magic = true; + } - public override void AI() - { - timeElapsed += 0.02; - projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); - projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); - circleSize += circleGrowth; - if (projectile.velocity.X > 0f) - { - projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - else - { - projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 4) - { - projectile.frame = 0; - } - } - int num3; - for (int num433 = 0; num433 < 1000; num433 = num3 + 1) - { - num3 = num433; - } - int[] array = new int[20]; - int num434 = 0; - float num435 = 300f; - bool flag14 = false; - for (int num436 = 0; num436 < 200; num436 = num3 + 1) - { - if (Main.npc[num436].CanBeChasedBy(projectile, false)) - { - float num437 = Main.npc[num436].position.X + (float)(Main.npc[num436].width / 2); - float num438 = Main.npc[num436].position.Y + (float)(Main.npc[num436].height / 2); - float num439 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num437) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num438); - if (num439 < num435 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num436].Center, 1, 1)) - { - if (num434 < 20) - { - array[num434] = num436; - num434++; - } - flag14 = true; - } - } - num3 = num436; - } - if (projectile.timeLeft < 30) - { - flag14 = false; - } - if (flag14) - { - int num440 = Main.rand.Next(num434); - num440 = array[num440]; - float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2); - float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - projectile.localAI[0] = 0f; - float num443 = 8f; - Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - vector33 += projectile.velocity * 4f; - float num444 = num441 - vector33.X; - float num445 = num442 - vector33.Y; - float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); - num446 = num443 / num446; - num444 *= num446; - num445 *= num446; - Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, mod.ProjectileType("ClimaxBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - return; - } - } - } + public override void AI() + { + timeElapsed += 0.02; + projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); + projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); + circleSize += circleGrowth; + if (projectile.velocity.X > 0f) + { + projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + else + { + projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } + int num3; + for (int num433 = 0; num433 < 1000; num433 = num3 + 1) + { + num3 = num433; + } + int[] array = new int[20]; + int num434 = 0; + float num435 = 300f; + bool flag14 = false; + for (int num436 = 0; num436 < 200; num436 = num3 + 1) + { + if (Main.npc[num436].CanBeChasedBy(projectile, false)) + { + float num437 = Main.npc[num436].position.X + (float)(Main.npc[num436].width / 2); + float num438 = Main.npc[num436].position.Y + (float)(Main.npc[num436].height / 2); + float num439 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num437) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num438); + if (num439 < num435 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num436].Center, 1, 1)) + { + if (num434 < 20) + { + array[num434] = num436; + num434++; + } + flag14 = true; + } + } + num3 = num436; + } + if (projectile.timeLeft < 30) + { + flag14 = false; + } + if (flag14) + { + int num440 = Main.rand.Next(num434); + num440 = array[num440]; + float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2); + float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + projectile.localAI[0] = 0f; + float num443 = 8f; + Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + vector33 += projectile.velocity * 4f; + float num444 = num441 - vector33.X; + float num445 = num442 - vector33.Y; + float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); + num446 = num443 / num446; + num444 *= num446; + num445 *= num446; + Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, mod.ProjectileType("ClimaxBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + return; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 30) - { - float num7 = (float)projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num7); - } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 30) + { + float num7 = (float)projectile.timeLeft / 30f; + projectile.alpha = (int)(255f - 255f * num7); + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index e5cbdfc14a..ee1760e11d 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class ClimaxBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -23,21 +23,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } } } } diff --git a/Projectiles/Magic/CoralSpike.cs b/Projectiles/Magic/CoralSpike.cs index f2223295c1..6d0c6081d9 100644 --- a/Projectiles/Magic/CoralSpike.cs +++ b/Projectiles/Magic/CoralSpike.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Magic { public class CoralSpike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Coral Spike"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coral Spike"); + } public override void SetDefaults() { @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.99f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.99f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } } } diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 5d585dcfc5..2169e6c53f 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class CosmicTentacle : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } public override void SetDefaults() { @@ -25,76 +25,76 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + projectile.owner); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.CursedInferno, 240); + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.CursedInferno, 240); } } } diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index ff098a4a35..374dcccaa2 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class CryoBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -24,34 +24,34 @@ namespace CalamityMod.Projectiles.Magic } public override void AI() - { - if (projectile.scale <= 3.6f) - { - projectile.scale *= 1.01f; - projectile.width = (int)(16f * projectile.scale); - projectile.height = (int)(32f * projectile.scale); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default, projectile.scale); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - int num470 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default, projectile.scale); - Main.dust[num470].noGravity = true; - Main.dust[num470].velocity *= 0f; - } - } + { + if (projectile.scale <= 3.6f) + { + projectile.scale *= 1.01f; + projectile.width = (int)(16f * projectile.scale); + projectile.height = (int)(32f * projectile.scale); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default, projectile.scale); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + int num470 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default, projectile.scale); + Main.dust[num470].noGravity = true; + Main.dust[num470].velocity *= 0f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 360); - target.AddBuff(BuffID.Frostburn, 360); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 360); + target.AddBuff(BuffID.Frostburn, 360); + } } } diff --git a/Projectiles/Magic/DemonicPitchfork.cs b/Projectiles/Magic/DemonicPitchfork.cs index 074b2607d7..422da8ed20 100644 --- a/Projectiles/Magic/DemonicPitchfork.cs +++ b/Projectiles/Magic/DemonicPitchfork.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class DemonicPitchfork : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pitchfork"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pitchfork"); + } public override void SetDefaults() { @@ -26,25 +26,25 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); if (projectile.localAI[1] > 7f) - { - int num307 = Main.rand.Next(3); - if (num307 == 0) - { - num307 = 14; - } - else if (num307 == 1) - { - num307 = 27; - } - else - { - num307 = 173; - } - int num308 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, num307, 0f, 0f, 100, default, 1.25f); - Main.dust[num308].velocity *= 0.1f; - } + { + int num307 = Main.rand.Next(3); + if (num307 == 0) + { + num307 = 14; + } + else if (num307 == 1) + { + num307 = 27; + } + else + { + num307 = 173; + } + int num308 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, num307, 0f, 0f, 100, default, 1.25f); + Main.dust[num308].velocity *= 0.1f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -58,9 +58,9 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 27, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 27, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index 8c35cab597..97b9b47766 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class DustProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -26,78 +26,78 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.timeLeft > 60) - { - projectile.timeLeft = 60; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 4f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 2.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.timeLeft > 60) + { + projectile.timeLeft = 60; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 4f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 2.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } } } diff --git a/Projectiles/Magic/EidolicWail.cs b/Projectiles/Magic/EidolicWail.cs index a0d6c38a47..925aba4367 100644 --- a/Projectiles/Magic/EidolicWail.cs +++ b/Projectiles/Magic/EidolicWail.cs @@ -8,85 +8,85 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class EidolicWail : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wail"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wail"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 36; - projectile.scale = 0.005f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - projectile.timeLeft = 450; - } + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 36; + projectile.scale = 0.005f; + projectile.alpha = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + projectile.timeLeft = 450; + } - public override void AI() - { - if (projectile.localAI[0] < 1f) - { - projectile.localAI[0] += 0.005f; //200 to reach full size and max power - projectile.scale += 0.005f; - projectile.width = (int)(36f * projectile.scale); - projectile.height = (int)(36f * projectile.scale); - } - else - { - projectile.width = 36; - projectile.height = 36; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + public override void AI() + { + if (projectile.localAI[0] < 1f) + { + projectile.localAI[0] += 0.005f; //200 to reach full size and max power + projectile.scale += 0.005f; + projectile.width = (int)(36f * projectile.scale); + projectile.height = (int)(36f * projectile.scale); + } + else + { + projectile.width = 36; + projectile.height = 36; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage = (int)((double)damage * (double)projectile.localAI[0]); - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage = (int)((double)damage * (double)projectile.localAI[0]); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - projectile.velocity *= 0.975f; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + projectile.velocity *= 0.975f; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/EldritchTentacle.cs b/Projectiles/Magic/EldritchTentacle.cs index fbdf16b818..cdb1bb6c83 100644 --- a/Projectiles/Magic/EldritchTentacle.cs +++ b/Projectiles/Magic/EldritchTentacle.cs @@ -1,93 +1,93 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class EldritchTentacle : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } + public class EldritchTentacle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.MaxUpdates = 3; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.MaxUpdates = 3; + projectile.magic = true; + } - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - } - } - } + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + projectile.owner); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + } + } + } } diff --git a/Projectiles/Magic/ElementBolt.cs b/Projectiles/Magic/ElementBolt.cs index 645429a53e..3048767b73 100644 --- a/Projectiles/Magic/ElementBolt.cs +++ b/Projectiles/Magic/ElementBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class ElementBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,27 +23,27 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } } } diff --git a/Projectiles/Magic/ElementBolt2.cs b/Projectiles/Magic/ElementBolt2.cs index 5dbf67ca85..ab800fc64d 100644 --- a/Projectiles/Magic/ElementBolt2.cs +++ b/Projectiles/Magic/ElementBolt2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class ElementBolt2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,21 +23,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } } } diff --git a/Projectiles/Magic/ElementOrb.cs b/Projectiles/Magic/ElementOrb.cs index 7d143308e7..fa0f07aec7 100644 --- a/Projectiles/Magic/ElementOrb.cs +++ b/Projectiles/Magic/ElementOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class ElementOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,64 +25,64 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } } } diff --git a/Projectiles/Magic/ElementOrb2.cs b/Projectiles/Magic/ElementOrb2.cs index 1c8270fccb..101a45e646 100644 --- a/Projectiles/Magic/ElementOrb2.cs +++ b/Projectiles/Magic/ElementOrb2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class ElementOrb2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,64 +25,64 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } } } diff --git a/Projectiles/Magic/ElementRay.cs b/Projectiles/Magic/ElementRay.cs index 2a2d5a88be..1ab7e8c869 100644 --- a/Projectiles/Magic/ElementRay.cs +++ b/Projectiles/Magic/ElementRay.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class ElementRay : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } public override void SetDefaults() { @@ -24,35 +24,35 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 22f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 22f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 3; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/ElementTentacle.cs index 7c344c6d80..0e149bf0d1 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/ElementTentacle.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class ElementTentacle : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } public override void SetDefaults() { @@ -25,77 +25,77 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 2f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 2f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 2f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 2f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); } } } diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index aad41386c4..2448ae0ecd 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -7,72 +7,72 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class EvergladeSprayProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spray"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spray"); + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.extraUpdates = 2; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 6; + projectile.extraUpdates = 2; + projectile.magic = true; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) - { - projectile.Kill(); - } - if (projectile.ai[0] <= 3f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) - { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 157, 0f, 0f, 100, default, 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X -= num152; - Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y -= num153; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 157, 0f, 0f, 100, default, 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.scale -= 0.002f; + if (projectile.scale <= 0f) + { + projectile.Kill(); + } + if (projectile.ai[0] <= 3f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; + for (int num151 = 0; num151 < 3; num151++) + { + float num152 = projectile.velocity.X / 3f * (float)num151; + float num153 = projectile.velocity.Y / 3f * (float)num151; + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 157, 0f, 0f, 100, default, 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + Dust expr_6A04_cp_0 = Main.dust[num155]; + expr_6A04_cp_0.position.X -= num152; + Dust expr_6A1F_cp_0 = Main.dust[num155]; + expr_6A1F_cp_0.position.Y -= num153; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 157, 0f, 0f, 100, default, 0.5f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Ichor, 1200); - target.AddBuff(BuffID.CursedInferno, 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Ichor, 1200); + target.AddBuff(BuffID.CursedInferno, 300); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index 9f21dec669..6d164e6ce8 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class FabBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,21 +23,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } } } diff --git a/Projectiles/Magic/FabOrb.cs b/Projectiles/Magic/FabOrb.cs index 8bfec26be7..ec817fa648 100644 --- a/Projectiles/Magic/FabOrb.cs +++ b/Projectiles/Magic/FabOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class FabOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,64 +25,64 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("FabBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("FabBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } } } diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 8ef4e35a62..f8507d5162 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class FabRay : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } public override void SetDefaults() { @@ -21,37 +21,37 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 100; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; + projectile.localNPCHitCooldown = 0; } public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("FabOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("FabOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 16f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; + projectile.penetrate--; if (projectile.penetrate <= 0) { projectile.Kill(); diff --git a/Projectiles/Magic/FatesReveal.cs b/Projectiles/Magic/FatesReveal.cs index 64e0a43a81..d9f4571f0e 100644 --- a/Projectiles/Magic/FatesReveal.cs +++ b/Projectiles/Magic/FatesReveal.cs @@ -6,169 +6,169 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class FatesReveal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 180; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 180; + projectile.magic = true; + } - public override void AI() - { - float num949 = 10f; - float scaleFactor11 = 15f; - float num950 = 160f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num3 = projectile.frameCounter + 1; - projectile.frameCounter = num3; - if (num3 > 4) - { - projectile.frameCounter = 0; - num3 = projectile.frame + 1; - projectile.frame = num3; - if (num3 >= 4) - { - projectile.frame = 0; - } - } - float num951 = 0.5f; - if (projectile.timeLeft < 120) - { - num951 = 1.1f; - } - if (projectile.timeLeft < 60) - { - num951 = 1.6f; - } - float[] var_2_2A211_cp_0 = projectile.ai; - int var_2_2A211_cp_1 = 1; - float num73 = var_2_2A211_cp_0[var_2_2A211_cp_1]; - var_2_2A211_cp_0[var_2_2A211_cp_1] = num73 + 1f; - float num952 = projectile.ai[1] / 180f * 6.28318548f; - for (float num953 = 0f; num953 < 3f; num953 = num73 + 1f) - { - if (Main.rand.Next(3) != 0) - { - return; - } - Dust dust13 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 60, 0f, -2f, 0, default, 1f)]; - dust13.position = projectile.Center + Vector2.UnitY.RotatedBy((double)(num953 * 6.28318548f / 3f + projectile.ai[1]), default) * 10f; - dust13.noGravity = true; - dust13.velocity = projectile.DirectionFrom(dust13.position); - dust13.scale = num951; - dust13.fadeIn = 0.5f; - dust13.alpha = 200; - num73 = num953; - } - if (projectile.timeLeft < 4) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 180); - projectile.Center = projectile.position; - projectile.damage = 800; - for (int num955 = 0; num955 < 10; num955 = num3 + 1) - { - Dust dust13 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, -2f, 0, default, 1f)]; - dust13.noGravity = true; - if (dust13.position != projectile.Center) - { - dust13.velocity = projectile.DirectionTo(dust13.position) * 3f; - } - num3 = num955; - } - } - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num950) - { - Vector2 vector118 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector118.HasNaNs()) - { - vector118 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } + public override void AI() + { + float num949 = 10f; + float scaleFactor11 = 15f; + float num950 = 160f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num3 = projectile.frameCounter + 1; + projectile.frameCounter = num3; + if (num3 > 4) + { + projectile.frameCounter = 0; + num3 = projectile.frame + 1; + projectile.frame = num3; + if (num3 >= 4) + { + projectile.frame = 0; + } + } + float num951 = 0.5f; + if (projectile.timeLeft < 120) + { + num951 = 1.1f; + } + if (projectile.timeLeft < 60) + { + num951 = 1.6f; + } + float[] var_2_2A211_cp_0 = projectile.ai; + int var_2_2A211_cp_1 = 1; + float num73 = var_2_2A211_cp_0[var_2_2A211_cp_1]; + var_2_2A211_cp_0[var_2_2A211_cp_1] = num73 + 1f; + float num952 = projectile.ai[1] / 180f * 6.28318548f; + for (float num953 = 0f; num953 < 3f; num953 = num73 + 1f) + { + if (Main.rand.Next(3) != 0) + { + return; + } + Dust dust13 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 60, 0f, -2f, 0, default, 1f)]; + dust13.position = projectile.Center + Vector2.UnitY.RotatedBy((double)(num953 * 6.28318548f / 3f + projectile.ai[1]), default) * 10f; + dust13.noGravity = true; + dust13.velocity = projectile.DirectionFrom(dust13.position); + dust13.scale = num951; + dust13.fadeIn = 0.5f; + dust13.alpha = 200; + num73 = num953; + } + if (projectile.timeLeft < 4) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 180); + projectile.Center = projectile.position; + projectile.damage = 800; + for (int num955 = 0; num955 < 10; num955 = num3 + 1) + { + Dust dust13 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, -2f, 0, default, 1f)]; + dust13.noGravity = true; + if (dust13.position != projectile.Center) + { + dust13.velocity = projectile.DirectionTo(dust13.position) * 3f; + } + num3 = num955; + } + } + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num950) + { + Vector2 vector118 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector118.HasNaNs()) + { + vector118 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 30) - { - float num4 = (float)projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num4); - } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 128 - projectile.alpha / 2); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 30) + { + float num4 = (float)projectile.timeLeft / 30f; + projectile.alpha = (int)(255f - 255f * num4); + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 128 - projectile.alpha / 2); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 192); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage *= 3; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); - int num3; - for (int num122 = 0; num122 < 3; num122 = num3 + 1) - { - int num123 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num123].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num122; - } - for (int num124 = 0; num124 < 10; num124 = num3 + 1) - { - int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); - Main.dust[num125].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num125].noGravity = true; - Dust dust = Main.dust[num125]; - dust.velocity *= 2f; - num3 = num124; - } - for (int num126 = 0; num126 < 5; num126 = num3 + 1) - { - int num127 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); - Main.dust[num127].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num127].noGravity = true; - Dust dust = Main.dust[num127]; - dust.velocity *= 2f; - num3 = num126; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 192); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage *= 3; + projectile.Damage(); + Main.PlaySound(SoundID.Item14, projectile.Center); + int num3; + for (int num122 = 0; num122 < 3; num122 = num3 + 1) + { + int num123 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num123].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num3 = num122; + } + for (int num124 = 0; num124 < 10; num124 = num3 + 1) + { + int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[num125].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num125].noGravity = true; + Dust dust = Main.dust[num125]; + dust.velocity *= 2f; + num3 = num124; + } + for (int num126 = 0; num126 < 5; num126 = num3 + 1) + { + int num127 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); + Main.dust[num127].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num127].noGravity = true; + Dust dust = Main.dust[num127]; + dust.velocity *= 2f; + num3 = num126; + } + } + } } diff --git a/Projectiles/Magic/FlameBeamTip.cs b/Projectiles/Magic/FlameBeamTip.cs index 0a19ae665f..08ad79c796 100644 --- a/Projectiles/Magic/FlameBeamTip.cs +++ b/Projectiles/Magic/FlameBeamTip.cs @@ -1,85 +1,83 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class FlameBeamTip : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public class FlameBeamTip : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } - public override bool PreAI() - { - if (projectile.ai[0] != 0f) - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - projectile.alpha += 5; + public override bool PreAI() + { + if (projectile.ai[0] != 0f) + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + projectile.alpha += 5; - return true; - } + return true; + } - public override void AI() - { - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity; - } - if (Main.myPlayer == projectile.owner) - { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(15 + Main.rand.Next(3))) - { - num48 = mod.ProjectileType("FlameBeamTip2"); - } + public override void AI() + { + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity; + } + if (Main.myPlayer == projectile.owner) + { + int num48 = projectile.type; + if (projectile.ai[1] >= (float)(15 + Main.rand.Next(3))) + { + num48 = mod.ProjectileType("FlameBeamTip2"); + } - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), - projectile.velocity.X, projectile.velocity.Y, num48, projectile.damage, projectile.knockBack, projectile.owner, 0f, projectile.ai[1] + 1f); - NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - if (projectile.alpha == 150) - { - for (int num55 = 0; num55 < 10; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.01f, projectile.velocity.Y * 0.01f, 200, default, 2f); - Main.dust[num56].noGravity = true; - } - } - } - } + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), + projectile.velocity.X, projectile.velocity.Y, num48, projectile.damage, projectile.knockBack, projectile.owner, 0f, projectile.ai[1] + 1f); + NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + if (projectile.alpha == 150) + { + for (int num55 = 0; num55 < 10; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.01f, projectile.velocity.Y * 0.01f, 200, default, 2f); + Main.dust[num56].noGravity = true; + } + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.OnFire, 300); + } + } } diff --git a/Projectiles/Magic/FlameBeamTip2.cs b/Projectiles/Magic/FlameBeamTip2.cs index 8167c20b1e..d1b0c79f75 100644 --- a/Projectiles/Magic/FlameBeamTip2.cs +++ b/Projectiles/Magic/FlameBeamTip2.cs @@ -1,73 +1,71 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class FlameBeamTip2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public class FlameBeamTip2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } - public override bool PreAI() - { - if (projectile.ai[0] != 0f) - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - projectile.alpha += 5; + public override bool PreAI() + { + if (projectile.ai[0] != 0f) + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + projectile.alpha += 5; - return true; - } + return true; + } - public override void AI() - { - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity; - } - } - } - else - { - if (projectile.alpha == 150) - { - for (int num55 = 0; num55 < 10; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.01f, projectile.velocity.Y * 0.01f, 200, default, 2f); - Main.dust[num56].noGravity = true; - } - } - } - } + public override void AI() + { + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity; + } + } + } + else + { + if (projectile.alpha == 150) + { + for (int num55 = 0; num55 < 10; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.01f, projectile.velocity.Y * 0.01f, 200, default, 2f); + Main.dust[num56].noGravity = true; + } + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.OnFire, 300); + } + } } diff --git a/Projectiles/Magic/FlamePillar.cs b/Projectiles/Magic/FlamePillar.cs index 677bfa37e2..4c65c48b4c 100644 --- a/Projectiles/Magic/FlamePillar.cs +++ b/Projectiles/Magic/FlamePillar.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class FlamePillar : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pillar"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pillar"); + } public override void SetDefaults() { @@ -27,64 +27,64 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 127; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 127; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.OnFire, 600); } } } diff --git a/Projectiles/Magic/FlamingPumpkin.cs b/Projectiles/Magic/FlamingPumpkin.cs index 695d59e94d..596ec98dc3 100644 --- a/Projectiles/Magic/FlamingPumpkin.cs +++ b/Projectiles/Magic/FlamingPumpkin.cs @@ -4,29 +4,29 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class FlamingPumpkin : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pumpkin"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pumpkin"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 14; - projectile.penetrate = 2; - projectile.timeLeft = 200; - projectile.magic = true; - projectile.friendly = true; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 14; + projectile.penetrate = 2; + projectile.timeLeft = 200; + projectile.magic = true; + projectile.friendly = true; + } - public override void AI() - { - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - } + public override void AI() + { + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index e15e8cb299..5f008ee5b0 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class FlareBoltProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -25,40 +25,40 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); - for (int num92 = 0; num92 < 5; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; - } - if (Main.rand.NextBool(5)) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + for (int num92 = 0; num92 < 5; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X -= num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y -= num94; + } + if (Main.rand.NextBool(5)) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -86,16 +86,16 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire, 240); } } } diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index ef7c4101fa..22c106566e 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,95 +8,95 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class ForbiddenAxeBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.magic = true; + } - public override void AI() - { - projectile.alpha -= 3; - projectile.rotation += 0.75f; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) - { - projectile.velocity.X *= 0.85f; - projectile.velocity.Y *= 0.85f; - } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - { - projectile.velocity.X *= 1.25f; - projectile.velocity.Y *= 1.25f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - else if (projectile.ai[1] == 40f) - { - projectile.ai[1] = 0f; - } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - } + public override void AI() + { + projectile.alpha -= 3; + projectile.rotation += 0.75f; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 20f) + { + projectile.velocity.X *= 0.85f; + projectile.velocity.Y *= 0.85f; + } + else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + { + projectile.velocity.X *= 1.25f; + projectile.velocity.Y *= 1.25f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + else if (projectile.ai[1] == 40f) + { + projectile.ai[1] = 0f; + } + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index 516e360a92..1ab8399cb5 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class ForbiddenSunProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sun"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sun"); + } public override void SetDefaults() { @@ -24,36 +24,36 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ForbiddenSunburst"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ForbiddenSunburst"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.OnFire, 600); } } } diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index 5e05868ee9..f33abe16d7 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Magic { public class ForbiddenSunburst : ModProjectile { - private static float ExplosionRadius = 190.0f; + private static float ExplosionRadius = 190.0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sunburst"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunburst"); + } public override void SetDefaults() { @@ -29,93 +29,96 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 0.5f, 0f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-25, 26); - float num464 = (float)Main.rand.Next(-25, 26); - float num465 = (float)Main.rand.Next(9, 24); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 2.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, 0.75f, 0.5f, 0f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-25, 26); + float num464 = (float)Main.rand.Next(-25, 26); + float num465 = (float)Main.rand.Next(9, 24); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 2.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 600); + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.OnFire, 600); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; - return minDist <= ExplosionRadius; - } - } + return minDist <= ExplosionRadius; + } + } } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 1fa3e5921f..7ae989e119 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class FrigidflashBoltProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -25,62 +25,62 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.02f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num92 = 0; num92 < 3; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; - } - if (Main.rand.NextBool(5)) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - for (int num105 = 0; num105 < 3; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; - } - if (Main.rand.NextBool(5)) - { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.02f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num92 = 0; num92 < 3; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X -= num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y -= num94; + } + if (Main.rand.NextBool(5)) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + for (int num105 = 0; num105 < 3; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X -= num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y -= num100; + } + if (Main.rand.NextBool(5)) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -108,18 +108,18 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); } } } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index d4c11a4c38..430aa79536 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class FrostBoltProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -25,40 +25,40 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - for (int num105 = 0; num105 < 3; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; - } - if (Main.rand.NextBool(5)) - { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + for (int num105 = 0; num105 < 3; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X -= num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y -= num100; + } + if (Main.rand.NextBool(5)) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -86,16 +86,16 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 60); + target.AddBuff(BuffID.Frostburn, 60); } } } diff --git a/Projectiles/Magic/GammaLaser.cs b/Projectiles/Magic/GammaLaser.cs index ed8851df0a..0560e0a11a 100644 --- a/Projectiles/Magic/GammaLaser.cs +++ b/Projectiles/Magic/GammaLaser.cs @@ -8,43 +8,43 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class GammaLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 150; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 150; + projectile.magic = true; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.1f, 0.35f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f); - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.1f, 0.35f, 0f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 1; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 1; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index 3e67b1870b..49c015dd74 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -8,321 +8,321 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class GhastlyBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 6; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 6; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } - public override void AI() - { - float[] var_2_2DDF8_cp_0 = projectile.ai; - int var_2_2DDF8_cp_1 = 0; - float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; - var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; - int num1013 = 0; - if (projectile.velocity.Length() <= 8f) //4 - { - num1013 = 1; - } - projectile.alpha -= 15; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (num1013 == 0) - { - projectile.rotation -= 0.104719758f; - if (Main.rand.NextBool(3)) - { - if (Main.rand.NextBool(2)) - { - Vector2 vector140 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust28 = Main.dust[Dust.NewDust(projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust28.noGravity = true; - dust28.position = projectile.Center - vector140 * (float)Main.rand.Next(10, 21); - dust28.velocity = vector140.RotatedBy(1.5707963705062866, default) * 6f; - dust28.scale = 0.5f + Main.rand.NextFloat(); - dust28.fadeIn = 0.5f; - dust28.customData = projectile; - } - else - { - Vector2 vector141 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust29 = Main.dust[Dust.NewDust(projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust29.noGravity = true; - dust29.position = projectile.Center - vector141 * 30f; - dust29.velocity = vector141.RotatedBy(-1.5707963705062866, default) * 3f; - dust29.scale = 0.5f + Main.rand.NextFloat(); - dust29.fadeIn = 0.5f; - dust29.customData = projectile; - } - } - if (projectile.ai[0] >= 30f) - { - projectile.velocity *= 0.98f; - projectile.scale += 0.00744680827f; - if (projectile.scale > 1.2f) - { - projectile.scale = 1.2f; - } - projectile.rotation -= 0.0174532924f; - } - if (projectile.velocity.Length() < 8.2f) //4.1 - { - projectile.velocity.Normalize(); - projectile.velocity *= 4f; - projectile.ai[0] = 0f; - } - } - else if (num1013 == 1) - { - projectile.rotation -= 0.104719758f; - int num3; - for (int num1014 = 0; num1014 < 1; num1014 = num3 + 1) - { - if (Main.rand.NextBool(2)) - { - Vector2 vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; - dust30.scale = 0.9f + Main.rand.NextFloat(); - dust30.fadeIn = 0.5f; - dust30.customData = projectile; - vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; - dust30.scale = 0.9f + Main.rand.NextFloat(); - dust30.fadeIn = 0.5f; - dust30.customData = projectile; - dust30.color = Color.Crimson; - } - else - { - Vector2 vector143 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust31 = Main.dust[Dust.NewDust(projectile.Center - vector143 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust31.noGravity = true; - dust31.position = projectile.Center - vector143 * (float)Main.rand.Next(20, 31); - dust31.velocity = vector143.RotatedBy(-1.5707963705062866, default) * 5f; - dust31.scale = 0.9f + Main.rand.NextFloat(); - dust31.fadeIn = 0.5f; - dust31.customData = projectile; - } - num3 = num1014; - } - if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 241f && Main.myPlayer == projectile.owner) - { - Vector2 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector144.X, vector144.Y, mod.ProjectileType("GhastlySubBlast"), projectile.damage, 0f, projectile.owner, 0f, (float)projectile.whoAmI); - } - Vector2 vector145 = projectile.Center; - float num1015 = 800f; - bool flag59 = false; - int num1016 = 0; - if (projectile.ai[1] == 0f) - { - for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) - { - if (Main.npc[num1017].CanBeChasedBy(projectile, false)) - { - Vector2 center13 = Main.npc[num1017].Center; - if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) - { - num1015 = projectile.Distance(center13); - vector145 = center13; - flag59 = true; - num1016 = num1017; - } - } - num3 = num1017; - } - if (flag59) - { - if (projectile.ai[1] != (float)(num1016 + 1)) - { - projectile.netUpdate = true; - } - projectile.ai[1] = (float)(num1016 + 1); - } - flag59 = false; - } - if (projectile.ai[1] != 0f) - { - int num1018 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) - { - flag59 = true; - vector145 = Main.npc[num1018].Center; - } - } - if (!projectile.friendly) - { - flag59 = false; - } - if (projectile.localAI[0] < 60f) - { - projectile.localAI[0] += 1f; - } - if (flag59 && projectile.localAI[0] >= 60f) - { - float num1019 = 24f; //14 - int num1020 = 8; - Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num1021 = vector145.X - vector146.X; - float num1022 = vector145.Y - vector146.Y; - float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); - num1023 = num1019 / num1023; - num1021 *= num1023; - num1022 *= num1023; - projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; - } - } - if (projectile.alpha < 150) - { - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.1f); - } - if (projectile.ai[0] >= 600f) - { - projectile.Kill(); - } - } + public override void AI() + { + float[] var_2_2DDF8_cp_0 = projectile.ai; + int var_2_2DDF8_cp_1 = 0; + float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; + var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; + int num1013 = 0; + if (projectile.velocity.Length() <= 8f) //4 + { + num1013 = 1; + } + projectile.alpha -= 15; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (num1013 == 0) + { + projectile.rotation -= 0.104719758f; + if (Main.rand.NextBool(3)) + { + if (Main.rand.NextBool(2)) + { + Vector2 vector140 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust28 = Main.dust[Dust.NewDust(projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + dust28.noGravity = true; + dust28.position = projectile.Center - vector140 * (float)Main.rand.Next(10, 21); + dust28.velocity = vector140.RotatedBy(1.5707963705062866, default) * 6f; + dust28.scale = 0.5f + Main.rand.NextFloat(); + dust28.fadeIn = 0.5f; + dust28.customData = projectile; + } + else + { + Vector2 vector141 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust29 = Main.dust[Dust.NewDust(projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + dust29.noGravity = true; + dust29.position = projectile.Center - vector141 * 30f; + dust29.velocity = vector141.RotatedBy(-1.5707963705062866, default) * 3f; + dust29.scale = 0.5f + Main.rand.NextFloat(); + dust29.fadeIn = 0.5f; + dust29.customData = projectile; + } + } + if (projectile.ai[0] >= 30f) + { + projectile.velocity *= 0.98f; + projectile.scale += 0.00744680827f; + if (projectile.scale > 1.2f) + { + projectile.scale = 1.2f; + } + projectile.rotation -= 0.0174532924f; + } + if (projectile.velocity.Length() < 8.2f) //4.1 + { + projectile.velocity.Normalize(); + projectile.velocity *= 4f; + projectile.ai[0] = 0f; + } + } + else if (num1013 == 1) + { + projectile.rotation -= 0.104719758f; + int num3; + for (int num1014 = 0; num1014 < 1; num1014 = num3 + 1) + { + if (Main.rand.NextBool(2)) + { + Vector2 vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + dust30.noGravity = true; + dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); + dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; + dust30.scale = 0.9f + Main.rand.NextFloat(); + dust30.fadeIn = 0.5f; + dust30.customData = projectile; + vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + dust30.noGravity = true; + dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); + dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; + dust30.scale = 0.9f + Main.rand.NextFloat(); + dust30.fadeIn = 0.5f; + dust30.customData = projectile; + dust30.color = Color.Crimson; + } + else + { + Vector2 vector143 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust31 = Main.dust[Dust.NewDust(projectile.Center - vector143 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + dust31.noGravity = true; + dust31.position = projectile.Center - vector143 * (float)Main.rand.Next(20, 31); + dust31.velocity = vector143.RotatedBy(-1.5707963705062866, default) * 5f; + dust31.scale = 0.9f + Main.rand.NextFloat(); + dust31.fadeIn = 0.5f; + dust31.customData = projectile; + } + num3 = num1014; + } + if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 241f && Main.myPlayer == projectile.owner) + { + Vector2 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector144.X, vector144.Y, mod.ProjectileType("GhastlySubBlast"), projectile.damage, 0f, projectile.owner, 0f, (float)projectile.whoAmI); + } + Vector2 vector145 = projectile.Center; + float num1015 = 800f; + bool flag59 = false; + int num1016 = 0; + if (projectile.ai[1] == 0f) + { + for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) + { + if (Main.npc[num1017].CanBeChasedBy(projectile, false)) + { + Vector2 center13 = Main.npc[num1017].Center; + if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) + { + num1015 = projectile.Distance(center13); + vector145 = center13; + flag59 = true; + num1016 = num1017; + } + } + num3 = num1017; + } + if (flag59) + { + if (projectile.ai[1] != (float)(num1016 + 1)) + { + projectile.netUpdate = true; + } + projectile.ai[1] = (float)(num1016 + 1); + } + flag59 = false; + } + if (projectile.ai[1] != 0f) + { + int num1018 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) + { + flag59 = true; + vector145 = Main.npc[num1018].Center; + } + } + if (!projectile.friendly) + { + flag59 = false; + } + if (projectile.localAI[0] < 60f) + { + projectile.localAI[0] += 1f; + } + if (flag59 && projectile.localAI[0] >= 60f) + { + float num1019 = 24f; //14 + int num1020 = 8; + Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num1021 = vector145.X - vector146.X; + float num1022 = vector145.Y - vector146.Y; + float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); + num1023 = num1019 / num1023; + num1021 *= num1023; + num1022 *= num1023; + projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; + } + } + if (projectile.alpha < 150) + { + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.1f); + } + if (projectile.ai[0] >= 600f) + { + projectile.Kill(); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 238); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); - int num3; - for (int num95 = 0; num95 < 4; num95 = num3 + 1) - { - int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num96].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num95; - } - for (int num97 = 0; num97 < 30; num97 = num3 + 1) - { - int num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 3.7f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num98].noGravity = true; - Dust dust = Main.dust[num98]; - dust.velocity *= 3f; - num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num98]; - dust.velocity *= 2f; - Main.dust[num98].noGravity = true; - Main.dust[num98].fadeIn = 1f; - Main.dust[num98].color = Color.Crimson * 0.5f; - num3 = num97; - } - for (int num99 = 0; num99 < 10; num99 = num3 + 1) - { - int num100 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Main.dust[num100].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num100].noGravity = true; - Dust dust = Main.dust[num100]; - dust.velocity *= 3f; - num3 = num99; - } - for (int num101 = 0; num101 < 10; num101 = num3 + 1) - { - int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); - Main.dust[num102].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num102].noGravity = true; - Dust dust = Main.dust[num102]; - dust.velocity *= 3f; - num3 = num101; - } - if (Main.myPlayer == projectile.owner) - { - for (int num105 = 0; num105 < 1000; num105 = num3 + 1) - { - if (Main.projectile[num105].active && Main.projectile[num105].type == mod.ProjectileType("GhastlySubBlast") && Main.projectile[num105].ai[1] == (float)projectile.whoAmI) - { - Main.projectile[num105].Kill(); - } - num3 = num105; - } - int num106 = Main.rand.Next(5, 9); - int num107 = Main.rand.Next(5, 9); - int num108 = Utils.SelectRandom(Main.rand, new int[] - { - 60, - 180 - }); - int num109 = (num108 == 60) ? 180 : 60; - for (int num110 = 0; num110 < num106; num110 = num3 + 1) - { - Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (vector5.X == 0f && vector5.Y == 0f) - { - vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - vector5.Normalize(); - if (vector5.Y > 0.2f) - { - vector5.Y *= -1f; - } - vector5 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num108, 0f); - num3 = num110; - } - for (int num111 = 0; num111 < num107; num111 = num3 + 1) - { - Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (vector7.X == 0f && vector7.Y == 0f) - { - vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - vector7.Normalize(); - if (vector7.Y > 0.4f) - { - vector7.Y *= -1f; - } - vector7 *= (float)Main.rand.Next(40, 81) * 0.1f; - Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, mod.ProjectileType("GhastlyExplosion"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num109, 0f); - num3 = num111; - } - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 238); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.Damage(); + Main.PlaySound(SoundID.Item14, projectile.position); + int num3; + for (int num95 = 0; num95 < 4; num95 = num3 + 1) + { + int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num96].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num3 = num95; + } + for (int num97 = 0; num97 < 30; num97 = num3 + 1) + { + int num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 3.7f); + Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num98].noGravity = true; + Dust dust = Main.dust[num98]; + dust.velocity *= 3f; + num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num98]; + dust.velocity *= 2f; + Main.dust[num98].noGravity = true; + Main.dust[num98].fadeIn = 1f; + Main.dust[num98].color = Color.Crimson * 0.5f; + num3 = num97; + } + for (int num99 = 0; num99 < 10; num99 = num3 + 1) + { + int num100 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); + Main.dust[num100].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num100].noGravity = true; + Dust dust = Main.dust[num100]; + dust.velocity *= 3f; + num3 = num99; + } + for (int num101 = 0; num101 < 10; num101 = num3 + 1) + { + int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); + Main.dust[num102].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num102].noGravity = true; + Dust dust = Main.dust[num102]; + dust.velocity *= 3f; + num3 = num101; + } + if (Main.myPlayer == projectile.owner) + { + for (int num105 = 0; num105 < 1000; num105 = num3 + 1) + { + if (Main.projectile[num105].active && Main.projectile[num105].type == mod.ProjectileType("GhastlySubBlast") && Main.projectile[num105].ai[1] == (float)projectile.whoAmI) + { + Main.projectile[num105].Kill(); + } + num3 = num105; + } + int num106 = Main.rand.Next(5, 9); + int num107 = Main.rand.Next(5, 9); + int num108 = Utils.SelectRandom(Main.rand, new int[] + { + 60, + 180 + }); + int num109 = (num108 == 60) ? 180 : 60; + for (int num110 = 0; num110 < num106; num110 = num3 + 1) + { + Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (vector5.X == 0f && vector5.Y == 0f) + { + vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + vector5.Normalize(); + if (vector5.Y > 0.2f) + { + vector5.Y *= -1f; + } + vector5 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num108, 0f); + num3 = num110; + } + for (int num111 = 0; num111 < num107; num111 = num3 + 1) + { + Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (vector7.X == 0f && vector7.Y == 0f) + { + vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + vector7.Normalize(); + if (vector7.Y > 0.4f) + { + vector7.Y *= -1f; + } + vector7 *= (float)Main.rand.Next(40, 81) * 0.1f; + Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, mod.ProjectileType("GhastlyExplosion"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num109, 0f); + num3 = num111; + } + } + } + } } diff --git a/Projectiles/Magic/GhastlyExplosion.cs b/Projectiles/Magic/GhastlyExplosion.cs index 9ab53c5ed5..126df4d4f3 100644 --- a/Projectiles/Magic/GhastlyExplosion.cs +++ b/Projectiles/Magic/GhastlyExplosion.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class GhastlyExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -24,69 +24,69 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int num3; - int num328 = (int)projectile.ai[0]; - for (int num329 = 0; num329 < 3; num329 = num3 + 1) - { - int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default, 1.2f); - Main.dust[num330].position = (Main.dust[num330].position + projectile.Center) / 2f; - Main.dust[num330].noGravity = true; - Dust dust = Main.dust[num330]; - dust.velocity *= 0.5f; - num3 = num329; - } - for (int num331 = 0; num331 < 2; num331 = num3 + 1) - { - int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default, 0.4f); - if (num331 == 0) - { - Main.dust[num330].position = (Main.dust[num330].position + projectile.Center * 5f) / 6f; - } - else if (num331 == 1) - { - Main.dust[num330].position = (Main.dust[num330].position + (projectile.Center + projectile.velocity / 2f) * 5f) / 6f; - } - Dust dust = Main.dust[num330]; - dust.velocity *= 0.1f; - Main.dust[num330].noGravity = true; - Main.dust[num330].fadeIn = 1f; - num3 = num331; - } - return; + int num3; + int num328 = (int)projectile.ai[0]; + for (int num329 = 0; num329 < 3; num329 = num3 + 1) + { + int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default, 1.2f); + Main.dust[num330].position = (Main.dust[num330].position + projectile.Center) / 2f; + Main.dust[num330].noGravity = true; + Dust dust = Main.dust[num330]; + dust.velocity *= 0.5f; + num3 = num329; + } + for (int num331 = 0; num331 < 2; num331 = num3 + 1) + { + int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default, 0.4f); + if (num331 == 0) + { + Main.dust[num330].position = (Main.dust[num330].position + projectile.Center * 5f) / 6f; + } + else if (num331 == 1) + { + Main.dust[num330].position = (Main.dust[num330].position + (projectile.Center + projectile.velocity / 2f) * 5f) / 6f; + } + Dust dust = Main.dust[num330]; + dust.velocity *= 0.1f; + Main.dust[num330].noGravity = true; + Main.dust[num330].fadeIn = 1f; + num3 = num331; + } + return; } public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item50, projectile.position); - int num3; - for (int num116 = 0; num116 < 20; num116 = num3 + 1) - { - int num117 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); - Dust dust; - Main.dust[num117].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num117].noGravity = true; - dust = Main.dust[num117]; - dust.velocity *= 2.5f; - dust = Main.dust[num117]; - dust.velocity -= projectile.oldVelocity / 10f; - num3 = num116; - } - if (Main.myPlayer == projectile.owner) - { - int num118 = Main.rand.Next(3, 6); - for (int num119 = 0; num119 < num118; num119 = num3 + 1) - { - Vector2 vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (vector8.X == 0f && vector8.Y == 0f) - { - vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - vector8.Normalize(); - vector8 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), vector8.X, vector8.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.9), projectile.knockBack * 0.8f, projectile.owner, projectile.ai[0], 0f); - num3 = num119; - } - } + int num3; + for (int num116 = 0; num116 < 20; num116 = num3 + 1) + { + int num117 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); + Dust dust; + Main.dust[num117].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[num117].noGravity = true; + dust = Main.dust[num117]; + dust.velocity *= 2.5f; + dust = Main.dust[num117]; + dust.velocity -= projectile.oldVelocity / 10f; + num3 = num116; + } + if (Main.myPlayer == projectile.owner) + { + int num118 = Main.rand.Next(3, 6); + for (int num119 = 0; num119 < num118; num119 = num3 + 1) + { + Vector2 vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (vector8.X == 0f && vector8.Y == 0f) + { + vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + vector8.Normalize(); + vector8 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), vector8.X, vector8.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.9), projectile.knockBack * 0.8f, projectile.owner, projectile.ai[0], 0f); + num3 = num119; + } + } } } } diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index 8f0525b26a..fa7b406b57 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class GhastlyExplosionShard : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -23,61 +23,61 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int num3 = 0; - int num332 = (int)projectile.ai[0]; - projectile.ai[1] += 1f; - float num333 = (60f - projectile.ai[1]) / 60f; - if (projectile.ai[1] > 40f) - { - projectile.Kill(); - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - if (projectile.velocity.Y > 18f) - { - projectile.velocity.Y = 18f; - } - projectile.velocity.X = projectile.velocity.X * 0.98f; - for (int num334 = 0; num334 < 2; num334 = num3 + 1) - { - int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default, 1.1f); - Main.dust[num335].position = (Main.dust[num335].position + projectile.Center) / 2f; - Main.dust[num335].noGravity = true; - Dust dust = Main.dust[num335]; - dust.velocity *= 0.3f; - dust = Main.dust[num335]; - dust.scale *= num333; - num3 = num334; - } - for (int num336 = 0; num336 < 1; num336 = num3 + 1) - { - int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num335].position = (Main.dust[num335].position + projectile.Center * 5f) / 6f; - Dust dust = Main.dust[num335]; - dust.velocity *= 0.1f; - Main.dust[num335].noGravity = true; - Main.dust[num335].fadeIn = 0.9f * num333; - dust = Main.dust[num335]; - dust.scale *= num333; - num3 = num336; - } - return; + int num3 = 0; + int num332 = (int)projectile.ai[0]; + projectile.ai[1] += 1f; + float num333 = (60f - projectile.ai[1]) / 60f; + if (projectile.ai[1] > 40f) + { + projectile.Kill(); + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + if (projectile.velocity.Y > 18f) + { + projectile.velocity.Y = 18f; + } + projectile.velocity.X = projectile.velocity.X * 0.98f; + for (int num334 = 0; num334 < 2; num334 = num3 + 1) + { + int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default, 1.1f); + Main.dust[num335].position = (Main.dust[num335].position + projectile.Center) / 2f; + Main.dust[num335].noGravity = true; + Dust dust = Main.dust[num335]; + dust.velocity *= 0.3f; + dust = Main.dust[num335]; + dust.scale *= num333; + num3 = num334; + } + for (int num336 = 0; num336 < 1; num336 = num3 + 1) + { + int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); + Main.dust[num335].position = (Main.dust[num335].position + projectile.Center * 5f) / 6f; + Dust dust = Main.dust[num335]; + dust.velocity *= 0.1f; + Main.dust[num335].noGravity = true; + Main.dust[num335].fadeIn = 0.9f * num333; + dust = Main.dust[num335]; + dust.scale *= num333; + num3 = num336; + } + return; } public override void Kill(int timeLeft) { - int num3; - for (int num114 = 0; num114 < 10; num114 = num3 + 1) - { - int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); - Dust dust; - Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num115].noGravity = true; - dust = Main.dust[num115]; - dust.velocity *= 1.25f; - dust = Main.dust[num115]; - dust.velocity -= projectile.oldVelocity / 10f; - num3 = num114; - } + int num3; + for (int num114 = 0; num114 < 10; num114 = num3 + 1) + { + int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); + Dust dust; + Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[num115].noGravity = true; + dust = Main.dust[num115]; + dust.velocity *= 1.25f; + dust = Main.dust[num115]; + dust.velocity -= projectile.oldVelocity / 10f; + num3 = num114; + } } } } diff --git a/Projectiles/Magic/GhastlySubBlast.cs b/Projectiles/Magic/GhastlySubBlast.cs index 8196a9e2cd..a03e9337ac 100644 --- a/Projectiles/Magic/GhastlySubBlast.cs +++ b/Projectiles/Magic/GhastlySubBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class GhastlySubBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -22,95 +22,95 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 420; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; } public override void AI() { - bool flag60 = false; - bool flag61 = false; - int num3 = projectile.type; - int num1024 = mod.ProjectileType("GhastlyBlast"); - float num1025 = 420f; - float x3 = 0.15f; - float y3 = 0.15f; - if (flag61) - { - int num1026 = (int)projectile.ai[1]; - if (!Main.projectile[num1026].active || Main.projectile[num1026].type != num1024) - { - projectile.Kill(); - return; - } - projectile.timeLeft = 2; - } - float[] npcArray = projectile.ai; - int npcChase = 0; - float num73 = npcArray[npcChase]; - npcArray[npcChase] = num73 + 1f; - if (projectile.ai[0] < num1025) - { - bool flag62 = true; - int num1027 = (int)projectile.ai[1]; - if (Main.projectile[num1027].active && Main.projectile[num1027].type == num1024) - { - if (!flag60 && Main.projectile[num1027].oldPos[1] != Vector2.Zero) - { - projectile.position += Main.projectile[num1027].position - Main.projectile[num1027].oldPos[1]; - } - if (projectile.Center.HasNaNs()) - { - projectile.Kill(); - return; - } - } - else - { - projectile.ai[0] = num1025; - flag62 = false; - projectile.Kill(); - } - if (flag62 && !flag60) - { - projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[num1027].Center.X - projectile.Center.X), (float)Math.Sign(Main.projectile[num1027].Center.Y - projectile.Center.Y)) * new Vector2(x3, y3); - if (projectile.velocity.Length() > 6f) - { - projectile.velocity *= 6f / projectile.velocity.Length(); - } - } - if (Main.rand.NextBool(2)) - { - int num1028 = Dust.NewDust(projectile.Center, 8, 8, 60, 0f, 0f, 0, default, 1f); - Main.dust[num1028].position = projectile.Center; - Main.dust[num1028].velocity = projectile.velocity; - Main.dust[num1028].noGravity = true; - Main.dust[num1028].scale = 1.5f; - if (flag62) - { - Main.dust[num1028].customData = Main.projectile[(int)projectile.ai[1]]; - } - } - projectile.alpha = 255; - return; - } + bool flag60 = false; + bool flag61 = false; + int num3 = projectile.type; + int num1024 = mod.ProjectileType("GhastlyBlast"); + float num1025 = 420f; + float x3 = 0.15f; + float y3 = 0.15f; + if (flag61) + { + int num1026 = (int)projectile.ai[1]; + if (!Main.projectile[num1026].active || Main.projectile[num1026].type != num1024) + { + projectile.Kill(); + return; + } + projectile.timeLeft = 2; + } + float[] npcArray = projectile.ai; + int npcChase = 0; + float num73 = npcArray[npcChase]; + npcArray[npcChase] = num73 + 1f; + if (projectile.ai[0] < num1025) + { + bool flag62 = true; + int num1027 = (int)projectile.ai[1]; + if (Main.projectile[num1027].active && Main.projectile[num1027].type == num1024) + { + if (!flag60 && Main.projectile[num1027].oldPos[1] != Vector2.Zero) + { + projectile.position += Main.projectile[num1027].position - Main.projectile[num1027].oldPos[1]; + } + if (projectile.Center.HasNaNs()) + { + projectile.Kill(); + return; + } + } + else + { + projectile.ai[0] = num1025; + flag62 = false; + projectile.Kill(); + } + if (flag62 && !flag60) + { + projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[num1027].Center.X - projectile.Center.X), (float)Math.Sign(Main.projectile[num1027].Center.Y - projectile.Center.Y)) * new Vector2(x3, y3); + if (projectile.velocity.Length() > 6f) + { + projectile.velocity *= 6f / projectile.velocity.Length(); + } + } + if (Main.rand.NextBool(2)) + { + int num1028 = Dust.NewDust(projectile.Center, 8, 8, 60, 0f, 0f, 0, default, 1f); + Main.dust[num1028].position = projectile.Center; + Main.dust[num1028].velocity = projectile.velocity; + Main.dust[num1028].noGravity = true; + Main.dust[num1028].scale = 1.5f; + if (flag62) + { + Main.dust[num1028].customData = Main.projectile[(int)projectile.ai[1]]; + } + } + projectile.alpha = 255; + return; + } } public override void Kill(int timeLeft) { - projectile.ai[0] = 60f; - int num3; - for (int num114 = 0; num114 < 10; num114 = num3 + 1) - { - int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); - Dust dust; - Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num115].noGravity = true; - dust = Main.dust[num115]; - dust.velocity *= 1.25f; - dust = Main.dust[num115]; - dust.velocity -= projectile.oldVelocity / 10f; - num3 = num114; - } + projectile.ai[0] = 60f; + int num3; + for (int num114 = 0; num114 < 10; num114 = num3 + 1) + { + int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); + Dust dust; + Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[num115].noGravity = true; + dust = Main.dust[num115]; + dust.velocity *= 1.25f; + dust = Main.dust[num115]; + dust.velocity -= projectile.oldVelocity / 10f; + num3 = num114; + } } } } diff --git a/Projectiles/Magic/GhastlyVisage.cs b/Projectiles/Magic/GhastlyVisage.cs index aa6374039c..06c56c39a8 100644 --- a/Projectiles/Magic/GhastlyVisage.cs +++ b/Projectiles/Magic/GhastlyVisage.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Magic { public class GhastlyVisage : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Visage"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Visage"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -27,54 +27,54 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.ai[0] += 1f; - int num39 = 0; - if (projectile.ai[0] >= 240f) - { - num39++; - } - if (projectile.ai[0] >= 480f) - { - num39++; - } - int num40 = 40; - int num41 = 2; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); - } - bool flag16 = player.channel && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.ai[0] += 1f; + int num39 = 0; + if (projectile.ai[0] >= 240f) + { + num39++; + } + if (projectile.ai[0] >= 480f) + { + num39++; + } + int num40 = 40; + int num41 = 2; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + } + bool flag16 = player.channel && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } int manaCost = (int)(20f * player.manaCost); - if (projectile.localAI[1] == 0f) - { - if (player.statMana < manaCost) - { + if (projectile.localAI[1] == 0f) + { + if (player.statMana < manaCost) + { if (player.manaFlower) { player.QuickMana(); @@ -93,19 +93,19 @@ namespace CalamityMod.Projectiles.Magic projectile.Kill(); } } - else - { + else + { if (player.statMana >= (int)((float)manaCost)) { player.statMana -= manaCost; player.manaRegenDelay = (int)player.maxRegenDelay; } } - projectile.localAI[1] += 1f; - Main.PlaySound(SoundID.Item117, projectile.position); - } - if (projectile.soundDelay <= 0 && flag16) - { + projectile.localAI[1] += 1f; + Main.PlaySound(SoundID.Item117, projectile.position); + } + if (projectile.soundDelay <= 0 && flag16) + { if (player.statMana < manaCost) { if (player.manaFlower) @@ -135,61 +135,61 @@ namespace CalamityMod.Projectiles.Magic } } projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item117, projectile.position); - } - projectile.localAI[0] = 12f; - } - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = mod.ProjectileType("GhastlyBlast"); - float scaleFactor11 = 6f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -10f, 10f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item117, projectile.position); + } + projectile.localAI[0] = 12f; + } + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = mod.ProjectileType("GhastlyBlast"); + float scaleFactor11 = 6f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -10f, 10f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index a861d814c1..d44203a396 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -5,72 +5,72 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class GleamingBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 250; - projectile.penetrate = 1; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 250; + projectile.penetrate = 1; + projectile.magic = true; + } - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 3; dust++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + for (int dust = 0; dust < 3; dust++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 90f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + } + } } diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index 797fba7bb8..99d088a9d4 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -4,57 +4,57 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class GleamingBolt2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.magic = true; + } - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 2; dust++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + for (int dust = 0; dust < 2; dust++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index f288b92cd7..460e5891fa 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class GraniteEnergy : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Granite Energy"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Granite Energy"); + } public override void SetDefaults() { @@ -25,46 +25,46 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f); - Main.dust[num469].velocity *= 0f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 22f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f); + Main.dust[num469].velocity *= 0f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 22f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } } } diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs index 618c52f025..6ac6c005dd 100644 --- a/Projectiles/Magic/GranitePulse.cs +++ b/Projectiles/Magic/GranitePulse.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,13 +7,13 @@ namespace CalamityMod.Projectiles.Magic { public class GranitePulse : ModProjectile { - public int pulse = 49; - public float count = 0f; + public int pulse = 49; + public float count = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pulse"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pulse"); + } public override void SetDefaults() { @@ -29,116 +29,116 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 1) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - return; - } - } - if (count == 0f) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - pulse--; - if (pulse == 0) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].velocity *= 2f; - } - pulse = 50; - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 1) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + return; + } + } + if (count == 0f) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + pulse--; + if (pulse == 0) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + Main.dust[num624].velocity *= 2f; + } + pulse = 50; + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } } } diff --git a/Projectiles/Magic/HeliumFlashBlast.cs b/Projectiles/Magic/HeliumFlashBlast.cs index 6b8dd3705a..7946e62696 100644 --- a/Projectiles/Magic/HeliumFlashBlast.cs +++ b/Projectiles/Magic/HeliumFlashBlast.cs @@ -1,7 +1,7 @@ -using System; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; -using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -93,9 +93,12 @@ namespace CalamityMod.Projectiles.Magic float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; return minDist <= ExplosionRadius; } diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index b1197daf2e..61686f2f66 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -1,100 +1,100 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class HellfireExplosionFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } - public override void SetDefaults() - { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } } diff --git a/Projectiles/Magic/HellfireExplosionFriendly2.cs b/Projectiles/Magic/HellfireExplosionFriendly2.cs index 8e390c3a42..58f27c4caa 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly2.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class HellfireExplosionFriendly2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -26,73 +26,73 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-15, 16); - float num464 = (float)Main.rand.Next(-15, 16); - float num465 = (float)Main.rand.Next(5, 12); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 0.75f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-15, 16); + float num464 = (float)Main.rand.Next(-15, 16); + float num465 = (float)Main.rand.Next(5, 12); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 0.75f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); } } } diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index cd130fa03b..827f0a72d8 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -6,11 +6,11 @@ namespace CalamityMod.Projectiles.Magic { public class HolyFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -26,56 +26,56 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.alpha -= 3; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); + projectile.alpha -= 3; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 300); + target.AddBuff(mod.BuffType("HolyLight"), 300); } } } diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index 79f95a631b..07e8ffcb87 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class HolyLaser : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } public override void SetDefaults() { @@ -21,12 +21,12 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 100; projectile.timeLeft = 180; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - projectile.localAI[0] += 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { Vector2 vector33 = projectile.position; @@ -49,12 +49,12 @@ namespace CalamityMod.Projectiles.Magic } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceMagic = true; - } - } + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceMagic = true; + } + } } } diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index 62176cf58e..90e9487f63 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Magic { public class IceCluster : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -29,95 +29,95 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation += 0.5f; - if (projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 120); - } - projectile.ai[0] += 1f; - if (projectile.ai[1] == 1f) - { - if (projectile.ai[0] >= 130f) - { - projectile.alpha += 10; - } - else - { - projectile.alpha -= 10; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - if (projectile.ai[0] >= 150f) - { - return; - } - if (projectile.ai[0] % 30f == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector80 = projectile.rotation.ToRotationVector2(); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); - } - else - { - if (projectile.ai[0] >= 40f) - { - projectile.alpha += 3; - } - else - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - if (projectile.ai[0] >= 45f) - { - return; - } - Vector2 value47 = new Vector2(0f, -720f).RotatedBy((double)projectile.velocity.ToRotation(), default); - float scaleFactor8 = projectile.ai[0] % 45f / 45f; - Vector2 spinningpoint = value47 * scaleFactor8; - for (int num844 = 0; num844 < 6; num844++) - { - Vector2 vector81 = projectile.Center + spinningpoint.RotatedBy((double)((float)num844 * 6.28318548f / 6f), default); - Lighting.AddLight(vector81, 0.3f, 0.75f, 0.9f); - for (int num845 = 0; num845 < 2; num845++) - { - int num846 = Dust.NewDust(vector81 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent, 1f); - Main.dust[num846].noGravity = true; - } - } - } + projectile.rotation += 0.5f; + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 120); + } + projectile.ai[0] += 1f; + if (projectile.ai[1] == 1f) + { + if (projectile.ai[0] >= 130f) + { + projectile.alpha += 10; + } + else + { + projectile.alpha -= 10; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + if (projectile.ai[0] >= 150f) + { + return; + } + if (projectile.ai[0] % 30f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector80 = projectile.rotation.ToRotationVector2(); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); + } + else + { + if (projectile.ai[0] >= 40f) + { + projectile.alpha += 3; + } + else + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + if (projectile.ai[0] >= 45f) + { + return; + } + Vector2 value47 = new Vector2(0f, -720f).RotatedBy((double)projectile.velocity.ToRotation(), default); + float scaleFactor8 = projectile.ai[0] % 45f / 45f; + Vector2 spinningpoint = value47 * scaleFactor8; + for (int num844 = 0; num844 < 6; num844++) + { + Vector2 vector81 = projectile.Center + spinningpoint.RotatedBy((double)((float)num844 * 6.28318548f / 6f), default); + Lighting.AddLight(vector81, 0.3f, 0.75f, 0.9f); + for (int num845 = 0; num845 < 2; num845++) + { + int num846 = Dust.NewDust(vector81 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent, 1f); + Main.dust[num846].noGravity = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("GlacialState"), 120); - Vector2 vector80 = projectile.rotation.ToRotationVector2(); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("GlacialState"), 120); + Vector2 vector80 = projectile.rotation.ToRotationVector2(); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Magic/IceSpike.cs b/Projectiles/Magic/IceSpike.cs index fed6c9416a..dce7b5508b 100644 --- a/Projectiles/Magic/IceSpike.cs +++ b/Projectiles/Magic/IceSpike.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class IceSpike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } public override void SetDefaults() { @@ -68,16 +68,16 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, 0f, 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, 0f, 0f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.Frostburn, 240); } } } diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index da9dbc41ec..2237d593cb 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Magic { public class InfernadoFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernado"); + Main.projFrames[projectile.type] = 6; + } public override void SetDefaults() { @@ -25,108 +25,108 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.timeLeft = 500; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - int num613 = 22; - int num614 = 22; - float num615 = 2.5f; - int num616 = 320; - int num617 = 88; - if (Main.rand.NextBool(25)) + int num613 = 22; + int num614 = 22; + float num615 = 2.5f; + int num616 = 320; + int num617 = 88; + if (Main.rand.NextBool(25)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + return; } - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - return; - } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 53, projectile.alpha); + return new Color(255, 255, 53, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } } } diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index 99b0019c30..584f3ae3e4 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,17 +7,17 @@ namespace CalamityMod.Projectiles.Magic { public class InfernadoMarkFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } public override void SetDefaults() { projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.magic = true; + projectile.magic = true; projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 5; @@ -25,116 +25,116 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) - { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - return; - } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + return; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - for (int num234 = num231; num234 < num231 + num233; num234++) - { - Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("InfernadoFriendly"), 390, 15f, Main.myPlayer, 16f, 16f); - Main.projectile[num236].netUpdate = true; - } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + for (int num234 = num231; num234 < num231 + num233; num234++) + { + Tile tile = Main.tile[num232, num234]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("InfernadoFriendly"), 390, 15f, Main.myPlayer, 16f, 16f); + Main.projectile[num236].netUpdate = true; + } } } } diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index eb7c4e40e9..5456e92646 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Magic { public class InfernalBlade : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } public override void SetDefaults() { @@ -30,105 +30,105 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y -= 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y -= 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 50, 50, 0); + return new Color(255, 50, 50, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; if (speedX > 15f) { speedX = 15f; @@ -146,10 +146,10 @@ namespace CalamityMod.Projectiles.Magic speedY = -15f; } if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("InfernalBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("InfernalBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); } } } diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 72b345d074..31f2dd8a59 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class InfernalBlade2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } public override void SetDefaults() { @@ -29,96 +29,96 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y -= 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y -= 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 50, 50, 0); + return new Color(255, 50, 50, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); } } } diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index d5cbdd8f8a..bd69bd67f2 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -8,91 +8,91 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class IonBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.ignoreWater = false; - projectile.timeLeft = 120; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.ignoreWater = false; + projectile.timeLeft = 120; + projectile.magic = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - if (projectile.alpha > 0) - { - projectile.alpha -= 3; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.2f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.X *= 1.015f; + projectile.velocity.Y *= 1.015f; + if (projectile.alpha > 0) + { + projectile.alpha -= 3; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.2f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); - int num212 = Main.rand.Next(15, 30); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default, 1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); + int num212 = Main.rand.Next(15, 30); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default, 1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index b86ca0c1da..e44f6c6629 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Magic { public class LiquidBlade : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } public override void SetDefaults() { @@ -31,104 +31,104 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y -= 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y -= 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; if (speedX > 15f) { speedX = 15f; @@ -146,13 +146,13 @@ namespace CalamityMod.Projectiles.Magic speedY = -15f; } if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("LiquidBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); - } - target.AddBuff(BuffID.Ichor, 600); - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.CursedInferno, 600); + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("LiquidBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); + } + target.AddBuff(BuffID.Ichor, 600); + target.AddBuff(BuffID.Frostburn, 600); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.CursedInferno, 600); } - } + } } diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index c15f053ed6..dd1072668f 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class LiquidBlade2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } public override void SetDefaults() { @@ -30,99 +30,99 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y -= 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y -= 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, 600); - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.CursedInferno, 600); + target.AddBuff(BuffID.Ichor, 600); + target.AddBuff(BuffID.Frostburn, 600); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.CursedInferno, 600); } } } diff --git a/Projectiles/Magic/MagicNebulaShot.cs b/Projectiles/Magic/MagicNebulaShot.cs index fc5b61e6e2..9aef458aa7 100644 --- a/Projectiles/Magic/MagicNebulaShot.cs +++ b/Projectiles/Magic/MagicNebulaShot.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class MagicNebulaShot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } public override void SetDefaults() { @@ -24,41 +24,41 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.extraUpdates = 5; projectile.timeLeft = 200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } public override void AI() { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 15; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(3) ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(3) ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } } diff --git a/Projectiles/Magic/MagnaBlast.cs b/Projectiles/Magic/MagnaBlast.cs index d764f2bbc0..ab8dc5abb6 100644 --- a/Projectiles/Magic/MagnaBlast.cs +++ b/Projectiles/Magic/MagnaBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class MagnaBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -23,32 +23,32 @@ namespace CalamityMod.Projectiles.Magic } public override void AI() - { - if (projectile.scale <= 1.6f) - { - projectile.scale *= 1.01f; - projectile.width = (int)(16f * projectile.scale); - projectile.height = (int)(32f * projectile.scale); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default, projectile.scale); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + { + if (projectile.scale <= 1.6f) + { + projectile.scale *= 1.01f; + projectile.width = (int)(16f * projectile.scale); + projectile.height = (int)(32f * projectile.scale); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default, projectile.scale); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index 7959b2d155..1047ef0846 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class MagneticBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -23,21 +23,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } } } } diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index bb4f65a7d5..cf0528ca9c 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Magic { public class MagneticOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnetic Orb"); - Main.projFrames[projectile.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnetic Orb"); + Main.projFrames[projectile.type] = 5; + } public override void SetDefaults() { @@ -28,104 +28,104 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; - if (projectile.velocity.X > 0f) - { - projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - else - { - projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 4) - { - projectile.frame = 0; - } - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int num3; - for (int num433 = 0; num433 < 1000; num433 = num3 + 1) - { - num3 = num433; - } - int[] array = new int[20]; - int num434 = 0; - float num435 = 400f; - bool flag14 = false; - for (int num436 = 0; num436 < 200; num436 = num3 + 1) - { - if (Main.npc[num436].CanBeChasedBy(projectile, false)) - { - float num437 = Main.npc[num436].position.X + (float)(Main.npc[num436].width / 2); - float num438 = Main.npc[num436].position.Y + (float)(Main.npc[num436].height / 2); - float num439 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num437) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num438); - if (num439 < num435 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num436].Center, 1, 1)) - { - if (num434 < 20) - { - array[num434] = num436; - num434++; - } - flag14 = true; - } - } - num3 = num436; - } - if (projectile.timeLeft < 30) - { - flag14 = false; - } - if (flag14) - { - int num440 = Main.rand.Next(num434); - num440 = array[num440]; - float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2); - float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - projectile.localAI[0] = 0f; - float num443 = 8f; - Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - vector33 += projectile.velocity * 4f; - float num444 = num441 - vector33.X; - float num445 = num442 - vector33.Y; - float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); - num446 = num443 / num446; - num444 *= num446; - num445 *= num446; - Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, mod.ProjectileType("MagneticBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - return; - } - } + projectile.velocity.X *= 0.98f; + projectile.velocity.Y *= 0.98f; + if (projectile.velocity.X > 0f) + { + projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + else + { + projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int num3; + for (int num433 = 0; num433 < 1000; num433 = num3 + 1) + { + num3 = num433; + } + int[] array = new int[20]; + int num434 = 0; + float num435 = 400f; + bool flag14 = false; + for (int num436 = 0; num436 < 200; num436 = num3 + 1) + { + if (Main.npc[num436].CanBeChasedBy(projectile, false)) + { + float num437 = Main.npc[num436].position.X + (float)(Main.npc[num436].width / 2); + float num438 = Main.npc[num436].position.Y + (float)(Main.npc[num436].height / 2); + float num439 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num437) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num438); + if (num439 < num435 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num436].Center, 1, 1)) + { + if (num434 < 20) + { + array[num434] = num436; + num434++; + } + flag14 = true; + } + } + num3 = num436; + } + if (projectile.timeLeft < 30) + { + flag14 = false; + } + if (flag14) + { + int num440 = Main.rand.Next(num434); + num440 = array[num440]; + float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2); + float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + projectile.localAI[0] = 0f; + float num443 = 8f; + Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + vector33 += projectile.velocity * 4f; + float num444 = num441 - vector33.X; + float num445 = num442 - vector33.Y; + float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); + num446 = num443 / num446; + num444 *= num446; + num445 *= num446; + Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, mod.ProjectileType("MagneticBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + return; + } + } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 30) - { - float num7 = (float)projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num7); - } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + if (projectile.timeLeft < 30) + { + float num7 = (float)projectile.timeLeft / 30f; + projectile.alpha = (int)(255f - 255f * num7); + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } } } diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index f2921a24ae..5dad9ddc5b 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class MagnusBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -26,176 +26,176 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float num29 = 5f; - float num30 = 150f; - float scaleFactor = 6f; - Vector2 value7 = new Vector2(10f, 20f); - float num31 = 1f; - int num32 = 3 * projectile.MaxUpdates; - int num33 = Utils.SelectRandom(Main.rand, new int[] - { - 56, - 92, - 229, - 206, - 181 - }); - int num34 = 261; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - projectile.localAI[0] = (float)(-(float)Main.rand.Next(48)); - } - else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) - { - int num35 = -1; - float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) - { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) - { - Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) - { - num36 = num38; - num35 = num37; - } - } - } - if (num36 < 8f) - { - projectile.Kill(); - return; - } - if (num35 != -1) - { - projectile.ai[1] = num29 + 1f; - projectile.ai[0] = (float)num35; - projectile.netUpdate = true; - } - } - else if (projectile.ai[1] > num29) - { - projectile.ai[1] += 1f; - int num39 = (int)projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - else - { - projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - projectile.Center; - if (vector6.Length() < 20f) - { - projectile.Kill(); - return; - } - if (vector6 != Vector2.Zero) - { - vector6.Normalize(); - vector6 *= scaleFactor; - } - float num40 = 30f; - projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; - } - } - if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] == num29) - { - projectile.ai[1] = 1f; - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) - { - projectile.localAI[0] = 0f; - } - else if (projectile.alpha == 0) - { - for (int num41 = 0; num41 < 2; num41++) - { - Vector2 value8 = Vector2.UnitX * -30f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = num31; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8 + projectile.velocity * 2f; - Main.dust[num42].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + projectile.velocity * 2f; - } - } - if (Main.rand.NextBool(12)) - { - for (int num43 = 0; num43 < 1; num43++) - { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 100, default, 1f); - Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; - Main.dust[num44].fadeIn = 0.9f; - } - } - if (Main.rand.NextBool(64)) - { - for (int num45 = 0; num45 < 1; num45++) - { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 155, default, 0.8f); - Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num46].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(4)) - { - for (int num47 = 0; num47 < 2; num47++) - { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1.2f); - Main.dust[num48].velocity *= 0.3f; - Main.dust[num48].noGravity = true; - Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num48].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(3)) - { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); - Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; - Main.dust[num50].fadeIn = 1.2f; - Main.dust[num50].scale = 1.5f; - Main.dust[num50].noGravity = true; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 263, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 263, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } + float num29 = 5f; + float num30 = 150f; + float scaleFactor = 6f; + Vector2 value7 = new Vector2(10f, 20f); + float num31 = 1f; + int num32 = 3 * projectile.MaxUpdates; + int num33 = Utils.SelectRandom(Main.rand, new int[] + { + 56, + 92, + 229, + 206, + 181 + }); + int num34 = 261; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + projectile.localAI[0] = (float)(-(float)Main.rand.Next(48)); + } + else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + { + int num35 = -1; + float num36 = num30; + for (int num37 = 0; num37 < 200; num37++) + { + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + { + Vector2 center3 = Main.npc[num37].Center; + float num38 = Vector2.Distance(center3, projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + { + num36 = num38; + num35 = num37; + } + } + } + if (num36 < 8f) + { + projectile.Kill(); + return; + } + if (num35 != -1) + { + projectile.ai[1] = num29 + 1f; + projectile.ai[0] = (float)num35; + projectile.netUpdate = true; + } + } + else if (projectile.ai[1] > num29) + { + projectile.ai[1] += 1f; + int num39 = (int)projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + else + { + projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + if (vector6.Length() < 20f) + { + projectile.Kill(); + return; + } + if (vector6 != Vector2.Zero) + { + vector6.Normalize(); + vector6 *= scaleFactor; + } + float num40 = 30f; + projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + } + } + if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] == num29) + { + projectile.ai[1] = 1f; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else if (projectile.alpha == 0) + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -30f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = num31; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8 + projectile.velocity * 2f; + Main.dust[num42].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + projectile.velocity * 2f; + } + } + if (Main.rand.NextBool(12)) + { + for (int num43 = 0; num43 < 1; num43++) + { + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 100, default, 1f); + Main.dust[num44].velocity *= 0.1f; + Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].fadeIn = 0.9f; + } + } + if (Main.rand.NextBool(64)) + { + for (int num45 = 0; num45 < 1; num45++) + { + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 155, default, 0.8f); + Main.dust[num46].velocity *= 0.3f; + Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num46].fadeIn = 1.4f; + } + } + } + if (Main.rand.NextBool(4)) + { + for (int num47 = 0; num47 < 2; num47++) + { + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1.2f); + Main.dust[num48].velocity *= 0.3f; + Main.dust[num48].noGravity = true; + Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num48].fadeIn = 1.4f; + } + } + } + if (Main.rand.NextBool(3)) + { + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); + Main.dust[num50].velocity *= 0.3f; + Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; + Main.dust[num50].fadeIn = 1.2f; + Main.dust[num50].scale = 1.5f; + Main.dust[num50].noGravity = true; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 263, 0f, 0f, 100, default, 1.35f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 263, 0f, 0f, 100, default, 1f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].noGravity = true; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -207,84 +207,84 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.statMana += 25; - player.HealEffect(1); - player.ManaEffect(25); - } + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.statMana += 25; + player.HealEffect(1); + player.ManaEffect(25); + } public override void Kill(int timeLeft) { int num47 = Utils.SelectRandom(Main.rand, new int[] - { - 56, - 92, - 229, - 206, - 181 - }); - int num48 = 263; - int num49 = 263; - int height = 50; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - num47 = Utils.SelectRandom(Main.rand, new int[] - { - 56, - 92, - 229, - 206, - 181 - }); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } + { + 56, + 92, + 229, + 206, + 181 + }); + int num48 = 263; + int num49 = 263; + int height = 50; + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item14, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + num47 = Utils.SelectRandom(Main.rand, new int[] + { + 56, + 92, + 229, + 206, + 181 + }); + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } } } } diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index 8a8741f40a..6da3aaa604 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class ManaBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } @@ -34,24 +34,24 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 3; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("ManaBoltSmall"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("ManaBoltSmall2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ManaBoltSmall"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ManaBoltSmall2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); } } } diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index 9c25b75aa7..07665a9edd 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Magic { public class ManaBoltSmall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } @@ -32,9 +32,9 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); } } } diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index 24bd113c7a..54bbf401d4 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Magic { public class ManaBoltSmall2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } @@ -32,9 +32,9 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); } } } diff --git a/Projectiles/Magic/NightBolt.cs b/Projectiles/Magic/NightBolt.cs index e682367cc0..7b2f4e8c25 100644 --- a/Projectiles/Magic/NightBolt.cs +++ b/Projectiles/Magic/NightBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class NightBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,21 +23,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } } } } diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index 968f004074..45c7cfe459 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class NightOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,64 +25,64 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NightBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NightBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } } } diff --git a/Projectiles/Magic/NightRay.cs b/Projectiles/Magic/NightRay.cs index ba28695c9c..83b1ae2ae9 100644 --- a/Projectiles/Magic/NightRay.cs +++ b/Projectiles/Magic/NightRay.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class NightRay : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } public override void SetDefaults() { @@ -24,27 +24,27 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("NightOrb"), (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("NightOrb"), (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 3; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } } } } diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index d23da1c524..3ed67adc11 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -7,56 +7,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class NuclearFuryProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nuclear Fury"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Fury"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.alpha = 255; - projectile.friendly = true; - projectile.aiStyle = 71; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.tileCollide = false; - projectile.extraUpdates = 2; - projectile.ignoreWater = true; - aiType = 409; - } + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.alpha = 255; + projectile.friendly = true; + projectile.aiStyle = 71; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.tileCollide = false; + projectile.extraUpdates = 2; + projectile.ignoreWater = true; + aiType = 409; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 34, 0f, 0f); - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 34, 0f, 0f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 0, 200, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 0, 200, 0); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/ParticleBeamofDoom.cs b/Projectiles/Magic/ParticleBeamofDoom.cs index 3609aa412b..931f84ba99 100644 --- a/Projectiles/Magic/ParticleBeamofDoom.cs +++ b/Projectiles/Magic/ParticleBeamofDoom.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class ParticleBeamofDoom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Doom"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Doom"); + } public override void SetDefaults() { @@ -22,26 +22,26 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 100; projectile.timeLeft = 100; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 30; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 206; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 2.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - } - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 206; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 2.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + } + return; + } } } } diff --git a/Projectiles/Magic/PhantasmalFury.cs b/Projectiles/Magic/PhantasmalFury.cs index 80ee3c403c..2704fc9937 100644 --- a/Projectiles/Magic/PhantasmalFury.cs +++ b/Projectiles/Magic/PhantasmalFury.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Magic { public class PhantasmalFury : ModProjectile { - int lightTimer = 10; + int lightTimer = 10; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fury"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fury"); + } public override void SetDefaults() { @@ -27,46 +27,46 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - lightTimer--; - if (lightTimer == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - lightTimer = 10; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + lightTimer--; + if (lightTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + lightTimer = 10; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 43); - for (int j = 0; j <= 10; j++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); - } - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 43); + for (int j = 0; j <= 10; j++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + } + float spread = 30f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } } } } diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 8a8ec7b5da..3effc813be 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class Phantom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); + } public override void SetDefaults() { @@ -26,47 +26,47 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 800f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } } } diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index c6991c493e..e3f20a5ad8 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -1,83 +1,83 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class PlagueFang : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fang"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fang"); + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = 9; - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.magic = true; + projectile.alpha = 255; + projectile.penetrate = 9; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.alpha > 0) - { - projectile.alpha -= 50; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha == 0) - { - int num159 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); - Main.dust[num159].noGravity = true; - Main.dust[num159].velocity *= 0.6f; - Main.dust[num159].velocity -= projectile.velocity * 0.4f; + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.alpha > 0) + { + projectile.alpha -= 50; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha == 0) + { + int num159 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); + Main.dust[num159].noGravity = true; + Main.dust[num159].velocity *= 0.6f; + Main.dust[num159].velocity -= projectile.velocity * 0.4f; - int num160 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); - Main.dust[num160].noGravity = true; - Main.dust[num160].velocity *= 0.2f; - Main.dust[num160].velocity -= projectile.velocity * 0.4f; - } - } + int num160 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); + Main.dust[num160].noGravity = true; + Main.dust[num160].velocity *= 0.2f; + Main.dust[num160].velocity -= projectile.velocity * 0.4f; + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.alpha > 0) - { - return Color.Transparent; - } - return null; - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha > 0) + { + return Color.Transparent; + } + return null; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int num301 = 0; num301 < 7; num301++) - { - int num302 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, 0f, 0f, 100, default, 1f); - Main.dust[num302].noGravity = true; - Main.dust[num302].velocity *= 1.2f; - Main.dust[num302].velocity -= projectile.oldVelocity * 0.3f; + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int num301 = 0; num301 < 7; num301++) + { + int num302 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, 0f, 0f, 100, default, 1f); + Main.dust[num302].noGravity = true; + Main.dust[num302].velocity *= 1.2f; + Main.dust[num302].velocity -= projectile.oldVelocity * 0.3f; - int num402 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num402]; - dust.noGravity = true; - dust.velocity *= 1.2f; - dust.velocity -= projectile.oldVelocity * 0.3f; - } - } + int num402 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[num402]; + dust.noGravity = true; + dust.velocity *= 1.2f; + dust.velocity -= projectile.oldVelocity * 0.3f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - target.immune[projectile.owner] = 2; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + target.immune[projectile.owner] = 2; + } + } } diff --git a/Projectiles/Magic/PlasmaBolt.cs b/Projectiles/Magic/PlasmaBolt.cs index 62aad4a616..043d6c278c 100644 --- a/Projectiles/Magic/PlasmaBolt.cs +++ b/Projectiles/Magic/PlasmaBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class PlasmaBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -20,24 +20,24 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 1; projectile.alpha = 255; projectile.timeLeft = 200; - projectile.extraUpdates = 10; - } + projectile.extraUpdates = 10; + } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; - dust.noGravity = true; - dust.scale = 0.65f; - dust.noLight = true; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * (float)num121; + dust.noGravity = true; + dust.scale = 0.65f; + dust.noLight = true; + } + } } } } diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index ae5ad63796..9132175ca2 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,92 +7,92 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class PlasmaRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 80; + } - public override void AI() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.75f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } + public override void AI() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.75f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + float random = Main.rand.Next(30, 90); + float spread = random * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 60); - target.AddBuff(BuffID.Ichor, 120); - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Poisoned, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 60); + target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Poisoned, 300); + } + } } diff --git a/Projectiles/Magic/PlasmaRay2.cs b/Projectiles/Magic/PlasmaRay2.cs index 1531a4e424..df6a7c2145 100644 --- a/Projectiles/Magic/PlasmaRay2.cs +++ b/Projectiles/Magic/PlasmaRay2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class PlasmaRay2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } public override void SetDefaults() { @@ -27,36 +27,36 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs index 144d2b5f8d..d29c56b199 100644 --- a/Projectiles/Magic/PlasmaShot.cs +++ b/Projectiles/Magic/PlasmaShot.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class PlasmaShot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } public override void SetDefaults() { @@ -20,42 +20,42 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 1; projectile.alpha = 255; projectile.timeLeft = 600; - projectile.extraUpdates = 10; + projectile.extraUpdates = 10; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - for (int num121 = 0; num121 < 10; num121++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; - dust.noGravity = true; - dust.noLight = true; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + for (int num121 = 0; num121 < 10; num121++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * (float)num121; + dust.noGravity = true; + dust.noLight = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - int num220 = Main.rand.Next(20, 31); - if (projectile.owner == Main.myPlayer) - { - for (int num221 = 0; num221 < num220; num221++) - { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, 511 + Main.rand.Next(3), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - } - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + int num220 = Main.rand.Next(20, 31); + if (projectile.owner == Main.myPlayer) + { + for (int num221 = 0; num221 < num220; num221++) + { + Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, 511 + Main.rand.Next(3), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + } + } for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/Purge.cs b/Projectiles/Magic/Purge.cs index 18fc76daab..6b689c0847 100644 --- a/Projectiles/Magic/Purge.cs +++ b/Projectiles/Magic/Purge.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class Purge : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purge"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purge"); + } public override void SetDefaults() { @@ -25,109 +25,109 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == mod.ProjectileType("Purge")) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 20f) - { - num2++; - } - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 60f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); - } - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 107, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default, 1f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.type == mod.ProjectileType("Purge")) + { + projectile.ai[0] += 1f; + int num2 = 0; + if (projectile.ai[0] >= 20f) + { + num2++; + } + if (projectile.ai[0] >= 40f) + { + num2++; + } + if (projectile.ai[0] >= 60f) + { + num2++; + } + int num3 = 24; + int num4 = 6; + projectile.ai[1] += 1f; + bool flag = false; + if (projectile.ai[1] >= (float)(num3 - num4 * num2)) + { + projectile.ai[1] = 0f; + flag = true; + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num3 - num4 * num2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); + } + } + if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) + { + Vector2 vector2 = Vector2.UnitX * 24f; + vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + Vector2 value = projectile.Center + vector2; + for (int i = 0; i < 2; i++) + { + int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 107, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default, 1f); + Main.dust[num5].velocity *= 0.66f; + Main.dust[num5].noGravity = true; + Main.dust[num5].scale = 1.4f; + } + } + if (flag && Main.myPlayer == projectile.owner) + { int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; - if (player.gravDir == -1f) - { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; - } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) - { - vector3 = -Vector2.UnitY; - } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector3; - int num6 = mod.ProjectileType("PurgeLaser"); - float scaleFactor2 = 14f; - int num7 = 7; - for (int j = 0; j < 3; j++) - { - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - projectile.Kill(); - } - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + if (flag2) + { + float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value2 = vector; + Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + if (player.gravDir == -1f) + { + value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + } + Vector2 vector3 = Vector2.Normalize(value3); + if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + { + vector3 = -Vector2.UnitY; + } + vector3 *= scaleFactor; + if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector3; + int num6 = mod.ProjectileType("PurgeLaser"); + float scaleFactor2 = 14f; + int num7 = 7; + for (int j = 0; j < 3; j++) + { + value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); + if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) + { + spinningpoint = -Vector2.UnitY; + } + Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + projectile.Kill(); + } + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Magic/PurgeLaser.cs b/Projectiles/Magic/PurgeLaser.cs index 3aded30bb5..9c2f398284 100644 --- a/Projectiles/Magic/PurgeLaser.cs +++ b/Projectiles/Magic/PurgeLaser.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class PurgeLaser : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } public override void SetDefaults() { @@ -27,81 +27,81 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(100, 255, 100, 0); + return new Color(100, 255, 100, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override void Kill(int timeLeft) { int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } } } diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index bc9a4dcaa7..c1634e33ae 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -8,80 +8,80 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class RougeSlashLarge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slash"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = 5; + projectile.alpha = 255; + projectile.timeLeft = 300; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 12f) - { - projectile.localAI[1] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 12f) + { + projectile.localAI[1] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.velocity *= 0.25f; - target.immune[projectile.owner] = 1; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.velocity *= 0.25f; + target.immune[projectile.owner] = 1; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/RougeSlashMedium.cs b/Projectiles/Magic/RougeSlashMedium.cs index 1251d0059a..7624a0c9eb 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -8,80 +8,80 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class RougeSlashMedium : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slash"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = 5; + projectile.alpha = 255; + projectile.timeLeft = 300; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 12f) - { - projectile.localAI[1] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 12f) + { + projectile.localAI[1] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.velocity *= 0.25f; - target.immune[projectile.owner] = 1; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.velocity *= 0.25f; + target.immune[projectile.owner] = 1; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/RougeSlashSmall.cs b/Projectiles/Magic/RougeSlashSmall.cs index 642646eb4c..c24496efb7 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -8,80 +8,80 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class RougeSlashSmall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slash"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = 5; + projectile.alpha = 255; + projectile.timeLeft = 300; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 12f) - { - projectile.localAI[1] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 12f) + { + projectile.localAI[1] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.velocity *= 0.25f; - target.immune[projectile.owner] = 1; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.velocity *= 0.25f; + target.immune[projectile.owner] = 1; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 0e3891a06e..572dac8009 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,13 +8,13 @@ namespace CalamityMod.Projectiles.Magic { public class SHPB : ModProjectile { - public int explosionTimer = 120; + public int explosionTimer = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SHPB"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SHPB"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -29,90 +29,90 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1f * num, 0.2f * num, 0.75f * num); - projectile.alpha -= 2; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; - projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 1f * num, 0.2f * num, 0.75f * num); + projectile.alpha -= 2; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; + projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 250f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - explosionTimer--; - if (explosionTimer <= 0) - { - projectile.Kill(); - } - } + float num473 = projectile.Center.Y; + float num474 = 250f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + explosionTimer--; + if (explosionTimer <= 0) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 155, projectile.alpha); + return new Color(255, Main.DiscoG, 155, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SHPExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SHPExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index ae4e0c04ac..3e46dfb4fd 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class SHPExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -23,84 +23,84 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override void AI() { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 5f * num, 1f * num, 4f * num); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-40, 41); - float num464 = (float)Main.rand.Next(-40, 41); - float num465 = (float)Main.rand.Next(12, 36); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 246; - } - else if (randomDust == 1) - { - randomDust = 73; - } - else - { - randomDust = 187; - } - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - return; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 5f * num, 1f * num, 4f * num); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-40, 41); + float num464 = (float)Main.rand.Next(-40, 41); + float num465 = (float)Main.rand.Next(12, 36); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 246; + } + else if (randomDust == 1) + { + randomDust = 73; + } + else + { + randomDust = 187; + } + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + return; } } } diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index 8eb14f2cc9..d3fc13a61d 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class SHPL : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } public override void SetDefaults() { @@ -27,95 +27,95 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 155, projectile.alpha); + return new Color(255, Main.DiscoG, 155, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override void Kill(int timeLeft) { int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 246; - } - else if (randomDust == 1) - { - randomDust = 73; - } - else - { - randomDust = 187; - } - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, randomDust, 0f, 0f, 100, default, 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + for (int num213 = 0; num213 < num212; num213++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 246; + } + else if (randomDust == 1) + { + randomDust = 73; + } + else + { + randomDust = 187; + } + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, randomDust, 0f, 0f, 100, default, 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } } } diff --git a/Projectiles/Magic/SanguineFlare.cs b/Projectiles/Magic/SanguineFlare.cs index 0c62048e44..35c13ef3fb 100644 --- a/Projectiles/Magic/SanguineFlare.cs +++ b/Projectiles/Magic/SanguineFlare.cs @@ -8,98 +8,98 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class SanguineFlare : ModProjectile - { - private int x; - private double speed = 10; - private float startSpeedY = 0f; + { + private int x; + private double speed = 10; + private float startSpeedY = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.alpha = 255; + projectile.magic = true; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.velocity.X = projectile.velocity.X + (Main.player[projectile.owner].velocity.X * 0.5f); - startSpeedY = projectile.velocity.Y + (Main.player[projectile.owner].velocity.Y * 0.5f); - projectile.velocity.Y = startSpeedY; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) - { - x++; - speed += 0.1; - projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x / 4)); - } - projectile.rotation += projectile.velocity.Y * 0.02f; - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.velocity.X = projectile.velocity.X + (Main.player[projectile.owner].velocity.X * 0.5f); + startSpeedY = projectile.velocity.Y + (Main.player[projectile.owner].velocity.Y * 0.5f); + projectile.velocity.Y = startSpeedY; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 180f) + { + x++; + speed += 0.1; + projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x / 4)); + } + projectile.rotation += projectile.velocity.Y * 0.02f; + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 6; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 6; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 1abb67ac4d..38f196ab17 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -8,56 +8,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class SeethingDischargeBrimstoneBarrage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) - { - projectile.velocity *= 1.01f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - } + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) + { + projectile.velocity *= 1.01f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index 3ce215f436..e2324f5abf 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -8,79 +8,79 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class SeethingDischargeBrimstoneHellblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellblast"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellblast"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 255; - projectile.alpha = 0; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 255; + projectile.alpha = 0; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.alpha += 1; + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.velocity.X *= 1.03f; + projectile.velocity.Y *= 1.03f; + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int dust = 0; dust <= 5; dust++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); + } + } + } } diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs index 671b5dfaf8..94f9df8dfc 100644 --- a/Projectiles/Magic/ShadeNimbus.cs +++ b/Projectiles/Magic/ShadeNimbus.cs @@ -5,84 +5,84 @@ namespace CalamityMod.Projectiles.Magic { public class ShadeNimbus : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nimbus"); + Main.projFrames[projectile.type] = 6; + } public override void SetDefaults() { projectile.width = 54; projectile.height = 28; projectile.tileCollide = false; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.penetrate = -1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 8f) - { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) - { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Shaderain"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 2) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - return; - } - } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 8f) + { + projectile.ai[0] = 0f; + if (projectile.owner == Main.myPlayer) + { + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Shaderain"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 2) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + return; + } + } } } } diff --git a/Projectiles/Magic/ShadeNimbusCloud.cs b/Projectiles/Magic/ShadeNimbusCloud.cs index 0922b3cff7..3253200943 100644 --- a/Projectiles/Magic/ShadeNimbusCloud.cs +++ b/Projectiles/Magic/ShadeNimbusCloud.cs @@ -5,11 +5,11 @@ namespace CalamityMod.Projectiles.Magic { public class ShadeNimbusCloud : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nimbus"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -21,45 +21,45 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float num410 = projectile.ai[0]; - float num411 = projectile.ai[1]; - if (num410 != 0f && num411 != 0f) - { - bool flag12 = false; - bool flag13 = false; - if ((projectile.velocity.X < 0f && projectile.Center.X < num410) || (projectile.velocity.X > 0f && projectile.Center.X > num410)) - { - flag12 = true; - } - if ((projectile.velocity.Y < 0f && projectile.Center.Y < num411) || (projectile.velocity.Y > 0f && projectile.Center.Y > num411)) - { - flag13 = true; - } - if (flag12 && flag13) - { - projectile.Kill(); - } - } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 3) - { - projectile.frame = 0; - return; - } - } + float num410 = projectile.ai[0]; + float num411 = projectile.ai[1]; + if (num410 != 0f && num411 != 0f) + { + bool flag12 = false; + bool flag13 = false; + if ((projectile.velocity.X < 0f && projectile.Center.X < num410) || (projectile.velocity.X > 0f && projectile.Center.X > num410)) + { + flag12 = true; + } + if ((projectile.velocity.Y < 0f && projectile.Center.Y < num411) || (projectile.velocity.Y > 0f && projectile.Center.Y > num411)) + { + flag13 = true; + } + if (flag12 && flag13) + { + projectile.Kill(); + } + } + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 3) + { + projectile.frame = 0; + return; + } + } } public override void Kill(int timeLeft) { if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbus"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbus"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index 6ba42475ce..36739b240b 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -7,16 +7,16 @@ namespace CalamityMod.Projectiles.Magic { public class ShadecrystalProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + } public override void SetDefaults() { projectile.width = 6; projectile.height = 6; - projectile.scale = 1.5f; + projectile.scale = 1.5f; projectile.friendly = true; projectile.alpha = 50; projectile.penetrate = 1; @@ -26,46 +26,46 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.15f, 0f, 0.15f); - projectile.rotation += projectile.velocity.X * 0.2f; - projectile.ai[1] += 1f; - if (Main.rand.NextBool(4)) - { - int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 70, 0f, 0f, 0, default, 1f); - Main.dust[num300].noGravity = true; - Main.dust[num300].velocity *= 0.2f; - Main.dust[num300].scale *= 0.8f; - } - projectile.velocity *= 0.99f; - if (projectile.ai[1] > 90f) - { - projectile.scale -= 0.05f; - if ((double)projectile.scale <= 0.2) - { - projectile.scale = 0.2f; - projectile.Kill(); - } - projectile.width = (int)(6f * projectile.scale); - projectile.height = (int)(6f * projectile.scale); - } + Lighting.AddLight(projectile.Center, 0.15f, 0f, 0.15f); + projectile.rotation += projectile.velocity.X * 0.2f; + projectile.ai[1] += 1f; + if (Main.rand.NextBool(4)) + { + int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 70, 0f, 0f, 0, default, 1f); + Main.dust[num300].noGravity = true; + Main.dust[num300].velocity *= 0.2f; + Main.dust[num300].scale *= 0.8f; + } + projectile.velocity *= 0.99f; + if (projectile.ai[1] > 90f) + { + projectile.scale -= 0.05f; + if ((double)projectile.scale <= 0.2) + { + projectile.scale = 0.2f; + projectile.Kill(); + } + projectile.width = (int)(6f * projectile.scale); + projectile.height = (int)(6f * projectile.scale); + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 70, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 70, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.Frostburn, 120); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 0); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 0); + } + } } diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index 0d4502c5cc..e080beb9d9 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class Shaderain : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rain"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rain"); + } public override void SetDefaults() { @@ -25,18 +25,18 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.alpha = 50; + projectile.alpha = 50; } public override void Kill(int timeLeft) { int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); - Dust expr_A0A0_cp_0 = Main.dust[num310]; - expr_A0A0_cp_0.position.X -= 2f; - Main.dust[num310].alpha = 38; - Main.dust[num310].velocity *= 0.1f; - Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; - Main.dust[num310].scale = 0.95f; + Dust expr_A0A0_cp_0 = Main.dust[num310]; + expr_A0A0_cp_0.position.X -= 2f; + Main.dust[num310].alpha = 38; + Main.dust[num310].velocity *= 0.1f; + Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; + Main.dust[num310].scale = 0.95f; } } } diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index b31e15b968..2c65ceacaa 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class Shadowbolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -22,13 +22,13 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 100; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.damage = (int)((double)projectile.damage * 1.25); - projectile.penetrate--; + projectile.damage = (int)((double)projectile.damage * 1.25); + projectile.penetrate--; if (projectile.penetrate <= 0) { projectile.Kill(); @@ -50,29 +50,29 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) - { - return; - } - projectile.damage = (int)((double)projectile.damage * 1.1); + if (target.type == NPCID.TargetDummy) + { + return; + } + projectile.damage = (int)((double)projectile.damage * 1.1); } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } } } diff --git a/Projectiles/Magic/ShiftingSands.cs b/Projectiles/Magic/ShiftingSands.cs index fe9dd83c56..4bc6aea133 100644 --- a/Projectiles/Magic/ShiftingSands.cs +++ b/Projectiles/Magic/ShiftingSands.cs @@ -8,159 +8,159 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class ShiftingSands : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shifting Sands"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shifting Sands"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.magic = true; + } - public override void AI() - { - if (projectile.soundDelay == 0 && Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.soundDelay = 10; - Main.PlaySound(SoundID.Item20, projectile.position); - } - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) - { - if (Main.player[projectile.owner].channel) - { - float num115 = 18f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (projectile.ai[0] < 0f) - { - projectile.ai[0] += 1f; - } - if (num118 > num115) - { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - else - { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - } - else if (projectile.ai[0] <= 0f) - { - projectile.netUpdate = true; - float num127 = 12f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) - { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.Kill(); - } - projectile.ai[0] = 1f; - } - } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + if (projectile.soundDelay == 0 && Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.soundDelay = 10; + Main.PlaySound(SoundID.Item20, projectile.position); + } + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + { + if (Main.player[projectile.owner].channel) + { + float num115 = 18f; + Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; + float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + } + float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + if (projectile.ai[0] < 0f) + { + projectile.ai[0] += 1f; + } + if (num118 > num115) + { + num118 = num115 / num118; + num116 *= num118; + num117 *= num118; + int num119 = (int)(num116 * 1000f); + int num120 = (int)(projectile.velocity.X * 1000f); + int num121 = (int)(num117 * 1000f); + int num122 = (int)(projectile.velocity.Y * 1000f); + if (num119 != num120 || num121 != num122) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + else + { + int num123 = (int)(num116 * 1000f); + int num124 = (int)(projectile.velocity.X * 1000f); + int num125 = (int)(num117 * 1000f); + int num126 = (int)(projectile.velocity.Y * 1000f); + if (num123 != num124 || num125 != num126) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + } + else if (projectile.ai[0] <= 0f) + { + projectile.netUpdate = true; + float num127 = 12f; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f || projectile.ai[0] < 0f) + { + vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } + num130 = num127 / num130; + num128 *= num130; + num129 *= num130; + projectile.velocity.X = num128; + projectile.velocity.Y = num129; + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.Kill(); + } + projectile.ai[0] = 1f; + } + } + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } } diff --git a/Projectiles/Magic/SirensSong.cs b/Projectiles/Magic/SirensSong.cs index 574ab6534b..ccf66830c2 100644 --- a/Projectiles/Magic/SirensSong.cs +++ b/Projectiles/Magic/SirensSong.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Magic { public class SirensSong : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -22,77 +22,77 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 30; projectile.friendly = true; projectile.magic = true; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.penetrate = 5; projectile.timeLeft = 420; } public override void AI() { - if (projectile.velocity.Length() > 4f) - { - projectile.velocity *= 0.985f; - } - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.harpNote = projectile.ai[0]; - Main.PlaySound(SoundID.Item26, projectile.position); - } - Lighting.AddLight(projectile.Center, 0f, 1.2f, 0f); - if (projectile.velocity.X > 0f) - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - else - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } + if (projectile.velocity.Length() > 4f) + { + projectile.velocity *= 0.985f; + } + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.harpNote = projectile.ai[0]; + Main.PlaySound(SoundID.Item26, projectile.position); + } + Lighting.AddLight(projectile.Center, 0f, 1.2f, 0f); + if (projectile.velocity.X > 0f) + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + else + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(50f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 50); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(50f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 50); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 7; target.AddBuff(BuffID.Confused, 300); diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 8b2a13d1ec..74bf89d2c1 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -7,56 +7,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class Snowflake : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snowflake"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snowflake"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 9; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.alpha = 70; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.magic = true; - aiType = 491; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 9; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.alpha = 70; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.magic = true; + aiType = 491; + } - public override void AI() - { - projectile.rotation += 0.15f; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + projectile.rotation += 0.15f; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(BuffID.Frostburn, 180); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(BuffID.Frostburn, 180); + } + } } diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/SolarBeam2.cs index 3c2bd6f6ac..dc92db084b 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/SolarBeam2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class SolarBeam2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; + projectile.penetrate--; if (projectile.penetrate <= 0) { projectile.Kill(); @@ -46,30 +46,30 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default, 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 4; - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceMagic = true; - } + target.immune[projectile.owner] = 4; + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceMagic = true; + } } } } diff --git a/Projectiles/Magic/SoulPiercer.cs b/Projectiles/Magic/SoulPiercer.cs index 396c784c5b..aaa3eaafed 100644 --- a/Projectiles/Magic/SoulPiercer.cs +++ b/Projectiles/Magic/SoulPiercer.cs @@ -1,66 +1,66 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class SoulPiercer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Piercer"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piercer"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 240; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num448].velocity *= 0.2f; - } - } - } + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; + Main.dust[num448].velocity *= 0.2f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - for (int x = 0; x < 3; x++) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SoulPiercerBolt"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + for (int x = 0; x < 3; x++) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SoulPiercerBolt"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner); + } + } + } + } } diff --git a/Projectiles/Magic/SoulPiercerBolt.cs b/Projectiles/Magic/SoulPiercerBolt.cs index 8ca3b6554d..3c0ae11ff9 100644 --- a/Projectiles/Magic/SoulPiercerBolt.cs +++ b/Projectiles/Magic/SoulPiercerBolt.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class SoulPiercerBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Piercer"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piercer"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 180; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 180; + projectile.penetrate = -1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void AI() - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num448].velocity *= 0.2f; - } - } - } + public override void AI() + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; + Main.dust[num448].velocity *= 0.2f; + } + } + } } diff --git a/Projectiles/Magic/SpiritFlameCurse.cs b/Projectiles/Magic/SpiritFlameCurse.cs index 3bd8621b61..d184ecd147 100644 --- a/Projectiles/Magic/SpiritFlameCurse.cs +++ b/Projectiles/Magic/SpiritFlameCurse.cs @@ -7,11 +7,11 @@ namespace CalamityMod.Projectiles.Magic { public class SpiritFlameCurse : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 8; + } public override void SetDefaults() { @@ -25,61 +25,61 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.alpha -= 3; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); + projectile.alpha -= 3; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn, 180); } } } diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index 59f1c03e75..4d34d770e5 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -7,76 +7,76 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class Starblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.magic = true; + } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - projectile.velocity.X = projectile.velocity.X * 1.025f; - projectile.alpha -= 23; - projectile.scale = 0.8f * (255f - (float)projectile.alpha) / 255f; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.alpha >= 255 && projectile.ai[0] > 5f) - { - projectile.Kill(); - } - if (Main.rand.NextBool(4)) - { - int num193 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); - Main.dust[num193].position = projectile.Center; - Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num193].noGravity = true; - Dust expr_835F_cp_0 = Main.dust[num193]; - expr_835F_cp_0.velocity.Y -= 2f; - } - if (Main.rand.NextBool(6)) - { - int num194 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 176, 0f, 0f, 100, default, 1f); - Main.dust[num194].position = projectile.Center; - Main.dust[num194].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num194].noGravity = true; - Main.dust[num194].velocity *= 0.1f; - } - } + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.1f; + projectile.velocity.X = projectile.velocity.X * 1.025f; + projectile.alpha -= 23; + projectile.scale = 0.8f * (255f - (float)projectile.alpha) / 255f; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.alpha >= 255 && projectile.ai[0] > 5f) + { + projectile.Kill(); + } + if (Main.rand.NextBool(4)) + { + int num193 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[num193].position = projectile.Center; + Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num193].noGravity = true; + Dust expr_835F_cp_0 = Main.dust[num193]; + expr_835F_cp_0.velocity.Y -= 2f; + } + if (Main.rand.NextBool(6)) + { + int num194 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 176, 0f, 0f, 100, default, 1f); + Main.dust[num194].position = projectile.Center; + Main.dust[num194].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num194].noGravity = true; + Main.dust[num194].velocity *= 0.1f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 180, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 180, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 3870e39f08..a21287bdad 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -7,67 +7,67 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class StickyFeather : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; - aiType = 514; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.magic = true; + projectile.aiStyle = 93; + aiType = 514; + } - public override void AI() - { - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index f39d21c128..fe08bdc2e2 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class SupremeDustFlakProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -26,79 +26,79 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = false; - Main.dust[num299].scale *= 1f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = false; - Main.dust[num299].scale *= 1.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 0.25f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = false; + Main.dust[num299].scale *= 1f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = false; + Main.dust[num299].scale *= 1.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 0.25f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[projectile.owner] = 6; } } } diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index a6ccb11e18..1fc9d3679f 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class SupremeDustProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -26,77 +26,77 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.95f) / 255f, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 4f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 2.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - int num399 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num399].noGravity = true; - Main.dust[num399].scale *= 6f; - Dust expr_DBEF_cp_0 = Main.dust[num399]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num399]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num399].scale *= 2.5f; - } - Dust expr_DC74_cp_1 = Main.dust[num399]; - expr_DC74_cp_1.velocity.X *= 1.2f; - Dust expr_DC94_cp_1 = Main.dust[num399]; - expr_DC94_cp_1.velocity.Y *= 1.2f; - Main.dust[num399].scale *= num296; - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.95f) / 255f, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 4f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 2.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + int num399 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num399].noGravity = true; + Main.dust[num399].scale *= 6f; + Dust expr_DBEF_cp_0 = Main.dust[num399]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num399]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num399].scale *= 2.5f; + } + Dust expr_DC74_cp_1 = Main.dust[num399]; + expr_DC74_cp_1.velocity.X *= 1.2f; + Dust expr_DC94_cp_1 = Main.dust[num399]; + expr_DC94_cp_1.velocity.Y *= 1.2f; + Main.dust[num399].scale *= num296; + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SupremeDustFlakProjectile"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + target.immune[projectile.owner] = 6; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SupremeDustFlakProjectile"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Magic/T1000.cs b/Projectiles/Magic/T1000.cs index 07ef34ac6d..14fea069c3 100644 --- a/Projectiles/Magic/T1000.cs +++ b/Projectiles/Magic/T1000.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class T1000 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("T1000"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("T1000"); + } public override void SetDefaults() { @@ -25,109 +25,109 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == mod.ProjectileType("T1000")) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 20f) - { - num2++; - } - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 60f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); - } - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 66, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.type == mod.ProjectileType("T1000")) + { + projectile.ai[0] += 1f; + int num2 = 0; + if (projectile.ai[0] >= 20f) + { + num2++; + } + if (projectile.ai[0] >= 40f) + { + num2++; + } + if (projectile.ai[0] >= 60f) + { + num2++; + } + int num3 = 24; + int num4 = 6; + projectile.ai[1] += 1f; + bool flag = false; + if (projectile.ai[1] >= (float)(num3 - num4 * num2)) + { + projectile.ai[1] = 0f; + flag = true; + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num3 - num4 * num2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); + } + } + if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) + { + Vector2 vector2 = Vector2.UnitX * 24f; + vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + Vector2 value = projectile.Center + vector2; + for (int i = 0; i < 2; i++) + { + int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 66, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num5].velocity *= 0.66f; + Main.dust[num5].noGravity = true; + Main.dust[num5].scale = 1.4f; + } + } + if (flag && Main.myPlayer == projectile.owner) + { int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; - if (player.gravDir == -1f) - { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; - } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) - { - vector3 = -Vector2.UnitY; - } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector3; - int num6 = mod.ProjectileType("T1000Laser"); - float scaleFactor2 = 14f; - int num7 = 7; - for (int j = 0; j < 4; j++) - { - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - projectile.Kill(); - } - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + if (flag2) + { + float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value2 = vector; + Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + if (player.gravDir == -1f) + { + value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + } + Vector2 vector3 = Vector2.Normalize(value3); + if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + { + vector3 = -Vector2.UnitY; + } + vector3 *= scaleFactor; + if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector3; + int num6 = mod.ProjectileType("T1000Laser"); + float scaleFactor2 = 14f; + int num7 = 7; + for (int j = 0; j < 4; j++) + { + value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); + if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) + { + spinningpoint = -Vector2.UnitY; + } + Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + projectile.Kill(); + } + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Magic/T1000Laser.cs b/Projectiles/Magic/T1000Laser.cs index 092021ca7c..0c7fbcd59b 100644 --- a/Projectiles/Magic/T1000Laser.cs +++ b/Projectiles/Magic/T1000Laser.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class T1000Laser : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } public override void SetDefaults() { @@ -27,81 +27,81 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override void Kill(int timeLeft) { int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } } } diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index 9587106297..a509ed7149 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class TearsofHeavenProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -27,67 +27,67 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int num92 = 0; num92 < 3; num92++) - { - int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, 1f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0f; - } - for (int num105 = 0; num105 < 3; num105++) - { - int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 100, default, 1f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int num92 = 0; num92 < 3; num92++) + { + int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, 1f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0f; + } + for (int num105 = 0; num105 < 3; num105++) + { + int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 100, default, 1f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 8f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; - target.AddBuff(mod.BuffType("HolyLight"), 300); + target.immune[projectile.owner] = 6; + target.AddBuff(mod.BuffType("HolyLight"), 300); } } } diff --git a/Projectiles/Magic/TerraBolt.cs b/Projectiles/Magic/TerraBolt.cs index df1ad341cc..b2ef6bde59 100644 --- a/Projectiles/Magic/TerraBolt.cs +++ b/Projectiles/Magic/TerraBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class TerraBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,31 +23,31 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb2"), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb2"), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } } diff --git a/Projectiles/Magic/TerraBolt2.cs b/Projectiles/Magic/TerraBolt2.cs index ce38a0cff5..0fccd0faba 100644 --- a/Projectiles/Magic/TerraBolt2.cs +++ b/Projectiles/Magic/TerraBolt2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class TerraBolt2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,25 +23,25 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } } diff --git a/Projectiles/Magic/TerraOrb.cs b/Projectiles/Magic/TerraOrb.cs index 2fea1ea957..39aa5f0127 100644 --- a/Projectiles/Magic/TerraOrb.cs +++ b/Projectiles/Magic/TerraOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class TerraOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -25,69 +25,69 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } } diff --git a/Projectiles/Magic/TerraOrb2.cs b/Projectiles/Magic/TerraOrb2.cs index 93c7069f96..2805d1329f 100644 --- a/Projectiles/Magic/TerraOrb2.cs +++ b/Projectiles/Magic/TerraOrb2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class TerraOrb2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -25,69 +25,69 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 18f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 18f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } } diff --git a/Projectiles/Magic/TerraRay.cs b/Projectiles/Magic/TerraRay.cs index 8334890cfd..b09fd5ca56 100644 --- a/Projectiles/Magic/TerraRay.cs +++ b/Projectiles/Magic/TerraRay.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class TerraRay : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -24,31 +24,31 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 21f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb"), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 21f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb"), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 3; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } } diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs index 813cb74625..bb6e328334 100644 --- a/Projectiles/Magic/ThunderstormShot.cs +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class ThunderstormShot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } public override void SetDefaults() { @@ -21,74 +21,74 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 1; projectile.alpha = 255; projectile.timeLeft = 600; - projectile.extraUpdates = 25; + projectile.extraUpdates = 25; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 9f) - { - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; - dust.noGravity = true; - dust.noLight = true; - Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust2.velocity = Vector2.Zero; - dust2.position -= projectile.velocity / 5f * (float)num121; - dust2.noGravity = true; - dust2.noLight = true; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 9f) + { + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * (float)num121; + dust.noGravity = true; + dust.noLight = true; + Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust2.velocity = Vector2.Zero; + dust2.position -= projectile.velocity / 5f * (float)num121; + dust2.noGravity = true; + dust2.noLight = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - for (int n = 0; n < 5; n++) - { - float x = projectile.position.X + (float)Main.rand.Next(-200, 200); - float y = projectile.position.Y - 1500f; - Vector2 vector = new Vector2(x, y); - float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("ThunderstormShotSplit"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.position = projectile.Center; - projectile.width = (projectile.height = 36); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 1f; //0.75 - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + for (int n = 0; n < 5; n++) + { + float x = projectile.position.X + (float)Main.rand.Next(-200, 200); + float y = projectile.position.Y - 1500f; + Vector2 vector = new Vector2(x, y); + float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("ThunderstormShotSplit"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 36); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 1f; //0.75 + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } } } diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs index faa23ecf34..ff6dbccc38 100644 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class ThunderstormShotSplit : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } public override void SetDefaults() { @@ -17,67 +17,67 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.tileCollide = false; + projectile.tileCollide = false; projectile.penetrate = 1; projectile.alpha = 255; projectile.timeLeft = 600; - projectile.extraUpdates = 15; + projectile.extraUpdates = 15; } public override void AI() { - if (projectile.timeLeft < 420) - { - projectile.tileCollide = true; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.5f)]; - dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; - dust.noGravity = true; - dust.noLight = true; - Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.5f)]; - dust2.velocity = Vector2.Zero; - dust2.position -= projectile.velocity / 5f * (float)num121; - dust2.noGravity = true; - dust2.noLight = true; - } - } + if (projectile.timeLeft < 420) + { + projectile.tileCollide = true; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.5f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * (float)num121; + dust.noGravity = true; + dust.noLight = true; + Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.5f)]; + dust2.velocity = Vector2.Zero; + dust2.position -= projectile.velocity / 5f * (float)num121; + dust2.noGravity = true; + dust2.noLight = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 16); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; //0.75 - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 0.6f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 0.6f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 16); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; //0.75 + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 0.6f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 0.6f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } } } diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index 899c150c4c..21dc99ae42 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -8,66 +8,66 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class TradewindsProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 600; + projectile.magic = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, 0f, 0f); - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, 0f, 0f); + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - projectile.velocity *= 0.75f; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + projectile.velocity *= 0.75f; + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.ai[0] += 0.1f; - projectile.velocity *= 0.75f; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.ai[0] += 0.1f; + projectile.velocity *= 0.75f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 4e41d3e362..8710d89ce9 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class UberBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } public override void SetDefaults() { @@ -25,51 +25,51 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - if (projectile.alpha > 0) - { - projectile.alpha -= 30; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Vector2 v2 = projectile.ai[0].ToRotationVector2(); - float num743 = projectile.velocity.ToRotation(); - float num744 = v2.ToRotation(); - double num745 = (double)(num744 - num743); - if (num745 > 3.1415926535897931) - { - num745 -= 6.2831853071795862; - } - if (num745 < -3.1415926535897931) - { - num745 += 6.2831853071795862; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.myPlayer == projectile.owner && projectile.timeLeft > 30) - projectile.timeLeft = 30; + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + if (projectile.alpha > 0) + { + projectile.alpha -= 30; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Vector2 v2 = projectile.ai[0].ToRotationVector2(); + float num743 = projectile.velocity.ToRotation(); + float num744 = v2.ToRotation(); + double num745 = (double)(num744 - num743); + if (num745 > 3.1415926535897931) + { + num745 -= 6.2831853071795862; + } + if (num745 < -3.1415926535897931) + { + num745 += 6.2831853071795862; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.myPlayer == projectile.owner && projectile.timeLeft > 30) + projectile.timeLeft = 30; } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 96); - int num190 = Main.rand.Next(4, 6); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 171, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } - if (projectile.owner == Main.myPlayer) - { - for (int numBubbles = 0; numBubbles <= (Main.rand.Next(3, 7)); numBubbles++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * (Main.rand.NextFloat() * 2f), projectile.velocity.Y * (Main.rand.NextFloat() * 2f), mod.ProjectileType("BlueBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + int num190 = Main.rand.Next(4, 6); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 171, 0f, 0f, 100, default, 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + if (projectile.owner == Main.myPlayer) + { + for (int numBubbles = 0; numBubbles <= (Main.rand.Next(3, 7)); numBubbles++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * (Main.rand.NextFloat() * 2f), projectile.velocity.Y * (Main.rand.NextFloat() * 2f), mod.ProjectileType("BlueBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } } } } diff --git a/Projectiles/Magic/UndinesRetribution.cs b/Projectiles/Magic/UndinesRetribution.cs index 8a596b8e85..e705fe2e52 100644 --- a/Projectiles/Magic/UndinesRetribution.cs +++ b/Projectiles/Magic/UndinesRetribution.cs @@ -8,145 +8,145 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class UndinesRetribution : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Undine's Retribution"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Undine's Retribution"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 420; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 420; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num953 = 25f * projectile.ai[1]; //100 - float scaleFactor12 = 5f * projectile.ai[1]; //5 - float num954 = 500f; - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 9f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num953 = 25f * projectile.ai[1]; //100 + float scaleFactor12 = 5f * projectile.ai[1]; //5 + float num954 = 500f; + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 9f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 180); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 21, 1f, 0f); - for (int num193 = 0; num193 < 4; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 6; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 21, 1f, 0f); + for (int num193 = 0; num193 < 4; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 6; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 24040d365c..2d3d334d59 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -8,78 +8,78 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class Vehemence : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vehemence"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vehemence"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.magic = true; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + projectile.magic = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.45f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.15f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.45f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.15f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - for (int j = 0; j <= 25; j++) - { - int num459 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 1f); - Main.dust[num459].noGravity = true; - Main.dust[num459].velocity *= 0.1f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + for (int j = 0; j <= 25; j++) + { + int num459 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 1f); + Main.dust[num459].noGravity = true; + Main.dust[num459].velocity *= 0.1f; + } + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - double lifeAmount = (double)target.life; - double lifeMax = (double)target.lifeMax; - double damageMult = (lifeAmount / lifeMax) * 7; - damage = (int)Math.Pow(damage, damageMult); - if (damage > 1000000) - { - damage = 1000000; - } - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + double lifeAmount = (double)target.life; + double lifeMax = (double)target.lifeMax; + double damageMult = (lifeAmount / lifeMax) * 7; + damage = (int)Math.Pow(damage, damageMult); + if (damage > 1000000) + { + damage = 1000000; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.life == target.lifeMax) - { - target.AddBuff(BuffID.ShadowFlame, 12000); - target.AddBuff(BuffID.Ichor, 12000); - target.AddBuff(BuffID.Frostburn, 12000); - target.AddBuff(BuffID.OnFire, 12000); - target.AddBuff(BuffID.Poisoned, 12000); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.life == target.lifeMax) + { + target.AddBuff(BuffID.ShadowFlame, 12000); + target.AddBuff(BuffID.Ichor, 12000); + target.AddBuff(BuffID.Frostburn, 12000); + target.AddBuff(BuffID.OnFire, 12000); + target.AddBuff(BuffID.Poisoned, 12000); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 358cdf28cf..3505556fed 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class VenusianBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -26,54 +26,54 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.2f, 0f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, 0.25f, 0.2f, 0f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) - { - int explosionDamage = VenusianTrident.BaseDamage; - float explosionKB = 6f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("VenusianExplosion"), explosionDamage, explosionKB, projectile.owner, 0f, 0f); + target.AddBuff(BuffID.OnFire, 600); + } - int cinderDamage = (int)(VenusianTrident.BaseDamage * 0.75f); - float cinderKB = 0f; - Vector2 cinderPos = projectile.oldPosition + 0.5f * projectile.Size; - int numCinders = Main.rand.Next(7, 10); - for (int i = 0; i < numCinders; i++) - { - Vector2 cinderVel = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (cinderVel.X == 0f && cinderVel.Y == 0f) - { - cinderVel = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - cinderVel.Normalize(); - cinderVel *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(cinderPos, cinderVel, mod.ProjectileType("VenusianFlame"), cinderDamage, cinderKB, projectile.owner, 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + int explosionDamage = VenusianTrident.BaseDamage; + float explosionKB = 6f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("VenusianExplosion"), explosionDamage, explosionKB, projectile.owner, 0f, 0f); + + int cinderDamage = (int)(VenusianTrident.BaseDamage * 0.75f); + float cinderKB = 0f; + Vector2 cinderPos = projectile.oldPosition + 0.5f * projectile.Size; + int numCinders = Main.rand.Next(7, 10); + for (int i = 0; i < numCinders; i++) + { + Vector2 cinderVel = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (cinderVel.X == 0f && cinderVel.Y == 0f) + { + cinderVel = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + cinderVel.Normalize(); + cinderVel *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(cinderPos, cinderVel, mod.ProjectileType("VenusianFlame"), cinderDamage, cinderKB, projectile.owner, 0f, 0f); + } + } } } } diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 9bed7282df..1f012271fa 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class VenusianExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -24,79 +24,79 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 120; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 8; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 2.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - return; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 2.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + return; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.OnFire, 600); } } } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index 252d7ae0c9..b55f8f4533 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -7,95 +7,95 @@ namespace CalamityMod.Projectiles.Magic { public class VenusianFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Venusian Cinder"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Venusian Cinder"); + } public override void SetDefaults() { projectile.width = 6; projectile.height = 12; projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + projectile.magic = true; + projectile.penetrate = 3; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); - } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); + } + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool OnTileCollide(Vector2 oldVelocity) { if (projectile.penetrate == 0) { diff --git a/Projectiles/Magic/Viscera.cs b/Projectiles/Magic/Viscera.cs index a1a7e86563..82925c3b47 100644 --- a/Projectiles/Magic/Viscera.cs +++ b/Projectiles/Magic/Viscera.cs @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Magic { public class Viscera : ModProjectile { - public float healAmt = 1f; + public float healAmt = 1f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viscera"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viscera"); + } public override void SetDefaults() { @@ -24,13 +24,13 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 100; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 5; } public override bool OnTileCollide(Vector2 oldVelocity) { - healAmt *= 1.4f; - projectile.penetrate--; + healAmt *= 1.4f; + projectile.penetrate--; if (projectile.penetrate <= 0) { projectile.Kill(); @@ -52,32 +52,32 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - healAmt *= 1.4f; - Player player = Main.player[projectile.owner]; - player.statLife += (int)healAmt; - player.HealEffect((int)healAmt); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + healAmt *= 1.4f; + Player player = Main.player[projectile.owner]; + player.statLife += (int)healAmt; + player.HealEffect((int)healAmt); } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 5, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 5, 0f, 0f, 0, default, 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } } } diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index c11cffe8d5..482aebed49 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -6,74 +6,74 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class VividBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.penetrate = -1; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.penetrate = -1; + projectile.friendly = true; + projectile.timeLeft = 30; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } - public override void AI() - { - Vector2 value7 = new Vector2(5f, 10f); - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) - { - projectile.ai[0] = 0f; - } - else - { - for (int num41 = 0; num41 < 2; num41++) - { - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num42].scale = 0.33f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.0065f; - Main.dust[num448].velocity *= 0.2f; - } - } - } + public override void AI() + { + Vector2 value7 = new Vector2(5f, 10f); + projectile.ai[0] += 1f; + if (projectile.ai[0] == 48f) + { + projectile.ai[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -12f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num42].scale = 0.33f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.0065f; + Main.dust[num448].velocity *= 0.2f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } } diff --git a/Projectiles/Magic/VividClarity.cs b/Projectiles/Magic/VividClarity.cs index 5b923c5e1a..7974f157ea 100644 --- a/Projectiles/Magic/VividClarity.cs +++ b/Projectiles/Magic/VividClarity.cs @@ -6,108 +6,108 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class VividClarity : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } - public override void AI() - { - Vector2 value7 = new Vector2(5f, 10f); - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) - { - projectile.ai[0] = 0f; - } - else - { - for (int num41 = 0; num41 < 2; num41++) - { - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num42].scale = 0.75f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("VividOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } + public override void AI() + { + Vector2 value7 = new Vector2(5f, 10f); + projectile.ai[0] += 1f; + if (projectile.ai[0] == 48f) + { + projectile.ai[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -12f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num42].scale = 0.75f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("VividOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.damage = (int)((double)projectile.damage * 1.1); - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.damage = (int)((double)projectile.damage * 1.1); + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - projectile.damage = (int)((double)projectile.damage * 1.05); - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + projectile.damage = (int)((double)projectile.damage * 1.05); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } } diff --git a/Projectiles/Magic/VividOrb.cs b/Projectiles/Magic/VividOrb.cs index 9b533cc823..83f8859d81 100644 --- a/Projectiles/Magic/VividOrb.cs +++ b/Projectiles/Magic/VividOrb.cs @@ -1,92 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class VividOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public class VividOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("VividBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("VividBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } } diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index f3f01826a0..b563ad9cf5 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.Items.Weapons; using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons; namespace CalamityMod.Projectiles.Magic { @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic { int coreDustCount = 2; //3 int coreDustType = 262; - for(int i = 0; i < coreDustCount; ++i) + for (int i = 0; i < coreDustCount; ++i) { float scale = Main.rand.NextFloat(1.0f, 1.4f); int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, coreDustType); @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic int trailDustCount = 4; //5 int trailDustType = 264; - for(int i = 0; i < trailDustCount; ++i) + for (int i = 0; i < trailDustCount; ++i) { float scale = Main.rand.NextFloat(1.0f, 1.4f); int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, trailDustType, 0f, 0f); diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 01326cb6ef..e6e17d12f0 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -8,171 +8,171 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class Vortex : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vortex"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vortex"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.alpha = 255; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 300; - projectile.tileCollide = true; - projectile.extraUpdates = 4; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.alpha = 255; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.timeLeft = 300; + projectile.tileCollide = true; + projectile.extraUpdates = 4; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) - { - int num713 = 5; - for (int num714 = 0; num714 < num713; num714++) - { - Vector2 vector58 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f; - vector58 = vector58.RotatedBy((double)(num714 - (num713 / 2 - 1)) * 3.1415926535897931 / (double)((float)num713), default) + projectile.Center; - Vector2 value25 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num715 = Dust.NewDust(vector58 + value25, 0, 0, 66, value25.X * 2f, value25.Y * 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.7f); - Main.dust[num715].noGravity = true; - Main.dust[num715].noLight = true; - Main.dust[num715].velocity /= 4f; - Main.dust[num715].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - projectile.rotation += projectile.velocity.X * 0.1f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - } - int num716 = -1; - Vector2 vector59 = projectile.Center; - float num717 = 350f * projectile.ai[1]; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) - { - for (int num718 = 0; num718 < 200; num718++) - { - NPC nPC6 = Main.npc[num718]; - if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) - { - Vector2 center4 = nPC6.Center; - float num719 = Vector2.Distance(center4, vector59); - if (num719 < num717 && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC6.position, nPC6.width, nPC6.height)) - { - num717 = num719; - vector59 = center4; - num716 = num718; - } - } - } - if (num716 >= 0) - { - projectile.ai[0] = (float)(num716 + 1); - projectile.netUpdate = true; - } - } - if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) - { - projectile.localAI[0] = 30f; - } - bool flag32 = false; - if (projectile.ai[0] != 0f) - { - int num720 = (int)(projectile.ai[0] - 1f); - if (Main.npc[num720].active && !Main.npc[num720].dontTakeDamage && Main.npc[num720].immune[projectile.owner] == 0) - { - float num721 = Main.npc[num720].position.X + (float)(Main.npc[num720].width / 2); - float num722 = Main.npc[num720].position.Y + (float)(Main.npc[num720].height / 2); - float num723 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num721) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num722); - if (num723 < 1000f) - { - flag32 = true; - vector59 = Main.npc[num720].Center; - } - } - else - { - projectile.ai[0] = 0f; - flag32 = false; - projectile.netUpdate = true; - } - } - if (flag32) - { - Vector2 v = vector59 - projectile.Center; - float num724 = projectile.velocity.ToRotation(); - float num725 = v.ToRotation(); - double num726 = (double)(num725 - num724); - if (num726 > 3.1415926535897931) - { - num726 -= 6.2831853071795862; - } - if (num726 < -3.1415926535897931) - { - num726 += 6.2831853071795862; - } - projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.10000000149011612, default); - } - float num727 = projectile.velocity.Length(); - projectile.velocity.Normalize(); - projectile.velocity *= num727 + 0.0025f; - } + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + { + int num713 = 5; + for (int num714 = 0; num714 < num713; num714++) + { + Vector2 vector58 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f; + vector58 = vector58.RotatedBy((double)(num714 - (num713 / 2 - 1)) * 3.1415926535897931 / (double)((float)num713), default) + projectile.Center; + Vector2 value25 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num715 = Dust.NewDust(vector58 + value25, 0, 0, 66, value25.X * 2f, value25.Y * 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.7f); + Main.dust[num715].noGravity = true; + Main.dust[num715].noLight = true; + Main.dust[num715].velocity /= 4f; + Main.dust[num715].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + projectile.rotation += projectile.velocity.X * 0.1f; + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + } + int num716 = -1; + Vector2 vector59 = projectile.Center; + float num717 = 350f * projectile.ai[1]; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + { + for (int num718 = 0; num718 < 200; num718++) + { + NPC nPC6 = Main.npc[num718]; + if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) + { + Vector2 center4 = nPC6.Center; + float num719 = Vector2.Distance(center4, vector59); + if (num719 < num717 && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC6.position, nPC6.width, nPC6.height)) + { + num717 = num719; + vector59 = center4; + num716 = num718; + } + } + } + if (num716 >= 0) + { + projectile.ai[0] = (float)(num716 + 1); + projectile.netUpdate = true; + } + } + if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) + { + projectile.localAI[0] = 30f; + } + bool flag32 = false; + if (projectile.ai[0] != 0f) + { + int num720 = (int)(projectile.ai[0] - 1f); + if (Main.npc[num720].active && !Main.npc[num720].dontTakeDamage && Main.npc[num720].immune[projectile.owner] == 0) + { + float num721 = Main.npc[num720].position.X + (float)(Main.npc[num720].width / 2); + float num722 = Main.npc[num720].position.Y + (float)(Main.npc[num720].height / 2); + float num723 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num721) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num722); + if (num723 < 1000f) + { + flag32 = true; + vector59 = Main.npc[num720].Center; + } + } + else + { + projectile.ai[0] = 0f; + flag32 = false; + projectile.netUpdate = true; + } + } + if (flag32) + { + Vector2 v = vector59 - projectile.Center; + float num724 = projectile.velocity.ToRotation(); + float num725 = v.ToRotation(); + double num726 = (double)(num725 - num724); + if (num726 > 3.1415926535897931) + { + num726 -= 6.2831853071795862; + } + if (num726 < -3.1415926535897931) + { + num726 += 6.2831853071795862; + } + projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.10000000149011612, default); + } + float num727 = projectile.velocity.Length(); + projectile.velocity.Normalize(); + projectile.velocity *= num727 + 0.0025f; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/WaterStream.cs b/Projectiles/Magic/WaterStream.cs index 8996f3c83b..a44bf12eb1 100644 --- a/Projectiles/Magic/WaterStream.cs +++ b/Projectiles/Magic/WaterStream.cs @@ -6,12 +6,12 @@ namespace CalamityMod.Projectiles.Magic { public class WaterStream : ModProjectile { - public int addSprayTimer = 20; + public int addSprayTimer = 20; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stream"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stream"); + } public override void SetDefaults() { @@ -26,48 +26,48 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - addSprayTimer--; - if (addSprayTimer <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("WaterStream2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - addSprayTimer = 20; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) - { - projectile.Kill(); - } - if (projectile.ai[0] <= 3f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) - { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X -= num152; - Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y -= num153; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } + addSprayTimer--; + if (addSprayTimer <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("WaterStream2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + addSprayTimer = 20; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + projectile.scale -= 0.002f; + if (projectile.scale <= 0f) + { + projectile.Kill(); + } + if (projectile.ai[0] <= 3f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; + for (int num151 = 0; num151 < 3; num151++) + { + float num152 = projectile.velocity.X / 3f * (float)num151; + float num153 = projectile.velocity.Y / 3f * (float)num151; + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + Dust expr_6A04_cp_0 = Main.dust[num155]; + expr_6A04_cp_0.position.X -= num152; + Dust expr_6A1F_cp_0 = Main.dust[num155]; + expr_6A1F_cp_0.position.Y -= num153; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } } } } diff --git a/Projectiles/Magic/WaterStream2.cs b/Projectiles/Magic/WaterStream2.cs index f286950024..20cab108c4 100644 --- a/Projectiles/Magic/WaterStream2.cs +++ b/Projectiles/Magic/WaterStream2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class WaterStream2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stream"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stream"); + } public override void SetDefaults() { @@ -25,40 +25,40 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) - { - projectile.Kill(); - } - if (projectile.ai[0] <= 3f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) - { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 33, 0f, 0f, 100, default, 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X -= num152; - Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y -= num153; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 33, 0f, 0f, 100, default, 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - return; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + projectile.scale -= 0.002f; + if (projectile.scale <= 0f) + { + projectile.Kill(); + } + if (projectile.ai[0] <= 3f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; + for (int num151 = 0; num151 < 3; num151++) + { + float num152 = projectile.velocity.X / 3f * (float)num151; + float num153 = projectile.velocity.Y / 3f * (float)num151; + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 33, 0f, 0f, 100, default, 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + Dust expr_6A04_cp_0 = Main.dust[num155]; + expr_6A04_cp_0.position.X -= num152; + Dust expr_6A1F_cp_0 = Main.dust[num155]; + expr_6A1F_cp_0.position.Y -= num153; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 33, 0f, 0f, 100, default, 0.5f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + return; + } } } } diff --git a/Projectiles/Magic/WhiteFlame.cs b/Projectiles/Magic/WhiteFlame.cs index e58a49e8e0..18fce7c499 100644 --- a/Projectiles/Magic/WhiteFlame.cs +++ b/Projectiles/Magic/WhiteFlame.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Magic { public class WhiteFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -24,39 +24,39 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - int num251 = 4; - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("WhiteFlame2"), (int)((double)projectile.damage), 0f, projectile.owner, 0f, 0f); - } - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + int num251 = 4; + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("WhiteFlame2"), (int)((double)projectile.damage), 0f, projectile.owner, 0f, 0f); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 360); + target.AddBuff(mod.BuffType("HolyLight"), 360); } } } diff --git a/Projectiles/Magic/WhiteFlame2.cs b/Projectiles/Magic/WhiteFlame2.cs index a88fc939e7..ee795b76f3 100644 --- a/Projectiles/Magic/WhiteFlame2.cs +++ b/Projectiles/Magic/WhiteFlame2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Magic { public class WhiteFlame2 : ModProjectile { - float homeTimer = 100; + float homeTimer = 100; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -22,61 +22,61 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.timeLeft = 120; projectile.magic = true; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 0.5f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - homeTimer += 5f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = homeTimer; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 0.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + homeTimer += 5f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = homeTimer; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } } } diff --git a/Projectiles/Magic/WintersFury.cs b/Projectiles/Magic/WintersFury.cs index 05bedef007..76b99fd567 100644 --- a/Projectiles/Magic/WintersFury.cs +++ b/Projectiles/Magic/WintersFury.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class WintersFury : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fury"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fury"); + } public override void SetDefaults() { @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.magic = true; projectile.penetrate = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = 1; projectile.timeLeft = 600; } @@ -27,23 +27,23 @@ namespace CalamityMod.Projectiles.Magic { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index df6fe58d10..25d3a96931 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic { public class WulfrumBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -24,23 +24,23 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - return; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + return; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/YharimsCrystal.cs b/Projectiles/Magic/YharimsCrystal.cs index 1db4b20494..0c511c7a59 100644 --- a/Projectiles/Magic/YharimsCrystal.cs +++ b/Projectiles/Magic/YharimsCrystal.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,192 +8,192 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class YharimsCrystal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 22; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 22; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.magic = true; + projectile.ignoreWater = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float num26 = 30f; - if (projectile.ai[0] > 90f) - { - num26 = 15f; - } - if (projectile.ai[0] > 120f) - { - num26 = 5f; - } - projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; - bool flag9 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag9 = true; - } - int num27 = 10; - bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag10 = true; - } - if (projectile.ai[1] >= 1f) - { - projectile.ai[1] = 0f; - flag10 = true; - if (Main.myPlayer == projectile.owner) - { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; - if (player.gravDir == -1f) - { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; - } - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) - { - vector11 = -Vector2.UnitY; - } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); - vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector11; - } - } - projectile.frameCounter++; - int num28 = (projectile.ai[0] < 120f) ? 3 : 1; - if (projectile.frameCounter >= num28) - { - projectile.frameCounter = 0; - if (++projectile.frame >= 6) - { - projectile.frame = 0; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item15, projectile.position); - } - } - if (flag10 && Main.myPlayer == projectile.owner) - { - bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); - bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; - if (flag12) - { - if (projectile.ai[0] == 1f) - { - Vector2 center3 = projectile.Center; - Vector2 vector12 = Vector2.Normalize(projectile.velocity); - if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) - { - vector12 = -Vector2.UnitY; - } - int num29 = projectile.damage; - for (int l = 0; l < 7; l++) - { - Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("YharimsCrystalBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); - } - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float num26 = 30f; + if (projectile.ai[0] > 90f) + { + num26 = 15f; + } + if (projectile.ai[0] > 120f) + { + num26 = 5f; + } + projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); + projectile.ai[0] += 1f; + projectile.ai[1] += 1f; + bool flag9 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag9 = true; + } + int num27 = 10; + bool flag10 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag10 = true; + } + if (projectile.ai[1] >= 1f) + { + projectile.ai[1] = 0f; + flag10 = true; + if (Main.myPlayer == projectile.owner) + { + float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value12 = vector; + Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + if (player.gravDir == -1f) + { + value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; + } + Vector2 vector11 = Vector2.Normalize(value13); + if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) + { + vector11 = -Vector2.UnitY; + } + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); + vector11 *= scaleFactor5; + if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector11; + } + } + projectile.frameCounter++; + int num28 = (projectile.ai[0] < 120f) ? 3 : 1; + if (projectile.frameCounter >= num28) + { + projectile.frameCounter = 0; + if (++projectile.frame >= 6) + { + projectile.frame = 0; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num27; + projectile.soundDelay *= 2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item15, projectile.position); + } + } + if (flag10 && Main.myPlayer == projectile.owner) + { + bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); + bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; + if (flag12) + { + if (projectile.ai[0] == 1f) + { + Vector2 center3 = projectile.Center; + Vector2 vector12 = Vector2.Normalize(projectile.velocity); + if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) + { + vector12 = -Vector2.UnitY; + } + int num29 = projectile.damage; + for (int l = 0; l < 7; l++) + { + Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("YharimsCrystalBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); + } + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Texture2D texture2D14 = Main.projectileTexture[projectile.type]; - int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y7 = num215 * projectile.frame; - Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - float scale5 = 1f; - if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num216 = Main.player[projectile.owner].stealth; - if ((double)num216 < 0.03) - { - num216 = 0.03f; - } - float arg_97B3_0 = (1f + num216 * 10f) / 11f; - color25 *= num216; - scale5 = num216; - } - if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num217 = Main.player[projectile.owner].stealth; - if ((double)num217 < 0.03) - { - num217 = 0.03f; - } - float arg_9854_0 = (1f + num217 * 10f) / 11f; - color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); - scale5 = num217; - } - Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 30f))) * 2f + 2f; - if (projectile.ai[0] > 120f) - { - scaleFactor2 = 4f; - } - for (float num218 = 0f; num218 < 4f; num218 += 1f) - { - Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture2D14 = Main.projectileTexture[projectile.type]; + int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y7 = num215 * projectile.frame; + Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); + float scale5 = 1f; + if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num216 = Main.player[projectile.owner].stealth; + if ((double)num216 < 0.03) + { + num216 = 0.03f; + } + float arg_97B3_0 = (1f + num216 * 10f) / 11f; + color25 *= num216; + scale5 = num216; + } + if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num217 = Main.player[projectile.owner].stealth; + if ((double)num217 < 0.03) + { + num217 = 0.03f; + } + float arg_9854_0 = (1f + num217 * 10f) / 11f; + color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); + scale5 = num217; + } + Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 30f))) * 2f + 2f; + if (projectile.ai[0] > 120f) + { + scaleFactor2 = 4f; + } + for (float num218 = 0f; num218 < 4f; num218 += 1f) + { + Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + } + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 200); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 200); + } + } } diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 619e38baf9..7ae11d9aa0 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -1,72 +1,72 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; using Terraria; -using Terraria.ModLoader; using Terraria.Enums; using Terraria.GameContent.Shaders; using Terraria.Graphics.Effects; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class YharimsCrystalBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } - public float GetHue(float indexing) - { - string playerName; - if (Main.player[projectile.owner].active && (playerName = Main.player[projectile.owner].name) != null) - { - Dictionary LaserHue = new Dictionary(17) - { - {"Fabsol", 0}, - {"Ziggums", 1}, - {"Poly", 2}, - {"Zach", 3}, - {"Grox the Great", 4}, - {"Jenosis", 5}, - {"DM DOKURO", 6}, - {"Uncle Danny", 7}, - {"Phoenix", 8}, - {"MineCat", 9}, - {"Khaelis", 10}, - {"Purple Necromancer", 11}, - {"gamagamer64", 12}, - {"Svante", 13}, - {"Puff", 14}, - {"Leviathan", 15}, - {"Testdude", 16} - }; + public float GetHue(float indexing) + { + string playerName; + if (Main.player[projectile.owner].active && (playerName = Main.player[projectile.owner].name) != null) + { + Dictionary LaserHue = new Dictionary(17) + { + {"Fabsol", 0}, + {"Ziggums", 1}, + {"Poly", 2}, + {"Zach", 3}, + {"Grox the Great", 4}, + {"Jenosis", 5}, + {"DM DOKURO", 6}, + {"Uncle Danny", 7}, + {"Phoenix", 8}, + {"MineCat", 9}, + {"Khaelis", 10}, + {"Purple Necromancer", 11}, + {"gamagamer64", 12}, + {"Svante", 13}, + {"Puff", 14}, + {"Leviathan", 15}, + {"Testdude", 16} + }; if (LaserHue.TryGetValue(playerName, out int someNumber)) { switch (someNumber) @@ -106,191 +106,191 @@ namespace CalamityMod.Projectiles.Magic } } } - return (float)((int)indexing) / 6f; - } + return (float)((int)indexing) / 6f; + } - public override void AI() - { - Vector2? vector71 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - if (projectile.type != mod.ProjectileType("YharimsCrystalBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("YharimsCrystal")) - { - projectile.Kill(); - return; - } - float num810 = (float)((int)projectile.ai[0]) - 2.5f; - Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; - float num811 = num810 * 0.5235988f; - Vector2 value37 = Vector2.Zero; - float num812; - float y; - float num813; - float scaleFactor6; - if (projectile2.ai[0] < 180f) - { - num812 = 1f - projectile2.ai[0] / 180f; - y = 20f - projectile2.ai[0] / 180f * 14f; - if (projectile2.ai[0] < 120f) - { - num813 = 20f - 4f * (projectile2.ai[0] / 120f); - projectile.Opacity = projectile2.ai[0] / 120f * 0.4f; - } - else - { - num813 = 16f - 10f * ((projectile2.ai[0] - 120f) / 60f); - projectile.Opacity = 0.4f + (projectile2.ai[0] - 120f) / 60f * 0.6f; - } - scaleFactor6 = -22f + projectile2.ai[0] / 180f * 20f; - } - else - { - num812 = 0f; - num813 = 1.75f; - y = 6f; - projectile.Opacity = 1f; - scaleFactor6 = -2f; - } - float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; - num811 = Vector2.UnitY.RotatedBy((double)num814, default).Y * 0.5235988f * num812; - value37 = (Vector2.UnitY.RotatedBy((double)num814, default) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default); - projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); - projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; - projectile.position += value37; - projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default); - projectile.scale = 1.8f * (1f - num812); - projectile.damage = projectile2.damage; - if (projectile2.ai[0] >= 180f) - { - projectile.damage = (int)((double)projectile.damage * 2.7); - vector71 = new Vector2?(projectile2.Center); - } - if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) - { - vector71 = new Vector2?(Main.player[projectile.owner].Center); - } - projectile.friendly = (projectile2.ai[0] > 30f); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - float num818 = projectile.velocity.ToRotation(); - projectile.rotation = num818 - 1.57079637f; - projectile.velocity = num818.ToRotationVector2(); - float num819 = 2f; - float num820 = 0f; - Vector2 samplingPoint = projectile.Center; - if (vector71.HasValue) - { - samplingPoint = vector71.Value; - } - float[] array3 = new float[(int)num819]; - Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); - float num821 = 0f; - for (int num822 = 0; num822 < array3.Length; num822++) - { - num821 += array3[num822]; - } - num821 /= num819; - float amount = 0.75f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); - if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) - { - float prismHue = GetHue(projectile.ai[0]); - Color color = Main.hslToRgb(2.55f, prismHue, 0.53f); - color.A = 0; - Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); - float x = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; - for (int num843 = 0; num843 < 2; num843++) - { - float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; - float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; - Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); - int num846 = Dust.NewDust(vector80, 0, 0, 244, vector81.X, vector81.Y, 0, new Color(255, Main.DiscoG, 53), 3.3f); //267 - Main.dust[num846].color = color; - Main.dust[num846].scale = 1.2f; - if (projectile.scale > 1f) - { - Main.dust[num846].velocity *= projectile.scale; - Main.dust[num846].scale *= projectile.scale; - } - Main.dust[num846].noGravity = true; - if (projectile.scale != 1.4f) - { - Dust dust9 = Dust.CloneDust(num846); - dust9.color = Color.Orange; - dust9.scale /= 2f; - } - float hue = (x + Main.rand.NextFloat() * 0.4f) % 1f; - Main.dust[num846].color = Color.Lerp(color, Main.hslToRgb(2.55f, hue, 0.53f), projectile.scale / 1.4f); - } - if (Main.rand.NextBool(5)) - { - Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 5f); - Main.dust[num847].velocity *= 0.5f; - Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); - } - DelegateMethods.v3_1 = color.ToVector3() * 0.3f; - float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); - Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); - float num848 = projectile.velocity.ToRotation(); - if (Main.netMode != NetmodeID.Server) - { - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default), new Color(0.5f, 0.1f * (float)Math.Sign(value43) + 0.5f, 0f, 1f) * Math.Abs(value43), size, RippleShape.Square, num848); - } - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - return; - } - } + public override void AI() + { + Vector2? vector71 = null; + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + if (projectile.type != mod.ProjectileType("YharimsCrystalBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("YharimsCrystal")) + { + projectile.Kill(); + return; + } + float num810 = (float)((int)projectile.ai[0]) - 2.5f; + Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); + Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + float num811 = num810 * 0.5235988f; + Vector2 value37 = Vector2.Zero; + float num812; + float y; + float num813; + float scaleFactor6; + if (projectile2.ai[0] < 180f) + { + num812 = 1f - projectile2.ai[0] / 180f; + y = 20f - projectile2.ai[0] / 180f * 14f; + if (projectile2.ai[0] < 120f) + { + num813 = 20f - 4f * (projectile2.ai[0] / 120f); + projectile.Opacity = projectile2.ai[0] / 120f * 0.4f; + } + else + { + num813 = 16f - 10f * ((projectile2.ai[0] - 120f) / 60f); + projectile.Opacity = 0.4f + (projectile2.ai[0] - 120f) / 60f * 0.6f; + } + scaleFactor6 = -22f + projectile2.ai[0] / 180f * 20f; + } + else + { + num812 = 0f; + num813 = 1.75f; + y = 6f; + projectile.Opacity = 1f; + scaleFactor6 = -2f; + } + float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; + num811 = Vector2.UnitY.RotatedBy((double)num814, default).Y * 0.5235988f * num812; + value37 = (Vector2.UnitY.RotatedBy((double)num814, default) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default); + projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); + projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; + projectile.position += value37; + projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default); + projectile.scale = 1.8f * (1f - num812); + projectile.damage = projectile2.damage; + if (projectile2.ai[0] >= 180f) + { + projectile.damage = (int)((double)projectile.damage * 2.7); + vector71 = new Vector2?(projectile2.Center); + } + if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) + { + vector71 = new Vector2?(Main.player[projectile.owner].Center); + } + projectile.friendly = (projectile2.ai[0] > 30f); + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + float num818 = projectile.velocity.ToRotation(); + projectile.rotation = num818 - 1.57079637f; + projectile.velocity = num818.ToRotationVector2(); + float num819 = 2f; + float num820 = 0f; + Vector2 samplingPoint = projectile.Center; + if (vector71.HasValue) + { + samplingPoint = vector71.Value; + } + float[] array3 = new float[(int)num819]; + Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); + float num821 = 0f; + for (int num822 = 0; num822 < array3.Length; num822++) + { + num821 += array3[num822]; + } + num821 /= num819; + float amount = 0.75f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); + if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) + { + float prismHue = GetHue(projectile.ai[0]); + Color color = Main.hslToRgb(2.55f, prismHue, 0.53f); + color.A = 0; + Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); + float x = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; + for (int num843 = 0; num843 < 2; num843++) + { + float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; + Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); + int num846 = Dust.NewDust(vector80, 0, 0, 244, vector81.X, vector81.Y, 0, new Color(255, Main.DiscoG, 53), 3.3f); //267 + Main.dust[num846].color = color; + Main.dust[num846].scale = 1.2f; + if (projectile.scale > 1f) + { + Main.dust[num846].velocity *= projectile.scale; + Main.dust[num846].scale *= projectile.scale; + } + Main.dust[num846].noGravity = true; + if (projectile.scale != 1.4f) + { + Dust dust9 = Dust.CloneDust(num846); + dust9.color = Color.Orange; + dust9.scale /= 2f; + } + float hue = (x + Main.rand.NextFloat() * 0.4f) % 1f; + Main.dust[num846].color = Color.Lerp(color, Main.hslToRgb(2.55f, hue, 0.53f), projectile.scale / 1.4f); + } + if (Main.rand.NextBool(5)) + { + Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 5f); + Main.dust[num847].velocity *= 0.5f; + Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); + } + DelegateMethods.v3_1 = color.ToVector3() * 0.3f; + float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); + Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); + float num848 = projectile.velocity.ToRotation(); + if (Main.netMode != NetmodeID.Server) + { + ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default), new Color(0.5f, 0.1f * (float)Math.Sign(value43) + 0.5f, 0f, 1f) * Math.Abs(value43), size, RippleShape.Square, num848); + } + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + return; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - { - return false; - } - Texture2D tex = Main.projectileTexture[projectile.type]; - float num228 = projectile.localAI[1]; - float prismHue = GetHue(projectile.ai[0]); - Microsoft.Xna.Framework.Color value25 = Main.hslToRgb(2.55f, prismHue, 0.53f); - value25.A = 0; - Vector2 value26 = projectile.Center.Floor(); - value26 += projectile.velocity * projectile.scale * 10.5f; - num228 -= projectile.scale * 14.5f * projectile.scale; - Vector2 vector29 = new Vector2(projectile.scale); - DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; - Vector2 projPos = projectile.oldPos[0]; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, Main.DiscoG, 53, 127) * 0.75f * projectile.Opacity; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D tex = Main.projectileTexture[projectile.type]; + float num228 = projectile.localAI[1]; + float prismHue = GetHue(projectile.ai[0]); + Microsoft.Xna.Framework.Color value25 = Main.hslToRgb(2.55f, prismHue, 0.53f); + value25.A = 0; + Vector2 value26 = projectile.Center.Floor(); + value26 += projectile.velocity * projectile.scale * 10.5f; + num228 -= projectile.scale * 14.5f * projectile.scale; + Vector2 vector29 = new Vector2(projectile.scale); + DelegateMethods.f_1 = 1f; + DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; + Vector2 projPos = projectile.oldPos[0]; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, Main.DiscoG, 53, 127) * 0.75f * projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + return false; + } - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) - { - return true; - } - return false; - } - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } + } } diff --git a/Projectiles/Melee/AccretionDisk2Melee.cs b/Projectiles/Melee/AccretionDisk2Melee.cs index 7c7a4020fb..727a35ac89 100644 --- a/Projectiles/Melee/AccretionDisk2Melee.cs +++ b/Projectiles/Melee/AccretionDisk2Melee.cs @@ -7,51 +7,51 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class AccretionDisk2Melee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.alpha = 120; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; - aiType = 52; - } + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.alpha = 120; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 60; + aiType = 52; + } - public override void AI() - { - if (Main.rand.NextBool(2)) - { - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - } + public override void AI() + { + if (Main.rand.NextBool(2)) + { + int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/AccretionDiskMelee.cs b/Projectiles/Melee/AccretionDiskMelee.cs index a78b0c591e..e33cb10a4e 100644 --- a/Projectiles/Melee/AccretionDiskMelee.cs +++ b/Projectiles/Melee/AccretionDiskMelee.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,115 +8,115 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class AccretionDiskMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 400; - aiType = 52; - } + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 400; + aiType = 52; + } - public override void AI() - { - if (Main.rand.NextBool(2)) - { - for (int num468 = 0; num468 < 1; num468++) - { - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.NextBool(3)) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } - } + public override void AI() + { + if (Main.rand.NextBool(2)) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.NextBool(3)) + { + if (projectile.owner == Main.myPlayer) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index a1f4d221a4..96ed915a92 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,90 +7,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class AegisBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Beam"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Beam"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.alpha = 255; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + projectile.alpha = 255; + projectile.melee = true; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); - projectile.rotation += 1f; - projectile.alpha -= 25; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); + projectile.rotation += 1f; + projectile.alpha -= 25; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item20, projectile.Center); - for (int dust = 0; dust <= 30; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - } - int num251 = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("AegisFlame"), (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); - } - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(SoundID.Item20, projectile.Center); + for (int dust = 0; dust <= 30; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + } + int num251 = Main.rand.Next(2, 4); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("AegisFlame"), (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index f43d911631..892ca8b581 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class AegisBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Blast"); + } public override void SetDefaults() { @@ -23,73 +23,73 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 90; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + projectile.localNPCHitCooldown = 15; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-15, 16); - float num464 = (float)Main.rand.Next(-15, 16); - float num465 = (float)Main.rand.Next(4, 13); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-15, 16); + float num464 = (float)Main.rand.Next(-15, 16); + float num465 = (float)Main.rand.Next(4, 13); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Melee/AegisBlast2.cs b/Projectiles/Melee/AegisBlast2.cs index 212f976837..47fe4c8448 100644 --- a/Projectiles/Melee/AegisBlast2.cs +++ b/Projectiles/Melee/AegisBlast2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class AegisBlast2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Blast"); + } public override void SetDefaults() { @@ -23,68 +23,68 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 60; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-5, 6); - float num464 = (float)Main.rand.Next(-5, 6); - float num465 = (float)Main.rand.Next(2, 5); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-5, 6); + float num464 = (float)Main.rand.Next(-5, 6); + float num465 = (float)Main.rand.Next(2, 5); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index 40f7dbad92..e8faa1282b 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class AegisFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Flame"); + } public override void SetDefaults() { @@ -23,71 +23,71 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("AegisBlast2"), (int)((double)damage * 0.75), knockback, Main.myPlayer); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("AegisBlast2"), (int)((double)damage * 0.75), knockback, Main.myPlayer); + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Melee/Aftershock.cs b/Projectiles/Melee/Aftershock.cs index 758a841457..71241d7d4f 100644 --- a/Projectiles/Melee/Aftershock.cs +++ b/Projectiles/Melee/Aftershock.cs @@ -4,10 +4,10 @@ namespace CalamityMod.Projectiles.Melee { public class Aftershock : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock"); + } public override void SetDefaults() { diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 173384957c..1ad63827de 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -8,146 +8,146 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class BalefulHarvesterProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pumpkin Skull"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pumpkin Skull"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } - public override void AI() - { - if (projectile.ai[0] < 0f) - { - projectile.alpha = 0; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 50; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } + public override void AI() + { + if (projectile.ai[0] < 0f) + { + projectile.alpha = 0; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 50; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - projectile.Center; - vector17.Normalize(); - vector17 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } + int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector17 = Main.player[num123].Center - projectile.Center; + vector17.Normalize(); + vector17 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item8, projectile.position); - for (int num124 = 0; num124 < 10; num124++) - { - int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 5 : 6), projectile.velocity.X, projectile.velocity.Y, 0, default, 2f); - Main.dust[num125].noGravity = true; - Main.dust[num125].velocity = projectile.Center - Main.dust[num125].position; - Main.dust[num125].velocity.Normalize(); - Main.dust[num125].velocity *= -5f; - Main.dust[num125].velocity += projectile.velocity / 2f; - } - } - else - { - for (int num157 = 0; num157 < 2; num157++) - { - int num158 = Dust.NewDust(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, (Main.rand.NextBool(2) ? 5 : 6), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 2f); - Main.dust[num158].position -= projectile.velocity * 2f; - Main.dust[num158].noGravity = true; - Dust expr_7A4A_cp_0_cp_0 = Main.dust[num158]; - expr_7A4A_cp_0_cp_0.velocity.X *= 0.3f; - Dust expr_7A65_cp_0_cp_0 = Main.dust[num158]; - expr_7A65_cp_0_cp_0.velocity.Y *= 0.3f; - } - } - } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item8, projectile.position); + for (int num124 = 0; num124 < 10; num124++) + { + int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 5 : 6), projectile.velocity.X, projectile.velocity.Y, 0, default, 2f); + Main.dust[num125].noGravity = true; + Main.dust[num125].velocity = projectile.Center - Main.dust[num125].position; + Main.dust[num125].velocity.Normalize(); + Main.dust[num125].velocity *= -5f; + Main.dust[num125].velocity += projectile.velocity / 2f; + } + } + else + { + for (int num157 = 0; num157 < 2; num157++) + { + int num158 = Dust.NewDust(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, (Main.rand.NextBool(2) ? 5 : 6), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 2f); + Main.dust[num158].position -= projectile.velocity * 2f; + Main.dust[num158].noGravity = true; + Dust expr_7A4A_cp_0_cp_0 = Main.dust[num158]; + expr_7A4A_cp_0_cp_0.velocity.X *= 0.3f; + Dust expr_7A65_cp_0_cp_0 = Main.dust[num158]; + expr_7A65_cp_0_cp_0.velocity.Y *= 0.3f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Main.rand.Next(0, 128)); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, Main.rand.Next(0, 128)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - if (projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("TinyFlare"), - (int)((double)projectile.damage * 0.35), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + if (projectile.owner == Main.myPlayer) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("TinyFlare"), + (int)((double)projectile.damage * 0.35), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Melee/BallOFugu.cs b/Projectiles/Melee/BallOFugu.cs index ab30531831..552c3649f4 100644 --- a/Projectiles/Melee/BallOFugu.cs +++ b/Projectiles/Melee/BallOFugu.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class BallOFugu : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball O Fugu"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball O Fugu"); + } public override void SetDefaults() { @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.Venom, 240); projectile.ai[0] = 1f; projectile.netUpdate = true; } diff --git a/Projectiles/Melee/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index 187f9dcc28..8029de76a5 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class BansheeHookBoom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boom"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boom"); + } public override void SetDefaults() { @@ -19,62 +19,62 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.alpha = 255; projectile.ignoreWater = true; - projectile.timeLeft = 6; + projectile.timeLeft = 6; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 16; } public override void AI() { - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1]; - projectile.ai[0] += 1f; - projectile.alpha -= 63; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 1.5f, 0f, 0.15f); - if (projectile.ai[0] == 1f) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = (int)(52f * projectile.scale)); - projectile.Center = projectile.position; - projectile.Damage(); - for (int num1000 = 0; num1000 < 2; num1000++) - { - int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - } - for (int num1002 = 0; num1002 < 5; num1002++) - { - int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 2.7f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].velocity *= 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].fadeIn = 2.5f; - } - for (int num1004 = 0; num1004 < 2; num1004++) - { - int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num1005].noGravity = true; - Main.dust[num1005].velocity *= 3f; - } - for (int num1006 = 0; num1006 < 5; num1006++) - { - int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 0, default, 1.5f); - Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num1007].noGravity = true; - Main.dust[num1007].velocity *= 3f; - } - } + projectile.ai[1] += 0.01f; + projectile.scale = projectile.ai[1]; + projectile.ai[0] += 1f; + projectile.alpha -= 63; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 1.5f, 0f, 0.15f); + if (projectile.ai[0] == 1f) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = (int)(52f * projectile.scale)); + projectile.Center = projectile.position; + projectile.Damage(); + for (int num1000 = 0; num1000 < 2; num1000++) + { + int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + } + for (int num1002 = 0; num1002 < 5; num1002++) + { + int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 2.7f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].velocity *= 3f; + num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].velocity *= 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].fadeIn = 2.5f; + } + for (int num1004 = 0; num1004 < 2; num1004++) + { + int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); + Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num1005].noGravity = true; + Main.dust[num1005].velocity *= 3f; + } + for (int num1006 = 0; num1006 < 5; num1006++) + { + int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 0, default, 1.5f); + Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num1007].noGravity = true; + Main.dust[num1007].velocity *= 3f; + } + } } } } diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index 121e4063a8..8022ac168c 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class BansheeHookScythe : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } public override void SetDefaults() { @@ -25,23 +25,23 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; aiType = 274; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 3; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, 0f, 0f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, 0f, 0f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); } } } diff --git a/Projectiles/Melee/BiomeOrb.cs b/Projectiles/Melee/BiomeOrb.cs index 2d84ca59bb..cee008ca1f 100644 --- a/Projectiles/Melee/BiomeOrb.cs +++ b/Projectiles/Melee/BiomeOrb.cs @@ -6,132 +6,132 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class BiomeOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Biome Orb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Biome Orb"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool sky = player.ZoneSkyHeight; - int dustType = 0; - if (jungle) - { - dustType = 39; - } - else if (snow) - { - dustType = 51; - } - else if (beach) - { - dustType = 33; - } - else if (corrupt) - { - dustType = 14; - } - else if (crimson) - { - dustType = 5; - } - else if (dungeon) - { - dustType = 29; - } - else if (desert) - { - dustType = 32; - } - else if (glow) - { - dustType = 56; - } - else if (hell) - { - dustType = 6; - } - else if (sky) - { - dustType = 213; - } - else - { - dustType = 3; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool sky = player.ZoneSkyHeight; + int dustType = 0; + if (jungle) + { + dustType = 39; + } + else if (snow) + { + dustType = 51; + } + else if (beach) + { + dustType = 33; + } + else if (corrupt) + { + dustType = 14; + } + else if (crimson) + { + dustType = 5; + } + else if (dungeon) + { + dustType = 29; + } + else if (desert) + { + dustType = 32; + } + else if (glow) + { + dustType = 56; + } + else if (hell) + { + dustType = 6; + } + else if (sky) + { + dustType = 213; + } + else + { + dustType = 3; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 180); - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 180); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 180); - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 180); - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 180); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 180); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 180); - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 180); + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 180); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 180); + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 180); + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 180); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 180); + } + } + } } diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 7233b5228d..da46216b29 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,90 +8,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class BlazingPhantomBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blazing Phantom Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blazing Phantom Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 460f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 460f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 8f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Venom, 60); - target.AddBuff(BuffID.CursedInferno, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Venom, 60); + target.AddBuff(BuffID.CursedInferno, 120); + } + } } diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index 23faca0997..eb96ee1670 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,73 +7,73 @@ namespace CalamityMod.Projectiles.Melee { public class Blood : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood"); + } public override void SetDefaults() { projectile.width = 4; projectile.height = 4; projectile.friendly = true; - projectile.melee = true; + projectile.melee = true; projectile.penetrate = 2; projectile.timeLeft = 180; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 6f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 6f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } + Player player = Main.player[projectile.owner]; + player.statLife += 5; + player.HealEffect(5); + } } } diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index 7f7c8e8779..dcfee74cc2 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -1,72 +1,72 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Blood2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.timeLeft = 150; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.timeLeft = 150; + } - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 6f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - } + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 6f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + } } diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index ee3a96b5d6..0adce3e848 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -5,126 +5,125 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class BloodBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Ball"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Ball"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.melee = true; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 200; + projectile.melee = true; + projectile.tileCollide = false; + } - public override void AI() - { - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 8f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - } + public override void AI() + { + try + { + int num223 = (int)(projectile.position.X / 16f) - 1; + int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int num225 = (int)(projectile.position.Y / 16f) - 1; + int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (num223 < 0) + { + num223 = 0; + } + if (num224 > Main.maxTilesX) + { + num224 = Main.maxTilesX; + } + if (num225 < 0) + { + num225 = 0; + } + if (num226 > Main.maxTilesY) + { + num226 = Main.maxTilesY; + } + for (int num227 = num223; num227 < num224; num227++) + { + for (int num228 = num225; num228 < num226; num228++) + { + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + { + Vector2 vector19; + vector19.X = (float)(num227 * 16); + vector19.Y = (float)(num228 * 16); + if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } catch + { + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 128; + projectile.height = 128; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 8f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 22; - projectile.height = 22; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num648 = 0; num648 < 20; num648++) - { - int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num649].velocity *= 1.4f; - } - for (int num650 = 0; num650 < 10; num650++) - { - int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2.5f); - Main.dust[num651].noGravity = true; - Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num651].velocity *= 3f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 22; + projectile.height = 22; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num648 = 0; num648 < 20; num648++) + { + int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[num649].velocity *= 1.4f; + } + for (int num650 = 0; num650 < 10; num650++) + { + int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2.5f); + Main.dust[num651].noGravity = true; + Main.dust[num651].velocity *= 5f; + num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[num651].velocity *= 3f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.Kill(); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.Kill(); + } + } } diff --git a/Projectiles/Melee/BloodScythe.cs b/Projectiles/Melee/BloodScythe.cs index b3386dfa13..e999be0c80 100644 --- a/Projectiles/Melee/BloodScythe.cs +++ b/Projectiles/Melee/BloodScythe.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class BloodScythe : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Scythe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Scythe"); + } public override void SetDefaults() { @@ -23,12 +23,12 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = true; projectile.penetrate = 2; - projectile.timeLeft = 600; + projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.075f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.075f) / 255f); if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) { projectile.velocity *= 1.05f; @@ -36,18 +36,18 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.1f; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 180); } diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs index bcce817104..0ff0acd900 100644 --- a/Projectiles/Melee/BloodyBlade.cs +++ b/Projectiles/Melee/BloodyBlade.cs @@ -7,52 +7,52 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class BloodyBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.aiStyle = 18; - aiType = 274; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.aiStyle = 18; + aiType = 274; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 9; - target.AddBuff(BuffID.Ichor, 60); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 9; + target.AddBuff(BuffID.Ichor, 60); + } + } } diff --git a/Projectiles/Melee/BlueAura.cs b/Projectiles/Melee/BlueAura.cs index 8de9bf7c4b..dfe60fa503 100644 --- a/Projectiles/Melee/BlueAura.cs +++ b/Projectiles/Melee/BlueAura.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class BlueAura : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blue Aura"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blue Aura"); + } public override void SetDefaults() { diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index 1a86a2e2f8..63a5909dcf 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -6,80 +6,80 @@ namespace CalamityMod.Projectiles.Melee { public class Brimblast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimblast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimblast"); + } public override void SetDefaults() { projectile.width = 6; projectile.height = 24; projectile.friendly = true; - projectile.melee = true; + projectile.melee = true; projectile.penetrate = -1; projectile.timeLeft = 240; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 4f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.2f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 4f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.2f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -93,8 +93,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index 23faafe3bc..071ccec56b 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class BrimlanceHellfireExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -23,78 +23,78 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 60; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + projectile.localNPCHitCooldown = 20; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); } } } diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index 0a43723e3f..9af44b38ad 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class BrimlanceStandingFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -23,68 +23,68 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); - } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); + } + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -98,8 +98,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); } } } diff --git a/Projectiles/Melee/Brimlash.cs b/Projectiles/Melee/Brimlash.cs index 30ca157b22..f95ddfb432 100644 --- a/Projectiles/Melee/Brimlash.cs +++ b/Projectiles/Melee/Brimlash.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class Brimlash : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlash"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlash"); + } public override void SetDefaults() { @@ -24,48 +24,48 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (Math.Abs(projectile.velocity.X) <= 1f || Math.Abs(projectile.velocity.Y) <= 1f) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (Math.Abs(projectile.velocity.X) <= 1f || Math.Abs(projectile.velocity.Y) <= 1f) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 2; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + float spread = 90f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); } } } diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index 13d4fc6d0b..338a33b1d5 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class Brimlash2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlash"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlash"); + } public override void SetDefaults() { @@ -25,57 +25,57 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 15f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); } } } diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index 324eb1fc39..26e8c97a2a 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class BrimstoneBoom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boom"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boom"); + } public override void SetDefaults() { @@ -26,63 +26,63 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index bc1179cade..7c866ffc20 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -1,64 +1,64 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class BrimstoneLaserFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = 1; - aiType = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 120; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.aiStyle = 1; + aiType = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 120; + projectile.timeLeft = 600; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += projectile.ai[0]; - if (Main.rand.NextBool(2)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += projectile.ai[0]; + if (Main.rand.NextBool(2)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); + } + } } diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index 4b586a9dfe..72d75db558 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Melee { public class BrinySpout : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Briny Spout"); - Main.projFrames[projectile.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Briny Spout"); + Main.projFrames[projectile.type] = 6; + } public override void SetDefaults() { @@ -26,107 +26,107 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = 255; projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 8; } public override void AI() { - int num613 = 16; - int num614 = 16; - float num615 = 1.5f; - int num616 = 150; - int num617 = 42; - if (Main.rand.NextBool(15)) + int num613 = 16; + int num614 = 16; + float num615 = 1.5f; + int num616 = 150; + int num617 = 42; + if (Main.rand.NextBool(15)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + } + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 3; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 3; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + int num335 = Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); } - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 3; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 3; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - int num335 = Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } } public override Color? GetAlpha(Color lightColor) { - return new Color(53, Main.DiscoG, 255, projectile.alpha); + return new Color(53, Main.DiscoG, 255, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } } } diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index d60160fdf6..f40a430639 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,11 +7,11 @@ namespace CalamityMod.Projectiles.Melee { public class BrinyTyphoonBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - Main.projFrames[projectile.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + Main.projFrames[projectile.type] = 3; + } public override void SetDefaults() { @@ -26,71 +26,71 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) - { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 187, value15.X * 2f, value15.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - return; - } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 187, value15.X * 2f, value15.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + return; + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 7020a7282b..25ed607e74 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -7,113 +7,113 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class BurningMeteor : ModProjectile - { - private int noTileHitCounter = 120; + { + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meteor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meteor"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.alpha = 150; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - } + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.alpha = 150; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + } - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(36)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(30)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(60)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, 150, default, 2f); - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } + public override void AI() + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + projectile.localAI[0] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(36)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(30)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(60)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, 150, default, 2f); + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/CalamityAura.cs b/Projectiles/Melee/CalamityAura.cs index 8b530f0fb2..60735d03ea 100644 --- a/Projectiles/Melee/CalamityAura.cs +++ b/Projectiles/Melee/CalamityAura.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class CalamityAura : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } public override void SetDefaults() { @@ -24,78 +24,78 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 73, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 73, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } - } + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 73, 0f, 0f, 100, default, 1.35f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 73, 0f, 0f, 100, default, 1f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].noGravity = true; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.OnFire, 600); } - public override void Kill(int timeLeft) - { - int height = 40; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } + public override void Kill(int timeLeft) + { + int height = 40; + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item14, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } } } diff --git a/Projectiles/Melee/CalamityAuraType2.cs b/Projectiles/Melee/CalamityAuraType2.cs index eeede10057..809c3f4e06 100644 --- a/Projectiles/Melee/CalamityAuraType2.cs +++ b/Projectiles/Melee/CalamityAuraType2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class CalamityAuraType2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } public override void SetDefaults() { @@ -24,78 +24,78 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 56, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 56, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } - } + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 56, 0f, 0f, 100, default, 1.35f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 56, 0f, 0f, 100, default, 1f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].noGravity = true; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn, 300); } - public override void Kill(int timeLeft) - { - int height = 40; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } + public override void Kill(int timeLeft) + { + int height = 40; + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item14, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } } diff --git a/Projectiles/Melee/CalamityAuraType3.cs b/Projectiles/Melee/CalamityAuraType3.cs index e6170c3166..7ce1edf101 100644 --- a/Projectiles/Melee/CalamityAuraType3.cs +++ b/Projectiles/Melee/CalamityAuraType3.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class CalamityAuraType3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } public override void SetDefaults() { @@ -24,78 +24,78 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 57, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 57, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } - } + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 57, 0f, 0f, 100, default, 1.35f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 57, 0f, 0f, 100, default, 1f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].noGravity = true; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, 180); + target.AddBuff(BuffID.Ichor, 180); } - public override void Kill(int timeLeft) - { - int height = 40; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } + public override void Kill(int timeLeft) + { + int height = 40; + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item14, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } } diff --git a/Projectiles/Melee/ChaosFlameLarge.cs b/Projectiles/Melee/ChaosFlameLarge.cs index 52f3043725..e6381796d1 100644 --- a/Projectiles/Melee/ChaosFlameLarge.cs +++ b/Projectiles/Melee/ChaosFlameLarge.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class ChaosFlameLarge : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -23,28 +23,28 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 1; projectile.timeLeft = 600; aiType = 228; - } + } public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); - if (Main.rand.NextBool(4)) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); + if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.OnFire, 480); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + } } diff --git a/Projectiles/Melee/ChaosFlameMedium.cs b/Projectiles/Melee/ChaosFlameMedium.cs index d830c0f6a3..0053732ea2 100644 --- a/Projectiles/Melee/ChaosFlameMedium.cs +++ b/Projectiles/Melee/ChaosFlameMedium.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class ChaosFlameMedium : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -23,28 +23,28 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 1; projectile.timeLeft = 600; aiType = 228; - } + } public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); - if (Main.rand.NextBool(4)) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); + if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.OnFire, 360); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + } } diff --git a/Projectiles/Melee/ChaosFlameSmall.cs b/Projectiles/Melee/ChaosFlameSmall.cs index af6d08a9ea..30fc88bd45 100644 --- a/Projectiles/Melee/ChaosFlameSmall.cs +++ b/Projectiles/Melee/ChaosFlameSmall.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class ChaosFlameSmall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -23,28 +23,28 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 1; projectile.timeLeft = 600; aiType = 228; - } + } public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); - if (Main.rand.NextBool(4)) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); + if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.OnFire, 240); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + } } diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index f6f389d0f4..9472a958b0 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -23,24 +23,24 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num441 = 0; num441 < 2; num441++) - { - Vector2 vector30 = projectile.position; - vector30 -= projectile.velocity * ((float)num441 * 0.25f); - projectile.alpha = 255; - int num442 = Dust.NewDust(vector30, 1, 1, 107, 0f, 0f, 0, default, 1.3f); - Main.dust[num442].position = vector30; - Dust expr_13A3E_cp_0 = Main.dust[num442]; - expr_13A3E_cp_0.position.X += (float)(projectile.width / 2); - Dust expr_13A62_cp_0 = Main.dust[num442]; - expr_13A62_cp_0.position.Y += (float)(projectile.height / 2); - Main.dust[num442].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num442].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num441 = 0; num441 < 2; num441++) + { + Vector2 vector30 = projectile.position; + vector30 -= projectile.velocity * ((float)num441 * 0.25f); + projectile.alpha = 255; + int num442 = Dust.NewDust(vector30, 1, 1, 107, 0f, 0f, 0, default, 1.3f); + Main.dust[num442].position = vector30; + Dust expr_13A3E_cp_0 = Main.dust[num442]; + expr_13A3E_cp_0.position.X += (float)(projectile.width / 2); + Dust expr_13A62_cp_0 = Main.dust[num442]; + expr_13A62_cp_0.position.Y += (float)(projectile.height / 2); + Main.dust[num442].scale = (float)Main.rand.Next(70, 110) * 0.007f; + Main.dust[num442].velocity *= 0.2f; + } + } } } } diff --git a/Projectiles/Melee/CosmicDischarge.cs b/Projectiles/Melee/CosmicDischarge.cs index 4ec6f7b729..42dd6c406a 100644 --- a/Projectiles/Melee/CosmicDischarge.cs +++ b/Projectiles/Melee/CosmicDischarge.cs @@ -1,19 +1,19 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Enums; namespace CalamityMod.Projectiles.Melee { public class CosmicDischarge : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Discharge"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Discharge"); + } public override void SetDefaults() { @@ -27,211 +27,211 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.Calamity().trueMelee = true; - } + projectile.localNPCHitCooldown = 4; + projectile.Calamity().trueMelee = true; + } public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = projectile.velocity.ToRotation(); - } - float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); - if (projectile.ai[1] <= 0f) - { - num32 *= -1f; - } - Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); - vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); - if (projectile.ai[1] <= 0f) - { - vector17.Y *= -1f; - } - vector17 = vector17.RotatedBy((double)projectile.localAI[0], default); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 30f) - { - projectile.velocity += 48f * vector17; - } - else - { - projectile.Kill(); - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; - if (player.direction != 1) - { - vector24.X = (float)player.bodyFrame.Width - vector24.X; - } - if (player.gravDir != 1f) - { - vector24.Y = (float)player.bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; - projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; - if (projectile.alpha == 0) - { - for (int num51 = 0; num51 < 2; num51++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 2f)]; - dust.noGravity = true; - dust.velocity *= 2f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); - dust.fadeIn = 1.5f; - } - float num52 = 18f; - int num53 = 0; - while ((float)num53 < num52) - { - if (Main.rand.NextBool(4)) - { - Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); - Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1f)]; - dust2.noGravity = true; - dust2.fadeIn = 0.5f; - dust2.velocity += projectile.localAI[0].ToRotationVector2(); - dust2.noLight = true; - } - num53++; - } - } + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = projectile.velocity.ToRotation(); + } + float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); + if (projectile.ai[1] <= 0f) + { + num32 *= -1f; + } + Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); + vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); + if (projectile.ai[1] <= 0f) + { + vector17.Y *= -1f; + } + vector17 = vector17.RotatedBy((double)projectile.localAI[0], default); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 30f) + { + projectile.velocity += 48f * vector17; + } + else + { + projectile.Kill(); + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = (float)player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; + if (projectile.alpha == 0) + { + for (int num51 = 0; num51 < 2; num51++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 2f)]; + dust.noGravity = true; + dust.velocity *= 2f; + dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.fadeIn = 1.5f; + } + float num52 = 18f; + int num53 = 0; + while ((float)num53 < num52) + { + if (Main.rand.NextBool(4)) + { + Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); + Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1f)]; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + dust2.velocity += projectile.localAI[0].ToRotationVector2(); + dust2.noLight = true; + } + num53++; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - Vector2 projPos = projectile.position; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D22 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); - if (projectile.velocity == Vector2.Zero) - { - return false; - } - float num230 = projectile.velocity.Length() + 16f; - bool flag24 = num230 < 100f; - Vector2 value28 = Vector2.Normalize(projectile.velocity); - Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 - Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); - float rotation24 = projectile.rotation + 3.14159274f; - Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); - num230 -= 40f * projectile.scale; - Vector2 vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 - if (num230 > 0f) - { - float num231 = 0f; - while (num231 + 1f < num230) - { - if (num230 - num231 < (float)rectangle8.Height) - { - rectangle8.Height = (int)(num230 - num231); - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num231 += (float)rectangle8.Height * projectile.scale; - vector31 += value28 * (float)rectangle8.Height * projectile.scale; - } - } - Vector2 value30 = vector31; - vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 - int num232 = 18; - if (flag24) - { - num232 = 9; - } - float num233 = num230; - if (num230 > 0f) - { - float num234 = 0f; - float num235 = num233 / (float)num232; - num234 += num235 * 0.25f; - vector31 += value28 * num235 * 0.25f; - for (int num236 = 0; num236 < num232; num236++) - { - float num237 = num235; - if (num236 == 0) - { - num237 *= 0.75f; - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num234 += num237; - vector31 += value28 * num237; - } - } - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 - Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 projPos = projectile.position; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D22 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); + if (projectile.velocity == Vector2.Zero) + { + return false; + } + float num230 = projectile.velocity.Length() + 16f; + bool flag24 = num230 < 100f; + Vector2 value28 = Vector2.Normalize(projectile.velocity); + Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 + Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); + float rotation24 = projectile.rotation + 3.14159274f; + Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); + num230 -= 40f * projectile.scale; + Vector2 vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 + if (num230 > 0f) + { + float num231 = 0f; + while (num231 + 1f < num230) + { + if (num230 - num231 < (float)rectangle8.Height) + { + rectangle8.Height = (int)(num230 - num231); + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num231 += (float)rectangle8.Height * projectile.scale; + vector31 += value28 * (float)rectangle8.Height * projectile.scale; + } + } + Vector2 value30 = vector31; + vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 + int num232 = 18; + if (flag24) + { + num232 = 9; + } + float num233 = num230; + if (num230 > 0f) + { + float num234 = 0f; + float num235 = num233 / (float)num232; + num234 += num235 * 0.25f; + vector31 += value28 * num235 * 0.25f; + for (int num236 = 0; num236 < num232; num236++) + { + float num237 = num235; + if (num236 == 0) + { + num237 *= 0.75f; + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num234 += num237; + vector31 += value28 * num237; + } + } + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 + Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } public override Color? GetAlpha(Color lightColor) { - return new Color(150, Main.DiscoG, 255, 200); + return new Color(150, Main.DiscoG, 255, 200); } public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) - { - return true; - } - return false; + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num8 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + { + return true; + } + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; - target.AddBuff(BuffID.Frostburn, 300); - if (Main.rand.NextBool(3)) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("CosmicIceBurst"), damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - projectile.localAI[1] = 4f; - player.AddBuff(mod.BuffType("CosmicFreeze"), 300); + Player player = Main.player[projectile.owner]; + target.AddBuff(BuffID.Frostburn, 300); + if (Main.rand.NextBool(3)) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("CosmicIceBurst"), damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + projectile.localAI[1] = 4f; + player.AddBuff(mod.BuffType("CosmicFreeze"), 300); } } } diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 32adfdb6d9..8699a8ef7a 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicIceBurst : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Ice"); - Main.projFrames[projectile.type] = 9; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Ice"); + Main.projFrames[projectile.type] = 9; + } public override void SetDefaults() { @@ -21,103 +21,103 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.alpha = 255; projectile.ignoreWater = true; - projectile.timeLeft = 60; + projectile.timeLeft = 60; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; } public override void AI() { - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1]; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) - { - projectile.Kill(); - return; - } - if (++projectile.frameCounter >= 3) - { - projectile.frameCounter = 0; - if (++projectile.frame >= Main.projFrames[projectile.type]) - { - projectile.hide = true; - } - } - projectile.alpha -= 63; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.517f, ((float)Main.DiscoG / 300f), 0.85f); - if (projectile.ai[0] == 1f) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = (int)(52f * projectile.scale)); - projectile.Center = projectile.position; - projectile.Damage(); - Main.PlaySound(SoundID.Item62, projectile.position); - for (int num1000 = 0; num1000 < 4; num1000++) - { - int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); - Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - } - for (int num1002 = 0; num1002 < 10; num1002++) - { - int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 2.7f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].velocity *= 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].fadeIn = 2.5f; - } - for (int num1004 = 0; num1004 < 5; num1004++) - { - int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 2.7f); - Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num1005].noGravity = true; - Main.dust[num1005].velocity *= 3f; - } - for (int num1006 = 0; num1006 < 10; num1006++) - { - int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 1.5f); - Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num1007].noGravity = true; - Main.dust[num1007].velocity *= 3f; - } - } + projectile.ai[1] += 0.01f; + projectile.scale = projectile.ai[1]; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) + { + projectile.Kill(); + return; + } + if (++projectile.frameCounter >= 3) + { + projectile.frameCounter = 0; + if (++projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.hide = true; + } + } + projectile.alpha -= 63; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.517f, ((float)Main.DiscoG / 300f), 0.85f); + if (projectile.ai[0] == 1f) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = (int)(52f * projectile.scale)); + projectile.Center = projectile.position; + projectile.Damage(); + Main.PlaySound(SoundID.Item62, projectile.position); + for (int num1000 = 0; num1000 < 4; num1000++) + { + int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); + Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + } + for (int num1002 = 0; num1002 < 10; num1002++) + { + int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 2.7f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].velocity *= 3f; + num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].velocity *= 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].fadeIn = 2.5f; + } + for (int num1004 = 0; num1004 < 5; num1004++) + { + int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 2.7f); + Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num1005].noGravity = true; + Main.dust[num1005].velocity *= 3f; + } + for (int num1006 = 0; num1006 < 10; num1006++) + { + int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 1.5f); + Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num1007].noGravity = true; + Main.dust[num1007].velocity *= 3f; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - Vector2 vector42 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D33 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle15 = texture2D33.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin11 = rectangle15.Size() / 2f; - return true; + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 vector42 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D33 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle15 = texture2D33.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin11 = rectangle15.Size() / 2f; + return true; } public override Color? GetAlpha(Color lightColor) { - return new Color(150, Main.DiscoG, 255, 127); + return new Color(150, Main.DiscoG, 255, 127); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); - projectile.direction = Main.player[projectile.owner].direction; + target.AddBuff(BuffID.Frostburn, 300); + projectile.direction = Main.player[projectile.owner].direction; } } } diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 6bd4b43bf4..c48e79403e 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,127 +8,127 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { - projectile.extraUpdates = 0; + projectile.extraUpdates = 0; projectile.width = 14; projectile.height = 14; projectile.friendly = true; projectile.penetrate = -1; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.5f, 0.15f)); - projectile.velocity *= 0.985f; - projectile.rotation += projectile.velocity.X * 0.2f; - if (projectile.velocity.X > 0f) - { - projectile.rotation += 0.08f; - } - else - { - projectile.rotation -= 0.08f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) - { - projectile.alpha += 10; - if (projectile.alpha >= 255) - { - projectile.alpha = 255; - projectile.Kill(); - return; - } - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 500f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("CosmicBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.5f, 0.15f)); + projectile.velocity *= 0.985f; + projectile.rotation += projectile.velocity.X * 0.2f; + if (projectile.velocity.X > 0f) + { + projectile.rotation += 0.08f; + } + else + { + projectile.rotation -= 0.08f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] > 30f) + { + projectile.alpha += 10; + if (projectile.alpha >= 255) + { + projectile.alpha = 255; + projectile.Kill(); + return; + } + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 500f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("CosmicBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); - Vector2 arg_6751_0 = projectile.Center; - int num3; - for (int num191 = 0; num191 < 10; num191 = num3 + 1) - { - int num192 = (int)(10f * projectile.scale); - int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default, 1f); - Dust dust20 = Main.dust[num193]; - Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); - dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; - if (num191 < 30) - { - dust20.velocity = value8 * dust20.velocity.Length(); - } - else - { - dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; - } - dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); - dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); - dust20.noGravity = true; - dust20.scale = 0.7f; - num3 = num191; - } + Main.PlaySound(SoundID.Item54, projectile.position); + Vector2 arg_6751_0 = projectile.Center; + int num3; + for (int num191 = 0; num191 < 10; num191 = num3 + 1) + { + int num192 = (int)(10f * projectile.scale); + int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default, 1f); + Dust dust20 = Main.dust[num193]; + Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); + dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; + if (num191 < 30) + { + dust20.velocity = value8 * dust20.velocity.Length(); + } + else + { + dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; + } + dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); + dust20.noGravity = true; + dust20.scale = 0.7f; + num3 = num191; + } } public override Color? GetAlpha(Color lightColor) { - return new Color(0, 255 - projectile.alpha, 0, 0); + return new Color(0, 255 - projectile.alpha, 0, 0); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb1.cs b/Projectiles/Melee/CosmicSpiritBomb1.cs index 75e51fe311..c24bcfe2c8 100644 --- a/Projectiles/Melee/CosmicSpiritBomb1.cs +++ b/Projectiles/Melee/CosmicSpiritBomb1.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicSpiritBomb1 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } public override void SetDefaults() { @@ -26,34 +26,34 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } - - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + target.AddBuff(BuffID.Frostburn, 300); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb2.cs b/Projectiles/Melee/CosmicSpiritBomb2.cs index c4fad26010..1029634e6c 100644 --- a/Projectiles/Melee/CosmicSpiritBomb2.cs +++ b/Projectiles/Melee/CosmicSpiritBomb2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicSpiritBomb2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } public override void SetDefaults() { @@ -26,34 +26,34 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + target.AddBuff(BuffID.OnFire, 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb3.cs b/Projectiles/Melee/CosmicSpiritBomb3.cs index 3de4d88d64..8ec3a07126 100644 --- a/Projectiles/Melee/CosmicSpiritBomb3.cs +++ b/Projectiles/Melee/CosmicSpiritBomb3.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicSpiritBomb3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } public override void SetDefaults() { @@ -26,34 +26,34 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - } - - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + target.AddBuff(BuffID.Ichor, 180); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CrystalDust.cs b/Projectiles/Melee/CrystalDust.cs index 368c44784f..cd7927cad9 100644 --- a/Projectiles/Melee/CrystalDust.cs +++ b/Projectiles/Melee/CrystalDust.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.GameContent.Achievements; using Terraria.ID; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class CrystalDust : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -29,81 +29,81 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - int num307 = Main.rand.Next(3); - if (num307 == 0) - { - num307 = 173; - } - else if (num307 == 1) - { - num307 = 57; - } - else - { - num307 = 58; - } - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num307, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - if (projectile.ai[0] == 1f) - { - if (projectile.owner == Main.myPlayer) - { - int num814 = 3; - int num815 = (int)(projectile.position.X / 16f - (float)num814); - int num816 = (int)(projectile.position.X / 16f + (float)num814); - int num817 = (int)(projectile.position.Y / 16f - (float)num814); - int num818 = (int)(projectile.position.Y / 16f + (float)num814); - if (num815 < 0) - { - num815 = 0; - } - if (num816 > Main.maxTilesX) - { - num816 = Main.maxTilesX; - } - if (num817 < 0) - { - num817 = 0; - } - if (num818 > Main.maxTilesY) - { - num818 = Main.maxTilesY; - } - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); - float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) - { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active()) - { - WorldGen.KillTile(num824, num825, false, false, false); - if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); - } - } - } + if (projectile.localAI[0] > 4f) + { + int num307 = Main.rand.Next(3); + if (num307 == 0) + { + num307 = 173; + } + else if (num307 == 1) + { + num307 = 57; + } + else + { + num307 = 58; + } + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num307, 0f, 0f, 100, default, 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + if (projectile.ai[0] == 1f) + { + if (projectile.owner == Main.myPlayer) + { + int num814 = 3; + int num815 = (int)(projectile.position.X / 16f - (float)num814); + int num816 = (int)(projectile.position.X / 16f + (float)num814); + int num817 = (int)(projectile.position.Y / 16f - (float)num814); + int num818 = (int)(projectile.position.Y / 16f + (float)num814); + if (num815 < 0) + { + num815 = 0; + } + if (num816 > Main.maxTilesX) + { + num816 = Main.maxTilesX; + } + if (num817 < 0) + { + num817 = 0; + } + if (num818 > Main.maxTilesY) + { + num818 = Main.maxTilesY; + } + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); + float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + if (num828 < (double)num814) + { + if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active()) + { + WorldGen.KillTile(num824, num825, false, false, false); + if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + if (Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + } + } + } } } } diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index eee47471c6..46ac92612b 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -1,41 +1,41 @@ -using System; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Melee { public class Cyclone : ModProjectile - { + { public int dustvortex = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cyclone"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cyclone"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.timeLeft = 300; - projectile.extraUpdates = 2; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.alpha = 255; + projectile.friendly = true; + projectile.melee = true; + projectile.timeLeft = 300; + projectile.extraUpdates = 2; + projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; projectile.tileCollide = false; - } + } - public override void AI() - { + public override void AI() + { projectile.ai[0]++; projectile.ai[1]++; @@ -43,18 +43,18 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[0] >= 12) projectile.tileCollide = true; - projectile.rotation += 2.5f; - projectile.alpha -= 5; - if (projectile.alpha < 50) - { - projectile.alpha = 50; + projectile.rotation += 2.5f; + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; if (projectile.ai[1] >= 15) { for (int i = 1; i <= 6; i++) { Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(dustvortex)); - int d = Dust.NewDust(projectile.Center, projectile.width/2, projectile.height/2, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); + int d = Dust.NewDust(projectile.Center, projectile.width / 2, projectile.height / 2, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); Main.dust[d].noGravity = true; Main.dust[d].velocity = dustspeed; dustvortex += 60; @@ -62,57 +62,57 @@ namespace CalamityMod.Projectiles.Melee dustvortex -= 355; projectile.ai[1] = 0; } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; - float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) - { - NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) - { - npcCenterX = npc.position.X + (float)(npc.width / 2); - npcCenterY = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); - if (num478 < num474) - { - if (npc.position.X < num472) - { - npc.velocity.X += 0.05f; - } - else - { - npc.velocity.X -= 0.05f; - } - if (npc.position.Y < num473) - { - npc.velocity.Y += 0.05f; - } - else - { - npc.velocity.Y -= 0.05f; - } - } - } - } - } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float npcCenterX = 0f; + float npcCenterY = 0f; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + NPC npc = Main.npc[num475]; + if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + npcCenterX = npc.position.X + (float)(npc.width / 2); + npcCenterY = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + if (num478 < num474) + { + if (npc.position.X < num472) + { + npc.velocity.X += 0.05f; + } + else + { + npc.velocity.X -= 0.05f; + } + if (npc.position.Y < num473) + { + npc.velocity.Y += 0.05f; + } + else + { + npc.velocity.Y -= 0.05f; + } + } + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(204, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(204, 255, 255, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.Center.X,(int)projectile.Center.Y, 60, 0.6f); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 60, 0.6f); for (int i = 0; i <= 360; i += 3) { diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 5338a7ac40..0bfe15886d 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -1,17 +1,16 @@ -using System; -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Melee { public class DNA : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("DNA"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("DNA"); + } public override void SetDefaults() { @@ -28,53 +27,53 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - if (Main.myPlayer == projectile.owner) - { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) - { - num48 = mod.ProjectileType("DNA2"); - } - int num49 = projectile.damage; - float num50 = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); - NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + if (Main.myPlayer == projectile.owner) + { + int num48 = projectile.type; + if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + { + num48 = mod.ProjectileType("DNA2"); + } + int num49 = projectile.damage; + float num50 = projectile.knockBack; + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); + NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); } } @@ -82,21 +81,21 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) - { - if (!Main.player[projectile.owner].immune) - { - Main.player[projectile.owner].immune = true; - Main.player[projectile.owner].immuneTime = 5; - } - } - target.immune[projectile.owner] = 5; + if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) + { + if (!Main.player[projectile.owner].immune) + { + Main.player[projectile.owner].immune = true; + Main.player[projectile.owner].immuneTime = 5; + } + } + target.immune[projectile.owner] = 5; } } } diff --git a/Projectiles/Melee/DNA2.cs b/Projectiles/Melee/DNA2.cs index df38cdd764..536d61a9a6 100644 --- a/Projectiles/Melee/DNA2.cs +++ b/Projectiles/Melee/DNA2.cs @@ -1,90 +1,89 @@ -using System; -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Melee { public class DNA2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("DNA"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("DNA"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - aiType = 494; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.melee = true; + aiType = 494; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + } + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) - { - if (!Main.player[projectile.owner].immune) - { - Main.player[projectile.owner].immune = true; - Main.player[projectile.owner].immuneTime = 5; - } - } - target.immune[projectile.owner] = 5; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) + { + if (!Main.player[projectile.owner].immune) + { + Main.player[projectile.owner].immune = true; + Main.player[projectile.owner].immuneTime = 5; + } + } + target.immune[projectile.owner] = 5; + } + } } diff --git a/Projectiles/Melee/Dark.cs b/Projectiles/Melee/Dark.cs index 80a56febfd..fa4e7f3b82 100644 --- a/Projectiles/Melee/Dark.cs +++ b/Projectiles/Melee/Dark.cs @@ -6,52 +6,52 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Dark : ModProjectile - { - private int speedTimer = 120; + { + private int speedTimer = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 300; + } - public override void AI() - { - projectile.rotation += 0.5f; - speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 10f; - projectile.velocity.Y = 0f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = -10f; - projectile.velocity.Y = 0f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } - } + public override void AI() + { + projectile.rotation += 0.5f; + speedTimer--; + if (speedTimer > 60) + { + projectile.velocity.X = 10f; + projectile.velocity.Y = 0f; + } + else if (speedTimer <= 60) + { + projectile.velocity.X = -10f; + projectile.velocity.Y = 0f; + } + if (speedTimer <= 0) + { + speedTimer = 120; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index ca8c54b17c..1abda1e8bf 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -5,127 +5,126 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class DarkBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Ball"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Ball"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.scale = 0.9f; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.melee = true; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.scale = 0.9f; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 200; + projectile.melee = true; + projectile.tileCollide = false; + } - public override void AI() - { - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 8f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - } + public override void AI() + { + try + { + int num223 = (int)(projectile.position.X / 16f) - 1; + int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int num225 = (int)(projectile.position.Y / 16f) - 1; + int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (num223 < 0) + { + num223 = 0; + } + if (num224 > Main.maxTilesX) + { + num224 = Main.maxTilesX; + } + if (num225 < 0) + { + num225 = 0; + } + if (num226 > Main.maxTilesY) + { + num226 = Main.maxTilesY; + } + for (int num227 = num223; num227 < num224; num227++) + { + for (int num228 = num225; num228 < num226; num228++) + { + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + { + Vector2 vector19; + vector19.X = (float)(num227 * 16); + vector19.Y = (float)(num228 * 16); + if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } catch + { + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 128; + projectile.height = 128; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 8f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 22; - projectile.height = 22; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num648 = 0; num648 < 20; num648++) - { - int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1.5f); - Main.dust[num649].velocity *= 1.4f; - } - for (int num650 = 0; num650 < 10; num650++) - { - int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 2.5f); - Main.dust[num651].noGravity = true; - Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1.5f); - Main.dust[num651].velocity *= 3f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 22; + projectile.height = 22; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num648 = 0; num648 < 20; num648++) + { + int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1.5f); + Main.dust[num649].velocity *= 1.4f; + } + for (int num650 = 0; num650 < 10; num650++) + { + int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 2.5f); + Main.dust[num651].noGravity = true; + Main.dust[num651].velocity *= 5f; + num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1.5f); + Main.dust[num651].velocity *= 3f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.Kill(); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.Kill(); + } + } } diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index 7b0c74d39d..aac9dab40e 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class DemonBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,107 +26,107 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default, 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default, 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.ShadowFlame, 300); - projectile.Kill(); + target.AddBuff(BuffID.ShadowFlame, 300); + projectile.Kill(); } } } diff --git a/Projectiles/Melee/DemonBlastType2.cs b/Projectiles/Melee/DemonBlastType2.cs index 8ff8d315f3..e0f6f7c058 100644 --- a/Projectiles/Melee/DemonBlastType2.cs +++ b/Projectiles/Melee/DemonBlastType2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class DemonBlastType2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -25,107 +25,107 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default, 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - projectile.Kill(); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + projectile.Kill(); + } + } } diff --git a/Projectiles/Melee/DemonBlastType3.cs b/Projectiles/Melee/DemonBlastType3.cs index b675aac00f..d39a17a742 100644 --- a/Projectiles/Melee/DemonBlastType3.cs +++ b/Projectiles/Melee/DemonBlastType3.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class DemonBlastType3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -25,107 +25,107 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default, 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default, 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default, 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default, 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - projectile.Kill(); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + projectile.Kill(); + } + } } diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 4608744a63..b58bffbf05 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,81 +9,81 @@ namespace CalamityMod.Projectiles.Melee { public class DepthOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 30; - } + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 30; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 50, 255, projectile.alpha); - } - - public override void Kill(int timeLeft) + public override void AI() { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int dust = 0; dust < 30; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(50, 50, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int dust = 0; dust < 30; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + } + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("CrushDepth"), 300); + target.AddBuff(mod.BuffType("CrushDepth"), 300); } } } diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index e3dfa13e80..e1a6b43ace 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,118 +9,118 @@ namespace CalamityMod.Projectiles.Melee { public class DepthOrb2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.timeLeft > 115) - return false; - - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 50, 255, projectile.alpha); - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int dust = 0; dust <= 30; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.Damage(); - } + if (projectile.timeLeft > 115) + return false; + + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(50, 50, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int dust = 0; dust <= 30; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + } + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.Damage(); + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("CrushDepth"), 300); + target.AddBuff(mod.BuffType("CrushDepth"), 300); } } } diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index fb8ec2151c..2069eacffe 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,65 +8,65 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class DracoBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 14; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 14; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void Kill(int timeLeft) - { - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + float spread = 30f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } } diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index 5face5150f..0af4cf3e8c 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -7,73 +7,73 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class DracoBeam2 : ModProjectile - { - private int start = 60; - private int speedTimer = 120; + { + private int start = 60; + private int speedTimer = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 14; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 14; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 240; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } - public override void AI() - { - start--; - if (start <= 0) - { - speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } - } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - } + public override void AI() + { + start--; + if (start <= 0) + { + speedTimer--; + if (speedTimer > 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 10f; + } + else if (speedTimer <= 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -10f; + } + if (speedTimer <= 0) + { + speedTimer = 120; + } + } + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } } diff --git a/Projectiles/Melee/DragonRage.cs b/Projectiles/Melee/DragonRage.cs index cc6a753070..a0462db905 100644 --- a/Projectiles/Melee/DragonRage.cs +++ b/Projectiles/Melee/DragonRage.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,119 +8,119 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class DragonRage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rage"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rage"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; - } + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.timeLeft = 120; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - if (projectile.localAI[1] <= 60f) - { - projectile.localAI[1] += 1f; - projectile.tileCollide = false; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + if (projectile.localAI[1] <= 60f) + { + projectile.localAI[1] += 1f; + projectile.tileCollide = false; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 100; - projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 6; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 9; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 2; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 100; + projectile.height = 100; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 6; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 9; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 2; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } + } } diff --git a/Projectiles/Melee/Earth.cs b/Projectiles/Melee/Earth.cs index 972328d90b..6d0480df6a 100644 --- a/Projectiles/Melee/Earth.cs +++ b/Projectiles/Melee/Earth.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Melee { public class Earth : ModProjectile { - private int noTileHitCounter = 120; + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } public override void SetDefaults() { @@ -29,117 +29,117 @@ namespace CalamityMod.Projectiles.Melee } public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - int dustChoice = Main.rand.Next(3); - if (dustChoice == 0) - { - dustChoice = 74; - } - else if (dustChoice == 1) - { - dustChoice = 229; - } - else - { - dustChoice = 244; - } - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + int dustChoice = Main.rand.Next(3); + if (dustChoice == 0) + { + dustChoice = 74; + } + else if (dustChoice == 1) + { + dustChoice = 229; + } + else + { + dustChoice = 244; + } + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); } public override void Kill(int timeLeft) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++ ) - { - int projChoice = Main.rand.Next(3); - if (projChoice == 0) - { - projChoice = mod.ProjectileType("Earth2"); - } - else if (projChoice == 1) - { - projChoice = mod.ProjectileType("Earth3"); - } - else - { - projChoice = mod.ProjectileType("Earth4"); - } - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + int projChoice = Main.rand.Next(3); + if (projChoice == 0) + { + projChoice = mod.ProjectileType("Earth2"); + } + else if (projChoice == 1) + { + projChoice = mod.ProjectileType("Earth3"); + } + else + { + projChoice = mod.ProjectileType("Earth4"); + } + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); for (int k = 0; k < 15; k++) { - int dustChoice = Main.rand.Next(3); - if (dustChoice == 0) - { - dustChoice = 74; - } - else if (dustChoice == 1) - { - dustChoice = 229; - } - else - { - dustChoice = 244; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + int dustChoice = Main.rand.Next(3); + if (dustChoice == 0) + { + dustChoice = 74; + } + else if (dustChoice == 1) + { + dustChoice = 229; + } + else + { + dustChoice = 244; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(BuffID.OnFire, 600); target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.CursedInferno, 600); + target.AddBuff(BuffID.CursedInferno, 600); } } } diff --git a/Projectiles/Melee/Earth2.cs b/Projectiles/Melee/Earth2.cs index abf7dc71bd..b5d9da00b6 100644 --- a/Projectiles/Melee/Earth2.cs +++ b/Projectiles/Melee/Earth2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class Earth2 : ModProjectile { - private int noTileHitCounter = 120; + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } public override void SetDefaults() { @@ -28,73 +28,73 @@ namespace CalamityMod.Projectiles.Melee } public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(projectile.Center, 0f, 0f, 1.5f); + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + Lighting.AddLight(projectile.Center, 0f, 0f, 1.5f); } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); for (int k = 0; k < 15; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("GlacialState"), 600); + target.AddBuff(mod.BuffType("GlacialState"), 600); } } } diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index 0231632ae3..59aca37546 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class Earth3 : ModProjectile { - private int noTileHitCounter = 120; + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } public override void SetDefaults() { @@ -28,129 +28,129 @@ namespace CalamityMod.Projectiles.Melee } public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(projectile.Center, 1.5f, 0f, 0f); + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + Lighting.AddLight(projectile.Center, 1.5f, 0f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 30; - projectile.height = 30; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 30; + projectile.height = 30; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 600); + target.AddBuff(mod.BuffType("HolyLight"), 600); } } } diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index 86e46fac19..e76d034dfc 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class Earth4 : ModProjectile { - private int noTileHitCounter = 120; + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } public override void SetDefaults() { @@ -28,85 +28,85 @@ namespace CalamityMod.Projectiles.Melee } public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(projectile.Center, 0f, 1.5f, 0f); + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + Lighting.AddLight(projectile.Center, 0f, 1.5f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); for (int k = 0; k < 15; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 4); - float num = (float)damage * 0.075f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("EarthHealOrb"), 0, 0f, projectile.owner, (float)num2, num); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 4); + float num = (float)damage * 0.075f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("EarthHealOrb"), 0, 0f, projectile.owner, (float)num2, num); } } } diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs index df70aa3b33..86b0068767 100644 --- a/Projectiles/Melee/ElementBall.cs +++ b/Projectiles/Melee/ElementBall.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class ElementBall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -26,50 +26,50 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); } } } diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index 63701e1733..3fb7efd465 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class ElementBallShiv : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shiv"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shiv"); + } public override void SetDefaults() { @@ -21,82 +21,82 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 120; - projectile.aiStyle = 27; - } + projectile.aiStyle = 27; + } public override void AI() { - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 36f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 36f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 4; k++) { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num].noGravity = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - float random = (float)Main.rand.Next(1, 150); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 4; i++) - { - speedX *= dir * random; - speedY *= dir * random; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SHIV"), projectile.damage, 1f, projectile.owner); - } - } - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + float random = (float)Main.rand.Next(1, 150); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 4; i++) + { + speedX *= dir * random; + speedY *= dir * random; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SHIV"), projectile.damage, 1f, projectile.owner); + } + } + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); } } } diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index 03001baa26..5460501eb7 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,454 +9,454 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class ElementalExcaliburBeam : ModProjectile - { - private int alpha = 50; + { + private int alpha = 50; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item60, projectile.position); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item60, projectile.position); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } - Color color = new Color(255, 0, 0, alpha); - switch ((int)projectile.ai[0]) - { - case 0: // Red, normal beam - break; + Color color = new Color(255, 0, 0, alpha); + switch ((int)projectile.ai[0]) + { + case 0: // Red, normal beam + break; - case 1: // Orange, curve back to player - color = new Color(255, 128, 0, alpha); + case 1: // Orange, curve back to player + color = new Color(255, 128, 0, alpha); - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - projectile.Center; - vector17.Normalize(); - vector17 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } + int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector17 = Main.player[num123].Center - projectile.Center; + vector17.Normalize(); + vector17 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } - if (projectile.velocity.Length() < 24f) - { - projectile.velocity *= 1.02f; - } + if (projectile.velocity.Length() < 24f) + { + projectile.velocity *= 1.02f; + } - break; + break; - case 2: // Yellow, split after a certain time - color = new Color(255, 255, 0, alpha); + case 2: // Yellow, split after a certain time + color = new Color(255, 255, 0, alpha); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 90f) - { - projectile.localAI[1] = 0f; - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("ElementalExcaliburBeam"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - projectile.Kill(); - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 90f) + { + projectile.localAI[1] = 0f; + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("ElementalExcaliburBeam"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + projectile.Kill(); + } - break; + break; - case 3: // Lime, home in on player within certain distance - color = new Color(128, 255, 0, alpha); + case 3: // Lime, home in on player within certain distance + color = new Color(128, 255, 0, alpha); - float num953 = 75f; - float scaleFactor12 = 15f; - float num954 = 80f; - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } + float num953 = 75f; + float scaleFactor12 = 15f; + float num954 = 80f; + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } - break; + break; - case 4: // Green, home in on enemies - color = new Color(0, 255, 0, alpha); + case 4: // Green, home in on enemies + color = new Color(0, 255, 0, alpha); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } - break; + break; - case 5: // Turquoise, speed up and don't collide with tiles - color = new Color(0, 255, 128, alpha); + case 5: // Turquoise, speed up and don't collide with tiles + color = new Color(0, 255, 128, alpha); - projectile.tileCollide = false; - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 28f) - { - projectile.velocity *= 1.035f; - } + projectile.tileCollide = false; + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 28f) + { + projectile.velocity *= 1.035f; + } - break; + break; - case 6: // Cyan, upon death create several turquoise swords - color = new Color(0, 255, 255, alpha); - break; + case 6: // Cyan, upon death create several turquoise swords + color = new Color(0, 255, 255, alpha); + break; - case 7: // Light Blue, slow down on hit - color = new Color(0, 128, 255, alpha); - break; + case 7: // Light Blue, slow down on hit + color = new Color(0, 128, 255, alpha); + break; - case 8: // Blue, bounce off of tiles and enemies - color = new Color(0, 0, 255, alpha); - break; + case 8: // Blue, bounce off of tiles and enemies + color = new Color(0, 0, 255, alpha); + break; - case 9: // Purple, speed up and slow down over and over - color = new Color(128, 0, 255, alpha); + case 9: // Purple, speed up and slow down over and over + color = new Color(128, 0, 255, alpha); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] <= 20f) - { - projectile.velocity *= 0.95f; - } - else if (projectile.localAI[1] > 20f && projectile.localAI[1] <= 39f) - { - projectile.velocity *= 1.05f; - } - else if (projectile.localAI[1] == 40f) - { - projectile.localAI[1] = 0f; - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] <= 20f) + { + projectile.velocity *= 0.95f; + } + else if (projectile.localAI[1] > 20f && projectile.localAI[1] <= 39f) + { + projectile.velocity *= 1.05f; + } + else if (projectile.localAI[1] == 40f) + { + projectile.localAI[1] = 0f; + } - break; + break; - case 10: // Fuschia, start slow then get faster - color = new Color(255, 0, 255, alpha); + case 10: // Fuschia, start slow then get faster + color = new Color(255, 0, 255, alpha); - if (projectile.localAI[1] == 0f) - { - projectile.velocity *= 0.1f; - projectile.localAI[1] += 1f; - } - projectile.velocity *= 1.01f; + if (projectile.localAI[1] == 0f) + { + projectile.velocity *= 0.1f; + projectile.localAI[1] += 1f; + } + projectile.velocity *= 1.01f; - break; + break; - case 11: // Hot Pink, split into fuschia while travelling - color = new Color(255, 0, 128, alpha); + case 11: // Hot Pink, split into fuschia while travelling + color = new Color(255, 0, 128, alpha); - if (projectile.localAI[1] == 0f) - { - projectile.velocity *= 0.33f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 91f) - { - projectile.localAI[1] = 1f; - if (Main.myPlayer == projectile.owner) - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ElementalExcaliburBeam"), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 10f, 0f); - } + if (projectile.localAI[1] == 0f) + { + projectile.velocity *= 0.33f; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 91f) + { + projectile.localAI[1] = 1f; + if (Main.myPlayer == projectile.owner) + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ElementalExcaliburBeam"), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 10f, 0f); + } - break; + break; - default: - break; - } + default: + break; + } - if (Main.rand.NextBool(2)) - { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].noGravity = true; - } - } + if (Main.rand.NextBool(2)) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); + Main.dust[dust].noGravity = true; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 60); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - target.AddBuff(mod.BuffType("GlacialState"), 240); - target.AddBuff(mod.BuffType("Plague"), 240); - target.AddBuff(mod.BuffType("HolyLight"), 240); - target.AddBuff(BuffID.CursedInferno, 240); - target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Ichor, 240); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 60); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + target.AddBuff(mod.BuffType("GlacialState"), 240); + target.AddBuff(mod.BuffType("Plague"), 240); + target.AddBuff(mod.BuffType("HolyLight"), 240); + target.AddBuff(BuffID.CursedInferno, 240); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Ichor, 240); - if (projectile.ai[0] == 7f) - { - projectile.velocity *= 0.25f; - } - else if (projectile.ai[0] == 8f) - { - projectile.velocity *= -1f; - } - } + if (projectile.ai[0] == 7f) + { + projectile.velocity *= 0.25f; + } + else if (projectile.ai[0] == 8f) + { + projectile.velocity *= -1f; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.ai[0] == 8f) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } - return true; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.ai[0] == 8f) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - Color color = new Color(255, 0, 0, alpha); - switch ((int)projectile.ai[0]) - { - case 0: // Red - break; - case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; - default: - break; - } - return color; - } + public override Color? GetAlpha(Color lightColor) + { + Color color = new Color(255, 0, 0, alpha); + switch ((int)projectile.ai[0]) + { + case 0: // Red + break; + case 1: // Orange + color = new Color(255, 128, 0, alpha); + break; + case 2: // Yellow + color = new Color(255, 255, 0, alpha); + break; + case 3: // Lime + color = new Color(128, 255, 0, alpha); + break; + case 4: // Green + color = new Color(0, 255, 0, alpha); + break; + case 5: // Turquoise + color = new Color(0, 255, 128, alpha); + break; + case 6: // Cyan + color = new Color(0, 255, 255, alpha); + break; + case 7: // Light Blue + color = new Color(0, 128, 255, alpha); + break; + case 8: // Blue + color = new Color(0, 0, 255, alpha); + break; + case 9: // Purple + color = new Color(128, 0, 255, alpha); + break; + case 10: // Fuschia + color = new Color(255, 0, 255, alpha); + break; + case 11: // Hot Pink + color = new Color(255, 0, 128, alpha); + break; + default: + break; + } + return color; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.timeLeft > 590) - return false; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 590) + return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); - Color color = new Color(255, 0, 0, alpha); - switch ((int)projectile.ai[0]) - { - case 0: // Red - break; - case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, alpha); - break; + Color color = new Color(255, 0, 0, alpha); + switch ((int)projectile.ai[0]) + { + case 0: // Red + break; + case 1: // Orange + color = new Color(255, 128, 0, alpha); + break; + case 2: // Yellow + color = new Color(255, 255, 0, alpha); + break; + case 3: // Lime + color = new Color(128, 255, 0, alpha); + break; + case 4: // Green + color = new Color(0, 255, 0, alpha); + break; + case 5: // Turquoise + color = new Color(0, 255, 128, alpha); + break; - case 6: // Cyan - color = new Color(0, 255, 255, alpha); + case 6: // Cyan + color = new Color(0, 255, 255, alpha); - for (int x = 0; x < 3; x++) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = projectile.Center.X - vector2.X; - float speedY = projectile.Center.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 5 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("ElementalExcaliburBeam"), (int)((double)projectile.damage * 0.2), 2f, projectile.owner, 5f, 0f); - } - } + for (int x = 0; x < 3; x++) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); + float num80 = xPos; + float speedX = projectile.Center.X - vector2.X; + float speedY = projectile.Center.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 5 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("ElementalExcaliburBeam"), (int)((double)projectile.damage * 0.2), 2f, projectile.owner, 5f, 0f); + } + } - break; + break; - case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; - default: - break; - } + case 7: // Light Blue + color = new Color(0, 128, 255, alpha); + break; + case 8: // Blue + color = new Color(0, 0, 255, alpha); + break; + case 9: // Purple + color = new Color(128, 0, 255, alpha); + break; + case 10: // Fuschia + color = new Color(255, 0, 255, alpha); + break; + case 11: // Hot Pink + color = new Color(255, 0, 128, alpha); + break; + default: + break; + } - for (int num193 = 0; num193 < 3; num193++) - { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].noGravity = true; - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + for (int num193 = 0; num193 < 3; num193++) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); + Main.dust[dust].noGravity = true; + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Melee/EonBeam.cs b/Projectiles/Melee/EonBeam.cs index a716cd88bc..67dc39023f 100644 --- a/Projectiles/Melee/EonBeam.cs +++ b/Projectiles/Melee/EonBeam.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class EonBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -23,19 +23,19 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; aiType = 173; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.localNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); if (projectile.localAI[1] > 7f) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); - Main.dust[num308].velocity *= 0.1f; + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + Main.dust[num308].velocity *= 0.1f; Main.dust[num308].noGravity = true; } - } + } public override Color? GetAlpha(Color lightColor) { @@ -60,10 +60,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } } } diff --git a/Projectiles/Melee/EonBeamV2.cs b/Projectiles/Melee/EonBeamV2.cs index e578034431..59c8064aed 100644 --- a/Projectiles/Melee/EonBeamV2.cs +++ b/Projectiles/Melee/EonBeamV2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class EonBeamV2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; aiType = 173; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 5; } public override void AI() @@ -60,10 +60,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } } } diff --git a/Projectiles/Melee/EonBeamV3.cs b/Projectiles/Melee/EonBeamV3.cs index 42ab778d75..7644661980 100644 --- a/Projectiles/Melee/EonBeamV3.cs +++ b/Projectiles/Melee/EonBeamV3.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class EonBeamV3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 200; aiType = 173; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; } public override void AI() @@ -61,10 +61,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } } } diff --git a/Projectiles/Melee/EonBeamV4.cs b/Projectiles/Melee/EonBeamV4.cs index 70e48b6186..9442523f44 100644 --- a/Projectiles/Melee/EonBeamV4.cs +++ b/Projectiles/Melee/EonBeamV4.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class EonBeamV4 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 200; aiType = 173; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 3; } public override void AI() @@ -61,10 +61,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } } } diff --git a/Projectiles/Melee/EradicatorMeleeProjectile.cs b/Projectiles/Melee/EradicatorMeleeProjectile.cs index ec2822a842..e3489b45cc 100644 --- a/Projectiles/Melee/EradicatorMeleeProjectile.cs +++ b/Projectiles/Melee/EradicatorMeleeProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Melee { public class EradicatorMeleeProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -28,81 +28,81 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 180; aiType = 52; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 3; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.NextBool(2)) - { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - } - } - } + Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.NextBool(2)) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/EradicatorMeleeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/EradicatorMeleeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } } diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs index 5ecb336623..9f4c82d115 100644 --- a/Projectiles/Melee/EssenceBeam.cs +++ b/Projectiles/Melee/EssenceBeam.cs @@ -5,45 +5,45 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class EssenceBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 120; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 120; + } - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 3f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - target.immune[projectile.owner] = 2; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + target.immune[projectile.owner] = 2; + } + } } diff --git a/Projectiles/Melee/EssenceFireball.cs b/Projectiles/Melee/EssenceFireball.cs index 208b69f2ee..9b7c3b88ae 100644 --- a/Projectiles/Melee/EssenceFireball.cs +++ b/Projectiles/Melee/EssenceFireball.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,100 +8,100 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class EssenceFireball : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 120; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 120; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (projectile.alpha > 0) + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; - int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 173, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.2f); - Main.dust[dust].noGravity = true; + int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 173, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.2f); + Main.dust[dust].noGravity = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 10; - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage /= 10; + projectile.Damage(); + } + } } diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index 0b60eae718..416fe307a9 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,11 +7,11 @@ namespace CalamityMod.Projectiles.Melee { public class EssenceFlame2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.penetrate = 1; projectile.tileCollide = false; - projectile.melee = true; + projectile.melee = true; projectile.timeLeft = 600; projectile.alpha = 255; projectile.extraUpdates = 3; @@ -28,79 +28,79 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.alpha -= 5; + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 8cf73ce1e5..e8cbf6b6e6 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,110 +8,110 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class EssenceScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 78; - projectile.aiStyle = 18; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.alpha = 55; - projectile.penetrate = 10; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - aiType = 274; - } + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 78; + projectile.aiStyle = 18; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.alpha = 55; + projectile.penetrate = 10; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + aiType = 274; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(50f, 39f); - Color color = Color.White; - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(50f, 39f); + Color color = Color.White; + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/EssenceScytheGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, spriteEffects, 0f); - } + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/EssenceScytheGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, spriteEffects, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(150, 0, 200, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(150, 0, 200, 0); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - if (target.life <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, mod.ProjectileType("EssenceFlame"), 0, 0, projectile.owner, 0f, 0f); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 2; + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + if (target.life <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, mod.ProjectileType("EssenceFlame"), 0, 0, projectile.owner, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Melee/Excelsus.cs b/Projectiles/Melee/Excelsus.cs index 8f038c1e98..5d4606a0fe 100644 --- a/Projectiles/Melee/Excelsus.cs +++ b/Projectiles/Melee/Excelsus.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class Excelsus : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excelsus"); + } public override void SetDefaults() { @@ -20,84 +20,84 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 34; projectile.friendly = true; projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; + projectile.ignoreWater = true; + projectile.penetrate = 3; projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + projectile.alpha = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 20f && projectile.timeLeft > 85) - { - projectile.velocity *= 1.05f; - } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) - { - projectile.velocity *= 0.98f; - } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (Main.rand.NextBool(3) ? 56 : 242), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 20f && projectile.timeLeft > 85) + { + projectile.velocity *= 1.05f; + } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + { + projectile.velocity *= 0.98f; + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (Main.rand.NextBool(3) ? 56 : 242), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.tileCollide = false; + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + return false; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return default(Color); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return default(Color); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = Main.projectileTexture[projectile.type]; spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Color color = default; - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - else - { - color = new Color(255, 255, 255, 100); - } - Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } + Color color = default; + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + else + { + color = new Color(255, 255, 255, 100); + } + Vector2 origin = new Vector2(39f, 46f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } } } diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index 07391c1730..92e77bfcfd 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class ExcelsusBlue : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excelsus"); + } public override void SetDefaults() { @@ -20,83 +20,83 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 34; projectile.friendly = true; projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; + projectile.ignoreWater = true; + projectile.penetrate = 3; projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + projectile.alpha = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft > 85) - { - projectile.velocity *= 1.05f; - } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) - { - projectile.velocity *= 0.98f; - } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft > 85) + { + projectile.velocity *= 1.05f; + } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + { + projectile.velocity *= 0.98f; + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.tileCollide = false; + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + return false; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return default(Color); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return default(Color); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = Main.projectileTexture[projectile.type]; spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Color color = default; - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - else - { - color = new Color(255, 255, 255, 100); - } - Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusBlueGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - target.AddBuff(BuffID.Frostburn, 600); - } + Color color = default; + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + else + { + color = new Color(255, 255, 255, 100); + } + Vector2 origin = new Vector2(39f, 46f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusBlueGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + target.AddBuff(BuffID.Frostburn, 600); + } } } diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index 1001510826..7dc0d2af6c 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class ExcelsusPink : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excelsus"); + } public override void SetDefaults() { @@ -20,83 +20,83 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 34; projectile.friendly = true; projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; + projectile.ignoreWater = true; + projectile.penetrate = 3; projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + projectile.alpha = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f && projectile.timeLeft > 85) - { - projectile.velocity *= 1.05f; - } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) - { - projectile.velocity *= 0.98f; - } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 242, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f && projectile.timeLeft > 85) + { + projectile.velocity *= 1.05f; + } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + { + projectile.velocity *= 0.98f; + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 242, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.tileCollide = false; + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + return false; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return default(Color); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return default(Color); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = Main.projectileTexture[projectile.type]; spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Color color = default; - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - else - { - color = new Color(255, 255, 255, 100); - } - Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusPinkGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - target.AddBuff(BuffID.OnFire, 600); - } + Color color = default; + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + else + { + color = new Color(255, 255, 255, 100); + } + Vector2 origin = new Vector2(39f, 46f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusPinkGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + target.AddBuff(BuffID.OnFire, 600); + } } } diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 2ee17e6f33..66c4d1ea7a 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,181 +8,181 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Exobeam : ModProjectile - { - private int counter = 0; + { + private int counter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 1f; - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 1f; + } - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.localAI[1] += 1f; - } - counter++; - if (counter == 12) - { - counter = 0; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 160, new Color(0, 255, 255), 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - } - else if (projectile.ai[0] == 1f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 2f; - projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; - } - } - else if (projectile.ai[0] == 2f) - { - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - if (vector70.Length() < 30f) - { - projectile.Kill(); - return; - } - vector70.Normalize(); - vector70 *= 14f; - vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); - if (vector70.Y < 24f) - { - vector70.Y = 24f; - } - float num804 = 0.4f; - if (projectile.velocity.X < vector70.X) - { - projectile.velocity.X = projectile.velocity.X + num804; - if (projectile.velocity.X < 0f && vector70.X > 0f) - { - projectile.velocity.X = projectile.velocity.X + num804; - } - } - else if (projectile.velocity.X > vector70.X) - { - projectile.velocity.X = projectile.velocity.X - num804; - if (projectile.velocity.X > 0f && vector70.X < 0f) - { - projectile.velocity.X = projectile.velocity.X - num804; - } - } - if (projectile.velocity.Y < vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - if (projectile.velocity.Y < 0f && vector70.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - } - } - else if (projectile.velocity.Y > vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - if (projectile.velocity.Y > 0f && vector70.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - } - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - } + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.localAI[1] += 1f; + } + counter++; + if (counter == 12) + { + counter = 0; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 160, new Color(0, 255, 255), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + projectile.alpha -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + } + else if (projectile.ai[0] == 1f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 2f; + projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); + projectile.netUpdate = true; + } + } + else if (projectile.ai[0] == 2f) + { + Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + if (vector70.Length() < 30f) + { + projectile.Kill(); + return; + } + vector70.Normalize(); + vector70 *= 14f; + vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); + if (vector70.Y < 24f) + { + vector70.Y = 24f; + } + float num804 = 0.4f; + if (projectile.velocity.X < vector70.X) + { + projectile.velocity.X = projectile.velocity.X + num804; + if (projectile.velocity.X < 0f && vector70.X > 0f) + { + projectile.velocity.X = projectile.velocity.X + num804; + } + } + else if (projectile.velocity.X > vector70.X) + { + projectile.velocity.X = projectile.velocity.X - num804; + if (projectile.velocity.X > 0f && vector70.X < 0f) + { + projectile.velocity.X = projectile.velocity.X - num804; + } + } + if (projectile.velocity.Y < vector70.Y) + { + projectile.velocity.Y = projectile.velocity.Y + num804; + if (projectile.velocity.Y < 0f && vector70.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num804; + } + } + else if (projectile.velocity.Y > vector70.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num804; + if (projectile.velocity.Y > 0f && vector70.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num804; + } + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 255, 255, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 192); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103); - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 192); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103); + for (int num193 = 0; num193 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 4a1dd98336..fd1eb82181 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class Exoboom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -24,86 +24,86 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 30; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } } } diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index a4f60bd5e0..0aa7171e2f 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -8,13 +8,13 @@ namespace CalamityMod.Projectiles.Melee { public class Exocomet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -30,122 +30,122 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - float num953 = 100f * projectile.ai[1]; //100 - float scaleFactor12 = 20f * projectile.ai[1]; //5 - float num954 = 40f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha < 40) - { - int num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num309].velocity *= -0.25f; - num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num309].velocity *= -0.25f; - Main.dust[num309].position -= projectile.velocity * 0.5f; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + float num953 = 100f * projectile.ai[1]; //100 + float scaleFactor12 = 20f * projectile.ai[1]; //5 + float num954 = 40f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha < 40) + { + int num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Main.dust[num309].velocity *= -0.25f; + num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Main.dust[num309].velocity *= -0.25f; + Main.dust[num309].position -= projectile.velocity * 0.5f; + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.01f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("Exoheal"), 0, 0f, projectile.owner, (float)num2, num); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.01f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("Exoheal"), 0, 0f, projectile.owner, (float)num2, num); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - return new Color(0, 255, 255, projectile.alpha); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 255, 255, projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 80); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 80); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } } } } diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index 26d8250242..408950af82 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -1,41 +1,41 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Feather : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.aiStyle = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 150; + projectile.aiStyle = 1; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override void Kill(int timeLeft) - { - int num3; - for (int num611 = 0; num611 < 10; num611 = num3 + 1) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 42, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 1f); - num3 = num611; - } - } - } + public override void Kill(int timeLeft) + { + int num3; + for (int num611 = 0; num611 < 10; num611 = num3 + 1) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 42, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 1f); + num3 = num611; + } + } + } } diff --git a/Projectiles/Melee/FlameScytheProjectileMelee.cs b/Projectiles/Melee/FlameScytheProjectileMelee.cs index 1652ec4856..f7806bdc30 100644 --- a/Projectiles/Melee/FlameScytheProjectileMelee.cs +++ b/Projectiles/Melee/FlameScytheProjectileMelee.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class FlameScytheProjectileMelee : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } public override void SetDefaults() { @@ -29,10 +29,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.15f, 0f); + Lighting.AddLight(projectile.Center, 0.25f, 0.15f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } - } + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceMelee = true; + } + } } } diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index 54b130f876..3e6a42bff3 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -1,105 +1,104 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class Flarefrost : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flarefrost"); - } + public class Flarefrost : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flarefrost"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.melee = true; + } - public override void AI() - { - Vector2 value7 = new Vector2(5f, 10f); - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.25f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) - { - projectile.localAI[0] = 0f; - } - else - { - for (int num41 = 0; num41 < 2; num41++) - { - int dustType = (num41 == 0 ? 67 : 174); - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = (dustType == 67 ? 1.5f : 1f); - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 14f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + Vector2 value7 = new Vector2(5f, 10f); + Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.25f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + int dustType = (num41 == 0 ? 67 : 174); + Vector2 value8 = Vector2.UnitX * -12f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = (dustType == 67 ? 1.5f : 1f); + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 14f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 2; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); + } + } } diff --git a/Projectiles/Melee/FossilSpike.cs b/Projectiles/Melee/FossilSpike.cs index 4596f510af..c3aa195899 100644 --- a/Projectiles/Melee/FossilSpike.cs +++ b/Projectiles/Melee/FossilSpike.cs @@ -5,11 +5,11 @@ namespace CalamityMod.Projectiles.Melee { public class FossilSpike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -24,20 +24,20 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } } } } diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index 77e4ec9a5c..abb70c0210 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -8,14 +8,14 @@ namespace CalamityMod.Projectiles.Melee { public class GalacticaComet : ModProjectile { - private int noTileHitCounter = 120; + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -31,21 +31,21 @@ namespace CalamityMod.Projectiles.Melee } public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } projectile.localAI[0] += 1f; if (projectile.localAI[0] == 18f) { @@ -64,57 +64,57 @@ namespace CalamityMod.Projectiles.Melee } } projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 164, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.5f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 164, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.5f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(Main.DiscoR, 100, 255, projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); projectile.position = projectile.Center; projectile.width = (projectile.height = 144); projectile.position.X = projectile.position.X - (float)(projectile.width / 2); @@ -132,17 +132,17 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn, 300); } } } diff --git a/Projectiles/Melee/Galaxia.cs b/Projectiles/Melee/Galaxia.cs index 88db2df466..ed17c831fd 100644 --- a/Projectiles/Melee/Galaxia.cs +++ b/Projectiles/Melee/Galaxia.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,257 +8,257 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Galaxia : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 50; - projectile.penetrate = 3; - projectile.timeLeft = 240; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 50; + projectile.penetrate = 3; + projectile.timeLeft = 240; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } - public override void AI() - { - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.rand.NextBool(8)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(24)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(5)) - { - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - } - if (Main.rand.NextBool(10)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.rand.NextBool(8)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(24)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(5)) + { + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + } + if (Main.rand.NextBool(10)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 35f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 1200); - player.AddBuff(BuffID.Thorns, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 1200); - player.AddBuff(BuffID.Warmth, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 1200); - player.AddBuff(BuffID.Wet, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 1200); - player.AddBuff(BuffID.Dangersense, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Endurance, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 1200); - player.AddBuff(BuffID.Spelunker, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); - player.AddBuff(BuffID.Inferno, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Heartreach, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 1200); - player.AddBuff(BuffID.DryadsWard, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 1200); + player.AddBuff(BuffID.Thorns, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 1200); + player.AddBuff(BuffID.Warmth, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 1200); + player.AddBuff(BuffID.Wet, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 1200); + player.AddBuff(BuffID.Dangersense, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Endurance, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 1200); + player.AddBuff(BuffID.Spelunker, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); + player.AddBuff(BuffID.Inferno, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Heartreach, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 1200); + player.AddBuff(BuffID.DryadsWard, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + } + } } diff --git a/Projectiles/Melee/Galaxia2.cs b/Projectiles/Melee/Galaxia2.cs index c0400e9a67..24b115772a 100644 --- a/Projectiles/Melee/Galaxia2.cs +++ b/Projectiles/Melee/Galaxia2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,256 +8,256 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Galaxia2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 50; - projectile.penetrate = 2; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 50; + projectile.penetrate = 2; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } - public override void AI() - { - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.rand.NextBool(8)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].noGravity = true; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(24)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(5)) - { - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - } - if (Main.rand.NextBool(10)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.rand.NextBool(8)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].noGravity = true; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(24)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(5)) + { + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + } + if (Main.rand.NextBool(10)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 35f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 1200); - player.AddBuff(BuffID.Thorns, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 1200); - player.AddBuff(BuffID.Warmth, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 1200); - player.AddBuff(BuffID.Wet, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 1200); - player.AddBuff(BuffID.Dangersense, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Endurance, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 1200); - player.AddBuff(BuffID.Spelunker, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); - player.AddBuff(BuffID.Inferno, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Heartreach, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 1200); - player.AddBuff(BuffID.DryadsWard, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 1200); + player.AddBuff(BuffID.Thorns, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 1200); + player.AddBuff(BuffID.Warmth, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 1200); + player.AddBuff(BuffID.Wet, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 1200); + player.AddBuff(BuffID.Dangersense, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Endurance, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 1200); + player.AddBuff(BuffID.Spelunker, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); + player.AddBuff(BuffID.Inferno, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Heartreach, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 1200); + player.AddBuff(BuffID.DryadsWard, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + } + } } diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index f1310900b9..84dc2cd44e 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class GalaxyBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,107 +26,107 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 600); - projectile.Kill(); + target.AddBuff(BuffID.OnFire, 600); + projectile.Kill(); } } } diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index 2bc5a0f31d..b510adb086 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class GalaxyBlastType2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,107 +26,107 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 600); - projectile.Kill(); + target.AddBuff(BuffID.Frostburn, 600); + projectile.Kill(); } } } diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index 8df3191ccf..01c2ca821d 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class GalaxyBlastType3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,107 +26,107 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, 600); - projectile.Kill(); + target.AddBuff(BuffID.Ichor, 600); + projectile.Kill(); } } } diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index 9aa9d3d590..a2da052a6c 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class GelWave : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wave"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wave"); + } public override void SetDefaults() { @@ -25,49 +25,49 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 2; projectile.alpha = 120; projectile.timeLeft = 200; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void AI() { - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - projectile.localAI[0] += 1f; - } - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.4f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + projectile.localAI[0] += 1f; + } + Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.4f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.velocity.Y += projectile.ai[0]; if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Slimed, 300); - projectile.velocity *= 0.5f; + target.AddBuff(BuffID.Slimed, 300); + projectile.velocity *= 0.5f; } } } diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 312e6439ff..ba22897a85 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +9,13 @@ namespace CalamityMod.Projectiles.Melee { public class GhastlySoulLarge : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Soul"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -33,38 +33,38 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; Main.dust[num822].scale = 1.3f; Main.dust[num822].noGravity = true; float num953 = 30f * projectile.ai[1]; //100 - float scaleFactor12 = 6f * projectile.ai[1]; //5 - float num954 = 900f; + float scaleFactor12 = 6f * projectile.ai[1]; //5 + float num954 = 900f; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 600f; @@ -99,22 +99,22 @@ namespace CalamityMod.Projectiles.Melee projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; } } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { @@ -127,21 +127,21 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("CrushDepth"), 600); + target.AddBuff(mod.BuffType("CrushDepth"), 600); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 112); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 112); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 39, 1f, 0f); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 0676221130..656f579d61 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +9,13 @@ namespace CalamityMod.Projectiles.Melee { public class GhastlySoulMedium : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Soul"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -108,13 +108,13 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { @@ -132,16 +132,16 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 39, 1f, 0f); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index cfded2d9e3..c33cff5bde 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +9,13 @@ namespace CalamityMod.Projectiles.Melee { public class GhastlySoulSmall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Soul"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -107,13 +107,13 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { @@ -131,16 +131,16 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 39, 1f, 0f); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Melee/GreenBall.cs b/Projectiles/Melee/GreenBall.cs index bc9fa4d5dd..4cd7f6d474 100644 --- a/Projectiles/Melee/GreenBall.cs +++ b/Projectiles/Melee/GreenBall.cs @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class GreenBall : ModProjectile { - private int projTime = 15; + private int projTime = 15; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -27,26 +27,26 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - projTime--; - if (projTime == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("GreenDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - projTime = 15; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + projTime--; + if (projTime == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("GreenDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + projTime = 15; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.CursedInferno, 300); } } } diff --git a/Projectiles/Melee/GreenDust.cs b/Projectiles/Melee/GreenDust.cs index 147319c0c5..adf9025b08 100644 --- a/Projectiles/Melee/GreenDust.cs +++ b/Projectiles/Melee/GreenDust.cs @@ -1,79 +1,79 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class GreenDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 3600; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.timeLeft = 3600; + } - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) - { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; - } - else - { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; - } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.timeLeft > 85) - projectile.timeLeft = 85; - if (projectile.alpha < 255) - { - projectile.alpha += 2; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.02f; + if (projectile.velocity.X < 0f) + { + projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + } + else + { + projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.timeLeft > 85) + projectile.timeLeft = 85; + if (projectile.alpha < 255) + { + projectile.alpha += 2; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + } } diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index a9b1f2546b..f25e32cfad 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class GreenWater : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } public override void SetDefaults() { @@ -26,51 +26,51 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.localAI[0] += 1f; - } - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.localAI[0] += 1f; + } + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int lol = 0; lol < 5; lol++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); - } + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int lol = 0; lol < 5; lol++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } } } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 099d06aade..fb089cd5d5 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,85 +8,85 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class HellionSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - aiType = 228; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + aiType = 228; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Venom, 300); - if (crit) - { - float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Venom, 300); + if (crit) + { + float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); + } + } + } + } } diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index d44f31caac..ecafd3038d 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Melee { public class HolyColliderHolyFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -29,15 +29,15 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } if (Math.Abs(projectile.velocity.X) < 7f) { projectile.velocity.X *= 1.05f; @@ -63,37 +63,37 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + } } } } diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs index 160c81012d..53dfc473fb 100644 --- a/Projectiles/Melee/HyperBlade.cs +++ b/Projectiles/Melee/HyperBlade.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,90 +8,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class HyperBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0f); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 120); - target.AddBuff(BuffID.CursedInferno, 240); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.CursedInferno, 240); + } + } } diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index c507d5fabc..bcb7debd28 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class IceBombFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } public override void SetDefaults() { @@ -24,42 +24,42 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 2; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile1].Calamity().forceMelee = true; - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].Calamity().forceMelee = true; - } - } - for (int k = 0; k < 3; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + float spread = 90f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 349, 30, 2f, projectile.owner, 0f, 0f); + Main.projectile[projectile1].Calamity().forceMelee = true; + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 349, 30, 2f, projectile.owner, 0f, 0f); + Main.projectile[projectile2].Calamity().forceMelee = true; + } + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("GlacialState"), 60); + target.AddBuff(mod.BuffType("GlacialState"), 60); } } } diff --git a/Projectiles/Melee/Iceberg.cs b/Projectiles/Melee/Iceberg.cs index a4243593ed..0d46c0e1ef 100644 --- a/Projectiles/Melee/Iceberg.cs +++ b/Projectiles/Melee/Iceberg.cs @@ -7,61 +7,61 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Iceberg : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Iceberg"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Iceberg"); + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void AI() - { - projectile.rotation += 0.5f; - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0f; - } + public override void AI() + { + projectile.rotation += 0.5f; + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - double newDamageMult = 1.0 - ((double)projectile.timeLeft / 300.0); - damage = (int)((double)damage * newDamageMult); - knockback = 0f; - if (crit || target.buffImmune[mod.BuffType("GlacialState")]) - damage *= 2; - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + double newDamageMult = 1.0 - ((double)projectile.timeLeft / 300.0); + damage = (int)((double)damage * newDamageMult); + knockback = 0f; + if (crit || target.buffImmune[mod.BuffType("GlacialState")]) + damage *= 2; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - int debuffDuration = 300 - projectile.timeLeft; - if (projectile.timeLeft < 270) - target.AddBuff(mod.BuffType("GlacialState"), debuffDuration); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int debuffDuration = 300 - projectile.timeLeft; + if (projectile.timeLeft < 270) + target.AddBuff(mod.BuffType("GlacialState"), debuffDuration); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/Icebreaker.cs b/Projectiles/Melee/Icebreaker.cs index 8737033f0a..efea0b63ca 100644 --- a/Projectiles/Melee/Icebreaker.cs +++ b/Projectiles/Melee/Icebreaker.cs @@ -8,18 +8,18 @@ namespace CalamityMod.Projectiles.Melee { public class Icebreaker : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icebreaker"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icebreaker"); + } public override void SetDefaults() { projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 120; aiType = 52; @@ -27,9 +27,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + } + } } diff --git a/Projectiles/Melee/Judgement.cs b/Projectiles/Melee/Judgement.cs index 9c3f4e5745..0723dc5eb9 100644 --- a/Projectiles/Melee/Judgement.cs +++ b/Projectiles/Melee/Judgement.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class Judgement : ModProjectile { - int whiteLightTimer = 5; + int whiteLightTimer = 5; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Judgement"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Judgement"); + } public override void SetDefaults() { @@ -27,79 +27,79 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - whiteLightTimer--; - if (whiteLightTimer == 0) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 1; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].velocity.X *= 0.1f; - Main.projectile[projectile1].velocity.Y *= 0.1f; - Main.projectile[projectile2].velocity.X *= 0.1f; - Main.projectile[projectile2].velocity.Y *= 0.1f; - } - } - whiteLightTimer = 5; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 9f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + whiteLightTimer--; + if (whiteLightTimer == 0) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 1; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].velocity.X *= 0.1f; + Main.projectile[projectile1].velocity.Y *= 0.1f; + Main.projectile[projectile2].velocity.X *= 0.1f; + Main.projectile[projectile2].velocity.Y *= 0.1f; + } + } + whiteLightTimer = 5; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 9f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAura"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAura"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Melee/JudgementBlah.cs b/Projectiles/Melee/JudgementBlah.cs index 2e7bf71bc7..ae313f1596 100644 --- a/Projectiles/Melee/JudgementBlah.cs +++ b/Projectiles/Melee/JudgementBlah.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class JudgementBlah : ModProjectile { - private int whiteLightTimer = 5; + private int whiteLightTimer = 5; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Judgement"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Judgement"); + } public override void SetDefaults() { @@ -28,79 +28,79 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - whiteLightTimer--; - if (whiteLightTimer == 0) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 1; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 6f ), (float)( Math.Cos(offsetAngle) * 6f ), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 6f ), (float)( -Math.Cos(offsetAngle) * 6f ), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].velocity.X *= 0.1f; - Main.projectile[projectile1].velocity.Y *= 0.1f; - Main.projectile[projectile2].velocity.X *= 0.1f; - Main.projectile[projectile2].velocity.Y *= 0.1f; - } - } - whiteLightTimer = 5; - } - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + whiteLightTimer--; + if (whiteLightTimer == 0) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 1; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 6f), (float)(Math.Cos(offsetAngle) * 6f), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 6f), (float)(-Math.Cos(offsetAngle) * 6f), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].velocity.X *= 0.1f; + Main.projectile[projectile1].velocity.Y *= 0.1f; + Main.projectile[projectile2].velocity.X *= 0.1f; + Main.projectile[projectile2].velocity.Y *= 0.1f; + } + } + whiteLightTimer = 5; + } + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAuraBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAuraBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index f520cea869..738ff41b5d 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Melee { public class LaserFountain : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fountain"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fountain"); + } public override void SetDefaults() { @@ -24,19 +24,19 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.localAI[0] += 1f; - float SpeedX = (float)Main.rand.Next(-15, 15); - float SpeedY = (float)Main.rand.Next(-20, -10); - if (projectile.localAI[0] >= 12f) - { - if (projectile.owner == Main.myPlayer) - { - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), (int)(350f * Main.player[projectile.owner].meleeDamage), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].Calamity().forceMelee = true; - Main.projectile[projectile1].aiStyle = 1; - } - projectile.localAI[0] = 0f; - } + projectile.localAI[0] += 1f; + float SpeedX = (float)Main.rand.Next(-15, 15); + float SpeedY = (float)Main.rand.Next(-20, -10); + if (projectile.localAI[0] >= 12f) + { + if (projectile.owner == Main.myPlayer) + { + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), (int)(350f * Main.player[projectile.owner].meleeDamage), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].Calamity().forceMelee = true; + Main.projectile[projectile1].aiStyle = 1; + } + projectile.localAI[0] = 0f; + } } } } diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index 4491bf35c6..73eb448fc2 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class Leech : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leech"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leech"); + } public override void SetDefaults() { @@ -19,70 +19,70 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.penetrate = 2; projectile.timeLeft = 180; - projectile.melee = true; - } + projectile.melee = true; + } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 6f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 6f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } + Player player = Main.player[projectile.owner]; + player.statLife += 5; + player.HealEffect(5); + } } } diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index c0e361bcd5..4cf752a6ec 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -7,59 +7,59 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class LifeScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 70; - projectile.aiStyle = 18; - projectile.alpha = 55; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 240; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 70; + projectile.aiStyle = 18; + projectile.alpha = 55; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 240; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - Lighting.AddLight(projectile.Center, 0.1f, 0.5f, 0.15f); - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + Lighting.AddLight(projectile.Center, 0.1f, 0.5f, 0.15f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/Light.cs b/Projectiles/Melee/Light.cs index fef65f8a6f..cfd9396c72 100644 --- a/Projectiles/Melee/Light.cs +++ b/Projectiles/Melee/Light.cs @@ -6,53 +6,53 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Light : ModProjectile - { - private int speedTimer = 120; + { + private int speedTimer = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 300; + } - public override void AI() - { - projectile.rotation += 0.5f; - speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } - } + public override void AI() + { + projectile.rotation += 0.5f; + speedTimer--; + if (speedTimer > 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 10f; + } + else if (speedTimer <= 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -10f; + } + if (speedTimer <= 0) + { + speedTimer = 120; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/MangroveChakramProjectileMelee.cs b/Projectiles/Melee/MangroveChakramProjectileMelee.cs index f7beb5d205..86a9bf073b 100644 --- a/Projectiles/Melee/MangroveChakramProjectileMelee.cs +++ b/Projectiles/Melee/MangroveChakramProjectileMelee.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class MangroveChakramProjectileMelee : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chakram"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chakram"); + } public override void SetDefaults() { @@ -27,10 +27,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.CursedInferno, 240); + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.CursedInferno, 240); } } } diff --git a/Projectiles/Melee/MarianaProjectile.cs b/Projectiles/Melee/MarianaProjectile.cs index 1424b1dc82..2d729bb3ad 100644 --- a/Projectiles/Melee/MarianaProjectile.cs +++ b/Projectiles/Melee/MarianaProjectile.cs @@ -6,62 +6,62 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class MarianaProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mariana"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mariana"); + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 120; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.8f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.8f); + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + } } diff --git a/Projectiles/Melee/MarniteObliterator.cs b/Projectiles/Melee/MarniteObliterator.cs index 79293dee60..a28b52c23d 100644 --- a/Projectiles/Melee/MarniteObliterator.cs +++ b/Projectiles/Melee/MarniteObliterator.cs @@ -3,23 +3,23 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class MarniteObliterator : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Obliterator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Obliterator"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.hide = true; - projectile.ownerHitCheck = true; - projectile.melee = true; - } - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 20; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.hide = true; + projectile.ownerHitCheck = true; + projectile.melee = true; + } + } } diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 838e0ecf82..1f3d2c4368 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -1,61 +1,61 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class MirrorBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public class MirrorBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } - public override void AI() - { - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - projectile.Center; - vector17.Normalize(); - vector17 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } + public override void AI() + { + int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector17 = Main.player[num123].Center - projectile.Center; + vector17.Normalize(); + vector17 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, 0.35f, 0.35f); - } + Lighting.AddLight(projectile.Center, 0f, 0.35f, 0.35f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/Mourningstar.cs b/Projectiles/Melee/Mourningstar.cs index 20ee67ea35..f887e75781 100644 --- a/Projectiles/Melee/Mourningstar.cs +++ b/Projectiles/Melee/Mourningstar.cs @@ -1,19 +1,19 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Enums; namespace CalamityMod.Projectiles.Melee { public class Mourningstar : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mourningstar"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mourningstar"); + } public override void SetDefaults() { @@ -28,190 +28,190 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.Calamity().trueMelee = true; - } + projectile.Calamity().trueMelee = true; + } public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = projectile.velocity.ToRotation(); - } - float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); - if (projectile.ai[1] <= 0f) - { - num32 *= -1f; - } - Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); - vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); - if (projectile.ai[1] <= 0f) - { - vector17.Y *= -1f; - } - vector17 = vector17.RotatedBy((double)projectile.localAI[0], default); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 30f) - { - projectile.velocity += 48f * vector17; - } - else - { - projectile.Kill(); - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; - if (player.direction != 1) - { - vector24.X = (float)player.bodyFrame.Width - vector24.X; - } - if (player.gravDir != 1f) - { - vector24.Y = (float)player.bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; - projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; - if (projectile.alpha == 0) - { - for (int num51 = 0; num51 < 2; num51++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, 200, 0), 2f)]; - dust.noGravity = true; - dust.velocity *= 2f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); - dust.fadeIn = 1.5f; - } - float num52 = 18f; - int num53 = 0; - while ((float)num53 < num52) - { - if (Main.rand.NextBool(4)) - { - Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); - Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; - dust2.noGravity = true; - dust2.fadeIn = 0.5f; - dust2.velocity += projectile.localAI[0].ToRotationVector2(); - dust2.noLight = true; - } - num53++; - } - } + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = projectile.velocity.ToRotation(); + } + float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); + if (projectile.ai[1] <= 0f) + { + num32 *= -1f; + } + Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); + vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); + if (projectile.ai[1] <= 0f) + { + vector17.Y *= -1f; + } + vector17 = vector17.RotatedBy((double)projectile.localAI[0], default); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 30f) + { + projectile.velocity += 48f * vector17; + } + else + { + projectile.Kill(); + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = (float)player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; + if (projectile.alpha == 0) + { + for (int num51 = 0; num51 < 2; num51++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, 200, 0), 2f)]; + dust.noGravity = true; + dust.velocity *= 2f; + dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.fadeIn = 1.5f; + } + float num52 = 18f; + int num53 = 0; + while ((float)num53 < num52) + { + if (Main.rand.NextBool(4)) + { + Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); + Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + dust2.velocity += projectile.localAI[0].ToRotationVector2(); + dust2.noLight = true; + } + num53++; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D22 = Main.projectileTexture[projectile.type]; - if (projectile.velocity == Vector2.Zero) - { - return false; - } - float num230 = projectile.velocity.Length() + 16f; - bool flag24 = num230 < 100f; - Vector2 value28 = Vector2.Normalize(projectile.velocity); - Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 - Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); - float rotation24 = projectile.rotation + 3.14159274f; - Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); - num230 -= 40f * projectile.scale; - Vector2 vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 - if (num230 > 0f) - { - float num231 = 0f; - while (num231 + 1f < num230) - { - if (num230 - num231 < (float)rectangle8.Height) - { - rectangle8.Height = (int)(num230 - num231); - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num231 += (float)rectangle8.Height * projectile.scale; - vector31 += value28 * (float)rectangle8.Height * projectile.scale; - } - } - Vector2 value30 = vector31; - vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 - int num232 = 18; - if (flag24) - { - num232 = 9; - } - float num233 = num230; - if (num230 > 0f) - { - float num234 = 0f; - float num235 = num233 / (float)num232; - num234 += num235 * 0.25f; - vector31 += value28 * num235 * 0.25f; - for (int num236 = 0; num236 < num232; num236++) - { - float num237 = num235; - if (num236 == 0) - { - num237 *= 0.75f; - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num234 += num237; - vector31 += value28 * num237; - } - } - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 - Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } + { + Texture2D texture2D22 = Main.projectileTexture[projectile.type]; + if (projectile.velocity == Vector2.Zero) + { + return false; + } + float num230 = projectile.velocity.Length() + 16f; + bool flag24 = num230 < 100f; + Vector2 value28 = Vector2.Normalize(projectile.velocity); + Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 + Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); + float rotation24 = projectile.rotation + 3.14159274f; + Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); + num230 -= 40f * projectile.scale; + Vector2 vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 + if (num230 > 0f) + { + float num231 = 0f; + while (num231 + 1f < num230) + { + if (num230 - num231 < (float)rectangle8.Height) + { + rectangle8.Height = (int)(num230 - num231); + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num231 += (float)rectangle8.Height * projectile.scale; + vector31 += value28 * (float)rectangle8.Height * projectile.scale; + } + } + Vector2 value30 = vector31; + vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 + int num232 = 18; + if (flag24) + { + num232 = 9; + } + float num233 = num230; + if (num230 > 0f) + { + float num234 = 0f; + float num235 = num233 / (float)num232; + num234 += num235 * 0.25f; + vector31 += value28 * num235 * 0.25f; + for (int num236 = 0; num236 < num232; num236++) + { + float num237 = num235; + if (num236 == 0) + { + num237 *= 0.75f; + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num234 += num237; + vector31 += value28 * num237; + } + } + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 + Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), lightColor, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) - { - return true; - } - return false; + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num8 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + { + return true; + } + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Daybreak, 300); - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - projectile.localAI[1] = 4f; + target.AddBuff(BuffID.Daybreak, 300); + if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + projectile.localAI[1] = 4f; } } } diff --git a/Projectiles/Melee/Murasama.cs b/Projectiles/Melee/Murasama.cs index 744c0f682d..90c2af035b 100644 --- a/Projectiles/Melee/Murasama.cs +++ b/Projectiles/Melee/Murasama.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Melee { public class Murasama : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Murasama"); - Main.projFrames[projectile.type] = 28; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murasama"); + Main.projFrames[projectile.type] = 28; + } public override void SetDefaults() { @@ -24,78 +24,78 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; - projectile.Calamity().trueMelee = true; - } + projectile.localNPCHitCooldown = 0; + projectile.Calamity().trueMelee = true; + } public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - if (++projectile.frame >= Main.projFrames[projectile.type]) - { - projectile.frame = 0; - } - projectile.soundDelay--; - if (projectile.soundDelay <= 0) - { - Main.PlaySound(SoundID.Item15, projectile.Center); - projectile.soundDelay = 24; - } - if (Main.myPlayer == projectile.owner) - { - if (player.channel && !player.noItems && !player.CCed) - { - float scaleFactor6 = 1f; - if (player.inventory[player.selectedItem].shoot == projectile.type) - { - scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - } - Vector2 vector13 = Main.MouseWorld - vector; - vector13.Normalize(); - if (vector13.HasNaNs()) - { - vector13 = Vector2.UnitX * (float)player.direction; - } - vector13 *= scaleFactor6; - if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector13; - } - else - { - projectile.Kill(); - } - } - Vector2 vector14 = projectile.Center + projectile.velocity * 3f; - Lighting.AddLight(vector14, 3f, 0.2f, 0.2f); - if (Main.rand.NextBool(3)) - { - int num30 = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default, 2f); - Main.dust[num30].noGravity = true; - Main.dust[num30].position -= projectile.velocity; - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + if (++projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + projectile.soundDelay--; + if (projectile.soundDelay <= 0) + { + Main.PlaySound(SoundID.Item15, projectile.Center); + projectile.soundDelay = 24; + } + if (Main.myPlayer == projectile.owner) + { + if (player.channel && !player.noItems && !player.CCed) + { + float scaleFactor6 = 1f; + if (player.inventory[player.selectedItem].shoot == projectile.type) + { + scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + } + Vector2 vector13 = Main.MouseWorld - vector; + vector13.Normalize(); + if (vector13.HasNaNs()) + { + vector13 = Vector2.UnitX * (float)player.direction; + } + vector13 *= scaleFactor6; + if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector13; + } + else + { + projectile.Kill(); + } + } + Vector2 vector14 = projectile.Center + projectile.velocity * 3f; + Lighting.AddLight(vector14, 3f, 0.2f, 0.2f); + if (Main.rand.NextBool(3)) + { + int num30 = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default, 2f); + Main.dust[num30].noGravity = true; + Main.dust[num30].position -= projectile.velocity; + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 0, 0, 0); + return new Color(200, 0, 0, 0); } } } diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index 91f4ea4442..46771ab6e1 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class Nebudust : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -28,67 +28,67 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 60f) - { - num461 -= (projectile.ai[0] - 60f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 60f) + { + num461 -= (projectile.ai[0] - 60f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; if (projectile.ai[0] == 0f) { Main.PlaySound(SoundID.Item105, projectile.position); } projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-6, 7); - float num464 = (float)Main.rand.Next(-6, 7); - float num465 = (float)Main.rand.Next(2, 5); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 269, 0f, 0f, 100, default, 1f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-6, 7); + float num464 = (float)Main.rand.Next(-6, 7); + float num465 = (float)Main.rand.Next(2, 5); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 269, 0f, 0f, 100, default, 1f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Melee/Nebulash.cs b/Projectiles/Melee/Nebulash.cs index 09b5bb52b1..3a4a3b98ca 100644 --- a/Projectiles/Melee/Nebulash.cs +++ b/Projectiles/Melee/Nebulash.cs @@ -1,19 +1,19 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Enums; namespace CalamityMod.Projectiles.Melee { public class Nebulash : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nebulash"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebulash"); + } public override void SetDefaults() { @@ -28,199 +28,199 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 2; - projectile.Calamity().trueMelee = true; - } + projectile.Calamity().trueMelee = true; + } public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = projectile.velocity.ToRotation(); - } - float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); - if (projectile.ai[1] <= 0f) - { - num32 *= -1f; - } - Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); - vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); - if (projectile.ai[1] <= 0f) - { - vector17.Y *= -1f; - } - vector17 = vector17.RotatedBy((double)projectile.localAI[0], default); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 30f) - { - projectile.velocity += 48f * vector17; - } - else - { - projectile.Kill(); - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; - if (player.direction != 1) - { - vector24.X = (float)player.bodyFrame.Width - vector24.X; - } - if (player.gravDir != 1f) - { - vector24.Y = (float)player.bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; - projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; - if (projectile.alpha == 0) - { - for (int num51 = 0; num51 < 2; num51++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, new Color(255, 200, 0), 2f)]; - dust.noGravity = true; - dust.velocity *= 2f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); - dust.fadeIn = 1.5f; - } - float num52 = 18f; - int num53 = 0; - while ((float)num53 < num52) - { - if (Main.rand.NextBool(4)) - { - Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); - Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 173, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; - dust2.noGravity = true; - dust2.fadeIn = 0.5f; - dust2.velocity += projectile.localAI[0].ToRotationVector2(); - dust2.noLight = true; - } - num53++; - } - } + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = projectile.velocity.ToRotation(); + } + float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); + if (projectile.ai[1] <= 0f) + { + num32 *= -1f; + } + Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); + vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); + if (projectile.ai[1] <= 0f) + { + vector17.Y *= -1f; + } + vector17 = vector17.RotatedBy((double)projectile.localAI[0], default); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 30f) + { + projectile.velocity += 48f * vector17; + } + else + { + projectile.Kill(); + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = (float)player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; + if (projectile.alpha == 0) + { + for (int num51 = 0; num51 < 2; num51++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, new Color(255, 200, 0), 2f)]; + dust.noGravity = true; + dust.velocity *= 2f; + dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.fadeIn = 1.5f; + } + float num52 = 18f; + int num53 = 0; + while ((float)num53 < num52) + { + if (Main.rand.NextBool(4)) + { + Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); + Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 173, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + dust2.velocity += projectile.localAI[0].ToRotationVector2(); + dust2.noLight = true; + } + num53++; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - Vector2 projPos = projectile.position; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it - Texture2D texture2D22 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); - if (projectile.velocity == Vector2.Zero) - { - return false; - } - float num230 = projectile.velocity.Length() + 16f; - bool flag24 = num230 < 100f; - Vector2 value28 = Vector2.Normalize(projectile.velocity); - Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 54); //2 and 40 - Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); - float rotation24 = projectile.rotation + 3.14159274f; - Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); - num230 -= 40f * projectile.scale; - Vector2 vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 18); //68 and 18 - if (num230 > 0f) - { - float num231 = 0f; - while (num231 + 1f < num230) - { - if (num230 - num231 < (float)rectangle8.Height) - { - rectangle8.Height = (int)(num230 - num231); - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num231 += (float)rectangle8.Height * projectile.scale; - vector31 += value28 * (float)rectangle8.Height * projectile.scale; - } - } - Vector2 value30 = vector31; - vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 20); //46 and 18 - int num232 = 18; - if (flag24) - { - num232 = 9; - } - float num233 = num230; - if (num230 > 0f) - { - float num234 = 0f; - float num235 = num233 / (float)num232; - num234 += num235 * 0.25f; - vector31 += value28 * num235 * 0.25f; - for (int num236 = 0; num236 < num232; num236++) - { - float num237 = num235; - if (num236 == 0) - { - num237 *= 0.75f; - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num234 += num237; - vector31 += value28 * num237; - } - } - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 104, texture2D22.Width, 50); //90 and 48 - Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 projPos = projectile.position; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it + Texture2D texture2D22 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); + if (projectile.velocity == Vector2.Zero) + { + return false; + } + float num230 = projectile.velocity.Length() + 16f; + bool flag24 = num230 < 100f; + Vector2 value28 = Vector2.Normalize(projectile.velocity); + Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 54); //2 and 40 + Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); + float rotation24 = projectile.rotation + 3.14159274f; + Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); + num230 -= 40f * projectile.scale; + Vector2 vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 18); //68 and 18 + if (num230 > 0f) + { + float num231 = 0f; + while (num231 + 1f < num230) + { + if (num230 - num231 < (float)rectangle8.Height) + { + rectangle8.Height = (int)(num230 - num231); + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num231 += (float)rectangle8.Height * projectile.scale; + vector31 += value28 * (float)rectangle8.Height * projectile.scale; + } + } + Vector2 value30 = vector31; + vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 20); //46 and 18 + int num232 = 18; + if (flag24) + { + num232 = 9; + } + float num233 = num230; + if (num230 > 0f) + { + float num234 = 0f; + float num235 = num233 / (float)num232; + num234 += num235 * 0.25f; + vector31 += value28 * num235 * 0.25f; + for (int num236 = 0; num236 < num232; num236++) + { + float num237 = num235; + if (num236 == 0) + { + num237 *= 0.75f; + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num234 += num237; + vector31 += value28 * num237; + } + } + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 104, texture2D22.Width, 50); //90 and 48 + Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) - { - return true; - } - return false; + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num8 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + { + return true; + } + return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Nebudust"), damage, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - projectile.localAI[1] = 4f; + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Nebudust"), damage, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + projectile.localAI[1] = 4f; } } } diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 55457e4f08..ee6eff8839 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,92 +9,92 @@ namespace CalamityMod.Projectiles.Melee { public class NeptuneOrb : ModProjectile { - private int addSprayTimer = 20; + private int addSprayTimer = 20; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 1f); - addSprayTimer--; - if (addSprayTimer <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 15f, mod.ProjectileType("DepthOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - addSprayTimer = 20; - } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, 0f, 0f, 1f); + addSprayTimer--; + if (addSprayTimer <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 15f, mod.ProjectileType("DepthOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + addSprayTimer = 20; + } + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 50, 255, projectile.alpha); - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int dust = 0; dust <= 30; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.Damage(); - } + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(50, 50, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int dust = 0; dust <= 30; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + } + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.Damage(); + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("CrushDepth"), 300); + target.AddBuff(mod.BuffType("CrushDepth"), 300); } } } diff --git a/Projectiles/Melee/NightStabber.cs b/Projectiles/Melee/NightStabber.cs index b08bab3a1f..ba4e7b0db5 100644 --- a/Projectiles/Melee/NightStabber.cs +++ b/Projectiles/Melee/NightStabber.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class NightStabber : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stabber"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stabber"); + } public override void SetDefaults() { @@ -20,62 +20,62 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 300; - projectile.melee = true; - } + projectile.melee = true; + } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 7f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 7f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Melee/OPHammerMelee.cs b/Projectiles/Melee/OPHammerMelee.cs index 0783adcb2d..be7723cb99 100644 --- a/Projectiles/Melee/OPHammerMelee.cs +++ b/Projectiles/Melee/OPHammerMelee.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,123 +8,123 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class OPHammerMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - } + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 16f; - float num43 = 3.2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 16f; + float num43 = 3.2f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceMelee = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index ab2ea1c4a1..754ad9fcc1 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -7,49 +7,49 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Oathblade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oathblade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oathblade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = true; - projectile.penetrate = 3; - aiType = 45; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = true; + projectile.penetrate = 3; + aiType = 45; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.35f); - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.35f); + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - int immuneTime = 10 - - (NPC.downedMoonlord ? 8 : 0); - target.immune[projectile.owner] = immuneTime; - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.ShadowFlame, 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int immuneTime = 10 - + (NPC.downedMoonlord ? 8 : 0); + target.immune[projectile.owner] = immuneTime; + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.ShadowFlame, 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/OceanBeam.cs b/Projectiles/Melee/OceanBeam.cs index 1bef8f1d4d..763a6820a4 100644 --- a/Projectiles/Melee/OceanBeam.cs +++ b/Projectiles/Melee/OceanBeam.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class OceanBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -23,43 +23,43 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 3; projectile.timeLeft /= 2; projectile.melee = true; - projectile.tileCollide = false; + projectile.tileCollide = false; } public override void AI() { - for (int num92 = 0; num92 < 2; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 56, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.25f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; - } - for (int num105 = 0; num105 < 2; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 245, 0f, 0f, 100, default, 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.25f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; - } + for (int num92 = 0; num92 < 2; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 56, 0f, 0f, 100, default, 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.25f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X -= num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y -= num94; + } + for (int num105 = 0; num105 < 2; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 245, 0f, 0f, 100, default, 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.25f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X -= num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y -= num100; + } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - projectile.tileCollide = true; + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 60f) + projectile.tileCollide = true; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -87,11 +87,11 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 245, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 245, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); } } } diff --git a/Projectiles/Melee/OmegaBiomeOrb.cs b/Projectiles/Melee/OmegaBiomeOrb.cs index 692d1f616a..8e64c37feb 100644 --- a/Projectiles/Melee/OmegaBiomeOrb.cs +++ b/Projectiles/Melee/OmegaBiomeOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,210 +7,210 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class OmegaBiomeOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.melee = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool sky = player.ZoneSkyHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - int dustType = 0; - if (jungle) - { - dustType = 39; - } - else if (snow) - { - dustType = 51; - } - else if (beach) - { - dustType = 33; - } - else if (corrupt) - { - dustType = 14; - } - else if (crimson) - { - dustType = 5; - } - else if (dungeon) - { - dustType = 29; - } - else if (desert) - { - dustType = 32; - } - else if (glow) - { - dustType = 56; - } - else if (hell) - { - dustType = 6; - } - else if (sky) - { - dustType = 213; - } - else if (holy) - { - dustType = 57; - } - else if (nebula) - { - dustType = 242; - } - else if (stardust) - { - dustType = 206; - } - else if (solar) - { - dustType = 244; - } - else if (vortex) - { - dustType = 107; - } - else - { - dustType = 3; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool sky = player.ZoneSkyHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + int dustType = 0; + if (jungle) + { + dustType = 39; + } + else if (snow) + { + dustType = 51; + } + else if (beach) + { + dustType = 33; + } + else if (corrupt) + { + dustType = 14; + } + else if (crimson) + { + dustType = 5; + } + else if (dungeon) + { + dustType = 29; + } + else if (desert) + { + dustType = 32; + } + else if (glow) + { + dustType = 56; + } + else if (hell) + { + dustType = 6; + } + else if (sky) + { + dustType = 213; + } + else if (holy) + { + dustType = 57; + } + else if (nebula) + { + dustType = 242; + } + else if (stardust) + { + dustType = 206; + } + else if (solar) + { + dustType = 244; + } + else if (vortex) + { + dustType = 107; + } + else + { + dustType = 3; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 15f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 600); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 600); - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 600); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 600); - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 600); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 600); + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 600); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 600); + } + } + } } diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index a64f93c4ec..083ebdb92d 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -5,88 +5,88 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class PlagueBeeDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 60; - } + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 60; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] % 2f == 0f) - { - int spawnX = (int)(projectile.width / 2); - int spawnY = (int)(projectile.width / 2); - int bee = Projectile.NewProjectile(projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), - projectile.velocity.X, projectile.velocity.Y, Main.player[projectile.owner].beeType(), - Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), projectile.owner, 0f, 0f); - Main.projectile[bee].penetrate = 1; - } - int num297 = 89; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] % 2f == 0f) + { + int spawnX = (int)(projectile.width / 2); + int spawnY = (int)(projectile.width / 2); + int bee = Projectile.NewProjectile(projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), + projectile.velocity.X, projectile.velocity.Y, Main.player[projectile.owner].beeType(), + Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), projectile.owner, 0f, 0f); + Main.projectile[bee].penetrate = 1; + } + int num297 = 89; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("Plague"), 180); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("Plague"), 180); + } + } } diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index 6487fad5d5..793efbffac 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class PlagueDust : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -26,58 +26,58 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 89; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 89; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("Plague"), 120); - } + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("Plague"), 120); + } } } diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index b3e51e302f..015360860c 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class PlagueSeeker : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seeker"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeker"); + } public override void SetDefaults() { @@ -24,54 +24,54 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 180); + target.AddBuff(mod.BuffType("Plague"), 180); } } } diff --git a/Projectiles/Melee/PlasmaBall.cs b/Projectiles/Melee/PlasmaBall.cs index a2d358407f..fc34d9b3a9 100644 --- a/Projectiles/Melee/PlasmaBall.cs +++ b/Projectiles/Melee/PlasmaBall.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,85 +7,85 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class PlasmaBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.melee = true; + projectile.timeLeft = 600; + } - public override void AI() - { - Vector2 value7 = new Vector2(6f, 12f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) - { - projectile.localAI[0] = 0f; - } - else - { - for (int num41 = 0; num41 < 2; num41++) - { - Vector2 value8 = Vector2.UnitX * -15f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 1f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - } - } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + Vector2 value7 = new Vector2(6f, 12f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -15f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = 1f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 300); + } + } } diff --git a/Projectiles/Melee/ProfanedSword.cs b/Projectiles/Melee/ProfanedSword.cs index 65db89b2f3..45700d6d47 100644 --- a/Projectiles/Melee/ProfanedSword.cs +++ b/Projectiles/Melee/ProfanedSword.cs @@ -1,63 +1,63 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class ProfanedSword : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Sword"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Sword"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.melee = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimlanceHellfireExplosion"), (int)((double)projectile.damage * 0.5), knockback, Main.myPlayer); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimlanceHellfireExplosion"), (int)((double)projectile.damage * 0.5), knockback, Main.myPlayer); + } + } } diff --git a/Projectiles/Melee/PwnagehammerMelee.cs b/Projectiles/Melee/PwnagehammerMelee.cs index bd9c6f119d..fb18cf7f83 100644 --- a/Projectiles/Melee/PwnagehammerMelee.cs +++ b/Projectiles/Melee/PwnagehammerMelee.cs @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class PwnagehammerMelee : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -29,14 +29,14 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.velocity.X *= 1.06f; - projectile.velocity.Y *= 1.06f; + projectile.velocity.X *= 1.06f; + projectile.velocity.Y *= 1.06f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index e54db72e83..f9c4067b04 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class RainBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -24,59 +24,59 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - projectile.localAI[0] += 1f; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); - Main.dust[num469].noGravity = true; + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + projectile.localAI[0] += 1f; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); + Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 14f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 14f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); for (int k = 0; k < 5; k++) { - int rain = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); - Main.dust[rain].noGravity = true; - Main.dust[rain].velocity *= 4f; + int rain = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); + Main.dust[rain].noGravity = true; + Main.dust[rain].velocity *= 4f; } } } diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index 94630b3339..6c4870158b 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class RainbowBoom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boom"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boom"); + } public override void SetDefaults() { @@ -23,67 +23,67 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 60; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 5; } public override void AI() { - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 1687677f5a..a48d3a27f7 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Melee { public class Razorwind : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Razorwind"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Razorwind"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + } public override void SetDefaults() { @@ -28,61 +28,61 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 3; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 8; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.alpha -= 5; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f * 3f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 5f * 3f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 150f * 3f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 5f * 3f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -98,19 +98,19 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } } public override Color? GetAlpha(Color lightColor) { - return new Color(53, Main.DiscoG, 255, projectile.alpha); + return new Color(53, Main.DiscoG, 255, projectile.alpha); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/RedBall.cs b/Projectiles/Melee/RedBall.cs index b9b5e08532..182d1eb83a 100644 --- a/Projectiles/Melee/RedBall.cs +++ b/Projectiles/Melee/RedBall.cs @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Melee { public class RedBall : ModProjectile { - private int projTime = 15; + private int projTime = 15; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -27,26 +27,26 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - projTime--; - if (projTime == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("RedDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - projTime = 15; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + projTime--; + if (projTime == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("RedDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + projTime = 15; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire, 300); } } } diff --git a/Projectiles/Melee/RedDust.cs b/Projectiles/Melee/RedDust.cs index 18fe326769..c716852840 100644 --- a/Projectiles/Melee/RedDust.cs +++ b/Projectiles/Melee/RedDust.cs @@ -1,79 +1,79 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class RedDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 3600; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.timeLeft = 3600; + } - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) - { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; - } - else - { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; - } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.timeLeft > 85) - projectile.timeLeft = 85; - if (projectile.alpha < 255) - { - projectile.alpha += 2; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.02f; + if (projectile.velocity.X < 0f) + { + projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + } + else + { + projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.timeLeft > 85) + projectile.timeLeft = 85; + if (projectile.alpha < 255) + { + projectile.alpha += 2; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + } } diff --git a/Projectiles/Melee/RoyalKnifeMelee.cs b/Projectiles/Melee/RoyalKnifeMelee.cs index 1a4d9eb210..496ae528e0 100644 --- a/Projectiles/Melee/RoyalKnifeMelee.cs +++ b/Projectiles/Melee/RoyalKnifeMelee.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,116 +8,116 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class RoyalKnifeMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) - { - projectile.alpha += 4; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); - } - if (projectile.ai[0] < 240f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - if (Main.rand.NextBool(6)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 240f) + { + projectile.alpha += 4; + projectile.damage = (int)((double)projectile.damage * 0.95); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); + } + if (projectile.ai[0] < 240f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + else + { + projectile.rotation += 0.5f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 800f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 35f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + if (Main.rand.NextBool(6)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } + public override void Kill(int timeLeft) + { + for (int num303 = 0; num303 < 3; num303++) + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.015f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.015f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index b64de73d9d..0e4a4b752b 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -7,53 +7,53 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SHIV : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shiv"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shiv"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.aiStyle = 27; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.aiStyle = 27; + } - public override void AI() - { - projectile.velocity.X *= 1.075f; - projectile.velocity.Y *= 1.075f; - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } + public override void AI() + { + projectile.velocity.X *= 1.075f; + projectile.velocity.Y *= 1.075f; + int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } - public override void Kill(int timeLeft) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; - } + public override void Kill(int timeLeft) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num].noGravity = true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/SandBlade.cs b/Projectiles/Melee/SandBlade.cs index 5bd1cd2cca..5c699c795a 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -7,56 +7,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SandBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } - public override void AI() - { - projectile.rotation += 0.5f; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 30f) - { - projectile.velocity.X *= 0.925f; - projectile.velocity.Y *= 0.925f; - } - else if (projectile.ai[1] > 30f && projectile.ai[1] <= 59f) - { - projectile.velocity.X *= 1.15f; - projectile.velocity.Y *= 1.15f; - } - else if (projectile.ai[1] == 60f) - { - projectile.ai[1] = 0f; - } - } + public override void AI() + { + projectile.rotation += 0.5f; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 30f) + { + projectile.velocity.X *= 0.925f; + projectile.velocity.Y *= 0.925f; + } + else if (projectile.ai[1] > 30f && projectile.ai[1] <= 59f) + { + projectile.velocity.X *= 1.15f; + projectile.velocity.Y *= 1.15f; + } + else if (projectile.ai[1] == 60f) + { + projectile.ai[1] = 0f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, 0f, 0f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, 0f, 0f); + } + } + } } diff --git a/Projectiles/Melee/SandFire.cs b/Projectiles/Melee/SandFire.cs index 844d465f7c..0b682f4985 100644 --- a/Projectiles/Melee/SandFire.cs +++ b/Projectiles/Melee/SandFire.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class SandFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -25,63 +25,63 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); } } } diff --git a/Projectiles/Melee/ScourgeoftheCosmos.cs b/Projectiles/Melee/ScourgeoftheCosmos.cs index 6c68953520..f6d625b34a 100644 --- a/Projectiles/Melee/ScourgeoftheCosmos.cs +++ b/Projectiles/Melee/ScourgeoftheCosmos.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,171 +8,171 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class ScourgeoftheCosmos : ModProjectile - { - private int bounce = 3; + { + private int bounce = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.alpha = 255; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - if (projectile.alpha <= 200) - { - int num3; - for (int num20 = 0; num20 < 2; num20 = num3 + 1) - { - int dustType = (Main.rand.NextBool(3) ? 56 : 242); - float num21 = projectile.velocity.X / 4f * (float)num20; - float num22 = projectile.velocity.Y / 4f * (float)num20; - int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[num23].position.X = projectile.Center.X - num21; - Main.dust[num23].position.Y = projectile.Center.Y - num22; - Dust dust = Main.dust[num23]; - dust.velocity *= 0f; - Main.dust[num23].scale = 0.7f; - num3 = num20; - } - } - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 180f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + if (projectile.ai[1] == 1f) + { + projectile.melee = false; + projectile.Calamity().rogue = true; + } + if (projectile.alpha <= 200) + { + int num3; + for (int num20 = 0; num20 < 2; num20 = num3 + 1) + { + int dustType = (Main.rand.NextBool(3) ? 56 : 242); + float num21 = projectile.velocity.X / 4f * (float)num20; + float num22 = projectile.velocity.Y / 4f * (float)num20; + int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + Main.dust[num23].position.X = projectile.Center.X - num21; + Main.dust[num23].position.Y = projectile.Center.Y - num22; + Dust dust = Main.dust[num23]; + dust.velocity *= 0f; + Main.dust[num23].scale = 0.7f; + num3 = num20; + } + } + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 180f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); - } - else - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - if (projectile.owner == Main.myPlayer) - { - int num626 = 1; - if (Main.rand.NextBool(10)) - { - num626++; - } - int num3; - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + { + projectile.Kill(); + } + else + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + if (projectile.owner == Main.myPlayer) + { + int num626 = 1; + if (Main.rand.NextBool(10)) + { + num626++; + } + int num3; + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; + num628 *= 10f; + num629 *= 10f; + if (!projectile.melee) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + num3 = num627; + } + } + } + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); - int num3; - for (int num622 = 0; num622 < 10; num622 = num3 + 1) - { - int dustType = (Main.rand.NextBool(3) ? 56 : 242); - int num623 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num623]; - dust.scale *= 1.1f; - Main.dust[num623].noGravity = true; - num3 = num622; - } - for (int num624 = 0; num624 < 15; num624 = num3 + 1) - { - int dustType = (Main.rand.NextBool(3) ? 56 : 242); - int num625 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num625]; - dust.velocity *= 2.5f; - dust = Main.dust[num625]; - dust.scale *= 0.8f; - Main.dust[num625].noGravity = true; - num3 = num624; - } - if (projectile.owner == Main.myPlayer) - { - int num626 = 3; - if (Main.rand.NextBool(10)) - { - num626++; - } - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); + int num3; + for (int num622 = 0; num622 < 10; num622 = num3 + 1) + { + int dustType = (Main.rand.NextBool(3) ? 56 : 242); + int num623 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num623]; + dust.scale *= 1.1f; + Main.dust[num623].noGravity = true; + num3 = num622; + } + for (int num624 = 0; num624 < 15; num624 = num3 + 1) + { + int dustType = (Main.rand.NextBool(3) ? 56 : 242); + int num625 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num625]; + dust.velocity *= 2.5f; + dust = Main.dust[num625]; + dust.scale *= 0.8f; + Main.dust[num625].noGravity = true; + num3 = num624; + } + if (projectile.owner == Main.myPlayer) + { + int num626 = 3; + if (Main.rand.NextBool(10)) + { + num626++; + } + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; + num628 *= 10f; + num629 *= 10f; + if (!projectile.melee) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + num3 = num627; + } + } + } + } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index 0f865c333a..1aede10bb6 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -10,9 +10,9 @@ namespace CalamityMod.Projectiles.Melee { private int bounce = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge Mini"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Scourge Mini"); Main.projFrames[projectile.type] = 2; } @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } if (projectile.alpha > 0) { projectile.alpha -= 50; @@ -168,13 +168,13 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Vector2 origin = new Vector2(9f, 10f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Vector2 origin = new Vector2(9f, 10f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + } } diff --git a/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs b/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs index 324390643e..c2cf2c2d8e 100644 --- a/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs +++ b/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs @@ -1,14 +1,13 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SeashellBoomerangProjectileMelee : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boomerang"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boomerang"); + } public override void SetDefaults() { diff --git a/Projectiles/Melee/ShortBeam.cs b/Projectiles/Melee/ShortBeam.cs index efdce9e6aa..0e04db95b4 100644 --- a/Projectiles/Melee/ShortBeam.cs +++ b/Projectiles/Melee/ShortBeam.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class ShortBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -26,11 +26,11 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, 0f, ((255 - projectile.alpha) * 0.2f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, 0f, ((255 - projectile.alpha) * 0.2f) / 255f); projectile.velocity.Y += projectile.ai[0]; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[projectile.owner] = 7; } } } diff --git a/Projectiles/Melee/ShortNightBeam.cs b/Projectiles/Melee/ShortNightBeam.cs index aaeca978f4..69a76de33a 100644 --- a/Projectiles/Melee/ShortNightBeam.cs +++ b/Projectiles/Melee/ShortNightBeam.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class ShortNightBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -26,11 +26,11 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); projectile.velocity.Y += projectile.ai[0]; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[projectile.owner] = 7; } } } diff --git a/Projectiles/Melee/ShortTerraBeam.cs b/Projectiles/Melee/ShortTerraBeam.cs index 7de34f3645..abd437cf95 100644 --- a/Projectiles/Melee/ShortTerraBeam.cs +++ b/Projectiles/Melee/ShortTerraBeam.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class ShortTerraBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -27,10 +27,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); } } @@ -41,28 +41,28 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } + target.immune[projectile.owner] = 7; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } } } diff --git a/Projectiles/Melee/SolarFlare.cs b/Projectiles/Melee/SolarFlare.cs index 8d085b23c4..edde775e93 100644 --- a/Projectiles/Melee/SolarFlare.cs +++ b/Projectiles/Melee/SolarFlare.cs @@ -1,127 +1,127 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SolarFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 150; - projectile.melee = true; - projectile.timeLeft = 120; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 150; + projectile.melee = true; + projectile.timeLeft = 120; + } - public override void AI() - { - if (projectile.timeLeft < 60) - { - projectile.tileCollide = true; - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 15; - if (projectile.alpha >= 150) - { - projectile.alpha = 150; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0f); - } + public override void AI() + { + if (projectile.timeLeft < 60) + { + projectile.tileCollide = true; + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 15; + if (projectile.alpha >= 150) + { + projectile.alpha = 150; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 1; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 1; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); + Main.dust[num624].velocity *= 2f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + } } diff --git a/Projectiles/Melee/SolsticeBeam.cs b/Projectiles/Melee/SolsticeBeam.cs index fcbfdfb871..7bdb95332d 100644 --- a/Projectiles/Melee/SolsticeBeam.cs +++ b/Projectiles/Melee/SolsticeBeam.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,193 +8,193 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SolsticeBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item60, projectile.position); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int dustType = 0; + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item60, projectile.position); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int dustType = 0; - switch (CalamityMod.season) - { - case Season.Spring: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 74, - 157, - 107 - }); - break; - case Season.Summer: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 247, - 228, - 57 - }); - break; - case Season.Fall: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 6, - 259, - 158 - }); - break; - case Season.Winter: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 67, - 229, - 185 - }); - break; - } - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); - Main.dust[dust].noGravity = true; - } - } + switch (CalamityMod.season) + { + case Season.Spring: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 74, + 157, + 107 + }); + break; + case Season.Summer: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 247, + 228, + 57 + }); + break; + case Season.Fall: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 6, + 259, + 158 + }); + break; + case Season.Winter: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 67, + 229, + 185 + }); + break; + } + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); + Main.dust[dust].noGravity = true; + } + } - public override Color? GetAlpha(Color lightColor) - { - byte red = 255; - byte green = 255; - byte blue = 255; - switch (CalamityMod.season) - { - case Season.Spring: - red = 0; - green = 250; - blue = 0; - break; - case Season.Summer: - red = 250; - green = 250; - blue = 0; - break; - case Season.Fall: - red = 250; - green = 150; - blue = 50; - break; - case Season.Winter: - red = 100; - green = 150; - blue = 250; - break; - } - return new Color(red, green, blue, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + byte red = 255; + byte green = 255; + byte blue = 255; + switch (CalamityMod.season) + { + case Season.Spring: + red = 0; + green = 250; + blue = 0; + break; + case Season.Summer: + red = 250; + green = 250; + blue = 0; + break; + case Season.Fall: + red = 250; + green = 150; + blue = 50; + break; + case Season.Winter: + red = 100; + green = 150; + blue = 250; + break; + } + return new Color(red, green, blue, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - int dustType = 0; + public override void Kill(int timeLeft) + { + int dustType = 0; - switch (CalamityMod.season) - { - case Season.Spring: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 245, - 157, - 107 - }); - break; - case Season.Summer: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 247, - 228, - 57 - }); - break; - case Season.Fall: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 6, - 259, - 158 - }); - break; - case Season.Winter: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 67, - 229, - 185 - }); - break; - } - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } + switch (CalamityMod.season) + { + case Season.Spring: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 245, + 157, + 107 + }); + break; + case Season.Summer: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 247, + 228, + 57 + }); + break; + case Season.Fall: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 6, + 259, + 158 + }); + break; + case Season.Winter: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 67, + 229, + 185 + }); + break; + } + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - int buff = Main.dayTime ? BuffID.Daybreak : mod.BuffType("Nightwither"); - target.AddBuff(buff, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int buff = Main.dayTime ? BuffID.Daybreak : mod.BuffType("Nightwither"); + target.AddBuff(buff, 300); + } + } } diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index 52e1bf99ea..05003f509f 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -7,77 +7,77 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SoulScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 55; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 420; - projectile.ignoreWater = true; - projectile.tileCollide = false; - aiType = 274; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.alpha = 55; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 420; + projectile.ignoreWater = true; + projectile.tileCollide = false; + aiType = 274; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(mod.BuffType("Plague"), 300); - if (target.life <= (target.lifeMax * 0.15f)) - { - Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 14); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(mod.BuffType("Plague"), 300); + if (target.life <= (target.lifeMax * 0.15f)) + { + Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 14); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 60; + projectile.height = 60; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index 05b9ccd846..f26dd8b504 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class Spark : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spark"); + } public override void SetDefaults() { @@ -19,69 +19,69 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.timeLeft = 120; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.melee = true; + projectile.localNPCHitCooldown = 10; + projectile.melee = true; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index fb81241619..eaa4aebcfa 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class SpatialSpear : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } public override void SetDefaults() { @@ -24,97 +24,97 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.timeLeft = 180; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.localNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.05f, 1f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 60f) - { - projectile.ai[0] = 60f; - projectile.velocity.Y = projectile.velocity.Y + 0.25f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - projectile.velocity.X = projectile.velocity.X * 0.995f; - } - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear2"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } + Lighting.AddLight(projectile.Center, 0.05f, 1f, 0.05f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 60f) + { + projectile.ai[0] = 60f; + projectile.velocity.Y = projectile.velocity.Y + 0.25f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + projectile.velocity.X = projectile.velocity.X * 0.995f; + } + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear2"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } } diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index 35990ee98e..8150c6ea63 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class SpatialSpear2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } public override void SetDefaults() { @@ -23,85 +23,85 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 2; projectile.timeLeft = 120; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.localNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.05f, 0.05f, 1f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear3"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); + Lighting.AddLight(projectile.Center, 0.05f, 0.05f, 1f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear3"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } } - public override void Kill(int timeLeft) - { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + public override void Kill(int timeLeft) + { + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index 78ebff6702..de18caf6ba 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -1,105 +1,105 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SpatialSpear3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 80; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 80; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 1f, 0.05f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear4"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 1f, 0.05f, 0.05f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear4"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } - public override void Kill(int timeLeft) - { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } + public override void Kill(int timeLeft) + { + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } } diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index b7db6982bb..6dd459b848 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class SpatialSpear4 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } public override void SetDefaults() { @@ -26,65 +26,65 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.05f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } - public override void Kill(int timeLeft) - { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } + public override void Kill(int timeLeft) + { + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } } diff --git a/Projectiles/Melee/Spears/AstralPike.cs b/Projectiles/Melee/Spears/AstralPike.cs index 2f83ff8b75..d9604efb26 100644 --- a/Projectiles/Melee/Spears/AstralPike.cs +++ b/Projectiles/Melee/Spears/AstralPike.cs @@ -1,116 +1,116 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class AstralPike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pike"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pike"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether projectile is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - target.immune[projectile.owner] = 6; - if (crit) - { - for (int i = 0; i < 3; i++) - { - float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstralStar"), (int)((double)projectile.damage * 0.2), 1f, projectile.owner); - Main.projectile[proj].Calamity().forceMelee = true; - } - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + target.immune[projectile.owner] = 6; + if (crit) + { + for (int i = 0; i < 3; i++) + { + float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstralStar"), (int)((double)projectile.damage * 0.2), 1f, projectile.owner); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + } + } + } } diff --git a/Projectiles/Melee/Spears/BansheeHook.cs b/Projectiles/Melee/Spears/BansheeHook.cs index 98a2829f5d..4e716f9130 100644 --- a/Projectiles/Melee/Spears/BansheeHook.cs +++ b/Projectiles/Melee/Spears/BansheeHook.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,144 +8,144 @@ namespace CalamityMod.Projectiles.Melee.Spears { public class BansheeHook : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Banshee Hook"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Banshee Hook"); + } public override void SetDefaults() { - projectile.width = 40; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 40; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - projectile.alpha = 255; + projectile.width = 40; + projectile.melee = true; + projectile.timeLeft = 90; + projectile.height = 40; + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + projectile.alpha = 255; } public override void AI() { - Player player = Main.player[projectile.owner]; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.direction = player.direction; - player.heldProj = projectile.whoAmI; - projectile.Center = vector; - if (player.dead) - { - projectile.Kill(); - return; - } - if (!player.frozen) - { - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + (projectile.velocity.X * 0.5f), projectile.Center.Y + (projectile.velocity.Y * 0.5f), - projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("BansheeHookScythe"), (int)((double)projectile.damage * 1.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - projectile.spriteDirection = (projectile.direction = player.direction); - projectile.alpha -= 127; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - float num = (float)player.itemAnimation / (float)player.itemAnimationMax; - float num2 = 1f - num; - float num3 = projectile.velocity.ToRotation(); - float num4 = projectile.velocity.Length(); - float num5 = 22f; - Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy((double)(3.14159274f + num2 * 6.28318548f), default) * new Vector2(num4, projectile.ai[0]); - projectile.position += spinningpoint.RotatedBy((double)num3, default) + new Vector2(num4 + num5, 0f).RotatedBy((double)num3, default); - Vector2 destination = vector + spinningpoint.RotatedBy((double)num3, default) + new Vector2(num4 + num5 + 40f, 0f).RotatedBy((double)num3, default); - projectile.rotation = player.AngleTo(destination) + ((float)(Math.PI * 0.25)) * (float)player.direction; //or this - if (projectile.spriteDirection == -1) - { - projectile.rotation += (float)Math.PI; //change this - } - player.DirectionTo(projectile.Center); - Vector2 value = player.DirectionTo(destination); - Vector2 vector2 = projectile.velocity.SafeNormalize(Vector2.UnitY); - float num6 = 2f; - int num7 = 0; - while ((float)num7 < num6) - { - Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f); - dust.velocity = player.DirectionTo(dust.position) * 2f; - dust.position = projectile.Center + vector2.RotatedBy((double)(num2 * 6.28318548f * 2f + (float)num7 / num6 * 6.28318548f), default) * 10f; - dust.scale = 1f + 0.6f * Main.rand.NextFloat(); - dust.velocity += vector2 * 3f; - dust.noGravity = true; - num7++; - } - for (int i = 0; i < 1; i++) - { - if (Main.rand.NextBool(3)) - { - Dust dust2 = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f); - dust2.velocity = player.DirectionTo(dust2.position) * 2f; - dust2.position = projectile.Center + value * -110f; - dust2.scale = 0.45f + 0.4f * Main.rand.NextFloat(); - dust2.fadeIn = 0.7f + 0.4f * Main.rand.NextFloat(); - dust2.noGravity = true; - dust2.noLight = true; - } - } - } - if (player.itemAnimation == 2) - { - projectile.Kill(); - player.reuseDelay = 2; - } + Player player = Main.player[projectile.owner]; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + projectile.direction = player.direction; + player.heldProj = projectile.whoAmI; + projectile.Center = vector; + if (player.dead) + { + projectile.Kill(); + return; + } + if (!player.frozen) + { + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + (projectile.velocity.X * 0.5f), projectile.Center.Y + (projectile.velocity.Y * 0.5f), + projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("BansheeHookScythe"), (int)((double)projectile.damage * 1.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + projectile.spriteDirection = (projectile.direction = player.direction); + projectile.alpha -= 127; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + float num = (float)player.itemAnimation / (float)player.itemAnimationMax; + float num2 = 1f - num; + float num3 = projectile.velocity.ToRotation(); + float num4 = projectile.velocity.Length(); + float num5 = 22f; + Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy((double)(3.14159274f + num2 * 6.28318548f), default) * new Vector2(num4, projectile.ai[0]); + projectile.position += spinningpoint.RotatedBy((double)num3, default) + new Vector2(num4 + num5, 0f).RotatedBy((double)num3, default); + Vector2 destination = vector + spinningpoint.RotatedBy((double)num3, default) + new Vector2(num4 + num5 + 40f, 0f).RotatedBy((double)num3, default); + projectile.rotation = player.AngleTo(destination) + ((float)(Math.PI * 0.25)) * (float)player.direction; //or this + if (projectile.spriteDirection == -1) + { + projectile.rotation += (float)Math.PI; //change this + } + player.DirectionTo(projectile.Center); + Vector2 value = player.DirectionTo(destination); + Vector2 vector2 = projectile.velocity.SafeNormalize(Vector2.UnitY); + float num6 = 2f; + int num7 = 0; + while ((float)num7 < num6) + { + Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f); + dust.velocity = player.DirectionTo(dust.position) * 2f; + dust.position = projectile.Center + vector2.RotatedBy((double)(num2 * 6.28318548f * 2f + (float)num7 / num6 * 6.28318548f), default) * 10f; + dust.scale = 1f + 0.6f * Main.rand.NextFloat(); + dust.velocity += vector2 * 3f; + dust.noGravity = true; + num7++; + } + for (int i = 0; i < 1; i++) + { + if (Main.rand.NextBool(3)) + { + Dust dust2 = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f); + dust2.velocity = player.DirectionTo(dust2.position) * 2f; + dust2.position = projectile.Center + value * -110f; + dust2.scale = 0.45f + 0.4f * Main.rand.NextFloat(); + dust2.fadeIn = 0.7f + 0.4f * Main.rand.NextFloat(); + dust2.noGravity = true; + dust2.noLight = true; + } + } + } + if (player.itemAnimation == 2) + { + projectile.Kill(); + player.reuseDelay = 2; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector53 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D31 = (projectile.spriteDirection == -1) ? mod.GetTexture("Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Color alpha4 = projectile.GetAlpha(color25); - Vector2 origin8 = new Vector2((float)texture2D31.Width, (float)texture2D31.Height) / 2f; - origin8 = new Vector2((projectile.spriteDirection == 1) ? ((float)texture2D31.Width - -8f) : -8f, -8f); //-8 -8 - SpriteBatch arg_E055_0 = Main.spriteBatch; - Vector2 arg_E055_2 = vector53; - Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; - arg_E055_0.Draw(texture2D31, arg_E055_2, sourceRectangle2, new Microsoft.Xna.Framework.Color(255, 255, 255, 127), projectile.rotation, origin8, projectile.scale, SpriteEffects.None, 0f); - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Vector2 vector53 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D31 = (projectile.spriteDirection == -1) ? mod.GetTexture("Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Color alpha4 = projectile.GetAlpha(color25); + Vector2 origin8 = new Vector2((float)texture2D31.Width, (float)texture2D31.Height) / 2f; + origin8 = new Vector2((projectile.spriteDirection == 1) ? ((float)texture2D31.Width - -8f) : -8f, -8f); //-8 -8 + SpriteBatch arg_E055_0 = Main.spriteBatch; + Vector2 arg_E055_2 = vector53; + Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; + arg_E055_0.Draw(texture2D31, arg_E055_2, sourceRectangle2, new Microsoft.Xna.Framework.Color(255, 255, 255, 127), projectile.rotation, origin8, projectile.scale, SpriteEffects.None, 0f); + return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float f2 = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X) + ((projectile.spriteDirection == -1) ? 3.14159274f : 0f); - float num4 = 0f; - float scaleFactor = -95f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor, 23f * projectile.scale, ref num4)) - { - return true; - } - return false; + float f2 = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X) + ((projectile.spriteDirection == -1) ? 3.14159274f : 0f); + float num4 = 0f; + float scaleFactor = -95f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor, 23f * projectile.scale, ref num4)) + { + return true; + } + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BansheeHookBoom"), (int)((double)damage * 0.25), 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BansheeHookBoom"), (int)((double)damage * 0.25), 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } } } } diff --git a/Projectiles/Melee/Spears/Brimlance.cs b/Projectiles/Melee/Spears/Brimlance.cs index 1b75355d80..06072a6ccc 100644 --- a/Projectiles/Melee/Spears/Brimlance.cs +++ b/Projectiles/Melee/Spears/Brimlance.cs @@ -1,97 +1,97 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class Brimlance : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlance"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlance"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(4)) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, (float)(projectile.direction * 2), 0f, 150, default, 1f); - Main.dust[num].noGravity = true; - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.ai[0] += 0.95f; - } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(4)) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, (float)(projectile.direction * 2), 0f, 150, default, 1f); + Main.dust[num].noGravity = true; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - if (target.life <= 0) - { - int num251 = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimlanceHellfireExplosion"), (int)((double)projectile.damage * 0.75), knockback, Main.myPlayer); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("BrimlanceStandingFire"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + if (target.life <= 0) + { + int num251 = Main.rand.Next(2, 5); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimlanceHellfireExplosion"), (int)((double)projectile.damage * 0.75), knockback, Main.myPlayer); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("BrimlanceStandingFire"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + } + } + } } diff --git a/Projectiles/Melee/Spears/DiseasedPike.cs b/Projectiles/Melee/Spears/DiseasedPike.cs index b99759a8e7..4d474a82fc 100644 --- a/Projectiles/Melee/Spears/DiseasedPike.cs +++ b/Projectiles/Melee/Spears/DiseasedPike.cs @@ -5,82 +5,82 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class DiseasedPike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pike"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pike"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether projectile is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(mod.BuffType("Plague"), 360); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i <= 3; i++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, mod.ProjectileType("PlagueSeeker"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(mod.BuffType("Plague"), 360); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i <= 3; i++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, mod.ProjectileType("PlagueSeeker"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Melee/Spears/EarthenPike.cs b/Projectiles/Melee/Spears/EarthenPike.cs index 688919d689..3cce7224e6 100644 --- a/Projectiles/Melee/Spears/EarthenPike.cs +++ b/Projectiles/Melee/Spears/EarthenPike.cs @@ -5,90 +5,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class EarthenPike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pike"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pike"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether projectile is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - projectile.localAI[0] = 0f; - if (Main.myPlayer == projectile.owner) - { - float velocityY = projectile.velocity.Y * 1.25f; - if (velocityY < 0.1f) - { - velocityY = 0.1f; - } - int proj = Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.25f, velocityY, mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + projectile.localAI[0] = 0f; + if (Main.myPlayer == projectile.owner) + { + float velocityY = projectile.velocity.Y * 1.25f; + if (velocityY < 0.1f) + { + velocityY = 0.1f; + } + int proj = Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X * 1.25f, velocityY, mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(mod.BuffType("ArmorCrunch"), 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(mod.BuffType("ArmorCrunch"), 300); + } + } } diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index 8cc003866f..06efa221ea 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,113 +7,113 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class ExsanguinationLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } - public override void SetDefaults() - { - projectile.width = 95; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 95; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 95; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 95; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.ai[0] += 0.95f; - } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } - if (crit) - { - for (int i = 0; i < 2; i++) - { - float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("TinyFlare"), (int)((double)projectile.damage * 0.5), 2f, projectile.owner); - } - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceMelee = true; + } + if (crit) + { + for (int i = 0; i < 2; i++) + { + float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("TinyFlare"), (int)((double)projectile.damage * 0.5), 2f, projectile.owner); + } + } + } + } + } } diff --git a/Projectiles/Melee/Spears/FulgurationHalberd.cs b/Projectiles/Melee/Spears/FulgurationHalberd.cs index 77b11325c8..464b3bdbe0 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberd.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberd.cs @@ -5,65 +5,65 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class FulgurationHalberd : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fulguration Halberd"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fulguration Halberd"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether projectile is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; projectile.Calamity().trueMelee = true; - } + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - } - else - { - projectile.ai[0] += 0.95f; - } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(mod.BuffType("BurningBlood"), 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(mod.BuffType("BurningBlood"), 300); + } + } } diff --git a/Projectiles/Melee/Spears/GildedProboscis.cs b/Projectiles/Melee/Spears/GildedProboscis.cs index 45db44b686..b91f9b5e6c 100644 --- a/Projectiles/Melee/Spears/GildedProboscis.cs +++ b/Projectiles/Melee/Spears/GildedProboscis.cs @@ -1,5 +1,4 @@ using System; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,81 +6,81 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class GildedProboscis : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Proboscis"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Proboscis"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(4)) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, (float)(projectile.direction * 2), 0f, 150, default, 1f); - Main.dust[num].noGravity = true; - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.ai[0] += 0.95f; - } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(4)) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, (float)(projectile.direction * 2), 0f, 150, default, 1f); + Main.dust[num].noGravity = true; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); + } + } } diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 7cdb739e62..16b98d728f 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -5,74 +5,74 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class GoldplumeSpearProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } - public override void SetDefaults() - { - projectile.width = 54; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 54; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - } + public override void SetDefaults() + { + projectile.width = 54; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 54; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - projectile.localAI[0] = 0f; - if (Main.myPlayer == projectile.owner) - { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("Feather"), (int)((double)projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); - } - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 1.1f; - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + projectile.localAI[0] = 0f; + if (Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("Feather"), (int)((double)projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); + } + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 1.1f; + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + } } diff --git a/Projectiles/Melee/Spears/HeartRapierProjectile.cs b/Projectiles/Melee/Spears/HeartRapierProjectile.cs index 8e5dd2e112..b2450f1fd9 100644 --- a/Projectiles/Melee/Spears/HeartRapierProjectile.cs +++ b/Projectiles/Melee/Spears/HeartRapierProjectile.cs @@ -7,73 +7,73 @@ namespace CalamityMod.Projectiles.Melee.Spears { public class HeartRapierProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rapier"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rapier"); + } public override void SetDefaults() { - projectile.width = 44; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 44; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + projectile.width = 44; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 44; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } public override void AI() { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 12, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 12, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 1.1f; + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 1.1f; - } - else - { - projectile.ai[0] += 0.95f; - } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 5; + player.HealEffect(5); + } } } diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index b918d6ca2e..f4e767abd6 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,107 +7,107 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class HellionFlowerSpearProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("HellionSpike"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("HellionSpike"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Venom, 300); - if (crit) - { - float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Venom, 300); + if (crit) + { + float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); + } + } + } + } } diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index 4e07efff21..489b1808f5 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -6,60 +6,60 @@ namespace CalamityMod.Projectiles.Melee.Spears { public class MarniteSpearProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } public override void SetDefaults() { - projectile.width = 50; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 50; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + projectile.width = 50; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 50; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } public override void AI() { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if(projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if(Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 1.1f; - } - else - { - projectile.ai[0] += 0.95f; - } + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 1.1f; + } + else + { + projectile.ai[0] += 0.95f; + } - if(Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } } } } diff --git a/Projectiles/Melee/Spears/SausageMaker.cs b/Projectiles/Melee/Spears/SausageMaker.cs index cba23a73b1..6784e70d56 100644 --- a/Projectiles/Melee/Spears/SausageMaker.cs +++ b/Projectiles/Melee/Spears/SausageMaker.cs @@ -5,76 +5,76 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class SausageMaker : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } - public override void SetDefaults() - { - projectile.width = 44; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 42; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 44; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 42; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 1.1f; - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 1.1f; + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 2; i++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.2f, projectile.velocity.Y * 1.2f, mod.ProjectileType("Blood2"), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.2f, projectile.velocity.Y * 1.2f, mod.ProjectileType("Blood2"), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs index 6817a43d1c..218c2691a8 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -1,86 +1,86 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class SpatialLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("SpatialSpear"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num].noGravity = true; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("SpatialSpear"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 69816cdf75..e3c5650a17 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -6,76 +6,76 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class StarnightLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether projectile is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 29, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("StarnightBeam"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 29, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("StarnightBeam"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Frostburn, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Frostburn, 120); + } + } } diff --git a/Projectiles/Melee/Spears/StreamGouge.cs b/Projectiles/Melee/Spears/StreamGouge.cs index 01a19aa1ab..bec79129ac 100644 --- a/Projectiles/Melee/Spears/StreamGouge.cs +++ b/Projectiles/Melee/Spears/StreamGouge.cs @@ -1,88 +1,88 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class StreamGouge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gouge"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gouge"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, (float)(projectile.direction * 2), 0f, 150, default, 1f); - Main.dust[num].noGravity = true; - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, - mod.ProjectileType("EssenceBeam"), projectile.damage * 4, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.95f; - } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, (float)(projectile.direction * 2), 0f, 150, default, 1f); + Main.dust[num].noGravity = true; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, + mod.ProjectileType("EssenceBeam"), projectile.damage * 4, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(0f, 0f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/Spears/StreamGougeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(0f, 0f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/Spears/StreamGougeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + } } diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index e6f1a2181b..1dc7c72909 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -5,75 +5,75 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class TerraLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } - public override void SetDefaults() - { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - } + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, mod.ProjectileType("TerraSpear"), (int)((double)projectile.damage * 0.85), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, mod.ProjectileType("TerraSpear"), (int)((double)projectile.damage * 0.85), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } } diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index 5f99463e09..c660f80f75 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -6,71 +6,71 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class UrchinSpearProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } - public override void SetDefaults() - { - projectile.width = 56; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 56; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - } + public override void SetDefaults() + { + projectile.width = 56; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether this is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 56; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.6f, projectile.velocity.Y * 1.6f, mod.ProjectileType("UrchinSpikeFugu"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.95f; - } + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X * 1.6f, projectile.velocity.Y * 1.6f, mod.ProjectileType("UrchinSpikeFugu"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.95f; + } - if (Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 300); + } + } } diff --git a/Projectiles/Melee/StarCrystal.cs b/Projectiles/Melee/StarCrystal.cs index 91031e147f..b7951f944e 100644 --- a/Projectiles/Melee/StarCrystal.cs +++ b/Projectiles/Melee/StarCrystal.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class StarCrystal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } public override void SetDefaults() { @@ -26,15 +26,15 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("TinyCrystal"), - (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.15f, Main.myPlayer, 0f, 0f); - } - } + if (projectile.owner == Main.myPlayer) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("TinyCrystal"), + (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.15f, Main.myPlayer, 0f, 0f); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index cb2ad88e10..82fec979f9 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -7,59 +7,59 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class StarnightBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - aiType = 156; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.timeLeft = 600; + aiType = 156; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.2f, 0f, 0.2f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.2f, 0f, 0.2f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } } diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index c7f09ae743..b9985d96c5 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -7,42 +7,42 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class StormBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index d602d9032f..884b1b1655 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class StormMark : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } public override void SetDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = false; projectile.timeLeft = 900; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -29,131 +29,131 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int num1137 = 100; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), num1137, 3f, projectile.owner, 0f, 0f); - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - } + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default, 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int num1137 = 100; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), num1137, 3f, projectile.owner, 0f, 0f); + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; } } } diff --git a/Projectiles/Melee/StormRuler.cs b/Projectiles/Melee/StormRuler.cs index aebf007ffa..fafb6075d8 100644 --- a/Projectiles/Melee/StormRuler.cs +++ b/Projectiles/Melee/StormRuler.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,63 +8,63 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class StormRuler : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ruler"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruler"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs index 3fb64ac0d3..9f6d55c208 100644 --- a/Projectiles/Melee/SunlightBlade.cs +++ b/Projectiles/Melee/SunlightBlade.cs @@ -7,56 +7,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SunlightBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } } diff --git a/Projectiles/Melee/TemporalFloeSwordProjectile.cs b/Projectiles/Melee/TemporalFloeSwordProjectile.cs index 5827ed62cd..4f8b3b75e1 100644 --- a/Projectiles/Melee/TemporalFloeSwordProjectile.cs +++ b/Projectiles/Melee/TemporalFloeSwordProjectile.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class TemporalFloeSwordProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Floe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Floe"); + } public override void SetDefaults() { @@ -26,10 +26,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); } } @@ -66,11 +66,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.rand.NextBool(3)) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - target.AddBuff(BuffID.Frostburn, 240); + if (Main.rand.NextBool(3)) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + target.AddBuff(BuffID.Frostburn, 240); } } } diff --git a/Projectiles/Melee/TerraBall.cs b/Projectiles/Melee/TerraBall.cs index 2d95eb6355..00f45f9fa7 100644 --- a/Projectiles/Melee/TerraBall.cs +++ b/Projectiles/Melee/TerraBall.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class TerraBall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -26,55 +26,55 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 2f); + Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.CursedInferno, 300); } } } diff --git a/Projectiles/Melee/TerraEdgeBeam.cs b/Projectiles/Melee/TerraEdgeBeam.cs index 69ef044c2e..47c4153805 100644 --- a/Projectiles/Melee/TerraEdgeBeam.cs +++ b/Projectiles/Melee/TerraEdgeBeam.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class TerraEdgeBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1.3f) / 255f, 0f); + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1.3f) / 255f, 0f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/TerraSpear.cs b/Projectiles/Melee/TerraSpear.cs index 72f8685caf..7ddfb440fd 100644 --- a/Projectiles/Melee/TerraSpear.cs +++ b/Projectiles/Melee/TerraSpear.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Melee { public class TerraSpear : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } public override void SetDefaults() { @@ -27,63 +27,63 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1f) / 255f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.NextBool(3)) + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1f) / 255f, 0f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - target.immune[projectile.owner] = 5; + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; } } } diff --git a/Projectiles/Melee/TerracottaExplosion.cs b/Projectiles/Melee/TerracottaExplosion.cs index 8c2b63a6f0..9b89bb3ad4 100644 --- a/Projectiles/Melee/TerracottaExplosion.cs +++ b/Projectiles/Melee/TerracottaExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class TerracottaExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -26,68 +26,68 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[projectile.owner] = 6; } } } diff --git a/Projectiles/Melee/TerratomereProjectile.cs b/Projectiles/Melee/TerratomereProjectile.cs index 29e00550ae..d05a262289 100644 --- a/Projectiles/Melee/TerratomereProjectile.cs +++ b/Projectiles/Melee/TerratomereProjectile.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,94 +7,94 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class TerratomereProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.tileCollide = false; - aiType = 132; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.tileCollide = false; + aiType = 132; + } - public override void AI() - { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); - } + public override void AI() + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 200, 0, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 200, 0, 0); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 60); - target.AddBuff(BuffID.CursedInferno, 600); - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(BuffID.OnFire, 900); - target.AddBuff(BuffID.Ichor, 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 60); + target.AddBuff(BuffID.CursedInferno, 600); + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.OnFire, 900); + target.AddBuff(BuffID.Ichor, 180); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } } diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 3892717ec0..53d85b54b2 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,111 +8,111 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class TerrorBeam : ModProjectile - { - private bool hasHitEnemy = false; + { + private bool hasHitEnemy = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 7; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 1f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 7; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 1f; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TerrorBoom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TerrorBoom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer && !hasHitEnemy) - { - hasHitEnemy = true; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TerrorBoom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer && !hasHitEnemy) + { + hasHitEnemy = true; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TerrorBoom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.localAI[1] += 1f; - } - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - } + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.localAI[1] += 1f; + } + projectile.alpha -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 0, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 0, 0, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 400); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - } - for (int num194 = 0; num194 < 60; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 400); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + } + for (int num194 = 0; num194 < 60; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Melee/TerrorBoom.cs b/Projectiles/Melee/TerrorBoom.cs index 7e0605cc94..9ced9a92ac 100644 --- a/Projectiles/Melee/TerrorBoom.cs +++ b/Projectiles/Melee/TerrorBoom.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class TerrorBoom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -21,31 +21,31 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 4; projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.melee = true; + projectile.localNPCHitCooldown = 3; + projectile.melee = true; } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 400); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - } - for (int num194 = 0; num194 < 60; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 400); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + } + for (int num194 = 0; num194 < 60; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); } } } diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs index afc57fce13..3b0af5f81b 100644 --- a/Projectiles/Melee/TinyCrystal.cs +++ b/Projectiles/Melee/TinyCrystal.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class TinyCrystal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + } public override void SetDefaults() { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); } diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 235ec5cdb4..ec0eec2830 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -1,77 +1,77 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class TinyFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - } + public class TinyFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.melee = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + } - public override void AI() - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } } diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index f5caef8d9c..e43f9aff8e 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -1,19 +1,19 @@ -using System; +using CalamityMod.CalPlayer; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Melee { public class Tornado : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } public override void SetDefaults() { @@ -25,168 +25,168 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = NPC.downedMoonlord ? -1 : 3; projectile.timeLeft = 1200; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } public override void AI() { - float num1125 = 900f; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; - float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) - { - NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) - { - npcCenterX = npc.position.X + (float)(npc.width / 2); - npcCenterY = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); - if (num478 < num474) - { - if (npc.position.X < num472) - { - npc.velocity.X += 0.02f; - } - else - { - npc.velocity.X -= 0.02f; - } - if (npc.position.Y < num473) - { - npc.velocity.Y += 0.02f; - } - else - { - npc.velocity.Y -= 0.02f; - } - } - } - } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - return; - } + float num1125 = 900f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float npcCenterX = 0f; + float npcCenterY = 0f; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + NPC npc = Main.npc[num475]; + if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + npcCenterX = npc.position.X + (float)(npc.width / 2); + npcCenterY = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + if (num478 < num474) + { + if (npc.position.X < num472) + { + npc.velocity.X += 0.02f; + } + else + { + npc.velocity.X -= 0.02f; + } + if (npc.position.Y < num473) + { + npc.velocity.Y += 0.02f; + } + else + { + npc.velocity.Y -= 0.02f; + } + } + } + } + float num1127 = 15f; + float num1128 = 15f; + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + return; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; + float num226 = 600f; + float num227 = 15f; + float num228 = 15f; + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; } } } diff --git a/Projectiles/Melee/TriactisOPHammerMelee.cs b/Projectiles/Melee/TriactisOPHammerMelee.cs index 82c372d3d3..b530673f00 100644 --- a/Projectiles/Melee/TriactisOPHammerMelee.cs +++ b/Projectiles/Melee/TriactisOPHammerMelee.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,140 +8,140 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class TriactisOPHammerMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - } + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 20f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 20f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/TrueBiomeOrb.cs b/Projectiles/Melee/TrueBiomeOrb.cs index 14a47a4fe4..f732d84abf 100644 --- a/Projectiles/Melee/TrueBiomeOrb.cs +++ b/Projectiles/Melee/TrueBiomeOrb.cs @@ -6,143 +6,143 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class TrueBiomeOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool sky = player.ZoneSkyHeight; - bool holy = player.ZoneHoly; - int dustType = 0; - if (jungle) - { - dustType = 39; - } - else if (snow) - { - dustType = 51; - } - else if (beach) - { - dustType = 33; - } - else if (corrupt) - { - dustType = 14; - } - else if (crimson) - { - dustType = 5; - } - else if (dungeon) - { - dustType = 29; - } - else if (desert) - { - dustType = 32; - } - else if (glow) - { - dustType = 56; - } - else if (hell) - { - dustType = 6; - } - else if (sky) - { - dustType = 213; - } - else if (holy) - { - dustType = 57; - } - else - { - dustType = 3; - } - for (int num457 = 0; num457 < 10; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - return; - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool sky = player.ZoneSkyHeight; + bool holy = player.ZoneHoly; + int dustType = 0; + if (jungle) + { + dustType = 39; + } + else if (snow) + { + dustType = 51; + } + else if (beach) + { + dustType = 33; + } + else if (corrupt) + { + dustType = 14; + } + else if (crimson) + { + dustType = 5; + } + else if (dungeon) + { + dustType = 29; + } + else if (desert) + { + dustType = 32; + } + else if (glow) + { + dustType = 56; + } + else if (hell) + { + dustType = 6; + } + else if (sky) + { + dustType = 213; + } + else if (holy) + { + dustType = 57; + } + else + { + dustType = 3; + } + for (int num457 = 0; num457 < 10; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + return; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 360); - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 360); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360); - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 360); - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 360); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 360); - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 360); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360); + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 360); + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 360); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360); + } + } + } } diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index 767fab9ddf..108d8b1e2c 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -7,87 +7,87 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class TrueCausticEdgeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Edge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Edge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.35f, 0f); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.35f, 0f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 100, 0, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 100, 0, 0); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Venom, 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Venom, 120); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } } diff --git a/Projectiles/Melee/Tumbleweed.cs b/Projectiles/Melee/Tumbleweed.cs index ca78ec40b7..4fe48da8aa 100644 --- a/Projectiles/Melee/Tumbleweed.cs +++ b/Projectiles/Melee/Tumbleweed.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class Tumbleweed : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tumbleweed"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tumbleweed"); + } public override void SetDefaults() { @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.melee = true; projectile.alpha = 255; - projectile.Calamity().trueMelee = true; - } + projectile.Calamity().trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index 0d5545dddb..818ed24d8f 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class TumbleweedRolling : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tumbleweed"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tumbleweed"); + } public override void SetDefaults() { diff --git a/Projectiles/Melee/TyphonsGreed.cs b/Projectiles/Melee/TyphonsGreed.cs index d59c2f3d81..dce72c2b3d 100644 --- a/Projectiles/Melee/TyphonsGreed.cs +++ b/Projectiles/Melee/TyphonsGreed.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Melee { public class TyphonsGreed : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Typhon's Greed"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Typhon's Greed"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -28,19 +28,19 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num953 = 50f * projectile.ai[1]; //100 - float scaleFactor12 = 10f * projectile.ai[1]; //5 - float num954 = 40f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num953 = 50f * projectile.ai[1]; //100 + float scaleFactor12 = 10f * projectile.ai[1]; //5 + float num954 = 40f; if ((double)Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = -projectile.direction; @@ -54,31 +54,31 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); } Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -87,42 +87,42 @@ namespace CalamityMod.Projectiles.Melee int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y6 = num214 * projectile.frame; Main.spriteBatch.Draw(texture2D13, - projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), - projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), + projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("CrushDepth"), 180); + target.AddBuff(mod.BuffType("CrushDepth"), 180); } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 6; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 6; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); } } } diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index a2aba9871c..5fef38dc4c 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Enums; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class TyphonsGreedStaff : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Typhon's Greed"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Typhon's Greed"); + } public override void SetDefaults() { @@ -243,7 +243,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("CrushDepth"), 240); + target.AddBuff(mod.BuffType("CrushDepth"), 240); target.immune[projectile.owner] = 6; } } diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index b37655ef4d..f4bec1ceaa 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class UltimusCleaverDust : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ultimus Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultimus Flame"); + } public override void SetDefaults() { @@ -19,104 +19,104 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.penetrate = 5; projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.tileCollide = false; projectile.melee = true; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 150f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } } } diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 6a1988d22b..a54146a47a 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Melee { public class UrchinSpikeFugu : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin Spike"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin Spike"); + } public override void SetDefaults() { @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (projectile.ai[0] == 0f) { float num695 = 100f; @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 180); + target.AddBuff(BuffID.Venom, 180); } } } diff --git a/Projectiles/Melee/Whirlpool.cs b/Projectiles/Melee/Whirlpool.cs index 1c229b593f..8736bf43db 100644 --- a/Projectiles/Melee/Whirlpool.cs +++ b/Projectiles/Melee/Whirlpool.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Melee { public class Whirlpool : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Whirlpool"); - Main.projFrames[projectile.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Whirlpool"); + Main.projFrames[projectile.type] = 3; + } public override void SetDefaults() { @@ -27,63 +27,63 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, projectile.scale * 1.5f); - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) - { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, projectile.scale); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - if (projectile.scale <= 1f) - { - projectile.scale *= 1.015f; - } - if (projectile.scale >= 1f) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0f, 0f, projectile.scale * 1.5f); + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, projectile.scale); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + if (projectile.scale <= 1f) + { + projectile.scale *= 1.015f; + } + if (projectile.scale >= 1f) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 19); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 19); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + } + } } diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index b329e7fc5d..9fb716f99c 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -5,73 +5,73 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteBoltAura : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } public override void SetDefaults() { projectile.width = 100; projectile.height = 2; projectile.tileCollide = false; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.penetrate = -1; projectile.timeLeft = 600; } public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) - { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Whiterain"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 1) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - } - } + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + projectile.ai[0] = 0f; + if (projectile.owner == Main.myPlayer) + { + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Whiterain"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 1) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + } + } } } } diff --git a/Projectiles/Melee/WhiteBoltAuraBlah.cs b/Projectiles/Melee/WhiteBoltAuraBlah.cs index 14e2107d5b..13d04cd05f 100644 --- a/Projectiles/Melee/WhiteBoltAuraBlah.cs +++ b/Projectiles/Melee/WhiteBoltAuraBlah.cs @@ -5,73 +5,73 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteBoltAuraBlah : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } public override void SetDefaults() { projectile.width = 100; projectile.height = 2; projectile.tileCollide = false; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.penetrate = -1; projectile.timeLeft = 1200; } public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) - { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 10f, mod.ProjectileType("WhiterainBlah"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 1) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - } - } + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + projectile.ai[0] = 0f; + if (projectile.owner == Main.myPlayer) + { + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 10f, mod.ProjectileType("WhiterainBlah"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 1) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + } + } } } } diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs index 8d9510d821..c23f98abc6 100644 --- a/Projectiles/Melee/WhiteOrb.cs +++ b/Projectiles/Melee/WhiteOrb.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,14 +25,14 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } } } diff --git a/Projectiles/Melee/WhiteOrbBlah.cs b/Projectiles/Melee/WhiteOrbBlah.cs index 2b790fec48..a086b3492d 100644 --- a/Projectiles/Melee/WhiteOrbBlah.cs +++ b/Projectiles/Melee/WhiteOrbBlah.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteOrbBlah : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,14 +25,14 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } } } diff --git a/Projectiles/Melee/Whiterain.cs b/Projectiles/Melee/Whiterain.cs index d5c1dab247..87db081d5b 100644 --- a/Projectiles/Melee/Whiterain.cs +++ b/Projectiles/Melee/Whiterain.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class Whiterain : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rain"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rain"); + } public override void SetDefaults() { @@ -27,52 +27,52 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - } - Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + } + Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } } } diff --git a/Projectiles/Melee/WhiterainBlah.cs b/Projectiles/Melee/WhiterainBlah.cs index ce951b2a31..e2ad348079 100644 --- a/Projectiles/Melee/WhiterainBlah.cs +++ b/Projectiles/Melee/WhiterainBlah.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Melee { public class WhiterainBlah : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rain"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rain"); + } public override void SetDefaults() { @@ -27,52 +27,52 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1000f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1000f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } } } diff --git a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs b/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs index 5e5c26a8b0..b69048f7de 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,82 +8,82 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class AirSpinnerProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Air Spinner"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Air Spinner"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Valor); - projectile.width = 16; - projectile.scale = 1.05f; - projectile.height = 16; - projectile.penetrate = 7; - projectile.extraUpdates = 1; - projectile.melee = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Valor; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Valor); + projectile.width = 16; + projectile.scale = 1.05f; + projectile.height = 16; + projectile.penetrate = 7; + projectile.extraUpdates = 1; + projectile.melee = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + aiType = ProjectileID.Valor; + } - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 60f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Feather"), projectile.damage / 4, 0f, projectile.owner, 0f, 0f); - } - } - } - } + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 60f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Feather"), projectile.damage / 4, 0f, projectile.owner, 0f, 0f); + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/AortaProjectile.cs b/Projectiles/Melee/Yoyos/AortaProjectile.cs index e124572953..153dd4415e 100644 --- a/Projectiles/Melee/Yoyos/AortaProjectile.cs +++ b/Projectiles/Melee/Yoyos/AortaProjectile.cs @@ -8,14 +8,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class AortaProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aorta"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aorta"); + } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Valor); + projectile.CloneDefaults(ProjectileID.Valor); projectile.width = 16; projectile.height = 16; projectile.penetrate = 7; @@ -26,11 +26,11 @@ namespace CalamityMod.Projectiles.Melee.Yoyos aiType = ProjectileID.Valor; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/AzathothProjectile.cs b/Projectiles/Melee/Yoyos/AzathothProjectile.cs index 6b464cf3cb..d1fc7fe75a 100644 --- a/Projectiles/Melee/Yoyos/AzathothProjectile.cs +++ b/Projectiles/Melee/Yoyos/AzathothProjectile.cs @@ -8,14 +8,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class AzathothProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Azathoth"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Azathoth"); + } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Kraken); + projectile.CloneDefaults(ProjectileID.Kraken); projectile.width = 16; projectile.scale = 1.2f; projectile.height = 16; @@ -24,25 +24,25 @@ namespace CalamityMod.Projectiles.Melee.Yoyos aiType = 554; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { if (Main.rand.NextBool(6)) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("CosmicOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("CosmicOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs index b546bcc0a2..de243a6d4d 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs @@ -8,14 +8,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class ChaotrixProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotrix"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotrix"); + } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Yelets); + projectile.CloneDefaults(ProjectileID.Yelets); projectile.width = 16; projectile.scale = 1.15f; projectile.height = 16; @@ -28,25 +28,25 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } - } + target.AddBuff(BuffID.OnFire, 300); + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceMelee = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs index fad047f0ef..a0f2f439de 100644 --- a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs +++ b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,14 +9,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class CnidarianProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cnidarian"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cnidarian"); + } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.CorruptYoyo); + projectile.CloneDefaults(ProjectileID.CorruptYoyo); projectile.width = 16; projectile.scale = 1.15f; projectile.height = 16; @@ -25,63 +25,63 @@ namespace CalamityMod.Projectiles.Melee.Yoyos aiType = 542; } - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 60f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Seashell"), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].Calamity().forceMelee = true; - } - } - } - } + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 60f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Seashell"), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); + Main.projectile[projectile2].Calamity().forceMelee = true; + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs b/Projectiles/Melee/Yoyos/LaceratorProjectile.cs index 2e1a790f74..aad17ebc2e 100644 --- a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs +++ b/Projectiles/Melee/Yoyos/LaceratorProjectile.cs @@ -8,14 +8,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class LaceratorProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lacerator"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lacerator"); + } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); projectile.width = 16; projectile.scale = 1.1f; projectile.height = 16; @@ -24,28 +24,28 @@ namespace CalamityMod.Projectiles.Melee.Yoyos aiType = 555; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 5; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; - if (Main.rand.NextBool(5)) - { - player.statLife += 1; - player.HealEffect(1); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + if (Main.rand.NextBool(5)) + { + player.statLife += 1; + player.HealEffect(1); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs index 12d7d12fb7..0ce9ca4191 100644 --- a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs +++ b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs @@ -7,66 +7,66 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class QuagmireProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Quagmire"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Quagmire"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.HelFire); - projectile.width = 16; - projectile.scale = 1.25f; - projectile.height = 16; - projectile.penetrate = 8; - projectile.melee = true; - aiType = 553; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.HelFire); + projectile.width = 16; + projectile.scale = 1.25f; + projectile.height = 16; + projectile.penetrate = 8; + projectile.melee = true; + aiType = 553; + } - public override void AI() - { - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.owner == Main.myPlayer) - { - int proj = 0; - if (Main.rand.NextBool(10)) - { - proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; - } - if (Main.rand.NextBool(30)) - { - proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 570, (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; - } - if (Main.rand.NextBool(50)) - { - proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, 571, (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; - } - } - } + public override void AI() + { + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.owner == Main.myPlayer) + { + int proj = 0; + if (Main.rand.NextBool(10)) + { + proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } + if (Main.rand.NextBool(30)) + { + proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 570, (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } + if (Main.rand.NextBool(50)) + { + proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, 571, (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs index 4857224b74..1c181441bf 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,92 +8,92 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class ShimmersparkProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shimmerspark"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shimmerspark"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Chik); - projectile.width = 16; - projectile.scale = 0.9f; - projectile.height = 16; - projectile.penetrate = 8; - projectile.melee = true; - aiType = 546; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Chik); + projectile.width = 16; + projectile.scale = 0.9f; + projectile.height = 16; + projectile.penetrate = 8; + projectile.melee = true; + aiType = 546; + } - public override void AI() - { - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.NextBool(5)) - { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 92, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - } - } - } - } + public override void AI() + { + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.NextBool(5)) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 92, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } } diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 660d822474..6bd5eae77f 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -7,49 +7,49 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class SolarFlareYoyo : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar Flare"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar Flare"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1.15f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1.15f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + aiType = 555; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void AI() - { - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs index 3862dd6dc4..86476ae75c 100644 --- a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,84 +8,84 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class TheEyeofCalamitasProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oblivion"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oblivion"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1.1f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.melee = true; - aiType = 555; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1.1f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.melee = true; + aiType = 555; + } - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BrimstoneLaserFriendly"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 16f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BrimstoneLaserFriendly"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs index 0f419c44bc..0d08ba6ee9 100644 --- a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,87 +8,87 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class TheGodsGambitProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God's Gambit"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God's Gambit"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Kraken); - projectile.width = 16; - projectile.scale = 1.15f; - projectile.height = 16; - projectile.penetrate = 6; - projectile.melee = true; - aiType = 554; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Kraken); + projectile.width = 16; + projectile.scale = 1.15f; + projectile.height = 16; + projectile.penetrate = 6; + projectile.melee = true; + aiType = 554; + } - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 450f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - num438 += (float)Main.rand.Next(-30, 31) * 0.05f; - num439 += (float)Main.rand.Next(-30, 31) * 0.05f; - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ProjectileID.SlimeGun, (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].Calamity().forceMelee = true; - } - } - } - } + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 450f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + num438 += (float)Main.rand.Next(-30, 31) * 0.05f; + num439 += (float)Main.rand.Next(-30, 31) * 0.05f; + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ProjectileID.SlimeGun, (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); + Main.projectile[projectile2].Calamity().forceMelee = true; + } + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slimed, 300); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/TheObliterator.cs b/Projectiles/Melee/Yoyos/TheObliterator.cs index 6ac9e162a3..8be7aff4d4 100644 --- a/Projectiles/Melee/Yoyos/TheObliterator.cs +++ b/Projectiles/Melee/Yoyos/TheObliterator.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,87 +8,87 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class TheObliterator : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Obliterator"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Obliterator"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.height = 16; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.height = 16; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + aiType = 555; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - } - } - } + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 16f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(10f, 10f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(10f, 10f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } } diff --git a/Projectiles/Melee/Yoyos/ThePlaguebringer.cs b/Projectiles/Melee/Yoyos/ThePlaguebringer.cs index 12351825d6..2ccf7af026 100644 --- a/Projectiles/Melee/Yoyos/ThePlaguebringer.cs +++ b/Projectiles/Melee/Yoyos/ThePlaguebringer.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,84 +8,84 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class ThePlaguebringer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pandemic"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pandemic"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.melee = true; - aiType = 555; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.melee = true; + aiType = 555; + } - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 32f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 32f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.cs b/Projectiles/Melee/Yoyos/VerdantProjectile.cs index 8c63bfad6b..884ca03389 100644 --- a/Projectiles/Melee/Yoyos/VerdantProjectile.cs +++ b/Projectiles/Melee/Yoyos/VerdantProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,89 +8,89 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class VerdantProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Verdant"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Verdant"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Kraken); - projectile.width = 16; - projectile.scale = 1.1f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.melee = true; - aiType = 554; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Kraken); + projectile.width = 16; + projectile.scale = 1.1f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.melee = true; + aiType = 554; + } - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 6f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.NextBool(2)) - { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 227, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } - } - } - } - } + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 6f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.NextBool(2)) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 227, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Melee/Yoyos/YinYo.cs b/Projectiles/Melee/Yoyos/YinYo.cs index 78a6eb1e50..9c1376b98c 100644 --- a/Projectiles/Melee/Yoyos/YinYo.cs +++ b/Projectiles/Melee/Yoyos/YinYo.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,90 +8,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { public class YinYo : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yinyo"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yinyo"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Chik); - projectile.width = 16; - projectile.scale = 0.9f; - projectile.height = 16; - projectile.penetrate = 5; - projectile.melee = true; - aiType = 546; - } + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Chik); + projectile.width = 16; + projectile.scale = 0.9f; + projectile.height = 16; + projectile.penetrate = 5; + projectile.melee = true; + aiType = 546; + } - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 0f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.NextBool(6)) - { - int choice = Main.rand.Next(2); - if (projectile.owner == Main.myPlayer) - { - if (choice == 0) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Dark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Light"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } - } + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 0f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.NextBool(6)) + { + int choice = Main.rand.Next(2); + if (projectile.owner == Main.myPlayer) + { + if (choice == 0) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Dark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Light"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Patreon/Akato.cs b/Projectiles/Patreon/Akato.cs index 7e5c41d66d..7d65712505 100644 --- a/Projectiles/Patreon/Akato.cs +++ b/Projectiles/Patreon/Akato.cs @@ -1,16 +1,16 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Patreon { public class Akato : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Akato"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Akato"); Main.projFrames[projectile.type] = 6; Main.projPet[projectile.type] = true; } diff --git a/Projectiles/Patreon/AngelicBeam.cs b/Projectiles/Patreon/AngelicBeam.cs index 1d44bc0559..1d0e708156 100644 --- a/Projectiles/Patreon/AngelicBeam.cs +++ b/Projectiles/Patreon/AngelicBeam.cs @@ -1,6 +1,4 @@ -using System; -using Terraria; -using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon @@ -47,7 +45,7 @@ namespace CalamityMod.Projectiles.Patreon } // Sparkles "burning off" of the laser beam - if(Main.rand.NextBool()) + if (Main.rand.NextBool()) { int dustType = Main.rand.NextBool() ? 244 : 246; int idx = Dust.NewDust(projectile.position, 1, 1, dustType); diff --git a/Projectiles/Patreon/AtaraxiaHoming.cs b/Projectiles/Patreon/AtaraxiaHoming.cs index 71010a0216..ce0edb3759 100644 --- a/Projectiles/Patreon/AtaraxiaHoming.cs +++ b/Projectiles/Patreon/AtaraxiaHoming.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Patreon private static int IntangibleFrames = 12; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Definitely Not Exoblade"); + { + DisplayName.SetDefault("Definitely Not Exoblade"); Main.projFrames[projectile.type] = NumAnimationFrames; } diff --git a/Projectiles/Patreon/AtaraxiaMain.cs b/Projectiles/Patreon/AtaraxiaMain.cs index 3b2bce45de..08a02bc9cb 100644 --- a/Projectiles/Patreon/AtaraxiaMain.cs +++ b/Projectiles/Patreon/AtaraxiaMain.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Patreon private static int AnimationFrameTime = 9; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Not Exoblade"); + { + DisplayName.SetDefault("Not Exoblade"); Main.projFrames[projectile.type] = NumAnimationFrames; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Patreon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.ShadowFlame, 180); + target.AddBuff(BuffID.ShadowFlame, 180); target.AddBuff(BuffID.Ichor, 180); } @@ -77,13 +77,13 @@ namespace CalamityMod.Projectiles.Patreon projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); - for (int i = 0; i < 50; i++) - { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 86, 0f, 0f, 0, new Color(210, 0, 255), 2.2f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 2.5f; + for (int i = 0; i < 50; i++) + { + int idx = Dust.NewDust(corner, projectile.width, projectile.height, 86, 0f, 0f, 0, new Color(210, 0, 255), 2.2f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 2.5f; - idx = Dust.NewDust(corner, projectile.width, projectile.height, 118, 0f, 0f, 100, new Color(210, 0, 255), 1.8f); + idx = Dust.NewDust(corner, projectile.width, projectile.height, 118, 0f, 0f, 100, new Color(210, 0, 255), 1.8f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 1.8f; @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Patreon Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 4.0f; } - projectile.Damage(); + projectile.Damage(); } } } diff --git a/Projectiles/Patreon/AtaraxiaSide.cs b/Projectiles/Patreon/AtaraxiaSide.cs index 64642babbe..0c80ab3bec 100644 --- a/Projectiles/Patreon/AtaraxiaSide.cs +++ b/Projectiles/Patreon/AtaraxiaSide.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Patreon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Patreon; namespace CalamityMod.Projectiles.Patreon { @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Patreon private static int AnimationFrameTime = 9; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Also Not Exoblade"); + { + DisplayName.SetDefault("Also Not Exoblade"); Main.projFrames[projectile.type] = NumAnimationFrames; } @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Patreon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.ShadowFlame, 180); + target.AddBuff(BuffID.ShadowFlame, 180); target.AddBuff(BuffID.Ichor, 180); } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Patreon for (int i = 0; i < numSplits; ++i) { projVec = projVec.RotatedBy(angleVariance); - if(projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer) Projectile.NewProjectile(projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer, 0.0f, 0.0f); } } diff --git a/Projectiles/Patreon/AtaraxiaSplit.cs b/Projectiles/Patreon/AtaraxiaSplit.cs index c5f36f4bd8..7a900d2800 100644 --- a/Projectiles/Patreon/AtaraxiaSplit.cs +++ b/Projectiles/Patreon/AtaraxiaSplit.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Patreon { public class AtaraxiaSplit : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Still Not Exoblade"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Still Not Exoblade"); + } public override void SetDefaults() { diff --git a/Projectiles/Patreon/CorpusAvertor.cs b/Projectiles/Patreon/CorpusAvertor.cs index b4ac6a95c1..e5224d1bca 100644 --- a/Projectiles/Patreon/CorpusAvertor.cs +++ b/Projectiles/Patreon/CorpusAvertor.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,91 +8,91 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class CorpusAvertor : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } + public override void AI() + { + if (projectile.ai[1] == 1f) + { + projectile.melee = false; + projectile.Calamity().rogue = true; + } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - if (projectile.ai[0] < 120f) - projectile.ai[0] += 1f; + if (projectile.ai[0] < 120f) + projectile.ai[0] += 1f; - if (projectile.ai[0] < 61f) - { - if (projectile.ai[0] % 20f == 0f) - { - Vector2 velocity = new Vector2(projectile.velocity.X, projectile.velocity.Y); - float mult = projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 - velocity *= mult; + if (projectile.ai[0] < 61f) + { + if (projectile.ai[0] % 20f == 0f) + { + Vector2 velocity = new Vector2(projectile.velocity.X, projectile.velocity.Y); + float mult = projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 + velocity *= mult; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, mod.ProjectileType("CorpusAvertorClone"), - (int)((float)projectile.damage * mult), projectile.knockBack * mult, projectile.owner, projectile.ai[0], (projectile.melee ? 0f : 1f)); - } - } - else - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, mod.ProjectileType("CorpusAvertorClone"), + (int)((float)projectile.damage * mult), projectile.knockBack * mult, projectile.owner, projectile.ai[0], (projectile.melee ? 0f : 1f)); + } + } + else + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; - } - } + int scale = (int)((projectile.ai[0] - 60f) * 4.25f); + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.ai[0] >= 61f) - { - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - return new Color(scale, 0, 0, 50); - } - return new Color(0, 0, 0, 50); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.ai[0] >= 61f) + { + int scale = (int)((projectile.ai[0] - 60f) * 4.25f); + return new Color(scale, 0, 0, 50); + } + return new Color(0, 0, 0, 50); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - return; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + return; - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; + float heal = (float)damage * 0.05f; + if ((int)heal == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; - Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; - int owner = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); - } - } + Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; + int owner = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); + } + } } diff --git a/Projectiles/Patreon/CorpusAvertorClone.cs b/Projectiles/Patreon/CorpusAvertorClone.cs index 7ac14dc078..0b755b3e8b 100644 --- a/Projectiles/Patreon/CorpusAvertorClone.cs +++ b/Projectiles/Patreon/CorpusAvertorClone.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,120 +8,120 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class CorpusAvertorClone : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = true; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.melee = true; + projectile.tileCollide = false; + } - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } + public override void AI() + { + if (projectile.ai[1] == 1f) + { + projectile.melee = false; + projectile.Calamity().rogue = true; + } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; - switch ((int)projectile.ai[0]) - { - case 20: - projectile.scale = 0.7f; - break; - case 40: - projectile.scale = 0.8f; - break; - case 60: - projectile.scale = 0.9f; - break; - default: - break; - } - projectile.width = (projectile.height = (int)(24f * projectile.scale)); + switch ((int)projectile.ai[0]) + { + case 20: + projectile.scale = 0.7f; + break; + case 40: + projectile.scale = 0.8f; + break; + case 60: + projectile.scale = 0.9f; + break; + default: + break; + } + projectile.width = (projectile.height = (int)(24f * projectile.scale)); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } - if (flag17) - { - float num483 = 16f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + if (flag17) + { + float num483 = 16f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - return new Color((int)(150f * ((float)projectile.timeLeft / 85f)), 0, 0, (projectile.timeLeft / 5) * 3); - } - return new Color(150, 0, 0, 50); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + return new Color((int)(150f * ((float)projectile.timeLeft / 85f)), 0, 0, (projectile.timeLeft / 5) * 3); + } + return new Color(150, 0, 0, 50); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - return; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + return; - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; + float heal = (float)damage * 0.05f; + if ((int)heal == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; - Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; - int owner = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); - } - } + Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; + int owner = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); + } + } } diff --git a/Projectiles/Patreon/DarkSpark.cs b/Projectiles/Patreon/DarkSpark.cs index 8be1911481..a6576c6ffa 100644 --- a/Projectiles/Patreon/DarkSpark.cs +++ b/Projectiles/Patreon/DarkSpark.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,220 +9,220 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DarkSpark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 22; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 22; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.magic = true; + projectile.ignoreWater = true; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 0f; - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float num26 = 30f; - if (projectile.ai[0] > 360f) - { - num26 = 15f; - } - if (projectile.ai[0] > 480f) - { - num26 = 5f; - } - projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.localAI[1] = 255f; - } - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - bool flag9 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag9 = true; - } - int num27 = 10; - bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag10 = true; - } - if (projectile.ai[1] >= 1f) - { - projectile.ai[1] = 0f; - flag10 = true; - if (Main.myPlayer == projectile.owner) - { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; - if (player.gravDir == -1f) - { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; - } - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) - { - vector11 = -Vector2.UnitY; - } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); - vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector11; - } - } - projectile.frameCounter++; - int num28 = (projectile.ai[0] < 480f) ? 3 : 1; - if (projectile.frameCounter >= num28) - { - projectile.frameCounter = 0; - if (++projectile.frame >= 4) - { - projectile.frame = 0; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item15, projectile.position); - } - } - if (flag10 && Main.myPlayer == projectile.owner) - { - bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); - bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; - if (flag12) - { - if (projectile.ai[0] == 1f) - { - Vector2 center3 = projectile.Center; - Vector2 vector12 = Vector2.Normalize(projectile.velocity); - if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) - { - vector12 = -Vector2.UnitY; - } - int num29 = projectile.damage; - for (int l = 0; l < 7; l++) - { - Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("DarkSparkBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); - } - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 0f; + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float num26 = 30f; + if (projectile.ai[0] > 360f) + { + num26 = 15f; + } + if (projectile.ai[0] > 480f) + { + num26 = 5f; + } + projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); + projectile.ai[0] += 1f; + projectile.ai[1] += 1f; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.localAI[1] = 255f; + } + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + bool flag9 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag9 = true; + } + int num27 = 10; + bool flag10 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag10 = true; + } + if (projectile.ai[1] >= 1f) + { + projectile.ai[1] = 0f; + flag10 = true; + if (Main.myPlayer == projectile.owner) + { + float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value12 = vector; + Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + if (player.gravDir == -1f) + { + value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; + } + Vector2 vector11 = Vector2.Normalize(value13); + if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) + { + vector11 = -Vector2.UnitY; + } + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); + vector11 *= scaleFactor5; + if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector11; + } + } + projectile.frameCounter++; + int num28 = (projectile.ai[0] < 480f) ? 3 : 1; + if (projectile.frameCounter >= num28) + { + projectile.frameCounter = 0; + if (++projectile.frame >= 4) + { + projectile.frame = 0; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num27; + projectile.soundDelay *= 2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item15, projectile.position); + } + } + if (flag10 && Main.myPlayer == projectile.owner) + { + bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); + bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; + if (flag12) + { + if (projectile.ai[0] == 1f) + { + Vector2 center3 = projectile.Center; + Vector2 vector12 = Vector2.Normalize(projectile.velocity); + if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) + { + vector12 = -Vector2.UnitY; + } + int num29 = projectile.damage; + for (int l = 0; l < 7; l++) + { + Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("DarkSparkBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); + } + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Texture2D texture2D14 = Main.projectileTexture[projectile.type]; - int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y7 = num215 * projectile.frame; - Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - float scale5 = 1f; - if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num216 = Main.player[projectile.owner].stealth; - if ((double)num216 < 0.03) - { - num216 = 0.03f; - } - float arg_97B3_0 = (1f + num216 * 10f) / 11f; - color25 *= num216; - scale5 = num216; - } - if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num217 = Main.player[projectile.owner].stealth; - if ((double)num217 < 0.03) - { - num217 = 0.03f; - } - float arg_9854_0 = (1f + num217 * 10f) / 11f; - color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); - scale5 = num217; - } - Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 120f))) * 2f + 2f; - if (projectile.ai[0] > 480f) - { - scaleFactor2 = 4f; - } - for (float num218 = 0f; num218 < 4f; num218 += 1f) - { - Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture2D14 = Main.projectileTexture[projectile.type]; + int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y7 = num215 * projectile.frame; + Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); + float scale5 = 1f; + if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num216 = Main.player[projectile.owner].stealth; + if ((double)num216 < 0.03) + { + num216 = 0.03f; + } + float arg_97B3_0 = (1f + num216 * 10f) / 11f; + color25 *= num216; + scale5 = num216; + } + if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num217 = Main.player[projectile.owner].stealth; + if ((double)num217 < 0.03) + { + num217 = 0.03f; + } + float arg_9854_0 = (1f + num217 * 10f) / 11f; + color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); + scale5 = num217; + } + Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 120f))) * 2f + 2f; + if (projectile.ai[0] > 480f) + { + scaleFactor2 = 4f; + } + for (float num218 = 0f; num218 < 4f; num218 += 1f) + { + Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + } + return false; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.ai[0] < 255f) - return new Color((int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.localAI[1])); - else - return new Color(255, 255, 255, 0); - } - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.ai[0] < 255f) + return new Color((int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.localAI[1])); + else + return new Color(255, 255, 255, 0); + } + } } diff --git a/Projectiles/Patreon/DarkSparkBeam.cs b/Projectiles/Patreon/DarkSparkBeam.cs index 99f5887bec..6ed6860a23 100644 --- a/Projectiles/Patreon/DarkSparkBeam.cs +++ b/Projectiles/Patreon/DarkSparkBeam.cs @@ -1,305 +1,305 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; -using Terraria.ModLoader; using Terraria.Enums; using Terraria.GameContent.Shaders; using Terraria.Graphics.Effects; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DarkSparkBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[1]); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[1] = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { - Vector2? vector71 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - if (projectile.type != mod.ProjectileType("DarkSparkBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("DarkSpark")) - { - projectile.Kill(); - return; - } - float num810 = (float)((int)projectile.ai[0]) - 2.5f; - Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; - float num811 = num810 * 0.5235988f; - Vector2 value37 = Vector2.Zero; - float num812; //0 to 1 - float y; //6 to 20 - float num813; //1.75 to 20 - float scaleFactor6; //-22 to -2 - Color color = new Color(1, 1, 1, 127); - projectile.Opacity = 1f; - if (projectile2.ai[0] < 720f) - { - num812 = 0f + projectile2.ai[0] / 1440f; //0 to 0.5 - y = 6f + projectile2.ai[0] / 720f * 7f; - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - if (projectile2.ai[0] < 480f) - { - num813 = 1.75f/* + 4f * (projectile2.ai[0] / 120f)*/; //20 to 16 - } - else - { - num813 = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); //7.99 to 3.01 - } - scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; - } - else - { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - { - colorLimit = 255f; - } - switch ((int)projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet - break; - } - num812 = 0.5f; //0f, inverted - num813 = 10.875f; //1.75f, inverted - y = 13f; //6f, inverted - scaleFactor6 = -7f; //-2, inverted - } - float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; - num811 = Vector2.UnitY.RotatedBy((double)num814, default).Y * 0.5235988f * num812; - value37 = (Vector2.UnitY.RotatedBy((double)num814, default) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default); - projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); - projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; - projectile.position += value37; - projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default); - projectile.scale = 1.5f * (1.5f - num812); - projectile.damage = projectile2.damage; - double damageMult = 1.0 + (double)(projectile2.ai[0] * 0.0015f); //1 to 2.0 (1400 * x) - if (damageMult > 2.0) - { - damageMult = 2.0; - } - if (projectile2.ai[0] >= 720f) - { - projectile.damage = (int)((double)projectile.damage * damageMult); - vector71 = new Vector2?(projectile2.Center); - } - if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) - { - vector71 = new Vector2?(Main.player[projectile.owner].Center); - } - projectile.friendly = (projectile2.ai[0] > 120f); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - float num818 = projectile.velocity.ToRotation(); - projectile.rotation = num818 - 1.57079637f; - projectile.velocity = num818.ToRotationVector2(); - float num819 = 2f; - float num820 = 0f; - Vector2 samplingPoint = projectile.Center; - if (vector71.HasValue) - { - samplingPoint = vector71.Value; - } - float[] array3 = new float[(int)num819]; - Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); - float num821 = 0f; - for (int num822 = 0; num822 < array3.Length; num822++) - { - num821 += array3[num822]; - } - num821 /= num819; - float amount = 0.75f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); - if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) - { - //color.A = 0; - Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); - for (int num843 = 0; num843 < 2; num843++) - { - float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; - float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; - Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); - int num846 = Dust.NewDust(vector80, 0, 0, 267, vector81.X, vector81.Y, 0, color, 3.3f); //267 - Main.dust[num846].color = color; - Main.dust[num846].scale = 1.2f; - if (projectile.scale > 1f) - { - Main.dust[num846].velocity *= projectile.scale; - Main.dust[num846].scale *= projectile.scale; - } - Main.dust[num846].noGravity = true; - if (projectile.scale != 1.4f) - { - Dust dust9 = Dust.CloneDust(num846); - dust9.color = color; - dust9.scale /= 2f; - dust9.noGravity = true; - } - Main.dust[num846].color = color; - } - if (Main.rand.NextBool(5)) - { - Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); - Main.dust[num847].velocity *= 0.5f; - Main.dust[num847].noGravity = true; - Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); - } - DelegateMethods.v3_1 = color.ToVector3() * 0.3f; - float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); - Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); - float num848 = projectile.velocity.ToRotation(); - if (Main.netMode != NetmodeID.Server) - { - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default), color, size, RippleShape.Square, num848); - } - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - return; - } - } + public override void AI() + { + Vector2? vector71 = null; + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + if (projectile.type != mod.ProjectileType("DarkSparkBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("DarkSpark")) + { + projectile.Kill(); + return; + } + float num810 = (float)((int)projectile.ai[0]) - 2.5f; + Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); + Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + float num811 = num810 * 0.5235988f; + Vector2 value37 = Vector2.Zero; + float num812; //0 to 1 + float y; //6 to 20 + float num813; //1.75 to 20 + float scaleFactor6; //-22 to -2 + Color color = new Color(1, 1, 1, 127); + projectile.Opacity = 1f; + if (projectile2.ai[0] < 720f) + { + num812 = 0f + projectile2.ai[0] / 1440f; //0 to 0.5 + y = 6f + projectile2.ai[0] / 720f * 7f; + if (projectile2.ai[0] > 360f) + { + int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); + color = new Color(colorValue, colorValue, colorValue, 127); + } + if (projectile2.ai[0] < 480f) + { + num813 = 1.75f/* + 4f * (projectile2.ai[0] / 120f)*/; //20 to 16 + } + else + { + num813 = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); //7.99 to 3.01 + } + scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; + } + else + { + float colorLimit = projectile2.ai[0] - 720f; + if (colorLimit > 255f) + { + colorLimit = 255f; + } + switch ((int)projectile.ai[0]) //R O Y G B I V + { + case 0: + color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red + break; + case 1: + color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange + break; + case 2: + color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow + break; + case 3: + color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green + break; + case 4: + color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue + break; + case 5: + color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo + break; + case 6: + color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet + break; + } + num812 = 0.5f; //0f, inverted + num813 = 10.875f; //1.75f, inverted + y = 13f; //6f, inverted + scaleFactor6 = -7f; //-2, inverted + } + float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; + num811 = Vector2.UnitY.RotatedBy((double)num814, default).Y * 0.5235988f * num812; + value37 = (Vector2.UnitY.RotatedBy((double)num814, default) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default); + projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); + projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; + projectile.position += value37; + projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default); + projectile.scale = 1.5f * (1.5f - num812); + projectile.damage = projectile2.damage; + double damageMult = 1.0 + (double)(projectile2.ai[0] * 0.0015f); //1 to 2.0 (1400 * x) + if (damageMult > 2.0) + { + damageMult = 2.0; + } + if (projectile2.ai[0] >= 720f) + { + projectile.damage = (int)((double)projectile.damage * damageMult); + vector71 = new Vector2?(projectile2.Center); + } + if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) + { + vector71 = new Vector2?(Main.player[projectile.owner].Center); + } + projectile.friendly = (projectile2.ai[0] > 120f); + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + float num818 = projectile.velocity.ToRotation(); + projectile.rotation = num818 - 1.57079637f; + projectile.velocity = num818.ToRotationVector2(); + float num819 = 2f; + float num820 = 0f; + Vector2 samplingPoint = projectile.Center; + if (vector71.HasValue) + { + samplingPoint = vector71.Value; + } + float[] array3 = new float[(int)num819]; + Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); + float num821 = 0f; + for (int num822 = 0; num822 < array3.Length; num822++) + { + num821 += array3[num822]; + } + num821 /= num819; + float amount = 0.75f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); + if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) + { + //color.A = 0; + Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); + for (int num843 = 0; num843 < 2; num843++) + { + float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; + Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); + int num846 = Dust.NewDust(vector80, 0, 0, 267, vector81.X, vector81.Y, 0, color, 3.3f); //267 + Main.dust[num846].color = color; + Main.dust[num846].scale = 1.2f; + if (projectile.scale > 1f) + { + Main.dust[num846].velocity *= projectile.scale; + Main.dust[num846].scale *= projectile.scale; + } + Main.dust[num846].noGravity = true; + if (projectile.scale != 1.4f) + { + Dust dust9 = Dust.CloneDust(num846); + dust9.color = color; + dust9.scale /= 2f; + dust9.noGravity = true; + } + Main.dust[num846].color = color; + } + if (Main.rand.NextBool(5)) + { + Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); + Main.dust[num847].velocity *= 0.5f; + Main.dust[num847].noGravity = true; + Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); + } + DelegateMethods.v3_1 = color.ToVector3() * 0.3f; + float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); + Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); + float num848 = projectile.velocity.ToRotation(); + if (Main.netMode != NetmodeID.Server) + { + ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default), color, size, RippleShape.Square, num848); + } + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + return; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - { - return false; - } - Texture2D tex = Main.projectileTexture[projectile.type]; - float num228 = projectile.localAI[1]; - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; - Color color = new Color(1, 1, 1, 127); - if (projectile2.ai[0] < 720f) - { - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - } - else - { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - { - colorLimit = 255f; - } - switch ((int)projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet - break; - } - } - Microsoft.Xna.Framework.Color value25 = color; - //value25.A = 0; - Vector2 value26 = projectile.Center.Floor(); - value26 += projectile.velocity * projectile.scale * 10.5f; - num228 -= projectile.scale * 14.5f * projectile.scale; - Vector2 vector29 = new Vector2(projectile.scale); - DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; - Vector2 projPos = projectile.oldPos[0]; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - DelegateMethods.c_1 = color * 0.75f * projectile.Opacity; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D tex = Main.projectileTexture[projectile.type]; + float num228 = projectile.localAI[1]; + Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + Color color = new Color(1, 1, 1, 127); + if (projectile2.ai[0] < 720f) + { + if (projectile2.ai[0] > 360f) + { + int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); + color = new Color(colorValue, colorValue, colorValue, 127); + } + } + else + { + float colorLimit = projectile2.ai[0] - 720f; + if (colorLimit > 255f) + { + colorLimit = 255f; + } + switch ((int)projectile.ai[0]) //R O Y G B I V + { + case 0: + color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red + break; + case 1: + color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange + break; + case 2: + color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow + break; + case 3: + color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green + break; + case 4: + color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue + break; + case 5: + color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo + break; + case 6: + color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet + break; + } + } + Microsoft.Xna.Framework.Color value25 = color; + //value25.A = 0; + Vector2 value26 = projectile.Center.Floor(); + value26 += projectile.velocity * projectile.scale * 10.5f; + num228 -= projectile.scale * 14.5f * projectile.scale; + Vector2 vector29 = new Vector2(projectile.scale); + DelegateMethods.f_1 = 1f; + DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; + Vector2 projPos = projectile.oldPos[0]; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + DelegateMethods.c_1 = color * 0.75f * projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + return false; + } - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) - { - return true; - } - return false; - } - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } + } } diff --git a/Projectiles/Patreon/DeepSeaDumbbell1.cs b/Projectiles/Patreon/DeepSeaDumbbell1.cs index 8e01a35747..9a3f5f15f2 100644 --- a/Projectiles/Patreon/DeepSeaDumbbell1.cs +++ b/Projectiles/Patreon/DeepSeaDumbbell1.cs @@ -1,117 +1,115 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DeepSeaDumbbell1 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deep Sea Dumbbell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deep Sea Dumbbell"); + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); + public override bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell2"), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell2"), + (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) - { - if (num627 == 1) - { - num628 *= 10f; - num629 *= 10f; - } - else - { - num628 *= -10f; - num629 *= -10f; - } + float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; + int num3; + for (int num627 = 0; num627 < 2; num627 = num3 + 1) + { + if (num627 == 1) + { + num628 *= 10f; + num629 *= 10f; + } + else + { + num628 *= -10f; + num629 *= -10f; + } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), + (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; - } - } + num3 = num627; + } + } - projectile.Kill(); + projectile.Kill(); - return false; - } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.defense > 0) - target.defense -= 15; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.defense > 0) + target.defense -= 15; - target.AddBuff(mod.BuffType("CrushDepth"), 600); + target.AddBuff(mod.BuffType("CrushDepth"), 600); - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + projectile.velocity.X = -projectile.velocity.X; + projectile.velocity.Y = -projectile.velocity.Y; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell2"), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell2"), + (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) - { - if (num627 == 1) - { - num628 *= 10f; - num629 *= 10f; - } - else - { - num628 *= -10f; - num629 *= -10f; - } + float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; + int num3; + for (int num627 = 0; num627 < 2; num627 = num3 + 1) + { + if (num627 == 1) + { + num628 *= 10f; + num629 *= 10f; + } + else + { + num628 *= -10f; + num629 *= -10f; + } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), + (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; - } - } + num3 = num627; + } + } - projectile.Kill(); - } - } + projectile.Kill(); + } + } } diff --git a/Projectiles/Patreon/DeepSeaDumbbell2.cs b/Projectiles/Patreon/DeepSeaDumbbell2.cs index 9c6151b4e6..6a9925b743 100644 --- a/Projectiles/Patreon/DeepSeaDumbbell2.cs +++ b/Projectiles/Patreon/DeepSeaDumbbell2.cs @@ -1,158 +1,156 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DeepSeaDumbbell2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deep Sea Dumbbell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deep Sea Dumbbell"); + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - if (projectile.ai[0] < 60f) - projectile.ai[0] += 1f; - else - { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; + public override void AI() + { + if (projectile.ai[0] < 60f) + projectile.ai[0] += 1f; + else + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; - } + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); + public override bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell3"), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell3"), + (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) - { - if (num627 == 1) - { - num628 *= 10f; - num629 *= 10f; - } - else - { - num628 *= -10f; - num629 *= -10f; - } + float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; + int num3; + for (int num627 = 0; num627 < 2; num627 = num3 + 1) + { + if (num627 == 1) + { + num628 *= 10f; + num629 *= 10f; + } + else + { + num628 *= -10f; + num629 *= -10f; + } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), + (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; - } - } + num3 = num627; + } + } - projectile.Kill(); + projectile.Kill(); - return false; - } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.defense > 0) - target.defense -= 15; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.defense > 0) + target.defense -= 15; - target.AddBuff(mod.BuffType("CrushDepth"), 600); + target.AddBuff(mod.BuffType("CrushDepth"), 600); - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + projectile.velocity.X = -projectile.velocity.X; + projectile.velocity.Y = -projectile.velocity.Y; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell3"), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("DeepSeaDumbbell3"), + (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) - { - if (num627 == 1) - { - num628 *= 10f; - num629 *= 10f; - } - else - { - num628 *= -10f; - num629 *= -10f; - } + float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; + int num3; + for (int num627 = 0; num627 < 2; num627 = num3 + 1) + { + if (num627 == 1) + { + num628 *= 10f; + num629 *= 10f; + } + else + { + num628 *= -10f; + num629 *= -10f; + } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), + (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; - } - } + num3 = num627; + } + } - projectile.Kill(); - } - } + projectile.Kill(); + } + } } diff --git a/Projectiles/Patreon/DeepSeaDumbbell3.cs b/Projectiles/Patreon/DeepSeaDumbbell3.cs index 39a168bccc..8ee5d37574 100644 --- a/Projectiles/Patreon/DeepSeaDumbbell3.cs +++ b/Projectiles/Patreon/DeepSeaDumbbell3.cs @@ -1,144 +1,142 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DeepSeaDumbbell3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deep Sea Dumbbell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deep Sea Dumbbell"); + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - if (projectile.ai[0] < 60f) - projectile.ai[0] += 1f; - else - { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; + public override void AI() + { + if (projectile.ai[0] < 60f) + projectile.ai[0] += 1f; + else + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; - } + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); + public override bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); - if (projectile.owner == Main.myPlayer) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) - { - if (num627 == 1) - { - num628 *= 10f; - num629 *= 10f; - } - else - { - num628 *= -10f; - num629 *= -10f; - } + if (projectile.owner == Main.myPlayer) + { + float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; + int num3; + for (int num627 = 0; num627 < 2; num627 = num3 + 1) + { + if (num627 == 1) + { + num628 *= 10f; + num629 *= 10f; + } + else + { + num628 *= -10f; + num629 *= -10f; + } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), + (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; - } - } + num3 = num627; + } + } - projectile.Kill(); + projectile.Kill(); - return false; - } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.defense > 0) - target.defense -= 15; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.defense > 0) + target.defense -= 15; - target.AddBuff(mod.BuffType("CrushDepth"), 600); + target.AddBuff(mod.BuffType("CrushDepth"), 600); - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); - if (projectile.owner == Main.myPlayer) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) - { - if (num627 == 1) - { - num628 *= 10f; - num629 *= 10f; - } - else - { - num628 *= -10f; - num629 *= -10f; - } + if (projectile.owner == Main.myPlayer) + { + float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; + int num3; + for (int num627 = 0; num627 < 2; num627 = num3 + 1) + { + if (num627 == 1) + { + num628 *= 10f; + num629 *= 10f; + } + else + { + num628 *= -10f; + num629 *= -10f; + } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("DeepSeaDumbbellWeight"), + (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; - } - } + num3 = num627; + } + } - projectile.Kill(); - } - } + projectile.Kill(); + } + } } diff --git a/Projectiles/Patreon/DeepSeaDumbbellWeight.cs b/Projectiles/Patreon/DeepSeaDumbbellWeight.cs index b1d168f5fd..09e24ffeaa 100644 --- a/Projectiles/Patreon/DeepSeaDumbbellWeight.cs +++ b/Projectiles/Patreon/DeepSeaDumbbellWeight.cs @@ -1,69 +1,67 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DeepSeaDumbbellWeight : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deep Sea Dumbbell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deep Sea Dumbbell"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.99f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.99f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 36); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 36); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.25f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X, vector7.Y, 100, default, 1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.25f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X, vector7.Y, 100, default, 1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } - projectile.Damage(); - } + projectile.Damage(); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.defense > 0) - target.defense -= 15; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.defense > 0) + target.defense -= 15; - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - } + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + } } diff --git a/Projectiles/Patreon/DevilsSunrise.cs b/Projectiles/Patreon/DevilsSunrise.cs index b8bdc53211..aa693e17a9 100644 --- a/Projectiles/Patreon/DevilsSunrise.cs +++ b/Projectiles/Patreon/DevilsSunrise.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,14 +8,14 @@ namespace CalamityMod.Projectiles.Patreon { public class DevilsSunrise : ModProjectile { - private int red; - private int greenAndBlue = 100; + private int red; + private int greenAndBlue = 100; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devil's Sunrise"); - Main.projFrames[projectile.type] = 28; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devil's Sunrise"); + Main.projFrames[projectile.type] = 28; + } public override void SetDefaults() { @@ -27,92 +27,92 @@ namespace CalamityMod.Projectiles.Patreon projectile.melee = true; projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.Calamity().trueMelee = true; - } + projectile.localNPCHitCooldown = 5; + projectile.Calamity().trueMelee = true; + } public override void AI() { - if (projectile.ai[1] < 255f) - projectile.ai[1] += 1f; + if (projectile.ai[1] < 255f) + projectile.ai[1] += 1f; - if (projectile.ai[1] == 255f) - projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); + if (projectile.ai[1] == 255f) + projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); - red = 64 + (int)(projectile.ai[1] * 0.75f); - if (red > 255) - red = 255; + red = 64 + (int)(projectile.ai[1] * 0.75f); + if (red > 255) + red = 255; - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - num = 3.14159274f; + if (projectile.spriteDirection == -1) + num = 3.14159274f; - if (++projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (++projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; - projectile.soundDelay--; - if (projectile.soundDelay <= 0) - { - Main.PlaySound(SoundID.Item15, projectile.Center); - projectile.soundDelay = 24; - } + projectile.soundDelay--; + if (projectile.soundDelay <= 0) + { + Main.PlaySound(SoundID.Item15, projectile.Center); + projectile.soundDelay = 24; + } - if (Main.myPlayer == projectile.owner) - { - if (player.channel && !player.noItems && !player.CCed) - { - float scaleFactor6 = 1f; + if (Main.myPlayer == projectile.owner) + { + if (player.channel && !player.noItems && !player.CCed) + { + float scaleFactor6 = 1f; - if (player.inventory[player.selectedItem].shoot == projectile.type) - scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + if (player.inventory[player.selectedItem].shoot == projectile.type) + scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector13 = Main.MouseWorld - vector; - vector13.Normalize(); - if (vector13.HasNaNs()) - vector13 = Vector2.UnitX * (float)player.direction; + Vector2 vector13 = Main.MouseWorld - vector; + vector13.Normalize(); + if (vector13.HasNaNs()) + vector13 = Vector2.UnitX * (float)player.direction; - vector13 *= scaleFactor6; - if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) - projectile.netUpdate = true; + vector13 *= scaleFactor6; + if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) + projectile.netUpdate = true; - projectile.velocity = vector13; - } - else - projectile.Kill(); - } + projectile.velocity = vector13; + } + else + projectile.Kill(); + } - Vector2 vector14 = projectile.Center + projectile.velocity * 3f; - Lighting.AddLight(vector14, (float)((double)red * 0.001), 0.1f, 0.1f); + Vector2 vector14 = projectile.Center + projectile.velocity * 3f; + Lighting.AddLight(vector14, (float)((double)red * 0.001), 0.1f, 0.1f); - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position -= projectile.velocity; - } + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position -= projectile.velocity; + } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(red, greenAndBlue, greenAndBlue, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(red, greenAndBlue, greenAndBlue, projectile.alpha); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } } diff --git a/Projectiles/Patreon/DevilsSunriseCyclone.cs b/Projectiles/Patreon/DevilsSunriseCyclone.cs index 566ed2f4a4..af6615c1a3 100644 --- a/Projectiles/Patreon/DevilsSunriseCyclone.cs +++ b/Projectiles/Patreon/DevilsSunriseCyclone.cs @@ -8,224 +8,224 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DevilsSunriseCyclone : ModProjectile - { - private int red = 0; - private int greenAndBlue = 100; + { + private int red = 0; + private int greenAndBlue = 100; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devil's Sunrise"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devil's Sunrise"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } - public override void AI() - { - if (projectile.ai[1] < 510f && projectile.ai[1] != -1f) - projectile.ai[1] += 1f; + public override void AI() + { + if (projectile.ai[1] < 510f && projectile.ai[1] != -1f) + projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - if (!Main.player[projectile.owner].channel) - { - projectile.ai[1] = -1f; - projectile.damage = projectile.Calamity().defDamage; - } - } + if (Main.myPlayer == projectile.owner) + { + if (!Main.player[projectile.owner].channel) + { + projectile.ai[1] = -1f; + projectile.damage = projectile.Calamity().defDamage; + } + } - if (projectile.ai[1] >= 255f) - projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); + if (projectile.ai[1] >= 255f) + projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); - red = 64 + (int)(projectile.ai[1] * 0.75f); - if (red > 255) - red = 255; + red = 64 + (int)(projectile.ai[1] * 0.75f); + if (red > 255) + red = 255; - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); - Main.dust[dust].velocity *= 0.3f; - Main.dust[dust].noGravity = true; + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].noGravity = true; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float x = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float distanceFromOwner = (float)Math.Sqrt((double)(x * x + y * y)); + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float x = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float distanceFromOwner = (float)Math.Sqrt((double)(x * x + y * y)); - float speed = 25f; - if (distanceFromOwner > 300f) - speed -= (distanceFromOwner - 300f) * 0.5f; // 350 units is about the max distance before traveling back or stopping - if (speed < 2f) - speed = 2f; + float speed = 25f; + if (distanceFromOwner > 300f) + speed -= (distanceFromOwner - 300f) * 0.5f; // 350 units is about the max distance before traveling back or stopping + if (speed < 2f) + speed = 2f; - if (speed <= 2f || projectile.ai[1] >= 510f || projectile.ai[1] == -1f) - { - float returnSpeedMax = 30f; - float returnSpeed = 6f; - distanceFromOwner = returnSpeedMax / distanceFromOwner; - x *= distanceFromOwner; - y *= distanceFromOwner; + if (speed <= 2f || projectile.ai[1] >= 510f || projectile.ai[1] == -1f) + { + float returnSpeedMax = 30f; + float returnSpeed = 6f; + distanceFromOwner = returnSpeedMax / distanceFromOwner; + x *= distanceFromOwner; + y *= distanceFromOwner; - if (projectile.velocity.X < x) - { - projectile.velocity.X = projectile.velocity.X + returnSpeed; - if (projectile.velocity.X < 0f && x > 0f) - projectile.velocity.X = projectile.velocity.X + returnSpeed; - } - else if (projectile.velocity.X > x) - { - projectile.velocity.X = projectile.velocity.X - returnSpeed; - if (projectile.velocity.X > 0f && x < 0f) - projectile.velocity.X = projectile.velocity.X - returnSpeed; - } - if (projectile.velocity.Y < y) - { - projectile.velocity.Y = projectile.velocity.Y + returnSpeed; - if (projectile.velocity.Y < 0f && y > 0f) - projectile.velocity.Y = projectile.velocity.Y + returnSpeed; - } - else if (projectile.velocity.Y > y) - { - projectile.velocity.Y = projectile.velocity.Y - returnSpeed; - if (projectile.velocity.Y > 0f && y < 0f) - projectile.velocity.Y = projectile.velocity.Y - returnSpeed; - } + if (projectile.velocity.X < x) + { + projectile.velocity.X = projectile.velocity.X + returnSpeed; + if (projectile.velocity.X < 0f && x > 0f) + projectile.velocity.X = projectile.velocity.X + returnSpeed; + } + else if (projectile.velocity.X > x) + { + projectile.velocity.X = projectile.velocity.X - returnSpeed; + if (projectile.velocity.X > 0f && x < 0f) + projectile.velocity.X = projectile.velocity.X - returnSpeed; + } + if (projectile.velocity.Y < y) + { + projectile.velocity.Y = projectile.velocity.Y + returnSpeed; + if (projectile.velocity.Y < 0f && y > 0f) + projectile.velocity.Y = projectile.velocity.Y + returnSpeed; + } + else if (projectile.velocity.Y > y) + { + projectile.velocity.Y = projectile.velocity.Y - returnSpeed; + if (projectile.velocity.Y > 0f && y < 0f) + projectile.velocity.Y = projectile.velocity.Y - returnSpeed; + } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - projectile.Kill(); - } - } - else if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) - { - if (Main.player[projectile.owner].channel) - { - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + projectile.Kill(); + } + } + else if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + { + if (Main.player[projectile.owner].channel) + { + Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; + float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + if (Main.player[projectile.owner].gravDir == -1f) + num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - if (projectile.ai[0] < 0f) - projectile.ai[0] += 1f; + if (projectile.ai[0] < 0f) + projectile.ai[0] += 1f; - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > speed) - { - num118 = speed / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); + float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + if (num118 > speed) + { + num118 = speed / num118; + num116 *= num118; + num117 *= num118; + int num119 = (int)(num116 * 1000f); + int num120 = (int)(projectile.velocity.X * 1000f); + int num121 = (int)(num117 * 1000f); + int num122 = (int)(projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) - projectile.netUpdate = true; + if (num119 != num120 || num121 != num122) + projectile.netUpdate = true; - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - else - { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + else + { + int num123 = (int)(num116 * 1000f); + int num124 = (int)(projectile.velocity.X * 1000f); + int num125 = (int)(num117 * 1000f); + int num126 = (int)(projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) - projectile.netUpdate = true; + if (num123 != num124 || num125 != num126) + projectile.netUpdate = true; - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - } - else if (projectile.ai[0] <= 0f) - { - projectile.netUpdate = true; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + } + else if (projectile.ai[0] <= 0f) + { + projectile.netUpdate = true; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + if (Main.player[projectile.owner].gravDir == -1f) + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) - { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f || projectile.ai[0] < 0f) + { + vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } - num130 = speed / num130; - num128 *= num130; - num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; + num130 = speed / num130; + num128 *= num130; + num129 *= num130; + projectile.velocity.X = num128; + projectile.velocity.Y = num129; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - projectile.Kill(); + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + projectile.Kill(); - projectile.ai[0] = 1f; - } - } + projectile.ai[0] = 1f; + } + } - Lighting.AddLight(projectile.Center, (float)((double)red * 0.001), 0.1f, 0.1f); + Lighting.AddLight(projectile.Center, (float)((double)red * 0.001), 0.1f, 0.1f); - projectile.rotation += 0.5f; - } + projectile.rotation += 0.5f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(red, greenAndBlue, greenAndBlue, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(red, greenAndBlue, greenAndBlue, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 88); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 66, vector7.X, vector7.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 88); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 66, vector7.X, vector7.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } } diff --git a/Projectiles/Patreon/DivineRetribution.cs b/Projectiles/Patreon/DivineRetribution.cs index 809a1889ae..85e0ca8379 100644 --- a/Projectiles/Patreon/DivineRetribution.cs +++ b/Projectiles/Patreon/DivineRetribution.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,135 +8,135 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class DivineRetribution : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Divine Retribution"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Divine Retribution"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 420; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 420; + } - public override void AI() - { - float num953 = 25f * projectile.ai[1]; //100 - float scaleFactor12 = 5f * projectile.ai[1]; //5 - float num954 = 1000f; - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 9f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } + public override void AI() + { + float num953 = 25f * projectile.ai[1]; //100 + float scaleFactor12 = 5f * projectile.ai[1]; //5 + float num954 = 1000f; + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 9f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - target.AddBuff(mod.BuffType("HolyLight"), 600); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + target.AddBuff(mod.BuffType("HolyLight"), 600); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 74, 1f, 0f); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); - } - for (int num194 = 0; num194 < 10; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 74, 1f, 0f); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + } + for (int num194 = 0; num194 < 10; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } diff --git a/Projectiles/Patreon/DraconicSpark.cs b/Projectiles/Patreon/DraconicSpark.cs index d4e76027d4..204315c198 100644 --- a/Projectiles/Patreon/DraconicSpark.cs +++ b/Projectiles/Patreon/DraconicSpark.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -85,16 +85,16 @@ namespace CalamityMod.Projectiles.Patreon { if (projectile.ai[0] == 0f) target.AddBuff(BuffID.Daybreak, 180); - else if(projectile.ai[0] == 1f) + else if (projectile.ai[0] == 1f) target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - else if(projectile.ai[0] == 2f) + else if (projectile.ai[0] == 2f) target.AddBuff(mod.BuffType("HolyLight"), 180); } // Pure dust projectile, but dust used depends on AI variables private void DrawProjectile() { - if(projectile.ai[0] == 0) // daybroken spark + if (projectile.ai[0] == 0) // daybroken spark { int dustID = 244; if (Main.rand.Next(3) != 0) @@ -105,10 +105,10 @@ namespace CalamityMod.Projectiles.Patreon Main.dust[idx].velocity += projectile.velocity * 0.1f; } } - else if(projectile.ai[0] == 1) // abyssal flames spark + else if (projectile.ai[0] == 1) // abyssal flames spark { int dustID = 235; - if(Main.rand.Next(3) != 0) + if (Main.rand.Next(3) != 0) { float scale = Main.rand.NextFloat(0.6f, 1.2f); int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, default, scale); @@ -116,10 +116,10 @@ namespace CalamityMod.Projectiles.Patreon Main.dust[idx].velocity += projectile.velocity * 0.1f; } } - else if(projectile.ai[0] == 2) // holy flames spark + else if (projectile.ai[0] == 2) // holy flames spark { int dustID = 246; - if(Main.rand.Next(3) != 0) + if (Main.rand.Next(3) != 0) { float scale = Main.rand.NextFloat(0.8f, 1.4f); int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID); diff --git a/Projectiles/Patreon/DragonPowFlail.cs b/Projectiles/Patreon/DragonPowFlail.cs index 20943d7163..3d9709e315 100644 --- a/Projectiles/Patreon/DragonPowFlail.cs +++ b/Projectiles/Patreon/DragonPowFlail.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.Items.Patreon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Patreon; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Patreon { @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Patreon vel += projectile.velocity * 0.05f; float sparkVariety = Main.rand.Next(3); - if(projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer) Projectile.NewProjectile(projectile.Center, vel, type, damage, kb, projectile.owner, sparkVariety, 0f); } } @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Patreon int waterfallDamage = DragonPow.BaseDamage / 6; float waterfallKB = 0f; Player owner = Main.player[projectile.owner]; - for(int i = 0; i < numWaterfalls; ++i) + for (int i = 0; i < numWaterfalls; ++i) { float startOffsetX = Main.rand.NextFloat(-120f, 120f); float startOffsetY = Main.rand.NextFloat(-740f, -700f); diff --git a/Projectiles/Patreon/HandheldTankShell.cs b/Projectiles/Patreon/HandheldTankShell.cs index 6aa09e9c7b..b2146dac4f 100644 --- a/Projectiles/Patreon/HandheldTankShell.cs +++ b/Projectiles/Patreon/HandheldTankShell.cs @@ -6,153 +6,159 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class HandheldTankShell : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tank Shell"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tank Shell"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 11; - projectile.timeLeft = 1800; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.extraUpdates = 11; + projectile.timeLeft = 1800; + } - public override void AI() - { - drawOffsetX = -8; - drawOriginOffsetY = 0; - drawOriginOffsetX = -2; - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 pos = projectile.Center; - projectile.localAI[0] += 1f; + public override void AI() + { + drawOffsetX = -8; + drawOriginOffsetY = 0; + drawOriginOffsetX = -2; + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 pos = projectile.Center; + projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 7f) // projectile has had more than 8 updates, draw fire trail - { - for (int i = 0; i < 5; ++i) - { - pos -= projectile.velocity * ((float)i * 0.25f); - int idx = Dust.NewDust(pos, 1, 1, 158, 0f, 0f, 0, default, 1f); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = pos; - Main.dust[idx].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[idx].velocity *= 0.3f; - } - return; - } - else // projectile has had less than 8 updates, draw smoke - { - for (int i = 0; i < 30; ++i) - { - // Pick a random type of smoke (there's a little fire mixed in) - int dustID = -1; - switch (Main.rand.Next(6)) - { - case 0: dustID = 55; break; - case 1: - case 2: dustID = 54; break; - default: dustID = 53; break; - } + if (projectile.localAI[0] > 7f) // projectile has had more than 8 updates, draw fire trail + { + for (int i = 0; i < 5; ++i) + { + pos -= projectile.velocity * ((float)i * 0.25f); + int idx = Dust.NewDust(pos, 1, 1, 158, 0f, 0f, 0, default, 1f); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = pos; + Main.dust[idx].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[idx].velocity *= 0.3f; + } + return; + } + else // projectile has had less than 8 updates, draw smoke + { + for (int i = 0; i < 30; ++i) + { + // Pick a random type of smoke (there's a little fire mixed in) + int dustID = -1; + switch (Main.rand.Next(6)) + { + case 0: + dustID = 55; + break; + case 1: + case 2: + dustID = 54; + break; + default: + dustID = 53; + break; + } - // Choose a random speed and angle to belch out the smoke - float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + // Choose a random speed and angle to belch out the smoke + float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - // Pick a size for the smoke particle - float scale = Main.rand.NextFloat(0.5f, 1.6f); + // Pick a size for the smoke particle + float scale = Main.rand.NextFloat(0.5f, 1.6f); - // Actually spawn the smoke - int idx = Dust.NewDust(pos, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = pos; - } - } - } + // Actually spawn the smoke + int idx = Dust.NewDust(pos, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = pos; + } + } + } - public override void Kill(int timeLeft) - { - // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion - Main.PlaySound(SoundID.Item62, projectile.Center); - Main.PlaySound(SoundID.Item88, projectile.Center); + public override void Kill(int timeLeft) + { + // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion + Main.PlaySound(SoundID.Item62, projectile.Center); + Main.PlaySound(SoundID.Item88, projectile.Center); - // Transform the projectile's hitbox into a big explosion - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + // Transform the projectile's hitbox into a big explosion + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - // Spawn explosion dust (separate method because it's messy) - SpawnExplosionDust(); + // Spawn explosion dust (separate method because it's messy) + SpawnExplosionDust(); - // Make the explosion cause damage to nearby targets (makes projectile hit twice) - projectile.Damage(); - } + // Make the explosion cause damage to nearby targets (makes projectile hit twice) + projectile.Damage(); + } - // Dust copied from Rocket III - void SpawnExplosionDust() - { - // Sparks and such - Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); - for (int i = 0; i < 40; i++) - { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int i = 0; i < 70; i++) - { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 2f; - } + // Dust copied from Rocket III + void SpawnExplosionDust() + { + // Sparks and such + Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); + for (int i = 0; i < 40; i++) + { + int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int i = 0; i < 70; i++) + { + int idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 5f; + idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 2f; + } - // Smoke, which counts as a Gore - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); - for (int i = 0; i < 3; i++) - { - float smokeScale = 0.33f; - if (i == 1) - { - smokeScale = 0.66f; - } - if (i == 2) - { - smokeScale = 1f; - } - int idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y += 1f; + // Smoke, which counts as a Gore + Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); + for (int i = 0; i < 3; i++) + { + float smokeScale = 0.33f; + if (i == 1) + { + smokeScale = 0.66f; + } + if (i == 2) + { + smokeScale = 1f; + } + int idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X += 1f; + Main.gore[idx].velocity.Y += 1f; - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y += 1f; + idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X -= 1f; + Main.gore[idx].velocity.Y += 1f; - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y -= 1f; + idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X += 1f; + Main.gore[idx].velocity.Y -= 1f; - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y -= 1f; - } - } - } + idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X -= 1f; + Main.gore[idx].velocity.Y -= 1f; + } + } + } } diff --git a/Projectiles/Patreon/IlluminatedBullet.cs b/Projectiles/Patreon/IlluminatedBullet.cs index e175588a3a..1687ade05e 100644 --- a/Projectiles/Patreon/IlluminatedBullet.cs +++ b/Projectiles/Patreon/IlluminatedBullet.cs @@ -1,7 +1,6 @@ -using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon diff --git a/Projectiles/Patreon/KarasawaShot.cs b/Projectiles/Patreon/KarasawaShot.cs index f488f80c0f..1f3114d83e 100644 --- a/Projectiles/Patreon/KarasawaShot.cs +++ b/Projectiles/Patreon/KarasawaShot.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,13 +8,13 @@ namespace CalamityMod.Projectiles.Patreon { public class KarasawaShot : ModProjectile { - private int dust1 = 187; //160 - private int dust2 = 229; //187 + private int dust1 = 187; //160 + private int dust2 = 229; //187 - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Karasawa Shot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Karasawa Shot"); + } public override void SetDefaults() { @@ -26,164 +26,164 @@ namespace CalamityMod.Projectiles.Patreon projectile.penetrate = -1; projectile.extraUpdates = 100; projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); - int dustTypeOnTimer = dust1; + int dustTypeOnTimer = dust1; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 15f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) - { - projectile.ai[0] = 0f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 15f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] == 48f) + { + projectile.ai[0] = 0f; - if (dustTypeOnTimer == dust1) - dustTypeOnTimer = dust2; - else - dustTypeOnTimer = dust1; - } - else - { - Vector2 value7 = new Vector2(5f, 10f); + if (dustTypeOnTimer == dust1) + dustTypeOnTimer = dust2; + else + dustTypeOnTimer = dust1; + } + else + { + Vector2 value7 = new Vector2(5f, 10f); - for (int num41 = 0; num41 < 2; num41++) - { - int dustType = (num41 == 0 ? dust1 : dust2); - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 1.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 0.75f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - } - } - } + for (int num41 = 0; num41 < 2; num41++) + { + int dustType = (num41 == 0 ? dust1 : dust2); + Vector2 value8 = Vector2.UnitX * -12f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 1.5f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = 0.75f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + } - if (projectile.localAI[0] == 15f) - { - float angleRandom = 0.1f; + if (projectile.localAI[0] == 15f) + { + float angleRandom = 0.1f; - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = (Main.rand.NextBool(2) ? dust1 : dust2); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = (Main.rand.NextBool(2) ? dust1 : dust2); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= (randomDustType == dust2 ? 2f : 4f); - dust = Main.dust[num54]; + Dust dust = Main.dust[num54]; + dust.velocity *= (randomDustType == dust2 ? 2f : 4f); + dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= (randomDustType == dust2 ? 1.33f : 2.66f); + dust = Main.dust[num54]; + dust.velocity *= (randomDustType == dust2 ? 1.33f : 2.66f); - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Blue * 0.5f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Blue * 0.5f; - dust = Main.dust[num54]; + dust = Main.dust[num54]; - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = (Main.rand.NextBool(2) ? dust1 : dust2); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = (Main.rand.NextBool(2) ? dust1 : dust2); - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= (randomDustType == dust2 ? 0.33f : 0.66f); - dust = Main.dust[num56]; + Dust dust = Main.dust[num56]; + dust.velocity *= (randomDustType == dust2 ? 0.33f : 0.66f); + dust = Main.dust[num56]; - num3 = num55; - } - } - } + num3 = num55; + } + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Confused, 300); - target.AddBuff(mod.BuffType("Irradiated"), 300); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Confused, 300); + target.AddBuff(mod.BuffType("Irradiated"), 300); } - public override void Kill(int timeLeft) - { - int height = 150; + public override void Kill(int timeLeft) + { + int height = 150; - Main.PlaySound(SoundID.NPCDeath43, projectile.Center); + Main.PlaySound(SoundID.NPCDeath43, projectile.Center); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) // 108 dusts - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.3f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) // 108 dusts + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.3f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? dust1 : dust2), vector7.X * 0.3f, vector7.Y * 0.3f, 100, default, 2f); - Main.dust[num228].noGravity = true; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? dust1 : dust2), vector7.X * 0.3f, vector7.Y * 0.3f, 100, default, 2f); + Main.dust[num228].noGravity = true; - int num229 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? dust1 : dust2), vector7.X * 0.2f, vector7.Y * 0.2f, 100, default, 2f); - Main.dust[num229].noGravity = true; + int num229 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? dust1 : dust2), vector7.X * 0.2f, vector7.Y * 0.2f, 100, default, 2f); + Main.dust[num229].noGravity = true; - int num230 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? dust1 : dust2), vector7.X * 0.1f, vector7.Y * 0.1f, 100, default, 2f); - Main.dust[num230].noGravity = true; - } + int num230 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? dust1 : dust2), vector7.X * 0.1f, vector7.Y * 0.1f, 100, default, 2f); + Main.dust[num230].noGravity = true; + } - bool random = Main.rand.NextBool(); - float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); - for (float angle = 0f; angle < MathHelper.TwoPi; angle += 0.05f) // 125 dusts - { - random = !random; - Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(projectile.Center, random ? dust1 : dust2, velocity); - d.noGravity = true; - d.customData = 0.025f; - d.scale = 2f; - } - } - } + bool random = Main.rand.NextBool(); + float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); + for (float angle = 0f; angle < MathHelper.TwoPi; angle += 0.05f) // 125 dusts + { + random = !random; + Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); + Dust d = Dust.NewDustPerfect(projectile.Center, random ? dust1 : dust2, velocity); + d.noGravity = true; + d.customData = 0.025f; + d.scale = 2f; + } + } + } } diff --git a/Projectiles/Patreon/KeelhaulBubble.cs b/Projectiles/Patreon/KeelhaulBubble.cs index 28f4e63a8e..1e9851c8c1 100644 --- a/Projectiles/Patreon/KeelhaulBubble.cs +++ b/Projectiles/Patreon/KeelhaulBubble.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Patreon { public class KeelhaulBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } public override void SetDefaults() { @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Patreon public override void Kill(int timeLeft) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserBottom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserTop"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserBottom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserTop"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Patreon/KeelhaulGeyserBottom.cs b/Projectiles/Patreon/KeelhaulGeyserBottom.cs index d5fda637de..b29d92c68d 100644 --- a/Projectiles/Patreon/KeelhaulGeyserBottom.cs +++ b/Projectiles/Patreon/KeelhaulGeyserBottom.cs @@ -5,11 +5,11 @@ namespace CalamityMod.Projectiles.Patreon { public class KeelhaulGeyserBottom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Geyser"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Geyser"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -18,26 +18,26 @@ namespace CalamityMod.Projectiles.Patreon projectile.friendly = true; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = -1; + projectile.magic = true; + projectile.penetrate = -1; projectile.timeLeft = 360; - projectile.alpha = 90; + projectile.alpha = 90; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } } } } diff --git a/Projectiles/Patreon/KeelhaulGeyserTop.cs b/Projectiles/Patreon/KeelhaulGeyserTop.cs index c057518cbd..889c2e1756 100644 --- a/Projectiles/Patreon/KeelhaulGeyserTop.cs +++ b/Projectiles/Patreon/KeelhaulGeyserTop.cs @@ -5,11 +5,11 @@ namespace CalamityMod.Projectiles.Patreon { public class KeelhaulGeyserTop : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Geyser"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Geyser"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -18,26 +18,26 @@ namespace CalamityMod.Projectiles.Patreon projectile.friendly = true; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.magic = true; + projectile.magic = true; projectile.penetrate = -1; projectile.timeLeft = 360; - projectile.alpha = 90; + projectile.alpha = 90; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + projectile.localNPCHitCooldown = 20; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } } } } diff --git a/Projectiles/Patreon/KelvinCatalyst.cs b/Projectiles/Patreon/KelvinCatalyst.cs index 8d3933a9da..d6e2532158 100644 --- a/Projectiles/Patreon/KelvinCatalyst.cs +++ b/Projectiles/Patreon/KelvinCatalyst.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +10,12 @@ namespace CalamityMod.Projectiles.Patreon { public class KelvinCatalyst : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kelvin Catalyst"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -24,126 +24,126 @@ namespace CalamityMod.Projectiles.Patreon projectile.friendly = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - projectile.melee = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.3f) / 255f, (Main.DiscoR * 0.4f) / 255f, (Main.DiscoR * 0.5f) / 255f); - - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 75f) - { - projectile.ai[0] = 1f; - projectile.localAI[0] = 0f; - projectile.width = (projectile.height = 60); - projectile.tileCollide = false; - projectile.netUpdate = true; - } - } - else - { - float num42 = 20f; - float num43 = 2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - - if (num46 > 3000f) - projectile.Kill(); - - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - projectile.velocity.X = projectile.velocity.X + num43; - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - projectile.velocity.X = projectile.velocity.X - num43; - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - projectile.velocity.Y = projectile.velocity.Y + num43; - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - projectile.velocity.Y = projectile.velocity.Y - num43; - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - projectile.Kill(); - } - } - - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0f; - - projectile.rotation += 0.25f; + projectile.melee = true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.ai[0] = 1f; - projectile.localAI[0] = 0f; - projectile.width = (projectile.height = 60); - projectile.tileCollide = false; - projectile.netUpdate = true; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void SendExtraAI(BinaryWriter writer) { - target.AddBuff(BuffID.Frostburn, 240); - if (projectile.owner == Main.myPlayer) - { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.3f) / 255f, (Main.DiscoR * 0.4f) / 255f, (Main.DiscoR * 0.5f) / 255f); + + if (projectile.ai[1] == 1f) + { + projectile.melee = false; + projectile.Calamity().rogue = true; + } + + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 75f) + { + projectile.ai[0] = 1f; + projectile.localAI[0] = 0f; + projectile.width = (projectile.height = 60); + projectile.tileCollide = false; + projectile.netUpdate = true; + } + } + else + { + float num42 = 20f; + float num43 = 2f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + + if (num46 > 3000f) + projectile.Kill(); + + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + projectile.velocity.X = projectile.velocity.X + num43; + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + projectile.velocity.X = projectile.velocity.X - num43; + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + projectile.velocity.Y = projectile.velocity.Y + num43; + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + projectile.velocity.Y = projectile.velocity.Y - num43; + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + projectile.Kill(); + } + } + + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + + projectile.rotation += 0.25f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[0] = 1f; + projectile.localAI[0] = 0f; + projectile.width = (projectile.height = 60); + projectile.tileCollide = false; + projectile.netUpdate = true; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + if (projectile.owner == Main.myPlayer) + { float spread = 45f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; @@ -154,19 +154,19 @@ namespace CalamityMod.Projectiles.Patreon offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - mod.ProjectileType("KelvinCatalystStar"), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + mod.ProjectileType("KelvinCatalystStar"), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), - mod.ProjectileType("KelvinCatalystStar"), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + mod.ProjectileType("KelvinCatalystStar"), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); } } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Patreon/KelvinCatalystStar.cs b/Projectiles/Patreon/KelvinCatalystStar.cs index dd5f49f696..0ed2f8123a 100644 --- a/Projectiles/Patreon/KelvinCatalystStar.cs +++ b/Projectiles/Patreon/KelvinCatalystStar.cs @@ -8,119 +8,119 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class KelvinCatalystStar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kelvin Catalyst Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + } - public override void AI() - { - if (projectile.ai[0] < 90f) - { - projectile.ai[0] += 1f; - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; - } - else - { - projectile.extraUpdates = 1; + public override void AI() + { + if (projectile.ai[0] < 90f) + { + projectile.ai[0] += 1f; + projectile.velocity.X *= 0.98f; + projectile.velocity.Y *= 0.98f; + } + else + { + projectile.extraUpdates = 1; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - else - projectile.Kill(); - } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + else + projectile.Kill(); + } - Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.075f) / 255f, (Main.DiscoR * 0.1f) / 255f, (Main.DiscoR * 0.125f) / 255f); + Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.075f) / 255f, (Main.DiscoR * 0.1f) / 255f, (Main.DiscoR * 0.125f) / 255f); - if (Main.rand.NextBool(6)) - { - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 0.4f); - Main.dust[dust].velocity *= 0.3f; - Main.dust[dust].noGravity = true; - } + if (Main.rand.NextBool(6)) + { + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 0.4f); + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].noGravity = true; + } - projectile.rotation += 0.25f; - } + projectile.rotation += 0.25f; + } - public override bool CanDamage() - { - return projectile.ai[0] >= 90f; - } + public override bool CanDamage() + { + return projectile.ai[0] >= 90f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 24); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 67, vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); - Main.dust[num228].noGravity = true; - } - projectile.Damage(); - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 24); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 67, vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); + Main.dust[num228].noGravity = true; + } + projectile.Damage(); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 60); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 60); + } + } } diff --git a/Projectiles/Patreon/LightBall.cs b/Projectiles/Patreon/LightBall.cs index 6d046cd4aa..5aa81e013d 100644 --- a/Projectiles/Patreon/LightBall.cs +++ b/Projectiles/Patreon/LightBall.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Patreon { public class LightBall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Ball"); + } public override void SetDefaults() { @@ -24,45 +24,45 @@ namespace CalamityMod.Projectiles.Patreon public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.velocity.X *= 0.995f; - projectile.velocity.Y *= 0.995f; + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + projectile.velocity.X *= 0.995f; + projectile.velocity.Y *= 0.995f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 200, projectile.alpha); + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 300; - projectile.height = 300; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("LightBallExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 300; + projectile.height = 300; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("LightBallExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Patreon/LightBallExplosion.cs b/Projectiles/Patreon/LightBallExplosion.cs index 04a42c9885..9bd7e2b273 100644 --- a/Projectiles/Patreon/LightBallExplosion.cs +++ b/Projectiles/Patreon/LightBallExplosion.cs @@ -4,10 +4,10 @@ namespace CalamityMod.Projectiles.Patreon { public class LightBallExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Patreon projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; } } } diff --git a/Projectiles/Patreon/LightBead.cs b/Projectiles/Patreon/LightBead.cs index b13ac7c96f..3df143f5a9 100644 --- a/Projectiles/Patreon/LightBead.cs +++ b/Projectiles/Patreon/LightBead.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Patreon { public class LightBead : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light Bead"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Bead"); + } public override void SetDefaults() { @@ -26,87 +26,87 @@ namespace CalamityMod.Projectiles.Patreon public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.rotation += projectile.velocity.X * 0.2f; - projectile.ai[1] += 1f; - if (Main.rand.NextBool(3)) - { - int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); - Main.dust[num300].noGravity = true; - Main.dust[num300].velocity *= 0.5f; - Main.dust[num300].scale *= 0.9f; - } - if (projectile.ai[1] > 300f) - { - projectile.scale -= 0.05f; - if ((double)projectile.scale <= 0.2) - { - projectile.scale = 0.2f; - projectile.Kill(); - return; - } - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 500f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + projectile.rotation += projectile.velocity.X * 0.2f; + projectile.ai[1] += 1f; + if (Main.rand.NextBool(3)) + { + int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); + Main.dust[num300].noGravity = true; + Main.dust[num300].velocity *= 0.5f; + Main.dust[num300].scale *= 0.9f; + } + if (projectile.ai[1] > 300f) + { + projectile.scale -= 0.05f; + if ((double)projectile.scale <= 0.2) + { + projectile.scale = 0.2f; + projectile.Kill(); + return; + } + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 500f; + bool homeIn = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; + projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; + } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 200, projectile.alpha); + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 6; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + int num251 = Main.rand.Next(2, 3); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("LightBeadSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } } - int num251 = Main.rand.Next(2, 3); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("LightBeadSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } } } } diff --git a/Projectiles/Patreon/LightBeadSplit.cs b/Projectiles/Patreon/LightBeadSplit.cs index beb1851bc7..6cb73b48fd 100644 --- a/Projectiles/Patreon/LightBeadSplit.cs +++ b/Projectiles/Patreon/LightBeadSplit.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Patreon { public class LightBeadSplit : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light Bead"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Bead"); + } public override void SetDefaults() { @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.Patreon public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - projectile.rotation += projectile.velocity.X * 0.2f; - projectile.velocity *= 0.985f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + projectile.rotation += projectile.velocity.X * 0.2f; + projectile.velocity *= 0.985f; } @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Patreon { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 212, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 212, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Patreon/MadAlchemistsCocktailAlt.cs b/Projectiles/Patreon/MadAlchemistsCocktailAlt.cs index dd499cc894..2fa1be5f6b 100644 --- a/Projectiles/Patreon/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Patreon/MadAlchemistsCocktailAlt.cs @@ -1,6 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,107 +7,107 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MadAlchemistsCocktailAlt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mad Alchemist's Cocktail"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mad Alchemist's Cocktail"); + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600); - target.AddBuff(mod.BuffType("HolyLight"), 600); - target.AddBuff(BuffID.Poisoned, 600); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.CursedInferno, 600); - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.Venom, 600); - target.AddBuff(BuffID.ShadowFlame, 600); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600); + target.AddBuff(mod.BuffType("HolyLight"), 600); + target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.CursedInferno, 600); + target.AddBuff(BuffID.Frostburn, 600); + target.AddBuff(BuffID.Venom, 600); + target.AddBuff(BuffID.ShadowFlame, 600); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - int height = 120; - float num51 = 1.8f; - float num52 = 2.5f; - Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage *= 2; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 200, default, num52); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 4f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 3f; - Main.dust[num54].noGravity = true; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Green * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item107, projectile.position); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + int height = 120; + float num51 = 1.8f; + float num52 = 2.5f; + Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage *= 2; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 200, default, num52); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 4f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 3f; + Main.dust[num54].noGravity = true; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Green * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } } diff --git a/Projectiles/Patreon/MadAlchemistsCocktailBlue.cs b/Projectiles/Patreon/MadAlchemistsCocktailBlue.cs index 8cea37251b..7d689bfd92 100644 --- a/Projectiles/Patreon/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Patreon/MadAlchemistsCocktailBlue.cs @@ -1,6 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,53 +7,53 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MadAlchemistsCocktailBlue : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mad Alchemist's Cocktail Blue"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mad Alchemist's Cocktail Blue"); + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - int num220 = Main.rand.Next(20, 31); - if (projectile.owner == Main.myPlayer) - { - for (int num221 = 0; num221 < num220; num221++) - { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, mod.ProjectileType("MadAlchemistsCocktailGasCloud"), projectile.damage / 4, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - } - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item107, projectile.position); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + int num220 = Main.rand.Next(20, 31); + if (projectile.owner == Main.myPlayer) + { + for (int num221 = 0; num221 < num220; num221++) + { + Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, mod.ProjectileType("MadAlchemistsCocktailGasCloud"), projectile.damage / 4, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + } + } + } + } } diff --git a/Projectiles/Patreon/MadAlchemistsCocktailGasCloud.cs b/Projectiles/Patreon/MadAlchemistsCocktailGasCloud.cs index ec62beee54..cd4f4ed98f 100644 --- a/Projectiles/Patreon/MadAlchemistsCocktailGasCloud.cs +++ b/Projectiles/Patreon/MadAlchemistsCocktailGasCloud.cs @@ -1,80 +1,77 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MadAlchemistsCocktailGasCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mad Alchemist's Cocktail Gas Cloud"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mad Alchemist's Cocktail Gas Cloud"); + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } - public override void AI() - { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 60f) - { - projectile.ai[0] += 10f; - } - if (projectile.ai[0] > 255f) - { - projectile.Kill(); - projectile.ai[0] = 255f; - } - projectile.alpha = (int)(100.0 + (double)projectile.ai[0] * 0.7); - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.rotation += (float)projectile.direction * 0.003f; - projectile.velocity *= 0.96f; - Rectangle rectangle5 = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - int num3; - for (int num894 = 0; num894 < 1000; num894 = num3 + 1) - { - if (num894 != projectile.whoAmI && Main.projectile[num894].active) - { - Rectangle value43 = new Rectangle((int)Main.projectile[num894].position.X, (int)Main.projectile[num894].position.Y, Main.projectile[num894].width, Main.projectile[num894].height); - if (rectangle5.Intersects(value43)) - { - Vector2 vector105 = Main.projectile[num894].Center - projectile.Center; - if (vector105.X == 0f && vector105.Y == 0f) - { - if (num894 < projectile.whoAmI) - { - vector105.X = -1f; - vector105.Y = 1f; - } - else - { - vector105.X = 1f; - vector105.Y = -1f; - } - } - vector105.Normalize(); - vector105 *= 0.005f; - projectile.velocity -= vector105; - Projectile projectile2 = Main.projectile[num894]; - projectile2.velocity += vector105; - } - } - num3 = num894; - } - } - } + public override void AI() + { + projectile.ai[1] += 1f; + if (projectile.ai[1] > 60f) + { + projectile.ai[0] += 10f; + } + if (projectile.ai[0] > 255f) + { + projectile.Kill(); + projectile.ai[0] = 255f; + } + projectile.alpha = (int)(100.0 + (double)projectile.ai[0] * 0.7); + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.rotation += (float)projectile.direction * 0.003f; + projectile.velocity *= 0.96f; + Rectangle rectangle5 = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + int num3; + for (int num894 = 0; num894 < 1000; num894 = num3 + 1) + { + if (num894 != projectile.whoAmI && Main.projectile[num894].active) + { + Rectangle value43 = new Rectangle((int)Main.projectile[num894].position.X, (int)Main.projectile[num894].position.Y, Main.projectile[num894].width, Main.projectile[num894].height); + if (rectangle5.Intersects(value43)) + { + Vector2 vector105 = Main.projectile[num894].Center - projectile.Center; + if (vector105.X == 0f && vector105.Y == 0f) + { + if (num894 < projectile.whoAmI) + { + vector105.X = -1f; + vector105.Y = 1f; + } + else + { + vector105.X = 1f; + vector105.Y = -1f; + } + } + vector105.Normalize(); + vector105 *= 0.005f; + projectile.velocity -= vector105; + Projectile projectile2 = Main.projectile[num894]; + projectile2.velocity += vector105; + } + } + num3 = num894; + } + } + } } diff --git a/Projectiles/Patreon/MadAlchemistsCocktailGreen.cs b/Projectiles/Patreon/MadAlchemistsCocktailGreen.cs index 44eea10495..300c5ff7fe 100644 --- a/Projectiles/Patreon/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Patreon/MadAlchemistsCocktailGreen.cs @@ -1,6 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,61 +7,61 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MadAlchemistsCocktailGreen : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mad Alchemist's Cocktail Green"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mad Alchemist's Cocktail Green"); + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item107, projectile.position); - Main.PlaySound(SoundID.Item88, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - for (int num118 = 0; num118 < 3; num118++) - { - float x = projectile.position.X + (float)Main.rand.Next(-100, 100); - float y = projectile.position.Y - (float)Main.rand.Next(500, 600); - Vector2 vector = new Vector2(x, y); - float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item107, projectile.position); + Main.PlaySound(SoundID.Item88, projectile.position); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + for (int num118 = 0; num118 < 3; num118++) + { + float x = projectile.position.X + (float)Main.rand.Next(-100, 100); + float y = projectile.position.Y - (float)Main.rand.Next(500, 600); + Vector2 vector = new Vector2(x, y); + float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 25; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; - float ai2 = num16 + projectile.position.Y; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(x, y, num15, num16, ProjectileID.LunarFlare, projectile.damage / 2, 5f, projectile.owner, 0f, ai2); - } - } - } + float ai2 = num16 + projectile.position.Y; + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(x, y, num15, num16, ProjectileID.LunarFlare, projectile.damage / 2, 5f, projectile.owner, 0f, ai2); + } + } + } } diff --git a/Projectiles/Patreon/MadAlchemistsCocktailPurple.cs b/Projectiles/Patreon/MadAlchemistsCocktailPurple.cs index 9f3ea831f4..70c887d195 100644 --- a/Projectiles/Patreon/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Patreon/MadAlchemistsCocktailPurple.cs @@ -1,6 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,52 +7,52 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MadAlchemistsCocktailPurple : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mad Alchemist's Cocktail Purple"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mad Alchemist's Cocktail Purple"); + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - if (projectile.owner == Main.myPlayer) - { - for (int num221 = 0; num221 < 4; num221++) - { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, mod.ProjectileType("MadAlchemistsCocktailShrapnel"), projectile.damage / 3, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - } - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item107, projectile.position); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + if (projectile.owner == Main.myPlayer) + { + for (int num221 = 0; num221 < 4; num221++) + { + Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, mod.ProjectileType("MadAlchemistsCocktailShrapnel"), projectile.damage / 3, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + } + } + } + } } diff --git a/Projectiles/Patreon/MadAlchemistsCocktailRed.cs b/Projectiles/Patreon/MadAlchemistsCocktailRed.cs index 537a692dad..209216e4af 100644 --- a/Projectiles/Patreon/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Patreon/MadAlchemistsCocktailRed.cs @@ -1,6 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,108 +7,108 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MadAlchemistsCocktailRed : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mad Alchemist's Cocktail Red"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mad Alchemist's Cocktail Red"); + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void Kill(int timeLeft) - { - int height = 480; - float num50 = 3f; - float num51 = 2.4f; - float num52 = 3.8f; - Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20, 2f, 0f); - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage *= 3; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 60; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 8f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 6f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 4f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 30; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } + public override void Kill(int timeLeft) + { + int height = 480; + float num50 = 3f; + float num51 = 2.4f; + float num52 = 3.8f; + Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20, 2f, 0f); + Main.PlaySound(SoundID.Item107, projectile.position); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage *= 3; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 60; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 8f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 6f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 4f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 30; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } } diff --git a/Projectiles/Patreon/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Patreon/MadAlchemistsCocktailShrapnel.cs index f5723daeb6..78cc28bb01 100644 --- a/Projectiles/Patreon/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Patreon/MadAlchemistsCocktailShrapnel.cs @@ -1,87 +1,85 @@ -using System; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class MadAlchemistsCocktailShrapnel : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shrapnel"); - } + public class MadAlchemistsCocktailShrapnel : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shrapnel"); + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.extraUpdates = 1; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.extraUpdates = 1; + } - public override void AI() - { - Vector2 value7 = new Vector2(6f, 12f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) - { - projectile.localAI[0] = 0f; - } - else - { - for (int num41 = 0; num41 < 2; num41++) - { - Vector2 value8 = Vector2.UnitX * -15f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 0.75f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - } - } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - } + public override void AI() + { + Vector2 value7 = new Vector2(6f, 12f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -15f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 0.75f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + } } diff --git a/Projectiles/Patreon/MelterAmp.cs b/Projectiles/Patreon/MelterAmp.cs index 2fddc5e476..ecce9a95e4 100644 --- a/Projectiles/Patreon/MelterAmp.cs +++ b/Projectiles/Patreon/MelterAmp.cs @@ -1,115 +1,115 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MelterAmp : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Melter Amp"); - Main.projFrames[projectile.type] = 3; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Melter Amp"); + Main.projFrames[projectile.type] = 3; + } - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 38; - projectile.friendly = true; - projectile.magic = true; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.timeLeft = 6000; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 38; + projectile.friendly = true; + projectile.magic = true; + projectile.netImportant = true; + projectile.penetrate = -1; + projectile.timeLeft = 6000; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("MelterAmp"); - Player player = Main.player[projectile.owner]; - if (flag64) - { - if (player.dead) - { - projectile.active = false; - return; - } - if (player.ownedProjectileCounts[mod.ProjectileType("MelterAmp")] > 1) - { - projectile.active = false; - return; - } - if (!player.inventory[player.selectedItem].magic || player.inventory[player.selectedItem].shoot != mod.ProjectileType("MelterNote1")) - { - projectile.active = false; - return; - } - } - Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0.75f); - if (projectile.ai[0] > 0f) - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - projectile.ai[0] = 0f; - } - } - if (Main.myPlayer == projectile.owner && projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - int Damage = projectile.damage; - int type; - projectile.netUpdate = true; - float num127 = 20f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (player.gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f) - { - vector11 = new Vector2(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - float VelocityX = num128; - float VelocityY = num129; - int note = Main.rand.Next(0, 2); - if (note == 0) - { - Damage = (int)(projectile.damage * 1.5f); - type = mod.ProjectileType("MelterNote1"); - } - else - { - VelocityX *= 1.5f; - VelocityY *= 1.5f; - type = mod.ProjectileType("MelterNote2"); - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, VelocityX, VelocityY, type, Damage, projectile.knockBack, projectile.owner, 0.0f, 0.0f); - } - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - } - } + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("MelterAmp"); + Player player = Main.player[projectile.owner]; + if (flag64) + { + if (player.dead) + { + projectile.active = false; + return; + } + if (player.ownedProjectileCounts[mod.ProjectileType("MelterAmp")] > 1) + { + projectile.active = false; + return; + } + if (!player.inventory[player.selectedItem].magic || player.inventory[player.selectedItem].shoot != mod.ProjectileType("MelterNote1")) + { + projectile.active = false; + return; + } + } + Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0.75f); + if (projectile.ai[0] > 0f) + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + projectile.ai[0] = 0f; + } + } + if (Main.myPlayer == projectile.owner && projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + int Damage = projectile.damage; + int type; + projectile.netUpdate = true; + float num127 = 20f; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + if (player.gravDir == -1f) + { + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f) + { + vector11 = new Vector2(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } + num130 = num127 / num130; + num128 *= num130; + num129 *= num130; + float VelocityX = num128; + float VelocityY = num129; + int note = Main.rand.Next(0, 2); + if (note == 0) + { + Damage = (int)(projectile.damage * 1.5f); + type = mod.ProjectileType("MelterNote1"); + } + else + { + VelocityX *= 1.5f; + VelocityY *= 1.5f; + type = mod.ProjectileType("MelterNote2"); + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, VelocityX, VelocityY, type, Damage, projectile.knockBack, projectile.owner, 0.0f, 0.0f); + } + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + } + } } diff --git a/Projectiles/Patreon/MelterNote1.cs b/Projectiles/Patreon/MelterNote1.cs index 1188980618..92d4bd0bce 100644 --- a/Projectiles/Patreon/MelterNote1.cs +++ b/Projectiles/Patreon/MelterNote1.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Patreon { public class MelterNote1 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + } public override void SetDefaults() { @@ -18,35 +18,35 @@ namespace CalamityMod.Projectiles.Patreon projectile.magic = true; projectile.penetrate = 10; projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.tileCollide = false; - projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.tileCollide = false; + projectile.ignoreWater = true; } public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(255, 255, 255); } diff --git a/Projectiles/Patreon/MelterNote2.cs b/Projectiles/Patreon/MelterNote2.cs index 1e1d244dcc..c0111ba8d8 100644 --- a/Projectiles/Patreon/MelterNote2.cs +++ b/Projectiles/Patreon/MelterNote2.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Patreon { public class MelterNote2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + } public override void SetDefaults() { @@ -18,35 +18,35 @@ namespace CalamityMod.Projectiles.Patreon projectile.magic = true; projectile.penetrate = 10; projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; - projectile.tileCollide = false; - projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 7; + projectile.tileCollide = false; + projectile.ignoreWater = true; } public override void AI() { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } + projectile.velocity.X *= 0.99f; + projectile.velocity.Y *= 0.99f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(255, 255, 255); } diff --git a/Projectiles/Patreon/MiniGuardianAttack.cs b/Projectiles/Patreon/MiniGuardianAttack.cs index 4c7d0266c9..cb3d82e9c6 100644 --- a/Projectiles/Patreon/MiniGuardianAttack.cs +++ b/Projectiles/Patreon/MiniGuardianAttack.cs @@ -1,17 +1,17 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Patreon { public class MiniGuardianAttack : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Offensive Guardian"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Offensive Guardian"); Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; @@ -20,17 +20,17 @@ namespace CalamityMod.Projectiles.Patreon public override void SetDefaults() { projectile.netImportant = true; - projectile.tileCollide = false; + projectile.tileCollide = false; projectile.width = 60; projectile.height = 88; - projectile.minionSlots = 0f; - projectile.minion = true; + projectile.minionSlots = 0f; + projectile.minion = true; projectile.friendly = true; projectile.penetrate = -1; - projectile.timeLeft = 18000; + projectile.timeLeft = 18000; projectile.timeLeft *= 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; } public override void AI() diff --git a/Projectiles/Patreon/MiniGuardianDefense.cs b/Projectiles/Patreon/MiniGuardianDefense.cs index 8cf1feb79a..939f971f4e 100644 --- a/Projectiles/Patreon/MiniGuardianDefense.cs +++ b/Projectiles/Patreon/MiniGuardianDefense.cs @@ -1,17 +1,17 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Patreon { public class MiniGuardianDefense : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Defensive Guardian"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Defensive Guardian"); Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; @@ -20,17 +20,17 @@ namespace CalamityMod.Projectiles.Patreon public override void SetDefaults() { projectile.netImportant = true; - projectile.tileCollide = false; + projectile.tileCollide = false; projectile.width = 62; projectile.height = 80; - projectile.minionSlots = 0f; - projectile.minion = true; + projectile.minionSlots = 0f; + projectile.minion = true; projectile.friendly = true; projectile.penetrate = -1; - projectile.timeLeft = 18000; + projectile.timeLeft = 18000; projectile.timeLeft *= 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; } public override void AI() diff --git a/Projectiles/Patreon/MiniGuardianHealer.cs b/Projectiles/Patreon/MiniGuardianHealer.cs index 10611f8542..da4db5aa3e 100644 --- a/Projectiles/Patreon/MiniGuardianHealer.cs +++ b/Projectiles/Patreon/MiniGuardianHealer.cs @@ -1,17 +1,17 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Patreon { public class MiniGuardianHealer : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Healer Guardian"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Healer Guardian"); Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; @@ -20,14 +20,14 @@ namespace CalamityMod.Projectiles.Patreon public override void SetDefaults() { projectile.netImportant = true; - projectile.tileCollide = false; + projectile.tileCollide = false; projectile.width = 68; projectile.height = 82; projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.minion = true; + projectile.minionSlots = 0f; + projectile.minion = true; projectile.penetrate = -1; - projectile.timeLeft = 18000; + projectile.timeLeft = 18000; projectile.timeLeft *= 5; } diff --git a/Projectiles/Patreon/MourningSkull.cs b/Projectiles/Patreon/MourningSkull.cs index acb86aa2c1..d99c7ddbc4 100644 --- a/Projectiles/Patreon/MourningSkull.cs +++ b/Projectiles/Patreon/MourningSkull.cs @@ -8,163 +8,163 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class MourningSkull : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mourning Skull"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mourning Skull"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + } - public override void AI() - { - if (projectile.ai[0] < 0f) - { - projectile.alpha = 0; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 50; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } + public override void AI() + { + if (projectile.ai[0] < 0f) + { + projectile.alpha = 0; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 50; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } - if (projectile.ai[0] >= 0f && projectile.ai[0] < 200f) - { - int num554 = (int)projectile.ai[0]; - if (Main.npc[num554].active) - { - float num555 = 8f; - Vector2 vector44 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num556 = Main.npc[num554].position.X - vector44.X; - float num557 = Main.npc[num554].position.Y - vector44.Y; - float num558 = (float)Math.Sqrt((double)(num556 * num556 + num557 * num557)); - num558 = num555 / num558; - num556 *= num558; - num557 *= num558; - projectile.velocity.X = (projectile.velocity.X * 14f + num556) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num557) / 15f; - } - else - { - float num559 = 1000f; - int num3; - for (int num560 = 0; num560 < 200; num560 = num3 + 1) - { - if (Main.npc[num560].CanBeChasedBy(projectile, false)) - { - float num561 = Main.npc[num560].position.X + (float)(Main.npc[num560].width / 2); - float num562 = Main.npc[num560].position.Y + (float)(Main.npc[num560].height / 2); - float num563 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num561) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num562); - if (num563 < num559 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].height)) - { - num559 = num563; - projectile.ai[0] = (float)num560; - } - } - num3 = num560; - } - } + if (projectile.ai[0] >= 0f && projectile.ai[0] < 200f) + { + int num554 = (int)projectile.ai[0]; + if (Main.npc[num554].active) + { + float num555 = 8f; + Vector2 vector44 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num556 = Main.npc[num554].position.X - vector44.X; + float num557 = Main.npc[num554].position.Y - vector44.Y; + float num558 = (float)Math.Sqrt((double)(num556 * num556 + num557 * num557)); + num558 = num555 / num558; + num556 *= num558; + num557 *= num558; + projectile.velocity.X = (projectile.velocity.X * 14f + num556) / 15f; + projectile.velocity.Y = (projectile.velocity.Y * 14f + num557) / 15f; + } + else + { + float num559 = 1000f; + int num3; + for (int num560 = 0; num560 < 200; num560 = num3 + 1) + { + if (Main.npc[num560].CanBeChasedBy(projectile, false)) + { + float num561 = Main.npc[num560].position.X + (float)(Main.npc[num560].width / 2); + float num562 = Main.npc[num560].position.Y + (float)(Main.npc[num560].height / 2); + float num563 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num561) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num562); + if (num563 < num559 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].height)) + { + num559 = num563; + projectile.ai[0] = (float)num560; + } + } + num3 = num560; + } + } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } - int num564 = 8; - int num565 = Dust.NewDust(new Vector2(projectile.position.X + (float)num564, projectile.position.Y + (float)num564), projectile.width - num564 * 2, projectile.height - num564 * 2, (Main.rand.NextBool(2) ? 5 : 6), 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num565]; - dust.velocity *= 0.5f; - dust = Main.dust[num565]; - dust.velocity += projectile.velocity * 0.5f; - Main.dust[num565].noGravity = true; - Main.dust[num565].noLight = true; - Main.dust[num565].scale = 1.4f; - return; - } + int num564 = 8; + int num565 = Dust.NewDust(new Vector2(projectile.position.X + (float)num564, projectile.position.Y + (float)num564), projectile.width - num564 * 2, projectile.height - num564 * 2, (Main.rand.NextBool(2) ? 5 : 6), 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num565]; + dust.velocity *= 0.5f; + dust = Main.dust[num565]; + dust.velocity += projectile.velocity * 0.5f; + Main.dust[num565].noGravity = true; + Main.dust[num565].noLight = true; + Main.dust[num565].scale = 1.4f; + return; + } - projectile.Kill(); - } + projectile.Kill(); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Main.rand.Next(0, 128)); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, Main.rand.Next(0, 128)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - if (projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("TinyFlare"), - (int)((double)projectile.damage * 0.35), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + if (projectile.owner == Main.myPlayer) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("TinyFlare"), + (int)((double)projectile.damage * 0.35), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Patreon/NadirSpear.cs b/Projectiles/Patreon/NadirSpear.cs index 221f026775..dc75d2944e 100644 --- a/Projectiles/Patreon/NadirSpear.cs +++ b/Projectiles/Patreon/NadirSpear.cs @@ -1,121 +1,120 @@ using CalamityMod.Items.Patreon; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class NadirSpear : ModProjectile - { - private const float StartOffset = 5.5f; - private const float OutSpeed = 1.1f; - private const float BackSpeed = 2.1f; + public class NadirSpear : ModProjectile + { + private const float StartOffset = 5.5f; + private const float OutSpeed = 1.1f; + private const float BackSpeed = 2.1f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nadir"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nadir"); + } - public override void SetDefaults() - { - projectile.width = 55; - projectile.height = 55; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; + public override void SetDefaults() + { + projectile.width = 55; + projectile.height = 55; + projectile.aiStyle = 19; + projectile.melee = true; + projectile.timeLeft = 90; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; - projectile.hide = true; + projectile.hide = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } - // ai[0] is the current offset of the spear. Positive is further away from the player. - public override void AI() - { - // On the first frame, set the spear at its starting offset - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = StartOffset; - projectile.netUpdate = true; - } + // ai[0] is the current offset of the spear. Positive is further away from the player. + public override void AI() + { + // On the first frame, set the spear at its starting offset + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = StartOffset; + projectile.netUpdate = true; + } - // Update the player so that he/she is still holding the spear - Player player = Main.player[projectile.owner]; - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; - player.itemTime = player.itemAnimation; + // Update the player so that he/she is still holding the spear + Player player = Main.player[projectile.owner]; + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + player.itemTime = player.itemAnimation; - // Update the spear so that it continues to be "held" by the player every frame - projectile.position.X = player.position.X + (player.width / 2) - (projectile.width / 2); - projectile.position.Y = player.position.Y + (player.height / 2) - (projectile.height / 2); + // Update the spear so that it continues to be "held" by the player every frame + projectile.position.X = player.position.X + (player.width / 2) - (projectile.width / 2); + projectile.position.Y = player.position.Y + (player.height / 2) - (projectile.height / 2); - // Move the spear based on its current offset - projectile.position += projectile.velocity * projectile.ai[0]; + // Move the spear based on its current offset + projectile.position += projectile.velocity * projectile.ai[0]; - // The spear is returning for the last 1/3 of the item's animation - if (player.itemAnimation < player.itemAnimationMax / 3f) - { - projectile.ai[0] -= BackSpeed; + // The spear is returning for the last 1/3 of the item's animation + if (player.itemAnimation < player.itemAnimationMax / 3f) + { + projectile.ai[0] -= BackSpeed; - // On the very first returning frame, fire the projectile - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; + // On the very first returning frame, fire the projectile + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; - int damage = Nadir.BaseDamage / 5; - float kb = 5.5f; - Vector2 projPos = projectile.Center + projectile.velocity; - Vector2 projVel = projectile.velocity * 0.75f; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projPos, projVel, mod.ProjectileType("VoidEssence"), damage, kb, projectile.owner, 0f, 0f); + int damage = Nadir.BaseDamage / 5; + float kb = 5.5f; + Vector2 projPos = projectile.Center + projectile.velocity; + Vector2 projVel = projectile.velocity * 0.75f; + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projPos, projVel, mod.ProjectileType("VoidEssence"), damage, kb, projectile.owner, 0f, 0f); - // Play a screaming soul sound effect (unused Shadowflame Hex Doll noise) - Main.PlaySound(SoundID.Item104, projectile.Center); + // Play a screaming soul sound effect (unused Shadowflame Hex Doll noise) + Main.PlaySound(SoundID.Item104, projectile.Center); - // Create a circle of purple dust where the projectile comes out, looking like the edge of a portal - int circleDust = 18; - Vector2 baseDustVel = new Vector2(3.8f, 0f); - for (int i = 0; i < circleDust; ++i) - { - int dustID = 27; - float angle = i * (MathHelper.TwoPi / circleDust); - Vector2 dustVel = baseDustVel.RotatedBy(angle); + // Create a circle of purple dust where the projectile comes out, looking like the edge of a portal + int circleDust = 18; + Vector2 baseDustVel = new Vector2(3.8f, 0f); + for (int i = 0; i < circleDust; ++i) + { + int dustID = 27; + float angle = i * (MathHelper.TwoPi / circleDust); + Vector2 dustVel = baseDustVel.RotatedBy(angle); - int idx = Dust.NewDust(projectile.Center, 1, 1, dustID); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = projectile.Center; - Main.dust[idx].velocity = dustVel; - Main.dust[idx].scale = 2.4f; - } - } - } + int idx = Dust.NewDust(projectile.Center, 1, 1, dustID); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = projectile.Center; + Main.dust[idx].velocity = dustVel; + Main.dust[idx].scale = 2.4f; + } + } + } - // For the remaining 2/3, the spear is heading out and doing nothing. - else - projectile.ai[0] += OutSpeed; + // For the remaining 2/3, the spear is heading out and doing nothing. + else + projectile.ai[0] += OutSpeed; - // If the player is no longer using an item (e.g. they die), kill the spear instantly. - if (Main.player[projectile.owner].itemAnimation == 0) - projectile.Kill(); + // If the player is no longer using an item (e.g. they die), kill the spear instantly. + if (Main.player[projectile.owner].itemAnimation == 0) + projectile.Kill(); - // Produce dust at all times while the spear is moving. - int movingDust = 3; - for (int i = 0; i < movingDust; ++i) - { - int dustID = Main.rand.NextBool(4) ? 27 : 118; - Vector2 corner = 0.5f * projectile.position + 0.5f * projectile.Center; - int idx = Dust.NewDust(corner, projectile.width / 2, projectile.height / 2, dustID); + // Produce dust at all times while the spear is moving. + int movingDust = 3; + for (int i = 0; i < movingDust; ++i) + { + int dustID = Main.rand.NextBool(4) ? 27 : 118; + Vector2 corner = 0.5f * projectile.position + 0.5f * projectile.Center; + int idx = Dust.NewDust(corner, projectile.width / 2, projectile.height / 2, dustID); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = Vector2.Zero; - } - } - } + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = Vector2.Zero; + } + } + } } diff --git a/Projectiles/Patreon/OracleYoyo.cs b/Projectiles/Patreon/OracleYoyo.cs index dd930d311f..3f6de9ae87 100644 --- a/Projectiles/Patreon/OracleYoyo.cs +++ b/Projectiles/Patreon/OracleYoyo.cs @@ -1,225 +1,227 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Patreon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Patreon; namespace CalamityMod.Projectiles.Patreon { - public class OracleYoyo : ModProjectile - { - // projectile.localAI[1] is the Aura Charge of the red lightning aura - // Minimum value is zero. Maximum value is 200. - // The aura turns on and begins damaging enemies at 20 charge. - // The yoyo "supercharges" at 50 charge. - // Its size caps out at 100 charge. - private static float MaxCharge = 200f; - private static float MinAuraRadius = 20f; - private static float SuperchargeThreshold = 50f; - private static float MaxAuraRadius = 100f; - private static float MinDischargeRate = 0.05f; - private static float MaxDischargeRate = 0.53f; - private static float ChargePerHit = 6f; + public class OracleYoyo : ModProjectile + { + // projectile.localAI[1] is the Aura Charge of the red lightning aura + // Minimum value is zero. Maximum value is 200. + // The aura turns on and begins damaging enemies at 20 charge. + // The yoyo "supercharges" at 50 charge. + // Its size caps out at 100 charge. + private static float MaxCharge = 200f; + private static float MinAuraRadius = 20f; + private static float SuperchargeThreshold = 50f; + private static float MaxAuraRadius = 100f; + private static float MinDischargeRate = 0.05f; + private static float MaxDischargeRate = 0.53f; + private static float ChargePerHit = 6f; - private static int AuraBaseDamage = 160; - private static int HitsPerOrbVolley = 6; + private static int AuraBaseDamage = 160; + private static int HitsPerOrbVolley = 6; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Oracle"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Oracle"); + } - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Terrarian); - aiType = 554; - projectile.width = 20; - projectile.height = 20; - projectile.scale = 1.2f; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Terrarian); + aiType = 554; + projectile.width = 20; + projectile.height = 20; + projectile.scale = 1.2f; + projectile.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } - public override void AI() - { - // Produces golden dust constantly while in flight. This lights the yoyo. - if (Main.rand.NextBool()) - { - int dustType = (Main.rand.NextBool(3)) ? 244 : 246; - float scale = 0.8f + Main.rand.NextFloat(0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = Vector2.Zero; - Main.dust[idx].scale = scale; - } + public override void AI() + { + // Produces golden dust constantly while in flight. This lights the yoyo. + if (Main.rand.NextBool()) + { + int dustType = (Main.rand.NextBool(3)) ? 244 : 246; + float scale = 0.8f + Main.rand.NextFloat(0.6f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = Vector2.Zero; + Main.dust[idx].scale = scale; + } - // The aura discharges over time based on its current charge. - float discharge = MinDischargeRate + 0.003f * projectile.localAI[1]; - if (discharge > MaxDischargeRate) - discharge = MaxDischargeRate; - projectile.localAI[1] -= discharge; + // The aura discharges over time based on its current charge. + float discharge = MinDischargeRate + 0.003f * projectile.localAI[1]; + if (discharge > MaxDischargeRate) + discharge = MaxDischargeRate; + projectile.localAI[1] -= discharge; - // Boundary checks on aura charge - if (projectile.localAI[1] < 0f) - projectile.localAI[1] = 0f; - if (projectile.localAI[1] > MaxCharge) - projectile.localAI[1] = MaxCharge; + // Boundary checks on aura charge + if (projectile.localAI[1] < 0f) + projectile.localAI[1] = 0f; + if (projectile.localAI[1] > MaxCharge) + projectile.localAI[1] = MaxCharge; - // If the aura is large enough to be considered "on", draw it, make sound and damage enemies - if (projectile.localAI[1] > MinAuraRadius) - { - float auraRadius = projectile.localAI[1] > MaxAuraRadius ? MaxAuraRadius : projectile.localAI[1]; - DrawRedLightningAura(auraRadius); + // If the aura is large enough to be considered "on", draw it, make sound and damage enemies + if (projectile.localAI[1] > MinAuraRadius) + { + float auraRadius = projectile.localAI[1] > MaxAuraRadius ? MaxAuraRadius : projectile.localAI[1]; + DrawRedLightningAura(auraRadius); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 22; - Main.PlaySound(SoundID.Item93, (int)projectile.Center.X, (int)projectile.Center.Y); - } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 22; + Main.PlaySound(SoundID.Item93, (int)projectile.Center.X, (int)projectile.Center.Y); + } - // The aura's direct damage scales with its charge: 100 base damage + 1 per charge point - int auraDamage = (int)(AuraBaseDamage + projectile.localAI[1]); - DealAuraDamage(auraRadius, auraDamage); - } - else - projectile.soundDelay = 2; + // The aura's direct damage scales with its charge: 100 base damage + 1 per charge point + int auraDamage = (int)(AuraBaseDamage + projectile.localAI[1]); + DealAuraDamage(auraRadius, auraDamage); + } + else + projectile.soundDelay = 2; - projectile.netUpdate = true; - } + projectile.netUpdate = true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - // The yoyo does nothing versus normal dummies - if (target.type == NPCID.TargetDummy) - return; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // The yoyo does nothing versus normal dummies + if (target.type == NPCID.TargetDummy) + return; - // Charge up the red lightning aura with every hit - projectile.localAI[1] += ChargePerHit; + // Charge up the red lightning aura with every hit + projectile.localAI[1] += ChargePerHit; - // Fire Auric orbs every few hits while supercharged. - if (projectile.localAI[1] > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) - FireAuricOrbs(); - } + // Fire Auric orbs every few hits while supercharged. + if (projectile.localAI[1] > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) + FireAuricOrbs(); + } - // Uses dust type 260, which lives for an extremely short amount of time - private void DrawRedLightningAura(float radius) - { - // Light emits from the yoyo itself while the aura is active, eventually becoming insanely bright - float brightness = radius * 0.03f; - Lighting.AddLight(projectile.Center, brightness, 0.2f * brightness, 0.1f * brightness); + // Uses dust type 260, which lives for an extremely short amount of time + private void DrawRedLightningAura(float radius) + { + // Light emits from the yoyo itself while the aura is active, eventually becoming insanely bright + float brightness = radius * 0.03f; + Lighting.AddLight(projectile.Center, brightness, 0.2f * brightness, 0.1f * brightness); - // Number of particles on the circumference scales directly with the circumference - float dustDensity = 0.2f; - int numDust = (int)(dustDensity * MathHelper.TwoPi * radius); - float angleIncrement = MathHelper.TwoPi / (float)numDust; + // Number of particles on the circumference scales directly with the circumference + float dustDensity = 0.2f; + int numDust = (int)(dustDensity * MathHelper.TwoPi * radius); + float angleIncrement = MathHelper.TwoPi / (float)numDust; - // Incrementally rotate the vector as a ring of dust is drawn - Vector2 dustOffset = new Vector2(radius, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - for (int i = 0; i < numDust; ++i) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dustType = 260; - float scale = 1.6f + Main.rand.NextFloat(0.9f); - int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); - Main.dust[idx].position = projectile.Center + dustOffset; - Main.dust[idx].noGravity = true; - Main.dust[idx].noLight = true; - Main.dust[idx].velocity *= 0.5f; - Main.dust[idx].scale = scale; - } + // Incrementally rotate the vector as a ring of dust is drawn + Vector2 dustOffset = new Vector2(radius, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + for (int i = 0; i < numDust; ++i) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dustType = 260; + float scale = 1.6f + Main.rand.NextFloat(0.9f); + int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); + Main.dust[idx].position = projectile.Center + dustOffset; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + Main.dust[idx].velocity *= 0.5f; + Main.dust[idx].scale = scale; + } - // Rarely, draw some "arcs" which are lines of dust to the edge - if (Main.rand.NextBool(30)) - { - int numArcs = 3; - float arcDustDensity = 0.6f; - if (Main.rand.NextBool()) ++numArcs; - if (Main.rand.NextBool()) ++numArcs; + // Rarely, draw some "arcs" which are lines of dust to the edge + if (Main.rand.NextBool(30)) + { + int numArcs = 3; + float arcDustDensity = 0.6f; + if (Main.rand.NextBool()) + ++numArcs; + if (Main.rand.NextBool()) + ++numArcs; - Vector2 radiusVec = new Vector2(radius, 0f); - int dustPerArc = (int)(arcDustDensity * radius); - for (int i = 0; i < numArcs; ++i) - { - radiusVec = radiusVec.RotatedByRandom(MathHelper.TwoPi); - for (int j = 0; j < dustPerArc; ++j) - { - Vector2 partialRadius = ((float)j / dustPerArc) * radiusVec; - int dustType = 260; - float scale = 1.6f + Main.rand.NextFloat(0.9f); - int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); - Main.dust[idx].position = projectile.Center + partialRadius; - Main.dust[idx].noGravity = true; - Main.dust[idx].noLight = true; - Main.dust[idx].velocity *= 0.3f; - Main.dust[idx].scale = scale; - } - } + Vector2 radiusVec = new Vector2(radius, 0f); + int dustPerArc = (int)(arcDustDensity * radius); + for (int i = 0; i < numArcs; ++i) + { + radiusVec = radiusVec.RotatedByRandom(MathHelper.TwoPi); + for (int j = 0; j < dustPerArc; ++j) + { + Vector2 partialRadius = ((float)j / dustPerArc) * radiusVec; + int dustType = 260; + float scale = 1.6f + Main.rand.NextFloat(0.9f); + int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); + Main.dust[idx].position = projectile.Center + partialRadius; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + Main.dust[idx].velocity *= 0.3f; + Main.dust[idx].scale = scale; + } + } - // Make extra sound when these arcs happen - Main.PlaySound(SoundID.NPCHit53, (int)projectile.Center.X, (int)projectile.Center.Y); - } - } + // Make extra sound when these arcs happen + Main.PlaySound(SoundID.NPCHit53, (int)projectile.Center.X, (int)projectile.Center.Y); + } + } - private void DealAuraDamage(float radius, int baseDamage) - { - if (projectile.owner != Main.myPlayer) - return; - Player owner = Main.player[projectile.owner]; + private void DealAuraDamage(float radius, int baseDamage) + { + if (projectile.owner != Main.myPlayer) + return; + Player owner = Main.player[projectile.owner]; - for (int i = 0; i < 200; ++i) - { - NPC target = Main.npc[i]; - if (!target.active || target.dontTakeDamage || target.friendly) - continue; + for (int i = 0; i < 200; ++i) + { + NPC target = Main.npc[i]; + if (!target.active || target.dontTakeDamage || target.friendly) + continue; - // Shock any valid target within range. Check all four corners of their hitbox. - float d1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); - float d2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); - float d3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); - float d4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); - float dist = MathHelper.Min(d1, d2); - dist = MathHelper.Min(dist, d3); - dist = MathHelper.Min(dist, d4); + // Shock any valid target within range. Check all four corners of their hitbox. + float d1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); + float d2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); + float d3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); + float d4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float dist = MathHelper.Min(d1, d2); + dist = MathHelper.Min(dist, d3); + dist = MathHelper.Min(dist, d4); - if (dist <= radius) - { - int finalDamage = (int)(baseDamage * owner.meleeDamage * Main.rand.NextFloat(0.85f, 1.15f)); - bool crit = Main.rand.Next(100) <= owner.meleeCrit + 4; - target.StrikeNPC(finalDamage, 0f, 0, crit, false, false); + if (dist <= radius) + { + int finalDamage = (int)(baseDamage * owner.meleeDamage * Main.rand.NextFloat(0.85f, 1.15f)); + bool crit = Main.rand.Next(100) <= owner.meleeCrit + 4; + target.StrikeNPC(finalDamage, 0f, 0, crit, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(28, -1, -1, null, i, finalDamage, 0f, 0f, crit ? 1 : 0, 0, 0); - } - } - } + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(28, -1, -1, null, i, finalDamage, 0f, 0f, crit ? 1 : 0, 0, 0); + } + } + } - private void FireAuricOrbs() - { - // Play a sound when orbs are fired - Main.PlaySound(SoundID.Item92, (int)projectile.Center.X, (int)projectile.Center.Y); + private void FireAuricOrbs() + { + // Play a sound when orbs are fired + Main.PlaySound(SoundID.Item92, (int)projectile.Center.X, (int)projectile.Center.Y); - int numOrbs = 3; - int orbID = mod.ProjectileType("Orbacle"); - int orbDamage = Oracle.BaseDamage * 3; - float orbKB = 8f; - float angleVariance = MathHelper.TwoPi / (float)numOrbs; - float spinOffsetAngle = MathHelper.Pi / (2f * numOrbs); - Vector2 posVec = new Vector2(2f, 0f).RotatedByRandom(MathHelper.TwoPi); + int numOrbs = 3; + int orbID = mod.ProjectileType("Orbacle"); + int orbDamage = Oracle.BaseDamage * 3; + float orbKB = 8f; + float angleVariance = MathHelper.TwoPi / (float)numOrbs; + float spinOffsetAngle = MathHelper.Pi / (2f * numOrbs); + Vector2 posVec = new Vector2(2f, 0f).RotatedByRandom(MathHelper.TwoPi); - for (int i = 0; i < numOrbs; ++i) - { - posVec = posVec.RotatedBy(angleVariance); - Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); - velocity.Normalize(); - velocity *= 18f; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); - } - } - } + for (int i = 0; i < numOrbs; ++i) + { + posVec = posVec.RotatedBy(angleVariance); + Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); + velocity.Normalize(); + velocity *= 18f; + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); + } + } + } } diff --git a/Projectiles/Patreon/PerforaMini.cs b/Projectiles/Patreon/PerforaMini.cs index 10582748f6..6e6b956522 100644 --- a/Projectiles/Patreon/PerforaMini.cs +++ b/Projectiles/Patreon/PerforaMini.cs @@ -1,174 +1,173 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using System; -using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class PerforaMini : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perforamini"); - Main.projFrames[projectile.type] = 8; - Main.projPet[projectile.type] = true; - } + public class PerforaMini : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforamini"); + Main.projFrames[projectile.type] = 8; + Main.projPet[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = false; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - Vector2 perfcenter = projectile.Center; - Vector2 vectorperf = player.Center - perfcenter; - float playerdistance = vectorperf.Length(); - if (!player.active) - { - projectile.active = false; - return; - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + Vector2 perfcenter = projectile.Center; + Vector2 vectorperf = player.Center - perfcenter; + float playerdistance = vectorperf.Length(); + if (!player.active) + { + projectile.active = false; + return; + } - //Delete the projectile if the player doesnt have the buff or is very far away (dunno if this needs to be deleted) - if (!player.HasBuff(mod.BuffType("BloodBound")) || playerdistance >= 4000f) - { - projectile.Kill(); - } + //Delete the projectile if the player doesnt have the buff or is very far away (dunno if this needs to be deleted) + if (!player.HasBuff(mod.BuffType("BloodBound")) || playerdistance >= 4000f) + { + projectile.Kill(); + } - CalamityPlayer modPlayer = player.Calamity(); - if (player.dead) - { - modPlayer.perfmini = false; - } - if (modPlayer.perfmini) - { - projectile.timeLeft = 2; - } + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.perfmini = false; + } + if (modPlayer.perfmini) + { + projectile.timeLeft = 2; + } - float num16 = 0.5f; - projectile.tileCollide = false; - int num17 = 100; - Vector2 vector3 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num18 = Main.player[projectile.owner].position.X + (Main.player[projectile.owner].width / 2) - vector3.X; - float num19 = Main.player[projectile.owner].position.Y + (Main.player[projectile.owner].height / 2) - vector3.Y; - num18 += 60 * -(float)Main.player[projectile.owner].direction; - num19 -= 60f; - float num20 = (float)Math.Sqrt(num18 * num18 + num19 * num19); - float num21 = 18f; - if (num20 < num17 && Main.player[projectile.owner].velocity.Y == 0f && - projectile.position.Y + projectile.height <= Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - if (num20 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (projectile.height / 2); - projectile.netUpdate = true; - } - if (num20 < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.99f; - } - num16 = 0.01f; - } - else - { - if (num20 < 100f) - { - num16 = 0.1f; - } - if (num20 > 300f) - { - num16 = 1f; - } - num20 = num21 / num20; - num18 *= num20; - num19 *= num20; - } - if (projectile.velocity.X < num18) - { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num16; - } - } - if (projectile.velocity.X > num18) - { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num16; - } - } - if (projectile.velocity.Y < num19) - { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; - } - } - if (projectile.velocity.Y > num19) - { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; - } - } - if (projectile.velocity.X >= 0.25) - { - projectile.direction = 1; - } - else if (projectile.velocity.X < -0.25) - { - projectile.direction = -1; - } + float num16 = 0.5f; + projectile.tileCollide = false; + int num17 = 100; + Vector2 vector3 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float num18 = Main.player[projectile.owner].position.X + (Main.player[projectile.owner].width / 2) - vector3.X; + float num19 = Main.player[projectile.owner].position.Y + (Main.player[projectile.owner].height / 2) - vector3.Y; + num18 += 60 * -(float)Main.player[projectile.owner].direction; + num19 -= 60f; + float num20 = (float)Math.Sqrt(num18 * num18 + num19 * num19); + float num21 = 18f; + if (num20 < num17 && Main.player[projectile.owner].velocity.Y == 0f && + projectile.position.Y + projectile.height <= Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (num20 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (projectile.height / 2); + projectile.netUpdate = true; + } + if (num20 < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.99f; + } + num16 = 0.01f; + } + else + { + if (num20 < 100f) + { + num16 = 0.1f; + } + if (num20 > 300f) + { + num16 = 1f; + } + num20 = num21 / num20; + num18 *= num20; + num19 *= num20; + } + if (projectile.velocity.X < num18) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > num18) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y < num19) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > num19) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + if (projectile.velocity.X >= 0.25) + { + projectile.direction = 1; + } + else if (projectile.velocity.X < -0.25) + { + projectile.direction = -1; + } - //Dust - if (Main.rand.NextBool(50)) - { - int d1 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); - int d2 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 170, 0f, 0f, 170, default, 0.5f); - Main.dust[d2].noLight = true; - Main.dust[d1].position = projectile.Center; - Main.dust[d2].position = projectile.Center; - } + //Dust + if (Main.rand.NextBool(50)) + { + int d1 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); + int d2 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 170, 0f, 0f, 170, default, 0.5f); + Main.dust[d2].noLight = true; + Main.dust[d1].position = projectile.Center; + Main.dust[d2].position = projectile.Center; + } - //Tilting and change directions - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.1f; + //Tilting and change directions + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.1f; - //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } - } + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + } } diff --git a/Projectiles/Patreon/PinkButterfly.cs b/Projectiles/Patreon/PinkButterfly.cs index bafe4fc126..b748d26cd4 100644 --- a/Projectiles/Patreon/PinkButterfly.cs +++ b/Projectiles/Patreon/PinkButterfly.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Patreon { public class PinkButterfly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pink Butterfly"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pink Butterfly"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -35,251 +35,251 @@ namespace CalamityMod.Projectiles.Patreon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 73, vector7.X, vector7.Y, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - projectile.rotation = projectile.velocity.X * 0.02f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.3f, 0.2f, 0.3f); - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("PinkButterfly"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("ResurrectionButterflyBuff"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.resButterfly = false; - } - if (modPlayer.resButterfly) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PinkButterfly")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 12f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 6f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 10f; - if (flag26) - { - num650 = 24f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-40f, -40f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 12f) - { - num650 = 12f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 73, vector7.X, vector7.Y, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + projectile.rotation = projectile.velocity.X * 0.02f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.3f, 0.2f, 0.3f); + float num633 = 700f; + float num634 = 1100f; + float num635 = 2400f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("PinkButterfly"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("ResurrectionButterflyBuff"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.resButterfly = false; + } + if (modPlayer.resButterfly) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PinkButterfly")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 12f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 6f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 10f; + if (flag26) + { + num650 = 24f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(-40f, -40f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 12f) + { + num650 = 12f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } - // Projectile fire timer - if (projectile.ai[1] > 0f) - projectile.ai[1] += (float)Main.rand.Next(1, 3); + // Projectile fire timer + if (projectile.ai[1] > 0f) + projectile.ai[1] += (float)Main.rand.Next(1, 3); - // Reset timer - if (projectile.ai[1] > 60f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } + // Reset timer + if (projectile.ai[1] > 60f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } - // Prevent firing immediately - if (projectile.localAI[0] < 120f) - projectile.localAI[0] += 1f; + // Prevent firing immediately + if (projectile.localAI[0] < 120f) + projectile.localAI[0] += 1f; - // Fire projectiles - if (projectile.ai[0] == 0f) - { - float velocity = 8f; - int projectileType = mod.ProjectileType("SakuraBullet"); - if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 8); - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= velocity; - int numProj = 2; - float rotation = MathHelper.ToRadians(4); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, projectileType, projectile.damage / 2, projectile.knockBack * 0.5f, Main.myPlayer, 0f, 0f); - } - projectile.netUpdate = true; - } - } - } + // Fire projectiles + if (projectile.ai[0] == 0f) + { + float velocity = 8f; + int projectileType = mod.ProjectileType("SakuraBullet"); + if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 8); + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= velocity; + int numProj = 2; + float rotation = MathHelper.ToRadians(4); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, projectileType, projectile.damage / 2, projectile.knockBack * 0.5f, Main.myPlayer, 0f, 0f); + } + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Patreon/PlagueBee.cs b/Projectiles/Patreon/PlagueBee.cs index 6b35ce8825..e456508ca8 100644 --- a/Projectiles/Patreon/PlagueBee.cs +++ b/Projectiles/Patreon/PlagueBee.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Patreon { public class PlagueBee : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Bee"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Bee"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -21,143 +21,143 @@ namespace CalamityMod.Projectiles.Patreon projectile.friendly = true; projectile.penetrate = 2; projectile.timeLeft = 420; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - } + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + } public override void AI() { - if (projectile.velocity.X > 0f) - { - projectile.spriteDirection = 1; - } - else if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - } - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter >= 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - float num373 = projectile.position.X; - float num374 = projectile.position.Y; - float num375 = 100000f; - bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) - { - projectile.ai[0] = 30f; - int num3; - for (int num376 = 0; num376 < 200; num376 = num3 + 1) - { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) - { - float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); - float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) - { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; - } - } - num3 = num376; - } - } - if (!flag10) - { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; - } - float num380 = 10f; - float num381 = 0.14f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); - num384 = num380 / num384; - num382 *= num384; - num383 *= num384; - if (projectile.velocity.X < num382) - { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; - } - } - else if (projectile.velocity.X > num382) - { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; - } - } - if (projectile.velocity.Y < num383) - { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; - } - } - else if (projectile.velocity.Y > num383) - { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; - } - } - } + if (projectile.velocity.X > 0f) + { + projectile.spriteDirection = 1; + } + else if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + } + projectile.rotation = projectile.velocity.X * 0.05f; + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + float num373 = projectile.position.X; + float num374 = projectile.position.Y; + float num375 = 100000f; + bool flag10 = false; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 30f) + { + projectile.ai[0] = 30f; + int num3; + for (int num376 = 0; num376 < 200; num376 = num3 + 1) + { + if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) + { + float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); + float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); + float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); + if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + { + num375 = num379; + num373 = num377; + num374 = num378; + flag10 = true; + } + } + num3 = num376; + } + } + if (!flag10) + { + num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; + num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; + } + float num380 = 10f; + float num381 = 0.14f; + Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num382 = num373 - vector30.X; + float num383 = num374 - vector30.Y; + float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); + num384 = num380 / num384; + num382 *= num384; + num383 *= num384; + if (projectile.velocity.X < num382) + { + projectile.velocity.X = projectile.velocity.X + num381; + if (projectile.velocity.X < 0f && num382 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num381 * 2f; + } + } + else if (projectile.velocity.X > num382) + { + projectile.velocity.X = projectile.velocity.X - num381; + if (projectile.velocity.X > 0f && num382 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num381 * 2f; + } + } + if (projectile.velocity.Y < num383) + { + projectile.velocity.Y = projectile.velocity.Y + num381; + if (projectile.velocity.Y < 0f && num383 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; + } + } + else if (projectile.velocity.Y > num383) + { + projectile.velocity.Y = projectile.velocity.Y - num381; + if (projectile.velocity.Y > 0f && num383 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + } + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - int num3; - for (int num418 = 0; num418 < 3; num418 = num3 + 1) - { - int num419 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); - Main.dust[num419].noGravity = true; - Main.dust[num419].scale = 1f; - num3 = num418; - } - } + public override void Kill(int timeLeft) + { + int num3; + for (int num418 = 0; num418 < 3; num418 = num3 + 1) + { + int num419 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); + Main.dust[num419].noGravity = true; + Main.dust[num419].scale = 1f; + num3 = num418; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + } + } } diff --git a/Projectiles/Patreon/Plaguenade.cs b/Projectiles/Patreon/Plaguenade.cs index 7ae8c9e6c1..b7a7d0e0e5 100644 --- a/Projectiles/Patreon/Plaguenade.cs +++ b/Projectiles/Patreon/Plaguenade.cs @@ -6,147 +6,147 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class Plaguenade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plaguenade"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguenade"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 180; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = oldVelocity.X * -0.5f; - } - if (projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f) - { - projectile.velocity.Y = oldVelocity.Y * -0.5f; - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = oldVelocity.X * -0.5f; + } + if (projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f) + { + projectile.velocity.Y = oldVelocity.Y * -0.5f; + } + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - int num3; - for (int num639 = 0; num639 < 20; num639 = num3 + 1) - { - float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; - float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, mod.ProjectileType("PlagueBee"), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - num3 = num639; - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + int num3; + for (int num639 = 0; num639 < 20; num639 = num3 + 1) + { + float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; + float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, mod.ProjectileType("PlagueBee"), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + num3 = num639; + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + } } diff --git a/Projectiles/Patreon/PurpleButterfly.cs b/Projectiles/Patreon/PurpleButterfly.cs index 20a6c17ca6..0d4a98d6cc 100644 --- a/Projectiles/Patreon/PurpleButterfly.cs +++ b/Projectiles/Patreon/PurpleButterfly.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Patreon { @@ -12,13 +12,13 @@ namespace CalamityMod.Projectiles.Patreon { public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purple Butterfly"); - Main.projFrames[projectile.type] = 4; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purple Butterfly"); + Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -39,9 +39,9 @@ namespace CalamityMod.Projectiles.Patreon { if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; @@ -52,14 +52,14 @@ namespace CalamityMod.Projectiles.Patreon } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = -projectile.direction; } @@ -74,221 +74,221 @@ namespace CalamityMod.Projectiles.Patreon { projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0.3f, 0f, 0.5f); - float num633 = 800f; - float num634 = 1000f; - float num635 = 1600f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("PurpleButterfly"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + Lighting.AddLight(projectile.Center, 0.3f, 0f, 0.5f); + float num633 = 800f; + float num634 = 1000f; + float num635 = 1600f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("PurpleButterfly"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("ResurrectionButterflyBuff"), 3600); if (flag64) - { - if (player.dead) - { - modPlayer.resButterfly = false; - } - if (modPlayer.resButterfly) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PurpleButterfly")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && + { + if (player.dead) + { + modPlayer.resButterfly = false; + } + if (modPlayer.resButterfly) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PurpleButterfly")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 18f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 9f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 10f; - if (flag26) - { - num650 = 24f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(40f, -40f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 12f) - { - num650 = 12f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 3); - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 300f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 12f; - projectile.netUpdate = true; - } - } - } + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 18f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 9f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 10f; + if (flag26) + { + num650 = 24f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(40f, -40f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 12f) + { + num650 = 12f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 3); + } + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 300f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 12f; + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (target.type == NPCID.DukeFishron) - damage = (int)((double)damage * 2.0); - else if (target.type == NPCID.CultistBoss) - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (target.type == NPCID.DukeFishron) + damage = (int)((double)damage * 2.0); + else if (target.type == NPCID.CultistBoss) + damage = (int)((double)damage * 0.5); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 6; } diff --git a/Projectiles/Patreon/Rox1.cs b/Projectiles/Patreon/Rox1.cs index 765483eb42..edc6f4eb74 100644 --- a/Projectiles/Patreon/Rox1.cs +++ b/Projectiles/Patreon/Rox1.cs @@ -1,67 +1,66 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class Rox1 : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.extraUpdates = 1; - } + public class Rox1 : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.extraUpdates = 1; + } - public override void AI() - { - //Gravity - projectile.velocity.Y = projectile.velocity.Y + 0.13f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - //Projectile rotation - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.spriteDirection = projectile.direction; - //Dust trail - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, projectile.velocity.X * 0.4f, projectile.velocity.Y * 0.4f, 160, default, 0.7f); - } - } + public override void AI() + { + //Gravity + projectile.velocity.Y = projectile.velocity.Y + 0.13f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + //Projectile rotation + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + projectile.spriteDirection = projectile.direction; + //Dust trail + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, projectile.velocity.X * 0.4f, projectile.velocity.Y * 0.4f, 160, default, 0.7f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - //Changes the texture of the projectile - if (projectile.ai[0] == 1f) - { - Texture2D texture = mod.GetTexture("Projectiles/Patreon/Rox2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; - } - if (projectile.ai[0] == 2f) - { - Texture2D texture = mod.GetTexture("Projectiles/Patreon/Rox3"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Changes the texture of the projectile + if (projectile.ai[0] == 1f) + { + Texture2D texture = mod.GetTexture("Projectiles/Patreon/Rox2"); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + if (projectile.ai[0] == 2f) + { + Texture2D texture = mod.GetTexture("Projectiles/Patreon/Rox3"); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + return true; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - for (int i = 0; i < 8; i++) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, -projectile.velocity.X * 0.4f, -projectile.velocity.Y * 0.4f, 120, default, 1.2f); - } - Main.PlaySound(0, projectile.position); - projectile.Kill(); - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + for (int i = 0; i < 8; i++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, -projectile.velocity.X * 0.4f, -projectile.velocity.Y * 0.4f, 120, default, 1.2f); + } + Main.PlaySound(0, projectile.position); + projectile.Kill(); + return false; + } + } } diff --git a/Projectiles/Patreon/RoxShockwave.cs b/Projectiles/Patreon/RoxShockwave.cs index 40e113b259..928eb3c607 100644 --- a/Projectiles/Patreon/RoxShockwave.cs +++ b/Projectiles/Patreon/RoxShockwave.cs @@ -1,25 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class RoxShockwave : ModProjectile - { - public override void SetDefaults() - { - projectile.penetrate = -1; - projectile.width = 450; - projectile.height = 450; - projectile.melee = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 40; - } - } + public class RoxShockwave : ModProjectile + { + public override void SetDefaults() + { + projectile.penetrate = -1; + projectile.width = 450; + projectile.height = 450; + projectile.melee = true; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.timeLeft = 40; + } + } } diff --git a/Projectiles/Patreon/RoxSlam.cs b/Projectiles/Patreon/RoxSlam.cs index a209a72a67..b9e0e24bb2 100644 --- a/Projectiles/Patreon/RoxSlam.cs +++ b/Projectiles/Patreon/RoxSlam.cs @@ -1,72 +1,66 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class RoxSlam : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.melee = true; - projectile.timeLeft = 400; - projectile.tileCollide = true; - } + public class RoxSlam : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.melee = true; + projectile.timeLeft = 400; + projectile.tileCollide = true; + } - public override void AI() - { - Player player = Main.player[Main.myPlayer]; - //Kills the projectile if the alt attack ended - if (player.itemAnimation == 0) - { - projectile.Kill(); - } - //Makes the projectiles follow the player - projectile.velocity.X = player.velocity.X; - projectile.velocity.Y = player.velocity.Y; - } + public override void AI() + { + Player player = Main.player[Main.myPlayer]; + //Kills the projectile if the alt attack ended + if (player.itemAnimation == 0) + { + projectile.Kill(); + } + //Makes the projectiles follow the player + projectile.velocity.X = player.velocity.X; + projectile.velocity.Y = player.velocity.Y; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - //This will only happen if the cooldown was full - if (projectile.ai[0] == 1) - { - Player player = Main.player[Main.myPlayer]; - //Bounce - player.velocity.Y = -18f; - //Spawns the shockwave - Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, mod.ProjectileType("RoxShockwave"), 300, 12, projectile.owner); - Main.PlaySound(2, projectile.position, 14); - projectile.Kill(); - //Pretty things - for (int dustexplode = 0; dustexplode < 360; dustexplode++) - { - Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); - int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 51, dustd.X, dustd.Y, 100, default, 3f); - Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; - } - return false; - } - //If the cooldown wasnt full, just bounce - else - { - Player player = Main.player[Main.myPlayer]; - player.velocity.Y = -14f; - Main.PlaySound(21, projectile.position); - projectile.Kill(); + public override bool OnTileCollide(Vector2 oldVelocity) + { + //This will only happen if the cooldown was full + if (projectile.ai[0] == 1) + { + Player player = Main.player[Main.myPlayer]; + //Bounce + player.velocity.Y = -18f; + //Spawns the shockwave + Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, mod.ProjectileType("RoxShockwave"), 300, 12, projectile.owner); + Main.PlaySound(2, projectile.position, 14); + projectile.Kill(); + //Pretty things + for (int dustexplode = 0; dustexplode < 360; dustexplode++) + { + Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); + int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 51, dustd.X, dustd.Y, 100, default, 3f); + Main.dust[d].noGravity = true; + Main.dust[d].position = projectile.Center; + } + return false; + } + //If the cooldown wasnt full, just bounce + else + { + Player player = Main.player[Main.myPlayer]; + player.velocity.Y = -14f; + Main.PlaySound(21, projectile.position); + projectile.Kill(); - return false; - } - } - } + return false; + } + } + } } diff --git a/Projectiles/Patreon/SakuraBullet.cs b/Projectiles/Patreon/SakuraBullet.cs index d0432c20fd..321e992b0f 100644 --- a/Projectiles/Patreon/SakuraBullet.cs +++ b/Projectiles/Patreon/SakuraBullet.cs @@ -1,99 +1,99 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class SakuraBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sakura Bullet"); - } + public class SakuraBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sakura Bullet"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.netImportant = true; + projectile.penetrate = 1; + projectile.timeLeft = 150; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + } - public override void AI() - { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + public override void AI() + { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) || Main.npc[num475].type == NPCID.DukeFishron) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) || Main.npc[num475].type == NPCID.DukeFishron) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } - if (flag17) - { - float num483 = 11f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (flag17) + { + float num483 = 11f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (target.type == NPCID.DukeFishron) - damage = (int)((double)damage * 2.0); - else if (target.type == NPCID.CultistBoss) - damage = (int)((double)damage * 0.5); - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (target.type == NPCID.DukeFishron) + damage = (int)((double)damage * 2.0); + else if (target.type == NPCID.CultistBoss) + damage = (int)((double)damage * 0.5); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 25); - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 0.5f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.4f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.8f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 25); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 0.5f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.4f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.8f); + } + } } diff --git a/Projectiles/Patreon/ThePackMinissile.cs b/Projectiles/Patreon/ThePackMinissile.cs index 5e3b129472..c71c311388 100644 --- a/Projectiles/Patreon/ThePackMinissile.cs +++ b/Projectiles/Patreon/ThePackMinissile.cs @@ -1,85 +1,85 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class ThePackMinissile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pack Minissile"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pack Minissile"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1500f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 15f + num484) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; - return; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 1500f; + bool homeIn = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 15f + num484) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; + return; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int i = 0; i < 10; i++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1f); + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int i = 0; i < 10; i++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1f); - } - } - } + } + } + } } diff --git a/Projectiles/Patreon/ThePackMissile.cs b/Projectiles/Patreon/ThePackMissile.cs index 05cdaa344b..4ec8a6c966 100644 --- a/Projectiles/Patreon/ThePackMissile.cs +++ b/Projectiles/Patreon/ThePackMissile.cs @@ -1,130 +1,130 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class ThePackMissile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pack Missile"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pack Missile"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 82; - projectile.height = 18; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 18; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 2500f; - float explode = 200f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < explode) - { - int numProj = 4; - float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - speed.Normalize(); - speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("ThePackMinissile"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.Kill(); - return; - } - else if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 15f + num484) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; - return; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 2500f; + float explode = 200f; + bool homeIn = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < explode) + { + int numProj = 4; + float rotation = MathHelper.ToRadians(50); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (speed.X == 0f && speed.Y == 0f) + { + speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + speed.Normalize(); + speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("ThePackMinissile"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.Kill(); + return; + } + else if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 15f + num484) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; + return; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 400; - projectile.height = 400; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1.5f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1.5f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 400; + projectile.height = 400; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1.5f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1.5f); + Main.dust[num624].velocity *= 2f; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Patreon/TimeBolt.cs b/Projectiles/Patreon/TimeBolt.cs index 9be93e142e..847deca234 100644 --- a/Projectiles/Patreon/TimeBolt.cs +++ b/Projectiles/Patreon/TimeBolt.cs @@ -1,7 +1,7 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,304 +9,304 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { public class TimeBolt : ModProjectile - { - private int penetrationAmt = 6; + { + private int penetrationAmt = 6; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Time Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Time Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = penetrationAmt; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.friendly = true; + projectile.penetrate = penetrationAmt; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(penetrationAmt); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(penetrationAmt); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - penetrationAmt = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + penetrationAmt = reader.ReadInt32(); + } - public override void AI() - { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.03f; + public override void AI() + { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.03f; - // If projectile hasn't hit anything yet - if (projectile.ai[0] == 0f) - { - projectile.tileCollide = true; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 7f) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 226, - 229 - }); - Vector2 center = projectile.Center; - Vector2 vector74 = new Vector2(-4f, 4f); - vector74 += new Vector2(-4f, 4f); - vector74 = vector74.RotatedBy((double)projectile.rotation, default); - int dust = Dust.NewDust(center + vector74 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 1f); - Dust dust2 = Main.dust[dust]; - dust2.velocity *= 0.1f; - if (Main.rand.Next(6) != 0) - dust2.noGravity = true; - } - float num773 = 0.01f; - int num774 = 5; - int num775 = num774 * 15; - int num776 = 0; - if (projectile.localAI[0] > 7f) - { - if (projectile.localAI[1] == 0f) - { - projectile.scale -= num773; + // If projectile hasn't hit anything yet + if (projectile.ai[0] == 0f) + { + projectile.tileCollide = true; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 7f) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 226, + 229 + }); + Vector2 center = projectile.Center; + Vector2 vector74 = new Vector2(-4f, 4f); + vector74 += new Vector2(-4f, 4f); + vector74 = vector74.RotatedBy((double)projectile.rotation, default); + int dust = Dust.NewDust(center + vector74 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 1f); + Dust dust2 = Main.dust[dust]; + dust2.velocity *= 0.1f; + if (Main.rand.Next(6) != 0) + dust2.noGravity = true; + } + float num773 = 0.01f; + int num774 = 5; + int num775 = num774 * 15; + int num776 = 0; + if (projectile.localAI[0] > 7f) + { + if (projectile.localAI[1] == 0f) + { + projectile.scale -= num773; - projectile.alpha += num774; - if (projectile.alpha > num775) - { - projectile.alpha = num775; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += num773; + projectile.alpha += num774; + if (projectile.alpha > num775) + { + projectile.alpha = num775; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += num773; - projectile.alpha -= num774; - if (projectile.alpha <= num776) - { - projectile.alpha = num776; - projectile.localAI[1] = 0f; - } - } - } - } + projectile.alpha -= num774; + if (projectile.alpha <= num776) + { + projectile.alpha = num776; + projectile.localAI[1] = 0f; + } + } + } + } - // If projectile has hit an enemy and has 'split' - else if (projectile.ai[0] >= 1f && projectile.ai[0] < (float)(1 + penetrationAmt)) - { - projectile.tileCollide = false; - projectile.alpha += 15; - projectile.velocity *= 0.98f; - projectile.localAI[0] = 0f; + // If projectile has hit an enemy and has 'split' + else if (projectile.ai[0] >= 1f && projectile.ai[0] < (float)(1 + penetrationAmt)) + { + projectile.tileCollide = false; + projectile.alpha += 15; + projectile.velocity *= 0.98f; + projectile.localAI[0] = 0f; - if (projectile.alpha >= 255) - { - if (projectile.ai[0] == 1f) - { - projectile.Kill(); - return; - } + if (projectile.alpha >= 255) + { + if (projectile.ai[0] == 1f) + { + projectile.Kill(); + return; + } - int whoAmI = -1; - Vector2 value19 = projectile.Center; - float num778 = 300f; - int j; - for (int i = 0; i < 200; i = j + 1) - { - NPC nPC = Main.npc[i]; - if (nPC.CanBeChasedBy(projectile, false)) - { - Vector2 center = nPC.Center; - float num780 = Vector2.Distance(center, projectile.Center); - if (num780 < num778) - { - num778 = num780; - value19 = center; - whoAmI = i; - } - } - j = i; - } + int whoAmI = -1; + Vector2 value19 = projectile.Center; + float num778 = 300f; + int j; + for (int i = 0; i < 200; i = j + 1) + { + NPC nPC = Main.npc[i]; + if (nPC.CanBeChasedBy(projectile, false)) + { + Vector2 center = nPC.Center; + float num780 = Vector2.Distance(center, projectile.Center); + if (num780 < num778) + { + num778 = num780; + value19 = center; + whoAmI = i; + } + } + j = i; + } - if (whoAmI >= 0) - { - projectile.netUpdate = true; - projectile.ai[0] += (float)penetrationAmt; - projectile.position = value19 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - projectile.velocity = Vector2.Normalize(value19 - projectile.Center) * 18f; - } - else - projectile.Kill(); - } + if (whoAmI >= 0) + { + projectile.netUpdate = true; + projectile.ai[0] += (float)penetrationAmt; + projectile.position = value19 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + projectile.velocity = Vector2.Normalize(value19 - projectile.Center) * 18f; + } + else + projectile.Kill(); + } - if (Main.rand.NextBool(3)) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 226, - 229 - }); - Vector2 center = projectile.Center; - Vector2 vector75 = new Vector2(-4f, 4f); - vector75 += new Vector2(-4f, 4f); - vector75 = vector75.RotatedBy((double)projectile.rotation, default); - int dust = Dust.NewDust(center + vector75 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); - Dust dust2 = Main.dust[dust]; - dust2.velocity *= 0.1f; - dust2.noGravity = true; - } - } + if (Main.rand.NextBool(3)) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 226, + 229 + }); + Vector2 center = projectile.Center; + Vector2 vector75 = new Vector2(-4f, 4f); + vector75 += new Vector2(-4f, 4f); + vector75 = vector75.RotatedBy((double)projectile.rotation, default); + int dust = Dust.NewDust(center + vector75 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); + Dust dust2 = Main.dust[dust]; + dust2.velocity *= 0.1f; + dust2.noGravity = true; + } + } - // If 'split' projectile has a target - else if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) - { - projectile.scale = 0.9f; - projectile.tileCollide = false; + // If 'split' projectile has a target + else if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + { + projectile.scale = 0.9f; + projectile.tileCollide = false; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 15f) - { - projectile.alpha += 51; - projectile.velocity *= 0.8f; + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 15f) + { + projectile.alpha += 51; + projectile.velocity *= 0.8f; - if (projectile.alpha >= 255) - projectile.Kill(); - } - else - { - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (projectile.alpha >= 255) + projectile.Kill(); + } + else + { + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; - projectile.velocity *= 0.98f; - } + projectile.velocity *= 0.98f; + } - projectile.localAI[0] += 1f; + projectile.localAI[0] += 1f; - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 226, - 229 - }); - Vector2 center = projectile.Center; - Vector2 vector76 = new Vector2(-4f, 4f); - vector76 += new Vector2(-4f, 4f); - vector76 = vector76.RotatedBy((double)projectile.rotation, default); - int dust = Dust.NewDust(center + vector76 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); - Dust dust2 = Main.dust[dust]; - dust2.velocity *= 0.1f; - dust2.noGravity = true; - } + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 226, + 229 + }); + Vector2 center = projectile.Center; + Vector2 vector76 = new Vector2(-4f, 4f); + vector76 += new Vector2(-4f, 4f); + vector76 = vector76.RotatedBy((double)projectile.rotation, default); + int dust = Dust.NewDust(center + vector76 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); + Dust dust2 = Main.dust[dust]; + dust2.velocity *= 0.1f; + dust2.noGravity = true; + } - float colorScale = (float)projectile.alpha / 255f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.3f * colorScale, 0.4f * colorScale, 1f * colorScale); - } + float colorScale = (float)projectile.alpha / 255f; + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.3f * colorScale, 0.4f * colorScale, 1f * colorScale); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 200) * ((255f - (float)projectile.alpha) / 255f); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, 200) * ((255f - (float)projectile.alpha) / 255f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - projectile.velocity = oldVelocity / 2f; + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + projectile.velocity = oldVelocity / 2f; - if (penetrationAmt == 6) - SlowTime(); + if (penetrationAmt == 6) + SlowTime(); - penetrationAmt = 2; + penetrationAmt = 2; - return false; - } + return false; + } - public override bool CanDamage() - { - // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames - if ((((int)(projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || projectile.ai[1] < 5f) && projectile.ai[0] != 0f) - return false; - return true; - } + public override bool CanDamage() + { + // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames + if ((((int)(projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || projectile.ai[1] < 5f) && projectile.ai[0] != 0f) + return false; + return true; + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (penetrationAmt == 6) - SlowTime(); + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (penetrationAmt == 6) + SlowTime(); - // If 'split' projectile hits an enemy - if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) - projectile.ai[0] = 0f; + // If 'split' projectile hits an enemy + if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + projectile.ai[0] = 0f; - // Becomes 5 on first hit, then 4, and so on - penetrationAmt--; + // Becomes 5 on first hit, then 4, and so on + penetrationAmt--; - // Hits enemy, ai[0] = 0f + 4f = 4f on first hit - // ai[0] = 4f - 1f = 3f on second hit - // ai[0] = 3f - 1f = 2f on third hit - if (projectile.ai[0] == 0f) - projectile.ai[0] += (float)penetrationAmt; - else - projectile.ai[0] -= (float)(penetrationAmt + 1); + // Hits enemy, ai[0] = 0f + 4f = 4f on first hit + // ai[0] = 4f - 1f = 3f on second hit + // ai[0] = 3f - 1f = 2f on third hit + if (projectile.ai[0] == 0f) + projectile.ai[0] += (float)penetrationAmt; + else + projectile.ai[0] -= (float)(penetrationAmt + 1); - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } - private void SlowTime() - { - Main.PlaySound(SoundID.Item114, projectile.Center); + private void SlowTime() + { + Main.PlaySound(SoundID.Item114, projectile.Center); - int radius = 300; - int numDust = (int)(0.2f * MathHelper.TwoPi * radius); - float angleIncrement = MathHelper.TwoPi / (float)numDust; - Vector2 dustOffset = new Vector2(radius, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - int dustType = 0; - int dust = 0; - for (int i = 0; i < numDust; i++) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 226, - 229 - }); - dust = Dust.NewDust(projectile.Center, 1, 1, dustType); - Main.dust[dust].position = projectile.Center + dustOffset; - if (Main.rand.Next(6) != 0) - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].scale = 0.3f; - } + int radius = 300; + int numDust = (int)(0.2f * MathHelper.TwoPi * radius); + float angleIncrement = MathHelper.TwoPi / (float)numDust; + Vector2 dustOffset = new Vector2(radius, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + int dustType = 0; + int dust = 0; + for (int i = 0; i < numDust; i++) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 226, + 229 + }); + dust = Dust.NewDust(projectile.Center, 1, 1, dustType); + Main.dust[dust].position = projectile.Center + dustOffset; + if (Main.rand.Next(6) != 0) + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].scale = 0.3f; + } - int buffType = mod.BuffType("TimeSlow"); - int damage = projectile.damage / 2; + int buffType = mod.BuffType("TimeSlow"); + int damage = projectile.damage / 2; - for (int i = 0; i < 200; i++) - { - NPC nPC = Main.npc[i]; - if (nPC.active && !nPC.dontTakeDamage && !nPC.buffImmune[buffType] && Vector2.Distance(projectile.Center, nPC.Center) <= (float)radius) - { - if (nPC.FindBuffIndex(buffType) == -1) - nPC.AddBuff(buffType, 180, false); - } - } - } - } + for (int i = 0; i < 200; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && !nPC.dontTakeDamage && !nPC.buffImmune[buffType] && Vector2.Distance(projectile.Center, nPC.Center) <= (float)radius) + { + if (nPC.FindBuffIndex(buffType) == -1) + nPC.AddBuff(buffType, 180, false); + } + } + } + } } diff --git a/Projectiles/Patreon/VoidEssence.cs b/Projectiles/Patreon/VoidEssence.cs index b279f1f379..4943dcc980 100644 --- a/Projectiles/Patreon/VoidEssence.cs +++ b/Projectiles/Patreon/VoidEssence.cs @@ -7,200 +7,200 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class VoidEssence : ModProjectile - { - private const int NumAnimationFrames = 4; - private const int AnimationFrameTime = 12; - private const float TentacleRange = 140f; - private const float TentacleCooldown = 25f; + public class VoidEssence : ModProjectile + { + private const int NumAnimationFrames = 4; + private const int AnimationFrameTime = 12; + private const float TentacleRange = 140f; + private const float TentacleCooldown = 25f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Void Essence"); - Main.projFrames[projectile.type] = NumAnimationFrames; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void Essence"); + Main.projFrames[projectile.type] = NumAnimationFrames; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.height = 24; - projectile.width = 24; - projectile.melee = true; - projectile.timeLeft = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 80; + public override void SetDefaults() + { + projectile.height = 24; + projectile.width = 24; + projectile.melee = true; + projectile.timeLeft = 100; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 80; - projectile.penetrate = 8; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.extraUpdates = 1; - } + projectile.penetrate = 8; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.extraUpdates = 1; + } - public override void AI() - { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - drawOffsetX = 1; - drawOriginOffsetY = 4; + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + drawOffsetX = 1; + drawOriginOffsetY = 4; - // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > AnimationFrameTime) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= NumAnimationFrames) - projectile.frame = 0; + // Update animation + projectile.frameCounter++; + if (projectile.frameCounter > AnimationFrameTime) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= NumAnimationFrames) + projectile.frame = 0; - // Produce light - Lighting.AddLight(projectile.Center, 0.9f, 0.9f, 1.0f); + // Produce light + Lighting.AddLight(projectile.Center, 0.9f, 0.9f, 1.0f); - // Continuously trail dust - int trailDust = 1; - for (int i = 0; i < trailDust; ++i) - { - int dustID = Main.rand.NextBool(8) ? 66 : 143; + // Continuously trail dust + int trailDust = 1; + for (int i = 0; i < trailDust; ++i) + { + int dustID = Main.rand.NextBool(8) ? 66 : 143; - int idx = Dust.NewDust(projectile.position - projectile.velocity, projectile.width, projectile.height, dustID); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity += projectile.velocity * 0.8f; - } + int idx = Dust.NewDust(projectile.position - projectile.velocity, projectile.width, projectile.height, dustID); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity += projectile.velocity * 0.8f; + } - // If tentacle is currently on cooldown, reduce the cooldown. - if (projectile.ai[0] > 0f) - projectile.ai[0] -= 1f; + // If tentacle is currently on cooldown, reduce the cooldown. + if (projectile.ai[0] > 0f) + projectile.ai[0] -= 1f; - // Home in on nearby enemies if homing is enabled - if (projectile.ai[1] == 0f) - HomingAI(); + // Home in on nearby enemies if homing is enabled + if (projectile.ai[1] == 0f) + HomingAI(); - // Fade out if about to despawn - if (projectile.timeLeft <= 40 && projectile.timeLeft % 5 == 0) - { - projectile.alpha += 20; - if (projectile.alpha > 255) - projectile.alpha = 255; - } - } + // Fade out if about to despawn + if (projectile.timeLeft <= 40 && projectile.timeLeft % 5 == 0) + { + projectile.alpha += 20; + if (projectile.alpha > 255) + projectile.alpha = 255; + } + } - private void HomingAI() - { - // Find the closest NPC within range. - int targetIdx = -1; - float maxHomingRange = 400f; - bool hasHomingTarget = false; - for (int i = 0; i < Main.npc.Length; ++i) - { - NPC npc = Main.npc[i]; - if (npc == null || !npc.active) - continue; + private void HomingAI() + { + // Find the closest NPC within range. + int targetIdx = -1; + float maxHomingRange = 400f; + bool hasHomingTarget = false; + for (int i = 0; i < Main.npc.Length; ++i) + { + NPC npc = Main.npc[i]; + if (npc == null || !npc.active) + continue; - // Won't home in through walls and won't chase invulnerable targets. - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) - { - float dist = (projectile.Center - npc.Center).Length(); - if (dist < maxHomingRange) - { - targetIdx = i; - maxHomingRange = dist; - hasHomingTarget = true; - } - } - } + // Won't home in through walls and won't chase invulnerable targets. + if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = i; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } - // Home in on said closest NPC. - if (hasHomingTarget) - { - NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * Nadir.ShootSpeed; - float homingRatio = 35f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + // Home in on said closest NPC. + if (hasHomingTarget) + { + NPC target = Main.npc[targetIdx]; + Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * Nadir.ShootSpeed; + float homingRatio = 35f; + projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); - // If the target is close enough and tentacle is off cooldown, summon one. - // maxHomingRange doubles as the distance to the target. - if (projectile.ai[0] <= 0f && maxHomingRange <= TentacleRange) - { - Vector2 projVel = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero); - projVel *= 6f; - SpawnTentacle(projVel); - projectile.ai[0] = TentacleCooldown; - } - } - } + // If the target is close enough and tentacle is off cooldown, summon one. + // maxHomingRange doubles as the distance to the target. + if (projectile.ai[0] <= 0f && maxHomingRange <= TentacleRange) + { + Vector2 projVel = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero); + projVel *= 6f; + SpawnTentacle(projVel); + projectile.ai[0] = TentacleCooldown; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - // Rapidly screech to a halt upon touching an enemy and disable homing. - projectile.velocity *= 0.4f; - projectile.ai[1] = 1f; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Rapidly screech to a halt upon touching an enemy and disable homing. + projectile.velocity *= 0.4f; + projectile.ai[1] = 1f; - // Fade out a bit with every hit - projectile.alpha += 20; - if (projectile.alpha > 255) - projectile.alpha = 255; + // Fade out a bit with every hit + projectile.alpha += 20; + if (projectile.alpha > 255) + projectile.alpha = 255; - // Explode into dust (as if being shredded apart on contact) - int onHitDust = Main.rand.Next(6, 11); - for (int i = 0; i < onHitDust; ++i) - { - int dustID = Main.rand.NextBool() ? 198 : 199; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f); + // Explode into dust (as if being shredded apart on contact) + int onHitDust = Main.rand.Next(6, 11); + for (int i = 0; i < onHitDust; ++i) + { + int dustID = Main.rand.NextBool() ? 198 : 199; + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f); - Main.dust[idx].noGravity = true; - float speed = Main.rand.NextFloat(1.4f, 2.6f); - Main.dust[idx].velocity *= speed; - float scale = Main.rand.NextFloat(1.0f, 1.8f); - Main.dust[idx].scale = scale; - } - } + Main.dust[idx].noGravity = true; + float speed = Main.rand.NextFloat(1.4f, 2.6f); + Main.dust[idx].velocity *= speed; + float scale = Main.rand.NextFloat(1.0f, 1.8f); + Main.dust[idx].scale = scale; + } + } - public override void Kill(int timeLeft) - { - // Create a burst of dust - int killDust = Main.rand.Next(30, 41); - for (int i = 0; i < killDust; ++i) - { - int dustID = Main.rand.NextBool() ? 198 : 199; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f); + public override void Kill(int timeLeft) + { + // Create a burst of dust + int killDust = Main.rand.Next(30, 41); + for (int i = 0; i < killDust; ++i) + { + int dustID = Main.rand.NextBool() ? 198 : 199; + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f); - Main.dust[idx].noGravity = true; - float speed = Main.rand.NextFloat(2.0f, 3.1f); - Main.dust[idx].velocity *= speed; - float scale = Main.rand.NextFloat(1.0f, 1.8f); - Main.dust[idx].scale = scale; - } + Main.dust[idx].noGravity = true; + float speed = Main.rand.NextFloat(2.0f, 3.1f); + Main.dust[idx].velocity *= speed; + float scale = Main.rand.NextFloat(1.0f, 1.8f); + Main.dust[idx].scale = scale; + } - // Spawn three tentacles pointing in random directions - for (int i = 0; i < 3; ++i) - { - Vector2 projVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi); - projVel *= 4f; - SpawnTentacle(projVel); - } - } + // Spawn three tentacles pointing in random directions + for (int i = 0; i < 3; ++i) + { + Vector2 projVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + projVel *= 4f; + SpawnTentacle(projVel); + } + } - private void SpawnTentacle(Vector2 tentacleVelocity) - { - int damage = Nadir.BaseDamage; - float kb = 7f; + private void SpawnTentacle(Vector2 tentacleVelocity) + { + int damage = Nadir.BaseDamage; + float kb = 7f; - // Randomize tentacle behavior variables - float ai0 = Main.rand.NextFloat(0.01f, 0.08f); - ai0 *= Main.rand.NextBool() ? -1f : 1f; - float ai1 = Main.rand.NextFloat(0.01f, 0.08f); - ai1 *= Main.rand.NextBool() ? -1f : 1f; + // Randomize tentacle behavior variables + float ai0 = Main.rand.NextFloat(0.01f, 0.08f); + ai0 *= Main.rand.NextBool() ? -1f : 1f; + float ai1 = Main.rand.NextFloat(0.01f, 0.08f); + ai1 *= Main.rand.NextBool() ? -1f : 1f; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, tentacleVelocity, mod.ProjectileType("VoidTentacle"), damage, kb, projectile.owner, ai0, ai1); - } - } + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center, tentacleVelocity, mod.ProjectileType("VoidTentacle"), damage, kb, projectile.owner, ai0, ai1); + } + } } diff --git a/Projectiles/Patreon/VoidTentacle.cs b/Projectiles/Patreon/VoidTentacle.cs index 0c78dc87f5..8284c38b2d 100644 --- a/Projectiles/Patreon/VoidTentacle.cs +++ b/Projectiles/Patreon/VoidTentacle.cs @@ -5,86 +5,86 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class VoidTentacle : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Void Tentacle"); - } - public override void SetDefaults() - { - projectile.height = 160; - projectile.width = 160; - projectile.melee = true; - projectile.friendly = true; - projectile.MaxUpdates = 3; + public class VoidTentacle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void Tentacle"); + } + public override void SetDefaults() + { + projectile.height = 160; + projectile.width = 160; + projectile.melee = true; + projectile.friendly = true; + projectile.MaxUpdates = 3; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } - public override void AI() - { - // HOW CAN THIS CODE EVER RUN - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - projectile.velocity.X = -projectile.velocity.X; - else - projectile.Kill(); - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - projectile.velocity.Y = -projectile.velocity.Y; - else - projectile.Kill(); - } + public override void AI() + { + // HOW CAN THIS CODE EVER RUN + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + projectile.velocity.X = -projectile.velocity.X; + else + projectile.Kill(); + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + projectile.velocity.Y = -projectile.velocity.Y; + else + projectile.Kill(); + } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int i = 0; - while (i < projectile.scale * 4f) - { - int dustID = Main.rand.NextBool(5) ? 199 : 175; - int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustID, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); - Main.dust[idx].position = (Main.dust[idx].position + projectile.Center) / 2f; - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[idx].fadeIn = (float)(100 + projectile.owner); - Main.dust[idx].scale += projectile.scale * 0.75f; - i++; - } - } - } - } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int i = 0; + while (i < projectile.scale * 4f) + { + int dustID = Main.rand.NextBool(5) ? 199 : 175; + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustID, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); + Main.dust[idx].position = (Main.dust[idx].position + projectile.Center) / 2f; + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 0.1f; + Main.dust[idx].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[idx].fadeIn = (float)(100 + projectile.owner); + Main.dust[idx].scale += projectile.scale * 0.75f; + i++; + } + } + } + } } diff --git a/Projectiles/Patreon/YateveoBloom.cs b/Projectiles/Patreon/YateveoBloom.cs index fef315698b..bf8b9e9243 100644 --- a/Projectiles/Patreon/YateveoBloom.cs +++ b/Projectiles/Patreon/YateveoBloom.cs @@ -1,231 +1,231 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class YateveoBloom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yateveo Bloom"); - } + public class YateveoBloom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yateveo Bloom"); + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.alpha = 255; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Vector2 vector62 = Main.player[projectile.owner].MountedCenter - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; - float distance = vector62.Length(); + public override void AI() + { + Vector2 vector62 = Main.player[projectile.owner].MountedCenter - projectile.Center; + projectile.rotation = vector62.ToRotation() - 1.57f; + float distance = vector62.Length(); - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; + Main.player[projectile.owner].itemAnimation = 10; + Main.player[projectile.owner].itemTime = 10; - if (vector62.X < 0f) - { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; - } + if (vector62.X < 0f) + { + Main.player[projectile.owner].ChangeDir(1); + projectile.direction = 1; + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + projectile.direction = -1; + } - if (projectile.ai[0] == 0f) - { - projectile.tileCollide = true; - if (distance > 210f) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - else if (!Main.player[projectile.owner].channel) - { - if (projectile.velocity.Y < 0f) - projectile.velocity.Y = projectile.velocity.Y * 0.9f; + if (projectile.ai[0] == 0f) + { + projectile.tileCollide = true; + if (distance > 210f) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + else if (!Main.player[projectile.owner].channel) + { + if (projectile.velocity.Y < 0f) + projectile.velocity.Y = projectile.velocity.Y * 0.9f; - projectile.velocity.Y = projectile.velocity.Y + 1f; - projectile.velocity.X = projectile.velocity.X * 0.9f; - } - } - else - { - float num211 = (14f / Main.player[projectile.owner].meleeSpeed) * 1.25f; - float num212 = (0.9f / Main.player[projectile.owner].meleeSpeed) * 1.25f; + projectile.velocity.Y = projectile.velocity.Y + 1f; + projectile.velocity.X = projectile.velocity.X * 0.9f; + } + } + else + { + float num211 = (14f / Main.player[projectile.owner].meleeSpeed) * 1.25f; + float num212 = (0.9f / Main.player[projectile.owner].meleeSpeed) * 1.25f; - if (projectile.ai[1] == 1f) - projectile.tileCollide = false; + if (projectile.ai[1] == 1f) + projectile.tileCollide = false; - if (!Main.player[projectile.owner].channel || distance > 375f || !projectile.tileCollide) - { - projectile.ai[1] = 1f; + if (!Main.player[projectile.owner].channel || distance > 375f || !projectile.tileCollide) + { + projectile.ai[1] = 1f; - if (projectile.tileCollide) - projectile.netUpdate = true; + if (projectile.tileCollide) + projectile.netUpdate = true; - projectile.tileCollide = false; + projectile.tileCollide = false; - if (distance < 20f) - projectile.Kill(); - } + if (distance < 20f) + projectile.Kill(); + } - if (!projectile.tileCollide) - num212 *= 2f; + if (!projectile.tileCollide) + num212 *= 2f; - if (distance > 80f || !projectile.tileCollide) - { - distance = num211 / distance; - vector62.X *= distance; - vector62.Y *= distance; + if (distance > 80f || !projectile.tileCollide) + { + distance = num211 / distance; + vector62.X *= distance; + vector62.Y *= distance; - Vector2 vector21 = new Vector2(projectile.velocity.X, projectile.velocity.Y); - float num217 = vector62.X - projectile.velocity.X; - float num218 = vector62.Y - projectile.velocity.Y; - float num219 = (float)Math.Sqrt((double)(num217 * num217 + num218 * num218)); + Vector2 vector21 = new Vector2(projectile.velocity.X, projectile.velocity.Y); + float num217 = vector62.X - projectile.velocity.X; + float num218 = vector62.Y - projectile.velocity.Y; + float num219 = (float)Math.Sqrt((double)(num217 * num217 + num218 * num218)); - num219 = num212 / num219; - num217 *= num219; - num218 *= num219; + num219 = num212 / num219; + num217 *= num219; + num218 *= num219; - projectile.velocity.X = projectile.velocity.X * 0.98f; - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - projectile.velocity.X = projectile.velocity.X + num217; - projectile.velocity.Y = projectile.velocity.Y + num218; - } - else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 6f) - { - projectile.velocity.X = projectile.velocity.X * 0.96f; - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } + projectile.velocity.X = projectile.velocity.X * 0.98f; + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + projectile.velocity.X = projectile.velocity.X + num217; + projectile.velocity.Y = projectile.velocity.Y + num218; + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 6f) + { + projectile.velocity.X = projectile.velocity.X * 0.96f; + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } - if (Main.player[projectile.owner].velocity.X == 0f) - projectile.velocity.X = projectile.velocity.X * 0.96f; - } - } + if (Main.player[projectile.owner].velocity.X == 0f) + projectile.velocity.X = projectile.velocity.X * 0.96f; + } + } - if (Main.rand.NextBool(3)) - { - int dustType = Main.rand.Next(5); - switch (dustType) - { - case 0: - dustType = 2; - break; - case 1: - dustType = 44; - break; - case 2: - case 3: - case 4: - dustType = 136; - break; - default: - break; - } - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, 0f, 0f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.5f; - } + if (Main.rand.NextBool(3)) + { + int dustType = Main.rand.Next(5); + switch (dustType) + { + case 0: + dustType = 2; + break; + case 1: + dustType = 44; + break; + case 2: + case 3: + case 4: + dustType = 136; + break; + default: + break; + } + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, 0f, 0f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.5f; + } - if (projectile.alpha == 255 && distance > 10f) - projectile.alpha = 0; - } + if (projectile.alpha == 255 && distance > 10f) + projectile.alpha = 0; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - bool hitTile = false; - if (oldVelocity.X != projectile.velocity.X) - { - hitTile = Math.Abs(oldVelocity.X) > 4f; + public override bool OnTileCollide(Vector2 oldVelocity) + { + bool hitTile = false; + if (oldVelocity.X != projectile.velocity.X) + { + hitTile = Math.Abs(oldVelocity.X) > 4f; - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -oldVelocity.X * 0.2f; - } - if (oldVelocity.Y != projectile.velocity.Y) - { - hitTile = Math.Abs(oldVelocity.Y) > 4f; + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -oldVelocity.X * 0.2f; + } + if (oldVelocity.Y != projectile.velocity.Y) + { + hitTile = Math.Abs(oldVelocity.Y) > 4f; - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -oldVelocity.Y * 0.2f; - } + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -oldVelocity.Y * 0.2f; + } - projectile.ai[0] = 1f; + projectile.ai[0] = 1f; - if (hitTile) - { - projectile.netUpdate = true; - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - } + if (hitTile) + { + projectile.netUpdate = true; + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + } - return false; - } + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/YateveoBloomChain"); - Vector2 vector17 = projectile.Center; - Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) - { - flag13 = false; - } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) - { - flag13 = false; - } - while (flag13) - { - if (vector18.Length() < num91 + 1f) - { - flag13 = false; - } - else - { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); - } - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/YateveoBloomChain"); + Vector2 vector17 = projectile.Center; + Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); + float num91 = (float)texture2D2.Height; + Vector2 vector18 = mountedCenter - vector17; + float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; + bool flag13 = true; + if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + { + flag13 = false; + } + if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + { + flag13 = false; + } + while (flag13) + { + if (vector18.Length() < num91 + 1f) + { + flag13 = false; + } + else + { + Vector2 value2 = vector18; + value2.Normalize(); + vector17 += value2 * num91; + vector18 = mountedCenter - vector17; + Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); + } + } + return true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 180); - target.AddBuff(BuffID.Venom, 90); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + target.AddBuff(BuffID.Venom, 90); + } + } } diff --git a/Projectiles/Patreon/YateveoBloomSpear.cs b/Projectiles/Patreon/YateveoBloomSpear.cs index de3105ab17..6aeda37340 100644 --- a/Projectiles/Patreon/YateveoBloomSpear.cs +++ b/Projectiles/Patreon/YateveoBloomSpear.cs @@ -1,92 +1,91 @@ using System; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon { - public class YateveoBloomSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yateveo Bloom"); - } + public class YateveoBloomSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yateveo Bloom"); + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 40; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.aiStyle = 19; + projectile.melee = true; + projectile.timeLeft = 90; + projectile.height = 40; + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.NextBool(3)) - { - int dustType = Main.rand.Next(5); - switch (dustType) - { - case 0: - dustType = 2; - break; - case 1: - dustType = 44; - break; - case 2: - case 3: - case 4: - dustType = 136; - break; - default: - break; - } - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, 0f, 0f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.5f; - } + if (Main.rand.NextBool(3)) + { + int dustType = Main.rand.Next(5); + switch (dustType) + { + case 0: + dustType = 2; + break; + case 1: + dustType = 44; + break; + case 2: + case 3: + case 4: + dustType = 136; + break; + default: + break; + } + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, 0f, 0f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.5f; + } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - projectile.ai[0] -= 2.4f; - else - projectile.ai[0] += 0.95f; + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + projectile.ai[0] -= 2.4f; + else + projectile.ai[0] += 0.95f; - if (Main.player[projectile.owner].itemAnimation == 0) - projectile.Kill(); + if (Main.player[projectile.owner].itemAnimation == 0) + projectile.Kill(); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - projectile.rotation -= 1.57f; - } + if (projectile.spriteDirection == -1) + projectile.rotation -= 1.57f; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 180); - target.AddBuff(BuffID.Venom, 90); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + target.AddBuff(BuffID.Venom, 90); + } + } } diff --git a/Projectiles/Permafrost/ArcticBearPaw.cs b/Projectiles/Permafrost/ArcticBearPaw.cs index dccf943e51..908e810970 100644 --- a/Projectiles/Permafrost/ArcticBearPaw.cs +++ b/Projectiles/Permafrost/ArcticBearPaw.cs @@ -6,28 +6,28 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class ArcticBearPaw : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 44; - projectile.height = 44; + { + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 44; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; + projectile.friendly = true; projectile.magic = true; projectile.coldDamage = true; - projectile.penetrate = 5; - projectile.ignoreWater = true; + projectile.penetrate = 5; + projectile.ignoreWater = true; projectile.tileCollide = false; - } + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arctic Bear Paw"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Bear Paw"); + } - public override void AI() - { + public override void AI() + { //make pretty dust int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); Main.dust[index2].noGravity = true; @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Permafrost } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 480); target.AddBuff(mod.BuffType("GlacialState"), 60); @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Permafrost target.AddBuff(BuffID.Confused, Main.rand.Next(60, 240)); } - public override Color? GetAlpha (Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + } } diff --git a/Projectiles/Permafrost/DarkIce.cs b/Projectiles/Permafrost/DarkIce.cs index c4a5b33713..107ab272a8 100644 --- a/Projectiles/Permafrost/DarkIce.cs +++ b/Projectiles/Permafrost/DarkIce.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,27 +7,27 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class DarkIce : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; + { + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; projectile.coldDamage = true; } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Ice"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Ice"); + } - public override void AI() - { + public override void AI() + { if (projectile.localAI[0] != 1f) { projectile.localAI[0] = 1f; @@ -44,19 +44,19 @@ namespace CalamityMod.Projectiles.Permafrost Main.dust[index2].noGravity = true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 480); target.AddBuff(mod.BuffType("GlacialState"), 480); } - public override Color? GetAlpha (Color lightColor) - { - return new Color(198, 197, 246); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(198, 197, 246); + } - public override void Kill(int timeLeft) - { + public override void Kill(int timeLeft) + { Main.PlaySound(SoundID.Item27, projectile.position); for (int i = 0; i < 30; i++) { @@ -65,5 +65,5 @@ namespace CalamityMod.Projectiles.Permafrost Main.dust[index2].velocity *= 4f; } } - } + } } diff --git a/Projectiles/Permafrost/DarkIceZero.cs b/Projectiles/Permafrost/DarkIceZero.cs index f0705466fa..9f7b63765a 100644 --- a/Projectiles/Permafrost/DarkIceZero.cs +++ b/Projectiles/Permafrost/DarkIceZero.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,28 +7,28 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class DarkIceZero : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.friendly = true; + { + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; projectile.coldDamage = true; } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Ice"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Ice"); + } - public override void AI() - { + public override void AI() + { if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) { projectile.velocity *= 1.035f; @@ -39,34 +39,34 @@ namespace CalamityMod.Projectiles.Permafrost Main.dust[index2].noGravity = true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 480); target.AddBuff(mod.BuffType("GlacialState"), 90); } - public override Color? GetAlpha (Color lightColor) - { - return new Color(198, 197, 246); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(198, 197, 246); + } - public override void Kill(int timeLeft) - { + public override void Kill(int timeLeft) + { if (timeLeft > 0) { timeLeft = 0; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 192); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); - Main.PlaySound(SoundID.Item27, projectile.Center); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 192); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; + projectile.Damage(); + Main.PlaySound(SoundID.Item27, projectile.Center); for (int i = 0; i < 30; i++) { int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Permafrost Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; } - } + } } - } + } } diff --git a/Projectiles/Permafrost/FrostShardFriendly.cs b/Projectiles/Permafrost/FrostShardFriendly.cs index e03fefcc68..7b6a5e1b8a 100644 --- a/Projectiles/Permafrost/FrostShardFriendly.cs +++ b/Projectiles/Permafrost/FrostShardFriendly.cs @@ -6,27 +6,27 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class FrostShardFriendly : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.aiStyle = 1; + { + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.aiStyle = 1; projectile.coldDamage = true; projectile.friendly = true; projectile.minion = true; - projectile.penetrate = 1; - projectile.Calamity().rogue = true; - } + projectile.penetrate = 1; + projectile.Calamity().rogue = true; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Shard"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Shard"); Main.projFrames[projectile.type] = 5; } - public override void AI() - { + public override void AI() + { projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Permafrost } public override void Kill(int timeLeft) - { + { Main.PlaySound(SoundID.Item27, projectile.position); for (int index1 = 0; index1 < 3; ++index1) { @@ -76,5 +76,5 @@ namespace CalamityMod.Projectiles.Permafrost Main.dust[index2].scale = 0.7f; } } - } + } } diff --git a/Projectiles/Permafrost/FrostyFlare.cs b/Projectiles/Permafrost/FrostyFlare.cs index 42a40ec5e5..86d69a36d4 100644 --- a/Projectiles/Permafrost/FrostyFlare.cs +++ b/Projectiles/Permafrost/FrostyFlare.cs @@ -6,25 +6,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class FrostyFlare : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; projectile.coldDamage = true; projectile.friendly = true; - projectile.penetrate = -1; + projectile.penetrate = -1; projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frosty Flare"); + projectile.Calamity().rogue = true; } - public override void AI() - { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frosty Flare"); + } + + public override void AI() + { bool shoot = false; projectile.localAI[0]--; if (projectile.localAI[0] <= 0f) @@ -123,5 +123,5 @@ namespace CalamityMod.Projectiles.Permafrost { return projectile.ai[0] == 0f; } - } + } } diff --git a/Projectiles/Permafrost/IceSentry.cs b/Projectiles/Permafrost/IceSentry.cs index 9184e0e86b..10373a9bb4 100644 --- a/Projectiles/Permafrost/IceSentry.cs +++ b/Projectiles/Permafrost/IceSentry.cs @@ -6,43 +6,43 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class IceSentry : ModProjectile - { - private bool setDamage = true; + { + private bool setDamage = true; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Sentry"); + { + DisplayName.SetDefault("Ice Sentry"); Main.projFrames[projectile.type] = 18; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } - public override void SetDefaults() - { - projectile.width = 102; + public override void SetDefaults() + { + projectile.width = 102; projectile.height = 94; projectile.timeLeft = Projectile.SentryLifeTime; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.sentry = true; - } + } - public override void AI() + public override void AI() { - if (setDamage) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - setDamage = false; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } + if (setDamage) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + setDamage = false; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } - projectile.velocity = Vector2.Zero; + projectile.velocity = Vector2.Zero; projectile.frameCounter++; if (projectile.frameCounter > 6) @@ -165,9 +165,9 @@ namespace CalamityMod.Projectiles.Permafrost } } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Permafrost/Icicle.cs b/Projectiles/Permafrost/Icicle.cs index 3a3a9a4ab9..cdb73417d9 100644 --- a/Projectiles/Permafrost/Icicle.cs +++ b/Projectiles/Permafrost/Icicle.cs @@ -6,26 +6,26 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class Icicle : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; + projectile.friendly = true; projectile.magic = true; projectile.coldDamage = true; - projectile.penetrate = 1; - } + projectile.penetrate = 1; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle"); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 300); } @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Permafrost } public override void Kill(int timeLeft) - { + { Main.PlaySound(SoundID.Item27, projectile.position); for (int index1 = 0; index1 < 5; ++index1) { @@ -45,5 +45,5 @@ namespace CalamityMod.Projectiles.Permafrost Main.dust[index2].scale *= 0.9f; } } - } + } } diff --git a/Projectiles/Permafrost/IcicleArrow.cs b/Projectiles/Permafrost/IcicleArrow.cs index 19a2e20669..e34276102e 100644 --- a/Projectiles/Permafrost/IcicleArrow.cs +++ b/Projectiles/Permafrost/IcicleArrow.cs @@ -6,27 +6,27 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class IcicleArrow : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; - projectile.friendly = true; + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 1; + projectile.friendly = true; projectile.ranged = true; projectile.arrow = true; projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle Arrow"); + } - public override void AI() - { + public override void AI() + { //icicle dust if (Main.rand.NextBool(2)) { @@ -35,13 +35,13 @@ namespace CalamityMod.Projectiles.Permafrost } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 300); } - public override void Kill(int timeLeft) - { + public override void Kill(int timeLeft) + { Main.PlaySound(SoundID.Item27, projectile.position); for (int index1 = 0; index1 < 5; ++index1) { @@ -60,5 +60,5 @@ namespace CalamityMod.Projectiles.Permafrost } } } - } + } } diff --git a/Projectiles/Permafrost/IcyBullet.cs b/Projectiles/Permafrost/IcyBullet.cs index b1fcfa533e..24c0c17e3d 100644 --- a/Projectiles/Permafrost/IcyBullet.cs +++ b/Projectiles/Permafrost/IcyBullet.cs @@ -6,30 +6,30 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class IcyBullet : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; + { + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.aiStyle = 1; aiType = ProjectileID.Bullet; projectile.timeLeft = 600; - projectile.friendly = true; + projectile.friendly = true; projectile.ranged = true; projectile.coldDamage = true; projectile.penetrate = 3; projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - } + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icy Bullet"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icy Bullet"); + } - public override void AI() - { + public override void AI() + { if (Main.rand.NextBool(3)) { int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 0, default, 1f); @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Permafrost } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 300); target.AddBuff(mod.BuffType("GlacialState"), 120); } @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Permafrost } public override void Kill(int timeLeft) - { + { Main.PlaySound(SoundID.Item27, projectile.position); for (int index1 = 0; index1 < 5; ++index1) { @@ -67,5 +67,5 @@ namespace CalamityMod.Projectiles.Permafrost } } } - } + } } diff --git a/Projectiles/Permafrost/Snowball.cs b/Projectiles/Permafrost/Snowball.cs index e6908f23f1..e41775adad 100644 --- a/Projectiles/Permafrost/Snowball.cs +++ b/Projectiles/Permafrost/Snowball.cs @@ -6,26 +6,26 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class Snowball : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 1; - projectile.friendly = true; + { + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.aiStyle = 1; + projectile.friendly = true; projectile.magic = true; projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snowball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snowball"); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 300); target.AddBuff(mod.BuffType("GlacialState"), 180); } @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Permafrost } public override void Kill(int timeLeft) - { + { Main.PlaySound(SoundID.Item27, projectile.position); //crystal bullet shards for (int index1 = 0; index1 < 10; ++index1) @@ -58,5 +58,5 @@ namespace CalamityMod.Projectiles.Permafrost } //insert ice shattering dust here } - } + } } diff --git a/Projectiles/Permafrost/TridentIcicle.cs b/Projectiles/Permafrost/TridentIcicle.cs index d9e4373819..e006e0e9e2 100644 --- a/Projectiles/Permafrost/TridentIcicle.cs +++ b/Projectiles/Permafrost/TridentIcicle.cs @@ -6,45 +6,45 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Permafrost { public class TridentIcicle : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; + { + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; + projectile.friendly = true; projectile.coldDamage = true; projectile.magic = true; - projectile.penetrate = 2; - projectile.ignoreWater = true; - } + projectile.penetrate = 2; + projectile.ignoreWater = true; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trident Icicle"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trident Icicle"); + } - public override void AI() - { + public override void AI() + { //make pretty dust int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); Main.dust[index2].noGravity = true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { target.AddBuff(BuffID.Frostburn, 480); target.AddBuff(mod.BuffType("GlacialState"), 180); } - public override Color? GetAlpha (Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override void Kill(int timeLeft) - { + public override void Kill(int timeLeft) + { Main.PlaySound(SoundID.Item27, projectile.position); for (int i = 0; i < 10; i++) { @@ -53,5 +53,5 @@ namespace CalamityMod.Projectiles.Permafrost Main.dust[index2].velocity *= 2f; } } - } + } } diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index 63344e9c0c..a57c3a9c98 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -1,377 +1,377 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class Bear : ModProjectile - { - public int chosenIdle = 0; - public int idleTimer = 0; - public int playerStill = 0; - public bool fly = false; - public bool easyfix = true; + { + public int chosenIdle = 0; + public int idleTimer = 0; + public int playerStill = 0; + public bool fly = false; + public bool easyfix = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bear"); - Main.projFrames[projectile.type] = 22; - Main.projPet[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bear"); + Main.projFrames[projectile.type] = 22; + Main.projPet[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 44; + projectile.height = 44; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = true; + } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - fallThrough = playerDistance > 200f; - return true; - } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + Player player = Main.player[projectile.owner]; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (!player.active) - { - projectile.active = false; - return; - } - CalamityPlayer modPlayer = player.Calamity(); - if (player.dead) - { - modPlayer.bearPet = false; - } - if (modPlayer.bearPet) - { - projectile.timeLeft = 2; - } - Vector2 vector46 = projectile.position; - if (easyfix) - { - projectile.position.Y += -3f; - easyfix = false; - } - if (!fly) - { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) - { - projectile.velocity.Y = -5f; - } - projectile.velocity.Y += 0.20f; + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.bearPet = false; + } + if (modPlayer.bearPet) + { + projectile.timeLeft = 2; + } + Vector2 vector46 = projectile.position; + if (easyfix) + { + projectile.position.Y += -3f; + easyfix = false; + } + if (!fly) + { + projectile.rotation = 0; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + { + projectile.velocity.Y = -5f; + } + projectile.velocity.Y += 0.20f; - if (projectile.velocity.Y > 7f) - { - projectile.velocity.Y = 7f; - } + if (projectile.velocity.Y > 7f) + { + projectile.velocity.Y = 7f; + } - if (playerDistance > 600f) - { - fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; - } - if (playerDistance > 100f) - { - if (player.position.X - projectile.position.X > 0f) - { - projectile.velocity.X += 0.10f; + if (playerDistance > 600f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 100f) + { + if (player.position.X - projectile.position.X > 0f) + { + projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) - { - projectile.velocity.X = 7f; - } - } - else - { - projectile.velocity.X -= 0.10f; + if (projectile.velocity.X > 7f) + { + projectile.velocity.X = 7f; + } + } + else + { + projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) - { - projectile.velocity.X = -7f; - } - } - } - if (playerDistance < 100f) - { - if (projectile.velocity.X != 0f) - { - if (projectile.velocity.X > 0.5f) - { - projectile.velocity.X -= 0.15f; - } - else if (projectile.velocity.X < -0.5f) - { - projectile.velocity.X += 0.15f; - } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) - { - projectile.velocity.X = 0f; - } - } - } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) - { - projectile.frameCounter++; + if (projectile.velocity.X < -7f) + { + projectile.velocity.X = -7f; + } + } + } + if (playerDistance < 100f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + projectile.velocity.X -= 0.15f; + } + else if (projectile.velocity.X < -0.5f) + { + projectile.velocity.X += 0.15f; + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + { + projectile.frameCounter++; - switch (chosenIdle) - { - case 1: - if (idleTimer == 0) - { - projectile.frame = 0; - } - ++idleTimer; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - chosenIdle = 0; - } - if (projectile.frame < 1) - { - projectile.frame = 1; - } - break; + switch (chosenIdle) + { + case 1: + if (idleTimer == 0) + { + projectile.frame = 0; + } + ++idleTimer; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + chosenIdle = 0; + } + if (projectile.frame < 1) + { + projectile.frame = 1; + } + break; - case 2: - if (idleTimer == 0) - { - projectile.frame = 0; - } - ++idleTimer; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 9) - { - chosenIdle = 0; - } - if (projectile.frame < 4) - { - projectile.frame = 4; - } - break; + case 2: + if (idleTimer == 0) + { + projectile.frame = 0; + } + ++idleTimer; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 9) + { + chosenIdle = 0; + } + if (projectile.frame < 4) + { + projectile.frame = 4; + } + break; - case 3: - if (idleTimer == 0) - { - projectile.frame = 0; - } - ++idleTimer; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 12) - { - chosenIdle = 0; - } - if (projectile.frame < 10) - { - projectile.frame = 10; - } - break; - } - if (chosenIdle == 0) - { - projectile.frame = 0; - projectile.frameCounter = 5; - ++idleTimer; - if (idleTimer > 120) - { - chosenIdle = Main.rand.Next(1, 4); - idleTimer = 0; - } - } - } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) - { - projectile.frame = 13; - projectile.frameCounter = 0; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 17) - { - projectile.frame = 14; - } - if (projectile.frame < 14) - { - projectile.frame = 14; - } - } - } - else if (fly) - { - float num16 = 0.3f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; - vertiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); - vertiPos -= 60f; - float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + case 3: + if (idleTimer == 0) + { + projectile.frame = 0; + } + ++idleTimer; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 12) + { + chosenIdle = 0; + } + if (projectile.frame < 10) + { + projectile.frame = 10; + } + break; + } + if (chosenIdle == 0) + { + projectile.frame = 0; + projectile.frameCounter = 5; + ++idleTimer; + if (idleTimer > 120) + { + chosenIdle = Main.rand.Next(1, 4); + idleTimer = 0; + } + } + } + else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + { + projectile.frame = 13; + projectile.frameCounter = 0; + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 17) + { + projectile.frame = 14; + } + if (projectile.frame < 14) + { + projectile.frame = 14; + } + } + } + else if (fly) + { + float num16 = 0.3f; + projectile.tileCollide = false; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + vertiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); + vertiPos -= 60f; + float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + float num21 = 18f; + float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - if (playerDistance > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (playerDistance < 100f) - { - num16 = 0.1f; - if (player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - } - } - if (playerDistance < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.90f; - } - num16 = 0.01f; - } - else - { - if (playerDistance < 100f) - { - num16 = 0.1f; - } - if (playerDistance > 300f) - { - num16 = 1f; - } - playerDistance = num21 / playerDistance; - horiPos *= playerDistance; - vertiPos *= playerDistance; - } + if (playerDistance > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + num16 = 0.1f; + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + } + } + if (playerDistance < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.90f; + } + num16 = 0.01f; + } + else + { + if (playerDistance < 100f) + { + num16 = 0.1f; + } + if (playerDistance > 300f) + { + num16 = 1f; + } + playerDistance = num21 / playerDistance; + horiPos *= playerDistance; + vertiPos *= playerDistance; + } - if (projectile.velocity.X <= horiPos) - { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num16; - } - } - if (projectile.velocity.X > horiPos) - { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num16; - } - } - if (projectile.velocity.Y <= vertiPos) - { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; - } - } - if (projectile.velocity.Y > vertiPos) - { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; - } - } + if (projectile.velocity.X <= horiPos) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > horiPos) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y <= vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } - projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 21) - { - projectile.frame = 18; - } - if (projectile.frame < 18) - { - projectile.frame = 18; - } - } - if (projectile.velocity.X > 0.25f) - { - projectile.spriteDirection = -1; - } - else if (projectile.velocity.X < -0.25f) - { - projectile.spriteDirection = 1; - } - } + projectile.rotation = projectile.velocity.X * 0.03f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 21) + { + projectile.frame = 18; + } + if (projectile.frame < 18) + { + projectile.frame = 18; + } + } + if (projectile.velocity.X > 0.25f) + { + projectile.spriteDirection = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = 1; + } + } - private bool HoleBelow() //pretty much the same as the one used in mantis - { - int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) - { - tileX += tileWidth; - } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); - for (int y = tileY; y < tileY + 2; y++) - { - for (int x = tileX; x < tileX + tileWidth; x++) - { - if (Main.tile[x, y].active()) - { - return false; - } - } - } - return true; - } - } + private bool HoleBelow() //pretty much the same as the one used in mantis + { + int tileWidth = 4; + int tileX = (int)(projectile.Center.X / 16f) - tileWidth; + if (projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].active()) + { + return false; + } + } + } + return true; + } + } } diff --git a/Projectiles/Pets/Brimling.cs b/Projectiles/Pets/Brimling.cs index df659dec09..68f1a0d3e4 100644 --- a/Projectiles/Pets/Brimling.cs +++ b/Projectiles/Pets/Brimling.cs @@ -1,16 +1,16 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class Brimling : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimling"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimling"); Main.projFrames[projectile.type] = 8; Main.projPet[projectile.type] = true; } @@ -55,17 +55,17 @@ namespace CalamityMod.Projectiles.Pets float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); float num21 = 18f; - //Limites de mouvement ici + //Limites de mouvement ici - float num27 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); + float num27 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); if (num27 > 1000f) { projectile.position.X = projectile.position.X + num18; projectile.position.Y = projectile.position.Y + num19; - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0, -1f, 0, default, 1f); - } + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0, -1f, 0, default, 1f); + } } if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Pets num19 *= num20; } - //Les changements de velocité ici + //Les changements de velocité ici if (projectile.velocity.X < num18) { projectile.velocity.X = projectile.velocity.X + num16; @@ -143,14 +143,14 @@ namespace CalamityMod.Projectiles.Pets projectile.direction = 1; } - //On gère le sprite et les frames ici + //On gère le sprite et les frames ici - Player projOwner = Main.player[projectile.owner]; + Player projOwner = Main.player[projectile.owner]; projectile.spriteDirection = -projOwner.direction; projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frameCounter++; + projectile.frameCounter++; if (projOwner.statLife >= projOwner.statLifeMax2 / 4) { @@ -179,6 +179,6 @@ namespace CalamityMod.Projectiles.Pets return; } } - } + } } } diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index e22876a95b..54ca6018c8 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -1,245 +1,245 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; -using Terraria.ModLoader; +using Terraria.ID; using Terraria.Localization; -using CalamityMod.CalPlayer; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Pets { public class ChibiiDoggo : ModProjectile - { - public int trueType; - public bool previousCollide = false; + { + public int trueType; + public bool previousCollide = false; public bool yFlip = false; //used to suppress y velocity (pet fastfalls with an extra update per tick otherwise) - public float notlocalai1 = 0f; - //used for companion cube AI section; using the actual projectile.ai[1] seems to conflict with black cat AI and cause pet to freeze up sometimes + public float notlocalai1 = 0f; + //used for companion cube AI section; using the actual projectile.ai[1] seems to conflict with black cat AI and cause pet to freeze up sometimes - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chibii Devourer"); - Main.projFrames[projectile.type] = 11; //same as black cat - Main.projPet[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chibii Devourer"); + Main.projFrames[projectile.type] = 11; //same as black cat + Main.projPet[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 38; - projectile.height = 46; - projectile.aiStyle = 26; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.scale = 0.8f; + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 38; + projectile.height = 46; + projectile.aiStyle = 26; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.scale = 0.8f; projectile.ignoreWater = true; - projectile.extraUpdates = 1; + projectile.extraUpdates = 1; - trueType = projectile.type; - } + trueType = projectile.type; + } - public override bool PreDraw (SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoMonochrome"); - int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num156 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); + Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoMonochrome"); + int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num156 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - goto IL_6899; - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value4 = (projectile.oldPos[num161]); - float num165 = projectile.rotation; - SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f); - goto IL_6881; - } - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; - } + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + goto IL_6899; + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value4 = (projectile.oldPos[num161]); + float num165 = projectile.rotation; + SpriteEffects effects = spriteEffects; + Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f); + goto IL_6881; + } + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; + } - public override bool PreAI() - { - projectile.type = 319; //tricks AI 26 into thinking this is a black cat, makes it act like black cat - Player player = Main.player[projectile.owner]; - player.blackCat = false; //ensure doesnt interact weird with actual black cat - return true; - } + public override bool PreAI() + { + projectile.type = 319; //tricks AI 26 into thinking this is a black cat, makes it act like black cat + Player player = Main.player[projectile.owner]; + player.blackCat = false; //ensure doesnt interact weird with actual black cat + return true; + } - //negates effect of y velocity every other tick - //pet updates twice per second, so this effectively gives it normal gravity despite otherwise doubled speed - //has full y speed when jumping up and when tile-intangible (i.e. chasing player when they move out of range) - public void PreventFastfall() - { - yFlip = !yFlip; + //negates effect of y velocity every other tick + //pet updates twice per second, so this effectively gives it normal gravity despite otherwise doubled speed + //has full y speed when jumping up and when tile-intangible (i.e. chasing player when they move out of range) + public void PreventFastfall() + { + yFlip = !yFlip; - if (yFlip && projectile.velocity.Y > 0) - projectile.position.Y -= projectile.velocity.Y; - } + if (yFlip && projectile.velocity.Y > 0) + projectile.position.Y -= projectile.velocity.Y; + } - public void SpawnDoggo() - { - Player player = Main.player[projectile.owner]; - string doggoType = "DevourerofGodsHead"; + public void SpawnDoggo() + { + Player player = Main.player[projectile.owner]; + string doggoType = "DevourerofGodsHead"; - if (player.name == "Terry") - { - doggoType += "S"; - Main.NewText("It's not over yet, kid!", Color.Cyan); - } - else - { - doggoType += "2"; - Main.NewText("Don't get cocky, kid!", Color.Cyan); - } + if (player.name == "Terry") + { + doggoType += "S"; + Main.NewText("It's not over yet, kid!", Color.Cyan); + } + else + { + doggoType += "2"; + Main.NewText("Don't get cocky, kid!", Color.Cyan); + } - int type = mod.NPCType(doggoType); + int type = mod.NPCType(doggoType); - int n = NPC.NewNPC((int)projectile.position.X, (int)projectile.position.Y, type); - NetMessage.SendData(23, -1, -1, (NetworkText) null, n, 0.0f, 0.0f, 0.0f, 0, 0, 0); - Main.npc[n].netUpdate = true; - } + int n = NPC.NewNPC((int)projectile.position.X, (int)projectile.position.Y, type); + NetMessage.SendData(23, -1, -1, (NetworkText)null, n, 0.0f, 0.0f, 0.0f, 0, 0, 0); + Main.npc[n].netUpdate = true; + } - public override void AI() - { - projectile.type = trueType; //asserts real type after running black Cat AI 26 (ensures chibii pet isnt drawn as black cat and other weird stuff) + public override void AI() + { + projectile.type = trueType; //asserts real type after running black Cat AI 26 (ensures chibii pet isnt drawn as black cat and other weird stuff) Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (player.dead) - { - modPlayer.chibii = false; - } - if (modPlayer.chibii) - { - projectile.timeLeft = 2; - } - //creates dust whenever switching between flying and grounded like when player spawns/despawns mount - if (previousCollide != projectile.tileCollide) - { - previousCollide = projectile.tileCollide; + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.chibii = false; + } + if (modPlayer.chibii) + { + projectile.timeLeft = 2; + } + //creates dust whenever switching between flying and grounded like when player spawns/despawns mount + if (previousCollide != projectile.tileCollide) + { + previousCollide = projectile.tileCollide; - for (int i = 0; i < 10; i++) //resets oldpos so trail doesn't "snap" to chibii from previous position after unhiding - projectile.oldPos[i] = projectile.position; + for (int i = 0; i < 10; i++) //resets oldpos so trail doesn't "snap" to chibii from previous position after unhiding + projectile.oldPos[i] = projectile.position; - for (int i = 0; i < 77; i++) //loop to make lots of dust - { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 182, projectile.velocity.X * 0.7f, projectile.velocity.Y * 0.7f, 100, default, 2.5f); + for (int i = 0; i < 77; i++) //loop to make lots of dust + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 182, projectile.velocity.X * 0.7f, projectile.velocity.Y * 0.7f, 100, default, 2.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.5f; - Main.dust[dust].noLight = true; + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.5f; + Main.dust[dust].noLight = true; - int rng = Main.rand.Next(3); + int rng = Main.rand.Next(3); - if (rng == 0) - { - Main.dust[dust].velocity *= 1.5f; - Main.dust[dust].scale *= 0.7f; - } - else if (rng == 1) - { - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].scale *= 0.9f; - } - } - } + if (rng == 0) + { + Main.dust[dust].velocity *= 1.5f; + Main.dust[dust].scale *= 0.7f; + } + else if (rng == 1) + { + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].scale *= 0.9f; + } + } + } - if (projectile.tileCollide) + if (projectile.tileCollide) { projectile.hide = false; - //if (projectile.extraUpdates == 1) - PreventFastfall(); + //if (projectile.extraUpdates == 1) + PreventFastfall(); - /*Vector2 distance = Main.player[projectile.owner].Center - projectile.Center; - if (distance.Length() < 100) - projectile.extraUpdates = 0; - else - projectile.extraUpdates = 1;*/ + /*Vector2 distance = Main.player[projectile.owner].Center - projectile.Center; + if (distance.Length() < 100) + projectile.extraUpdates = 0; + else + projectile.extraUpdates = 1;*/ } - else - { - projectile.hide = true; - //projectile.extraUpdates = 1; - - if (player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] <= 0) - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0f, 0f, mod.ProjectileType("ChibiiDoggoFly"), 0, 0f, projectile.owner, (float) projectile.identity); - } - - //companion cube lighting check and stab - Color color; - color = Lighting.GetColor((int) projectile.Center.X / 16, (int) projectile.Center.Y / 16); - Vector3 vector3_1 = color.ToVector3(); - color = Lighting.GetColor((int) player.Center.X / 16, (int) player.Center.Y / 16); - Vector3 vector3_2 = color.ToVector3(); - - if ((double)vector3_1.Length() < 0.150000005960464 && (double)vector3_2.Length() < 0.150000005960464) - { - notlocalai1 += 1; - } - else if ((double) notlocalai1 > 0.0) + else { - notlocalai1 -= 1; + projectile.hide = true; + //projectile.extraUpdates = 1; + + if (player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] <= 0) + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0f, 0f, mod.ProjectileType("ChibiiDoggoFly"), 0, 0f, projectile.owner, (float)projectile.identity); } - notlocalai1 = MathHelper.Clamp(notlocalai1, -3600f, 120f); + //companion cube lighting check and stab + Color color; + color = Lighting.GetColor((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16); + Vector3 vector3_1 = color.ToVector3(); + color = Lighting.GetColor((int)player.Center.X / 16, (int)player.Center.Y / 16); + Vector3 vector3_2 = color.ToVector3(); - if ((double) notlocalai1 > (double) Main.rand.Next(30, 120) && !player.immune && player.velocity.X == 0 && player.velocity.Y == 0) + if ((double)vector3_1.Length() < 0.150000005960464 && (double)vector3_2.Length() < 0.150000005960464) { - if (Main.rand.NextBool(3)) - { - if (Main.rand.NextBool(2)) - { - int style = 5 + Main.rand.Next(5); - Main.PlaySound(SoundID.Meowmere, (int) projectile.position.X, (int) projectile.position.Y, style, 4f, 0.0f); //nya - } - else - { - Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 2, 2f); //REEEEEEE - } - notlocalai1 = -600f; - } - else - { - notlocalai1 = (float) (Main.rand.Next(30) * -10 - 300); - Main.PlaySound(SoundID.Item1, projectile.Center); - player.Hurt(PlayerDeathReason.ByOther(6), 500, 0, false, false, false, -1); - player.immune = false; - player.immuneTime = 0; - - if (Main.netMode != NetmodeID.MultiplayerClient) - SpawnDoggo(); - } - projectile.netUpdate = true; + notlocalai1 += 1; } - } - } + else if ((double)notlocalai1 > 0.0) + { + notlocalai1 -= 1; + } + + notlocalai1 = MathHelper.Clamp(notlocalai1, -3600f, 120f); + + if ((double)notlocalai1 > (double)Main.rand.Next(30, 120) && !player.immune && player.velocity.X == 0 && player.velocity.Y == 0) + { + if (Main.rand.NextBool(3)) + { + if (Main.rand.NextBool(2)) + { + int style = 5 + Main.rand.Next(5); + Main.PlaySound(SoundID.Meowmere, (int)projectile.position.X, (int)projectile.position.Y, style, 4f, 0.0f); //nya + } + else + { + Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 2, 2f); //REEEEEEE + } + notlocalai1 = -600f; + } + else + { + notlocalai1 = (float)(Main.rand.Next(30) * -10 - 300); + Main.PlaySound(SoundID.Item1, projectile.Center); + player.Hurt(PlayerDeathReason.ByOther(6), 500, 0, false, false, false, -1); + player.immune = false; + player.immuneTime = 0; + + if (Main.netMode != NetmodeID.MultiplayerClient) + SpawnDoggo(); + } + projectile.netUpdate = true; + } + } + } } diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index e3ac773ade..eef59af83a 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -3,111 +3,110 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class ChibiiDoggoFly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chibii Devourer (Flying)"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chibii Devourer (Flying)"); + Main.projPet[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 24; - projectile.height = 46; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.scale = 0.8f; - projectile.tileCollide = false; - projectile.ignoreWater = true; + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 24; + projectile.height = 46; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.scale = 0.8f; + projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.extraUpdates = 1; - } + } - public override bool PreDraw (SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoFlyMonochrome"); - int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num156 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 12; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - goto IL_6899; - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value4 = (projectile.oldPos[num161]); - float num165 = projectile.rotation; - SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f); - goto IL_6881; - } - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); + Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoFlyMonochrome"); + int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num156 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 12; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + goto IL_6899; + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value4 = (projectile.oldPos[num161]); + float num165 = projectile.rotation; + SpriteEffects effects = spriteEffects; + Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f); + goto IL_6881; + } + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; + } - public override bool PreAI() - { - //parent projectile might spawn more than one ChibiiDoggoFly sometimes - if (Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] > 1) - { - projectile.hide = true; - projectile.Kill(); - Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")]--; - return false; - } + public override bool PreAI() + { + //parent projectile might spawn more than one ChibiiDoggoFly sometimes + if (Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] > 1) + { + projectile.hide = true; + projectile.Kill(); + Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")]--; + return false; + } - return true; - } + return true; + } - public override void AI() - { - if (Main.player[projectile.owner].Calamity().chibii) - projectile.timeLeft = 2; + public override void AI() + { + if (Main.player[projectile.owner].Calamity().chibii) + projectile.timeLeft = 2; - int byUuid = (int) projectile.ai[0]; //contains identity of parent projectile in main.projectile array + int byUuid = (int)projectile.ai[0]; //contains identity of parent projectile in main.projectile array - //basically slaved to parent's position - //this projectile only exists because i fucking hate that tile collision desync i got when using full-sized flying sprites in ChibiiDoggo - if (Main.projectile[byUuid].active && Main.projectile[byUuid].type == mod.ProjectileType("ChibiiDoggo")) - { - //projectile.position.X = Main.projectile[byUuid].position.X - 22; - //projectile.position.Y = Main.projectile[byUuid].position.Y; - projectile.Center = Main.projectile[byUuid].Center; - projectile.rotation = Main.projectile[byUuid].rotation; - projectile.spriteDirection = Main.projectile[byUuid].spriteDirection; + //basically slaved to parent's position + //this projectile only exists because i fucking hate that tile collision desync i got when using full-sized flying sprites in ChibiiDoggo + if (Main.projectile[byUuid].active && Main.projectile[byUuid].type == mod.ProjectileType("ChibiiDoggo")) + { + //projectile.position.X = Main.projectile[byUuid].position.X - 22; + //projectile.position.Y = Main.projectile[byUuid].position.Y; + projectile.Center = Main.projectile[byUuid].Center; + projectile.rotation = Main.projectile[byUuid].rotation; + projectile.spriteDirection = Main.projectile[byUuid].spriteDirection; - if(Main.projectile[byUuid].tileCollide) - projectile.hide = true; - else - projectile.hide = false; - } - } - } + if (Main.projectile[byUuid].tileCollide) + projectile.hide = true; + else + projectile.hide = false; + } + } + } } diff --git a/Projectiles/Pets/DannyDevito.cs b/Projectiles/Pets/DannyDevito.cs index 81602dccad..529d1151ef 100644 --- a/Projectiles/Pets/DannyDevito.cs +++ b/Projectiles/Pets/DannyDevito.cs @@ -1,319 +1,319 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class DannyDevito : ModProjectile - { - private int playerStill = 0; - private bool fly = false; + { + private int playerStill = 0; + private bool fly = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Danny Devito"); - Main.projFrames[projectile.type] = 8; - Main.projPet[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Danny Devito"); + Main.projFrames[projectile.type] = 8; + Main.projPet[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 42; + projectile.height = 42; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = true; + } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - fallThrough = playerDistance > 200f; - return true; - } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + Player player = Main.player[projectile.owner]; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (!player.active) - { - projectile.active = false; - return; - } - CalamityPlayer modPlayer = player.Calamity(); - if (player.dead) - { - modPlayer.trashMan = false; - } - if (modPlayer.trashMan) - { - projectile.timeLeft = 2; - } - Vector2 vector46 = projectile.position; - if (!fly) - { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) - { - projectile.velocity.Y = -5f; - } - projectile.velocity.Y += 0.20f; - if (projectile.velocity.Y > 7f) - { - projectile.velocity.Y = 7f; - } - if (playerDistance > 600f) - { - fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; - } - if (playerDistance > 100f) - { - if (player.position.X - projectile.position.X > 0f) - { - projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) - { - projectile.velocity.X = 7f; - } - } - else - { - projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) - { - projectile.velocity.X = -7f; - } - } - } - if (playerDistance < 100f) - { - if (projectile.velocity.X != 0f) - { - if (projectile.velocity.X > 0.5f) - { - projectile.velocity.X -= 0.15f; - } - else if (projectile.velocity.X < -0.5f) - { - projectile.velocity.X += 0.15f; - } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) - { - projectile.velocity.X = 0f; - } - } - } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) - { - projectile.frame = 0; - } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) - { - projectile.frame = 1; - projectile.frameCounter = 0; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 6) - { - projectile.frame = 2; - } - if (projectile.frame < 2) - { - projectile.frame = 2; - } - } - } - else if (fly) - { - float num16 = 0.3f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; - vertiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); - vertiPos -= 60f; - float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - if (playerDistance > 1200f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (playerDistance < 100f) - { - num16 = 0.1f; - if (player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - } - } - if (playerDistance < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.90f; - } - num16 = 0.01f; - } - else - { - if (playerDistance < 100f) - { - num16 = 0.1f; - } - if (playerDistance > 300f) - { - num16 = 1f; - } - playerDistance = num21 / playerDistance; - horiPos *= playerDistance; - vertiPos *= playerDistance; - } - if (projectile.velocity.X <= horiPos) - { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num16; - } - } - if (projectile.velocity.X > horiPos) - { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num16; - } - } - if (projectile.velocity.Y <= vertiPos) - { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; - } - } - if (projectile.velocity.Y > vertiPos) - { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; - } - } - projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frame = 7; - } - if (projectile.velocity.X > 0.25f) - { - projectile.spriteDirection = -1; - } - else if (projectile.velocity.X < -0.25f) - { - projectile.spriteDirection = 1; - } - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.trashMan = false; + } + if (modPlayer.trashMan) + { + projectile.timeLeft = 2; + } + Vector2 vector46 = projectile.position; + if (!fly) + { + projectile.rotation = 0; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + { + projectile.velocity.Y = -5f; + } + projectile.velocity.Y += 0.20f; + if (projectile.velocity.Y > 7f) + { + projectile.velocity.Y = 7f; + } + if (playerDistance > 600f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 100f) + { + if (player.position.X - projectile.position.X > 0f) + { + projectile.velocity.X += 0.10f; + if (projectile.velocity.X > 7f) + { + projectile.velocity.X = 7f; + } + } + else + { + projectile.velocity.X -= 0.10f; + if (projectile.velocity.X < -7f) + { + projectile.velocity.X = -7f; + } + } + } + if (playerDistance < 100f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + projectile.velocity.X -= 0.15f; + } + else if (projectile.velocity.X < -0.5f) + { + projectile.velocity.X += 0.15f; + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + { + projectile.frame = 0; + } + else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + { + projectile.frame = 1; + projectile.frameCounter = 0; + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 6) + { + projectile.frame = 2; + } + if (projectile.frame < 2) + { + projectile.frame = 2; + } + } + } + else if (fly) + { + float num16 = 0.3f; + projectile.tileCollide = false; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + vertiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); + vertiPos -= 60f; + float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + float num21 = 18f; + float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + if (playerDistance > 1200f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + num16 = 0.1f; + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + } + } + if (playerDistance < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.90f; + } + num16 = 0.01f; + } + else + { + if (playerDistance < 100f) + { + num16 = 0.1f; + } + if (playerDistance > 300f) + { + num16 = 1f; + } + playerDistance = num21 / playerDistance; + horiPos *= playerDistance; + vertiPos *= playerDistance; + } + if (projectile.velocity.X <= horiPos) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > horiPos) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y <= vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + projectile.rotation = projectile.velocity.X * 0.03f; + projectile.frame = 7; + } + if (projectile.velocity.X > 0.25f) + { + projectile.spriteDirection = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = 1; + } + } - /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (!Main.gamePaused || Main.gameMenu) - { - Vector2 vector69 = projectile.position - Main.screenPosition; - if ((float)Main.mouseX > vector69.X && (float)Main.mouseX < vector69.X + (float)projectile.width && (float)Main.mouseY > vector69.Y && (float)Main.mouseY < vector69.Y + (float)projectile.height) - { - int num345 = (int)(Main.player[projectile.owner].Center.X / 16f); - int num346 = (int)(Main.player[projectile.owner].Center.Y / 16f); - int num347 = (int)projectile.Center.X / 16; - int num348 = (int)projectile.Center.Y / 16; - int lastTileRangeX = Main.player[projectile.owner].lastTileRangeX; - int lastTileRangeY = Main.player[projectile.owner].lastTileRangeY; - if (num345 >= num347 - lastTileRangeX && num345 <= num347 + lastTileRangeX + 1 && num346 >= num348 - lastTileRangeY && num346 <= num348 + lastTileRangeY + 1) - { - Main.player[projectile.owner].noThrow = 2; - Main.player[projectile.owner].showItemIcon = true; - Main.player[projectile.owner].showItemIcon2 = 3213; - if (PlayerInput.UsingGamepad) - { - Main.player[projectile.owner].GamepadEnableGrappleCooldown(); - } - if (Main.mouseRight && Main.mouseRightRelease && Player.StopMoneyTroughFromWorking == 0) - { - Main.mouseRightRelease = false; - if (Main.player[projectile.owner].chest == -2) - { - Main.PlaySound(SoundID.Item11, -1, -1); - Main.player[projectile.owner].chest = -1; - Recipe.FindRecipes(); - return; - } - Main.player[projectile.owner].GetCalamityPlayer().trashManChest = projectile.type; - Main.player[projectile.owner].chest = -2; - Main.player[projectile.owner].chestX = (int)(projectile.Center.X / 16f); - Main.player[projectile.owner].chestY = (int)(projectile.Center.Y / 16f); - Main.player[projectile.owner].talkNPC = -1; - Main.npcShop = 0; - Main.playerInventory = true; - Main.PlaySound(SoundID.Item10, -1, -1); - Recipe.FindRecipes(); - } - } - } - } - }*/ + /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (!Main.gamePaused || Main.gameMenu) + { + Vector2 vector69 = projectile.position - Main.screenPosition; + if ((float)Main.mouseX > vector69.X && (float)Main.mouseX < vector69.X + (float)projectile.width && (float)Main.mouseY > vector69.Y && (float)Main.mouseY < vector69.Y + (float)projectile.height) + { + int num345 = (int)(Main.player[projectile.owner].Center.X / 16f); + int num346 = (int)(Main.player[projectile.owner].Center.Y / 16f); + int num347 = (int)projectile.Center.X / 16; + int num348 = (int)projectile.Center.Y / 16; + int lastTileRangeX = Main.player[projectile.owner].lastTileRangeX; + int lastTileRangeY = Main.player[projectile.owner].lastTileRangeY; + if (num345 >= num347 - lastTileRangeX && num345 <= num347 + lastTileRangeX + 1 && num346 >= num348 - lastTileRangeY && num346 <= num348 + lastTileRangeY + 1) + { + Main.player[projectile.owner].noThrow = 2; + Main.player[projectile.owner].showItemIcon = true; + Main.player[projectile.owner].showItemIcon2 = 3213; + if (PlayerInput.UsingGamepad) + { + Main.player[projectile.owner].GamepadEnableGrappleCooldown(); + } + if (Main.mouseRight && Main.mouseRightRelease && Player.StopMoneyTroughFromWorking == 0) + { + Main.mouseRightRelease = false; + if (Main.player[projectile.owner].chest == -2) + { + Main.PlaySound(SoundID.Item11, -1, -1); + Main.player[projectile.owner].chest = -1; + Recipe.FindRecipes(); + return; + } + Main.player[projectile.owner].GetCalamityPlayer().trashManChest = projectile.type; + Main.player[projectile.owner].chest = -2; + Main.player[projectile.owner].chestX = (int)(projectile.Center.X / 16f); + Main.player[projectile.owner].chestY = (int)(projectile.Center.Y / 16f); + Main.player[projectile.owner].talkNPC = -1; + Main.npcShop = 0; + Main.playerInventory = true; + Main.PlaySound(SoundID.Item10, -1, -1); + Recipe.FindRecipes(); + } + } + } + } + }*/ - private bool HoleBelow() //pretty much the same as the one used in mantis - { - int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) - { - tileX += tileWidth; - } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); - for (int y = tileY; y < tileY + 2; y++) - { - for (int x = tileX; x < tileX + tileWidth; x++) - { - if (Main.tile[x, y].active()) - { - return false; - } - } - } - return true; - } - } + private bool HoleBelow() //pretty much the same as the one used in mantis + { + int tileWidth = 4; + int tileX = (int)(projectile.Center.X / 16f) - tileWidth; + if (projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].active()) + { + return false; + } + } + } + return true; + } + } } diff --git a/Projectiles/Pets/Fox.cs b/Projectiles/Pets/Fox.cs index f55fecde78..a3b67a4c3b 100644 --- a/Projectiles/Pets/Fox.cs +++ b/Projectiles/Pets/Fox.cs @@ -1,14 +1,14 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class Fox : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fox"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fox"); Main.projFrames[projectile.type] = 11; Main.projPet[projectile.type] = true; } diff --git a/Projectiles/Pets/Kendra.cs b/Projectiles/Pets/Kendra.cs index 2f27b65b3e..c6e5912203 100644 --- a/Projectiles/Pets/Kendra.cs +++ b/Projectiles/Pets/Kendra.cs @@ -1,381 +1,381 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class Kendra : ModProjectile - { - private int chosenIdle = 0; - private int idleTimer = 0; - private int idleBarkTimer = 0; - private int playerStill = 0; - private bool fly = false; + { + private int chosenIdle = 0; + private int idleTimer = 0; + private int idleBarkTimer = 0; + private int playerStill = 0; + private bool fly = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kendra"); - Main.projFrames[projectile.type] = 31; - Main.projPet[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kendra"); + Main.projFrames[projectile.type] = 31; + Main.projPet[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 46; + projectile.height = 46; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = true; + } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - fallThrough = playerDistance > 200f; - return true; - } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + Player player = Main.player[projectile.owner]; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (!player.active) - { - projectile.active = false; - return; - } - CalamityPlayer modPlayer = player.Calamity(); - if (player.dead) - { - modPlayer.kendra = false; - } - if (modPlayer.kendra) - { - projectile.timeLeft = 2; - } - Vector2 vector46 = projectile.position; - if (!fly) - { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0f && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) - { - projectile.velocity.Y = -5f; - } - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 7f) - { - projectile.velocity.Y = 7f; - } - if (playerDistance > 600f) - { - fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; - } - if (playerDistance > 100f) - { - if (player.position.X - projectile.position.X > 0f) - { - projectile.velocity.X += 0.1f; - if (projectile.velocity.X > 7f) - { - projectile.velocity.X = 7f; - } - } - else - { - projectile.velocity.X -= 0.1f; - if (projectile.velocity.X < -7f) - { - projectile.velocity.X = -7f; - } - } - } - if (playerDistance < 100f) - { - if (projectile.velocity.X != 0f) - { - if (projectile.velocity.X > 0.5f) - { - projectile.velocity.X -= 0.15f; - } - else if (projectile.velocity.X < -0.5f) - { - projectile.velocity.X += 0.15f; - } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) - { - projectile.velocity.X = 0f; - } - } - } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) - { - projectile.frameCounter++; - switch (chosenIdle) - { - case 1: - if (idleTimer == 0) - { - projectile.frame = 0; - } - idleTimer++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - chosenIdle = 0; - } - if (projectile.frame < 1) - { - projectile.frame = 1; - } - break; - case 2: - if (idleTimer == 0) - { - projectile.frame = 0; - } - idleTimer++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 13) - { - chosenIdle = 0; - } - if (projectile.frame < 5) - { - projectile.frame = 5; - } - break; - case 3: - if (idleTimer == 0) - { - projectile.frame = 0; - } - idleTimer++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 24) - { - chosenIdle = 0; - } - if (projectile.frame < 19) - { - projectile.frame = 19; - } - break; - } - if (chosenIdle == 0) - { - projectile.frame = 0; - projectile.frameCounter = 6; - idleTimer++; - if (idleTimer > 360) - { - chosenIdle = Main.rand.Next(1, 3); - idleTimer = 0; - } - idleBarkTimer++; - if (idleBarkTimer > 1080 && Main.rand.NextBool(2)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/KendraBark"), (int)projectile.position.X, (int)projectile.position.Y); - chosenIdle = 3; - idleBarkTimer = 0; - idleTimer = 0; - } - } - } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) - { - projectile.frame = 16; - projectile.frameCounter = 0; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 18) - { - projectile.frame = 14; - } - if (projectile.frame < 14) - { - projectile.frame = 14; - } - } - } - else if (fly) - { - float num16 = 0.3f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; - vertiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); - vertiPos -= 60f; - float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18.5f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - if (playerDistance > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (playerDistance < 100f) - { - num16 = 0.1f; - if (player.velocity.Y == 0f) - { - playerStill++; - } - else - { - playerStill = 0; - } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - } - } - if (playerDistance < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.9f; - } - num16 = 0.01f; - } - else - { - if (playerDistance < 100f) - { - num16 = 0.1f; - } - if (playerDistance > 300f) - { - num16 = 1f; - } - playerDistance = num21 / playerDistance; - horiPos *= playerDistance; - vertiPos *= playerDistance; - } - if (projectile.velocity.X <= horiPos) - { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num16; - } - } - if (projectile.velocity.X > horiPos) - { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num16; - } - } - if (projectile.velocity.Y <= vertiPos) - { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; - } - } - if (projectile.velocity.Y > vertiPos) - { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; - } - } - projectile.rotation = projectile.velocity.X * 0.015f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 30) - { - projectile.frame = 25; - } - if (projectile.frame < 25) - { - projectile.frame = 25; - } - } - if (projectile.velocity.X > 0.25f) - { - projectile.spriteDirection = -1; - } - else if (projectile.velocity.X < -0.25f) - { - projectile.spriteDirection = 1; - } - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.kendra = false; + } + if (modPlayer.kendra) + { + projectile.timeLeft = 2; + } + Vector2 vector46 = projectile.position; + if (!fly) + { + projectile.rotation = 0; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0f && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + { + projectile.velocity.Y = -5f; + } + projectile.velocity.Y += 0.2f; + if (projectile.velocity.Y > 7f) + { + projectile.velocity.Y = 7f; + } + if (playerDistance > 600f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 100f) + { + if (player.position.X - projectile.position.X > 0f) + { + projectile.velocity.X += 0.1f; + if (projectile.velocity.X > 7f) + { + projectile.velocity.X = 7f; + } + } + else + { + projectile.velocity.X -= 0.1f; + if (projectile.velocity.X < -7f) + { + projectile.velocity.X = -7f; + } + } + } + if (playerDistance < 100f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + projectile.velocity.X -= 0.15f; + } + else if (projectile.velocity.X < -0.5f) + { + projectile.velocity.X += 0.15f; + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + { + projectile.frameCounter++; + switch (chosenIdle) + { + case 1: + if (idleTimer == 0) + { + projectile.frame = 0; + } + idleTimer++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + chosenIdle = 0; + } + if (projectile.frame < 1) + { + projectile.frame = 1; + } + break; + case 2: + if (idleTimer == 0) + { + projectile.frame = 0; + } + idleTimer++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 13) + { + chosenIdle = 0; + } + if (projectile.frame < 5) + { + projectile.frame = 5; + } + break; + case 3: + if (idleTimer == 0) + { + projectile.frame = 0; + } + idleTimer++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 24) + { + chosenIdle = 0; + } + if (projectile.frame < 19) + { + projectile.frame = 19; + } + break; + } + if (chosenIdle == 0) + { + projectile.frame = 0; + projectile.frameCounter = 6; + idleTimer++; + if (idleTimer > 360) + { + chosenIdle = Main.rand.Next(1, 3); + idleTimer = 0; + } + idleBarkTimer++; + if (idleBarkTimer > 1080 && Main.rand.NextBool(2)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/KendraBark"), (int)projectile.position.X, (int)projectile.position.Y); + chosenIdle = 3; + idleBarkTimer = 0; + idleTimer = 0; + } + } + } + else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + { + projectile.frame = 16; + projectile.frameCounter = 0; + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 18) + { + projectile.frame = 14; + } + if (projectile.frame < 14) + { + projectile.frame = 14; + } + } + } + else if (fly) + { + float num16 = 0.3f; + projectile.tileCollide = false; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + vertiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); + vertiPos -= 60f; + float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + float num21 = 18.5f; + float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + if (playerDistance > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + num16 = 0.1f; + if (player.velocity.Y == 0f) + { + playerStill++; + } + else + { + playerStill = 0; + } + if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + } + } + if (playerDistance < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.9f; + } + num16 = 0.01f; + } + else + { + if (playerDistance < 100f) + { + num16 = 0.1f; + } + if (playerDistance > 300f) + { + num16 = 1f; + } + playerDistance = num21 / playerDistance; + horiPos *= playerDistance; + vertiPos *= playerDistance; + } + if (projectile.velocity.X <= horiPos) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > horiPos) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y <= vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + projectile.rotation = projectile.velocity.X * 0.015f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 30) + { + projectile.frame = 25; + } + if (projectile.frame < 25) + { + projectile.frame = 25; + } + } + if (projectile.velocity.X > 0.25f) + { + projectile.spriteDirection = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = 1; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - private bool HoleBelow() - { - int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) - { - tileX += tileWidth; - } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); - for (int y = tileY; y < tileY + 2; y++) - { - for (int x = tileX; x < tileX + tileWidth; x++) - { - if (Main.tile[x, y].active()) - { - return false; - } - } - } - return true; - } - } + private bool HoleBelow() + { + int tileWidth = 4; + int tileX = (int)(projectile.Center.X / 16f) - tileWidth; + if (projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].active()) + { + return false; + } + } + } + return true; + } + } } diff --git a/Projectiles/Pets/Levi.cs b/Projectiles/Pets/Levi.cs index 0ab65216f3..3285d0a3b6 100644 --- a/Projectiles/Pets/Levi.cs +++ b/Projectiles/Pets/Levi.cs @@ -1,16 +1,16 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class Levi : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Levi"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Levi"); Main.projFrames[projectile.type] = 5; Main.projPet[projectile.type] = true; } diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index 78557d8391..e19d02458a 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -1,491 +1,490 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Pets { public class SirenYoung : ModProjectile - { - private bool underwater = false; + { + private bool underwater = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren"); + Main.projFrames[projectile.type] = 4; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.LightPet[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.ignoreWater = true; - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.ignoreWater = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (!player.active) - { - projectile.active = false; - return; - } - CalamityPlayer modPlayer = player.Calamity(); - if (player.dead) - { - modPlayer.sirenPet = false; - } - if (modPlayer.sirenPet) - { - projectile.timeLeft = 2; - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) || modPlayer.leviathanAndSirenLore; - if (underwater) - { - projectile.width = 30; - projectile.height = 30; - if (projectile.localAI[0] == 0f) - { - Lighting.AddLight(projectile.Center, 2.5f, 2f, 0f); //4.5 - } - else - { - Lighting.AddLight(projectile.Center, 1.65f, 1.32f, 0f); //3 - } - } - else - { - projectile.width = 54; - projectile.height = 54; - Lighting.AddLight(projectile.Center, 0.825f, 0.66f, 0f); //1.5 - Vector2 vector54 = player.Center; - vector54.X -= (float)((15 + player.width / 2) * player.direction); - vector54.X -= (float)(40 * player.direction); - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - float num663 = 0.2f; - float num664 = 10f; - int num665 = 200; - if (num664 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - { - num664 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - } - Vector2 vector58 = vector54 - projectile.Center; - float num666 = vector58.Length(); - if (num666 > 2000f) - { - projectile.position = player.Center - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } - if (num666 < (float)num665 && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - if (num666 >= 60f) - { - vector58.Normalize(); - vector58 *= num664; - if (projectile.velocity.X < vector58.X) - { - projectile.velocity.X = projectile.velocity.X + num663; - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num663 * 1.5f; - } - } - if (projectile.velocity.X > vector58.X) - { - projectile.velocity.X = projectile.velocity.X - num663; - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num663 * 1.5f; - } - } - if (projectile.velocity.Y < vector58.Y) - { - projectile.velocity.Y = projectile.velocity.Y + num663; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num663 * 1.5f; - } - } - if (projectile.velocity.Y > vector58.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num663; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num663 * 1.5f; - } - } - } - if (projectile.velocity.X != 0f) - { - projectile.spriteDirection = Math.Sign(projectile.velocity.X); - } - } - if (projectile.ai[0] == 2f) - { - projectile.friendly = true; - projectile.spriteDirection = projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } - float[] var_2_1C896_cp_0 = projectile.ai; - int var_2_1C896_cp_1 = 1; - float num73 = var_2_1C896_cp_0[var_2_1C896_cp_1]; - var_2_1C896_cp_0[var_2_1C896_cp_1] = num73 - 1f; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = 0f; - projectile.ai[0] = 0f; - projectile.friendly = false; - projectile.netUpdate = true; - return; - } - } - if (projectile.ai[0] == 0f) - { - float num671 = 200f; - if (player.rocketDelay2 > 0) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - Vector2 vector59 = vector54 - projectile.Center; - if (vector59.Length() > 2000f) - { - projectile.position = vector54 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } - else if (vector59.Length() > num671 || Math.Abs(vector59.Y) > 300f) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - if (projectile.velocity.Y > 0f && vector59.Y < 0f) - { - projectile.velocity.Y = 0f; - } - if (projectile.velocity.Y < 0f && vector59.Y > 0f) - { - projectile.velocity.Y = 0f; - } - } - projectile.tileCollide = true; - float num672 = 0.5f; - float num673 = 4f; - float num674 = 4f; - float num675 = 0.1f; - if (num674 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - { - num674 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - num672 = 0.7f; - } - int num676 = 0; - bool flag29 = false; - float num677 = vector54.X - projectile.Center.X; - if (Math.Abs(num677) > 5f) - { - if (num677 < 0f) - { - num676 = -1; - if (projectile.velocity.X > -num673) - { - projectile.velocity.X = projectile.velocity.X - num672; - } - else - { - projectile.velocity.X = projectile.velocity.X - num675; - } - } - else - { - num676 = 1; - if (projectile.velocity.X < num673) - { - projectile.velocity.X = projectile.velocity.X + num672; - } - else - { - projectile.velocity.X = projectile.velocity.X + num675; - } - } - flag29 = true; - } - else - { - projectile.velocity.X = projectile.velocity.X * 0.9f; - if (Math.Abs(projectile.velocity.X) < num672 * 2f) - { - projectile.velocity.X = 0f; - } - } - if (num676 != 0) - { - int num678 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - int num679 = (int)projectile.position.Y / 16; - num678 += num676; - num678 += (int)projectile.velocity.X; - int num3; - for (int num680 = num679; num680 < num679 + projectile.height / 16 + 1; num680 = num3 + 1) - { - if (WorldGen.SolidTile(num678, num680)) - { - flag29 = true; - } - num3 = num680; - } - } - if (projectile.velocity.X != 0f) - { - flag29 = true; - } - Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); - if (projectile.velocity.Y == 0f && flag29) - { - int num3; - for (int num681 = 0; num681 < 3; num681 = num3 + 1) - { - int num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - if (num681 == 0) - { - num682 = (int)projectile.position.X / 16; - } - if (num681 == 2) - { - num682 = (int)(projectile.position.X + (float)projectile.width) / 16; - } - int num683 = (int)(projectile.position.Y + (float)projectile.height) / 16; - if (WorldGen.SolidTile(num682, num683) || Main.tile[num682, num683].halfBrick() || Main.tile[num682, num683].slope() > 0 || (TileID.Sets.Platforms[(int)Main.tile[num682, num683].type] && Main.tile[num682, num683].active() && !Main.tile[num682, num683].inActive())) - { - try - { - num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - num683 = (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16; - num682 += num676; - num682 += (int)projectile.velocity.X; - if (!WorldGen.SolidTile(num682, num683 - 1) && !WorldGen.SolidTile(num682, num683 - 2)) - { - projectile.velocity.Y = -5.1f; - } - else if (!WorldGen.SolidTile(num682, num683 - 2)) - { - projectile.velocity.Y = -7.1f; - } - else if (WorldGen.SolidTile(num682, num683 - 5)) - { - projectile.velocity.Y = -11.1f; - } - else if (WorldGen.SolidTile(num682, num683 - 4)) - { - projectile.velocity.Y = -10.1f; - } - else - { - projectile.velocity.Y = -9.1f; - } - } - catch - { - projectile.velocity.Y = -9.1f; - } - } - num3 = num681; - } - } - if (projectile.velocity.X > num674) - { - projectile.velocity.X = num674; - } - if (projectile.velocity.X < -num674) - { - projectile.velocity.X = -num674; - } - if (projectile.velocity.X < 0f) - { - projectile.direction = -1; - } - if (projectile.velocity.X > 0f) - { - projectile.direction = 1; - } - if (projectile.velocity.X > num672 && num676 == 1) - { - projectile.direction = 1; - } - if (projectile.velocity.X < -num672 && num676 == -1) - { - projectile.direction = -1; - } - projectile.spriteDirection = projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } - } - return; - } - float num23 = 0.2f; - float num24 = 5f; - projectile.tileCollide = false; - Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; - float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; - if (Main.player[projectile.owner].controlLeft) - { - num25 -= 120f; - } - else if (Main.player[projectile.owner].controlRight) - { - num25 += 120f; - } - if (Main.player[projectile.owner].controlDown) - { - num26 += 120f; - } - else - { - if (Main.player[projectile.owner].controlUp) - { - num26 -= 120f; - } - num26 -= 60f; - } - float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); - if (num27 > 1000f) - { - projectile.position.X = projectile.position.X + num25; - projectile.position.Y = projectile.position.Y + num26; - } - if (projectile.localAI[0] == 1f) - { - if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) - { - projectile.localAI[0] = 0f; - } - num24 = 12f; - if (num27 < num24) - { - projectile.velocity.X = num25; - projectile.velocity.Y = num26; - } - else - { - num27 = num24 / num27; - projectile.velocity.X = num25 * num27; - projectile.velocity.Y = num26 * num27; - } - if ((double)projectile.velocity.X > 0.5) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.5) - { - projectile.direction = 1; - } - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.05f; - return; - } - if (num27 > 200f) - { - projectile.localAI[0] = 1f; - } - if ((double)projectile.velocity.X > 0.5) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.5) - { - projectile.direction = 1; - } - projectile.spriteDirection = projectile.direction; - if (num27 < 10f) - { - projectile.velocity.X = num25; - projectile.velocity.Y = num26; - projectile.rotation = projectile.velocity.X * 0.05f; - if (num27 < num24) - { - projectile.position += projectile.velocity; - projectile.velocity *= 0f; - num23 = 0f; - } - projectile.direction = -Main.player[projectile.owner].direction; - } - num27 = num24 / num27; - num25 *= num27; - num26 *= num27; - if (projectile.velocity.X < num25) - { - projectile.velocity.X = projectile.velocity.X + num23; - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - } - } - if (projectile.velocity.X > num25) - { - projectile.velocity.X = projectile.velocity.X - num23; - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - } - } - if (projectile.velocity.Y < num26) - { - projectile.velocity.Y = projectile.velocity.Y + num23; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.99f; - } - } - if (projectile.velocity.Y > num26) - { - projectile.velocity.Y = projectile.velocity.Y - num23; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.99f; - } - } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) - { - projectile.rotation = projectile.velocity.X * 0.05f; - } - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.sirenPet = false; + } + if (modPlayer.sirenPet) + { + projectile.timeLeft = 2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) || modPlayer.leviathanAndSirenLore; + if (underwater) + { + projectile.width = 30; + projectile.height = 30; + if (projectile.localAI[0] == 0f) + { + Lighting.AddLight(projectile.Center, 2.5f, 2f, 0f); //4.5 + } + else + { + Lighting.AddLight(projectile.Center, 1.65f, 1.32f, 0f); //3 + } + } + else + { + projectile.width = 54; + projectile.height = 54; + Lighting.AddLight(projectile.Center, 0.825f, 0.66f, 0f); //1.5 + Vector2 vector54 = player.Center; + vector54.X -= (float)((15 + player.width / 2) * player.direction); + vector54.X -= (float)(40 * player.direction); + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + float num663 = 0.2f; + float num664 = 10f; + int num665 = 200; + if (num664 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) + { + num664 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + } + Vector2 vector58 = vector54 - projectile.Center; + float num666 = vector58.Length(); + if (num666 > 2000f) + { + projectile.position = player.Center - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + } + if (num666 < (float)num665 && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (num666 >= 60f) + { + vector58.Normalize(); + vector58 *= num664; + if (projectile.velocity.X < vector58.X) + { + projectile.velocity.X = projectile.velocity.X + num663; + if (projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num663 * 1.5f; + } + } + if (projectile.velocity.X > vector58.X) + { + projectile.velocity.X = projectile.velocity.X - num663; + if (projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num663 * 1.5f; + } + } + if (projectile.velocity.Y < vector58.Y) + { + projectile.velocity.Y = projectile.velocity.Y + num663; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num663 * 1.5f; + } + } + if (projectile.velocity.Y > vector58.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num663; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num663 * 1.5f; + } + } + } + if (projectile.velocity.X != 0f) + { + projectile.spriteDirection = Math.Sign(projectile.velocity.X); + } + } + if (projectile.ai[0] == 2f) + { + projectile.friendly = true; + projectile.spriteDirection = projectile.direction; + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + float[] var_2_1C896_cp_0 = projectile.ai; + int var_2_1C896_cp_1 = 1; + float num73 = var_2_1C896_cp_0[var_2_1C896_cp_1]; + var_2_1C896_cp_0[var_2_1C896_cp_1] = num73 - 1f; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = 0f; + projectile.ai[0] = 0f; + projectile.friendly = false; + projectile.netUpdate = true; + return; + } + } + if (projectile.ai[0] == 0f) + { + float num671 = 200f; + if (player.rocketDelay2 > 0) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + Vector2 vector59 = vector54 - projectile.Center; + if (vector59.Length() > 2000f) + { + projectile.position = vector54 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + } + else if (vector59.Length() > num671 || Math.Abs(vector59.Y) > 300f) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + if (projectile.velocity.Y > 0f && vector59.Y < 0f) + { + projectile.velocity.Y = 0f; + } + if (projectile.velocity.Y < 0f && vector59.Y > 0f) + { + projectile.velocity.Y = 0f; + } + } + projectile.tileCollide = true; + float num672 = 0.5f; + float num673 = 4f; + float num674 = 4f; + float num675 = 0.1f; + if (num674 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) + { + num674 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + num672 = 0.7f; + } + int num676 = 0; + bool flag29 = false; + float num677 = vector54.X - projectile.Center.X; + if (Math.Abs(num677) > 5f) + { + if (num677 < 0f) + { + num676 = -1; + if (projectile.velocity.X > -num673) + { + projectile.velocity.X = projectile.velocity.X - num672; + } + else + { + projectile.velocity.X = projectile.velocity.X - num675; + } + } + else + { + num676 = 1; + if (projectile.velocity.X < num673) + { + projectile.velocity.X = projectile.velocity.X + num672; + } + else + { + projectile.velocity.X = projectile.velocity.X + num675; + } + } + flag29 = true; + } + else + { + projectile.velocity.X = projectile.velocity.X * 0.9f; + if (Math.Abs(projectile.velocity.X) < num672 * 2f) + { + projectile.velocity.X = 0f; + } + } + if (num676 != 0) + { + int num678 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; + int num679 = (int)projectile.position.Y / 16; + num678 += num676; + num678 += (int)projectile.velocity.X; + int num3; + for (int num680 = num679; num680 < num679 + projectile.height / 16 + 1; num680 = num3 + 1) + { + if (WorldGen.SolidTile(num678, num680)) + { + flag29 = true; + } + num3 = num680; + } + } + if (projectile.velocity.X != 0f) + { + flag29 = true; + } + Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); + if (projectile.velocity.Y == 0f && flag29) + { + int num3; + for (int num681 = 0; num681 < 3; num681 = num3 + 1) + { + int num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; + if (num681 == 0) + { + num682 = (int)projectile.position.X / 16; + } + if (num681 == 2) + { + num682 = (int)(projectile.position.X + (float)projectile.width) / 16; + } + int num683 = (int)(projectile.position.Y + (float)projectile.height) / 16; + if (WorldGen.SolidTile(num682, num683) || Main.tile[num682, num683].halfBrick() || Main.tile[num682, num683].slope() > 0 || (TileID.Sets.Platforms[(int)Main.tile[num682, num683].type] && Main.tile[num682, num683].active() && !Main.tile[num682, num683].inActive())) + { + try + { + num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; + num683 = (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16; + num682 += num676; + num682 += (int)projectile.velocity.X; + if (!WorldGen.SolidTile(num682, num683 - 1) && !WorldGen.SolidTile(num682, num683 - 2)) + { + projectile.velocity.Y = -5.1f; + } + else if (!WorldGen.SolidTile(num682, num683 - 2)) + { + projectile.velocity.Y = -7.1f; + } + else if (WorldGen.SolidTile(num682, num683 - 5)) + { + projectile.velocity.Y = -11.1f; + } + else if (WorldGen.SolidTile(num682, num683 - 4)) + { + projectile.velocity.Y = -10.1f; + } + else + { + projectile.velocity.Y = -9.1f; + } + } catch + { + projectile.velocity.Y = -9.1f; + } + } + num3 = num681; + } + } + if (projectile.velocity.X > num674) + { + projectile.velocity.X = num674; + } + if (projectile.velocity.X < -num674) + { + projectile.velocity.X = -num674; + } + if (projectile.velocity.X < 0f) + { + projectile.direction = -1; + } + if (projectile.velocity.X > 0f) + { + projectile.direction = 1; + } + if (projectile.velocity.X > num672 && num676 == 1) + { + projectile.direction = 1; + } + if (projectile.velocity.X < -num672 && num676 == -1) + { + projectile.direction = -1; + } + projectile.spriteDirection = projectile.direction; + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + } + return; + } + float num23 = 0.2f; + float num24 = 5f; + projectile.tileCollide = false; + Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; + float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; + if (Main.player[projectile.owner].controlLeft) + { + num25 -= 120f; + } + else if (Main.player[projectile.owner].controlRight) + { + num25 += 120f; + } + if (Main.player[projectile.owner].controlDown) + { + num26 += 120f; + } + else + { + if (Main.player[projectile.owner].controlUp) + { + num26 -= 120f; + } + num26 -= 60f; + } + float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); + if (num27 > 1000f) + { + projectile.position.X = projectile.position.X + num25; + projectile.position.Y = projectile.position.Y + num26; + } + if (projectile.localAI[0] == 1f) + { + if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) + { + projectile.localAI[0] = 0f; + } + num24 = 12f; + if (num27 < num24) + { + projectile.velocity.X = num25; + projectile.velocity.Y = num26; + } + else + { + num27 = num24 / num27; + projectile.velocity.X = num25 * num27; + projectile.velocity.Y = num26 * num27; + } + if ((double)projectile.velocity.X > 0.5) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.5) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.05f; + return; + } + if (num27 > 200f) + { + projectile.localAI[0] = 1f; + } + if ((double)projectile.velocity.X > 0.5) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.5) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + if (num27 < 10f) + { + projectile.velocity.X = num25; + projectile.velocity.Y = num26; + projectile.rotation = projectile.velocity.X * 0.05f; + if (num27 < num24) + { + projectile.position += projectile.velocity; + projectile.velocity *= 0f; + num23 = 0f; + } + projectile.direction = -Main.player[projectile.owner].direction; + } + num27 = num24 / num27; + num25 *= num27; + num26 *= num27; + if (projectile.velocity.X < num25) + { + projectile.velocity.X = projectile.velocity.X + num23; + if (projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + } + if (projectile.velocity.X > num25) + { + projectile.velocity.X = projectile.velocity.X - num23; + if (projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + } + if (projectile.velocity.Y < num26) + { + projectile.velocity.Y = projectile.velocity.Y + num23; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.99f; + } + } + if (projectile.velocity.Y > num26) + { + projectile.velocity.Y = projectile.velocity.Y - num23; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.99f; + } + } + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = projectile.velocity.X * 0.05f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture = (underwater ? Main.projectileTexture[projectile.type] : mod.GetTexture("Projectiles/Pets/SirenFlopping")); - int height = (underwater ? Main.projectileTexture[projectile.type].Height : 256) / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = (underwater ? Main.projectileTexture[projectile.type] : mod.GetTexture("Projectiles/Pets/SirenFlopping")); + int height = (underwater ? Main.projectileTexture[projectile.type].Height : 256) / Main.projFrames[projectile.type]; + int frameHeight = height * projectile.frame; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Pets/ThirdSage.cs b/Projectiles/Pets/ThirdSage.cs index 9d67718d1d..5bbfc161a1 100644 --- a/Projectiles/Pets/ThirdSage.cs +++ b/Projectiles/Pets/ThirdSage.cs @@ -1,168 +1,162 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Pets { - public class ThirdSage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Third Sage"); - Main.projPet[projectile.type] = true; - Main.projFrames[projectile.type] = 7; - } + public class ThirdSage : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Third Sage"); + Main.projPet[projectile.type] = true; + Main.projFrames[projectile.type] = 7; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 42; + projectile.height = 42; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = false; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (!player.active) - { - projectile.active = false; - return; - } - CalamityPlayer modPlayer = player.Calamity(); - if (player.dead) - { - modPlayer.thirdSage = false; - } - if (modPlayer.thirdSage) - { - projectile.timeLeft = 2; - } - float num16 = 0.5f; - projectile.tileCollide = false; - int num17 = 100; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; - num19 += (float)Main.rand.Next(-10, 21); - num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); - num19 -= 60f; - float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); - float num21 = 18f; - if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - if (num20 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num20 < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.99f; - } - num16 = 0.01f; - } - else - { - if (num20 < 100f) - { - num16 = 0.1f; - } - if (num20 > 300f) - { - num16 = 1f; - } - num20 = num21 / num20; - num18 *= num20; - num19 *= num20; - } - if (projectile.velocity.X < num18) - { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num16; - } - } - if (projectile.velocity.X > num18) - { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num16; - } - } - if (projectile.velocity.Y < num19) - { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; - } - } - if (projectile.velocity.Y > num19) - { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; - } - } - if ((double)projectile.velocity.X >= 0.25) - { - projectile.direction = 1; - } - else if ((double)projectile.velocity.X < -0.25) - { - projectile.direction = -1; - } - //Tilting and change directions - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.1f; - //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4 && projectile.ai[1] < 45) - { - projectile.frame = 0; - projectile.ai[1]++; - } - else if (projectile.frame == 4 && projectile.ai[1] >= 45) - { - Main.PlaySound(29, projectile.position, 32); - } - else if (projectile.frame > 6) - { - projectile.frame = 0; - projectile.ai[1] = 0; - } - } - } + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.thirdSage = false; + } + if (modPlayer.thirdSage) + { + projectile.timeLeft = 2; + } + float num16 = 0.5f; + projectile.tileCollide = false; + int num17 = 100; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + num19 += (float)Main.rand.Next(-10, 21); + num18 += (float)Main.rand.Next(-10, 21); + num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); + num19 -= 60f; + float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); + float num21 = 18f; + if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (num20 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num20 < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.99f; + } + num16 = 0.01f; + } + else + { + if (num20 < 100f) + { + num16 = 0.1f; + } + if (num20 > 300f) + { + num16 = 1f; + } + num20 = num21 / num20; + num18 *= num20; + num19 *= num20; + } + if (projectile.velocity.X < num18) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > num18) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y < num19) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > num19) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + if ((double)projectile.velocity.X >= 0.25) + { + projectile.direction = 1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.direction = -1; + } + //Tilting and change directions + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.1f; + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4 && projectile.ai[1] < 45) + { + projectile.frame = 0; + projectile.ai[1]++; + } + else if (projectile.frame == 4 && projectile.ai[1] >= 45) + { + Main.PlaySound(29, projectile.position, 32); + } + else if (projectile.frame > 6) + { + projectile.frame = 0; + projectile.ai[1] = 0; + } + } + } } diff --git a/Projectiles/Ranged/AMR.cs b/Projectiles/Ranged/AMR.cs index f38dacf9c1..d8437c52d5 100644 --- a/Projectiles/Ranged/AMR.cs +++ b/Projectiles/Ranged/AMR.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class AMR : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("AMR"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("AMR"); + } public override void SetDefaults() { @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 4; projectile.light = 0.5f; projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.scale = 1.18f; + projectile.extraUpdates = 10; + projectile.scale = 1.18f; projectile.friendly = true; projectile.ranged = true; projectile.ignoreWater = true; @@ -29,14 +29,14 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (crit) { diff --git a/Projectiles/Ranged/AMR2.cs b/Projectiles/Ranged/AMR2.cs index 8e6b37e10f..65b7fbd0e9 100644 --- a/Projectiles/Ranged/AMR2.cs +++ b/Projectiles/Ranged/AMR2.cs @@ -4,10 +4,10 @@ namespace CalamityMod.Projectiles.Ranged { public class AMR2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("AMR"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("AMR"); + } public override void SetDefaults() { @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 4; projectile.light = 0.5f; projectile.alpha = 255; - projectile.extraUpdates = 5; - projectile.scale = 1.18f; + projectile.extraUpdates = 5; + projectile.scale = 1.18f; projectile.tileCollide = false; projectile.friendly = true; projectile.ranged = true; diff --git a/Projectiles/Ranged/AccelerationBullet.cs b/Projectiles/Ranged/AccelerationBullet.cs index cafbaf1687..c385f281a0 100644 --- a/Projectiles/Ranged/AccelerationBullet.cs +++ b/Projectiles/Ranged/AccelerationBullet.cs @@ -7,65 +7,65 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class AccelerationBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acceleration Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acceleration Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - projectile.velocity *= 1.01f; + public override void AI() + { + projectile.velocity *= 1.01f; if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; } } - } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Ranged/AcidBullet.cs b/Projectiles/Ranged/AcidBullet.cs index 520b994c9d..f497998315 100644 --- a/Projectiles/Ranged/AcidBullet.cs +++ b/Projectiles/Ranged/AcidBullet.cs @@ -7,69 +7,69 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class AcidBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (Main.rand.NextBool(2)) - { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + public override void SetStaticDefaults() { - target.AddBuff(mod.BuffType("Plague"), 360); + DisplayName.SetDefault("Acid Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - public override void Kill(int timeLeft) + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } - } + } } diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index 6174294c29..882f5b2f76 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class AquaBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aqua Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aqua Blast"); + } public override void SetDefaults() { @@ -24,22 +24,22 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - for (int lol = 0; lol < 10; lol++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1f); - } + for (int lol = 0; lol < 10; lol++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1f); + } } } } diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs index ebff22df79..df7d7f9840 100644 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ b/Projectiles/Ranged/AquaBlastToxic.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class AquaBlastToxic : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aqua Blast Toxic"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aqua Blast Toxic"); + } public override void SetDefaults() { @@ -25,28 +25,28 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - for (int lol = 0; lol < 10; lol++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); - } + for (int lol = 0; lol < 10; lol++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } } } diff --git a/Projectiles/Ranged/Archerfish.cs b/Projectiles/Ranged/Archerfish.cs index c2650787fb..8fbbcaa16d 100644 --- a/Projectiles/Ranged/Archerfish.cs +++ b/Projectiles/Ranged/Archerfish.cs @@ -6,26 +6,26 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class Archerfish : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water Round"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water Round"); + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - } + projectile.penetrate = 2; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.extraUpdates = 2; + } - public override void AI() + public override void AI() { if (projectile.localAI[0] < 5f) { @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Wet, 240); + target.AddBuff(BuffID.Wet, 240); } - } + } } diff --git a/Projectiles/Ranged/ArcticArrow.cs b/Projectiles/Ranged/ArcticArrow.cs index 37e066f0b8..36a84a9071 100644 --- a/Projectiles/Ranged/ArcticArrow.cs +++ b/Projectiles/Ranged/ArcticArrow.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ArcticArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arctic Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Arrow"); + } public override void SetDefaults() { @@ -26,44 +26,44 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void Kill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("GlacialState"), 180); + target.AddBuff(mod.BuffType("GlacialState"), 180); } } } diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index f7ff00c660..29737c407f 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -1,155 +1,155 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class AstralRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Round"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.light = 0.25f; - projectile.extraUpdates = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Bullet; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() + public class AstralRound : ModProjectile + { + public override void SetStaticDefaults() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; + DisplayName.SetDefault("Astral Round"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.light = 0.25f; + projectile.extraUpdates = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + aiType = ProjectileID.Bullet; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(2)) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = mod.DustType("AstralOrange"); - } - else - { - randomDust = mod.DustType("AstralBlue"); - } - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 200f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - return false; - } + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = mod.DustType("AstralOrange"); + } + else + { + randomDust = mod.DustType("AstralBlue"); + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 200f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } - } + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } + } } diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index 0d18fa4072..5845b2955a 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,14 +9,14 @@ namespace CalamityMod.Projectiles.Ranged { public class AstrealArrow : ModProjectile { - private int flameTimer = 180; + private int flameTimer = 180; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astreal Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astreal Arrow"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,66 +25,66 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 255; projectile.friendly = true; projectile.ranged = true; - projectile.arrow = true; - projectile.extraUpdates = 1; + projectile.arrow = true; + projectile.extraUpdates = 1; projectile.penetrate = 1; projectile.timeLeft = 600; - } + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int random = Main.rand.Next(1, 4); - flameTimer -= random; - int choice = Main.rand.Next(2); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - if (choice == 0 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; - } - else if (choice == 1 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) - { - projectile.velocity.X = 10f; - projectile.velocity.Y = 0f; - } - else if (choice == 0 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; - } - else if (choice == 1 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) - { - projectile.velocity.X = -10f; - projectile.velocity.Y = 0f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int random = Main.rand.Next(1, 4); + flameTimer -= random; + int choice = Main.rand.Next(2); + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + if (choice == 0 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 10f; + } + else if (choice == 1 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) + { + projectile.velocity.X = 10f; + projectile.velocity.Y = 0f; + } + else if (choice == 0 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -10f; + } + else if (choice == 1 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) + { + projectile.velocity.X = -10f; + projectile.velocity.Y = 0f; + } if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (flameTimer <= 0) - { + { float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); float num80 = xPos; @@ -111,30 +111,30 @@ namespace CalamityMod.Projectiles.Ranged speedY = -15f; } if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstrealFlame"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstrealFlame"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); } - flameTimer = 180; - } + flameTimer = 180; + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - for (int k = 0; k < 5; k++) + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.ShadowFlame, 360); + target.AddBuff(BuffID.ShadowFlame, 360); } } } diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index de26e4e2ff..3bd2197f09 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,11 +7,11 @@ namespace CalamityMod.Projectiles.Ranged { public class AstrealFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -26,77 +26,77 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 16f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.alpha -= 5; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 16f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 74); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 74); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index 971cb8bc99..58c099770a 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -1,69 +1,69 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class BallistaGreatArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ballista Great Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public class BallistaGreatArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ballista Great Arrow"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 2; - projectile.aiStyle = 1; - aiType = 1; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 2; + projectile.aiStyle = 1; + aiType = 1; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 12; - target.AddBuff(mod.BuffType("ArmorCrunch"), 360); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 12; + target.AddBuff(mod.BuffType("ArmorCrunch"), 360); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + float spread = 90f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 529d9ffefe..37abdc0d79 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BeeRPG : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bee RPG"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bee RPG"); + } public override void SetDefaults() { @@ -24,161 +24,161 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 2f; - } - else if (Main.rand.NextBool(2)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 2f; + } + else if (Main.rand.NextBool(2)) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void Kill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) - { - int num516 = 12; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 4), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; - } - } - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 2; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + if (projectile.owner == Main.myPlayer) + { + int num516 = 12; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.NextBool(3)) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + num518 += projectile.oldVelocity.X / 6f; + num519 += projectile.oldVelocity.Y / 6f; + int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 4), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].penetrate = 2; + Main.projectile[num520].Calamity().forceRanged = true; + } + } + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 2; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 300); + target.AddBuff(mod.BuffType("Plague"), 300); } } } diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index b38fbe89cf..8cc3697539 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BigNuke : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Nuke"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Nuke"); + } public override void SetDefaults() { @@ -24,135 +24,135 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void Kill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 720); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 90; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 180; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 9; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 720); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 90; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 180; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 9; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } } } diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index 5a90f35921..4b0b4bc86f 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BloodClotFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Clot"); + } public override void SetDefaults() { @@ -25,16 +25,16 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } } } diff --git a/Projectiles/Ranged/BloodfireArrow.cs b/Projectiles/Ranged/BloodfireArrow.cs index 1092811618..f5f45c5063 100644 --- a/Projectiles/Ranged/BloodfireArrow.cs +++ b/Projectiles/Ranged/BloodfireArrow.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Ranged { public class BloodfireArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodfire Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodfire Arrow"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -25,18 +25,18 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 1; projectile.timeLeft = 300; - } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void AI() + public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.localAI[0] += 1f; if (projectile.localAI[0] == 15f) { @@ -58,31 +58,31 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 0.5f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 0.5f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; if (Main.rand.NextBool(3)) { player.statLife += 1; @@ -91,10 +91,10 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Ranged/BloodfireBullet.cs b/Projectiles/Ranged/BloodfireBullet.cs index 37637f6c7e..c992fa17de 100644 --- a/Projectiles/Ranged/BloodfireBullet.cs +++ b/Projectiles/Ranged/BloodfireBullet.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class BloodfireBullet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodfire Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodfire Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -27,47 +27,47 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - } + } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; if (Main.rand.NextBool(2)) { player.statLife += 1; player.HealEffect(1); } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index 1fe4538e0e..3808456de9 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +9,13 @@ namespace CalamityMod.Projectiles.Ranged { public class BloodflareSoul : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Soul"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -30,42 +30,42 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.penetrate = 1; projectile.timeLeft = 900; - } + } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; Main.dust[num822].scale = 1.3f; Main.dust[num822].noGravity = true; float num953 = 30f * projectile.ai[1]; //100 - float scaleFactor12 = 6f * projectile.ai[1]; //5 - float num954 = 600f; + float scaleFactor12 = 6f * projectile.ai[1]; //5 + float num954 = 600f; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 400f; @@ -100,22 +100,22 @@ namespace CalamityMod.Projectiles.Ranged projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; } } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { @@ -128,11 +128,11 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 110); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 110); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.Damage(); + projectile.Damage(); } } } diff --git a/Projectiles/Ranged/BlueExoArrow.cs b/Projectiles/Ranged/BlueExoArrow.cs index 5e51a4b82d..094f1e28d3 100644 --- a/Projectiles/Ranged/BlueExoArrow.cs +++ b/Projectiles/Ranged/BlueExoArrow.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BlueExoArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -29,83 +29,83 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 40f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(0, 0, 250, projectile.alpha); + return new Color(0, 0, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 40f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - for (int x = 0; x < 3; x++) + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + for (int x = 0; x < 3; x++) { float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); diff --git a/Projectiles/Ranged/BlueExoArrow2.cs b/Projectiles/Ranged/BlueExoArrow2.cs index e151f58cff..67d932c4d6 100644 --- a/Projectiles/Ranged/BlueExoArrow2.cs +++ b/Projectiles/Ranged/BlueExoArrow2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BlueExoArrow2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -28,69 +28,69 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 40f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(0, 0, 250, projectile.alpha); + return new Color(0, 0, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 40f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } } } diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index 10645997ee..5c2800befa 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Ranged { public class Bolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,14 +26,14 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.alpha = 255; projectile.penetrate = 1; - } + } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.65f); - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.65f); + projectile.velocity.X *= 1.015f; + projectile.velocity.Y *= 1.015f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.localAI[0] += 1f; if (projectile.localAI[0] == 30f) { @@ -64,10 +64,10 @@ namespace CalamityMod.Projectiles.Ranged return new Color(255, 255, 255, 100); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/BoltArrow.cs b/Projectiles/Ranged/BoltArrow.cs index b031de809d..985fd1b528 100644 --- a/Projectiles/Ranged/BoltArrow.cs +++ b/Projectiles/Ranged/BoltArrow.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BoltArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt Arrow"); + } public override void SetDefaults() { @@ -18,14 +18,14 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 10; projectile.friendly = true; projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; + projectile.arrow = true; + projectile.penetrate = 1; projectile.timeLeft = 180; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.localAI[0] += 1f; if (projectile.localAI[0] == 15f) { @@ -45,32 +45,32 @@ namespace CalamityMod.Projectiles.Ranged } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void Kill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); - int num212 = Main.rand.Next(10, 20); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); + int num212 = Main.rand.Next(10, 20); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } } } diff --git a/Projectiles/Ranged/BrimstoneBallFriendly.cs b/Projectiles/Ranged/BrimstoneBallFriendly.cs index d7a042d536..439b61c40c 100644 --- a/Projectiles/Ranged/BrimstoneBallFriendly.cs +++ b/Projectiles/Ranged/BrimstoneBallFriendly.cs @@ -6,35 +6,35 @@ namespace CalamityMod.Projectiles.Ranged { public class BrimstoneBallFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 6; + projectile.ranged = true; + projectile.penetrate = 6; projectile.aiStyle = 14; projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -62,8 +62,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); } } } diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index 46bc3b74f8..7775b7c975 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BrimstoneBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -26,34 +26,34 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 15; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 621727d8fb..33cdcca56d 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class BrimstoneFireFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -25,65 +25,65 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 235; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 235; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); } } } diff --git a/Projectiles/Ranged/Butcher.cs b/Projectiles/Ranged/Butcher.cs index 13fcc454e1..ebf4dbcdf7 100644 --- a/Projectiles/Ranged/Butcher.cs +++ b/Projectiles/Ranged/Butcher.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Butcher : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Butcher"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Butcher"); + } public override void SetDefaults() { @@ -26,137 +26,137 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.ai[0] += 1f; - int num39 = 0; - float spreadMult = 0.15f; - if (projectile.ai[0] >= 90f) - { - num39++; - spreadMult = 0.13f; - } - if (projectile.ai[0] >= 180f) - { - num39++; - spreadMult = 0.11f; - } - if (projectile.ai[0] >= 270f) - { - num39++; - spreadMult = 0.09f; - } - if (projectile.ai[0] >= 360f) - { - num39++; - spreadMult = 0.07f; - } - if (projectile.ai[0] >= 450f) - { - num39++; - spreadMult = 0.05f; - } - if (projectile.ai[0] >= 540f) - { - num39++; - spreadMult = 0.04f; - } - if (projectile.ai[0] >= 630f) - { - num39++; - spreadMult = 0.03f; - } - if (projectile.ai[0] >= 720f) //8 - { - num39++; - spreadMult = 0.02f; - } - int num40 = 40; - int num41 = 3; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.soundDelay <= 0 && flag16) - { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item38, projectile.position); - } - projectile.localAI[0] = 12f; - } - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - int randomBulletCount = Main.rand.Next(3, 5); - for (int num43 = 0; num43 < randomBulletCount; num43++) - { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * spreadMult); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); - vector20.X += (float)Main.rand.Next(-15, 16) * spreadMult; - vector20.Y += (float)Main.rand.Next(-15, 16) * spreadMult; - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; - Main.projectile[num44].extraUpdates += num39 / 2; //0 to 4 - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.ai[0] += 1f; + int num39 = 0; + float spreadMult = 0.15f; + if (projectile.ai[0] >= 90f) + { + num39++; + spreadMult = 0.13f; + } + if (projectile.ai[0] >= 180f) + { + num39++; + spreadMult = 0.11f; + } + if (projectile.ai[0] >= 270f) + { + num39++; + spreadMult = 0.09f; + } + if (projectile.ai[0] >= 360f) + { + num39++; + spreadMult = 0.07f; + } + if (projectile.ai[0] >= 450f) + { + num39++; + spreadMult = 0.05f; + } + if (projectile.ai[0] >= 540f) + { + num39++; + spreadMult = 0.04f; + } + if (projectile.ai[0] >= 630f) + { + num39++; + spreadMult = 0.03f; + } + if (projectile.ai[0] >= 720f) //8 + { + num39++; + spreadMult = 0.02f; + } + int num40 = 40; + int num41 = 3; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + } + bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.soundDelay <= 0 && flag16) + { + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item38, projectile.position); + } + projectile.localAI[0] = 12f; + } + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = 14; + float scaleFactor11 = 14f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + int randomBulletCount = Main.rand.Next(3, 5); + for (int num43 = 0; num43 < randomBulletCount; num43++) + { + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * spreadMult); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); + vector20.X += (float)Main.rand.Next(-15, 16) * spreadMult; + vector20.Y += (float)Main.rand.Next(-15, 16) * spreadMult; + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + Main.projectile[num44].noDropItem = true; + Main.projectile[num44].extraUpdates += num39 / 2; //0 to 4 + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index c21bf856ce..43b0d7f020 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,85 +26,85 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(100, 100, 255, 0); + return new Color(100, 100, 255, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); int projectiles = Main.rand.Next(2, 5); if (projectile.owner == Main.myPlayer) { - for (int k = 0; k < projectiles; k++) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, mod.ProjectileType("ChargedBlast2"), - (int)((double)projectile.damage * 0.85), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); - } + for (int k = 0; k < projectiles; k++) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, mod.ProjectileType("ChargedBlast2"), + (int)((double)projectile.damage * 0.85), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); + } } } } diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index a320f0e146..fd2f3ab9e8 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,77 +26,77 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 30f; - float num56 = 1f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + float num55 = 30f; + float num56 = 1f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(100, 100, 255, 0); + return new Color(100, 100, 255, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 1f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 30f; + float scaleFactor = 1f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 3; + target.immune[projectile.owner] = 3; } } } diff --git a/Projectiles/Ranged/ChargedBlast3.cs b/Projectiles/Ranged/ChargedBlast3.cs index 7d58d6f5ac..cfbf50053c 100644 --- a/Projectiles/Ranged/ChargedBlast3.cs +++ b/Projectiles/Ranged/ChargedBlast3.cs @@ -6,202 +6,202 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 4; - projectile.extraUpdates = 3; - projectile.alpha = 255; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 4; + projectile.extraUpdates = 3; + projectile.alpha = 255; + projectile.timeLeft = 300; + } - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 100, 255, 0); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 100, 255, 0); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[explode].penetrate = 1; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[explode].penetrate = 1; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override void Kill(int timeLeft) - { - int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[explode].penetrate = 1; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 100; - projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + public override void Kill(int timeLeft) + { + int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[explode].penetrate = 1; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 100; + projectile.height = 100; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; - int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[explode].penetrate = 1; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 2; + int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[explode].penetrate = 1; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Ranged/Chicken.cs b/Projectiles/Ranged/Chicken.cs index d14fb286bf..1dbfb7cb7b 100644 --- a/Projectiles/Ranged/Chicken.cs +++ b/Projectiles/Ranged/Chicken.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,18 +7,18 @@ namespace CalamityMod.Projectiles.Ranged { public class Chicken : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chicken"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chicken"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.penetrate = 1; projectile.aiStyle = 1; projectile.ranged = true; @@ -26,55 +26,55 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.NextBool(2)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.1f; + } + else if (Main.rand.NextBool(2)) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -87,33 +87,33 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 1040); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChickenExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 1040); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChickenExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 028bfffe1d..360ac81ee2 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ChickenExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -23,73 +23,73 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 150; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-120, 121); - float num464 = (float)Main.rand.Next(-120, 121); - float num465 = (float)Main.rand.Next(36, 108); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-120, 121); + float num464 = (float)Main.rand.Next(-120, 121); + float num465 = (float)Main.rand.Next(36, 108); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Ranged/Contagion.cs b/Projectiles/Ranged/Contagion.cs index 74ad39d5d5..84e6640c4c 100644 --- a/Projectiles/Ranged/Contagion.cs +++ b/Projectiles/Ranged/Contagion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Contagion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion"); + } public override void SetDefaults() { @@ -25,115 +25,115 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == mod.ProjectileType("Contagion")) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 80f) - { - num2++; - } - if (projectile.ai[0] >= 120f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - projectile.frameCounter += 1 + num2; - if (projectile.frameCounter >= 4) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 5); - } - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default, 0.25f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { - bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; - if (player.gravDir == -1f) - { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; - } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) - { - vector3 = -Vector2.UnitY; - } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector3; - int num6 = mod.ProjectileType("ContagionArrow"); - float scaleFactor2 = 14f; - int num7 = 7; - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else - { - projectile.Kill(); - } - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.type == mod.ProjectileType("Contagion")) + { + projectile.ai[0] += 1f; + int num2 = 0; + if (projectile.ai[0] >= 40f) + { + num2++; + } + if (projectile.ai[0] >= 80f) + { + num2++; + } + if (projectile.ai[0] >= 120f) + { + num2++; + } + int num3 = 24; + int num4 = 6; + projectile.ai[1] += 1f; + bool flag = false; + if (projectile.ai[1] >= (float)(num3 - num4 * num2)) + { + projectile.ai[1] = 0f; + flag = true; + } + projectile.frameCounter += 1 + num2; + if (projectile.frameCounter >= 4) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num3 - num4 * num2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 5); + } + } + if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) + { + Vector2 vector2 = Vector2.UnitX * 24f; + vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + Vector2 value = projectile.Center + vector2; + for (int i = 0; i < 2; i++) + { + int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default, 0.25f); + Main.dust[num5].velocity *= 0.66f; + Main.dust[num5].noGravity = true; + Main.dust[num5].scale = 1.4f; + } + } + if (flag && Main.myPlayer == projectile.owner) + { + bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; + if (flag2) + { + float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value2 = vector; + Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + if (player.gravDir == -1f) + { + value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + } + Vector2 vector3 = Vector2.Normalize(value3); + if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + { + vector3 = -Vector2.UnitY; + } + vector3 *= scaleFactor; + if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector3; + int num6 = mod.ProjectileType("ContagionArrow"); + float scaleFactor2 = 14f; + int num7 = 7; + value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); + if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) + { + spinningpoint = -Vector2.UnitY; + } + Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else + { + projectile.Kill(); + } + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index 02ad4ee83b..3237fee71c 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,14 +9,14 @@ namespace CalamityMod.Projectiles.Ranged { public class ContagionArrow : ModProjectile { - private int addBallTimer = 10; + private int addBallTimer = 10; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion Arrow"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -24,49 +24,49 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 10; projectile.friendly = true; projectile.ignoreWater = true; - projectile.arrow = true; - projectile.penetrate = 1; + projectile.arrow = true; + projectile.penetrate = 1; projectile.extraUpdates = 1; projectile.ranged = true; - } + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - addBallTimer--; - if (addBallTimer <= 0) - { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ContagionBall")] < 100) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ContagionBall"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - addBallTimer = 10; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.ai[0] <= 60f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + addBallTimer--; + if (addBallTimer <= 0) + { + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ContagionBall")] < 100) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ContagionBall"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + addBallTimer = 10; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.ai[0] <= 60f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool OnTileCollide(Vector2 oldVelocity) { - target.AddBuff(mod.BuffType("Plague"), 600); + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/ContagionBall.cs b/Projectiles/Ranged/ContagionBall.cs index c3073ebeff..c3e41eb8a6 100644 --- a/Projectiles/Ranged/ContagionBall.cs +++ b/Projectiles/Ranged/ContagionBall.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ContagionBall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion Ball"); + } public override void SetDefaults() { @@ -23,15 +23,15 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default, 0.15f); Main.dust[num622].velocity *= 1.2f; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 300); + target.AddBuff(mod.BuffType("Plague"), 300); } } } diff --git a/Projectiles/Ranged/CorossiveFlames.cs b/Projectiles/Ranged/CorossiveFlames.cs index a54b9e2414..5167abef3b 100644 --- a/Projectiles/Ranged/CorossiveFlames.cs +++ b/Projectiles/Ranged/CorossiveFlames.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class CorossiveFlames : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flames"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flames"); + } public override void SetDefaults() { @@ -25,74 +25,74 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 89; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - if (Main.rand.NextBool(6)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 89; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + if (Main.rand.NextBool(6)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 4; - target.AddBuff(mod.BuffType("Plague"), 300); + target.immune[projectile.owner] = 4; + target.AddBuff(mod.BuffType("Plague"), 300); } } } diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 015224043b..59143baaf5 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class CosmicFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -26,74 +26,74 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.1f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 58; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.1f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 58; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 3; - target.AddBuff(BuffID.CursedInferno, 300); + target.immune[projectile.owner] = 3; + target.AddBuff(BuffID.CursedInferno, 300); } } } diff --git a/Projectiles/Ranged/DaemonsFlame.cs b/Projectiles/Ranged/DaemonsFlame.cs index 924c7dce8c..078d05af4b 100644 --- a/Projectiles/Ranged/DaemonsFlame.cs +++ b/Projectiles/Ranged/DaemonsFlame.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Ranged { public class DaemonsFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daemon's Flame"); - Main.projFrames[projectile.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daemon's Flame"); + Main.projFrames[projectile.type] = 3; + } public override void SetDefaults() { @@ -27,128 +27,128 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - projectile.ai[0] += 1f; - int num39 = 0; - if (projectile.ai[0] >= 30f) - { - num39++; - } - if (projectile.ai[0] >= 60f) - { - num39++; - } - if (projectile.ai[0] >= 90f) - { - num39++; - } - if (projectile.ai[0] >= 120f) - { - num39++; - } - int num40 = 24; - int num41 = 2; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); - } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.soundDelay <= 0 && flag16) - { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item5, projectile.position); - } - projectile.localAI[0] = 12f; - } - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - for (int num43 = 0; num43 < 4; num43++) - { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; - } - Vector2 vector2 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y)) - { - vector2 = -Vector2.UnitY; - } - float speedY = vector2.Y; - Vector2 vector3 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - Projectile.NewProjectile(vector3.X, vector3.Y, vector2.X, vector2.Y, mod.ProjectileType("DaemonsFlameArrow"), weaponDamage2, weaponKnockback2, projectile.owner, 0.0f, speedY); - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + projectile.ai[0] += 1f; + int num39 = 0; + if (projectile.ai[0] >= 30f) + { + num39++; + } + if (projectile.ai[0] >= 60f) + { + num39++; + } + if (projectile.ai[0] >= 90f) + { + num39++; + } + if (projectile.ai[0] >= 120f) + { + num39++; + } + int num40 = 24; + int num41 = 2; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + } + bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.soundDelay <= 0 && flag16) + { + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item5, projectile.position); + } + projectile.localAI[0] = 12f; + } + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = 14; + float scaleFactor11 = 14f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + for (int num43 = 0; num43 < 4; num43++) + { + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + Main.projectile[num44].noDropItem = true; + } + Vector2 vector2 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y)) + { + vector2 = -Vector2.UnitY; + } + float speedY = vector2.Y; + Vector2 vector3 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); + Projectile.NewProjectile(vector3.X, vector3.Y, vector2.X, vector2.Y, mod.ProjectileType("DaemonsFlameArrow"), weaponDamage2, weaponKnockback2, projectile.owner, 0.0f, speedY); + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Ranged/DaemonsFlameArrow.cs b/Projectiles/Ranged/DaemonsFlameArrow.cs index 2924834d1a..ee690b9eeb 100644 --- a/Projectiles/Ranged/DaemonsFlameArrow.cs +++ b/Projectiles/Ranged/DaemonsFlameArrow.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Ranged { public class DaemonsFlameArrow : ModProjectile { - public int x; + public int x; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -25,59 +25,59 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 255; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - x++; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 30f) - { - projectile.velocity.Y = (float)(((double)projectile.ai[1]) * Math.Sin(x/4)); - } - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 60, 0f, 0f, 100, default, 3f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 60, 0f, 0f, 100, default, 2.25f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } + x++; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 30f) + { + projectile.velocity.Y = (float)(((double)projectile.ai[1]) * Math.Sin(x / 4)); + } + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 60, 0f, 0f, 100, default, 3f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 60, 0f, 0f, 100, default, 2.25f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Ranged/DragonBurst.cs b/Projectiles/Ranged/DragonBurst.cs index cf8b122919..2c11366bdc 100644 --- a/Projectiles/Ranged/DragonBurst.cs +++ b/Projectiles/Ranged/DragonBurst.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class DragonBurst : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burst"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burst"); + } public override void SetDefaults() { @@ -26,45 +26,45 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num92 = 0; num92 < 2; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 127, 0f, 0f, 100, default, 2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; - } - if (Main.rand.NextBool(10)) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 127, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num92 = 0; num92 < 2; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 127, 0f, 0f, 100, default, 2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X -= num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y -= num94; + } + if (Main.rand.NextBool(10)) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 127, 0f, 0f, 100, default, 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRanged = true; - } + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceRanged = true; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.OnFire, 600); } } } diff --git a/Projectiles/Ranged/Drataliornus.cs b/Projectiles/Ranged/Drataliornus.cs index 80277445b0..90264ddd72 100644 --- a/Projectiles/Ranged/Drataliornus.cs +++ b/Projectiles/Ranged/Drataliornus.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,21 +7,21 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class Drataliornus : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Drataliornus"); } public override void SetDefaults() - { - projectile.width = 64; - projectile.height = 84; + { + projectile.width = 64; + projectile.height = 84; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + projectile.ranged = true; + projectile.ignoreWater = true; } public override void AI() //mostly phangasm code @@ -45,7 +45,9 @@ namespace CalamityMod.Projectiles.Ranged case 216: case 252: case 288: - case 324: projectile.localAI[0]++; break; + case 324: + projectile.localAI[0]++; + break; case 360: projectile.localAI[0]++; diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index 69736a36fa..e46ffbc12b 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Ranged private int HolyLight { get { return mod.BuffType("HolyLight"); } } public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drataliornus Arrow"); - } + { + DisplayName.SetDefault("Drataliornus Arrow"); + } public override void SetDefaults() { @@ -32,32 +32,32 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -72,53 +72,53 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Daybreak, 540); target.AddBuff(HolyLight, 540); - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 25, 0, projectile.alpha); + return new Color(250, 25, 0, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } } } diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index 67f36988da..1ff28a1581 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -1,14 +1,14 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class DrataliornusFlame : ModProjectile - { + public class DrataliornusFlame : ModProjectile + { private int HolyLight { get { return mod.BuffType("HolyLight"); } } private int DragonDust { get { return mod.ProjectileType("DragonDust"); } } private int SkyFlareFriendly { get { return mod.ProjectileType("SkyFlareFriendly"); } } @@ -20,14 +20,14 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; + { + projectile.width = 18; + projectile.height = 18; projectile.scale = 1.5f; projectile.friendly = true; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.ranged = true; + projectile.ranged = true; projectile.hide = true; projectile.timeLeft = 180; } @@ -258,5 +258,5 @@ namespace CalamityMod.Projectiles.Ranged } } } - } + } } diff --git a/Projectiles/Ranged/ElysianArrow.cs b/Projectiles/Ranged/ElysianArrow.cs index a546b14561..6d12d870f4 100644 --- a/Projectiles/Ranged/ElysianArrow.cs +++ b/Projectiles/Ranged/ElysianArrow.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Ranged { public class ElysianArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,114 +26,114 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.aiStyle = 1; - } + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void Kill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); - for (int num621 = 0; num621 < 2; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 6; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - if (projectile.owner == Main.myPlayer) - { - int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("SkyFlareFriendly"), projectile.damage, 5f, projectile.owner, 0f, 0f); - Main.projectile[num19].ai[1] = projectile.position.Y; - } + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; + projectile.Damage(); + for (int num621 = 0; num621 < 2; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 6; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + float x = projectile.position.X + (float)Main.rand.Next(-400, 400); + float y = projectile.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 25; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + if (projectile.owner == Main.myPlayer) + { + int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("SkyFlareFriendly"), projectile.damage, 5f, projectile.owner, 0f, 0f); + Main.projectile[num19].ai[1] = projectile.position.Y; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 360); + target.AddBuff(mod.BuffType("HolyLight"), 360); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/EnhancedNanoRound.cs b/Projectiles/Ranged/EnhancedNanoRound.cs index 758d8afc56..a4aac0c2e8 100644 --- a/Projectiles/Ranged/EnhancedNanoRound.cs +++ b/Projectiles/Ranged/EnhancedNanoRound.cs @@ -7,83 +7,83 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class EnhancedNanoRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nano Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nano Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Confused, 300); - if (target.life <= 0) - { - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("Nanomachine"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } - } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Confused, 300); + if (target.life <= 0) + { + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("Nanomachine"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); int num212 = Main.rand.Next(5, 10); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default, 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } - } + } } diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index c1a483da29..cef51d17db 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class EssenceFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -25,74 +25,74 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - if (projectile.timeLeft > 50) - { - projectile.timeLeft = 50; - } - if (projectile.ai[0] > 5f) - { - float num296 = 1f; - if (projectile.ai[0] == 6f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 7f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 8f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 173; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + if (projectile.timeLeft > 50) + { + projectile.timeLeft = 50; + } + if (projectile.ai[0] > 5f) + { + float num296 = 1f; + if (projectile.ai[0] == 6f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 7f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 8f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 173; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - target.immune[projectile.owner] = 1; - } + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + target.immune[projectile.owner] = 1; + } } } diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index 6c742b40b3..d24f946d1f 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Ranged public bool speedXChoice = false; public bool speedYChoice = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -45,29 +45,29 @@ namespace CalamityMod.Projectiles.Ranged } projectile.velocity.X *= speedX; projectile.velocity.X *= speedY; - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = (Main.rand.NextBool(2) ? 107 : 234); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = (Main.rand.NextBool(2) ? 107 : 234); if (Main.rand.NextBool(4)) { num297 = 269; } - if (Main.rand.NextBool(2)) - { + if (Main.rand.NextBool(2)) + { for (int num298 = 0; num298 < 2; num298++) { int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 0.6f); @@ -91,26 +91,26 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num299].scale *= num296; Main.dust[num299].velocity += projectile.velocity; } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } } } diff --git a/Projectiles/Ranged/ExoMark.cs b/Projectiles/Ranged/ExoMark.cs index bd44317868..4f29bbc266 100644 --- a/Projectiles/Ranged/ExoMark.cs +++ b/Projectiles/Ranged/ExoMark.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoMark : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } public override void SetDefaults() { @@ -19,136 +19,136 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.tileCollide = false; projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.alpha = 255; projectile.penetrate = -1; projectile.localNPCHitCooldown = 5; } public override void AI() { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 107, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("ExoTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - } + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 107, 0f, 0f, 0, default, 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("ExoTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0f, 3f, 0f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0f, 3f, 0f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; } } } diff --git a/Projectiles/Ranged/ExoTornado.cs b/Projectiles/Ranged/ExoTornado.cs index efbecaadd8..d7c71f2db3 100644 --- a/Projectiles/Ranged/ExoTornado.cs +++ b/Projectiles/Ranged/ExoTornado.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoTornado : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } public override void SetDefaults() { @@ -22,130 +22,130 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.timeLeft = 240; //1200 projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.localNPCHitCooldown = 6; } public override void AI() { - float num1125 = 165f; //900 - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - float num1127 = 30f; //15 - float num1128 = 30f; //15 - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - return; - } + float num1125 = 165f; //900 + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + float num1127 = 30f; //15 + float num1128 = 30f; //15 + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + return; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float num226 = 150f; //600 - float num227 = 30f; //15 - float num228 = 30f; //15 - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(0, 250, 0); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; + float num226 = 150f; //600 + float num227 = 30f; //15 + float num228 = 30f; //15 + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(0, 250, 0); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; } } } diff --git a/Projectiles/Ranged/ExplodingStake.cs b/Projectiles/Ranged/ExplodingStake.cs index 7d6ecaab8d..05f54a4075 100644 --- a/Projectiles/Ranged/ExplodingStake.cs +++ b/Projectiles/Ranged/ExplodingStake.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ExplodingStake : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stake"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stake"); + } public override void SetDefaults() { @@ -31,18 +31,18 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = Main.projectileTexture[projectile.type]; spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); @@ -51,26 +51,26 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceRanged = true; - } + target.immune[projectile.owner] = 5; + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[boom].Calamity().forceRanged = true; + } } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (target.type == NPCID.Vampire || target.type == NPCID.VampireBat) - damage += target.lifeMax * 3; - } - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (target.type == NPCID.Vampire || target.type == NPCID.VampireBat) + damage += target.lifeMax * 3; + } + } } diff --git a/Projectiles/Ranged/ExplosiveShellBullet.cs b/Projectiles/Ranged/ExplosiveShellBullet.cs index b0260c89b4..a95107402e 100644 --- a/Projectiles/Ranged/ExplosiveShellBullet.cs +++ b/Projectiles/Ranged/ExplosiveShellBullet.cs @@ -1,47 +1,47 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Ranged { public class ExplosiveShellBullet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosive Shell Bullet"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Shell Bullet"); + } public override void SetDefaults() { projectile.width = 4; projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.friendly = true; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 10; + projectile.friendly = true; projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { damage += target.lifeMax / 150; //120 + 30 = 150 + (100000 / 150 = 666) = 816 * 15 (pellets) = 12240 * 2 (explosion) = 24480 = 24.48% of boss HP - if (damage > target.lifeMax / 90 && CalamityPlayer.areThereAnyDamnBosses) + if (damage > target.lifeMax / 90 && CalamityPlayer.areThereAnyDamnBosses) damage = target.lifeMax / 90; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); projectile.position = projectile.Center; diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index cf46450219..60a4592ebb 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,50 +8,50 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class FeatherLarge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - int num3; - for (int num611 = 0; num611 < 10; num611 = num3 + 1) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 42, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 1f); - num3 = num611; - } - } - } + public override void Kill(int timeLeft) + { + int num3; + for (int num611 = 0; num611 < 10; num611 = num3 + 1) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 42, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 1f); + num3 = num611; + } + } + } } diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index c04284a0e0..48b3ad7252 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class FishronRPG : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("RPG"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("RPG"); + } public override void SetDefaults() { @@ -24,130 +24,130 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return true; - } - - public override void Kill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Ranged/FlakKraken.cs b/Projectiles/Ranged/FlakKraken.cs index cb9def59c7..88b8ee661d 100644 --- a/Projectiles/Ranged/FlakKraken.cs +++ b/Projectiles/Ranged/FlakKraken.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,135 +8,135 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class FlakKraken : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kraken"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kraken"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.scale = 0.002f; - projectile.timeLeft = 36000; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.scale = 0.002f; + projectile.timeLeft = 36000; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } - public override void AI() - { - if (projectile.type != mod.ProjectileType("FlakKraken") || - !Main.projectile[(int)projectile.ai[1]].active || - Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("FlakKrakenGun")) - { - projectile.Kill(); - return; - } - projectile.rotation += 0.2f; - if (projectile.localAI[0] < 1f) - { - projectile.localAI[0] += 0.002f; - projectile.scale += 0.002f; - projectile.width = (projectile.height = (int)(50f * projectile.scale)); - } - else - { - projectile.width = (projectile.height = 50); - } - Player player = Main.player[projectile.owner]; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - } - vector2 += new Vector2(num78, num79); - float speed = 30f; - float speedScale = 3f; - Vector2 vectorPos = projectile.Center; - if (Vector2.Distance(vector2, vectorPos) < 90f) - { - speed = 10f; - speedScale = 1f; - } - if (Vector2.Distance(vector2, vectorPos) < 30f) - { - speed = 3f; - speedScale = 0.3f; - } - if (Vector2.Distance(vector2, vectorPos) < 10f) - { - speed = 1f; - speedScale = 0.1f; - } - float num678 = vector2.X - vectorPos.X; - float num679 = vector2.Y - vectorPos.Y; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - num680 = speed / num680; - num678 *= num680; - num679 *= num680; - if (projectile.velocity.X < num678) - { - projectile.velocity.X = projectile.velocity.X + speedScale; - if (projectile.velocity.X < 0f && num678 > 0f) - { - projectile.velocity.X = projectile.velocity.X + speedScale; - } - } - else if (projectile.velocity.X > num678) - { - projectile.velocity.X = projectile.velocity.X - speedScale; - if (projectile.velocity.X > 0f && num678 < 0f) - { - projectile.velocity.X = projectile.velocity.X - speedScale; - } - } - if (projectile.velocity.Y < num679) - { - projectile.velocity.Y = projectile.velocity.Y + speedScale; - if (projectile.velocity.Y < 0f && num679 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + speedScale; - } - } - else if (projectile.velocity.Y > num679) - { - projectile.velocity.Y = projectile.velocity.Y - speedScale; - if (projectile.velocity.Y > 0f && num679 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - speedScale; - } - } - } + public override void AI() + { + if (projectile.type != mod.ProjectileType("FlakKraken") || + !Main.projectile[(int)projectile.ai[1]].active || + Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("FlakKrakenGun")) + { + projectile.Kill(); + return; + } + projectile.rotation += 0.2f; + if (projectile.localAI[0] < 1f) + { + projectile.localAI[0] += 0.002f; + projectile.scale += 0.002f; + projectile.width = (projectile.height = (int)(50f * projectile.scale)); + } + else + { + projectile.width = (projectile.height = 50); + } + Player player = Main.player[projectile.owner]; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + } + vector2 += new Vector2(num78, num79); + float speed = 30f; + float speedScale = 3f; + Vector2 vectorPos = projectile.Center; + if (Vector2.Distance(vector2, vectorPos) < 90f) + { + speed = 10f; + speedScale = 1f; + } + if (Vector2.Distance(vector2, vectorPos) < 30f) + { + speed = 3f; + speedScale = 0.3f; + } + if (Vector2.Distance(vector2, vectorPos) < 10f) + { + speed = 1f; + speedScale = 0.1f; + } + float num678 = vector2.X - vectorPos.X; + float num679 = vector2.Y - vectorPos.Y; + float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); + num680 = speed / num680; + num678 *= num680; + num679 *= num680; + if (projectile.velocity.X < num678) + { + projectile.velocity.X = projectile.velocity.X + speedScale; + if (projectile.velocity.X < 0f && num678 > 0f) + { + projectile.velocity.X = projectile.velocity.X + speedScale; + } + } + else if (projectile.velocity.X > num678) + { + projectile.velocity.X = projectile.velocity.X - speedScale; + if (projectile.velocity.X > 0f && num678 < 0f) + { + projectile.velocity.X = projectile.velocity.X - speedScale; + } + } + if (projectile.velocity.Y < num679) + { + projectile.velocity.Y = projectile.velocity.Y + speedScale; + if (projectile.velocity.Y < 0f && num679 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + speedScale; + } + } + else if (projectile.velocity.Y > num679) + { + projectile.velocity.Y = projectile.velocity.Y - speedScale; + if (projectile.velocity.Y > 0f && num679 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - speedScale; + } + } + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage = (int)((double)damage * (double)projectile.localAI[0]); - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage = (int)((double)damage * (double)projectile.localAI[0]); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 200, 50, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 200, 50, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index d6982b9902..0738d61580 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,92 +8,92 @@ namespace CalamityMod.Projectiles.Ranged { public class FlakKrakenGun : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flak Kraken"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flak Kraken"); + } public override void SetDefaults() { projectile.width = 140; projectile.height = 44; projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.spriteDirection == -1) { num = 3.14159274f; } float num26 = 30f; - if (projectile.ai[0] > 90f) - { - num26 = 15f; - } - if (projectile.ai[0] > 120f) - { - num26 = 5f; - } - projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.rangedDamage); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; - int num27 = 10; - bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag10 = true; - } - if (projectile.ai[1] >= 1f) - { - projectile.ai[1] = 0f; - flag10 = true; - if (Main.myPlayer == projectile.owner) - { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; - if (player.gravDir == -1f) - { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; - } - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) - { - vector11 = -Vector2.UnitY; - } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); //0.92 - vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector11; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f && projectile.ai[0] <= 500f) - { - Main.PlaySound(SoundID.Item15, projectile.position); - } - } - if (flag10 && Main.myPlayer == projectile.owner) - { - bool flag12 = player.channel && !player.noItems && !player.CCed; - if (flag12) - { - if (projectile.ai[0] == 1f) - { + if (projectile.ai[0] > 90f) + { + num26 = 15f; + } + if (projectile.ai[0] > 120f) + { + num26 = 5f; + } + projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.rangedDamage); + projectile.ai[0] += 1f; + projectile.ai[1] += 1f; + int num27 = 10; + bool flag10 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag10 = true; + } + if (projectile.ai[1] >= 1f) + { + projectile.ai[1] = 0f; + flag10 = true; + if (Main.myPlayer == projectile.owner) + { + float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value12 = vector; + Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + if (player.gravDir == -1f) + { + value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; + } + Vector2 vector11 = Vector2.Normalize(value13); + if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) + { + vector11 = -Vector2.UnitY; + } + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); //0.92 + vector11 *= scaleFactor5; + if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector11; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num27; + projectile.soundDelay *= 2; + if (projectile.ai[0] != 1f && projectile.ai[0] <= 500f) + { + Main.PlaySound(SoundID.Item15, projectile.position); + } + } + if (flag10 && Main.myPlayer == projectile.owner) + { + bool flag12 = player.channel && !player.noItems && !player.CCed; + if (flag12) + { + if (projectile.ai[0] == 1f) + { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -108,24 +108,24 @@ namespace CalamityMod.Projectiles.Ranged } vector2 += new Vector2(num78, num79); int num29 = projectile.damage; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("FlakKraken"), num29, projectile.knockBack, projectile.owner, 0f, (float)projectile.whoAmI); - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("FlakKraken"), num29, projectile.knockBack, projectile.owner, 0f, (float)projectile.whoAmI); + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Ranged/FlamingStake.cs b/Projectiles/Ranged/FlamingStake.cs index dad9fb5104..a6bb53d7e1 100644 --- a/Projectiles/Ranged/FlamingStake.cs +++ b/Projectiles/Ranged/FlamingStake.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class FlamingStake : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stake"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stake"); + } public override void SetDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -43,22 +43,22 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.OnFire, 300); + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.OnFire, 300); } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (target.type == NPCID.Vampire || target.type == NPCID.VampireBat) - damage += target.lifeMax * 3; - } - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (target.type == NPCID.Vampire || target.type == NPCID.VampireBat) + damage += target.lifeMax * 3; + } + } } diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index 8060c60f5f..f6f099c044 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Ranged { public class FlareBat : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bat"); - Main.projFrames[projectile.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bat"); + Main.projFrames[projectile.type] = 5; + } public override void SetDefaults() { @@ -27,49 +27,49 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 0, default, 1f); - Main.dust[num192].noGravity = true; - Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; - projectile.frameCounter++; - if (projectile.frameCounter >= 2) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= 5) - { - projectile.frame = 0; - } - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 0, default, 1f); + Main.dust[num192].noGravity = true; + Main.dust[num192].velocity *= 0.2f; + Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; + projectile.frameCounter++; + if (projectile.frameCounter >= 2) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame >= 5) + { + projectile.frame = 0; + } + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -101,18 +101,18 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index 32c6806366..1774faf0cd 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Flash : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flash"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flash"); + } public override void SetDefaults() { @@ -20,75 +20,75 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; + projectile.ranged = true; + projectile.penetrate = -1; projectile.timeLeft = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, default, 2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, default, 2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Confused, 300); + target.AddBuff(BuffID.Confused, 300); } } } diff --git a/Projectiles/Ranged/FlashBullet.cs b/Projectiles/Ranged/FlashBullet.cs index e548939fe4..e52300cc51 100644 --- a/Projectiles/Ranged/FlashBullet.cs +++ b/Projectiles/Ranged/FlashBullet.cs @@ -7,62 +7,62 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class FlashBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 93); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Flash"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 264, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 93); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Flash"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 264, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 8835219cee..0bc0bf632e 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Ranged { public class FossilShard : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shard"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shard"); + } public override void SetDefaults() { @@ -24,21 +24,21 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation += projectile.velocity.Y; - projectile.velocity.Y *= 1.05f; + projectile.rotation += projectile.velocity.Y; + projectile.velocity.Y *= 1.05f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ArmorCrunch"), 60); + target.AddBuff(mod.BuffType("ArmorCrunch"), 60); } public override void Kill(int timeLeft) { - for (int i = 0; i <= 2; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } + for (int i = 0; i <= 2; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } } } } diff --git a/Projectiles/Ranged/FrostsparkBullet.cs b/Projectiles/Ranged/FrostsparkBullet.cs index 706f0d460e..7a67f2f9d6 100644 --- a/Projectiles/Ranged/FrostsparkBullet.cs +++ b/Projectiles/Ranged/FrostsparkBullet.cs @@ -7,87 +7,87 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class FrostsparkBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); if (Main.rand.NextBool(2)) { - int dustType = Main.rand.Next(3); - if (dustType == 0) - { - dustType = 67; - } - else - { - dustType = 6; - } - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(mod.BuffType("GlacialState"), 120); + int dustType = Main.rand.Next(3); + if (dustType == 0) + { + dustType = 67; + } + else + { + dustType = 6; + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BoltExplosion"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - int num212 = Main.rand.Next(10, 20); - for (int num213 = 0; num213 < num212; num213++) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 67; - } - else - { - dustType = 6; - } - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + int num212 = Main.rand.Next(10, 20); + for (int num213 = 0; num213 < num212; num213++) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 67; + } + else + { + dustType = 6; + } + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } - } + } } diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index 9100de6c81..65e9ed7065 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class FungiOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,39 +25,39 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void Kill(int timeLeft) { - int num251 = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("FungiOrb2"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 1); - for (int k = 0; k < 5; k++) + int num251 = Main.rand.Next(2, 5); + if (projectile.owner == Main.myPlayer) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("FungiOrb2"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 1); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index fb3b020047..7874b15e18 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class FungiOrb2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -25,18 +25,18 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.velocity.Y += 0.1f; - projectile.velocity.X *= 0.95f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.velocity.Y += 0.1f; + projectile.velocity.X *= 0.95f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index e28a6677f1..a52f82147d 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class GoliathRocket : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rocket"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rocket"); + } public override void SetDefaults() { @@ -25,75 +25,75 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.NextBool(2)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.1f; + } + else if (Main.rand.NextBool(2)) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -105,97 +105,97 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) - { - int num516 = 2; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; - } - } - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + if (projectile.owner == Main.myPlayer) + { + int num516 = 2; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.NextBool(3)) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + num518 += projectile.oldVelocity.X / 6f; + num519 += projectile.oldVelocity.Y / 6f; + int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].penetrate = 2; + Main.projectile[num520].Calamity().forceRanged = true; + } + } + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 300); + target.AddBuff(mod.BuffType("Plague"), 300); } } } diff --git a/Projectiles/Ranged/GreenExoArrow.cs b/Projectiles/Ranged/GreenExoArrow.cs index 6c38777f5b..deb159e8c3 100644 --- a/Projectiles/Ranged/GreenExoArrow.cs +++ b/Projectiles/Ranged/GreenExoArrow.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class GreenExoArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -28,82 +28,82 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 40f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override Color? GetAlpha(Color lightColor) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - return new Color(0, 250, 0, projectile.alpha); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 250, 0, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 40f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 3c22f290ed..8b957ef050 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -1,18 +1,15 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class HalleysComet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Halley's Comet"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Halley's Comet"); + } public override void SetDefaults() { @@ -28,73 +25,73 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - if (projectile.timeLeft > 600) - { - projectile.timeLeft = 600; - } - if (projectile.ai[0] > 5f) - { - float num296 = 1f; - if (projectile.ai[0] == 6f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 7f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 8f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 176; - if (Main.rand.Next(1) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 1, default, 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + if (projectile.timeLeft > 600) + { + projectile.timeLeft = 600; + } + if (projectile.ai[0] > 5f) + { + float num296 = 1f; + if (projectile.ai[0] == 6f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 7f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 8f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 176; + if (Main.rand.Next(1) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 1, default, 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Nightwither"), 300); - } + { + target.AddBuff(mod.BuffType("Nightwither"), 300); + } } } diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index ade37d2bd9..f67e33d8df 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class HiveBomb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } public override void SetDefaults() { @@ -25,75 +25,75 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.NextBool(2)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.1f; + } + else if (Main.rand.NextBool(2)) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -105,97 +105,97 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) - { - int num516 = 6; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; - } - } - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + if (projectile.owner == Main.myPlayer) + { + int num516 = 6; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.NextBool(3)) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + num518 += projectile.oldVelocity.X / 6f; + num519 += projectile.oldVelocity.Y / 6f; + int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].penetrate = 2; + Main.projectile[num520].Calamity().forceRanged = true; + } + } + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 900); + target.AddBuff(mod.BuffType("Plague"), 900); } } } diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 58295e0e46..d902a41ca0 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class HiveMissile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } public override void SetDefaults() { @@ -26,75 +26,75 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.5f; - } - else if (Main.rand.NextBool(2)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.5f; + } + else if (Main.rand.NextBool(2)) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -106,92 +106,92 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 80); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) - { - int num516 = 3; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; - } - } - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 80); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + if (projectile.owner == Main.myPlayer) + { + int num516 = 3; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.NextBool(3)) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + num518 += projectile.oldVelocity.X / 6f; + num519 += projectile.oldVelocity.Y / 6f; + int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].penetrate = 2; + Main.projectile[num520].Calamity().forceRanged = true; + } + } + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } } } diff --git a/Projectiles/Ranged/HolyFireBullet.cs b/Projectiles/Ranged/HolyFireBullet.cs index 728b061049..4e1d35c23f 100644 --- a/Projectiles/Ranged/HolyFireBullet.cs +++ b/Projectiles/Ranged/HolyFireBullet.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class HolyFireBullet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -28,59 +28,59 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(10)) { - float num93 = projectile.velocity.X / 3f; - float num94 = projectile.velocity.Y / 3f; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 244, 0f, 0f, 100, default, 2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; - } - if (Main.rand.NextBool(20)) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 244, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } + float num93 = projectile.velocity.X / 3f; + float num94 = projectile.velocity.Y / 3f; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 244, 0f, 0f, 100, default, 2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X -= num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y -= num94; + } + if (Main.rand.NextBool(20)) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 244, 0f, 0f, 100, default, 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((double)projectile.damage * 0.85), projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRanged = true; - } + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), (int)((double)projectile.damage * 0.85), projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceRanged = true; + } for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 300); + target.AddBuff(mod.BuffType("HolyLight"), 300); } } } diff --git a/Projectiles/Ranged/HyperiusBullet.cs b/Projectiles/Ranged/HyperiusBullet.cs index b36d9ddea1..e812c24519 100644 --- a/Projectiles/Ranged/HyperiusBullet.cs +++ b/Projectiles/Ranged/HyperiusBullet.cs @@ -1,79 +1,79 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class HyperiusBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class HyperiusBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - int dustType = Main.rand.Next(3); - if (dustType == 0) - { - dustType = 235; - } - else if (dustType == 1) - { - dustType = 61; - } - else - { - dustType = 88; - } - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + int dustType = Main.rand.Next(3); + if (dustType == 0) + { + dustType = 235; + } + else if (dustType == 1) + { + dustType = 61; + } + else + { + dustType = 88; + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir= (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float xPos = (Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; if (speedX > 15f) { speedX = 15f; @@ -91,9 +91,9 @@ namespace CalamityMod.Projectiles.Ranged speedY = -15f; } if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("OMGWTH"), (int)((double)projectile.damage * 0.8), 1f, projectile.owner); - } - } - } + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("OMGWTH"), (int)((double)projectile.damage * 0.8), 1f, projectile.owner); + } + } + } } diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index f60e041ed0..3157b1ed82 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,88 +8,88 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class LeafArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + } - public override void AI() - { - projectile.alpha -= 2; - projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; - projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 3.14f; - if (projectile.localAI[1] <= 30f) - { - projectile.localAI[1] += 1f; - projectile.velocity.Y *= 0.975f; - projectile.velocity.X *= 0.975f; - } - else if (projectile.localAI[1] <= 60f) - { - projectile.localAI[1] += 1f; - projectile.velocity.Y *= 1.025f; - projectile.velocity.X *= 1.025f; - } - else - { - projectile.localAI[1] = 0f; - } - } + public override void AI() + { + projectile.alpha -= 2; + projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; + projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 3.14f; + if (projectile.localAI[1] <= 30f) + { + projectile.localAI[1] += 1f; + projectile.velocity.Y *= 0.975f; + projectile.velocity.X *= 0.975f; + } + else if (projectile.localAI[1] <= 60f) + { + projectile.localAI[1] += 1f; + projectile.velocity.Y *= 1.025f; + projectile.velocity.X *= 1.025f; + } + else + { + projectile.localAI[1] = 0f; + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(6, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - projectile.localAI[1] += 1f; - for (int num407 = 0; num407 < 5; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 3f; - Main.dust[num408].scale = 1.5f; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(6, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + projectile.localAI[1] += 1f; + for (int num407 = 0; num407 < 5; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 3f; + Main.dust[num408].scale = 1.5f; + } + } + } } diff --git a/Projectiles/Ranged/LunarBolt.cs b/Projectiles/Ranged/LunarBolt.cs index de42e0b8a7..fc7cad5332 100644 --- a/Projectiles/Ranged/LunarBolt.cs +++ b/Projectiles/Ranged/LunarBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class LunarBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -28,35 +28,35 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.alpha < 170) - { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 15, 0f, 0f, 0, default, 0.4f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } + if (projectile.alpha < 170) + { + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 15, 0f, 0f, 0, default, 0.4f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - return false; + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + return false; } } } diff --git a/Projectiles/Ranged/LunarBolt2.cs b/Projectiles/Ranged/LunarBolt2.cs index 5b646e5df2..604c42dc8d 100644 --- a/Projectiles/Ranged/LunarBolt2.cs +++ b/Projectiles/Ranged/LunarBolt2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class LunarBolt2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -28,35 +28,35 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.alpha < 170) - { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 107, 0f, 0f, 0, default, 0.2f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } + if (projectile.alpha < 170) + { + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 107, 0f, 0f, 0, default, 0.2f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - return false; + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + return false; } } } diff --git a/Projectiles/Ranged/MagnaStrike.cs b/Projectiles/Ranged/MagnaStrike.cs index 1674ab70e7..6fa6b3f077 100644 --- a/Projectiles/Ranged/MagnaStrike.cs +++ b/Projectiles/Ranged/MagnaStrike.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class MagnaStrike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Strike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Strike"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,26 +25,26 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 300; projectile.ranged = true; - } + } public override void AI() { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - projectile.alpha -= 2; - if (projectile.alpha == 0) - { - projectile.alpha = 200; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + projectile.alpha -= 2; + if (projectile.alpha == 0) + { + projectile.alpha = 200; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index d7cb5b87bb..3bd473a9c1 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -5,11 +5,11 @@ namespace CalamityMod.Projectiles.Ranged { public class MechanicalBarracuda : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Barracuda"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Barracuda"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } } diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index f9a1586c11..36c605c65e 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class MeowFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -26,87 +26,87 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 56; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 56; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 57); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - target.AddBuff(BuffID.Frostburn, 180); + target.immune[projectile.owner] = 8; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 57); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + target.AddBuff(BuffID.Frostburn, 180); } } } diff --git a/Projectiles/Ranged/MeowFire2.cs b/Projectiles/Ranged/MeowFire2.cs index 2375e35bcb..19ca13e98c 100644 --- a/Projectiles/Ranged/MeowFire2.cs +++ b/Projectiles/Ranged/MeowFire2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class MeowFire2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -26,87 +26,87 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 73; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 73; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 58); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - target.AddBuff(BuffID.OnFire, 180); + target.immune[projectile.owner] = 8; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 58); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + target.AddBuff(BuffID.OnFire, 180); } } } diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index 7cef0bfbb5..a127a45e6e 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class MiniRocket : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rocket"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rocket"); + } public override void SetDefaults() { @@ -24,144 +24,144 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 16); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 16); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } } } diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 97ff510f2e..b536a6b7ff 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class MistArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -26,30 +26,30 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(mod.BuffType("GlacialState"), 120); } } } diff --git a/Projectiles/Ranged/MortarRound.cs b/Projectiles/Ranged/MortarRound.cs index 33e13d9184..66566bff11 100644 --- a/Projectiles/Ranged/MortarRound.cs +++ b/Projectiles/Ranged/MortarRound.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.GameContent.Achievements; using Terraria.ID; @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Ranged { public class MortarRound : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mortar"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mortar"); + } public override void SetDefaults() { @@ -27,43 +27,43 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -75,158 +75,158 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - if (projectile.owner == Main.myPlayer) - { - int num814 = 5; - int num815 = (int)(projectile.position.X / 16f - (float)num814); - int num816 = (int)(projectile.position.X / 16f + (float)num814); - int num817 = (int)(projectile.position.Y / 16f - (float)num814); - int num818 = (int)(projectile.position.Y / 16f + (float)num814); - if (num815 < 0) - { - num815 = 0; - } - if (num816 > Main.maxTilesX) - { - num816 = Main.maxTilesX; - } - if (num817 < 0) - { - num817 = 0; - } - if (num818 > Main.maxTilesY) - { - num818 = Main.maxTilesY; - } - bool flag3 = false; - for (int num819 = num815; num819 <= num816; num819++) - { - for (int num820 = num817; num820 <= num818; num820++) - { - float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); - float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); - double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); - if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) - { - flag3 = true; - break; - } - } - } - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); - float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) - { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) - { - WorldGen.KillTile(num824, num825, false, false, false); - if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); - } - } - for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) - { - for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) - { - if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) - { - WorldGen.KillWall(num829, num830, false); - if (Main.tile[num829, num830].wall == 0 && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); - } - } - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); - } - if (!projectile.noDropItem) - { - int num831 = -1; - if (Main.netMode == NetmodeID.MultiplayerClient && num831 >= 0) - { - NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); - } - } - } - projectile.active = false; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + if (projectile.owner == Main.myPlayer) + { + int num814 = 5; + int num815 = (int)(projectile.position.X / 16f - (float)num814); + int num816 = (int)(projectile.position.X / 16f + (float)num814); + int num817 = (int)(projectile.position.Y / 16f - (float)num814); + int num818 = (int)(projectile.position.Y / 16f + (float)num814); + if (num815 < 0) + { + num815 = 0; + } + if (num816 > Main.maxTilesX) + { + num816 = Main.maxTilesX; + } + if (num817 < 0) + { + num817 = 0; + } + if (num818 > Main.maxTilesY) + { + num818 = Main.maxTilesY; + } + bool flag3 = false; + for (int num819 = num815; num819 <= num816; num819++) + { + for (int num820 = num817; num820 <= num818; num820++) + { + float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); + float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); + double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); + if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) + { + flag3 = true; + break; + } + } + } + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); + float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + if (num828 < (double)num814) + { + if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) + { + WorldGen.KillTile(num824, num825, false, false, false); + if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); + } + } + for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) + { + for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) + { + if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) + { + WorldGen.KillWall(num829, num830, false); + if (Main.tile[num829, num830].wall == 0 && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); + } + } + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + if (Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + } + if (!projectile.noDropItem) + { + int num831 = -1; + if (Main.netMode == NetmodeID.MultiplayerClient && num831 >= 0) + { + NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); + } + } + } + projectile.active = false; } } } diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index b3588eaf09..976e560828 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -1,140 +1,140 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class Nanomachine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void AI() + public class Nanomachine : ModProjectile + { + public override void SetStaticDefaults() { - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 800f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Confused, 180); + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void AI() + { + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 800f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Confused, 180); + } + } } diff --git a/Projectiles/Ranged/NapalmArrow.cs b/Projectiles/Ranged/NapalmArrow.cs index 40addcbdc4..70da930967 100644 --- a/Projectiles/Ranged/NapalmArrow.cs +++ b/Projectiles/Ranged/NapalmArrow.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class NapalmArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -26,88 +26,88 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 3; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, Main.rand.Next(400, 403), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 3; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, Main.rand.Next(400, 403), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } } } } diff --git a/Projectiles/Ranged/NebulaShot.cs b/Projectiles/Ranged/NebulaShot.cs index 571bd12afb..ca86009f17 100644 --- a/Projectiles/Ranged/NebulaShot.cs +++ b/Projectiles/Ranged/NebulaShot.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class NebulaShot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } public override void SetDefaults() { @@ -23,48 +23,48 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.extraUpdates = 5; projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } public override void AI() { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } - // Force damage type based on AI variable (this is outdated code and the weapons themselves should set the force variables) - if (projectile.ai[0] == 1f) - projectile.Calamity().forceMelee = true; - else if (projectile.ai[0] == 2f) - projectile.Calamity().forceRogue = true; + // Force damage type based on AI variable (this is outdated code and the weapons themselves should set the force variables) + if (projectile.ai[0] == 1f) + projectile.Calamity().forceMelee = true; + else if (projectile.ai[0] == 2f) + projectile.Calamity().forceRogue = true; - if (projectile.alpha > 0) - { - projectile.alpha -= 15; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(3) ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(3) ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } } diff --git a/Projectiles/Ranged/Needler.cs b/Projectiles/Ranged/Needler.cs index 3b204dec8d..6256f69516 100644 --- a/Projectiles/Ranged/Needler.cs +++ b/Projectiles/Ranged/Needler.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Needler : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Needle"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Needle"); + } public override void SetDefaults() { @@ -28,52 +28,52 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 1; + target.immune[projectile.owner] = 1; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Ranged/Norfleet.cs b/Projectiles/Ranged/Norfleet.cs index 510539aa1b..a0cad5de86 100644 --- a/Projectiles/Ranged/Norfleet.cs +++ b/Projectiles/Ranged/Norfleet.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,21 +7,21 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class Norfleet : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Norfleet"); } public override void SetDefaults() - { - projectile.width = 140; - projectile.height = 42; + { + projectile.width = 140; + projectile.height = 42; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + projectile.ranged = true; + projectile.ignoreWater = true; } public override void AI() @@ -37,7 +37,9 @@ namespace CalamityMod.Projectiles.Ranged case 180: case 270: case 360: - case 450: projectile.localAI[0] += 1f; break; + case 450: + projectile.localAI[0] += 1f; + break; case 540: projectile.localAI[0] += 1f; projectile.ai[0] = -1f; @@ -79,29 +81,29 @@ namespace CalamityMod.Projectiles.Ranged float scaleFactor = 30f; int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); float knockBack = player.inventory[player.selectedItem].knockBack; - for (int i = 0; i < 5; i++) - { - player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); - knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); - Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.velocity = Main.screenPosition - playerPosition; - projectile.velocity.X += Main.mouseX; - projectile.velocity.Y += Main.mouseY; - if (player.gravDir == -1f) - projectile.velocity.Y = (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerPosition.Y; - projectile.velocity.Normalize(); - float variation = (1f + projectile.localAI[0]) * 3f; - Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); - type = mod.ProjectileType("NorfleetComet"); - speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; - speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; - speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - projectile.netUpdate = true; - } + for (int i = 0; i < 5; i++) + { + player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); + Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); + projectile.velocity = Main.screenPosition - playerPosition; + projectile.velocity.X += Main.mouseX; + projectile.velocity.Y += Main.mouseY; + if (player.gravDir == -1f) + projectile.velocity.Y = (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerPosition.Y; + projectile.velocity.Normalize(); + float variation = (1f + projectile.localAI[0]) * 3f; + Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); + Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); + type = mod.ProjectileType("NorfleetComet"); + speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; + speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; + speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + projectile.netUpdate = true; + } } else { @@ -122,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); } - public override bool CanDamage() + public override bool CanDamage() { return false; } diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index ebbbfaf5e6..32df6b8b50 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -7,125 +7,125 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class NorfleetComet : ModProjectile - { - private int noTileHitCounter = 120; + { + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; - } + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ignoreWater = true; + } - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 18f) - { - projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.5f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - } - } + public override void AI() + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 18f) + { + projectile.localAI[0] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.5f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 100, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 100, 255, projectile.alpha); + } - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("NorfleetExplosion"), (int)((double)projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 10); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 144); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 4; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 50, default, 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("NorfleetExplosion"), (int)((double)projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 10); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 144); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 4; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 50, default, 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 50, default, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index 8bbbe4d85d..726c345008 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class NorfleetExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -23,68 +23,68 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 30; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-120, 121); - float num464 = (float)Main.rand.Next(-120, 121); - float num465 = (float)Main.rand.Next(36, 108); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 100, default, 2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-120, 121); + float num464 = (float)Main.rand.Next(-120, 121); + float num465 = (float)Main.rand.Next(36, 108); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.NextBool(2) ? 221 : 244), 0f, 0f, 100, default, 2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index b29a69d715..2e5ab2ba67 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Ranged { public class Nuke : ModProjectile { - public int flarePowderTimer = 12; + public int flarePowderTimer = 12; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nuke"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuke"); + } public override void SetDefaults() { @@ -26,152 +26,152 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - flarePowderTimer--; - if (flarePowderTimer <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("DragonDust"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - flarePowderTimer = 12; - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 1000; - projectile.height = 1000; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 30f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 4; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + flarePowderTimer--; + if (flarePowderTimer <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("DragonDust"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + flarePowderTimer = 12; + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 1000; + projectile.height = 1000; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 30f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 4; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 192); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 10; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 192); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 10; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } } } diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index 398d8c0bcc..60fc241eb2 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class NullShot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Null"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Null"); + } public override void SetDefaults() { @@ -43,46 +43,46 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) - { - return; - } - int nullBuff = Main.rand.Next(7); - if (!target.boss) - { - if (nullBuff == 0) - { - target.scale *= 2f; - } - else if (nullBuff == 1) - { - target.scale *= 0.5f; - } - else if (nullBuff == 2) - { - target.damage += 100; - } - else if (nullBuff == 3) - { - target.damage -= 100; - } - else if (nullBuff == 4) - { - target.knockBackResist = 0f; - } - else if (nullBuff == 5) - { - target.knockBackResist = 1f; - } - else if (nullBuff == 6) - { - target.defense += 10; - } - else - { - target.defense -= 10; - } - } + if (target.type == NPCID.TargetDummy) + { + return; + } + int nullBuff = Main.rand.Next(7); + if (!target.boss) + { + if (nullBuff == 0) + { + target.scale *= 2f; + } + else if (nullBuff == 1) + { + target.scale *= 0.5f; + } + else if (nullBuff == 2) + { + target.damage += 100; + } + else if (nullBuff == 3) + { + target.damage -= 100; + } + else if (nullBuff == 4) + { + target.knockBackResist = 0f; + } + else if (nullBuff == 5) + { + target.knockBackResist = 1f; + } + else if (nullBuff == 6) + { + target.defense += 10; + } + else + { + target.defense -= 10; + } + } } } } diff --git a/Projectiles/Ranged/NullShot2.cs b/Projectiles/Ranged/NullShot2.cs index bb248ac080..d86145ff81 100644 --- a/Projectiles/Ranged/NullShot2.cs +++ b/Projectiles/Ranged/NullShot2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class NullShot2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Null"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Null"); + } public override void SetDefaults() { @@ -44,45 +44,45 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) - { - return; - } - int nullBuff = Main.rand.Next(10); - if (!target.boss) - { - if (nullBuff == 0) - { - target.scale *= 5f; - } - else if (nullBuff == 1) - { - target.scale *= 0.1f; - } - else if (nullBuff == 2) - { - target.damage += 500; - } - else if (nullBuff == 3) - { - target.damage -= 500; - } - else if (nullBuff == 4) - { - target.knockBackResist = 0f; - } - else if (nullBuff == 5) - { - target.knockBackResist = 1f; - } - else if (nullBuff == 6) - { - target.defense += 20; - } - else if (nullBuff == 7) - { - target.defense -= 20; - } + if (target.type == NPCID.TargetDummy) + { + return; + } + int nullBuff = Main.rand.Next(10); + if (!target.boss) + { + if (nullBuff == 0) + { + target.scale *= 5f; + } + else if (nullBuff == 1) + { + target.scale *= 0.1f; + } + else if (nullBuff == 2) + { + target.damage += 500; + } + else if (nullBuff == 3) + { + target.damage -= 500; + } + else if (nullBuff == 4) + { + target.knockBackResist = 0f; + } + else if (nullBuff == 5) + { + target.knockBackResist = 1f; + } + else if (nullBuff == 6) + { + target.defense += 20; + } + else if (nullBuff == 7) + { + target.defense -= 20; + } else if (nullBuff == 8) { target.velocity.Y = -30f; diff --git a/Projectiles/Ranged/OMGWTH.cs b/Projectiles/Ranged/OMGWTH.cs index eef30b5186..5dba7e187f 100644 --- a/Projectiles/Ranged/OMGWTH.cs +++ b/Projectiles/Ranged/OMGWTH.cs @@ -7,63 +7,63 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class OMGWTH : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("WTH"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("WTH"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 360; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 360; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); if (Main.rand.NextBool(2)) { - int dustType = Main.rand.Next(3); - if (dustType == 0) - { - dustType = 235; - } - else if (dustType == 1) - { - dustType = 61; - } - else - { - dustType = 88; - } - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + int dustType = Main.rand.Next(3); + if (dustType == 0) + { + dustType = 235; + } + else if (dustType == 1) + { + dustType = 61; + } + else + { + dustType = 88; + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + } } diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index e1abe72830..a2198338dc 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,86 +8,86 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class OnyxSharkBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shark"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shark"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 109, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 159, 0f, 0f, 100, default, 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 109, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 159, 0f, 0f, 100, default, 0.25f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 109, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 2; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 109, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index c45bfd7234..5da3c15b4d 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class OpalStrike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Strike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Strike"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,26 +25,26 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 300; projectile.ranged = true; - } + } public override void AI() { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - projectile.alpha -= 2; - if (projectile.alpha == 0) - { - projectile.alpha = 200; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + projectile.alpha -= 2; + if (projectile.alpha == 0) + { + projectile.alpha = 200; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/OrangeExoArrow.cs b/Projectiles/Ranged/OrangeExoArrow.cs index 07cfe04e3e..b447b2bfe2 100644 --- a/Projectiles/Ranged/OrangeExoArrow.cs +++ b/Projectiles/Ranged/OrangeExoArrow.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class OrangeExoArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -28,96 +28,96 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 40f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 100, 0, projectile.alpha); + return new Color(250, 100, 0, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 40f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 188); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14, 1f, 0f); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 188); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14, 1f, 0f); for (int num193 = 0; num193 < 4; num193++) { Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f); @@ -126,13 +126,13 @@ namespace CalamityMod.Projectiles.Ranged { int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 0, default, 1.5f); Main.dust[num195].noGravity = true; - Main.dust[num195].noLight = true; - Main.dust[num195].velocity *= 3f; + Main.dust[num195].noLight = true; + Main.dust[num195].velocity *= 3f; num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; - Main.dust[num195].noLight = true; - } + Main.dust[num195].noLight = true; + } } } } diff --git a/Projectiles/Ranged/Phangasm.cs b/Projectiles/Ranged/Phangasm.cs index afbcfa4c0c..2ef3d55571 100644 --- a/Projectiles/Ranged/Phangasm.cs +++ b/Projectiles/Ranged/Phangasm.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Phangasm : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phangasm"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phangasm"); + } public override void SetDefaults() { @@ -26,107 +26,107 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.7f, 0.5f); - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.ai[0] += 1f; - int num39 = 0; - if (projectile.ai[0] >= 90f) - { - num39++; - } - if (projectile.ai[0] >= 180f) - { - num39++; - } - if (projectile.ai[0] >= 270f) - { - num39++; - } - int num40 = 24; - int num41 = 2; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); - } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.soundDelay <= 0 && flag16) - { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item5, projectile.position); - } - projectile.localAI[0] = 12f; - } - player.phantasmTime = 2; - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - for (int num43 = 0; num43 < 10; num43++) - { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Lighting.AddLight(projectile.Center, 0f, 0.7f, 0.5f); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.ai[0] += 1f; + int num39 = 0; + if (projectile.ai[0] >= 90f) + { + num39++; + } + if (projectile.ai[0] >= 180f) + { + num39++; + } + if (projectile.ai[0] >= 270f) + { + num39++; + } + int num40 = 24; + int num41 = 2; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + } + bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.soundDelay <= 0 && flag16) + { + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item5, projectile.position); + } + projectile.localAI[0] = 12f; + } + player.phantasmTime = 2; + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = 14; + float scaleFactor11 = 14f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + for (int num43 = 0; num43 < 10; num43++) + { + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + Main.projectile[num44].noDropItem = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); } } } diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index 1bd64640d8..7814df574b 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class PlagueArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -21,45 +21,45 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 10; projectile.friendly = true; projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; + projectile.arrow = true; + projectile.penetrate = 1; projectile.aiStyle = 1; projectile.timeLeft = 600; aiType = 1; - } + } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num516 = 6; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].Calamity().forceRanged = true; - Main.projectile[num520].penetrate = 2; - } - } - } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int num516 = 6; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.NextBool(3)) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + num518 += projectile.oldVelocity.X / 6f; + num519 += projectile.oldVelocity.Y / 6f; + int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].Calamity().forceRanged = true; + Main.projectile[num520].penetrate = 2; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index 70b9f90211..f77b14fc99 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class PlagueExplosionFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -19,75 +19,75 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; + projectile.ranged = true; + projectile.penetrate = -1; projectile.timeLeft = 60; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 0.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 0.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); } } } diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 290357e83f..f6a8d53c32 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class PlasmaBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -27,19 +27,19 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.ignoreWater = true; aiType = 503; - } + } public override void AI() - { - if (projectile.Center.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } + { + if (projectile.Center.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } projectile.localAI[0] += 1f; if (projectile.localAI[0] == 12f) { @@ -58,60 +58,60 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index c333d143d9..7c1de660f8 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class PlasmaExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -23,75 +23,75 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.timeLeft = 5; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-40, 41); - float num464 = (float)Main.rand.Next(-40, 41); - float num465 = (float)Main.rand.Next(12, 36); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-40, 41); + float num464 = (float)Main.rand.Next(-40, 41); + float num465 = (float)Main.rand.Next(12, 36); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (projectile.ai[1] == 1f ? 173 : 221), 0f, 0f, 100, default, 2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - return; + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + return; } } } diff --git a/Projectiles/Ranged/ProBolt.cs b/Projectiles/Ranged/ProBolt.cs index 705699b6fe..f009d6e956 100644 --- a/Projectiles/Ranged/ProBolt.cs +++ b/Projectiles/Ranged/ProBolt.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ProBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -24,17 +24,17 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 1.25f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 1.25f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -63,13 +63,13 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); //206 160 226 + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); //206 160 226 } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + } + } } diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index dda8c64045..df4fde5c7f 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class RainbowBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -25,57 +25,57 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 200f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 200f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } } diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 5534fe0306..ac635d4edc 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -6,25 +6,25 @@ namespace CalamityMod.Projectiles.Ranged { public class RealmRavagerBullet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosive Bullet"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Bullet"); + } public override void SetDefaults() { projectile.width = 4; projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.ranged = true; - projectile.friendly = true; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.ranged = true; + projectile.friendly = true; projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 90; - } + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 90; + } public override void Kill(int timeLeft) { @@ -46,11 +46,11 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); } } } diff --git a/Projectiles/Ranged/RubberMortarRound.cs b/Projectiles/Ranged/RubberMortarRound.cs index 26ace01aaf..3be500c069 100644 --- a/Projectiles/Ranged/RubberMortarRound.cs +++ b/Projectiles/Ranged/RubberMortarRound.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.GameContent.Achievements; using Terraria.ID; @@ -10,10 +10,10 @@ namespace CalamityMod.Projectiles.Ranged { public class RubberMortarRound : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } public override void SetDefaults() { @@ -27,43 +27,43 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -75,157 +75,157 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - if (projectile.owner == Main.myPlayer) - { - int num814 = 5; - int num815 = (int)(projectile.position.X / 16f - (float)num814); - int num816 = (int)(projectile.position.X / 16f + (float)num814); - int num817 = (int)(projectile.position.Y / 16f - (float)num814); - int num818 = (int)(projectile.position.Y / 16f + (float)num814); - if (num815 < 0) - { - num815 = 0; - } - if (num816 > Main.maxTilesX) - { - num816 = Main.maxTilesX; - } - if (num817 < 0) - { - num817 = 0; - } - if (num818 > Main.maxTilesY) - { - num818 = Main.maxTilesY; - } - bool flag3 = false; - for (int num819 = num815; num819 <= num816; num819++) - { - for (int num820 = num817; num820 <= num818; num820++) - { - float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); - float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); - double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); - if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) - { - flag3 = true; - break; - } - } - } - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); - float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) - { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) - { - WorldGen.KillTile(num824, num825, false, false, false); - if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); - } - } - for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) - { - for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) - { - if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) - { - WorldGen.KillWall(num829, num830, false); - if (Main.tile[num829, num830].wall == 0 && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); - } - } - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); - } - if (!projectile.noDropItem) - { - int num831 = -1; - if (Main.netMode == NetmodeID.MultiplayerClient && num831 >= 0) - { - NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); - } - } - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + if (projectile.owner == Main.myPlayer) + { + int num814 = 5; + int num815 = (int)(projectile.position.X / 16f - (float)num814); + int num816 = (int)(projectile.position.X / 16f + (float)num814); + int num817 = (int)(projectile.position.Y / 16f - (float)num814); + int num818 = (int)(projectile.position.Y / 16f + (float)num814); + if (num815 < 0) + { + num815 = 0; + } + if (num816 > Main.maxTilesX) + { + num816 = Main.maxTilesX; + } + if (num817 < 0) + { + num817 = 0; + } + if (num818 > Main.maxTilesY) + { + num818 = Main.maxTilesY; + } + bool flag3 = false; + for (int num819 = num815; num819 <= num816; num819++) + { + for (int num820 = num817; num820 <= num818; num820++) + { + float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); + float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); + double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); + if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) + { + flag3 = true; + break; + } + } + } + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); + float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + if (num828 < (double)num814) + { + if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) + { + WorldGen.KillTile(num824, num825, false, false, false); + if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); + } + } + for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) + { + for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) + { + if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) + { + WorldGen.KillWall(num829, num830, false); + if (Main.tile[num829, num830].wall == 0 && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); + } + } + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + if (Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + } + if (!projectile.noDropItem) + { + int num831 = -1; + if (Main.netMode == NetmodeID.MultiplayerClient && num831 >= 0) + { + NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); + } + } + } projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -250,157 +250,157 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } - if (projectile.owner == Main.myPlayer) - { - int num814 = 5; - int num815 = (int)(projectile.position.X / 16f - (float)num814); - int num816 = (int)(projectile.position.X / 16f + (float)num814); - int num817 = (int)(projectile.position.Y / 16f - (float)num814); - int num818 = (int)(projectile.position.Y / 16f + (float)num814); - if (num815 < 0) - { - num815 = 0; - } - if (num816 > Main.maxTilesX) - { - num816 = Main.maxTilesX; - } - if (num817 < 0) - { - num817 = 0; - } - if (num818 > Main.maxTilesY) - { - num818 = Main.maxTilesY; - } - bool flag3 = false; - for (int num819 = num815; num819 <= num816; num819++) - { - for (int num820 = num817; num820 <= num818; num820++) - { - float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); - float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); - double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); - if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) - { - flag3 = true; - break; - } - } - } - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); - float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) - { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active()) - { - WorldGen.KillTile(num824, num825, false, false, false); - if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); - } - } - for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) - { - for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) - { - if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && flag3) - { - WorldGen.KillWall(num829, num830, false); - if (Main.tile[num829, num830].wall == 0 && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); - } - } - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); - } - if (!projectile.noDropItem) - { - int num831 = -1; - if (Main.netMode == NetmodeID.MultiplayerClient && num831 >= 0) - { - NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); - } - } - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + if (projectile.owner == Main.myPlayer) + { + int num814 = 5; + int num815 = (int)(projectile.position.X / 16f - (float)num814); + int num816 = (int)(projectile.position.X / 16f + (float)num814); + int num817 = (int)(projectile.position.Y / 16f - (float)num814); + int num818 = (int)(projectile.position.Y / 16f + (float)num814); + if (num815 < 0) + { + num815 = 0; + } + if (num816 > Main.maxTilesX) + { + num816 = Main.maxTilesX; + } + if (num817 < 0) + { + num817 = 0; + } + if (num818 > Main.maxTilesY) + { + num818 = Main.maxTilesY; + } + bool flag3 = false; + for (int num819 = num815; num819 <= num816; num819++) + { + for (int num820 = num817; num820 <= num818; num820++) + { + float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); + float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); + double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); + if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) + { + flag3 = true; + break; + } + } + } + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); + float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + if (num828 < (double)num814) + { + if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active()) + { + WorldGen.KillTile(num824, num825, false, false, false); + if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); + } + } + for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) + { + for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) + { + if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && flag3) + { + WorldGen.KillWall(num829, num830, false); + if (Main.tile[num829, num830].wall == 0 && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); + } + } + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + if (Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + } + if (!projectile.noDropItem) + { + int num831 = -1; + if (Main.netMode == NetmodeID.MultiplayerClient && num831 >= 0) + { + NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); + } + } + } } } } diff --git a/Projectiles/Ranged/SandWater.cs b/Projectiles/Ranged/SandWater.cs index b3627f0591..e60826e91a 100644 --- a/Projectiles/Ranged/SandWater.cs +++ b/Projectiles/Ranged/SandWater.cs @@ -1,63 +1,63 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class SandWater : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 60; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - for (int num457 = 0; num457 < 10; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.9f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); + for (int num457 = 0; num457 < 10; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.9f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - for (int dust = 0; dust <= 40; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + for (int dust = 0; dust <= 40; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + } + } + } } diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index a134764c93..1bb34278b9 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Ranged { public class SandstormBullet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandstorm"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandstorm"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.aiStyle = 1; projectile.alpha = 255; - } + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -80,10 +80,10 @@ namespace CalamityMod.Projectiles.Ranged } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index 95638b7d21..0fd48d109d 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Ranged { public class SandyWaifuShark : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shark"); - Main.projFrames[projectile.type] = 8; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shark"); + Main.projFrames[projectile.type] = 8; + } public override void SetDefaults() { @@ -28,66 +28,66 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.05f; - } - } - int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 32, 0f, 0f, 0, default, 0.5f); - Main.dust[num192].noGravity = true; - Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.05f; + } + } + int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 32, 0f, 0f, 0, default, 0.5f); + Main.dust[num192].noGravity = true; + Main.dust[num192].velocity *= 0.2f; + Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index 6587329353..90762cd8c2 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class SeaDragonRocket : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("RPG"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("RPG"); + } public override void SetDefaults() { @@ -24,123 +24,123 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 192); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 110); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 25; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 192); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 110); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 25; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } int num251 = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index 8c833d571b..51308892d1 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ShadeFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -25,64 +25,64 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - if (projectile.timeLeft > 80) - { - projectile.timeLeft = 80; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 14; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 3; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (projectile.timeLeft > 80) + { + projectile.timeLeft = 80; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 14; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 3; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } } } diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index a5053793f3..7fa7ce4c3b 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Shockblast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -19,70 +19,70 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; + projectile.ranged = true; + projectile.penetrate = -1; projectile.timeLeft = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.025f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default, 1f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.025f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default, 1f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index 6c5bb10936..bf303a6d8d 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -1,109 +1,109 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class ShockblastRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 0.5f; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, 0f, projectile.owner, 0f, 0f); - return true; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - projectile.damage = (int)((double)projectile.damage * 0.995); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.995)); - } - } - - public override bool PreAI() + public class ShockblastRound : ModProjectile + { + public override void SetStaticDefaults() { - for (int num136 = 0; num136 < 5; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.1f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("TransfusionTrail"), 0, 0f, projectile.owner, (float)num2, num); + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 0.5f; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, 0f, projectile.owner, 0f, 0f); + return true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + projectile.damage = (int)((double)projectile.damage * 0.995); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.995)); + } + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 5; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.1f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("TransfusionTrail"), 0, 0f, projectile.owner, (float)num2, num); + } + } } diff --git a/Projectiles/Ranged/Shroom.cs b/Projectiles/Ranged/Shroom.cs index c098b6e740..930aa25e80 100644 --- a/Projectiles/Ranged/Shroom.cs +++ b/Projectiles/Ranged/Shroom.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Ranged { public class Shroom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shroom"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shroom"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,56 +26,56 @@ namespace CalamityMod.Projectiles.Ranged projectile.tileCollide = false; projectile.timeLeft = 120; projectile.ranged = true; - } + } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.6f); - projectile.rotation += 1f; + Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.6f); + projectile.rotation += 1f; float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[projectile.owner] = 5; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index e49753ab63..d61bece7ff 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Sickness : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sickness"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sickness"); + } public override void SetDefaults() { @@ -19,75 +19,75 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; + projectile.ranged = true; + projectile.penetrate = -1; projectile.timeLeft = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 0.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 0.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); } } } diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index ead5222f12..b9e5b27b78 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -1,90 +1,90 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class SicknessRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 0.25f; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() + public class SicknessRound : ModProjectile + { + public override void SetStaticDefaults() { - for (int num136 = 0; num136 < 7; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 360); - target.AddBuff(BuffID.Venom, 360); - target.AddBuff(mod.BuffType("Plague"), 360); + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - public override void Kill(int timeLeft) + public override void SetDefaults() { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("SicknessRound2"), - (int)((double)projectile.damage * 0.5), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); - } - } + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 0.25f; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 7; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 360); + target.AddBuff(BuffID.Venom, 360); + target.AddBuff(mod.BuffType("Plague"), 360); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("SicknessRound2"), + (int)((double)projectile.damage * 0.5), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); + } + } + } + } } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 975967485f..b0c8df05db 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -1,84 +1,84 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class SicknessRound2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 180; - projectile.light = 0.15f; - projectile.extraUpdates = 1; - aiType = ProjectileID.WoodenArrowFriendly; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() + public class SicknessRound2 : ModProjectile + { + public override void SetStaticDefaults() { - for (int num136 = 0; num136 < 5; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 180); - target.AddBuff(BuffID.Venom, 180); - target.AddBuff(mod.BuffType("Plague"), 180); + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - public override void Kill(int timeLeft) + public override void SetDefaults() { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 180; + projectile.light = 0.15f; + projectile.extraUpdates = 1; + aiType = ProjectileID.WoodenArrowFriendly; } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 5; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + target.AddBuff(BuffID.Venom, 180); + target.AddBuff(mod.BuffType("Plague"), 180); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index 9058da331b..9345ffec7e 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class SlagRound : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } public override void SetDefaults() { @@ -26,43 +26,43 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 2f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1.25f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 2f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1.25f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120); + target.AddBuff(mod.BuffType("ArmorCrunch"), 120); } public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i <= 1; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); + } } - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i <= 1; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } } } } diff --git a/Projectiles/Ranged/SlashRound.cs b/Projectiles/Ranged/SlashRound.cs index e2217a1932..021926a61d 100644 --- a/Projectiles/Ranged/SlashRound.cs +++ b/Projectiles/Ranged/SlashRound.cs @@ -4,32 +4,32 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class SlashRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 7; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 7; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Shred"), 180); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Shred"), 180); + } + } } diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index 7394ffa225..de3ce7fba3 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class SlimeBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -25,10 +25,10 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -59,13 +59,13 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 180); - } + { + target.AddBuff(BuffID.Slimed, 180); + } } } diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index 0ea1b52549..63511276e0 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class SparkSpreaderFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -23,81 +21,81 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 3; projectile.extraUpdates = 1; projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 60) - { - projectile.timeLeft = 60; - } - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 35, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 80, default, 0.75f); - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 50, default, 0.75f); - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 6; - if (Main.rand.Next(1) == 0) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, default, 0.75f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 60) + { + projectile.timeLeft = 60; + } + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 35, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 80, default, 0.75f); + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 50, default, 0.75f); + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 6; + if (Main.rand.Next(1) == 0) + { + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, default, 0.75f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1,4)); + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); } } } diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index c55b6aba41..39f60afd9c 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class SporeBomb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,80 +26,80 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 300; projectile.ranged = true; projectile.light = 0.2f; - } + } public override void AI() { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - projectile.velocity.X = projectile.velocity.X * 0.98f; - } - else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.3f; - projectile.velocity.X = projectile.velocity.X * 1.02f; - } - else if (projectile.ai[0] >= 60f) - { - projectile.ai[0] = 0f; - } + projectile.alpha -= 2; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.3f; + projectile.velocity.X = projectile.velocity.X * 0.98f; + } + else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.3f; + projectile.velocity.X = projectile.velocity.X * 1.02f; + } + else if (projectile.ai[0] >= 60f) + { + projectile.ai[0] = 0f; + } } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + return new Color(Main.DiscoR, 203, 103, projectile.alpha); } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num407 = 0; num407 < 25; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; - } - int num251 = Main.rand.Next(3, 7); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, 569 + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } + for (int num407 = 0; num407 < 25; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 1.5f; + Main.dust[num408].scale = 1.5f; + } + int num251 = Main.rand.Next(3, 7); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, 569 + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Ranged/Spyker.cs b/Projectiles/Ranged/Spyker.cs index c19653aa4c..e3caa4041f 100644 --- a/Projectiles/Ranged/Spyker.cs +++ b/Projectiles/Ranged/Spyker.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class Spyker : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spyker"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spyker"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -28,77 +28,77 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 2; projectile.aiStyle = 93; aiType = 514; - } + } public override void AI() { - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - target.immune[projectile.owner] = 1; + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 1; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num251 = Main.rand.Next(3, 6); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("Needler"), (int)((double)projectile.damage * 0.65), 0f, projectile.owner, 0f, 0f); - } - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num251 = Main.rand.Next(3, 6); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("Needler"), (int)((double)projectile.damage * 0.65), 0f, projectile.owner, 0f, 0f); + } + } for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Ranged/StarfleetMK2.cs b/Projectiles/Ranged/StarfleetMK2.cs index 701e01e6ae..2c74de50cc 100644 --- a/Projectiles/Ranged/StarfleetMK2.cs +++ b/Projectiles/Ranged/StarfleetMK2.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,21 +7,21 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class StarfleetMK2 : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Starmada"); } public override void SetDefaults() - { - projectile.width = 122; - projectile.height = 50; + { + projectile.width = 122; + projectile.height = 50; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + projectile.ranged = true; + projectile.ignoreWater = true; } public override void AI() @@ -38,7 +38,9 @@ namespace CalamityMod.Projectiles.Ranged case 180: case 270: case 360: - case 450: projectile.localAI[0] += 1f; break; + case 450: + projectile.localAI[0] += 1f; + break; case 540: projectile.localAI[0] += 1f; projectile.ai[0] = -1f; @@ -96,17 +98,26 @@ namespace CalamityMod.Projectiles.Ranged Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); switch (Main.rand.Next(5)) { - case 0: type = mod.ProjectileType("PlasmaBlast"); break; - case 1: type = mod.ProjectileType("AstralStar"); break; - case 2: type = mod.ProjectileType("GalacticaComet"); break; - case 3: break; - case 4: type = 9; break; + case 0: + type = mod.ProjectileType("PlasmaBlast"); + break; + case 1: + type = mod.ProjectileType("AstralStar"); + break; + case 2: + type = mod.ProjectileType("GalacticaComet"); + break; + case 3: + break; + case 4: + type = 9; + break; } - int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - Main.projectile[star].penetrate = 1; - Main.projectile[star].timeLeft = 300; - Main.projectile[star].Calamity().forceRanged = true; - Main.projectile[star].netUpdate = true; + int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + Main.projectile[star].penetrate = 1; + Main.projectile[star].timeLeft = 300; + Main.projectile[star].Calamity().forceRanged = true; + Main.projectile[star].netUpdate = true; projectile.netUpdate = true; } } @@ -129,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); } - public override bool CanDamage() + public override bool CanDamage() { return false; } diff --git a/Projectiles/Ranged/StormSurge.cs b/Projectiles/Ranged/StormSurge.cs index b6c8f50f34..08455685f7 100644 --- a/Projectiles/Ranged/StormSurge.cs +++ b/Projectiles/Ranged/StormSurge.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Ranged { public class StormSurge : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Surge"); - Main.projFrames[projectile.type] = 6; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Surge"); + Main.projFrames[projectile.type] = 6; + } public override void SetDefaults() { @@ -28,35 +28,35 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 1.25f, 1.25f); - if (projectile.scale <= 2f) - { - projectile.scale *= 1.03f; - } - if (projectile.scale >= 2f) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0f, 1.25f, 1.25f); + if (projectile.scale <= 2f) + { + projectile.scale *= 1.03f; + } + if (projectile.scale >= 2f) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } } } diff --git a/Projectiles/Ranged/SulphuricAcidCannon2.cs b/Projectiles/Ranged/SulphuricAcidCannon2.cs index 875b8f5c5f..fca33f48c8 100644 --- a/Projectiles/Ranged/SulphuricAcidCannon2.cs +++ b/Projectiles/Ranged/SulphuricAcidCannon2.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Ranged public float counter2 = 0f; public int killCounter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Bubble"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bubble"); Main.projFrames[projectile.type] = 7; } @@ -43,20 +43,20 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.owner == Main.myPlayer) { - if (counter >= 120f) - { - counter = 0f; - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SulphuricAcidMist2"), (int)(250f * Main.player[projectile.owner].rangedDamage), 1f, projectile.owner, 0f, 0f); - } - else - counter += 1f; + if (counter >= 120f) + { + counter = 0f; + Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SulphuricAcidMist2"), (int)(250f * Main.player[projectile.owner].rangedDamage), 1f, projectile.owner, 0f, 0f); + } + else + counter += 1f; } if (projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; + projectile.ai[1] += 1f; if (projectile.ai[1] >= 6f) { int num982 = 20; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Ranged { projectile.tileCollide = false; bool flag54 = false; - projectile.localAI[0] += 1f; + projectile.localAI[0] += 1f; int num989 = (int)projectile.ai[1]; if (projectile.localAI[0] >= 360f) { @@ -243,8 +243,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.width = (projectile.height = 64); projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item54, projectile.Center); - int num3; + Main.PlaySound(SoundID.Item54, projectile.Center); + int num3; for (int num246 = 0; num246 < 25; num246 = num3 + 1) { int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1f); @@ -256,11 +256,11 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num247].alpha = projectile.alpha; num3 = num246; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - } + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + } } } diff --git a/Projectiles/Ranged/SulphuricAcidMist2.cs b/Projectiles/Ranged/SulphuricAcidMist2.cs index ee34e7ac01..6ba99f784a 100644 --- a/Projectiles/Ranged/SulphuricAcidMist2.cs +++ b/Projectiles/Ranged/SulphuricAcidMist2.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Projectiles.Ranged { public class SulphuricAcidMist2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Mist"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Mist"); Main.projFrames[projectile.type] = 10; } @@ -39,21 +39,21 @@ namespace CalamityMod.Projectiles.Ranged { projectile.frame = 0; } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } projectile.ai[0] += 1f; if (projectile.ai[0] >= 90f) { diff --git a/Projectiles/Ranged/SuperballBullet.cs b/Projectiles/Ranged/SuperballBullet.cs index 2f51c81e6d..dc39d12714 100644 --- a/Projectiles/Ranged/SuperballBullet.cs +++ b/Projectiles/Ranged/SuperballBullet.cs @@ -7,39 +7,39 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class SuperballBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 5; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { + public override void AI() + { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; if (projectile.penetrate <= 0) @@ -63,25 +63,25 @@ namespace CalamityMod.Projectiles.Ranged return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.oldVelocity.X * 0.05f, projectile.oldVelocity.Y * 0.05f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.oldVelocity.X * 0.05f, projectile.oldVelocity.Y * 0.05f); } } - } + } } diff --git a/Projectiles/Ranged/TealExoArrow.cs b/Projectiles/Ranged/TealExoArrow.cs index 39ad60411b..fa92d1443f 100644 --- a/Projectiles/Ranged/TealExoArrow.cs +++ b/Projectiles/Ranged/TealExoArrow.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TealExoArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -24,88 +24,88 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 300; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 40f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override Color? GetAlpha(Color lightColor) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - return new Color(0, 100, 100, projectile.alpha); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 100, 100, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 40f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } } } diff --git a/Projectiles/Ranged/TelluricGlare.cs b/Projectiles/Ranged/TelluricGlare.cs index 2896f1e819..f5eed39976 100644 --- a/Projectiles/Ranged/TelluricGlare.cs +++ b/Projectiles/Ranged/TelluricGlare.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TelluricGlare : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Glare"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Glare"); + } public override void SetDefaults() { @@ -23,53 +23,53 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 300; aiType = 1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); } } } diff --git a/Projectiles/Ranged/TerraArrow.cs b/Projectiles/Ranged/TerraArrow.cs index 7886165e43..ba42990c46 100644 --- a/Projectiles/Ranged/TerraArrow.cs +++ b/Projectiles/Ranged/TerraArrow.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -26,45 +26,45 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.velocity *= 1.005f; - if (projectile.velocity.X >= 20f || projectile.velocity.Y >= 20f || projectile.velocity.X <= -20f || projectile.velocity.Y <= -20f) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity *= 1.005f; + if (projectile.velocity.X >= 20f || projectile.velocity.Y >= 20f || projectile.velocity.X <= -20f || projectile.velocity.Y <= -20f) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 60); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 1.2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("TerraArrow2"), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); - } - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 60); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 1.2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("TerraArrow2"), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + } + } } } } diff --git a/Projectiles/Ranged/TerraArrow2.cs b/Projectiles/Ranged/TerraArrow2.cs index ad62dd8f70..9ff2e5664e 100644 --- a/Projectiles/Ranged/TerraArrow2.cs +++ b/Projectiles/Ranged/TerraArrow2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraArrow2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -27,62 +27,62 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.alpha -= 5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.alpha -= 5; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 30; - projectile.height = 30; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 2; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 30; + projectile.height = 30; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 2; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } } } } diff --git a/Projectiles/Ranged/TerraBallBow.cs b/Projectiles/Ranged/TerraBallBow.cs index 4418852f7b..427e1e3260 100644 --- a/Projectiles/Ranged/TerraBallBow.cs +++ b/Projectiles/Ranged/TerraBallBow.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraBallBow : ModProjectile { - private int dustType = 0; + private int dustType = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -22,124 +22,124 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = 1; projectile.tileCollide = true; projectile.timeLeft = 600; } public override void AI() { - switch ((int)projectile.ai[1]) - { - case 0: - dustType = 15; - break; - case 1: - dustType = 74; - break; - case 2: - dustType = 73; - break; - case 3: - dustType = 162; - break; - case 4: - dustType = 90; - break; - case 5: - dustType = 173; - break; - case 6: - dustType = 57; - break; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2.2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + switch ((int)projectile.ai[1]) + { + case 0: + dustType = 15; + break; + case 1: + dustType = 74; + break; + case 2: + dustType = 73; + break; + case 3: + dustType = 162; + break; + case 4: + dustType = 90; + break; + case 5: + dustType = 173; + break; + case 6: + dustType = 57; + break; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2.2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } - public override void Kill(int timeLeft) - { - int height = 40; - float num50 = 2.1f; - float num51 = 1.1f; - float num52 = 2.5f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 20; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 10; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } + public override void Kill(int timeLeft) + { + int height = 40; + float num50 = 2.1f; + float num51 = 1.1f; + float num52 = 2.5f; + Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item14, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 20; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 10; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } } diff --git a/Projectiles/Ranged/TerraBullet.cs b/Projectiles/Ranged/TerraBullet.cs index a20fa898bb..8e6d966ceb 100644 --- a/Projectiles/Ranged/TerraBullet.cs +++ b/Projectiles/Ranged/TerraBullet.cs @@ -1,89 +1,89 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class TerraBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class TerraBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; projectile.alpha = 255; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override void AI() - { + public override void AI() + { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { if (projectile.alpha > 0) { projectile.alpha -= 17; } - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("TerraBulletSplit"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 118); + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("TerraBulletSplit"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 118); + } + } } diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 44bea527d1..89edc4e1ba 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -1,48 +1,48 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class TerraBulletSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class TerraBulletSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } - public override void AI() + public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (projectile.alpha > 0) @@ -50,91 +50,91 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha -= 85; } for (int num136 = 0; num136 < 2; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 400f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - } - } + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 400f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + } + } } diff --git a/Projectiles/Ranged/TerraFireGreen.cs b/Projectiles/Ranged/TerraFireGreen.cs index 13d7c4be45..c86baf101c 100644 --- a/Projectiles/Ranged/TerraFireGreen.cs +++ b/Projectiles/Ranged/TerraFireGreen.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraFireGreen : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -26,71 +26,71 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 120) - { - projectile.timeLeft = 120; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 107; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 3; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 0.75f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 0.75f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 120) + { + projectile.timeLeft = 120; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 107; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 3; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 0.75f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 0.75f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.CursedInferno, 300); - target.AddBuff(BuffID.OnFire, 300); + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.OnFire, 300); } } } diff --git a/Projectiles/Ranged/TerraFireGreen2.cs b/Projectiles/Ranged/TerraFireGreen2.cs index e301b18399..b32697b783 100644 --- a/Projectiles/Ranged/TerraFireGreen2.cs +++ b/Projectiles/Ranged/TerraFireGreen2.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraFireGreen2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -22,73 +22,73 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 2; projectile.extraUpdates = 3; projectile.timeLeft = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 9; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0.15f, 0.45f, 0f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 66; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, 0.15f, 0.45f, 0f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 66; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(BuffID.CursedInferno, 300); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(BuffID.Frostburn, 300); - } + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(BuffID.Frostburn, 300); + } } } diff --git a/Projectiles/Ranged/TitRail.cs b/Projectiles/Ranged/TitRail.cs index 92a9f9a14f..069af40ea1 100644 --- a/Projectiles/Ranged/TitRail.cs +++ b/Projectiles/Ranged/TitRail.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TitRail : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -24,26 +24,26 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 91, 0f, 0f, 0, default, 1f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 91, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[projectile.owner] = 7; } } } diff --git a/Projectiles/Ranged/TorrentialArrow.cs b/Projectiles/Ranged/TorrentialArrow.cs index 0e894b0e89..5ce8080572 100644 --- a/Projectiles/Ranged/TorrentialArrow.cs +++ b/Projectiles/Ranged/TorrentialArrow.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TorrentialArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -23,75 +23,75 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 300; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 40f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(53, Main.DiscoG, 255, projectile.alpha); + return new Color(53, Main.DiscoG, 255, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 40f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } } } diff --git a/Projectiles/Ranged/Triploon.cs b/Projectiles/Ranged/Triploon.cs index 6971834a39..80444213a7 100644 --- a/Projectiles/Ranged/Triploon.cs +++ b/Projectiles/Ranged/Triploon.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class Triploon : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triploon"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triploon"); + } public override void SetDefaults() { @@ -25,75 +25,75 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - if (projectile.alpha == 0) - { - if (projectile.position.X + (float)(projectile.width / 2) > Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2)) - { - Main.player[projectile.owner].ChangeDir(1); - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - } - } - if (projectile.ai[0] == 0f) - { - projectile.extraUpdates = 0; - } - else - { - projectile.extraUpdates = 1; - } - Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num166 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector14.X; - float num167 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector14.Y; - float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167)); - if (projectile.ai[0] == 0f) - { - if (num168 > 700f) - { - projectile.ai[0] = 1f; - } - else if (num168 > 350f) - { - projectile.ai[0] = 1f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - if (projectile.ai[1] > 8f) - { - projectile.ai[1] = 8f; - } - if (projectile.ai[1] >= 10f) - { - projectile.ai[1] = 15f; - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - } - } - else if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f; - float num169 = 20f; - if (num168 < 50f) - { - projectile.Kill(); - } - num168 = num169 / num168; - num166 *= num168; - num167 *= num168; - projectile.velocity.X = num166; - projectile.velocity.Y = num167; - } + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + if (projectile.alpha == 0) + { + if (projectile.position.X + (float)(projectile.width / 2) > Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2)) + { + Main.player[projectile.owner].ChangeDir(1); + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + } + } + if (projectile.ai[0] == 0f) + { + projectile.extraUpdates = 0; + } + else + { + projectile.extraUpdates = 1; + } + Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num166 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector14.X; + float num167 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector14.Y; + float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167)); + if (projectile.ai[0] == 0f) + { + if (num168 > 700f) + { + projectile.ai[0] = 1f; + } + else if (num168 > 350f) + { + projectile.ai[0] = 1f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.ai[1] += 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + if (projectile.ai[1] > 8f) + { + projectile.ai[1] = 8f; + } + if (projectile.ai[1] >= 10f) + { + projectile.ai[1] = 15f; + projectile.velocity.Y = projectile.velocity.Y + 0.3f; + } + } + else if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + projectile.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f; + float num169 = 20f; + if (num168 < 50f) + { + projectile.Kill(); + } + num168 = num169 / num168; + num166 *= num168; + num167 *= num168; + projectile.velocity.X = num166; + projectile.velocity.Y = num167; + } } } } diff --git a/Projectiles/Ranged/TyphoonArrow.cs b/Projectiles/Ranged/TyphoonArrow.cs index 9329834b29..63723a1252 100644 --- a/Projectiles/Ranged/TyphoonArrow.cs +++ b/Projectiles/Ranged/TyphoonArrow.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Ranged { public class TyphoonArrow : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 14; projectile.friendly = true; projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; + projectile.arrow = true; + projectile.penetrate = 1; projectile.aiStyle = 1; projectile.timeLeft = 600; aiType = 1; @@ -25,10 +25,10 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TyphoonBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TyphoonBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 045a6427a0..afea04975b 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,11 +7,11 @@ namespace CalamityMod.Projectiles.Ranged { public class TyphoonBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - Main.projFrames[projectile.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + Main.projFrames[projectile.type] = 3; + } public override void SetDefaults() { @@ -26,94 +26,94 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) - { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + } } public override void Kill(int timeLeft) { - Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 19); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[1] < 1f) - { - int num230 = Projectile.NewProjectile(projectile.Center.X - (float)(projectile.direction * 30), projectile.Center.Y - 4f, (float)(-(float)projectile.direction) * 0.01f, 0f, mod.ProjectileType("WaterSpout"), projectile.damage, 3f, projectile.owner, 16f, 8f); - Main.projectile[num230].netUpdate = true; - } - } + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 19); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[1] < 1f) + { + int num230 = Projectile.NewProjectile(projectile.Center.X - (float)(projectile.direction * 30), projectile.Center.Y - 4f, (float)(-(float)projectile.direction) * 0.01f, 0f, mod.ProjectileType("WaterSpout"), projectile.damage, 3f, projectile.owner, 16f, 8f); + Main.projectile[num230].netUpdate = true; + } + } } } } diff --git a/Projectiles/Ranged/VanquisherArrow.cs b/Projectiles/Ranged/VanquisherArrow.cs index dd9a23eb82..060bcce0f0 100644 --- a/Projectiles/Ranged/VanquisherArrow.cs +++ b/Projectiles/Ranged/VanquisherArrow.cs @@ -1,6 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -8,12 +7,12 @@ namespace CalamityMod.Projectiles.Ranged { public class VanquisherArrow : ModProjectile { - private int projCount = 18; + private int projCount = 18; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -30,32 +29,32 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projCount--; - if (projCount <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, mod.ProjectileType("VanquisherArrow2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projCount = 18; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projCount--; + if (projCount <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, mod.ProjectileType("VanquisherArrow2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projCount = 18; + } } - /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(0f, 0f); - Color color = Color.White; - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - spriteBatch.Draw(mod.GetTexture("Projectiles/Ranged/VanquisherArrowGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - }*/ + /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(0f, 0f); + Color color = Color.White; + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + spriteBatch.Draw(mod.GetTexture("Projectiles/Ranged/VanquisherArrowGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + }*/ - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { @@ -68,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); } } } diff --git a/Projectiles/Ranged/VeriumBullet.cs b/Projectiles/Ranged/VeriumBullet.cs index fff0dbaf52..5551ffb4a5 100644 --- a/Projectiles/Ranged/VeriumBullet.cs +++ b/Projectiles/Ranged/VeriumBullet.cs @@ -1,131 +1,131 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class VeriumBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() + public class VeriumBullet : ModProjectile + { + public override void SetStaticDefaults() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; + DisplayName.SetDefault("Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 70, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 300f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - return false; - } - } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 70, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 300f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + return false; + } + } } diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index fd91cea165..ef353fbbc6 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Ranged { public class Voidragon : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -27,15 +27,15 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.ignoreWater = true; aiType = 503; - } + } public override void AI() - { - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 150 + Main.rand.Next(40); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - } + { + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 150 + Main.rand.Next(40); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + } projectile.localAI[0] += 1f; if (projectile.localAI[0] == 12f) { @@ -54,60 +54,60 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index a4abe620eb..53b18d305f 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -1,123 +1,123 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class WaterSpout : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spout"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spout"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 42; - projectile.scale = 0.6f; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 42; + projectile.scale = 0.6f; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } - public override void AI() - { - int num613 = 10; - int num614 = 15; - float num615 = 1f; - int num616 = 150; - int num617 = 42; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } + public override void AI() + { + int num613 = 10; + int num614 = 15; + float num615 = 1f; + int num616 = 150; + int num617 = 42; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.cs b/Projectiles/Rogue/AbyssalMirrorProjectile.cs index 2c0706b2ec..15ac13b962 100644 --- a/Projectiles/Rogue/AbyssalMirrorProjectile.cs +++ b/Projectiles/Rogue/AbyssalMirrorProjectile.cs @@ -1,14 +1,14 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Rogue { public class AbyssalMirrorProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lumenyl Fluid"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lumenyl Fluid"); Main.projFrames[projectile.type] = 3; } @@ -30,7 +30,8 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (projectile.timeLeft < 25) { projectile.alpha += 10; } + if (projectile.timeLeft < 25) + { projectile.alpha += 10; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/AccretionDisk.cs b/Projectiles/Rogue/AccretionDisk.cs index b4157a16d3..aabfc2ec3d 100644 --- a/Projectiles/Rogue/AccretionDisk.cs +++ b/Projectiles/Rogue/AccretionDisk.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class AccretionDisk : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -23,100 +23,100 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.localNPCHitCooldown = 6; projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 400; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - if (Main.rand.NextBool(2)) - { - for (int num468 = 0; num468 < 1; num468++) - { - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.NextBool(3)) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } + if (Main.rand.NextBool(2)) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.NextBool(3)) + { + if (projectile.owner == Main.myPlayer) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs index 6574a74365..4c87b2f761 100644 --- a/Projectiles/Rogue/AccretionDisk2.cs +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Rogue { public class AccretionDisk2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -26,8 +26,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 60; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { @@ -37,21 +37,21 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num250].noGravity = true; Main.dust[num250].velocity *= 0f; } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index 921f5796ed..91e2dac0d1 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class AdamantiteThrowingAxeProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Adamantite Throwing Axe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Adamantite Throwing Axe"); + } public override void SetDefaults() { @@ -21,22 +21,22 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 3; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("AdamantiteThrowingAxe")); - } + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("AdamantiteThrowingAxe")); + } } } } diff --git a/Projectiles/Rogue/BallisticPoisonBomb.cs b/Projectiles/Rogue/BallisticPoisonBomb.cs index 1f7a8b3dc2..99b7a269b9 100644 --- a/Projectiles/Rogue/BallisticPoisonBomb.cs +++ b/Projectiles/Rogue/BallisticPoisonBomb.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class BallisticPoisonBomb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Poison Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Poison Bomb"); + } public override void SetDefaults() { @@ -20,95 +20,94 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.timeLeft = 200; projectile.tileCollide = false; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - if (Main.rand.NextBool(6)) + if (Main.rand.NextBool(6)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && !TileID.Sets.Platforms[Main.tile[num227, num228].type] && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; + try + { + int num223 = (int)(projectile.position.X / 16f) - 1; + int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int num225 = (int)(projectile.position.Y / 16f) - 1; + int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (num223 < 0) + { + num223 = 0; + } + if (num224 > Main.maxTilesX) + { + num224 = Main.maxTilesX; + } + if (num225 < 0) + { + num225 = 0; + } + if (num226 > Main.maxTilesY) + { + num226 = Main.maxTilesY; + } + for (int num227 = num223; num227 < num224; num227++) + { + for (int num228 = num225; num228 < num226; num228++) + { + if (Main.tile[num227, num228] != null && !TileID.Sets.Platforms[Main.tile[num227, num228].type] && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + { + Vector2 vector19; + vector19.X = (float)(num227 * 16); + vector19.Y = (float)(num228 * 16); + if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } catch + { + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 128; + projectile.height = 128; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 128); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 128); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); int num251 = Main.rand.Next(3, 5); if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index ae0dc54554..91ea63c17b 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class BallisticPoisonBombSpike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } public override void SetDefaults() { @@ -24,17 +24,17 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 2; projectile.aiStyle = 93; aiType = 514; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.localAI[1] += 1f; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.localAI[1] += 1f; if (projectile.localAI[1] > 4f) { int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 0.75f); @@ -51,28 +51,28 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 2; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 2; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 2; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 2; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Rogue/BarrelShrapnel.cs b/Projectiles/Rogue/BarrelShrapnel.cs index 2840269c74..682e4c40b0 100644 --- a/Projectiles/Rogue/BarrelShrapnel.cs +++ b/Projectiles/Rogue/BarrelShrapnel.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Projectiles.Rogue { public class BarrelShrapnel : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shrapnel"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shrapnel"); Main.projFrames[projectile.type] = 3; } @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.timeLeft = 160; projectile.tileCollide = true; - projectile.Calamity().rogue = true; + projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 243b7e0962..ac789c47af 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -1,10 +1,10 @@ using CalamityMod.Items.CalamityCustomThrowingDamage; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Rogue { @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Rogue public float cooldown = 0f; public float oldVelocityX = 0f; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Barrel"); + { + DisplayName.SetDefault("Barrel"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = -1; projectile.timeLeft = 480; - projectile.Calamity().rogue = true; + projectile.Calamity().rogue = true; } //Jesus christ, why isn't this in the Entity class instead of just NPC??? //Negative check is so that it doesn't register a bounce as a collision @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(4)) { - Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3,12f))).RotatedByRandom((double)MathHelper.ToRadians(30f)); + Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(30f)); Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity, mod.ProjectileType("BarrelShrapnel"), BlastBarrel.BaseDamage, 3f, projectile.owner); } diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index b3d4f4f419..3d540b6a2d 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -8,15 +8,15 @@ namespace CalamityMod.Projectiles.Rogue { public class BloodsoakedCrashax : ModProjectile { - private int bounce = 3; //number of times it bounces - private int grind = 0; //used to know when to slow down + private int bounce = 3; //number of times it bounces + private int grind = 0; //used to know when to slow down - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodsoaked Crasher"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodsoaked Crasher"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -27,40 +27,40 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; //10 seconds and counting aiType = 48; //Throwing Knife AI - projectile.Calamity().rogue = true; + projectile.Calamity().rogue = true; projectile.usesIDStaticNPCImmunity = true; //afaik, no Calamity projectiles use this and only 1 vanilla projectile - projectile.idStaticNPCHitCooldown = 5; + projectile.idStaticNPCHitCooldown = 5; projectile.extraUpdates = 1; - } + } public override void AI() { - grind--; + grind--; if (grind <= 0) { grind = 0; } - if (grind >= 1) - { - projectile.extraUpdates = 0; //stop, you're touching an enemy - projectile.velocity.X *= 0.75f; - projectile.velocity.Y *= 0.75f; - } - else - { - projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out - projectile.velocity.Y *= 1.005f; - if (projectile.velocity.X > 16f) - { - projectile.velocity.X = 16f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - projectile.extraUpdates = 1; - } - } + if (grind >= 1) + { + projectile.extraUpdates = 0; //stop, you're touching an enemy + projectile.velocity.X *= 0.75f; + projectile.velocity.Y *= 0.75f; + } + else + { + projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out + projectile.velocity.Y *= 1.005f; + if (projectile.velocity.X > 16f) + { + projectile.velocity.X = 16f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + projectile.extraUpdates = 1; + } + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -83,30 +83,30 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - grind += 5; //THE GRIND NEVER STOPS + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + grind += 5; //THE GRIND NEVER STOPS if (grind >= 10) { grind = 10; } - Player player = Main.player[projectile.owner]; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer && grind >= 1) //stealth strike attack - { - int stealth = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Blood"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[stealth].Calamity().forceRogue = true; - } - if (!target.canGhostHeal) //canGhostHeal be like lol - { - return; - } + Player player = Main.player[projectile.owner]; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer && grind >= 1) //stealth strike attack + { + int stealth = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Blood"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[stealth].Calamity().forceRogue = true; + } + if (!target.canGhostHeal) //canGhostHeal be like lol + { + return; + } if (Main.rand.NextBool(2)) { player.statLife += 1; //Trello said 2 hp per hit. Sounds like a fat balancing problem. player.HealEffect(1); } - } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) //afterimages { diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index 4d3186e96c..4d36f2b02d 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class BlueFlamePillar : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame Pillar"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame Pillar"); + } public override void SetDefaults() { @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.alpha = 255; projectile.Calamity().rogue = true; - } + } /// /// Checks if a tile is below a designated Vector2 /// @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue } int x = (int)position.X; int y = (int)position.Y; - return Main.tile[x,y + 1].active() && Main.tileSolid[Main.tile[x, y + 1].type]; + return Main.tile[x, y + 1].active() && Main.tileSolid[Main.tile[x, y + 1].type]; } public override void AI() { diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index b4e8556a58..bea4850f20 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -1,10 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; using static System.Math; namespace CalamityMod.Projectiles.Rogue @@ -13,11 +11,11 @@ namespace CalamityMod.Projectiles.Rogue { private int Bounces = 5; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eyeball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + DisplayName.SetDefault("Eyeball"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -28,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 300; projectile.penetrate = 2; projectile.Calamity().rogue = true; - } + } public override bool OnTileCollide(Vector2 oldVelocity) { Main.PlaySound(3, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); @@ -70,9 +68,9 @@ namespace CalamityMod.Projectiles.Rogue } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index 85ff1b9623..cf2597d5c5 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -1,10 +1,9 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Projectiles.Rogue { @@ -13,11 +12,11 @@ namespace CalamityMod.Projectiles.Rogue public const float Bounciness = 1.35f; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eyeball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + DisplayName.SetDefault("Eyeball"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -27,8 +26,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = true; projectile.timeLeft = 280; projectile.penetrate = -1; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { @@ -63,9 +62,9 @@ namespace CalamityMod.Projectiles.Rogue } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Rogue/BrackishFlask.cs b/Projectiles/Rogue/BrackishFlask.cs index a6a75b04b0..03406005e0 100644 --- a/Projectiles/Rogue/BrackishFlask.cs +++ b/Projectiles/Rogue/BrackishFlask.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class BrackishFlask : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brackish Flask"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brackish Flask"); + } public override void SetDefaults() { @@ -21,46 +21,46 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 180; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int k = 0; k < 5; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); + int randomDust = Main.rand.Next(2); + if (randomDust == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X, projectile.oldVelocity.Y); + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X, projectile.oldVelocity.Y); + } + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } } } diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index 8bc5b17234..9482dd3c65 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class BrackishWater : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } public override void SetDefaults() { @@ -20,47 +20,47 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.penetrate = 1; projectile.timeLeft = 60; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.localAI[0] += 1f; - } - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.localAI[0] += 1f; + } + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } } } diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 5652f23e8e..d1b2d26253 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class BrackishWaterBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } public override void SetDefaults() { @@ -22,89 +22,89 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 60; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 0.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 0.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } } } diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 1794ff4b2c..3ba36551e5 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -1,5 +1,4 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -55,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low - if (shardspeedX < 2f && shardspeedX > -2f ) + if (shardspeedX < 2f && shardspeedX > -2f) { shardspeedX += -projectile.velocity.X; } diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index 8d7766fcd7..bc9865c261 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -1,5 +1,4 @@ -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -37,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void Kill(int timeLeft) { - Main.PlaySound(0, (int) projectile.position.X, (int) projectile.position.Y); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) diff --git a/Projectiles/Rogue/Brimblade.cs b/Projectiles/Rogue/Brimblade.cs index 6b2cadab9d..97554efe5a 100644 --- a/Projectiles/Rogue/Brimblade.cs +++ b/Projectiles/Rogue/Brimblade.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class Brimblade : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimblade"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimblade"); + } public override void SetDefaults() { @@ -20,25 +20,25 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - int numProj = 2; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + int numProj = 2; float rotation = MathHelper.ToRadians(20); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, mod.ProjectileType("Brimblade2"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, mod.ProjectileType("Brimblade2"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } } for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/Brimblade2.cs b/Projectiles/Rogue/Brimblade2.cs index 058b961525..ffcb6c0a86 100644 --- a/Projectiles/Rogue/Brimblade2.cs +++ b/Projectiles/Rogue/Brimblade2.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Rogue { public class Brimblade2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimblade"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimblade"); + } public override void SetDefaults() { @@ -19,15 +19,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 0426123a64..207de21529 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -8,107 +8,107 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class ButcherKnife : ModProjectile - { - private static float RotationIncrement = 0.22f; + { + private static float RotationIncrement = 0.22f; private static float ReboundTime = 26f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Butcher Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Butcher Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; + projectile.localNPCHitCooldown = 60; projectile.tileCollide = true; - } + } - public override void AI() - { - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + public override void AI() + { + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } drawOffsetX = -11; drawOriginOffsetY = -10; drawOriginOffsetX = 0; // ai[0] stores whether the knife is returning. If 0, it isn't. If 1, it is. if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= ReboundTime) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; float returnSpeed = 16f; - float acceleration = 3.2f; + float acceleration = 3.2f; Player owner = Main.player[projectile.owner]; // Delete the knife if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - projectile.Kill(); + float xDist = playerCenter.X - projectile.Center.X; + float yDist = playerCenter.Y - projectile.Center.Y; + float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (dist > 3000f) + projectile.Kill(); - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; - } + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + projectile.velocity.Y = projectile.velocity.Y - acceleration; + if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); - } + if (Main.myPlayer == projectile.owner) + if (projectile.Hitbox.Intersects(owner.Hitbox)) + projectile.Kill(); + } // Rotate the knife as it flies. - projectile.rotation += RotationIncrement; - return; - } + projectile.rotation += RotationIncrement; + return; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -124,16 +124,16 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + player.AddBuff(BuffID.WellFed, 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index 5b5d73ddfa..082f5156b7 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,48 +7,48 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class CarvingFork : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Carving Fork"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Carving Fork"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } + projectile.localNPCHitCooldown = 30; + } - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + player.AddBuff(BuffID.WellFed, 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index 87a80fed50..feca158b05 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.CalamityCustomThrowingDamage; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/Celestus.cs b/Projectiles/Rogue/Celestus.cs index a325951b02..39c5cd0dd5 100644 --- a/Projectiles/Rogue/Celestus.cs +++ b/Projectiles/Rogue/Celestus.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class Celestus : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestus"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestus"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,105 +26,105 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.5f) / 255f, (Main.DiscoG * 0.5f) / 255f, (Main.DiscoB * 0.5f) / 255f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 40f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - float num42 = 25f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 4000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 1f; + Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.5f) / 255f, (Main.DiscoG * 0.5f) / 255f, (Main.DiscoB * 0.5f) / 255f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 40f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + float num42 = 25f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 4000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 1f; } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 250, 250, 50); + return new Color(250, 250, 250, 50); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - if (projectile.owner == Main.myPlayer) - { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + if (projectile.owner == Main.myPlayer) + { float spread = 45f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; @@ -137,13 +137,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), mod.ProjectileType("Celestus2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index 90928142f3..8a524c02af 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Rogue { public class Celestus2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestus"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestus"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,15 +26,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 40; projectile.timeLeft = 85; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { projectile.rotation += 2f; projectile.velocity.X *= 1.02f; projectile.velocity.Y *= 1.02f; - Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.5f) / 255f, (Main.DiscoG * 0.5f) / 255f, (Main.DiscoB * 0.5f) / 255f); + Lighting.AddLight(projectile.Center, (Main.DiscoR * 0.5f) / 255f, (Main.DiscoG * 0.5f) / 255f, (Main.DiscoB * 0.5f) / 255f); } public override Color? GetAlpha(Color lightColor) @@ -50,21 +50,21 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 2e9c2b4f7e..892076ff51 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -1,9 +1,9 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index 8b5612166f..de8406c306 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class CobaltKunaiProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kunai"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kunai"); + } public override void SetDefaults() { @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -46,19 +46,19 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("CobaltKunai")); - } + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("CobaltKunai")); + } } } } diff --git a/Projectiles/Rogue/ConsecratedWaterProjectile.cs b/Projectiles/Rogue/ConsecratedWaterProjectile.cs index 49fdc152f6..f8a938ea53 100644 --- a/Projectiles/Rogue/ConsecratedWaterProjectile.cs +++ b/Projectiles/Rogue/ConsecratedWaterProjectile.cs @@ -1,18 +1,17 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.CalamityCustomThrowingDamage; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using CalamityMod.Items.CalamityCustomThrowingDamage; using Terraria.ModLoader; -using CalamityMod.Projectiles; namespace CalamityMod.Projectiles.Rogue { public class ConsecratedWaterProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Consecrated Water"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Consecrated Water"); + } public override void SetDefaults() { @@ -23,8 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 200; projectile.tileCollide = true; projectile.alpha = 0; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { projectile.ai[0] += 1f; //arbitrary timer @@ -40,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107,projectile.Bottom); + Main.PlaySound(SoundID.Item107, projectile.Bottom); //normal if (projectile.ai[1] == 0f) { @@ -52,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue //3 pillars instead of 1 for (float i = -1f; i <= 1f; i += 1f) { - Projectile.NewProjectile(projectile.Bottom + i * Main.rand.NextFloat(56f,108f) * Vector2.UnitX, Vector2.Zero, mod.ProjectileType("BlueFlamePillar"), ConsecratedWater.BaseDamage, 2f, projectile.owner); + Projectile.NewProjectile(projectile.Bottom + i * Main.rand.NextFloat(56f, 108f) * Vector2.UnitX, Vector2.Zero, mod.ProjectileType("BlueFlamePillar"), ConsecratedWater.BaseDamage, 2f, projectile.owner); } } } diff --git a/Projectiles/Rogue/CosmicKunai.cs b/Projectiles/Rogue/CosmicKunai.cs index 09c0ccf4aa..f4d36204cf 100644 --- a/Projectiles/Rogue/CosmicKunai.cs +++ b/Projectiles/Rogue/CosmicKunai.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class CosmicKunai : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kunai"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kunai"); + } public override void SetDefaults() { @@ -19,51 +19,51 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.tileCollide = false; projectile.penetrate = 1; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha += 17; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 28f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.alpha += 17; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 28f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } } } diff --git a/Projectiles/Rogue/CraniumSmasher.cs b/Projectiles/Rogue/CraniumSmasher.cs index 6f20aa7028..8ac32d4fec 100644 --- a/Projectiles/Rogue/CraniumSmasher.cs +++ b/Projectiles/Rogue/CraniumSmasher.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class CraniumSmasher : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cranium Smasher"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cranium Smasher"); + } public override void SetDefaults() { @@ -24,34 +24,34 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override void AI() + public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 3f) - { - projectile.tileCollide = true; - } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.velocity.Y = projectile.velocity.Y + 0.085f; - projectile.velocity.X = projectile.velocity.X * 0.99f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 3f) + { + projectile.tileCollide = true; + } + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.velocity.Y = projectile.velocity.Y + 0.085f; + projectile.velocity.X = projectile.velocity.X * 0.99f; } public override void Kill(int timeLeft) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, (projectile.oldVelocity.X / 2), (projectile.oldVelocity.Y / 2), 0, default, 2f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, (projectile.oldVelocity.X / 2), (projectile.oldVelocity.Y / 2), 0, default, 1f); - } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, (projectile.oldVelocity.X / 2), (projectile.oldVelocity.Y / 2), 0, default, 2f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, (projectile.oldVelocity.X / 2), (projectile.oldVelocity.Y / 2), 0, default, 1f); + } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } } } diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 9ad14eabe9..a9809d4975 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -5,84 +5,84 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class CraniumSmasherExplosive : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosive Cranium Smasher"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Cranium Smasher"); + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.localNPCHitCooldown = 15; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.localNPCHitCooldown = 15; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) - { - projectile.tileCollide = true; - } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.velocity.Y = projectile.velocity.Y + 0.085f; - projectile.velocity.X = projectile.velocity.X * 0.99f; - } + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 5f) + { + projectile.tileCollide = true; + } + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.velocity.Y = projectile.velocity.Y + 0.085f; + projectile.velocity.X = projectile.velocity.X * 0.99f; + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 192); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - } - for (int num194 = 0; num194 < 25; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 0f; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 192); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + } + for (int num194 = 0; num194 < 25; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 0f; + } + } + } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 5c56a7f114..d49afce798 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class Crushax : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crushax"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crushax"); + } public override void SetDefaults() { @@ -22,45 +22,45 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 300; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } - public override void AI() - { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 350f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 350f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -93,8 +93,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); } } } diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 1976cb1ff1..6c0612ee18 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,60 +8,60 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class CrystalPiercerProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Piercer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Piercer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("CrystalPiercer")); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("CrystalPiercer")); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } } diff --git a/Projectiles/Rogue/Crystalline.cs b/Projectiles/Rogue/Crystalline.cs index 00602a8e26..699af454a9 100644 --- a/Projectiles/Rogue/Crystalline.cs +++ b/Projectiles/Rogue/Crystalline.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class Crystalline : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystalline"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystalline"); + } public override void SetDefaults() { @@ -22,30 +22,30 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 120; aiType = 598; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 30f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Crystalline2"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 30f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(50); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Crystalline2"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index e4114935bc..7cf6c9a2fc 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class Crystalline2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystalline"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystalline"); + } public override void SetDefaults() { @@ -22,16 +22,16 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 30; aiType = 598; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -43,9 +43,9 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/CursedDagger.cs b/Projectiles/Rogue/CursedDagger.cs index 7134e1f7f1..70b2018f97 100644 --- a/Projectiles/Rogue/CursedDagger.cs +++ b/Projectiles/Rogue/CursedDagger.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class CursedDagger : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cursed Dagger"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed Dagger"); + } public override void SetDefaults() { @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -47,16 +47,16 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } } } diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 519e7b04b2..0197f2e408 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.ignoreWater = true; projectile.timeLeft = 3600; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { diff --git a/Projectiles/Rogue/DuststormInABottle.cs b/Projectiles/Rogue/DuststormInABottle.cs index 7d58f6f967..2ad941bc8f 100644 --- a/Projectiles/Rogue/DuststormInABottle.cs +++ b/Projectiles/Rogue/DuststormInABottle.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class DuststormInABottle : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duststorm"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duststorm"); + } public override void SetDefaults() { @@ -20,15 +20,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 180; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change - for (int k = 0; k < 15; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change + for (int k = 0; k < 15; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X, projectile.oldVelocity.Y); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X, projectile.oldVelocity.Y); } int num220 = Main.rand.Next(20, 31); if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Rogue/EclipseMirrorBurst.cs b/Projectiles/Rogue/EclipseMirrorBurst.cs index e0577f29cb..19abcd2292 100644 --- a/Projectiles/Rogue/EclipseMirrorBurst.cs +++ b/Projectiles/Rogue/EclipseMirrorBurst.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -12,9 +11,9 @@ namespace CalamityMod.Projectiles.Rogue private int frameX = 0; private int frameY = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse Mirror Flash"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse Mirror Flash"); } public override void SetDefaults() diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index dc9bed25e4..abe0e64a8a 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -1,6 +1,6 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class EclipsesFallMain : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse's Fall"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse's Fall"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -23,45 +23,45 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; + projectile.localNPCHitCooldown = 10; + projectile.extraUpdates = 1; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - for (int n = 0; n < Main.rand.Next(4,7); n++) //4 to 6 spears - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("EclipsesSmol"), (int)((double)projectile.damage * 0.1 * Main.rand.Next(7, 10)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + for (int n = 0; n < Main.rand.Next(4, 7); n++) //4 to 6 spears + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("EclipsesSmol"), (int)((double)projectile.damage * 0.1 * Main.rand.Next(7, 10)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index 3fa11cbd47..46ac2113af 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -1,18 +1,17 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class EclipsesSmol : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse's Small"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse's Small"); + } public override void SetDefaults() { @@ -23,75 +22,75 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.ignoreWater = true; projectile.timeLeft = 300; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; - } + projectile.extraUpdates = 1; + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 60; num621++) - { - if (Main.rand.Next(10) == 0) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - } - for (int num623 = 0; num623 < 90; num623++) - { - if (Main.rand.Next(10) == 0) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - } + { + if (Main.rand.Next(10) == 0) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + } + for (int num623 = 0; num623 < 90; num623++) + { + if (Main.rand.Next(10) == 0) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -100,5 +99,5 @@ namespace CalamityMod.Projectiles.Rogue spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - } + } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 9773437aac..f6347c056b 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -1,75 +1,70 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; -using Terraria.DataStructures; -using Terraria.GameInput; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.IO; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Rogue { public class EclipsesStealth : ModProjectile - { - private int deadinside = 0; //used to know when to drop spears from the sky + { + private int deadinside = 0; //used to know when to drop spears from the sky - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse's Stealth"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse's Stealth"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - public override void SetDefaults() - { - projectile.width = 25; - projectile.height = 25; + public override void SetDefaults() + { + projectile.width = 25; + projectile.height = 25; projectile.friendly = true; - projectile.penetrate = -1; + projectile.penetrate = -1; projectile.timeLeft = 300; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 30; + projectile.Calamity().rogue = true; + } - public override void AI() - { - deadinside++; //congrats Pinkie - if (deadinside >= 5) //every 5 ticks - { - deadinside = 0; - if (Main.rand.Next(2) == 0) - { - int spearAmt = Main.rand.Next(1,4); //1 to 3 spears - for (int n = 0; n < spearAmt; n++) - { - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("EclipsesSmol"), (int)((double)projectile.damage * 0.1 * Main.rand.Next(7, 10)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); - } //very complicated and painful - } - } + public override void AI() + { + deadinside++; //congrats Pinkie + if (deadinside >= 5) //every 5 ticks + { + deadinside = 0; + if (Main.rand.Next(2) == 0) + { + int spearAmt = Main.rand.Next(1, 4); //1 to 3 spears + for (int n = 0; n < spearAmt; n++) + { + float x = projectile.position.X + (float)Main.rand.Next(-400, 400); + float y = projectile.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("EclipsesSmol"), (int)((double)projectile.damage * 0.1 * Main.rand.Next(7, 10)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); + } //very complicated and painful + } + } if (projectile.ai[0] == 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (Main.rand.Next(5) == 0) //dust - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (Main.rand.Next(5) == 0) //dust + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } } if (projectile.ai[0] == 1f) //sticking to enemies { @@ -113,11 +108,11 @@ namespace CalamityMod.Projectiles.Rogue } } - #region SpearBarrage - public void SpearBarrage(Player player) - { - } - #endregion + #region SpearBarrage + public void SpearBarrage(Player player) + { + } + #endregion public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { @@ -155,7 +150,7 @@ namespace CalamityMod.Projectiles.Rogue return; } projectile.ai[0] = 1f; - projectile.timeLeft = 900; //increase lifetime if sticking to something + projectile.timeLeft = 900; //increase lifetime if sticking to something projectile.ai[1] = (float)i; projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; projectile.netUpdate = true; @@ -203,10 +198,10 @@ namespace CalamityMod.Projectiles.Rogue return null; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/EmpyreanKnives.cs b/Projectiles/Rogue/EmpyreanKnives.cs index 08c95297bb..e5beaf6bf9 100644 --- a/Projectiles/Rogue/EmpyreanKnives.cs +++ b/Projectiles/Rogue/EmpyreanKnives.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,12 +11,12 @@ namespace CalamityMod.Projectiles.Rogue { private int bounce = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -27,70 +27,70 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 300; projectile.melee = true; projectile.extraUpdates = 1; - } + } public override void AI() { if (projectile.ai[1] == 1f) { projectile.melee = false; - projectile.Calamity().rogue = true; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 75f) - { - projectile.alpha += 10; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); + projectile.Calamity().rogue = true; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 75f) + { + projectile.alpha += 10; + projectile.damage = (int)((double)projectile.damage * 0.95); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); if (projectile.alpha >= 255) { projectile.active = false; } } - if (projectile.ai[0] < 75f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } + if (projectile.ai[0] < 75f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } else { projectile.rotation += 0.5f; } float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 250f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num473 = projectile.Center.Y; + float num474 = 250f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 15f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } if (Main.rand.NextBool(6)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); } } @@ -118,38 +118,38 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.005f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, 305, 0, 0f, projectile.owner, (float)num2, num); + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.005f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, 305, 0, 0f, projectile.owner, (float)num2, num); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 492eca0ccb..a78580c022 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class EradicatorProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -27,82 +27,82 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 180; aiType = 52; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 3; + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.NextBool(2)) - { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceRogue = true; - } - } - } - } + Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.NextBool(2)) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceRogue = true; + } + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Rogue/EradicatorProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Rogue/EradicatorProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } } diff --git a/Projectiles/Rogue/ExecutionersBlade.cs b/Projectiles/Rogue/ExecutionersBlade.cs index 81841430b8..c5a0d7fbf5 100644 --- a/Projectiles/Rogue/ExecutionersBlade.cs +++ b/Projectiles/Rogue/ExecutionersBlade.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ExecutionersBlade : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,93 +26,93 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 240; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0.65f); - if (Main.rand.NextBool(5)) + Lighting.AddLight(projectile.Center, 0.5f, 0f, 0.65f); + if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1200f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 26f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 26f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(32f, 32f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Rogue/ExecutionersBladeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(32f, 32f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Rogue/ExecutionersBladeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 128); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 74); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 128); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 74); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index dc920400c4..8ace881b33 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class FeatherKnifeProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } public override void SetDefaults() { @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -55,10 +55,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("FeatherKnife")); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("FeatherKnife")); + } } } } diff --git a/Projectiles/Rogue/FlameScytheProjectile.cs b/Projectiles/Rogue/FlameScytheProjectile.cs index 192c22189b..9f44776e4b 100644 --- a/Projectiles/Rogue/FlameScytheProjectile.cs +++ b/Projectiles/Rogue/FlameScytheProjectile.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class FlameScytheProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } public override void SetDefaults() { @@ -24,15 +24,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; projectile.alpha = 55; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.15f, 0f); - if (Main.rand.NextBool(5)) + Lighting.AddLight(projectile.Center, 0.25f, 0.15f, 0f); + if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; - } + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceRogue = true; + } } } } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index bc092c50b1..6f75996587 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,48 +7,48 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class Fork : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fork"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fork"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - target.AddBuff(BuffID.Bleeding, 300); - target.AddBuff(mod.BuffType("BurningBlood"), 300); - player.AddBuff(BuffID.WellFed, 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + target.AddBuff(BuffID.Bleeding, 300); + target.AddBuff(mod.BuffType("BurningBlood"), 300); + player.AddBuff(BuffID.WellFed, 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index 34df455317..67b67f9df1 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Rogue { public class FossilShardThrown : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shard"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shard"); + } public override void SetDefaults() { @@ -19,23 +19,23 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 1; projectile.timeLeft = 90; aiType = 1; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.rotation += projectile.velocity.Y; - projectile.velocity.Y *= 1.05f; + projectile.rotation += projectile.velocity.Y; + projectile.velocity.Y *= 1.05f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ArmorCrunch"), 60); + target.AddBuff(mod.BuffType("ArmorCrunch"), 60); } public override void Kill(int timeLeft) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 4f83988f2d..8525f49d9d 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -1,93 +1,91 @@ -using System; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class GacruxianHome : ModProjectile - { - private int sparkTrailTimer = 10; + { + private int sparkTrailTimer = 10; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 18; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 18; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override void AI() - { - sparkTrailTimer--; - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (sparkTrailTimer == 0) - { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceRogue = true; - } - sparkTrailTimer = 10; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + sparkTrailTimer--; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (sparkTrailTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceRogue = true; + } + sparkTrailTimer = 10; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Rogue/GacruxianProj.cs b/Projectiles/Rogue/GacruxianProj.cs index 857cec09f6..77a97723d1 100644 --- a/Projectiles/Rogue/GacruxianProj.cs +++ b/Projectiles/Rogue/GacruxianProj.cs @@ -1,76 +1,72 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class GacruxianProj : ModProjectile - { - private int sparkTrailTimer = 10; + { + private int sparkTrailTimer = 10; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) - { - sparkTrailTimer--; - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (sparkTrailTimer == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("GacruxianHome"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - sparkTrailTimer = 10; - } - } - else - { - sparkTrailTimer--; - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (sparkTrailTimer == 0) - { - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceRogue = true; - } - sparkTrailTimer = 10; - } - } - } + public override void AI() + { + if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + { + sparkTrailTimer--; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (sparkTrailTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("GacruxianHome"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + sparkTrailTimer = 10; + } + } + else + { + sparkTrailTimer--; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (sparkTrailTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().forceRogue = true; + } + sparkTrailTimer = 10; + } + } + } - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 858959518a..7c3892ef9f 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class GelDartProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dart"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dart"); + } public override void SetDefaults() { @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -47,24 +47,24 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("GelDart")); - } + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("GelDart")); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 120); - } + { + target.AddBuff(BuffID.Slimed, 120); + } } } diff --git a/Projectiles/Rogue/GhoulishGouger.cs b/Projectiles/Rogue/GhoulishGouger.cs index fd8cc7eb82..17e0b400a3 100644 --- a/Projectiles/Rogue/GhoulishGouger.cs +++ b/Projectiles/Rogue/GhoulishGouger.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class GhoulishGouger : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,98 +25,98 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.extraUpdates = 4; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 2; + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0.7f, 0f, 0.15f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 45f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 28f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; + Lighting.AddLight(projectile.Center, 0.7f, 0f, 0.15f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 45f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 28f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 250, 250, 50); + return new Color(250, 250, 250, 50); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index 4b3c40732b..e9709e247b 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue } // Returns after some number of frames in the air - if(projectile.timeLeft < Lifetime - ReboundTime) + if (projectile.timeLeft < Lifetime - ReboundTime) projectile.ai[0] = 1f; if (projectile.ai[0] != 0f) diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 181d201c2c..4769244fcc 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -1,86 +1,86 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class IceStarProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 280; - aiType = 48; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 280; + aiType = 48; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation += 0.5f; - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 14f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + projectile.rotation += 0.5f; + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 14f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/Rogue/IchorSpear.cs b/Projectiles/Rogue/IchorSpear.cs index 46dfd24f0d..aa3fbafa50 100644 --- a/Projectiles/Rogue/IchorSpear.cs +++ b/Projectiles/Rogue/IchorSpear.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,55 +8,55 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class IchorSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 120); + } + } } diff --git a/Projectiles/Rogue/IchorSpear2.cs b/Projectiles/Rogue/IchorSpear2.cs index 109f1dad9d..cf55bb1888 100644 --- a/Projectiles/Rogue/IchorSpear2.cs +++ b/Projectiles/Rogue/IchorSpear2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,90 +8,90 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class IchorSpear2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - projectile.extraUpdates = 2; - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + public override void AI() + { + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + projectile.extraUpdates = 2; + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 120); + } + } } diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs index 64ef2c44fe..a3cd77106e 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class InkBombProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Bomb"); + } public override void SetDefaults() { diff --git a/Projectiles/Rogue/InkCloud.cs b/Projectiles/Rogue/InkCloud.cs index 83a5e5aade..6d45837054 100644 --- a/Projectiles/Rogue/InkCloud.cs +++ b/Projectiles/Rogue/InkCloud.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class InkCloud : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Cloud"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Cloud"); + } public override void SetDefaults() { diff --git a/Projectiles/Rogue/InkCloud2.cs b/Projectiles/Rogue/InkCloud2.cs index 263b20323c..499c81cee2 100644 --- a/Projectiles/Rogue/InkCloud2.cs +++ b/Projectiles/Rogue/InkCloud2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class InkCloud2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Cloud"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Cloud"); + } public override void SetDefaults() { diff --git a/Projectiles/Rogue/InkCloud3.cs b/Projectiles/Rogue/InkCloud3.cs index 879009d812..c390c5a41e 100644 --- a/Projectiles/Rogue/InkCloud3.cs +++ b/Projectiles/Rogue/InkCloud3.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class InkCloud3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Cloud"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Cloud"); + } public override void SetDefaults() { diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index 568f0d32b5..8e4270efaf 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,46 +7,46 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class Knife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + player.AddBuff(BuffID.WellFed, 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs index 926fc27224..fec87aac64 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0]++; //Dust trail - if(Main.rand.Next(15) == 0) + if (Main.rand.Next(15) == 0) { int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 7, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 100, default, 0f); Main.dust[d].position = projectile.Center; diff --git a/Projectiles/Rogue/Lionfish.cs b/Projectiles/Rogue/Lionfish.cs index 65c11115d8..1c5a847d1d 100644 --- a/Projectiles/Rogue/Lionfish.cs +++ b/Projectiles/Rogue/Lionfish.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Rogue { public class Lionfish : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lionfish"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lionfish"); + } public override void SetDefaults() { @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.penetrate = -1; projectile.alpha = 255; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { diff --git a/Projectiles/Rogue/Malachite.cs b/Projectiles/Rogue/Malachite.cs index 048b5613f3..52034ba901 100644 --- a/Projectiles/Rogue/Malachite.cs +++ b/Projectiles/Rogue/Malachite.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Rogue { public class Malachite : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -28,64 +28,64 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 93; aiType = 514; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 1; + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.alpha -= 3; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.alpha -= 3; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index 1d0c94fb32..2c0d007311 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class MalachiteBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -27,97 +27,97 @@ namespace CalamityMod.Projectiles.Rogue projectile.alpha = 255; projectile.extraUpdates = 10; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 10; + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha -= 3; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.alpha -= 3; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.penetrate <= 1) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - for (int num621 = 0; num621 < 70; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } + if (projectile.penetrate <= 1) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + for (int num621 = 0; num621 < 70; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 16); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 3; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 16); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 3; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index ddbbe98cea..822dce4e95 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class MangroveChakramProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chakram"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chakram"); + } public override void SetDefaults() { @@ -22,15 +22,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 600; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.CursedInferno, 240); + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.CursedInferno, 240); } } } diff --git a/Projectiles/Rogue/MeteorFist.cs b/Projectiles/Rogue/MeteorFist.cs index 44971c7f71..a9791c17fd 100644 --- a/Projectiles/Rogue/MeteorFist.cs +++ b/Projectiles/Rogue/MeteorFist.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class MeteorFist : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fist"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fist"); + } public override void SetDefaults() { @@ -20,151 +20,151 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 180; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 7f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - } - } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 7f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + } + } // Almost instantly accelerate to very high speed - if (projectile.velocity.Length() <= 23f) - projectile.velocity *= 2f; + if (projectile.velocity.Length() <= 23f) + projectile.velocity *= 2f; - else if (Main.rand.NextBool(2)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 0.5f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 0.5f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } + else if (Main.rand.NextBool(2)) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 0.5f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 0.5f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 32); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 0.5f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.OnFire, 120); } } } diff --git a/Projectiles/Rogue/MoltenAmputator.cs b/Projectiles/Rogue/MoltenAmputator.cs index 11105cfe1f..069fefaa7b 100644 --- a/Projectiles/Rogue/MoltenAmputator.cs +++ b/Projectiles/Rogue/MoltenAmputator.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Rogue { public class MoltenAmputator : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amputator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amputator"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -25,37 +25,37 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - target.immune[projectile.owner] = 3; - int num251 = Main.rand.Next(1, 3); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("MoltenBlobThrown"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 3; + int num251 = Main.rand.Next(1, 3); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("MoltenBlobThrown"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index ace7351982..5bf41083af 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -6,11 +6,11 @@ namespace CalamityMod.Projectiles.Rogue { public class MoltenBlobThrown : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blob"); - Main.projFrames[projectile.type] = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blob"); + Main.projFrames[projectile.type] = 2; + } public override void SetDefaults() { @@ -19,34 +19,34 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.velocity.X *= 0.95f; - if (projectile.wet || projectile.lavaWet) - { - projectile.velocity.Y = 0f; - } - else - { + projectile.velocity.X *= 0.95f; + if (projectile.wet || projectile.lavaWet) + { + projectile.velocity.Y = 0f; + } + else + { projectile.velocity.Y = projectile.velocity.Y + 0.1f; if (projectile.velocity.Y > 5f) { projectile.velocity.Y = 5f; } } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -67,28 +67,28 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + } } } } diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index 0321a8b2ce..5c1092af5e 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue int dustsplash = 0; while (dustsplash < 4) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, projectile.velocity.X * 0.25f, projectile.velocity.Y* 0.25f, 100, default, 0.9f); + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 100, default, 0.9f); Main.dust[d].position = projectile.Center; dustsplash += 1; } @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue //Randomly not consume item if it wasnt a stealth strike if (Main.rand.Next(4) == 0 && projectile.ai[0] != 1) { - Item.NewItem((int)projectile.position.X,(int) projectile.position.Y, 27, 27, ModContent.ItemType() ); + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, 27, 27, ModContent.ItemType()); } } diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index 156cc01453..1ce73d33e9 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -1,17 +1,16 @@ -using Terraria; -using Terraria.ModLoader; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class MoonSigil : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moon Sigil"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moon Sigil"); + } public override void SetDefaults() { @@ -31,7 +30,8 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (projectile.timeLeft < 25) { projectile.alpha += 10; } + if (projectile.timeLeft < 25) + { projectile.alpha += 10; } } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/Mycoroot.cs b/Projectiles/Rogue/Mycoroot.cs index 56a335746b..be47ada3fc 100644 --- a/Projectiles/Rogue/Mycoroot.cs +++ b/Projectiles/Rogue/Mycoroot.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class Mycoroot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Root"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Root"); + } public override void SetDefaults() { @@ -19,22 +19,22 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 12; projectile.friendly = true; projectile.penetrate = 1; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.alpha += 20; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.alpha += 20; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index 97c2863317..99442d9e9d 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class MythrilKnifeProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } public override void SetDefaults() { @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -47,24 +47,24 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("MythrilKnife")); - } + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("MythrilKnife")); + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 200); + target.AddBuff(BuffID.Venom, 200); } } } diff --git a/Projectiles/Rogue/OPHammer.cs b/Projectiles/Rogue/OPHammer.cs index 48ea16ef7a..db4f6f6ebf 100644 --- a/Projectiles/Rogue/OPHammer.cs +++ b/Projectiles/Rogue/OPHammer.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,123 +8,123 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class OPHammer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + projectile.Calamity().rogue = true; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 16f; - float num43 = 3.2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 16f; + float num43 = 3.2f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FuckYou"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceRogue = true; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index 50bb26b31a..a672fcd708 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class OrichalcumSpikedGemstoneProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gemstone"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gemstone"); + } public override void SetDefaults() { @@ -21,25 +21,25 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 6; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool OnTileCollide(Vector2 oldVelocity) { - Vector2 velocity = projectile.velocity; + Vector2 velocity = projectile.velocity; if (projectile.velocity.Y != velocity.Y && (velocity.Y < -3f || velocity.Y > 3f)) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.Center.X, (int)projectile.Center.Y, 1); - } - if (projectile.velocity.X != velocity.X) - { - projectile.velocity.X = velocity.X * -0.5f; - } - if (projectile.velocity.Y != velocity.Y && velocity.Y > 1f) - { - projectile.velocity.Y = velocity.Y * -0.5f; - } + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.Center.X, (int)projectile.Center.Y, 1); + } + if (projectile.velocity.X != velocity.X) + { + projectile.velocity.X = velocity.X * -0.5f; + } + if (projectile.velocity.Y != velocity.Y && velocity.Y > 1f) + { + projectile.velocity.Y = velocity.Y * -0.5f; + } return false; } @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("OrichalcumSpikedGemstone")); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("OrichalcumSpikedGemstone")); + } } } } diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index c1ab2acddb..bfe8be4def 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -1,18 +1,17 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class PalladiumJavelinProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Javelin"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Javelin"); + } public override void SetDefaults() { @@ -23,12 +22,12 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = 598; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -40,10 +39,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("PalladiumJavelin")); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("PalladiumJavelin")); + } } } } diff --git a/Projectiles/Rogue/ProfanedTrident.cs b/Projectiles/Rogue/ProfanedTrident.cs index 794cb5f15e..43a51cd5cc 100644 --- a/Projectiles/Rogue/ProfanedTrident.cs +++ b/Projectiles/Rogue/ProfanedTrident.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +9,13 @@ namespace CalamityMod.Projectiles.Rogue { public class ProfanedTrident : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,98 +25,98 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Daybreak, 360); + target.AddBuff(BuffID.Daybreak, 360); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/Pwnagehammer.cs b/Projectiles/Rogue/Pwnagehammer.cs index cbb60ef4d9..d50b4188ef 100644 --- a/Projectiles/Rogue/Pwnagehammer.cs +++ b/Projectiles/Rogue/Pwnagehammer.cs @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Rogue { public class Pwnagehammer : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -24,19 +24,19 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 120; projectile.extraUpdates = 3; aiType = 301; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.velocity.X *= 1.06f; - projectile.velocity.Y *= 1.06f; + projectile.velocity.X *= 1.06f; + projectile.velocity.Y *= 1.06f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 28e1f6ee6c..ef023fd193 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class RotBallProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -33,10 +33,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("RotBall")); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("RotBall")); + } } } } diff --git a/Projectiles/Rogue/RoyalKnife.cs b/Projectiles/Rogue/RoyalKnife.cs index 28ebb4e5df..7b17ca80ca 100644 --- a/Projectiles/Rogue/RoyalKnife.cs +++ b/Projectiles/Rogue/RoyalKnife.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,116 +8,116 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class RoyalKnife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) - { - projectile.alpha += 4; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); - } - if (projectile.ai[0] < 240f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - if (Main.rand.NextBool(6)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 240f) + { + projectile.alpha += 4; + projectile.damage = (int)((double)projectile.damage * 0.95); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); + } + if (projectile.ai[0] < 240f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + else + { + projectile.rotation += 0.5f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 800f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 35f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + if (Main.rand.NextBool(6)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } + public override void Kill(int timeLeft) + { + for (int num303 = 0; num303 < 3; num303++) + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.015f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.015f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index 6ad8d46084..e10aebd005 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class ScarletBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -22,74 +22,74 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.timeLeft = 30; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.Calamity().rogue = true; + projectile.localNPCHitCooldown = 1; + projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 35); - float num464 = (float)Main.rand.Next(-30, 35); - float num465 = (float)Main.rand.Next(13, 18); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 130, 0f, 0f, 100, default, 1.25f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 35); + float num464 = (float)Main.rand.Next(-30, 35); + float num465 = (float)Main.rand.Next(13, 18); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 130, 0f, 0f, 100, default, 1.25f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } } } diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index bc489173c7..9267dfbc75 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,74 +7,74 @@ namespace CalamityMod.Projectiles.Rogue { public class ScarletDevilBullet : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gungnir Bullet"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gungnir Bullet"); + } public override void SetDefaults() { projectile.width = 16; projectile.height = 16; projectile.friendly = true; - projectile.timeLeft = 140; + projectile.timeLeft = 140; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.Calamity().rogue = true; + projectile.Calamity().rogue = true; } public override void AI() { projectile.ai[0] += 1f; - if (projectile.ai[0] <= 60f) - { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - } - else - { - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1000f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } - else - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - } - } + if (projectile.ai[0] <= 60f) + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + } + else + { + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 1000f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; + projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; + } + else + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + } + } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(250, 250, 250); } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 313e230e1c..6e3aa564cb 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -1,96 +1,96 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Rogue { - public class ScarletDevilProjectile : ModProjectile - { - bool lifesteal = false; + public class ScarletDevilProjectile : ModProjectile + { + bool lifesteal = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear the Gungnir"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear the Gungnir"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 116; - projectile.height = 116; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 116; + projectile.height = 116; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.extraUpdates = 1; + projectile.Calamity().rogue = true; + } - public override void AI() - { - CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); - Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 130, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.85f); - projectile.ai[0] += 1f; + public override void AI() + { + CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); + Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 130, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.85f); + projectile.ai[0] += 1f; if (projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) { projectile.Calamity().stealthStrike = true; lifesteal = true; } - if ((projectile.ai[0] %= 5f) == 0f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(15); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(-projectile.velocity.X / 3, -projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - for (int j = 0; j < 2; j++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ScarletDevilBullet"), (int)((double)projectile.damage * 0.03), 0f, projectile.owner, 0f, 0f); - perturbedSpeed *= 1.05f; - } - } - } - } - } + if ((projectile.ai[0] %= 5f) == 0f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(15); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(-projectile.velocity.X / 3, -projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + for (int j = 0; j < 2; j++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ScarletDevilBullet"), (int)((double)projectile.damage * 0.03), 0f, projectile.owner, 0f, 0f); + perturbedSpeed *= 1.05f; + } + } + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item122, projectile.position); - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item122, projectile.position); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 150); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ScarletBlast"), (int)((double)projectile.damage * 0.0075), 0f, projectile.owner, 0f, 0f); - if (target.type == NPCID.TargetDummy || !lifesteal) - { - return; - } - Main.player[Main.myPlayer].statLife += 120; - Main.player[Main.myPlayer].HealEffect(120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 150); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ScarletBlast"), (int)((double)projectile.damage * 0.0075), 0f, projectile.owner, 0f, 0f); + if (target.type == NPCID.TargetDummy || !lifesteal) + { + return; + } + Main.player[Main.myPlayer].statLife += 120; + Main.player[Main.myPlayer].HealEffect(120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(100, 100, 100), ProjectileID.Sets.TrailingMode[projectile.type], 1); - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(100, 100, 100), ProjectileID.Sets.TrailingMode[projectile.type], 1); + return true; + } + } } diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index 63bdbdcdd9..73e59b73ea 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -1,35 +1,31 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ScourgeVenomCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Venom Cloud"); - Main.projFrames[projectile.type] = 4; - } + public class ScourgeVenomCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Venom Cloud"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 45; - projectile.height = 45; - projectile.friendly = true; - projectile.penetrate = -1; + public override void SetDefaults() + { + projectile.width = 45; + projectile.height = 45; + projectile.friendly = true; + projectile.penetrate = -1; projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 30; + projectile.Calamity().rogue = true; + } public override void AI() { @@ -44,30 +40,30 @@ namespace CalamityMod.Projectiles.Rogue projectile.frame = 0; } projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/ScourgeoftheDesert.cs b/Projectiles/Rogue/ScourgeoftheDesert.cs index cce72a54e5..43f306fb27 100644 --- a/Projectiles/Rogue/ScourgeoftheDesert.cs +++ b/Projectiles/Rogue/ScourgeoftheDesert.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ScourgeoftheDesert : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -23,23 +23,23 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; aiType = 598; projectile.penetrate = 3; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.velocity.X *= 1.025f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } + projectile.velocity.X *= 1.025f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Rogue/ScourgeoftheDesert2.cs b/Projectiles/Rogue/ScourgeoftheDesert2.cs index 130194b47b..cbfb7ffb1e 100644 --- a/Projectiles/Rogue/ScourgeoftheDesert2.cs +++ b/Projectiles/Rogue/ScourgeoftheDesert2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ScourgeoftheDesert2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -21,47 +21,47 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 26; projectile.friendly = true; projectile.penetrate = 6; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 20f) - { - if (projectile.velocity.Y < 24f) - { - projectile.velocity.Y += 0.4f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 20f) + { + if (projectile.velocity.Y < 24f) + { + projectile.velocity.Y += 0.4f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index c4fbe36514..f09abf4384 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -1,7 +1,6 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ScourgeoftheSeasProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moist Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moist Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,46 +24,46 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; aiType = 598; projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 1200; - projectile.Calamity().rogue = true; - } + projectile.extraUpdates = 1; + projectile.timeLeft = 1200; + projectile.Calamity().rogue = true; + } public override void AI() { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - if (projectile.velocity.X > 16f) - { - projectile.velocity.X = 16f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.velocity.X *= 1.015f; + projectile.velocity.Y *= 1.015f; + if (projectile.velocity.X > 16f) + { + projectile.velocity.X = 16f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 600); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 600); + } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 8; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 1f; - } + for (int num621 = 0; num621 < 8; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 1f; + } if (projectile.owner == Main.myPlayer) { - int num320 = Main.rand.Next(2, 6); + int num320 = Main.rand.Next(2, 6); int num3; for (int num321 = 0; num321 < num320; num321 = num3 + 1) { @@ -75,12 +74,12 @@ namespace CalamityMod.Projectiles.Rogue num3 = num321; } } - } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs index 5032a8d03c..9047dbb5e5 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs @@ -1,7 +1,6 @@ -using System; -using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ScourgeoftheSeasStealth : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stealthy Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stealthy Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,33 +24,33 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 113; aiType = 598; projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = 1200; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; - } + projectile.extraUpdates = 1; + projectile.timeLeft = 1200; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 60; + } public override void AI() { - if (Main.rand.Next(5) == 0 && projectile.ai[0] != 1f) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (Main.rand.Next(5) == 0 && projectile.ai[0] != 1f) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; if (projectile.ai[0] != 1f) { - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - } - if (projectile.velocity.X > 16f) - { - projectile.velocity.X = 16f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + projectile.velocity.X *= 1.015f; + projectile.velocity.Y *= 1.015f; + } + if (projectile.velocity.X > 16f) + { + projectile.velocity.X = 16f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } if (projectile.ai[0] == 1f) { projectile.tileCollide = false; @@ -177,30 +176,30 @@ namespace CalamityMod.Projectiles.Rogue return null; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == mod.NPCType("Cryogen") || target.type == mod.NPCType("Brimstone Elemental") || target.type == NPCID.SkeletronPrime) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == mod.NPCType("Cryogen") || target.type == mod.NPCType("Brimstone Elemental") || target.type == NPCID.SkeletronPrime) + { target.buffImmune[BuffID.Venom] = false; - } - else if (target.buffImmune[BuffID.Venom] && !target.boss && target.aiStyle != 6 && target.type != mod.NPCType("EidolonWyrmHeadHuge")) - { + } + else if (target.buffImmune[BuffID.Venom] && !target.boss && target.aiStyle != 6 && target.type != mod.NPCType("EidolonWyrmHeadHuge")) + { target.buffImmune[BuffID.Venom] = false; - } - target.AddBuff(BuffID.Venom, 600); - } + } + target.AddBuff(BuffID.Venom, 600); + } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 8; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 1f; - } + for (int num621 = 0; num621 < 8; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 1f; + } if (projectile.owner == Main.myPlayer) { - int num320 = Main.rand.Next(2, 6); + int num320 = Main.rand.Next(2, 6); int num3; for (int num321 = 0; num321 < num320; num321 = num3 + 1) { @@ -211,12 +210,12 @@ namespace CalamityMod.Projectiles.Rogue num3 = num321; } } - } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Rogue/SeashellBoomerangProjectile.cs b/Projectiles/Rogue/SeashellBoomerangProjectile.cs index bc4d4d5050..6fd2e31db5 100644 --- a/Projectiles/Rogue/SeashellBoomerangProjectile.cs +++ b/Projectiles/Rogue/SeashellBoomerangProjectile.cs @@ -1,14 +1,13 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class SeashellBoomerangProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boomerang"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boomerang"); + } public override void SetDefaults() { @@ -19,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 3; projectile.timeLeft = 240; aiType = 52; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } } } diff --git a/Projectiles/Rogue/ShatteredExplosion.cs b/Projectiles/Rogue/ShatteredExplosion.cs index 4f147078b5..8922960211 100644 --- a/Projectiles/Rogue/ShatteredExplosion.cs +++ b/Projectiles/Rogue/ShatteredExplosion.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Rogue { public class ShatteredExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -20,28 +20,28 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 15; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.Calamity().rogue = true; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.Calamity().rogue = true; + } public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int i = 0; i < 5; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int i = 0; i < 5; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 180); + target.AddBuff(mod.BuffType("HolyLight"), 180); } } } diff --git a/Projectiles/Rogue/ShatteredSun.cs b/Projectiles/Rogue/ShatteredSun.cs index 8f16087dbe..bc07dcbf8c 100644 --- a/Projectiles/Rogue/ShatteredSun.cs +++ b/Projectiles/Rogue/ShatteredSun.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ShatteredSun : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattered Sun"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Sun"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -23,72 +23,72 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 3; projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; - } + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] < 5f) - { - projectile.alpha -= 50; - } - if (projectile.ai[1] == 5f) - { - projectile.alpha = 0; - projectile.tileCollide = false; - } - - if (projectile.ai[1] == 12f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.active = false; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void AI() { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] < 5f) + { + projectile.alpha -= 50; + } + if (projectile.ai[1] == 5f) + { + projectile.alpha = 0; + projectile.tileCollide = false; + } - public override bool OnTileCollide(Vector2 oldVelocity) + if (projectile.ai[1] == 12f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.active = false; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - return true; - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + return true; + } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); } } } diff --git a/Projectiles/Rogue/ShatteredSun2.cs b/Projectiles/Rogue/ShatteredSun2.cs index 0c4f54167d..ffc0eb66b0 100644 --- a/Projectiles/Rogue/ShatteredSun2.cs +++ b/Projectiles/Rogue/ShatteredSun2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ShatteredSun2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattered Sun"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Sun"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -23,60 +23,60 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 3; projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 8f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun3"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.active = false; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void AI() { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 8f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun3"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.active = false; + } + } + } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - return true; - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + return true; + } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); } } } diff --git a/Projectiles/Rogue/ShatteredSun3.cs b/Projectiles/Rogue/ShatteredSun3.cs index 492c035336..72ac9edb89 100644 --- a/Projectiles/Rogue/ShatteredSun3.cs +++ b/Projectiles/Rogue/ShatteredSun3.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class ShatteredSun3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattered Sun"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Sun"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -23,75 +23,75 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 750f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 15f + num484) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void AI() { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 750f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 15f + num484) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - return true; - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + return true; + } public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); } } } diff --git a/Projectiles/Rogue/SpearofPaleolith.cs b/Projectiles/Rogue/SpearofPaleolith.cs index 718eebde28..551fde0073 100644 --- a/Projectiles/Rogue/SpearofPaleolith.cs +++ b/Projectiles/Rogue/SpearofPaleolith.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,67 +8,67 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class SpearofPaleolith : ModProjectile - { - private int shardRainTimer = 3; + { + private int shardRainTimer = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - shardRainTimer--; - if (Main.rand.NextBool(4)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - if (shardRainTimer == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("FossilShardThrown"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - shardRainTimer = 3; - } - } + public override void AI() + { + shardRainTimer--; + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + if (shardRainTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("FossilShardThrown"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + shardRainTimer = 3; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120); + } + } } diff --git a/Projectiles/Rogue/Stormfrontproj.cs b/Projectiles/Rogue/Stormfrontproj.cs index da18a6e87d..078a68f459 100644 --- a/Projectiles/Rogue/Stormfrontproj.cs +++ b/Projectiles/Rogue/Stormfrontproj.cs @@ -1,9 +1,8 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -43,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] >= sparkFreq) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-14f, 14f), Main.rand.NextFloat(-14f, 14f)); - Projectile.NewProjectile(projectile.Center,sparkS,mod.ProjectileType("Stormfrontspark"),projectile.damage,3f,projectile.owner); + Projectile.NewProjectile(projectile.Center, sparkS, mod.ProjectileType("Stormfrontspark"), projectile.damage, 3f, projectile.owner); projectile.ai[0] = 0; } if (Main.rand.Next(10) == 0) diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index a0e983aa50..57c577c959 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -1,8 +1,6 @@ -using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Rogue { @@ -26,36 +24,36 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; projectile.velocity.Y += 0.15f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index 8ecd1e4e2f..3e8b1e6faa 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -1,61 +1,61 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class TarragonThrowingDartProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dart"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dart"); + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("TarragonThrowingDart")); - } - } + public override void Kill(int timeLeft) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("TarragonThrowingDart")); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 3; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 3; + } + } } diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index defcad7d6d..02513d4087 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class TitaniumShurikenProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shuriken"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shuriken"); + } public override void SetDefaults() { @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -33,10 +33,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("TitaniumShuriken")); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("TitaniumShuriken")); + } } } } diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 5fc85287ff..733729fde2 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class ToothBallProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } public override void SetDefaults() { @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -33,10 +33,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("ToothBall")); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("ToothBall")); + } } } } diff --git a/Projectiles/Rogue/TriactisOPHammer.cs b/Projectiles/Rogue/TriactisOPHammer.cs index 911eb0975d..a678cda27d 100644 --- a/Projectiles/Rogue/TriactisOPHammer.cs +++ b/Projectiles/Rogue/TriactisOPHammer.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class TriactisOPHammer : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -24,124 +24,124 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = -1; projectile.extraUpdates = 3; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 20f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 20f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 250, 250, 50); + return new Color(250, 250, 250, 50); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/UrchinStinger.cs b/Projectiles/Rogue/UrchinStinger.cs index 404c57d909..e75a6ed302 100644 --- a/Projectiles/Rogue/UrchinStinger.cs +++ b/Projectiles/Rogue/UrchinStinger.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Rogue { public class UrchinStinger : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stinger"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stinger"); + } public override void SetDefaults() { @@ -22,27 +22,27 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 360); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("UrchinStinger")); - } + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("UrchinStinger")); + } } } } diff --git a/Projectiles/Rogue/Valediction.cs b/Projectiles/Rogue/Valediction.cs index eed74aac7c..24edea3386 100644 --- a/Projectiles/Rogue/Valediction.cs +++ b/Projectiles/Rogue/Valediction.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class Valediction : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -25,26 +25,26 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 15; + projectile.Calamity().rogue = true; + } public override void AI() { - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; if (projectile.ai[1] >= 60f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } else { float num472 = projectile.Center.X; @@ -81,74 +81,74 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; } } - } - else - { - float num42 = 30f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; + } + else + { + float num42 = 30f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(mod.BuffType("CrushDepth"), 600); } diff --git a/Projectiles/Rogue/Valediction2.cs b/Projectiles/Rogue/Valediction2.cs index 66ec5dc524..727abe1a44 100644 --- a/Projectiles/Rogue/Valediction2.cs +++ b/Projectiles/Rogue/Valediction2.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Rogue { public class Valediction2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -23,29 +23,29 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.tileCollide = false; projectile.penetrate = 12; - projectile.timeLeft = 750; + projectile.timeLeft = 750; projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; - } + projectile.localNPCHitCooldown = 15; + projectile.Calamity().rogue = true; + } public override void AI() { - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.localAI[0] == 0f) - { - projectile.ai[1] += 1f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.localAI[0] == 0f) + { + projectile.ai[1] += 1f; if (projectile.ai[1] >= 60f) - { - projectile.localAI[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } + { + projectile.localAI[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } else { float num472 = projectile.Center.X; @@ -82,98 +82,98 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; } } - } - else - { - float num633 = 700f; - bool flag24 = false; - if (projectile.ai[0] == 1f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 1f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } - } - projectile.rotation += 0.5f; + } + else + { + float num633 = 700f; + bool flag24 = false; + if (projectile.ai[0] == 1f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (!flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 1f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 8f; + projectile.netUpdate = true; + } + } + } + } + projectile.rotation += 0.5f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(mod.BuffType("CrushDepth"), 600); } diff --git a/Projectiles/Rogue/WulfrumKnife.cs b/Projectiles/Rogue/WulfrumKnife.cs index c57f765f42..289b2a0ce4 100644 --- a/Projectiles/Rogue/WulfrumKnife.cs +++ b/Projectiles/Rogue/WulfrumKnife.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Rogue { public class WulfrumKnife : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } public override void SetDefaults() { @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 2; projectile.timeLeft = 600; aiType = 48; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -33,10 +33,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("WulfrumKnife")); - } + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("WulfrumKnife")); + } } } } diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.cs b/Projectiles/Rogue/XerocPitchforkProjectile.cs index d60cc5fb15..9ba598cf09 100644 --- a/Projectiles/Rogue/XerocPitchforkProjectile.cs +++ b/Projectiles/Rogue/XerocPitchforkProjectile.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,63 +8,63 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class XerocPitchforkProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pitchfork"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pitchfork"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("XerocPitchfork")); - } - } + public override void Kill(int timeLeft) + { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("XerocPitchfork")); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.damage /= 2; - if (projectile.damage < 1) - { - projectile.damage = 1; - } - target.immune[projectile.owner] = 2; - target.AddBuff(BuffID.CursedInferno, 300); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.damage /= 2; + if (projectile.damage < 1) + { + projectile.damage = 1; + } + target.immune[projectile.owner] = 2; + target.AddBuff(BuffID.CursedInferno, 300); + } + } } diff --git a/Projectiles/Shrines/GladiatorSword.cs b/Projectiles/Shrines/GladiatorSword.cs index 47dc0666f3..32408ab1b1 100644 --- a/Projectiles/Shrines/GladiatorSword.cs +++ b/Projectiles/Shrines/GladiatorSword.cs @@ -1,67 +1,67 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Shrines { public class GladiatorSword : ModProjectile - { - private double rotation = 0; + { + private double rotation = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gladiator Sword"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gladiator Sword"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 22; - projectile.height = 22; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.gladiatorSword) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.glSword = false; - } - if (modPlayer.glSword) - { - projectile.timeLeft = 2; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - 1.57f; - projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - rotation += 0.03; - if (rotation >= 360) - { - rotation = 0; - } - projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); - } - } + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.gladiatorSword) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.glSword = false; + } + if (modPlayer.glSword) + { + projectile.timeLeft = 2; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + Vector2 vector = player.Center - projectile.Center; + projectile.rotation = vector.ToRotation() - 1.57f; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + rotation += 0.03; + if (rotation >= 360) + { + rotation = 0; + } + projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); + } + } } diff --git a/Projectiles/Shrines/GladiatorSword2.cs b/Projectiles/Shrines/GladiatorSword2.cs index e4649ec1c1..b113a97a64 100644 --- a/Projectiles/Shrines/GladiatorSword2.cs +++ b/Projectiles/Shrines/GladiatorSword2.cs @@ -1,67 +1,67 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Shrines { public class GladiatorSword2 : ModProjectile - { - private double rotation = 0; + { + private double rotation = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gladiator Sword"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gladiator Sword"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 22; - projectile.height = 22; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword2"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.gladiatorSword) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.glSword = false; - } - if (modPlayer.glSword) - { - projectile.timeLeft = 2; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - 1.57f; - projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - rotation -= 0.03; - if (rotation <= 0) - { - rotation = 360; - } - projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); - } - } + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword2"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.gladiatorSword) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.glSword = false; + } + if (modPlayer.glSword) + { + projectile.timeLeft = 2; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + Vector2 vector = player.Center - projectile.Center; + projectile.rotation = vector.ToRotation() - 1.57f; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + rotation -= 0.03; + if (rotation <= 0) + { + rotation = 360; + } + projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); + } + } } diff --git a/Projectiles/Shrines/LuxorsGiftMagic.cs b/Projectiles/Shrines/LuxorsGiftMagic.cs index ee046f095e..2fdcaf36e9 100644 --- a/Projectiles/Shrines/LuxorsGiftMagic.cs +++ b/Projectiles/Shrines/LuxorsGiftMagic.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Shrines { public class LuxorsGiftMagic : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -25,33 +25,33 @@ namespace CalamityMod.Projectiles.Shrines projectile.penetrate = 2; projectile.alpha = 255; projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } projectile.localAI[1] += 1f; if (projectile.localAI[1] == 3f) { @@ -72,13 +72,13 @@ namespace CalamityMod.Projectiles.Shrines public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity *= 0.25f; + projectile.velocity *= 0.25f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Shrines/LuxorsGiftMelee.cs b/Projectiles/Shrines/LuxorsGiftMelee.cs index f156079a09..55f3889c2c 100644 --- a/Projectiles/Shrines/LuxorsGiftMelee.cs +++ b/Projectiles/Shrines/LuxorsGiftMelee.cs @@ -8,12 +8,12 @@ namespace CalamityMod.Projectiles.Shrines { public class LuxorsGiftMelee : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -22,53 +22,53 @@ namespace CalamityMod.Projectiles.Shrines projectile.friendly = true; projectile.melee = true; projectile.penetrate = 3; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 3f) - { - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 235, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 3f) + { + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 235, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { @@ -105,10 +105,10 @@ namespace CalamityMod.Projectiles.Shrines return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Shrines/LuxorsGiftRanged.cs b/Projectiles/Shrines/LuxorsGiftRanged.cs index 5c4100bb43..e319e5733f 100644 --- a/Projectiles/Shrines/LuxorsGiftRanged.cs +++ b/Projectiles/Shrines/LuxorsGiftRanged.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Shrines { public class LuxorsGiftRanged : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -23,44 +23,44 @@ namespace CalamityMod.Projectiles.Shrines projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 180; - } + projectile.alpha = 255; + projectile.timeLeft = 180; + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - - public override void AI() + public override Color? GetAlpha(Color lightColor) { - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.localAI[1] += 1f; if (projectile.localAI[1] == 3f) { @@ -81,29 +81,29 @@ namespace CalamityMod.Projectiles.Shrines public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 16); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); - int num212 = Main.rand.Next(10, 20); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 16); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); + int num212 = Main.rand.Next(10, 20); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Shrines/LuxorsGiftRogue.cs b/Projectiles/Shrines/LuxorsGiftRogue.cs index 237ed19451..3f2d980f61 100644 --- a/Projectiles/Shrines/LuxorsGiftRogue.cs +++ b/Projectiles/Shrines/LuxorsGiftRogue.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,107 +8,107 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Shrines { public class LuxorsGiftRogue : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.aiStyle = 2; - projectile.alpha = 255; - projectile.timeLeft = 300; - aiType = 48; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.aiStyle = 2; + projectile.alpha = 255; + projectile.timeLeft = 300; + aiType = 48; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 3f) - { - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 3f) + { + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Shrines/LuxorsGiftSummon.cs b/Projectiles/Shrines/LuxorsGiftSummon.cs index 1a4a243e00..1173f514ee 100644 --- a/Projectiles/Shrines/LuxorsGiftSummon.cs +++ b/Projectiles/Shrines/LuxorsGiftSummon.cs @@ -1,294 +1,294 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Shrines { public class LuxorsGiftSummon : ModProjectile - { - private int dust = 3; + { + private int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gift"); - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - if (dust > 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - dust--; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - float num633 = 700f; - float num634 = 1000f; - float num635 = 2200f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("LuxorsGiftSummon"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (flag64) - { - if (!modPlayer.luxorsGift || player.dead) - { - projectile.Kill(); - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("LuxorsGiftSummon")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && - flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() + 1.57f; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 9f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57f; - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 9f; //8 - projectile.netUpdate = true; - } - } - } - } + public override void AI() + { + if (dust > 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + dust--; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + float num633 = 700f; + float num634 = 1000f; + float num635 = 2200f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("LuxorsGiftSummon"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (flag64) + { + if (!modPlayer.luxorsGift || player.dead) + { + projectile.Kill(); + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("LuxorsGiftSummon")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && + flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + projectile.rotation = projectile.velocity.ToRotation() + 1.57f; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 9f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57f; + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 9f; //8 + projectile.netUpdate = true; + } + } + } + } - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Shrines/UnstableSpark.cs b/Projectiles/Shrines/UnstableSpark.cs index b642293b2c..315c62b782 100644 --- a/Projectiles/Shrines/UnstableSpark.cs +++ b/Projectiles/Shrines/UnstableSpark.cs @@ -5,91 +5,91 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Shrines { public class UnstableSpark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Unstable Spark"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Unstable Spark"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } } diff --git a/Projectiles/Summon/AngryChicken.cs b/Projectiles/Summon/AngryChicken.cs index 0c27caccd3..660af9a277 100644 --- a/Projectiles/Summon/AngryChicken.cs +++ b/Projectiles/Summon/AngryChicken.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class AngryChicken : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Son of Yharon"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Son of Yharon"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; projectile.extraUpdates = 1; projectile.minionSlots = 4f; projectile.timeLeft = 18000; @@ -38,255 +38,255 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 100; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 800f; - float num634 = 1200f; - float num635 = 3000f; - float num636 = 500f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1.2f * num, 0.8f * num, 0f * num); - bool flag64 = projectile.type == mod.ProjectileType("AngryChicken"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("AngryChicken"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.aChicken = false; - } - if (modPlayer.aChicken) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("AngryChicken")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 100; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 800f; + float num634 = 1200f; + float num635 = 3000f; + float num636 = 500f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 1.2f * num, 0.8f * num, 0f * num); + bool flag64 = projectile.type == mod.ProjectileType("AngryChicken"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("AngryChicken"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.aChicken = false; + } + if (modPlayer.aChicken) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("AngryChicken")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 2; + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 1; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 8f; + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + } } diff --git a/Projectiles/Summon/AquaticStar.cs b/Projectiles/Summon/AquaticStar.cs index 2b7fcce6c4..85e0c28692 100644 --- a/Projectiles/Summon/AquaticStar.cs +++ b/Projectiles/Summon/AquaticStar.cs @@ -1,21 +1,21 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class AquaticStar : ModProjectile { - public float dust = 0f; + public float dust = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Star"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Star"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -36,47 +36,47 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (dust == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.rotation += projectile.velocity.X * 0.04f; - bool flag64 = projectile.type == mod.ProjectileType("AquaticStar"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("AquaticStar"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.aStar = false; - } - if (modPlayer.aStar) - { - projectile.timeLeft = 2; - } - } - } + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.rotation += projectile.velocity.X * 0.04f; + bool flag64 = projectile.type == mod.ProjectileType("AquaticStar"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("AquaticStar"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.aStar = false; + } + if (modPlayer.aStar) + { + projectile.timeLeft = 2; + } + } + } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Summon/BigBustyRose.cs b/Projectiles/Summon/BigBustyRose.cs index a88be5a51a..f0de99aaa0 100644 --- a/Projectiles/Summon/BigBustyRose.cs +++ b/Projectiles/Summon/BigBustyRose.cs @@ -1,29 +1,29 @@ -using System; +using CalamityMod.CalPlayer; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class BigBustyRose : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Busty Rose"); - Main.projFrames[projectile.type] = 4; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Busty Rose"); + Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { projectile.width = 78; - projectile.height = 126; + projectile.height = 126; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -34,11 +34,11 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } public override void AI() @@ -65,9 +65,9 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 235, 0f, 0f, 0, default, 1f); @@ -75,14 +75,14 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.frameCounter++; + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; if (projectile.frameCounter > 20) { projectile.frame++; @@ -135,37 +135,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } if (Vector2.Distance(player.Center, projectile.Center) > 1200f) { projectile.ai[0] = 1f; @@ -234,8 +234,8 @@ namespace CalamityMod.Projectiles.Summon value19 *= scaleFactor3; int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num659].timeLeft = 200; - Main.projectile[num659].Calamity().forceMinion = true; - projectile.netUpdate = true; + Main.projectile[num659].Calamity().forceMinion = true; + projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index 2136336a50..e2a9ff7a5b 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -1,42 +1,39 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class BlackHawkBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 2; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index a71e892b73..0000980b73 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -1,10 +1,9 @@ -using System; -using System.Collections.Generic; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { @@ -16,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public const float maxDistToEnemy = 340f; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Black Hawk"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + { + DisplayName.SetDefault("Black Hawk"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; Main.projFrames[projectile.type] = 3; } @@ -64,30 +63,30 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.frameCounter++; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; if (projectile.frameCounter >= 4) { projectile.frame++; @@ -97,189 +96,189 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - float num633 = 700f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 600f; - bool flag64 = projectile.type == mod.ProjectileType("BlackHawkSummon"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("BlackHawkBuff"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.blackhawk = false; - } - if (modPlayer.blackhawk) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("BlackHawkSummon")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 18f; //12 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 9f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 12f; - if (flag26) - { - num650 = 30f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 16f) - { - num650 = 16f; - } - if (num651 < num636 && flag26) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 6f; - int num658 = mod.ProjectileType("BlackHawkBullet"); - if (flag25 && projectile.ai[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.ai[1] += 2f; - if (Main.myPlayer == projectile.owner) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int bullet = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + float num633 = 700f; + float num634 = 1300f; + float num635 = 2600f; + float num636 = 600f; + bool flag64 = projectile.type == mod.ProjectileType("BlackHawkSummon"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("BlackHawkBuff"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.blackhawk = false; + } + if (modPlayer.blackhawk) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("BlackHawkSummon")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 18f; //12 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 9f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 12f; + if (flag26) + { + num650 = 30f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 16f) + { + num650 = 16f; + } + if (num651 < num636 && flag26) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 6f; + int num658 = mod.ProjectileType("BlackHawkBullet"); + if (flag25 && projectile.ai[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.ai[1] += 2f; + if (Main.myPlayer == projectile.owner) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int bullet = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[bullet].owner = projectile.owner; //doesn't do damage otherwise for some retarded reason - projectile.netUpdate = true; - } - } - } - if (Vector2.Distance(player.Center, projectile.Center) <= 1400 & !returningBackToPlayer) //don't return to player if currently busy dealing with an enemy + projectile.netUpdate = true; + } + } + } + if (Vector2.Distance(player.Center, projectile.Center) <= 1400 & !returningBackToPlayer) //don't return to player if currently busy dealing with an enemy { if (enemyCheckTimer % 240 == 0 & enemyCheckTimer != 0) { @@ -288,9 +287,9 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() + { + return false; + } } } diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index cec1497064..d5b4f5923b 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -1,18 +1,18 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class BloodClotMinion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Clot"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; Main.projFrames[projectile.type] = 4; } @@ -30,36 +30,36 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 0, default, 1f); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 0, default, 1f); Main.dust[num1262].velocity *= 0.1f; Main.dust[num1262].scale = 0.7f; Main.dust[num1262].noGravity = true; @@ -74,20 +74,20 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } bool flag64 = projectile.type == mod.ProjectileType("BloodClotMinion"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("BloodClot"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.bClot = false; - } - if (modPlayer.bClot) - { - projectile.timeLeft = 2; - } - } + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("BloodClot"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.bClot = false; + } + if (modPlayer.bClot) + { + projectile.timeLeft = 2; + } + } int num3; for (int num534 = 0; num534 < 1000; num534 = num3 + 1) { @@ -131,20 +131,20 @@ namespace CalamityMod.Projectiles.Summon { if (player.HasMinionAttackTargetNPC) { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } - } + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } } else { diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index 8d70334852..e9087e36f1 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Summon { public class BrimstoneFireSummon : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -26,60 +26,60 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 235; - if (Main.rand.NextBool(2)) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 235; + if (Main.rand.NextBool(2)) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + if (Main.rand.NextBool(3)) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X *= 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y *= 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X *= 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y *= 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); target.immune[projectile.owner] = 9; } } diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index 4cbdced3af..57c331b792 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -1,49 +1,49 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class BrimstoneLaserSummon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 2; - projectile.aiStyle = 1; - aiType = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.alpha = 120; - projectile.timeLeft = 300; - } + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 2; + projectile.aiStyle = 1; + aiType = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.alpha = 120; + projectile.timeLeft = 300; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += projectile.ai[0]; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += projectile.ai[0]; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + } } diff --git a/Projectiles/Summon/BrittleStar.cs b/Projectiles/Summon/BrittleStar.cs index 4a8b9249f1..2cb9e25036 100644 --- a/Projectiles/Summon/BrittleStar.cs +++ b/Projectiles/Summon/BrittleStar.cs @@ -1,21 +1,21 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class BrittleStar : ModProjectile { - public float dust = 0f; + public float dust = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brittle Star"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brittle Star"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -36,47 +36,47 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (dust == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.rotation += projectile.velocity.X * 0.04f; - bool flag64 = projectile.type == mod.ProjectileType("BrittleStar"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("BrittleStar"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.bStar = false; - } - if (modPlayer.bStar) - { - projectile.timeLeft = 2; - } - } - } + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.rotation += projectile.velocity.X * 0.04f; + bool flag64 = projectile.type == mod.ProjectileType("BrittleStar"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("BrittleStar"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.bStar = false; + } + if (modPlayer.bStar) + { + projectile.timeLeft = 2; + } + } + } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Summon/Calamari.cs b/Projectiles/Summon/Calamari.cs index f4dc3a49bf..463f51a609 100644 --- a/Projectiles/Summon/Calamari.cs +++ b/Projectiles/Summon/Calamari.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Calamari : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamari"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamari"); Main.projFrames[projectile.type] = 5; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -32,16 +32,16 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 30; } public override void AI() { if (projectile.localAI[1] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; //66% = 1.66 - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; //300 * 1.66 = 498 (new value) - int num226 = 36; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; //66% = 1.66 + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; //300 * 1.66 = 498 (new value) + int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; @@ -54,14 +54,14 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[1] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / //498 - projectile.Calamity().spawnedPlayerMinionDamageValue) * //1.66 498 / 1.66 = 300 (original value) - Main.player[projectile.owner].minionDamage); //300 * 1.15 = 345 (new value) - projectile.damage = damage2; - } - projectile.frameCounter++; + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / //498 + projectile.Calamity().spawnedPlayerMinionDamageValue) * //1.66 498 / 1.66 = 300 (original value) + Main.player[projectile.owner].minionDamage); //300 * 1.15 = 345 (new value) + projectile.damage = damage2; + } + projectile.frameCounter++; if (projectile.frameCounter > 8) { projectile.frame++; @@ -163,19 +163,19 @@ namespace CalamityMod.Projectiles.Summon value.Y = 0f; if (player.HasMinionAttackTargetNPC) { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num12 = Vector2.Distance(vector2, center); - if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num10 = num12; - vector = vector2; - flag = true; - num11 = npc.whoAmI; - } - } + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 vector2 = npc.position + npc.Size * value; + float num12 = Vector2.Distance(vector2, center); + if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num10 = num12; + vector = vector2; + flag = true; + num11 = npc.whoAmI; + } + } } else { @@ -360,9 +360,9 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/CalamariInk.cs b/Projectiles/Summon/CalamariInk.cs index 908d7a761a..a67499d7e3 100644 --- a/Projectiles/Summon/CalamariInk.cs +++ b/Projectiles/Summon/CalamariInk.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,9 +8,9 @@ namespace CalamityMod.Projectiles.Summon { public class CalamariInk : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink"); Main.projFrames[projectile.type] = 5; } @@ -39,39 +39,39 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -90,11 +90,11 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 48); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 28); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 48); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 28); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 54, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 0a151558c8..73c12a0872 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Calamitamini : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitamini"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitamini"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -35,249 +35,249 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Calamitamini"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("CalamitasEyes"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cEyes = false; - } - if (modPlayer.cEyes) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Calamitamini")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //6 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 8f; - int num658 = mod.ProjectileType("BrimstoneLaserSummon"); - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - projectile.netUpdate = true; - } - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + float num633 = 700f; + float num634 = 1100f; + float num635 = 2400f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Calamitamini"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("CalamitasEyes"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cEyes = false; + } + if (modPlayer.cEyes) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Calamitamini")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (projectile.ai[0] != 1f) + { + projectile.tileCollide = false; + } + if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + { + projectile.tileCollide = false; + } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; //6 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 8f; + int num658 = mod.ProjectileType("BrimstoneLaserSummon"); + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 300; + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index f153dce789..a9e2a294d5 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Cataclymini : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclymini"); - Main.projFrames[projectile.type] = 3; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclymini"); + Main.projFrames[projectile.type] = 3; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -35,248 +35,248 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Cataclymini"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (flag64) - { - if (player.dead) - { - modPlayer.cEyes = false; - } - if (modPlayer.cEyes) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Cataclymini")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //6 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.25f; - projectile.velocity.Y = -0.15f; - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 80); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 8f; - int num658 = mod.ProjectileType("BrimstoneFireSummon"); - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 50; - projectile.netUpdate = true; - } - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + float num633 = 700f; + float num634 = 1100f; + float num635 = 2400f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Cataclymini"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (flag64) + { + if (player.dead) + { + modPlayer.cEyes = false; + } + if (modPlayer.cEyes) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Cataclymini")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (projectile.ai[0] != 1f) + { + projectile.tileCollide = false; + } + if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + { + projectile.tileCollide = false; + } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; //6 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.25f; + projectile.velocity.Y = -0.15f; + } + } + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 80); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 8f; + int num658 = mod.ProjectileType("BrimstoneFireSummon"); + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 50; + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index df3d6addcb..bf1bd887f3 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Catastromini : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastromini"); - Main.projFrames[projectile.type] = 3; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastromini"); + Main.projFrames[projectile.type] = 3; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -35,264 +35,264 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Catastromini"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (flag64) - { - if (player.dead) - { - modPlayer.cEyes = false; - } - if (modPlayer.cEyes) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Catastromini")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - projectile.frameCounter++; - if (projectile.frameCounter > 1) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + float num633 = 700f; + float num634 = 1100f; + float num635 = 2400f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Catastromini"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (flag64) + { + if (player.dead) + { + modPlayer.cEyes = false; + } + if (modPlayer.cEyes) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Catastromini")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.frameCounter++; + if (projectile.frameCounter > 1) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (projectile.ai[0] != 1f) + { + projectile.tileCollide = false; + } + if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + { + projectile.tileCollide = false; + } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 8f; + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 9; } diff --git a/Projectiles/Summon/ChaosFlame.cs b/Projectiles/Summon/ChaosFlame.cs index d50c2f1abb..21176b78bf 100644 --- a/Projectiles/Summon/ChaosFlame.cs +++ b/Projectiles/Summon/ChaosFlame.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Summon { public class ChaosFlame : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Flame"); + } public override void SetDefaults() { @@ -26,24 +26,24 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire, 180); } } } diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index 968bd57b05..a6285ab025 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -1,23 +1,23 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class ChaosSpirit : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Spirit"); - Main.projFrames[projectile.type] = 9; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Spirit"); + Main.projFrames[projectile.type] = 9; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -26,8 +26,8 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.tileCollide = false; @@ -36,145 +36,145 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("ChaosSpirit"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.chaosSpirit) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.cSpirit = false; - } - if (modPlayer.cSpirit) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 127, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 8) - { - projectile.frame = 0; - } - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - } - } - } - else - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - int projectileType = mod.ProjectileType("ChaosFlame"); - float num403 = Main.rand.Next(14, 19); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 38f; - } - } + bool flag64 = projectile.type == mod.ProjectileType("ChaosSpirit"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.chaosSpirit) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.cSpirit = false; + } + if (modPlayer.cSpirit) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 127, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 8) + { + projectile.frame = 0; + } + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } + } + } + else + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; + int projectileType = mod.ProjectileType("ChaosFlame"); + float num403 = Main.rand.Next(14, 19); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); + projectile.ai[0] = 38f; + } + } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/CloudyWaifu.cs b/Projectiles/Summon/CloudyWaifu.cs index c351b3d778..bd097bf614 100644 --- a/Projectiles/Summon/CloudyWaifu.cs +++ b/Projectiles/Summon/CloudyWaifu.cs @@ -1,29 +1,29 @@ -using System; +using CalamityMod.CalPlayer; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class CloudyWaifu : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloudy Waifu"); - Main.projFrames[projectile.type] = 8; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloudy Waifu"); + Main.projFrames[projectile.type] = 8; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { projectile.width = 58; - projectile.height = 116; + projectile.height = 116; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -34,234 +34,234 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("CloudyWaifu"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.cloudWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.cWaifu = false; - } - if (modPlayer.cWaifu) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 16, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 500f; //700 - float num634 = 800f; - float num635 = 1200f; - float num636 = 400f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.25f * num, 0.55f * num, 0.75f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("CloudyWaifu")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } + bool flag64 = projectile.type == mod.ProjectileType("CloudyWaifu"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.cloudWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.cWaifu = false; + } + if (modPlayer.cWaifu) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 16, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 500f; //700 + float num634 = 800f; + float num635 = 1200f; + float num636 = 400f; //150 + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 0.25f * num, 0.55f * num, 0.75f * num); + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("CloudyWaifu")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - projectile.frameCounter++; - if (projectile.frameCounter > 48) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 100f) //200 - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; //6 - if (flag26) - { - num650 = 15f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(500f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) //200 and 8 - { - num650 = 8f; //8 - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 2; + projectile.frameCounter++; + if (projectile.frameCounter > 48) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 100f) //200 + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; //6 + if (flag26) + { + num650 = 15f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(500f, -60f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) //200 and 8 + { + num650 = 8f; //8 + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } if (projectile.ai[1] > 0f) { projectile.ai[1] += (float)Main.rand.Next(1, 4); diff --git a/Projectiles/Summon/Corroslime.cs b/Projectiles/Summon/Corroslime.cs index ff69b934db..3acfb07110 100644 --- a/Projectiles/Summon/Corroslime.cs +++ b/Projectiles/Summon/Corroslime.cs @@ -1,23 +1,23 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Corroslime : ModProjectile { - public float dust = 0f; + public float dust = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corroslime"); - Main.projFrames[projectile.type] = 6; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corroslime"); + Main.projFrames[projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -35,57 +35,57 @@ namespace CalamityMod.Projectiles.Summon aiType = 266; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } + { + fallThrough = false; + return true; + } public override void AI() { - if (dust == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 14, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("Corroslime"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("Corroslime"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cSlime = false; - } - if (modPlayer.cSlime) - { - projectile.timeLeft = 2; - } - } - } + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 14, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("Corroslime"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("Corroslime"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cSlime = false; + } + if (modPlayer.cSlime) + { + projectile.timeLeft = 2; + } + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index d4f378a538..e3c15628f0 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,11 +9,11 @@ namespace CalamityMod.Projectiles.Summon { public class CosmicBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -31,16 +31,16 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } if (Main.rand.NextBool(8)) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); @@ -53,20 +53,20 @@ namespace CalamityMod.Projectiles.Summon float num473 = projectile.Center.Y; float num474 = 1200f; bool flag17 = false; - int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } if (flag17) { float num483 = 40f; @@ -89,38 +89,38 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 144); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 144); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103); for (int num193 = 0; num193 < 3; num193++) { int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index af29c3aabe..24cd8267cc 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Summon { public class CosmicBlastBig : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -64,36 +64,36 @@ namespace CalamityMod.Projectiles.Summon } } float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - if (flag17) - { - float num483 = 45f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + if (flag17) + { + float num483 = 45f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override Color? GetAlpha(Color lightColor) @@ -103,29 +103,29 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 288); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 288); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(29, (int)projectile.Center.X, (int)projectile.Center.Y, 103); for (int num193 = 0; num193 < 3; num193++) { int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); diff --git a/Projectiles/Summon/CosmicEnergy.cs b/Projectiles/Summon/CosmicEnergy.cs index 860cf376d4..57e555eb51 100644 --- a/Projectiles/Summon/CosmicEnergy.cs +++ b/Projectiles/Summon/CosmicEnergy.cs @@ -1,9 +1,9 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { @@ -11,13 +11,13 @@ namespace CalamityMod.Projectiles.Summon { private bool justSpawned = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Energy"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Energy"); + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -38,34 +38,34 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("CosmicEnergy"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("CosmicEnergy"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cEnergy = false; - } - if (modPlayer.cEnergy) - { - projectile.timeLeft = 2; - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("CosmicEnergy"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("CosmicEnergy"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cEnergy = false; + } + if (modPlayer.cEnergy) + { + projectile.timeLeft = 2; + } + } float num633 = 1400f; //700 float num634 = 1600f; //800 float num635 = 2400f; //1200 @@ -97,40 +97,40 @@ namespace CalamityMod.Projectiles.Summon projectile.rotation += projectile.velocity.X * 0.1f; Vector2 vector46 = projectile.position; bool flag25 = false; - int target = 0; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - target = npc.whoAmI; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - target = num645; - } - } - } - } + int target = 0; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + target = npc.whoAmI; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + target = num645; + } + } + } + } float num647 = num634; if (flag25) { @@ -202,42 +202,42 @@ namespace CalamityMod.Projectiles.Summon } } float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; if (justSpawned) { justSpawned = false; projectile.ai[0] = 100f; } if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 1200f; - bool flag11 = false; - for (int num399 = 0; num399 < 200; num399++) - { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) - { - float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); - float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); - if (num402 < num398) - { - num398 = num402; - num396 = num400; - num397 = num401; - flag11 = true; - } - } - } - if (flag11) - { + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + float num396 = projectile.position.X; + float num397 = projectile.position.Y; + float num398 = 1200f; + bool flag11 = false; + for (int num399 = 0; num399 < 200; num399++) + { + if (Main.npc[num399].CanBeChasedBy(projectile, true)) + { + float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); + float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); + float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); + if (num402 < num398) + { + num398 = num402; + num396 = num400; + num397 = num401; + flag11 = true; + } + } + } + if (flag11) + { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); int num251 = Main.rand.Next(5, 8); for (int num252 = 0; num252 < num251; num252++) @@ -252,17 +252,17 @@ namespace CalamityMod.Projectiles.Summon Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("CosmicBlast"), (int)((double)projectile.damage * 0.5), 2f, projectile.owner, (float)target, 0f); } float num403 = 15f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, mod.ProjectileType("CosmicBlastBig"), projectile.damage, 3f, projectile.owner, (float)target, 0f); - projectile.ai[0] = 100f; - } - } + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num396 - vector29.X; + float num405 = num397 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, mod.ProjectileType("CosmicBlastBig"), projectile.damage, 3f, projectile.owner, (float)target, 0f); + projectile.ai[0] = 100f; + } + } } public override Color? GetAlpha(Color lightColor) @@ -270,9 +270,9 @@ namespace CalamityMod.Projectiles.Summon return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/Cosmilamp.cs b/Projectiles/Summon/Cosmilamp.cs index 74d8893d96..ab53f23a14 100644 --- a/Projectiles/Summon/Cosmilamp.cs +++ b/Projectiles/Summon/Cosmilamp.cs @@ -1,20 +1,20 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Cosmilamp : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmilamp"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmilamp"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -29,59 +29,59 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 24; + projectile.localNPCHitCooldown = 24; projectile.extraUpdates = 1; } public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 204, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 204, 0f, 0f, 0, default, 1f); - Main.dust[num1262].velocity *= 0.1f; - Main.dust[num1262].scale = 0.7f; - Main.dust[num1262].noGravity = true; - bool flag64 = projectile.type == mod.ProjectileType("Cosmilamp"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("Cosmilamp"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cLamp = false; - } - if (modPlayer.cLamp) - { - projectile.timeLeft = 2; - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 204, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 204, 0f, 0f, 0, default, 1f); + Main.dust[num1262].velocity *= 0.1f; + Main.dust[num1262].scale = 0.7f; + Main.dust[num1262].noGravity = true; + bool flag64 = projectile.type == mod.ProjectileType("Cosmilamp"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("Cosmilamp"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cLamp = false; + } + if (modPlayer.cLamp) + { + projectile.timeLeft = 2; + } + } int num3; for (int num534 = 0; num534 < 1000; num534 = num3 + 1) { @@ -123,26 +123,26 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } - } - } - else - { - for (int num542 = 0; num542 < 200; num542 = num3 + 1) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + } + else + { + for (int num542 = 0; num542 < 200; num542 = num3 + 1) { if (Main.npc[num542].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Summon/Crimslime.cs b/Projectiles/Summon/Crimslime.cs index 19c39213af..007925fdb1 100644 --- a/Projectiles/Summon/Crimslime.cs +++ b/Projectiles/Summon/Crimslime.cs @@ -1,23 +1,23 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Crimslime : ModProjectile { - public float dust = 0f; + public float dust = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimslime"); - Main.projFrames[projectile.type] = 6; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimslime"); + Main.projFrames[projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -35,56 +35,56 @@ namespace CalamityMod.Projectiles.Summon aiType = 266; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } + { + fallThrough = false; + return true; + } public override void AI() { - if (dust == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("Crimslime"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("Crimslime"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cSlime2 = false; - } - if (modPlayer.cSlime2) - { - projectile.timeLeft = 2; - } - } + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("Crimslime"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("Crimslime"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cSlime2 = false; + } + if (modPlayer.cSlime2) + { + projectile.timeLeft = 2; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index 4a1e3b2eb1..4de31e1896 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class DaedalusCrystal : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Crystal"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Crystal"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.tileCollide = false; @@ -35,138 +35,138 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("DaedalusCrystal"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.daedalusCrystal) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.dCrystal = false; - } - if (modPlayer.dCrystal) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 173, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - } - } - } - else - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - int projectileType = mod.ProjectileType("DaedalusCrystalShot"); - float num403 = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 50f; - } - } + bool flag64 = projectile.type == mod.ProjectileType("DaedalusCrystal"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.daedalusCrystal) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.dCrystal = false; + } + if (modPlayer.dCrystal) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 173, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } + } + } + else + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; + int projectileType = mod.ProjectileType("DaedalusCrystalShot"); + float num403 = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); + projectile.ai[0] = 50f; + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, 200); + return new Color(200, 200, 200, 200); } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index a340cb00ba..1a35580356 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Summon { public class DaedalusCrystalShot : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Shot"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Shot"); + } public override void SetDefaults() { @@ -27,45 +27,45 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 360); + target.AddBuff(BuffID.Frostburn, 360); } } } diff --git a/Projectiles/Summon/DankCreeper.cs b/Projectiles/Summon/DankCreeper.cs index 332922e5df..41ecf35e4d 100644 --- a/Projectiles/Summon/DankCreeper.cs +++ b/Projectiles/Summon/DankCreeper.cs @@ -1,21 +1,21 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class DankCreeper : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dank Creeper"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -33,50 +33,50 @@ namespace CalamityMod.Projectiles.Summon aiType = 317; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 14, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("DankCreeper"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("DankCreeper"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.dCreeper = false; - } - if (modPlayer.dCreeper) - { - projectile.timeLeft = 2; - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 14, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("DankCreeper"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("DankCreeper"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.dCreeper = false; + } + if (modPlayer.dCreeper) + { + projectile.timeLeft = 2; + } + } int num3; for (int num534 = 0; num534 < 1000; num534 = num3 + 1) { @@ -118,26 +118,26 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } - } - } - else - { - for (int num542 = 0; num542 < 200; num542 = num3 + 1) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + } + else + { + for (int num542 = 0; num542 < 200; num542 = num3 + 1) { if (Main.npc[num542].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index 3e0a8ee292..49e3530535 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Summon { public class Dreadmine : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mine"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mine"); + } public override void SetDefaults() { @@ -28,142 +28,142 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - float num945 = 1f; - float num946 = 1f; - if (projectile.identity % 6 == 0) - { - num946 *= -1f; - } - if (projectile.identity % 6 == 1) - { - num945 *= -1f; - } - if (projectile.identity % 6 == 2) - { - num946 *= -1f; - num945 *= -1f; - } - if (projectile.identity % 6 == 3) - { - num946 = 0f; - } - if (projectile.identity % 6 == 4) - { - num945 = 0f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) - { - projectile.localAI[1] = -180f; - } - if (projectile.localAI[1] >= -60f) - { - projectile.velocity.X = projectile.velocity.X + 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; - } - else - { - projectile.velocity.X = projectile.velocity.X - 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) - { - projectile.ai[1] = 1f; - if (projectile.ai[0] < 5500f) - { + float num945 = 1f; + float num946 = 1f; + if (projectile.identity % 6 == 0) + { + num946 *= -1f; + } + if (projectile.identity % 6 == 1) + { + num945 *= -1f; + } + if (projectile.identity % 6 == 2) + { + num946 *= -1f; + num945 *= -1f; + } + if (projectile.identity % 6 == 3) + { + num946 = 0f; + } + if (projectile.identity % 6 == 4) + { + num945 = 0f; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 60f) + { + projectile.localAI[1] = -180f; + } + if (projectile.localAI[1] >= -60f) + { + projectile.velocity.X = projectile.velocity.X + 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; + } + else + { + projectile.velocity.X = projectile.velocity.X - 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5400f) + { + projectile.ai[1] = 1f; + if (projectile.ai[0] < 5500f) + { return; - } - if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else - { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; - if (num947 > 4f) - { - num947 *= 1.1f; - } - if (num947 > 5f) - { - num947 *= 1.2f; - } - if (num947 > 6f) - { - num947 *= 1.3f; - } - if (num947 > 7f) - { - num947 *= 1.4f; - } - if (num947 > 8f) - { - num947 *= 1.5f; - } - if (num947 > 9f) - { - num947 *= 1.6f; - } - if (num947 > 10f) - { - num947 *= 1.7f; - } - projectile.ai[0] += num947; - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - } - bool flag49 = false; - Vector2 center12 = new Vector2(0f, 0f); - float num948 = 600f; - for (int num949 = 0; num949 < 200; num949++) - { - if (Main.npc[num949].CanBeChasedBy(projectile, false)) - { - float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); - float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); - float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); - if (num952 < num948) - { - num948 = num952; - center12 = Main.npc[num949].Center; - flag49 = true; - } - } - } - if (flag49) - { - Vector2 vector101 = center12 - projectile.Center; - vector101.Normalize(); - vector101 *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + vector101) / 10.8f; //11 - return; - } - if ((double)projectile.velocity.Length() > 0.2) - { - projectile.velocity *= 0.98f; - } + } + if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else + { + float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + if (num947 > 4f) + { + num947 *= 1.1f; + } + if (num947 > 5f) + { + num947 *= 1.2f; + } + if (num947 > 6f) + { + num947 *= 1.3f; + } + if (num947 > 7f) + { + num947 *= 1.4f; + } + if (num947 > 8f) + { + num947 *= 1.5f; + } + if (num947 > 9f) + { + num947 *= 1.6f; + } + if (num947 > 10f) + { + num947 *= 1.7f; + } + projectile.ai[0] += num947; + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + } + bool flag49 = false; + Vector2 center12 = new Vector2(0f, 0f); + float num948 = 600f; + for (int num949 = 0; num949 < 200; num949++) + { + if (Main.npc[num949].CanBeChasedBy(projectile, false)) + { + float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); + float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); + float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); + if (num952 < num948) + { + num948 = num952; + center12 = Main.npc[num949].Center; + flag49 = true; + } + } + } + if (flag49) + { + Vector2 vector101 = center12 - projectile.Center; + vector101.Normalize(); + vector101 *= 0.75f; + projectile.velocity = (projectile.velocity * 10f + vector101) / 10.8f; //11 + return; + } + if ((double)projectile.velocity.Length() > 0.2) + { + projectile.velocity *= 0.98f; + } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 112); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 112); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 20; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index 3e52795989..1c7d405950 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,13 +7,13 @@ namespace CalamityMod.Projectiles.Summon { public class DreadmineTurret : ModProjectile { - public float count = 0; + public float count = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dreadmine Turret"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dreadmine Turret"); Main.projFrames[projectile.type] = 2; - } + } public override void SetDefaults() { @@ -28,20 +28,20 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.frameCounter++; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; if (projectile.frameCounter > 6) { projectile.frame++; @@ -127,9 +127,9 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/DrewsSandyWaifu.cs b/Projectiles/Summon/DrewsSandyWaifu.cs index 14e162d97c..3bb667cab9 100644 --- a/Projectiles/Summon/DrewsSandyWaifu.cs +++ b/Projectiles/Summon/DrewsSandyWaifu.cs @@ -1,29 +1,29 @@ -using System; +using CalamityMod.CalPlayer; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class DrewsSandyWaifu : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oxy's Waifu"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oxy's Waifu"); + Main.projFrames[projectile.type] = 5; + Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + } public override void SetDefaults() { projectile.width = 42; - projectile.height = 98; + projectile.height = 98; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -34,188 +34,188 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("DrewsSandyWaifu"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.dWaifu = false; - } - if (modPlayer.dWaifu) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num636 = 100f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.7f * num, 0.6f * num, 0f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("DrewsSandyWaifu")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - if (Vector2.Distance(player.Center, projectile.Center) > 400f) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 7f; //6 - if (flag26) - { - num650 = 18f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-250f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 10f) //200 and 8 - { - num650 = 10f; //8 - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.22f; - projectile.velocity.Y = -0.12f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 220f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.localAI[0] < 120f) - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[0] == 0f) - { - int num658 = mod.ProjectileType("CactusHealOrb"); - if (projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Main.player[projectile.owner].statLife < Main.player[projectile.owner].statLifeMax2) - { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 6); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.5f, vector7.Y * 1.5f, 100, new Color(0, 200, 0), 1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -6f, num658, 0, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("DrewsSandyWaifu"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.dWaifu = false; + } + if (modPlayer.dWaifu) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num636 = 100f; //150 + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 0.7f * num, 0.6f * num, 0f * num); + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("DrewsSandyWaifu")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + if (Vector2.Distance(player.Center, projectile.Center) > 400f) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 7f; //6 + if (flag26) + { + num650 = 18f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(-250f, -60f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 10f) //200 and 8 + { + num650 = 10f; //8 + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.22f; + projectile.velocity.Y = -0.12f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 220f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.localAI[0] < 120f) + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[0] == 0f) + { + int num658 = mod.ProjectileType("CactusHealOrb"); + if (projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Main.player[projectile.owner].statLife < Main.player[projectile.owner].statLifeMax2) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 6); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.5f, vector7.Y * 1.5f, 100, new Color(0, 200, 0), 1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -6f, num658, 0, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } } } diff --git a/Projectiles/Summon/ElementalAxe.cs b/Projectiles/Summon/ElementalAxe.cs index f3a8a70a61..9cb7a842c2 100644 --- a/Projectiles/Summon/ElementalAxe.cs +++ b/Projectiles/Summon/ElementalAxe.cs @@ -1,19 +1,19 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class ElementalAxe : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Axe"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Axe"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -35,213 +35,213 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = (projectile.type == mod.ProjectileType("ElementalAxe")); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("ElementalAxe"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.eAxe = false; - } - if (modPlayer.eAxe) - { - projectile.timeLeft = 2; - } - } - projectile.rotation += 0.075f; - float num633 = 700f; - float num634 = 1200f; - float num635 = 2500f; - float num636 = 400f; - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("ElementalAxe")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 24f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 12f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 16f; //8 - projectile.netUpdate = true; - } - } - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = (projectile.type == mod.ProjectileType("ElementalAxe")); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("ElementalAxe"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.eAxe = false; + } + if (modPlayer.eAxe) + { + projectile.timeLeft = 2; + } + } + projectile.rotation += 0.075f; + float num633 = 700f; + float num634 = 1200f; + float num635 = 2500f; + float num636 = 400f; + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("ElementalAxe")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 2; + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 1; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 24f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 12f; //4 + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 16f; //8 + projectile.netUpdate = true; + } + } + } + } public override Color? GetAlpha(Color lightColor) { @@ -257,7 +257,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 4; + target.immune[projectile.owner] = 4; target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); target.AddBuff(mod.BuffType("GlacialState"), 120); target.AddBuff(mod.BuffType("Plague"), 120); diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 6fc9eaaf3e..0e744a301b 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Summon { public class FlameBlast : ModProjectile { - public float count = 0; + public float count = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -28,82 +28,82 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (count == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (count == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) + { + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + if (flag17) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index aca1bd05e9..92a2b086c7 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,12 +7,12 @@ namespace CalamityMod.Projectiles.Summon { public class FlameBurst : ModProjectile { - private float count = 0; + private float count = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burst"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burst"); + } public override void SetDefaults() { @@ -28,82 +28,82 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (count == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (count == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 0.75f); + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1200f; + bool flag17 = false; + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) + { + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index 63fcb46065..fb1cd572bf 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -1,114 +1,114 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class FrostMistFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mist"); - Main.projFrames[projectile.type] = 6; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mist"); + Main.projFrames[projectile.type] = 6; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + } } diff --git a/Projectiles/Summon/FungalClump.cs b/Projectiles/Summon/FungalClump.cs index f60a71135b..b4c410301c 100644 --- a/Projectiles/Summon/FungalClump.cs +++ b/Projectiles/Summon/FungalClump.cs @@ -1,19 +1,19 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class FungalClump : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungal Clump"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Clump"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; projectile.minionSlots = 0f; projectile.aiStyle = 54; projectile.timeLeft = 18000; @@ -35,73 +35,73 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("FungalClump"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.fungalClump) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.fClump = false; - } - if (modPlayer.fClump) - { - projectile.timeLeft = 2; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 56, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if (Main.rand.NextBool(16)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); - } - } + bool flag64 = projectile.type == mod.ProjectileType("FungalClump"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.fungalClump) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.fClump = false; + } + if (modPlayer.fClump) + { + projectile.timeLeft = 2; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 56, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if (Main.rand.NextBool(16)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - float num = (float)damage * 0.25f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("FungalHeal"), 0, 0f, projectile.owner, (float)num2, num); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + float num = (float)damage * 0.25f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("FungalHeal"), 0, 0f, projectile.owner, (float)num2, num); } } } diff --git a/Projectiles/Summon/GhostFire.cs b/Projectiles/Summon/GhostFire.cs index 1c5d667afc..b828f3426e 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Summon { public class GhostFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -21,25 +21,25 @@ namespace CalamityMod.Projectiles.Summon projectile.extraUpdates = 100; projectile.timeLeft = 80; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 8; projectile.minion = true; projectile.minionSlots = 0f; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 6f) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 180, 0f, 0f, 0, default, 0.2f); - Main.dust[num448].position = vector33; - Main.dust[num448].noGravity = true; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 6f) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 180, 0f, 0f, 0, default, 0.2f); + Main.dust[num448].position = vector33; + Main.dust[num448].noGravity = true; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } } } } diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index 9d3d7daf96..7c8f70093e 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,17 +7,17 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class GhostlyMine : ModProjectile - { - public bool start = true; + { + public bool start = true; public bool spawnDust = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mine"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mine"); + } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.width = 30; projectile.height = 30; projectile.friendly = true; @@ -29,30 +29,30 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; } - public override void AI() - { - if (start) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(SoundID.Item20, projectile.position); + public override void AI() + { + if (start) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Main.PlaySound(SoundID.Item20, projectile.position); projectile.ai[1] = projectile.ai[0]; start = false; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Vector2 direction = Main.player[projectile.owner].Center - projectile.Center; - direction.Normalize(); - direction *= 9f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Vector2 direction = Main.player[projectile.owner].Center - projectile.Center; + direction.Normalize(); + direction *= 9f; Player player = Main.player[projectile.owner]; - double deg = (double)projectile.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 550; + double deg = (double)projectile.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 550; projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; projectile.ai[1] += 1f; //1f @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon } spawnDust = false; } - } + } public override Color? GetAlpha(Color lightColor) { @@ -93,11 +93,11 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 160); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 160); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 30; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); diff --git a/Projectiles/Summon/GigaFlareFriendly.cs b/Projectiles/Summon/GigaFlareFriendly.cs index 556f672d06..f9177adedd 100644 --- a/Projectiles/Summon/GigaFlareFriendly.cs +++ b/Projectiles/Summon/GigaFlareFriendly.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Summon { public class GigaFlareFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon projectile.penetrate = -1; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; projectile.minion = true; projectile.minionSlots = 0f; projectile.timeLeft = 120; @@ -30,144 +30,144 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } public override void Kill(int timeLeft) { float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 2; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 100; - projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 100; + projectile.height = 100; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 200); + target.AddBuff(mod.BuffType("HolyLight"), 200); } } } diff --git a/Projectiles/Summon/Herring.cs b/Projectiles/Summon/Herring.cs index 572f0c49a3..4364c6584e 100644 --- a/Projectiles/Summon/Herring.cs +++ b/Projectiles/Summon/Herring.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { @@ -12,13 +12,13 @@ namespace CalamityMod.Projectiles.Summon { public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Herring"); - Main.projFrames[projectile.type] = 4; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Herring"); + Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -39,9 +39,9 @@ namespace CalamityMod.Projectiles.Summon { if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; @@ -53,14 +53,14 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = projectile.direction; } @@ -76,211 +76,211 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } float num633 = 600f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Herring"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + float num634 = 800f; + float num635 = 1200f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Herring"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Herring"), 3600); if (flag64) - { - if (player.dead) - { - modPlayer.herring = false; - } - if (modPlayer.herring) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Herring")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && + { + if (player.dead) + { + modPlayer.herring = false; + } + if (modPlayer.herring) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Herring")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 7f; //8 - projectile.netUpdate = true; - } - } - } + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 7f; //8 + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 8; } diff --git a/Projectiles/Summon/IceClasper.cs b/Projectiles/Summon/IceClasper.cs index 18eb4f0d84..5dfe47f2f0 100644 --- a/Projectiles/Summon/IceClasper.cs +++ b/Projectiles/Summon/IceClasper.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { @@ -12,13 +12,13 @@ namespace CalamityMod.Projectiles.Summon { private int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Clasper"); - Main.projFrames[projectile.type] = 6; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Clasper"); + Main.projFrames[projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -39,9 +39,9 @@ namespace CalamityMod.Projectiles.Summon { if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; @@ -53,14 +53,14 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.frameCounter++; + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; if (projectile.frameCounter > 6) { projectile.frame++; @@ -72,212 +72,212 @@ namespace CalamityMod.Projectiles.Summon } Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.05f, 0.15f, 0.2f); float num633 = 700f; - float num634 = 1000f; - float num635 = 2200f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("IceClasper"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + float num634 = 1000f; + float num635 = 2200f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("IceClasper"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("IceClasper"), 3600); if (flag64) - { - if (player.dead) - { - modPlayer.iClasper = false; - } - if (modPlayer.iClasper) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("IceClasper")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && + { + if (player.dead) + { + modPlayer.iClasper = false; + } + if (modPlayer.iClasper) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("IceClasper")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() - 1.57f; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 9f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57f; - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 9f; //8 - projectile.netUpdate = true; - } - } - } + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + projectile.rotation = projectile.velocity.ToRotation() - 1.57f; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 9f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57f; + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 9f; //8 + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 7; } diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 7164c8689e..da3e677ce6 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class MechwormBody : ModProjectile { - private int playerMinionSlots = 0; - private bool runCheck = true; + private int playerMinionSlots = 0; + private bool runCheck = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } public override void SetDefaults() { @@ -32,88 +32,88 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; } public override void AI() - { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - if (player9.maxMinions > playerMinionSlots) - { - playerMinionSlots = player9.maxMinions; - } - if (runCheck) - { - runCheck = false; - playerMinionSlots = player9.maxMinions; - } - CalamityPlayer modPlayer = player9.Calamity(); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - //Maybe add some kill code here ? - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - } + { + Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); + Player player9 = Main.player[projectile.owner]; + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } + CalamityPlayer modPlayer = player9.Calamity(); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 10; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + //Maybe add some kill code here ? + return; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -121,5 +121,5 @@ namespace CalamityMod.Projectiles.Summon spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - } + } } diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index d18280d658..1a033fa535 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class MechwormBody2 : ModProjectile { - private int playerMinionSlots = 0; - private bool runCheck = true; + private int playerMinionSlots = 0; + private bool runCheck = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } public override void SetDefaults() { @@ -32,88 +32,88 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; } public override void AI() - { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - if (player9.maxMinions > playerMinionSlots) - { - playerMinionSlots = player9.maxMinions; - } - if (runCheck) - { - runCheck = false; - playerMinionSlots = player9.maxMinions; - } - CalamityPlayer modPlayer = player9.Calamity(); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - return; - } + { + Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); + Player player9 = Main.player[projectile.owner]; + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } + CalamityPlayer modPlayer = player9.Calamity(); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 10; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + return; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + return; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -121,5 +121,5 @@ namespace CalamityMod.Projectiles.Summon spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - } + } } diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 6819cbb6b6..c86ebadae3 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -1,226 +1,226 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class MechwormHead : ModProjectile - { - private int dust = 3; - private int playerMinionSlots = 0; - private bool runCheck = true; + { + private int dust = 3; + private int playerMinionSlots = 0; + private bool runCheck = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.penetrate = -1; + projectile.timeLeft = 18000; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } - public override void AI() - { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - if (dust > 0) - { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - dust--; - } - if (player9.maxMinions > playerMinionSlots) - { - playerMinionSlots = player9.maxMinions; - } - if (runCheck) - { - runCheck = false; - playerMinionSlots = player9.maxMinions; - } - CalamityPlayer modPlayer = player9.Calamity(); - player9.AddBuff(mod.BuffType("Mechworm"), 3600); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 30; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 center14 = player9.Center; - float num1053 = 1800f; //700 - float num1054 = 2200f; //1000 - int num1055 = -1; - if (projectile.Distance(center14) > 3000f) //2000 - { - projectile.Center = center14; - projectile.netUpdate = true; - } - if (player9.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player9.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && player9.Distance(npc.Center) < num1054) - { - float num1057 = projectile.Distance(npc.Center); - if (num1057 < num1053) - { - num1055 = npc.whoAmI; - } - } - } - else - { - for (int num1056 = 0; num1056 < 200; num1056++) - { - NPC nPC13 = Main.npc[num1056]; - if (nPC13.CanBeChasedBy(projectile, false) && player9.Distance(nPC13.Center) < num1054) - { - float num1057 = projectile.Distance(nPC13.Center); - if (num1057 < num1053) - { - num1055 = num1056; - } - } - } - } - if (num1055 != -1) - { - NPC nPC14 = Main.npc[num1055]; - Vector2 vector132 = nPC14.Center - projectile.Center; - (vector132.X > 0f).ToDirectionInt(); - (vector132.Y > 0f).ToDirectionInt(); - float scaleFactor16 = 0.3f; //.4 + public override void AI() + { + Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); + Player player9 = Main.player[projectile.owner]; + if (dust > 0) + { + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + dust--; + } + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } + CalamityPlayer modPlayer = player9.Calamity(); + player9.AddBuff(mod.BuffType("Mechworm"), 3600); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 30; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 center14 = player9.Center; + float num1053 = 1800f; //700 + float num1054 = 2200f; //1000 + int num1055 = -1; + if (projectile.Distance(center14) > 3000f) //2000 + { + projectile.Center = center14; + projectile.netUpdate = true; + } + if (player9.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player9.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && player9.Distance(npc.Center) < num1054) + { + float num1057 = projectile.Distance(npc.Center); + if (num1057 < num1053) + { + num1055 = npc.whoAmI; + } + } + } + else + { + for (int num1056 = 0; num1056 < 200; num1056++) + { + NPC nPC13 = Main.npc[num1056]; + if (nPC13.CanBeChasedBy(projectile, false) && player9.Distance(nPC13.Center) < num1054) + { + float num1057 = projectile.Distance(nPC13.Center); + if (num1057 < num1053) + { + num1055 = num1056; + } + } + } + } + if (num1055 != -1) + { + NPC nPC14 = Main.npc[num1055]; + Vector2 vector132 = nPC14.Center - projectile.Center; + (vector132.X > 0f).ToDirectionInt(); + (vector132.Y > 0f).ToDirectionInt(); + float scaleFactor16 = 0.3f; //.4 if (vector132.Length() < 900f) { scaleFactor16 = 0.45f; //.5 } if (vector132.Length() < 600f) - { - scaleFactor16 = 0.6f; //.6 - } - if (vector132.Length() < 300f) - { - scaleFactor16 = 0.8f; //.8 - } - if (vector132.Length() > nPC14.Size.Length() * 0.75f) - { - projectile.velocity += Vector2.Normalize(vector132) * scaleFactor16 * 1.5f; - if (Vector2.Dot(projectile.velocity, vector132) < 0.25f) - { - projectile.velocity *= 0.8f; - } - } - float num1058 = 50f; //30 - if (projectile.velocity.Length() > num1058) - { - projectile.velocity = Vector2.Normalize(projectile.velocity) * num1058; - } - } - else - { - float num1059 = 0.2f; - Vector2 vector133 = center14 - projectile.Center; - if (vector133.Length() < 200f) - { - num1059 = 0.12f; - } - if (vector133.Length() < 140f) - { - num1059 = 0.06f; - } - if (vector133.Length() > 100f) - { - if (Math.Abs(center14.X - projectile.Center.X) > 20f) - { - projectile.velocity.X = projectile.velocity.X + num1059 * (float)Math.Sign(center14.X - projectile.Center.X); - } - if (Math.Abs(center14.Y - projectile.Center.Y) > 10f) - { - projectile.velocity.Y = projectile.velocity.Y + num1059 * (float)Math.Sign(center14.Y - projectile.Center.Y); - } - } - else if (projectile.velocity.Length() > 2f) - { - projectile.velocity *= 0.96f; - } - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.1f; - } - float num1060 = 25f; //15 - if (projectile.velocity.Length() > num1060) - { - projectile.velocity = Vector2.Normalize(projectile.velocity) * num1060; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - int direction = projectile.direction; - projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); - if (direction != projectile.direction) - { - projectile.netUpdate = true; - } - float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); - projectile.position = projectile.Center; - projectile.scale = 1f + num1061 * 0.01f; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (projectile.alpha > 0) - { - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - } + { + scaleFactor16 = 0.6f; //.6 + } + if (vector132.Length() < 300f) + { + scaleFactor16 = 0.8f; //.8 + } + if (vector132.Length() > nPC14.Size.Length() * 0.75f) + { + projectile.velocity += Vector2.Normalize(vector132) * scaleFactor16 * 1.5f; + if (Vector2.Dot(projectile.velocity, vector132) < 0.25f) + { + projectile.velocity *= 0.8f; + } + } + float num1058 = 50f; //30 + if (projectile.velocity.Length() > num1058) + { + projectile.velocity = Vector2.Normalize(projectile.velocity) * num1058; + } + } + else + { + float num1059 = 0.2f; + Vector2 vector133 = center14 - projectile.Center; + if (vector133.Length() < 200f) + { + num1059 = 0.12f; + } + if (vector133.Length() < 140f) + { + num1059 = 0.06f; + } + if (vector133.Length() > 100f) + { + if (Math.Abs(center14.X - projectile.Center.X) > 20f) + { + projectile.velocity.X = projectile.velocity.X + num1059 * (float)Math.Sign(center14.X - projectile.Center.X); + } + if (Math.Abs(center14.Y - projectile.Center.Y) > 10f) + { + projectile.velocity.Y = projectile.velocity.Y + num1059 * (float)Math.Sign(center14.Y - projectile.Center.Y); + } + } + else if (projectile.velocity.Length() > 2f) + { + projectile.velocity *= 0.96f; + } + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.1f; + } + float num1060 = 25f; //15 + if (projectile.velocity.Length() > num1060) + { + projectile.velocity = Vector2.Normalize(projectile.velocity) * num1060; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + int direction = projectile.direction; + projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); + if (direction != projectile.direction) + { + projectile.netUpdate = true; + } + float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); + projectile.position = projectile.Center; + projectile.scale = 1f + num1061 * 0.01f; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (projectile.alpha > 0) + { + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = Main.projectileTexture[projectile.type]; spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(21f, 25f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Summon/MechwormHeadGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(21f, 25f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Summon/MechwormHeadGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + } } diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index 46402c53b0..1142ed55cd 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class MechwormTail : ModProjectile { - private int playerMinionSlots = 0; - private bool runCheck = true; + private int playerMinionSlots = 0; + private bool runCheck = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } public override void SetDefaults() { @@ -32,89 +32,89 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; } public override void AI() - { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - if (player9.maxMinions > playerMinionSlots) - { - playerMinionSlots = player9.maxMinions; - } - if (runCheck) - { - runCheck = false; - playerMinionSlots = player9.maxMinions; - } - CalamityPlayer modPlayer = player9.Calamity(); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - projectile.Kill(); - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - return; - } + { + Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); + Player player9 = Main.player[projectile.owner]; + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } + CalamityPlayer modPlayer = player9.Calamity(); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 10; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + projectile.Kill(); + return; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + return; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -122,5 +122,5 @@ namespace CalamityMod.Projectiles.Summon spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - } + } } diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index 7cec33ea4d..0ac5c46af6 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Summon { public class MiniSandShark : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mini Sand Shark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mini Sand Shark"); + } public override void SetDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ignoreWater = true; projectile.alpha = 255; projectile.minionSlots = 0f; - projectile.extraUpdates = 1; + projectile.extraUpdates = 1; } public override void AI() @@ -54,28 +54,28 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 77d1bcf56c..8b998675c1 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -1,20 +1,20 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class PhantomGuy : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -33,220 +33,220 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - float num633 = 700f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 600f; - bool flag64 = projectile.type == mod.ProjectileType("PhantomGuy"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("Phantom"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.pGuy = false; - } - if (modPlayer.pGuy) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PhantomGuy")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 18f; //12 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 9f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 12f; - if (flag26) - { - num650 = 30f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 16f) - { - num650 = 16f; - } - if (num651 < num636 && flag26) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 6f; - int num658 = mod.ProjectileType("GhostFire"); - if (flag25 && projectile.ai[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - projectile.netUpdate = true; - } - } - } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + float num633 = 700f; + float num634 = 1300f; + float num635 = 2600f; + float num636 = 600f; + bool flag64 = projectile.type == mod.ProjectileType("PhantomGuy"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("Phantom"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.pGuy = false; + } + if (modPlayer.pGuy) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PhantomGuy")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 18f; //12 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 9f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 12f; + if (flag26) + { + num650 = 30f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 16f) + { + num650 = 16f; + } + if (num651 < num636 && flag26) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 6f; + int num658 = mod.ProjectileType("GhostFire"); + if (flag25 && projectile.ai[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + projectile.netUpdate = true; + } + } + } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { - return new Color(100, 250, 250, projectile.alpha); + return new Color(100, 250, 250, projectile.alpha); } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/PhoenixFireFriendly.cs b/Projectiles/Summon/PhoenixFireFriendly.cs index c8916abae2..189ff8b527 100644 --- a/Projectiles/Summon/PhoenixFireFriendly.cs +++ b/Projectiles/Summon/PhoenixFireFriendly.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Summon { public class PhoenixFireFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -26,63 +26,63 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); } } } diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index faaef7c94a..09889c0708 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,14 +8,14 @@ namespace CalamityMod.Projectiles.Summon { public class ProfanedEnergy : ModProjectile { - private float count = 0f; + private float count = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Energy"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Energy"); Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -41,93 +41,93 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } if (count == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - int target = 0; - if (Main.player[projectile.owner].HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - target = npc.whoAmI; - } - } - } - else - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - target = num512; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + int target = 0; + if (Main.player[projectile.owner].HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + target = npc.whoAmI; + } + } + } + else + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + target = num512; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; if (num506 < 0f) { projectile.spriteDirection = 1; @@ -137,31 +137,31 @@ namespace CalamityMod.Projectiles.Summon projectile.spriteDirection = -1; } int projectileType = Main.rand.Next(2); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("FlameBlast"); - } - else - { - projectileType = mod.ProjectileType("FlameBurst"); - } - float num403 = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); - projectile.ai[0] = 8f; - } - } + if (projectileType == 0) + { + projectileType = mod.ProjectileType("FlameBlast"); + } + else + { + projectileType = mod.ProjectileType("FlameBurst"); + } + float num403 = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); + projectile.ai[0] = 8f; + } + } } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/ReaverOrb.cs b/Projectiles/Summon/ReaverOrb.cs index 43adfa19fd..5b2c43ba7d 100644 --- a/Projectiles/Summon/ReaverOrb.cs +++ b/Projectiles/Summon/ReaverOrb.cs @@ -1,21 +1,21 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class ReaverOrb : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Orb"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Orb"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + } public override void SetDefaults() { @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.alpha = 50; projectile.penetrate = -1; @@ -35,107 +35,107 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("ReaverOrb"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.reaverOrb) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.rOrb = false; - } - if (modPlayer.rOrb) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 157, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num508 = 600f; - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - flag18 = true; - } - } - } - if (flag18) - { - int num251 = Main.rand.Next(4, 9); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(90, 121) * 0.1f; - int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, 569 + Main.rand.Next(3), projectile.damage, 1.5f, projectile.owner, 0f, 0f); - Main.projectile[spore].minion = true; - Main.projectile[spore].minionSlots = 0f; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 77); - projectile.ai[0] = 50f; - } - } + bool flag64 = projectile.type == mod.ProjectileType("ReaverOrb"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.reaverOrb) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.rOrb = false; + } + if (modPlayer.rOrb) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 157, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num508 = 600f; + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + flag18 = true; + } + } + } + if (flag18) + { + int num251 = Main.rand.Next(4, 9); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(90, 121) * 0.1f; + int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, 569 + Main.rand.Next(3), projectile.damage, 1.5f, projectile.owner, 0f, 0f); + Main.projectile[spore].minion = true; + Main.projectile[spore].minionSlots = 0f; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 77); + projectile.ai[0] = 50f; + } + } } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/RedDevil.cs b/Projectiles/Summon/RedDevil.cs index 57e45f45a3..f8bcca5f9a 100644 --- a/Projectiles/Summon/RedDevil.cs +++ b/Projectiles/Summon/RedDevil.cs @@ -1,24 +1,24 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class RedDevil : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Devil"); - Main.projFrames[projectile.type] = 5; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Devil"); + Main.projFrames[projectile.type] = 5; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -35,260 +35,260 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("RedDevil"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.redDevil) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.rDevil = false; - } - if (modPlayer.rDevil) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 235, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1f * num, 0f * num, 0.15f * num); - projectile.rotation = projectile.velocity.X * 0.04f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 700f; - float num634 = 2000f; - float num635 = 3000f; - float num636 = 150f; - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("RedDevil")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 16f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 5f; //6 - if (flag26) - { - num650 = 12f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -30f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 6.5f) //200 and 8 - { - num650 = 6.5f; //8 - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.2f; - projectile.velocity.Y = -0.1f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 80f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 24f; - int num658 = ProjectileID.UnholyTridentFriendly; - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - Main.projectile[num659].usesLocalNPCImmunity = true; - Main.projectile[num659].localNPCHitCooldown = 10; - projectile.netUpdate = true; - } - } - } + bool flag64 = projectile.type == mod.ProjectileType("RedDevil"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.redDevil) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.rDevil = false; + } + if (modPlayer.rDevil) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 235, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 1f * num, 0f * num, 0.15f * num); + projectile.rotation = projectile.velocity.X * 0.04f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 700f; + float num634 = 2000f; + float num635 = 3000f; + float num636 = 150f; + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("RedDevil")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (projectile.ai[0] != 1f) + { + projectile.tileCollide = false; + } + if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + { + projectile.tileCollide = false; + } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 16f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 5f; //6 + if (flag26) + { + num650 = 12f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -30f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 6.5f) //200 and 8 + { + num650 = 6.5f; //8 + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.2f; + projectile.velocity.Y = -0.1f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 80f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 24f; + int num658 = ProjectileID.UnholyTridentFriendly; + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 300; + Main.projectile[num659].usesLocalNPCImmunity = true; + Main.projectile[num659].localNPCHitCooldown = 10; + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/SandBolt.cs b/Projectiles/Summon/SandBolt.cs index 3a3a1c918e..2ea51ae097 100644 --- a/Projectiles/Summon/SandBolt.cs +++ b/Projectiles/Summon/SandBolt.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Summon { public class SandBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -22,15 +22,15 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SandMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SandMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index 2b75f9a468..98cfea0324 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Summon { public class SandMark : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } public override void SetDefaults() { @@ -20,146 +20,146 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.tileCollide = false; projectile.timeLeft = 900; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } public override void AI() { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("SandTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); - Main.projectile[storm].minion = true; - Main.projectile[storm].melee = false; - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - return; - } + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("SandTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); + Main.projectile[storm].minion = true; + Main.projectile[storm].melee = false; + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + return; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; } } } diff --git a/Projectiles/Summon/SandTornado.cs b/Projectiles/Summon/SandTornado.cs index 98869d3739..39a6c6fb49 100644 --- a/Projectiles/Summon/SandTornado.cs +++ b/Projectiles/Summon/SandTornado.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Summon { public class SandTornado : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } public override void SetDefaults() { @@ -23,134 +23,134 @@ namespace CalamityMod.Projectiles.Summon projectile.penetrate = NPC.downedMoonlord ? -1 : 3; projectile.timeLeft = 1200; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } public override void AI() { - float num1125 = 900f; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - return; - } + float num1125 = 900f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + float num1127 = 15f; + float num1128 = 15f; + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + return; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 100); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; + float num226 = 600f; + float num227 = 15f; + float num228 = 15f; + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 100); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; } } } diff --git a/Projectiles/Summon/Sandnado.cs b/Projectiles/Summon/Sandnado.cs index 9228ea83e5..dd5f82c2c8 100644 --- a/Projectiles/Summon/Sandnado.cs +++ b/Projectiles/Summon/Sandnado.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Sandnado : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandnado"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandnado"); Main.projFrames[projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -32,16 +32,16 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + projectile.localNPCHitCooldown = 20; } public override void AI() { if (projectile.localAI[1] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; @@ -54,14 +54,14 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[1] += 1f; } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("Sandnado"); + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("Sandnado"); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(mod.BuffType("Sandnado"), 3600); @@ -123,25 +123,25 @@ namespace CalamityMod.Projectiles.Summon } Vector2 center = Main.player[projectile.owner].Center; Vector2 value = new Vector2(0.5f); - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num12 = Vector2.Distance(vector2, center); - if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num10 = num12; - vector = vector2; - flag = true; - num11 = npc.whoAmI; - } - } - } - else - { - for (int k = 0; k < 200; k++) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 vector2 = npc.position + npc.Size * value; + float num12 = Vector2.Distance(vector2, center); + if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num10 = num12; + vector = vector2; + flag = true; + num11 = npc.whoAmI; + } + } + } + else + { + for (int k = 0; k < 200; k++) { NPC nPC = Main.npc[k]; if (nPC.CanBeChasedBy(projectile, false)) @@ -308,9 +308,9 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/SandyWaifu.cs b/Projectiles/Summon/SandyWaifu.cs index 34d83d3dd5..a9c068a385 100644 --- a/Projectiles/Summon/SandyWaifu.cs +++ b/Projectiles/Summon/SandyWaifu.cs @@ -1,29 +1,29 @@ -using System; +using CalamityMod.CalPlayer; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class SandyWaifu : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Waifu"); - Main.projFrames[projectile.type] = 12; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Waifu"); + Main.projFrames[projectile.type] = 12; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { projectile.width = 42; - projectile.height = 98; + projectile.height = 98; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -34,133 +34,133 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("SandyWaifu"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sandWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sWaifu = false; - } - if (modPlayer.sWaifu) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 700f; //700 - float num634 = 800f; - float num635 = 1200f; - float num636 = 200f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.7f * num, 0.6f * num, 0f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("SandyWaifu")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { + bool flag64 = projectile.type == mod.ProjectileType("SandyWaifu"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.sandWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.sWaifu = false; + } + if (modPlayer.sWaifu) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 700f; //700 + float num634 = 800f; + float num635 = 1200f; + float num636 = 200f; //150 + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 0.7f * num, 0.6f * num, 0f * num); + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("SandyWaifu")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (projectile.ai[0] != 1f) + { + projectile.tileCollide = false; + } + if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + { + projectile.tileCollide = false; + } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { if (projectile.frame < 6) { projectile.frame = 6; @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 6; } num647 = num635; - } + } else { projectile.frameCounter++; @@ -190,12 +190,12 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector47 = vector46 - projectile.Center; @@ -256,33 +256,33 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity.Y = -0.095f; } } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 220f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 11f; - int num658 = mod.ProjectileType("SandBolt"); - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - projectile.netUpdate = true; - } - } - } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 220f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 11f; + int num658 = mod.ProjectileType("SandBolt"); + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 300; + projectile.netUpdate = true; + } + } + } } } } diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 7ae993c58a..2a2663c327 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -1,31 +1,31 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class SilvaCrystal : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Crystal"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Crystal"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { projectile.width = 22; projectile.height = 52; projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.alpha = 255; projectile.tileCollide = false; @@ -35,20 +35,20 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[1] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[1] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("SilvaCrystal"); + if (projectile.localAI[1] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[1] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("SilvaCrystal"); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.silvaSummon) @@ -119,19 +119,19 @@ namespace CalamityMod.Projectiles.Summon { int num1074 = -1; float num1075 = num1072; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num1076 = projectile.Distance(npc.Center); - if (num1076 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, npc.Center, 0, 0)) - { - num1075 = num1076; - num1074 = npc.whoAmI; - } - } - } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num1076 = projectile.Distance(npc.Center); + if (num1076 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, npc.Center, 0, 0)) + { + num1075 = num1076; + num1074 = npc.whoAmI; + } + } + } if (num1074 < 0) { int num30; @@ -231,9 +231,9 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index acfbbcbf1f..7876015c09 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Summon { public class SilvaCrystalExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; + projectile.localAI[1] += 1f; if (projectile.localAI[1] >= 60f) { projectile.Kill(); @@ -212,9 +212,9 @@ namespace CalamityMod.Projectiles.Summon projectile.Center = projectile.position; projectile.penetrate = -1; projectile.maxPenetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); projectile.penetrate = num75; projectile.position = projectile.Center; projectile.width = width; diff --git a/Projectiles/Summon/SirenLure.cs b/Projectiles/Summon/SirenLure.cs index c98c9637e5..11f917be15 100644 --- a/Projectiles/Summon/SirenLure.cs +++ b/Projectiles/Summon/SirenLure.cs @@ -1,33 +1,33 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class SirenLure : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren Lure"); - Main.projFrames[projectile.type] = 6; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren Lure"); + Main.projFrames[projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { projectile.width = 70; - projectile.height = 120; + projectile.height = 120; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.tileCollide = false; @@ -36,161 +36,161 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("SirenLure"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sirenWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.slWaifu = false; - } - if (modPlayer.slWaifu) - { - projectile.timeLeft = 2; - } - } - if (dust > 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } + bool flag64 = projectile.type == mod.ProjectileType("SirenLure"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.sirenWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.slWaifu = false; + } + if (modPlayer.slWaifu) + { + projectile.timeLeft = 2; + } + } + if (dust > 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } dust--; } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, 0f, 0.25f, 1.5f); - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 180f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 360f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - } - } - } - else - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - if (num506 < 0f) - { - projectile.spriteDirection = 1; - } - else - { - projectile.spriteDirection = -1; - } - int projectileType = mod.ProjectileType("WaterSpearFriendly"); - if (Main.rand.NextBool(9)) - { - projectileType = mod.ProjectileType("FrostMistFriendly"); - } - else if (Main.rand.NextBool(9)) - { - projectileType = mod.ProjectileType("SirenSongFriendly"); - } - float num403 = Main.rand.Next(12, 20); - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 12f; - } - } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 1.5f); + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 180f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 360f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } + } + } + else + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; + if (num506 < 0f) + { + projectile.spriteDirection = 1; + } + else + { + projectile.spriteDirection = -1; + } + int projectileType = mod.ProjectileType("WaterSpearFriendly"); + if (Main.rand.NextBool(9)) + { + projectileType = mod.ProjectileType("FrostMistFriendly"); + } + else if (Main.rand.NextBool(9)) + { + projectileType = mod.ProjectileType("SirenSongFriendly"); + } + float num403 = Main.rand.Next(12, 20); + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.ai[0] = 12f; + } + } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/SirenSongFriendly.cs b/Projectiles/Summon/SirenSongFriendly.cs index 7ac2098fb4..4f3b428c82 100644 --- a/Projectiles/Summon/SirenSongFriendly.cs +++ b/Projectiles/Summon/SirenSongFriendly.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Summon { public class SirenSongFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + } public override void SetDefaults() { @@ -25,37 +25,37 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; - Main.harpNote = soundPitch; - Main.PlaySound(SoundID.Item26, projectile.position); - } - Lighting.AddLight(projectile.Center, 0f, 0f, 1.2f); - } + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + Main.harpNote = soundPitch; + Main.PlaySound(SoundID.Item26, projectile.position); + } + Lighting.AddLight(projectile.Center, 0f, 0f, 1.2f); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 0); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, 0); + } + } } diff --git a/Projectiles/Summon/SlimeGod.cs b/Projectiles/Summon/SlimeGod.cs index ba7b155b86..6a0c2eca93 100644 --- a/Projectiles/Summon/SlimeGod.cs +++ b/Projectiles/Summon/SlimeGod.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class SlimeGod : ModProjectile { - public float dust = 0f; + public float dust = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God"); - Main.projFrames[projectile.type] = 2; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God"); + Main.projFrames[projectile.type] = 2; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -34,62 +34,62 @@ namespace CalamityMod.Projectiles.Summon aiType = 266; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } + { + fallThrough = false; + return true; + } public override void AI() { - if (dust == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("SlimeGod"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("SlimeGod"), 3600); - if (!modPlayer.slimeGod) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sGod = false; - } - if (modPlayer.sGod) - { - projectile.timeLeft = 2; - } - } - } + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("SlimeGod"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("SlimeGod"), 3600); + if (!modPlayer.slimeGod) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.sGod = false; + } + if (modPlayer.sGod) + { + projectile.timeLeft = 2; + } + } + } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Summon/SlimeGodAlt.cs b/Projectiles/Summon/SlimeGodAlt.cs index 696ad5359b..c1e27eabe1 100644 --- a/Projectiles/Summon/SlimeGodAlt.cs +++ b/Projectiles/Summon/SlimeGodAlt.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class SlimeGodAlt : ModProjectile { - public float dust = 0f; + public float dust = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God"); - Main.projFrames[projectile.type] = 2; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God"); + Main.projFrames[projectile.type] = 2; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -34,62 +34,62 @@ namespace CalamityMod.Projectiles.Summon aiType = 266; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } + { + fallThrough = false; + return true; + } public override void AI() { - if (dust == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - bool flag64 = projectile.type == mod.ProjectileType("SlimeGodAlt"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("SlimeGod"), 3600); - if (!modPlayer.slimeGod) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sGod = false; - } - if (modPlayer.sGod) - { - projectile.timeLeft = 2; - } - } - } + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == mod.ProjectileType("SlimeGodAlt"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("SlimeGod"), 3600); + if (!modPlayer.slimeGod) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.sGod = false; + } + if (modPlayer.sGod) + { + projectile.timeLeft = 2; + } + } + } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Summon/SolarBeam.cs b/Projectiles/Summon/SolarBeam.cs index 2504bea378..5a4f986e93 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Summon { public class SolarBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -26,20 +26,20 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default, 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } } } } diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index be462ade0e..571462269c 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -1,20 +1,20 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class SolarGod : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar God"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar God"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -33,129 +33,129 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - bool flag64 = projectile.type == mod.ProjectileType("SolarGod"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("SolarSpiritGod"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.SPG = false; - } - if (modPlayer.SPG) - { - projectile.timeLeft = 2; - } - } - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 150f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 700f; - bool flag11 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num398 = num541; - num396 = num539; - num397 = num540; - flag11 = true; - } - } - } - else - { - for (int num399 = 0; num399 < 200; num399++) - { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) - { - float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); - float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); - if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) - { - num398 = num402; - num396 = num400; - num397 = num401; - flag11 = true; - } - } - } - } - if (flag11) - { - float num403 = 35f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, mod.ProjectileType("SolarBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 30f; - } - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + bool flag64 = projectile.type == mod.ProjectileType("SolarGod"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("SolarSpiritGod"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.SPG = false; + } + if (modPlayer.SPG) + { + projectile.timeLeft = 2; + } + } + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 150f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + float num396 = projectile.position.X; + float num397 = projectile.position.Y; + float num398 = 700f; + bool flag11 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num398 = num541; + num396 = num539; + num397 = num540; + flag11 = true; + } + } + } + else + { + for (int num399 = 0; num399 < 200; num399++) + { + if (Main.npc[num399].CanBeChasedBy(projectile, true)) + { + float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); + float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); + float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); + if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) + { + num398 = num402; + num396 = num400; + num397 = num401; + flag11 = true; + } + } + } + } + if (flag11) + { + float num403 = 35f; + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num396 - vector29.X; + float num405 = num397 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, mod.ProjectileType("SolarBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.ai[0] = 30f; + } + } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 439c5327bd..c27e982d61 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -1,20 +1,20 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class SolarPixie : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar Pixie"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar Pixie"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } public override void SetDefaults() { @@ -33,131 +33,131 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - bool flag64 = projectile.type == mod.ProjectileType("SolarPixie"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("SolarSpirit"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.SP = false; - } - if (modPlayer.SP) - { - projectile.timeLeft = 2; - } - } - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 140f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 25; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 700f; - bool flag11 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num398 = num541; - num396 = num539; - num397 = num540; - flag11 = true; - } - } - } - else - { - for (int num399 = 0; num399 < 200; num399++) - { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) - { - float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); - float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); - if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) - { - num398 = num402; - num396 = num400; - num397 = num401; - flag11 = true; - } - } - } - } - if (flag11) - { - float num403 = 30f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - int beam = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, 260, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + bool flag64 = projectile.type == mod.ProjectileType("SolarPixie"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("SolarSpirit"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.SP = false; + } + if (modPlayer.SP) + { + projectile.timeLeft = 2; + } + } + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 140f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 25; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + float num396 = projectile.position.X; + float num397 = projectile.position.Y; + float num398 = 700f; + bool flag11 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num398 = num541; + num396 = num539; + num397 = num540; + flag11 = true; + } + } + } + else + { + for (int num399 = 0; num399 < 200; num399++) + { + if (Main.npc[num399].CanBeChasedBy(projectile, true)) + { + float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); + float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); + float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); + if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) + { + num398 = num402; + num396 = num400; + num397 = num401; + flag11 = true; + } + } + } + } + if (flag11) + { + float num403 = 30f; + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num396 - vector29.X; + float num405 = num397 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + int beam = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, 260, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[beam].magic = false; Main.projectile[beam].minion = true; projectile.ai[0] = 50f; - } - } + } + } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index f23b22bb96..8633a36f8e 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -1,116 +1,116 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class Spikecrag : ModProjectile - { + { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spikecrag"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spikecrag"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 42; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - } + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 42; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.Y += 0.5f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1000f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - homeIn = true; - } - } - } - if (projectile.owner == Main.myPlayer && homeIn) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - projectile.ai[1] += 1f; - if ((projectile.ai[1] % 10f) == 0f) - { - int amount = Main.rand.Next(6, 10); - for (int i = 0; i < amount; i++) - { - float velocityX = Main.rand.NextFloat(-10f, 10f); - float velocityY = Main.rand.NextFloat(-15f, -8f); - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, mod.ProjectileType("SpikecragSpike"), (int)((double)projectile.damage * 0.80), 0f, projectile.owner, 0f, 0f); - } - } - } - } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 1000f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + homeIn = true; + } + } + } + if (projectile.owner == Main.myPlayer && homeIn) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + projectile.ai[1] += 1f; + if ((projectile.ai[1] % 10f) == 0f) + { + int amount = Main.rand.Next(6, 10); + for (int i = 0; i < amount; i++) + { + float velocityX = Main.rand.NextFloat(-10f, 10f); + float velocityY = Main.rand.NextFloat(-15f, -8f); + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, mod.ProjectileType("SpikecragSpike"), (int)((double)projectile.damage * 0.80), 0f, projectile.owner, 0f, 0f); + } + } + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs index 0e81e7acc7..e2e21a791e 100644 --- a/Projectiles/Summon/SpikecragSpike.cs +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Summon { public class SpikecragSpike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SpikecragSpike"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SpikecragSpike"); + } public override void SetDefaults() { @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += 0.1f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += 0.1f; + } } } diff --git a/Projectiles/Summon/StormMarkSummon.cs b/Projectiles/Summon/StormMarkSummon.cs index 7be16732f8..594a6fc937 100644 --- a/Projectiles/Summon/StormMarkSummon.cs +++ b/Projectiles/Summon/StormMarkSummon.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Projectiles.Summon { public class StormMarkSummon : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } public override void SetDefaults() { @@ -20,145 +20,145 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.tileCollide = false; projectile.timeLeft = 900; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = -1; projectile.localNPCHitCooldown = 30 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); } public override void AI() { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); - Main.projectile[storm].minion = true; - Main.projectile[storm].melee = false; - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - return; - } + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); + Main.projectile[storm].minion = true; + Main.projectile[storm].melee = false; + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + return; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; } } } diff --git a/Projectiles/Summon/Urchin.cs b/Projectiles/Summon/Urchin.cs index d79fe81247..40694f219a 100644 --- a/Projectiles/Summon/Urchin.cs +++ b/Projectiles/Summon/Urchin.cs @@ -1,21 +1,21 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Urchin : ModProjectile { - public int dust = 3; + public int dust = 3; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } + } public override void SetDefaults() { @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.tileCollide = false; @@ -34,109 +34,109 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("Urchin"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.urchin) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.vUrchin = false; - } - if (modPlayer.vUrchin) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 179, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num508 = 300f; - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - flag18 = true; - } - } - } - if (flag18) - { - int num251 = Main.rand.Next(3, 7); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("UrchinSpike"), projectile.damage, 1f, projectile.owner, 0f, 0f); - Main.projectile[spore].minion = true; - Main.projectile[spore].minionSlots = 0f; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 42); - projectile.ai[0] = 60f; - } - } + bool flag64 = projectile.type == mod.ProjectileType("Urchin"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.urchin) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.vUrchin = false; + } + if (modPlayer.vUrchin) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 50; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 179, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num508 = 300f; + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + flag18 = true; + } + } + } + if (flag18) + { + int num251 = Main.rand.Next(3, 7); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("UrchinSpike"), projectile.damage, 1f, projectile.owner, 0f, 0f); + Main.projectile[spore].minion = true; + Main.projectile[spore].minionSlots = 0f; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 42); + projectile.ai[0] = 60f; + } + } } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() + { + return false; + } + } } diff --git a/Projectiles/Summon/UrchinSpike.cs b/Projectiles/Summon/UrchinSpike.cs index 5bd24cbed9..d9d98f5572 100644 --- a/Projectiles/Summon/UrchinSpike.cs +++ b/Projectiles/Summon/UrchinSpike.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Summon { public class UrchinSpike : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin Spike"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin Spike"); + } public override void SetDefaults() { @@ -26,12 +26,12 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Poisoned, 180); + target.AddBuff(BuffID.Poisoned, 180); } } } diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 9e221f1648..2cdf9ca333 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -1,22 +1,22 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Summon { public class Valkyrie : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Valkyrie"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Valkyrie"); + Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + } public override void SetDefaults() { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; @@ -37,258 +37,258 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == mod.ProjectileType("Valkyrie"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.valkyrie) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.aValkyrie = false; - } - if (modPlayer.aValkyrie) - { - projectile.timeLeft = 2; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 30; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 59, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - projectile.localAI[0] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0f * num, 0.2f * num, 0.45f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Valkyrie")); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 14) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + bool flag64 = projectile.type == mod.ProjectileType("Valkyrie"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.valkyrie) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.aValkyrie = false; + } + if (modPlayer.aValkyrie) + { + projectile.timeLeft = 2; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 30; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 59, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 700f; + float num634 = 800f; + float num635 = 1200f; + float num636 = 150f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 0f * num, 0.2f * num, 0.45f * num); + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Valkyrie")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (projectile.ai[0] != 1f) + { + projectile.tileCollide = false; + } + if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + { + projectile.tileCollide = false; + } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 14) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 8f; + projectile.netUpdate = true; + } + } + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + } } diff --git a/Projectiles/Summon/WaterSpearFriendly.cs b/Projectiles/Summon/WaterSpearFriendly.cs index 99f813c164..6e342f199d 100644 --- a/Projectiles/Summon/WaterSpearFriendly.cs +++ b/Projectiles/Summon/WaterSpearFriendly.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Summon { public class WaterSpearFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } public override void SetDefaults() { @@ -28,45 +28,45 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -76,16 +76,16 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/SunkenSea/AquaStream.cs b/Projectiles/SunkenSea/AquaStream.cs index a560d8437a..ce6d673ffa 100644 --- a/Projectiles/SunkenSea/AquaStream.cs +++ b/Projectiles/SunkenSea/AquaStream.cs @@ -5,37 +5,37 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class AquaStream : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aqua Stream"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aqua Stream"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.scale = 1f; - projectile.friendly = true; - projectile.alpha = 150; - projectile.penetrate = 1; - projectile.timeLeft = 14; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.scale = 1f; + projectile.friendly = true; + projectile.alpha = 150; + projectile.penetrate = 1; + projectile.timeLeft = 14; + projectile.melee = true; + } - public override void AI() - { - //projectile.ai[0] is the X increment while projectile.ai[1] is the Y increment - projectile.velocity.X += projectile.ai[0]; - projectile.velocity.Y += projectile.ai[1]; - if (Main.rand.NextFloat() < 1f) - { - Dust dust; - // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 position = projectile.Center; - dust = Terraria.Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f); - dust.noGravity = true; - } - } - } + public override void AI() + { + //projectile.ai[0] is the X increment while projectile.ai[1] is the Y increment + projectile.velocity.X += projectile.ai[0]; + projectile.velocity.Y += projectile.ai[1]; + if (Main.rand.NextFloat() < 1f) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center; + dust = Terraria.Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f); + dust.noGravity = true; + } + } + } } diff --git a/Projectiles/SunkenSea/AquamarineBolt.cs b/Projectiles/SunkenSea/AquamarineBolt.cs index b7e9348cce..e43dc92fad 100644 --- a/Projectiles/SunkenSea/AquamarineBolt.cs +++ b/Projectiles/SunkenSea/AquamarineBolt.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class AquamarineBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -24,22 +24,22 @@ namespace CalamityMod.Projectiles.SunkenSea public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1.5f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 68, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1.5f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 68, 0f, 0f, 100, default, 1f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/SunkenSea/Aquashard.cs b/Projectiles/SunkenSea/Aquashard.cs index fde06f2f19..e4070c795f 100644 --- a/Projectiles/SunkenSea/Aquashard.cs +++ b/Projectiles/SunkenSea/Aquashard.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class Aquashard : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquashard"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquashard"); + } public override void SetDefaults() { @@ -19,40 +19,40 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.ranged = true; projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.aiStyle = 1; + projectile.aiStyle = 1; } - public override void AI() + public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y = projectile.velocity.Y + 0.01f; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int num251 = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("AquashardSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } + int num251 = Main.rand.Next(2, 4); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("AquashardSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/SunkenSea/AquashardSplit.cs b/Projectiles/SunkenSea/AquashardSplit.cs index 8acdced332..f9a2c030f7 100644 --- a/Projectiles/SunkenSea/AquashardSplit.cs +++ b/Projectiles/SunkenSea/AquashardSplit.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class AquashardSplit : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquashard"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquashard"); + } public override void SetDefaults() { @@ -18,21 +18,21 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.ranged = true; projectile.penetrate = 3; projectile.timeLeft = 180; - projectile.aiStyle = 1; + projectile.aiStyle = 1; } public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y = projectile.velocity.Y + 0.01f; } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/SunkenSea/ClamCrusherFlail.cs b/Projectiles/SunkenSea/ClamCrusherFlail.cs index d9284c6a60..705caa6437 100644 --- a/Projectiles/SunkenSea/ClamCrusherFlail.cs +++ b/Projectiles/SunkenSea/ClamCrusherFlail.cs @@ -1,208 +1,208 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.SunkenSea { public class ClamCrusherFlail : ModProjectile - { - public int finalDamage; + { + public int finalDamage; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clam Crusher"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clam Crusher"); + } - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 74; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.Calamity().trueMelee = true; - } + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 74; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.Calamity().trueMelee = true; + } - public override void AI() - { - projectile.ai[1] += 1f; - if (projectile.ai[1] == 1f) - { - finalDamage = (int)(projectile.damage * 2.5f); - } - if (projectile.ai[1] >= 5f && (projectile.ai[1] <= 10f)) - { - for (int num105 = 0; num105 < 10; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int waterDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); - Main.dust[waterDust].noGravity = true; - Main.dust[waterDust].velocity *= 0.1f; - Main.dust[waterDust].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[waterDust]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[waterDust]; - expr_4815_cp_0.position.Y -= num100; - } - } - if (projectile.ai[1] == 5f) - { - projectile.tileCollide = true; - } - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; - if (vector62.X < 0f) - { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; - } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); - if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) - { - projectile.velocity.Y += 1f; - projectile.velocity.X *= 0.995f; - projectile.damage = finalDamage; - } - if (projectile.ai[0] == 0f && vector62.Length() > 1000f) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) - { - float num693 = vector62.Length(); - if (num693 > 1500f) - { - projectile.Kill(); - return; - } - if (num693 > 600f) - { - projectile.ai[0] = 2f; - } - projectile.tileCollide = false; - float num694 = 20f; - if (projectile.ai[0] == 2f) - { - num694 = 40f; - } - projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) - { - projectile.Kill(); - return; - } - } - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - } + public override void AI() + { + projectile.ai[1] += 1f; + if (projectile.ai[1] == 1f) + { + finalDamage = (int)(projectile.damage * 2.5f); + } + if (projectile.ai[1] >= 5f && (projectile.ai[1] <= 10f)) + { + for (int num105 = 0; num105 < 10; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int waterDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].velocity *= 0.1f; + Main.dust[waterDust].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[waterDust]; + expr_47FA_cp_0.position.X -= num99; + Dust expr_4815_cp_0 = Main.dust[waterDust]; + expr_4815_cp_0.position.Y -= num100; + } + } + if (projectile.ai[1] == 5f) + { + projectile.tileCollide = true; + } + Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; + projectile.rotation = vector62.ToRotation() - 1.57f; + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + Main.player[projectile.owner].itemAnimation = 10; + Main.player[projectile.owner].itemTime = 10; + float arg_1DC8F_0 = vector62.X; + if (vector62.X < 0f) + { + Main.player[projectile.owner].ChangeDir(1); + projectile.direction = 1; + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + projectile.direction = -1; + } + Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); + projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); + if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + { + projectile.velocity.Y += 1f; + projectile.velocity.X *= 0.995f; + projectile.damage = finalDamage; + } + if (projectile.ai[0] == 0f && vector62.Length() > 1000f) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + { + float num693 = vector62.Length(); + if (num693 > 1500f) + { + projectile.Kill(); + return; + } + if (num693 > 600f) + { + projectile.ai[0] = 2f; + } + projectile.tileCollide = false; + float num694 = 20f; + if (projectile.ai[0] == 2f) + { + num694 = 40f; + } + projectile.velocity = Vector2.Normalize(vector62) * num694; + if (vector62.Length() < num694) + { + projectile.Kill(); + return; + } + } + float[] var_2_1DE21_cp_0 = projectile.ai; + int var_2_1DE21_cp_1 = 1; + float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; + var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.ai[1] >= 5f) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); - for (int num105 = 0; num105 < 50; num105++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int waterDust = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width / 2, projectile.height / 2, 33, value15.X, value15.Y, 0, new Color(0, 142, 255), 1.5f); - Main.dust[waterDust].velocity *= 2f; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.ai[1] >= 5f) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); + for (int num105 = 0; num105 < 50; num105++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int waterDust = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width / 2, projectile.height / 2, 33, value15.X, value15.Y, 0, new Color(0, 142, 255), 1.5f); + Main.dust[waterDust].velocity *= 2f; + } + } + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/ClamCrusherChain"); - Vector2 vector17 = projectile.Center; - Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) - { - flag13 = false; - } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) - { - flag13 = false; - } - while (flag13) - { - if (vector18.Length() < num91 + 1f) - { - flag13 = false; - } - else - { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); - } - } - return true; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/ClamCrusherChain"); + Vector2 vector17 = projectile.Center; + Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); + float num91 = (float)texture2D2.Height; + Vector2 vector18 = mountedCenter - vector17; + float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; + bool flag13 = true; + if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + { + flag13 = false; + } + if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + { + flag13 = false; + } + while (flag13) + { + if (vector18.Length() < num91 + 1f) + { + flag13 = false; + } + else + { + Vector2 value2 = vector18; + value2.Normalize(); + vector17 += value2 * num91; + vector18 = mountedCenter - vector17; + Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); + } + } + return true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (target.rarity != 2) - { - target.AddBuff(mod.BuffType("SilvaStun"), 60); - } - else if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) - { - target.AddBuff(mod.BuffType("SilvaStun"), 30); - } - } - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (target.rarity != 2) + { + target.AddBuff(mod.BuffType("SilvaStun"), 60); + } + else if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + { + target.AddBuff(mod.BuffType("SilvaStun"), 30); + } + } + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); + } + } } diff --git a/Projectiles/SunkenSea/ClamorRifleProj.cs b/Projectiles/SunkenSea/ClamorRifleProj.cs index 7d9f34e45b..7f6d2d05a1 100644 --- a/Projectiles/SunkenSea/ClamorRifleProj.cs +++ b/Projectiles/SunkenSea/ClamorRifleProj.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class ClamorRifleProj : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Energy Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Bolt"); + } public override void SetDefaults() { @@ -25,52 +25,52 @@ namespace CalamityMod.Projectiles.SunkenSea public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 300f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 25f + num484) / 26f; - projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 3f) + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 300f; + bool homeIn = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 25f + num484) / 26f; + projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -80,24 +80,24 @@ namespace CalamityMod.Projectiles.SunkenSea return false; } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { - int num251 = Main.rand.Next(2, 3); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("ClamorRifleProjSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); + int num251 = Main.rand.Next(2, 3); + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("ClamorRifleProjSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); } } } diff --git a/Projectiles/SunkenSea/ClamorRifleProjSplit.cs b/Projectiles/SunkenSea/ClamorRifleProjSplit.cs index 8d4501c432..4e3a63796c 100644 --- a/Projectiles/SunkenSea/ClamorRifleProjSplit.cs +++ b/Projectiles/SunkenSea/ClamorRifleProjSplit.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class ClamorRifleProjSplit : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Energy Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Bolt"); + } public override void SetDefaults() { @@ -24,15 +24,15 @@ namespace CalamityMod.Projectiles.SunkenSea public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/SunkenSea/CoralBubble.cs b/Projectiles/SunkenSea/CoralBubble.cs index 9a50c7b27d..9cf8381eab 100644 --- a/Projectiles/SunkenSea/CoralBubble.cs +++ b/Projectiles/SunkenSea/CoralBubble.cs @@ -8,9 +8,9 @@ namespace CalamityMod.Projectiles.SunkenSea { public class CoralBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); } public override void SetDefaults() @@ -23,52 +23,52 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.penetrate = 1; } - public override void AI() - { - if (projectile.localAI[0] > 2f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - else - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[1] > 30f) - { - if (projectile.velocity.Y > -1.5f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - } - else - { - projectile.ai[1] += 1f; - } - if (projectile.wet) - { - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y > -1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - } - int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; - if (projectile.Distance(Main.player[closestPlayer].Center) < 14f) - { - Main.player[closestPlayer].AddBuff(BuffID.Gills, 90); - projectile.Kill(); - } - } + public override void AI() + { + if (projectile.localAI[0] > 2f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[1] > 30f) + { + if (projectile.velocity.Y > -1.5f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + } + else + { + projectile.ai[1] += 1f; + } + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + } + int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; + if (projectile.Distance(Main.player[closestPlayer].Center) < 14f) + { + Main.player[closestPlayer].AddBuff(BuffID.Gills, 90); + projectile.Kill(); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture2D13 = Main.projectileTexture[projectile.type]; int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; @@ -83,14 +83,14 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.position = projectile.Center; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } - } + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + } } } diff --git a/Projectiles/SunkenSea/CoralBubbleSmall.cs b/Projectiles/SunkenSea/CoralBubbleSmall.cs index b0d03a7d83..e2602250f1 100644 --- a/Projectiles/SunkenSea/CoralBubbleSmall.cs +++ b/Projectiles/SunkenSea/CoralBubbleSmall.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Projectiles.SunkenSea { public class CoralBubbleSmall : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); } public override void SetDefaults() @@ -23,50 +23,50 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.penetrate = 1; } - public override void AI() - { - if (projectile.localAI[0] > 2f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - else - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[1] > 30f) - { - if (projectile.velocity.Y > -1.5f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - } - else - { - projectile.ai[1] += 1f; - } - if (projectile.wet) - { - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y > -1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - } - int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; - if (projectile.Distance(Main.player[closestPlayer].Center) < 7f) - { - Main.player[closestPlayer].AddBuff(BuffID.Gills, 30); - projectile.Kill(); - } - } + public override void AI() + { + if (projectile.localAI[0] > 2f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[1] > 30f) + { + if (projectile.velocity.Y > -1.5f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + } + else + { + projectile.ai[1] += 1f; + } + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + } + int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; + if (projectile.Distance(Main.player[closestPlayer].Center) < 7f) + { + Main.player[closestPlayer].AddBuff(BuffID.Gills, 30); + projectile.Kill(); + } + } public override void Kill(int timeLeft) { @@ -74,14 +74,14 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.position = projectile.Center; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } - } + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + } } } diff --git a/Projectiles/SunkenSea/EutrophicScimitarProj.cs b/Projectiles/SunkenSea/EutrophicScimitarProj.cs index a936e90f37..5f7c483bd5 100644 --- a/Projectiles/SunkenSea/EutrophicScimitarProj.cs +++ b/Projectiles/SunkenSea/EutrophicScimitarProj.cs @@ -1,80 +1,80 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.SunkenSea { class EutrophicScimitarProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scimitar Zap"); - Main.projFrames[projectile.type] = 3; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scimitar Zap"); + Main.projFrames[projectile.type] = 3; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.melee = true; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(127, 255, 253); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(127, 255, 253); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.rarity != 2 && !CalamityPlayer.areThereAnyDamnBosses) - { - target.AddBuff(mod.BuffType("SilvaStun"), 15); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.rarity != 2 && !CalamityPlayer.areThereAnyDamnBosses) + { + target.AddBuff(mod.BuffType("SilvaStun"), 15); + } + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.velocity.X < 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - else - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - if (Main.rand.NextBool(2)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 226, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.velocity.X < 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + else + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + if (Main.rand.NextBool(2)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 226, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust dust; - Vector2 position = new Vector2(projectile.position.X - 4, projectile.position.Y - 4); - dust = Main.dust[Terraria.Dust.NewDust(position, 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; - dust.noGravity = true; - dust.fadeIn = 0.9473684f; - } - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust dust; + Vector2 position = new Vector2(projectile.position.X - 4, projectile.position.Y - 4); + dust = Main.dust[Terraria.Dust.NewDust(position, 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; + dust.noGravity = true; + dust.fadeIn = 0.9473684f; + } + } + } } diff --git a/Projectiles/SunkenSea/EutrophicSpark.cs b/Projectiles/SunkenSea/EutrophicSpark.cs index a1142325bb..7de8f307ba 100644 --- a/Projectiles/SunkenSea/EutrophicSpark.cs +++ b/Projectiles/SunkenSea/EutrophicSpark.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class EutrophicSpark : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eutrophic Spark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eutrophic Spark"); + } public override void SetDefaults() { @@ -19,69 +19,69 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.penetrate = 2; projectile.timeLeft = 30; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.melee = true; + projectile.localNPCHitCooldown = 15; + projectile.melee = true; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/SunkenSea/PearlBurst.cs b/Projectiles/SunkenSea/PearlBurst.cs index 20f5e87305..a9775e7395 100644 --- a/Projectiles/SunkenSea/PearlBurst.cs +++ b/Projectiles/SunkenSea/PearlBurst.cs @@ -1,86 +1,86 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class PearlBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pearl Burst"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pearl Burst"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 64; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 64; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - projectile.alpha -= 6; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) - { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - { - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - } - else if (projectile.ai[1] == 40f) - { - projectile.ai[1] = 0f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 92, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + projectile.alpha -= 6; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 20f) + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + } + else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + { + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + } + else if (projectile.ai[1] == 40f) + { + projectile.ai[1] = 0f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + projectile.localAI[0] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 92, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255); + } + } } diff --git a/Projectiles/SunkenSea/PearlRain.cs b/Projectiles/SunkenSea/PearlRain.cs index ccf8e197f4..ba16725969 100644 --- a/Projectiles/SunkenSea/PearlRain.cs +++ b/Projectiles/SunkenSea/PearlRain.cs @@ -1,54 +1,54 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class PearlRain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pearl Rain"); - Main.projFrames[projectile.type] = 4; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pearl Rain"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 64; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; - } + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 64; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - projectile.alpha -= 6; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + projectile.alpha -= 6; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255); + } + } } diff --git a/Projectiles/SunkenSea/PendantProjectile1.cs b/Projectiles/SunkenSea/PendantProjectile1.cs index 606831233e..9cae36610f 100644 --- a/Projectiles/SunkenSea/PendantProjectile1.cs +++ b/Projectiles/SunkenSea/PendantProjectile1.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class PendantProjectile1 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism Shard"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shard"); + } public override void SetDefaults() { @@ -24,15 +24,15 @@ namespace CalamityMod.Projectiles.SunkenSea public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.rotation += projectile.velocity.X * 1.25f; + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } } } diff --git a/Projectiles/SunkenSea/PendantProjectile2.cs b/Projectiles/SunkenSea/PendantProjectile2.cs index 4d441dfa79..8829e59a07 100644 --- a/Projectiles/SunkenSea/PendantProjectile2.cs +++ b/Projectiles/SunkenSea/PendantProjectile2.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class PendantProjectile2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism Shard"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shard"); + } public override void SetDefaults() { @@ -24,15 +24,15 @@ namespace CalamityMod.Projectiles.SunkenSea public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.rotation += projectile.velocity.X * 1.25f; + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } } } diff --git a/Projectiles/SunkenSea/PendantProjectile3.cs b/Projectiles/SunkenSea/PendantProjectile3.cs index f3c783f416..bb28976649 100644 --- a/Projectiles/SunkenSea/PendantProjectile3.cs +++ b/Projectiles/SunkenSea/PendantProjectile3.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class PendantProjectile3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism Shard"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shard"); + } public override void SetDefaults() { @@ -24,15 +24,15 @@ namespace CalamityMod.Projectiles.SunkenSea public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.rotation += projectile.velocity.X * 1.25f; + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } } } diff --git a/Projectiles/SunkenSea/PoseidonTyphoon.cs b/Projectiles/SunkenSea/PoseidonTyphoon.cs index 117ffd778e..1635d03d94 100644 --- a/Projectiles/SunkenSea/PoseidonTyphoon.cs +++ b/Projectiles/SunkenSea/PoseidonTyphoon.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class PoseidonTyphoon : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Poseidon Typhoon"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Poseidon Typhoon"); + } public override void SetDefaults() { @@ -24,42 +24,42 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.ignoreWater = true; } - public override void AI() + public override void AI() { - projectile.rotation += projectile.velocity.X * 0.05f; - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 6f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; - projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; - } + projectile.rotation += projectile.velocity.X * 0.05f; + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 600f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 6f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; + projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; + } } public override void Kill(int timeLeft) @@ -69,12 +69,12 @@ namespace CalamityMod.Projectiles.SunkenSea public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, 0); + return new Color(200, 200, 200, 0); } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; + projectile.penetrate--; if (projectile.penetrate <= 0) { projectile.Kill(); diff --git a/Projectiles/SunkenSea/Prismalline.cs b/Projectiles/SunkenSea/Prismalline.cs index b7b17607a4..cea1abab7c 100644 --- a/Projectiles/SunkenSea/Prismalline.cs +++ b/Projectiles/SunkenSea/Prismalline.cs @@ -1,89 +1,89 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class Prismalline : ModProjectile - { - public bool hitEnemy = false; + { + public bool hitEnemy = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 180; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 113; + projectile.timeLeft = 180; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 40f) - { - int numProj = 4; - int numSpecProj = 0; - float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - speed.Normalize(); - speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2f; - if (numSpecProj < 2 && !hitEnemy) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline3"), (int)((double)projectile.damage * 1.25), projectile.knockBack, projectile.owner, 0f, 0f); - ++numSpecProj; - } - else - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 40f) + { + int numProj = 4; + int numSpecProj = 0; + float rotation = MathHelper.ToRadians(50); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (speed.X == 0f && speed.Y == 0f) + { + speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + speed.Normalize(); + speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2f; + if (numSpecProj < 2 && !hitEnemy) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline3"), (int)((double)projectile.damage * 1.25), projectile.knockBack, projectile.owner, 0f, 0f); + ++numSpecProj; + } + else + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - hitEnemy = true; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + hitEnemy = true; + } + } } diff --git a/Projectiles/SunkenSea/Prismalline2.cs b/Projectiles/SunkenSea/Prismalline2.cs index e48ccdc815..fff9ee144d 100644 --- a/Projectiles/SunkenSea/Prismalline2.cs +++ b/Projectiles/SunkenSea/Prismalline2.cs @@ -1,52 +1,52 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class Prismalline2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 60; - aiType = 598; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 60; + aiType = 598; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/SunkenSea/Prismalline3.cs b/Projectiles/SunkenSea/Prismalline3.cs index ac8bdcac09..d453815294 100644 --- a/Projectiles/SunkenSea/Prismalline3.cs +++ b/Projectiles/SunkenSea/Prismalline3.cs @@ -1,84 +1,84 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class Prismalline3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 300f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 300f; + bool homeIn = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } diff --git a/Projectiles/SunkenSea/SeafoamBomb.cs b/Projectiles/SunkenSea/SeafoamBomb.cs index 2f0d1f70c6..638c2c947e 100644 --- a/Projectiles/SunkenSea/SeafoamBomb.cs +++ b/Projectiles/SunkenSea/SeafoamBomb.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class SeafoamBomb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seafoam Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seafoam Bomb"); + } public override void SetDefaults() { @@ -18,30 +18,30 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 240; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } - public override void AI() + public override void AI() { - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.velocity.X = projectile.velocity.X * 0.99f; + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + projectile.velocity.X = projectile.velocity.X * 0.99f; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 128); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SeafoamBubble"), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); - for (int num625 = 0; num625 < 3; num625++) + projectile.position = projectile.Center; + projectile.width = (projectile.height = 128); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SeafoamBubble"), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + for (int num625 = 0; num625 < 3; num625++) { float scaleFactor10 = 0.33f; if (num625 == 1) diff --git a/Projectiles/SunkenSea/SeafoamBubble.cs b/Projectiles/SunkenSea/SeafoamBubble.cs index 13945bceab..9962919aac 100644 --- a/Projectiles/SunkenSea/SeafoamBubble.cs +++ b/Projectiles/SunkenSea/SeafoamBubble.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class SeafoamBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seafoam Bubble"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seafoam Bubble"); + } public override void SetDefaults() { @@ -19,34 +19,34 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.friendly = true; projectile.penetrate = 3; projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.scale = 1f; - projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; - } + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.scale = 1f; + projectile.localNPCHitCooldown = 30; + projectile.Calamity().rogue = true; + } - public override void AI() + public override void AI() { - projectile.ai[0] += 1f; - if(projectile.alpha < 50) - { - projectile.alpha = 50; - } - else if(projectile.alpha > 50) - { - projectile.alpha -= 10; - } - projectile.scale += 0.002f; - if( projectile.ai[0] % 60 == 0) - { - projectile.damage *= 2; - } + projectile.ai[0] += 1f; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + else if (projectile.alpha > 50) + { + projectile.alpha -= 10; + } + projectile.scale += 0.002f; + if (projectile.ai[0] % 60 == 0) + { + projectile.damage *= 2; + } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + Main.PlaySound(SoundID.Item54, projectile.position); projectile.position = projectile.Center; projectile.width = (projectile.height = 60); projectile.position.X = projectile.position.X - (float)(projectile.width / 2); diff --git a/Projectiles/SunkenSea/SeashineSwordProj.cs b/Projectiles/SunkenSea/SeashineSwordProj.cs index b90ee35b4b..e6eaabe448 100644 --- a/Projectiles/SunkenSea/SeashineSwordProj.cs +++ b/Projectiles/SunkenSea/SeashineSwordProj.cs @@ -6,39 +6,39 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { class SeashineSwordProj : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; - } + { + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.melee = true; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(127, 255, 253); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(127, 255, 253); + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - if (Main.rand.NextBool(2)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + if (Main.rand.NextBool(2)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); + } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); + } + } + } } diff --git a/Projectiles/SunkenSea/SerpentineBody.cs b/Projectiles/SunkenSea/SerpentineBody.cs index 8665e8bb0e..54ef6d703c 100644 --- a/Projectiles/SunkenSea/SerpentineBody.cs +++ b/Projectiles/SunkenSea/SerpentineBody.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class SerpentineBody : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Serpentine"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Serpentine"); + } public override void SetDefaults() { @@ -17,79 +17,79 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.height = 16; projectile.friendly = true; projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.tileCollide = false; + projectile.netImportant = true; + projectile.tileCollide = false; projectile.alpha = 255; projectile.penetrate = -1; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + projectile.localNPCHitCooldown = 20; } public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); - int num1051 = 10; - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - for (int k = 0; k < 8; k++) - { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - } - projectile.active = false; - projectile.Kill(); - return; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - return; - } - } + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); + int num1051 = 10; + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + for (int k = 0; k < 8; k++) + { + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + } + projectile.active = false; + projectile.Kill(); + return; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + return; + } + } } diff --git a/Projectiles/SunkenSea/SerpentineHead.cs b/Projectiles/SunkenSea/SerpentineHead.cs index 01d0f9a156..221d454df5 100644 --- a/Projectiles/SunkenSea/SerpentineHead.cs +++ b/Projectiles/SunkenSea/SerpentineHead.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,72 +7,72 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class SerpentineHead : ModProjectile - { + { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Serpentine"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Serpentine"); + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = 5; - projectile.timeLeft = 600; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.penetrate = 5; + projectile.timeLeft = 600; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); - if (projectile.alpha > 0) - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); + if (projectile.alpha > 0) + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[num114]; dust.velocity *= 0.3f; Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); Main.dust[num114].noGravity = true; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - int direction = projectile.direction; - projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); - if (direction != projectile.direction) - { - projectile.netUpdate = true; - } - float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); - projectile.position = projectile.Center; - projectile.scale = 1f + num1061 * 0.01f; - projectile.width = (projectile.height = (int)(10 * projectile.scale)); - projectile.Center = projectile.position; + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + int direction = projectile.direction; + projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); + if (direction != projectile.direction) + { + projectile.netUpdate = true; + } + float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); + projectile.position = projectile.Center; + projectile.scale = 1f + num1061 * 0.01f; + projectile.width = (projectile.height = (int)(10 * projectile.scale)); + projectile.Center = projectile.position; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - } - else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.3f; - } - else if (projectile.ai[0] >= 60f) - { - projectile.ai[0] = 0f; - } - if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.3f; + } + else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.3f; + } + else if (projectile.ai[0] >= 60f) + { + projectile.ai[0] = 0f; + } + if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) { if (Main.player[projectile.owner].channel) { @@ -155,20 +155,20 @@ namespace CalamityMod.Projectiles.SunkenSea { projectile.velocity.Y = 16f; } - } + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int k = 0; k < 8; k++) + Main.PlaySound(SoundID.Item10, projectile.position); + for (int k = 0; k < 8; k++) { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; } } - } + } } diff --git a/Projectiles/SunkenSea/SerpentineTail.cs b/Projectiles/SunkenSea/SerpentineTail.cs index 92f97bac9e..60c4c38733 100644 --- a/Projectiles/SunkenSea/SerpentineTail.cs +++ b/Projectiles/SunkenSea/SerpentineTail.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.SunkenSea { public class SerpentineTail : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Serpentine"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Serpentine"); + } public override void SetDefaults() { @@ -18,78 +18,78 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.friendly = true; projectile.ignoreWater = true; projectile.netImportant = true; - projectile.tileCollide = false; - projectile.alpha = 255; + projectile.tileCollide = false; + projectile.alpha = 255; projectile.penetrate = -1; - projectile.magic = true; + projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + projectile.localNPCHitCooldown = 20; } public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - int num1051 = 10; - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - for (int k = 0; k < 8; k++) - { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - } - projectile.active = false; - projectile.Kill(); - return; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - return; - } - } + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + int num1051 = 10; + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + for (int k = 0; k < 8; k++) + { + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + } + projectile.active = false; + projectile.Kill(); + return; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + return; + } + } } diff --git a/Projectiles/SunkenSea/Shellfish.cs b/Projectiles/SunkenSea/Shellfish.cs index f4d241eb4f..2104af7691 100644 --- a/Projectiles/SunkenSea/Shellfish.cs +++ b/Projectiles/SunkenSea/Shellfish.cs @@ -1,478 +1,478 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.SunkenSea { public class Shellfish : ModProjectile - { - private int playerStill = 0; - private bool fly = false; - private bool spawnDust = true; + { + private int playerStill = 0; + private bool fly = false; + private bool spawnDust = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shellfish"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shellfish"); + Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 24; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 2; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 24; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 2; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } - public override void AI() - { - if (spawnDust) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 20; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - spawnDust = false; - } - bool flag64 = projectile.type == mod.ProjectileType("Shellfish"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(mod.BuffType("Shellfish"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.shellfish = false; - } - if (modPlayer.shellfish) - { - projectile.timeLeft = 2; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.damage = 70; - if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - float[] var0 = projectile.ai; - int var1 = 1; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - Vector2 vector46 = projectile.position; - if (!fly) - { - projectile.tileCollide = true; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0f && (projectile.velocity.X != 0f || playerDistance > 200f)) - { - switch (Main.rand.Next(1, 3)) - { + public override void AI() + { + if (spawnDust) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 20; + for (int num502 = 0; num502 < num501; num502++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + spawnDust = false; + } + bool flag64 = projectile.type == mod.ProjectileType("Shellfish"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(mod.BuffType("Shellfish"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.shellfish = false; + } + if (modPlayer.shellfish) + { + projectile.timeLeft = 2; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.damage = 70; + if (Main.player[projectile.owner].minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + float[] var0 = projectile.ai; + int var1 = 1; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + Vector2 vector46 = projectile.position; + if (!fly) + { + projectile.tileCollide = true; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0f && (projectile.velocity.X != 0f || playerDistance > 200f)) + { + switch (Main.rand.Next(1, 3)) + { - case 1: - projectile.velocity.Y -= 5f; - break; + case 1: + projectile.velocity.Y -= 5f; + break; - case 2: - projectile.velocity.Y -= 7.5f; - break; + case 2: + projectile.velocity.Y -= 7.5f; + break; - case 3: - projectile.velocity.Y -= 10f; - break; - } - } - projectile.velocity.Y += 0.3f; - float num633 = 1000f; - bool chaseNPC = false; - float npcPositionX = 0f; - for (int num645 = 0; num645 < 200; num645++) - { - NPC npcTarget = Main.npc[num645]; - if (npcTarget.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) - { - num633 = num646; - vector46 = npcTarget.Center; - npcPositionX = npcTarget.position.X; - chaseNPC = true; - } - } - } - if (chaseNPC) - { - if (npcPositionX - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 2)) - { + case 3: + projectile.velocity.Y -= 10f; + break; + } + } + projectile.velocity.Y += 0.3f; + float num633 = 1000f; + bool chaseNPC = false; + float npcPositionX = 0f; + for (int num645 = 0; num645 < 200; num645++) + { + NPC npcTarget = Main.npc[num645]; + if (npcTarget.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) + { + num633 = num646; + vector46 = npcTarget.Center; + npcPositionX = npcTarget.position.X; + chaseNPC = true; + } + } + } + if (chaseNPC) + { + if (npcPositionX - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 2)) + { - case 1: - projectile.velocity.X += 0.15f; - break; + case 1: + projectile.velocity.X += 0.15f; + break; - case 2: - projectile.velocity.X += 0.20f; - break; - } + case 2: + projectile.velocity.X += 0.20f; + break; + } - if (projectile.velocity.X > 8f) - { - projectile.velocity.X = 8f; - } - } - else - { - switch (Main.rand.Next(1, 2)) - { + if (projectile.velocity.X > 8f) + { + projectile.velocity.X = 8f; + } + } + else + { + switch (Main.rand.Next(1, 2)) + { - case 1: - projectile.velocity.X -= 0.15f; - break; + case 1: + projectile.velocity.X -= 0.15f; + break; - case 2: - projectile.velocity.X -= 0.20f; - break; - } + case 2: + projectile.velocity.X -= 0.20f; + break; + } - if (projectile.velocity.X < -8f) - { - projectile.velocity.X = -8f; - } - } - } - else - { - if (playerDistance > 800f) - { - fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; - } - if (playerDistance > 200f) - { - if (player.position.X - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; + if (projectile.velocity.X < -8f) + { + projectile.velocity.X = -8f; + } + } + } + else + { + if (playerDistance > 800f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 200f) + { + if (player.position.X - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; - case 2: - projectile.velocity.X += 0.10f; - break; + case 2: + projectile.velocity.X += 0.10f; + break; - case 3: - projectile.velocity.X += 0.15f; - break; - } + case 3: + projectile.velocity.X += 0.15f; + break; + } - if (projectile.velocity.X > 6f) - { - projectile.velocity.X = 6f; - } - } - else - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; + if (projectile.velocity.X > 6f) + { + projectile.velocity.X = 6f; + } + } + else + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; - case 2: - projectile.velocity.X -= 0.10f; - break; + case 2: + projectile.velocity.X -= 0.10f; + break; - case 3: - projectile.velocity.X -= 0.15f; - break; - } + case 3: + projectile.velocity.X -= 0.15f; + break; + } - if (projectile.velocity.X < -6f) - { - projectile.velocity.X = -6f; - } - } - } - if (playerDistance < 200f) - { - if (projectile.velocity.X != 0f) - { - if (projectile.velocity.X > 0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; + if (projectile.velocity.X < -6f) + { + projectile.velocity.X = -6f; + } + } + } + if (playerDistance < 200f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; - case 2: - projectile.velocity.X -= 0.10f; - break; + case 2: + projectile.velocity.X -= 0.10f; + break; - case 3: - projectile.velocity.X -= 0.15f; - break; - } - } - else if (projectile.velocity.X < -0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; + case 3: + projectile.velocity.X -= 0.15f; + break; + } + } + else if (projectile.velocity.X < -0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; - case 2: - projectile.velocity.X += 0.10f; - break; + case 2: + projectile.velocity.X += 0.10f; + break; - case 3: - projectile.velocity.X += 0.15f; - break; - } - } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) - { - projectile.velocity.X = 0f; - } - } - } - } - } - else if (fly) - { - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); - float playerDistance = vector48.Length(); - vector48.Normalize(); - vector48 *= 14f; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + case 3: + projectile.velocity.X += 0.15f; + break; + } + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + } + } + else if (fly) + { + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); + float playerDistance = vector48.Length(); + vector48.Normalize(); + vector48 *= 14f; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - projectile.rotation = projectile.velocity.X * 0.03f; - if (playerDistance > 1500f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (playerDistance < 100f) - { - if (player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; - projectile.velocity.X *= 0.30f; - projectile.velocity.Y *= 0.30f; - } - } - } - if ((double)projectile.velocity.X > 0.25) - { - projectile.spriteDirection = -1; - } - else if ((double)projectile.velocity.X < -0.25) - { - projectile.spriteDirection = 1; - } - } - if (projectile.ai[0] == 1f) - { - projectile.rotation = 0; - projectile.tileCollide = false; - int num988 = 10; - bool flag54 = false; - bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60000 * num988)) //tryna make it stay on there "forever" without glitching - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage && Main.npc[num989].defense < 9999) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.ai[0] = 0f; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - } - } - } + projectile.rotation = projectile.velocity.X * 0.03f; + if (playerDistance > 1500f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + projectile.rotation = 0; + projectile.velocity.X *= 0.30f; + projectile.velocity.Y *= 0.30f; + } + } + } + if ((double)projectile.velocity.X > 0.25) + { + projectile.spriteDirection = -1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.spriteDirection = 1; + } + } + if (projectile.ai[0] == 1f) + { + projectile.rotation = 0; + projectile.tileCollide = false; + int num988 = 10; + bool flag54 = false; + bool flag55 = false; + float[] var0 = projectile.localAI; + int var1 = 0; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60000 * num988)) //tryna make it stay on there "forever" without glitching + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage && Main.npc[num989].defense < 9999) + { + projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[num989].gfxOffY; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.ai[0] = 0f; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + } + } + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage && Main.npc[i].defense < 9999)) && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 10; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage && Main.npc[i].defense < 9999)) && + ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || + (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 10; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.buffImmune[mod.BuffType("ShellfishEating")] = false; - if (target.type == mod.NPCType("CeaselessVoid") || target.type == mod.NPCType("EidolonWyrmHeadHuge")) - { - target.buffImmune[mod.BuffType("ShellfishEating")] = true; - } - target.AddBuff(mod.BuffType("ShellfishEating"), 600000); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.buffImmune[mod.BuffType("ShellfishEating")] = false; + if (target.type == mod.NPCType("CeaselessVoid") || target.type == mod.NPCType("EidolonWyrmHeadHuge")) + { + target.buffImmune[mod.BuffType("ShellfishEating")] = true; + } + target.AddBuff(mod.BuffType("ShellfishEating"), 600000); + } + } } diff --git a/Projectiles/SunkenSea/WhirlpoolProjectile.cs b/Projectiles/SunkenSea/WhirlpoolProjectile.cs index debfd31f96..deda3ccd4a 100644 --- a/Projectiles/SunkenSea/WhirlpoolProjectile.cs +++ b/Projectiles/SunkenSea/WhirlpoolProjectile.cs @@ -5,58 +5,58 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.SunkenSea { public class WhirlpoolProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Riptide"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Riptide"); + } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.alpha = 150; - projectile.penetrate = -1; - projectile.timeLeft = 99; - projectile.melee = true; - aiType = ProjectileID.Amarok; - projectile.CloneDefaults(ProjectileID.CorruptYoyo); - } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.scale = 0.75f; + projectile.friendly = true; + projectile.alpha = 150; + projectile.penetrate = -1; + projectile.timeLeft = 99; + projectile.melee = true; + aiType = ProjectileID.Amarok; + projectile.CloneDefaults(ProjectileID.CorruptYoyo); + } - public override void AI() - { - if (Main.rand.Next(1, 51) == 1) - { - switch (Main.rand.Next(1, 9)) - { - case 1: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); - break; - case 2: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, -5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); - break; - case 3: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 10, 0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); - break; - case 4: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); - break; - case 5: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0, 10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); - break; - case 6: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); - break; - case 7: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); - break; - case 8: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); - break; - } - } - } - } + public override void AI() + { + if (Main.rand.Next(1, 51) == 1) + { + switch (Main.rand.Next(1, 9)) + { + case 1: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); + break; + case 2: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, -5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); + break; + case 3: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 10, 0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); + break; + case 4: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); + break; + case 5: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0, 10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); + break; + case 6: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); + break; + case 7: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); + break; + case 8: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); + break; + } + } + } + } } diff --git a/Projectiles/Typeless/AstralFallingSand.cs b/Projectiles/Typeless/AstralFallingSand.cs index 2a0ea06f56..188866f137 100644 --- a/Projectiles/Typeless/AstralFallingSand.cs +++ b/Projectiles/Typeless/AstralFallingSand.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Projectiles.Typeless } if (!Main.tile[tileX, tileY].active()) { - if (Main.tile[tileX, tileY].type == TileID.MinecartTrack) return; + if (Main.tile[tileX, tileY].type == TileID.MinecartTrack) + return; WorldGen.PlaceTile(tileX, tileY, mod.TileType("AstralSand"), false, true); WorldGen.SquareTileFrame(tileX, tileY); diff --git a/Projectiles/Typeless/AstralSpray.cs b/Projectiles/Typeless/AstralSpray.cs index 8f352de942..1fe5438b5a 100644 --- a/Projectiles/Typeless/AstralSpray.cs +++ b/Projectiles/Typeless/AstralSpray.cs @@ -1,11 +1,9 @@  +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; - -using CalamityMod.World; - namespace CalamityMod.Projectiles.Typeless { public class AstralSpray : ModProjectile @@ -34,7 +32,7 @@ namespace CalamityMod.Projectiles.Typeless { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); - WorldGenerationMethods.ConvertToAstral(x - 1, x + 1, y - 1, y + 1); + WorldGenerationMethods.ConvertToAstral(x - 1, x + 1, y - 1, y + 1); } if (projectile.timeLeft > 133) { diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 192f665445..a2397a20a4 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,14 +9,14 @@ namespace CalamityMod.Projectiles.Typeless { public class AstralStar : ModProjectile { - private int noTileHitCounter = 120; + private int noTileHitCounter = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -26,113 +26,113 @@ namespace CalamityMod.Projectiles.Typeless projectile.alpha = 50; projectile.penetrate = 1; projectile.tileCollide = false; - } + } public override void AI() { - if (projectile.ai[0] == 2f) - { - projectile.Calamity().rogue = true; - } - int randomToSubtract = Main.rand.Next(1, 3); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - } - projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48)) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } + if (projectile.ai[0] == 2f) + { + projectile.Calamity().rogue = true; + } + int randomToSubtract = Main.rand.Next(1, 3); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.rand.NextBool(16)) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.NextBool(48)) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.NextBool(10)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + } + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 120); + } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(200, 100, 250, projectile.alpha); } public override void Kill(int timeLeft) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - for (int num480 = 0; num480 < 3; num480++) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); - } + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num480 = 0; num480 < 3; num480++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Typeless/AtaxiaOrb.cs b/Projectiles/Typeless/AtaxiaOrb.cs index 8253488854..3ddbe6368c 100644 --- a/Projectiles/Typeless/AtaxiaOrb.cs +++ b/Projectiles/Typeless/AtaxiaOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class AtaxiaOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Orb"); + } public override void SetDefaults() { @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.height = 4; projectile.friendly = true; projectile.penetrate = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = 1; projectile.tileCollide = false; projectile.timeLeft = 200; } @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); - } + target.AddBuff(BuffID.OnFire, 180); + } } } diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Typeless/BallisticPoisonCloud.cs index cb430f94b0..85c298c4c1 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud.cs @@ -6,9 +6,9 @@ namespace CalamityMod.Projectiles.Typeless { public class BallisticPoisonCloud : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); Main.projFrames[projectile.type] = 4; } @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 30; } public override void AI() @@ -39,30 +39,30 @@ namespace CalamityMod.Projectiles.Typeless projectile.frame = 0; } projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/BallisticPoisonCloud2.cs b/Projectiles/Typeless/BallisticPoisonCloud2.cs index 8a4b43341d..b6dac364c0 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud2.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud2.cs @@ -6,9 +6,9 @@ namespace CalamityMod.Projectiles.Typeless { public class BallisticPoisonCloud2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); Main.projFrames[projectile.type] = 4; } @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 30; } public override void AI() @@ -39,30 +39,30 @@ namespace CalamityMod.Projectiles.Typeless projectile.frame = 0; } projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 150f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 150f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/BallisticPoisonCloud3.cs b/Projectiles/Typeless/BallisticPoisonCloud3.cs index 0beb4c3e00..b0ac1bcf78 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud3.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud3.cs @@ -6,9 +6,9 @@ namespace CalamityMod.Projectiles.Typeless { public class BallisticPoisonCloud3 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); Main.projFrames[projectile.type] = 4; } @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 30; } public override void AI() @@ -39,30 +39,30 @@ namespace CalamityMod.Projectiles.Typeless projectile.frame = 0; } projectile.velocity *= 0.97f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index 79dc38baa2..05344ed7e7 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class BloodBomb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } public override void SetDefaults() { @@ -23,27 +23,27 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { + if (projectile.owner == Main.myPlayer) + { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BloodBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + } } } } diff --git a/Projectiles/Typeless/BloodBombExplosion.cs b/Projectiles/Typeless/BloodBombExplosion.cs index 8509c01ede..b2ac0c83c7 100644 --- a/Projectiles/Typeless/BloodBombExplosion.cs +++ b/Projectiles/Typeless/BloodBombExplosion.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class BloodBombExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -22,74 +22,74 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = -1; projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 2; } public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.localAI[0] += 1f; - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.8f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - return; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.8f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + return; } } } diff --git a/Projectiles/Typeless/ChaosBlaze.cs b/Projectiles/Typeless/ChaosBlaze.cs index 0ef83b750b..dd2328a8af 100644 --- a/Projectiles/Typeless/ChaosBlaze.cs +++ b/Projectiles/Typeless/ChaosBlaze.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosBlaze : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blaze"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blaze"); + } public override void SetDefaults() { @@ -28,72 +28,72 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire, 300); } } } diff --git a/Projectiles/Typeless/ChaosFlare.cs b/Projectiles/Typeless/ChaosFlare.cs index c57b280c21..3aa0eb0639 100644 --- a/Projectiles/Typeless/ChaosFlare.cs +++ b/Projectiles/Typeless/ChaosFlare.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosFlare : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + } public override void SetDefaults() { @@ -26,58 +26,58 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 6; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 6; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 15f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + target.AddBuff(BuffID.OnFire, 180); } } } diff --git a/Projectiles/Typeless/ChaosFlare2.cs b/Projectiles/Typeless/ChaosFlare2.cs index 019e3ef845..24d18d5ced 100644 --- a/Projectiles/Typeless/ChaosFlare2.cs +++ b/Projectiles/Typeless/ChaosFlare2.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosFlare2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + } public override void SetDefaults() { @@ -26,52 +26,52 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - for (int num457 = 0; num457 < 6; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 11f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + for (int num457 = 0; num457 < 6; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 11f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire, 180); } } } diff --git a/Projectiles/Typeless/ChaosGeyser.cs b/Projectiles/Typeless/ChaosGeyser.cs index 6fa8d3b21b..d2504f2b21 100644 --- a/Projectiles/Typeless/ChaosGeyser.cs +++ b/Projectiles/Typeless/ChaosGeyser.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosGeyser : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Geyser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Geyser"); + } public override void SetDefaults() { @@ -25,68 +25,68 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 16f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.8f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 16f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.8f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire, 180); } } } diff --git a/Projectiles/Typeless/DarkEnergySpawn.cs b/Projectiles/Typeless/DarkEnergySpawn.cs index f170de124f..2c4987b79f 100644 --- a/Projectiles/Typeless/DarkEnergySpawn.cs +++ b/Projectiles/Typeless/DarkEnergySpawn.cs @@ -5,36 +5,36 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class DarkEnergySpawn : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spawn"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spawn"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 1; - projectile.scale = 1f; - projectile.penetrate = 1; - projectile.timeLeft = 20; - projectile.tileCollide = false; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.aiStyle = 1; + projectile.scale = 1f; + projectile.penetrate = 1; + projectile.timeLeft = 20; + projectile.tileCollide = false; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - projectile.ai[1]++; + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.ai[1]++; - if (projectile.ai[1] >= 0) - { - NPC.NewNPC((int)projectile.Center.X - 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy")); - NPC.NewNPC((int)projectile.Center.X + 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy2")); - NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 200, mod.NPCType("DarkEnergy3")); - projectile.ai[1] = -30; - } - } - } + if (projectile.ai[1] >= 0) + { + NPC.NewNPC((int)projectile.Center.X - 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy")); + NPC.NewNPC((int)projectile.Center.X + 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy2")); + NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 200, mod.NPCType("DarkEnergy3")); + projectile.ai[1] = -30; + } + } + } } diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index 1b9581b93f..76ea20dd2b 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class DragonDust : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -24,69 +24,69 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 60f) - { - num461 -= (projectile.ai[0] - 60f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-8, 9); - float num464 = (float)Main.rand.Next(-8, 9); - float num465 = (float)Main.rand.Next(2, 7); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 60f) + { + num461 -= (projectile.ai[0] - 60f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-8, 9); + float num464 = (float)Main.rand.Next(-8, 9); + float num465 = (float)Main.rand.Next(2, 7); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 0; - target.AddBuff(mod.BuffType("HolyLight"), 120); + target.immune[projectile.owner] = 0; + target.AddBuff(mod.BuffType("HolyLight"), 120); } } } diff --git a/Projectiles/Typeless/FabsolDust.cs b/Projectiles/Typeless/FabsolDust.cs index b37c854e52..6c5769bf78 100644 --- a/Projectiles/Typeless/FabsolDust.cs +++ b/Projectiles/Typeless/FabsolDust.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class FabsolDust : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -23,17 +23,17 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default, 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } } } diff --git a/Projectiles/Typeless/FlareExplosion.cs b/Projectiles/Typeless/FlareExplosion.cs index 902f75517e..4eb8264195 100644 --- a/Projectiles/Typeless/FlareExplosion.cs +++ b/Projectiles/Typeless/FlareExplosion.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class FlareExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -24,22 +24,22 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 60); + target.AddBuff(mod.BuffType("HolyLight"), 60); } } } diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index a98da509f0..698c2ba161 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -9,11 +8,11 @@ namespace CalamityMod.Projectiles.Typeless { public class FuckYou : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - Main.projFrames[projectile.type] = 5; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + Main.projFrames[projectile.type] = 5; + } public override void SetDefaults() { @@ -22,108 +21,108 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.ignoreWater = false; projectile.tileCollide = false; - projectile.alpha = 255; + projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.9f, 0.8f, 0.6f); - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1] * 0.5f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) - { - projectile.Kill(); - return; - } - int num3 = projectile.frameCounter + 1; - projectile.frameCounter = num3; - if (num3 >= 3) - { - projectile.frameCounter = 0; - num3 = projectile.frame + 1; - projectile.frame = num3; - if (num3 >= Main.projFrames[projectile.type]) - { - projectile.hide = true; - } - } - projectile.alpha -= 63; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 1f) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = (int)(52f * projectile.scale)); - projectile.Center = projectile.position; - Main.PlaySound(SoundID.Item14, projectile.position); - for (int num991 = 0; num991 < 4; num991 = num3 + 1) - { - int num992 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); - Main.dust[num992].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num991; - } - for (int num993 = 0; num993 < 10; num993 = num3 + 1) - { - int num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 200, default, 2.7f); - Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num994].noGravity = true; - Dust dust = Main.dust[num994]; - dust.velocity *= 3f; - num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); - Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num994]; - dust.velocity *= 2f; - Main.dust[num994].noGravity = true; - Main.dust[num994].fadeIn = 2.5f; - num3 = num993; - } - for (int num995 = 0; num995 < 5; num995 = num3 + 1) - { - int num996 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.7f); - Main.dust[num996].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num996].noGravity = true; - Dust dust = Main.dust[num996]; - dust.velocity *= 3f; - num3 = num995; - } - for (int num997 = 0; num997 < 10; num997 = num3 + 1) - { - int num998 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1.5f); - Main.dust[num998].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num998].noGravity = true; - Dust dust = Main.dust[num998]; - dust.velocity *= 3f; - num3 = num997; - } - } - } + Lighting.AddLight(projectile.Center, 0.9f, 0.8f, 0.6f); + projectile.ai[1] += 0.01f; + projectile.scale = projectile.ai[1] * 0.5f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) + { + projectile.Kill(); + return; + } + int num3 = projectile.frameCounter + 1; + projectile.frameCounter = num3; + if (num3 >= 3) + { + projectile.frameCounter = 0; + num3 = projectile.frame + 1; + projectile.frame = num3; + if (num3 >= Main.projFrames[projectile.type]) + { + projectile.hide = true; + } + } + projectile.alpha -= 63; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[0] == 1f) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = (int)(52f * projectile.scale)); + projectile.Center = projectile.position; + Main.PlaySound(SoundID.Item14, projectile.position); + for (int num991 = 0; num991 < 4; num991 = num3 + 1) + { + int num992 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Main.dust[num992].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num3 = num991; + } + for (int num993 = 0; num993 < 10; num993 = num3 + 1) + { + int num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 200, default, 2.7f); + Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num994].noGravity = true; + Dust dust = Main.dust[num994]; + dust.velocity *= 3f; + num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); + Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num994]; + dust.velocity *= 2f; + Main.dust[num994].noGravity = true; + Main.dust[num994].fadeIn = 2.5f; + num3 = num993; + } + for (int num995 = 0; num995 < 5; num995 = num3 + 1) + { + int num996 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.7f); + Main.dust[num996].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num996].noGravity = true; + Dust dust = Main.dust[num996]; + dust.velocity *= 3f; + num3 = num995; + } + for (int num997 = 0; num997 < 10; num997 = num3 + 1) + { + int num998 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1.5f); + Main.dust[num998].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + Main.dust[num998].noGravity = true; + Dust dust = Main.dust[num998]; + dust.velocity *= 3f; + num3 = num997; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - return projectile.ai[0] > 1f; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + return projectile.ai[0] > 1f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 127); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, 127); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - projectile.direction = Main.player[projectile.owner].direction; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + projectile.direction = Main.player[projectile.owner].direction; + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage = (int)((double)damage * 0.3); - } - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage = (int)((double)damage * 0.3); + } + } } diff --git a/Projectiles/Typeless/GalaxySmasherHammer.cs b/Projectiles/Typeless/GalaxySmasherHammer.cs index c942a27e30..6a21444254 100644 --- a/Projectiles/Typeless/GalaxySmasherHammer.cs +++ b/Projectiles/Typeless/GalaxySmasherHammer.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.Items.Weapons; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons; namespace CalamityMod.Projectiles.Typeless { @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless // Produces violet dust constantly while in flight. This lights the hammer. int numDust = 2; - for(int i = 0; i < numDust; ++i) + for (int i = 0; i < numDust; ++i) { int dustType = (Main.rand.NextBool(6)) ? 112 : 173; float scale = 0.8f + Main.rand.NextFloat(0.6f); @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Typeless int laserDamage = (int)(0.2f * GalaxySmasherMelee.BaseDamage); float laserKB = 2.5f; int numLasers = 3; - for(int i = 0; i < numLasers; ++i) + for (int i = 0; i < numLasers; ++i) { float startDist = Main.rand.NextFloat(260f, 270f); Vector2 startDir = Main.rand.NextVector2Unit(); @@ -182,14 +182,14 @@ namespace CalamityMod.Projectiles.Typeless float laserSpeed = Main.rand.NextFloat(15f, 18f); Vector2 velocity = startDir * (-laserSpeed); - // NebulaShot projectile adjusts its own damage type based on ai[0] - if (projectile.owner == Main.myPlayer) + // NebulaShot projectile adjusts its own damage type based on ai[0] + if (projectile.owner == Main.myPlayer) { float damageType = projectile.melee ? 1f : 2f; int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner, damageType, 0f); Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 30; - } + } } } } diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index 2e459d8a23..76d6fe8980 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class GhostlyBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index 92fb938633..15c6185948 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,12 @@ namespace CalamityMod.Projectiles.Typeless { public class GodKiller : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Killer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Killer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -26,110 +26,110 @@ namespace CalamityMod.Projectiles.Typeless projectile.alpha = 255; projectile.penetrate = 1; projectile.timeLeft = 180; - } + } public override void AI() { - projectile.alpha -= 5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 100; - projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 5f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 2f || Math.Abs(projectile.velocity.Y) >= 2f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 173, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 199, 0f, 0f, 100, default, 0.1f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.alpha -= 5; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 100; + projectile.height = 100; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 5f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 2f || Math.Abs(projectile.velocity.Y) >= 2f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 173, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 199, 0f, 0f, 100, default, 0.1f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 35f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(11f, 23f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/GodKillerGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override void Kill(int timeLeft) + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 89); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 199, 0f, 0f, 100, default, 1.5f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].velocity *= 2f; - } + Vector2 origin = new Vector2(11f, 23f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/GodKillerGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 89); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 199, 0f, 0f, 100, default, 1.5f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].velocity *= 2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -137,10 +137,10 @@ namespace CalamityMod.Projectiles.Typeless target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } } diff --git a/Projectiles/Typeless/GodSlayerBlaze.cs b/Projectiles/Typeless/GodSlayerBlaze.cs index 19dca04e2f..f0622578ac 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/GodSlayerBlaze.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerBlaze : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blaze"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blaze"); + } public override void SetDefaults() { @@ -27,58 +27,58 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0.75f); - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - float scale = 0.7f; - int dustType = (Main.rand.NextBool(2) ? mod.DustType("AstralOrange") : mod.DustType("AstralBlue")); - if (projectile.ai[1] == 0f) - { - scale = 1.5f; - dustType = 173; - } - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, scale); - if (dustType != 173) - Main.dust[num467].color = new Color(255, 255, 255, 0); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, 0.5f, 0f, 0.75f); + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + float scale = 0.7f; + int dustType = (Main.rand.NextBool(2) ? mod.DustType("AstralOrange") : mod.DustType("AstralBlue")); + if (projectile.ai[1] == 0f) + { + scale = 1.5f; + dustType = 173; + } + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, scale); + if (dustType != 173) + Main.dust[num467].color = new Color(255, 255, 255, 0); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[1] == 1f) - target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); - else - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + if (projectile.ai[1] == 1f) + target.AddBuff(mod.BuffType("AstralInfectionDebuff"), 300); + else + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); } } } diff --git a/Projectiles/Typeless/GodSlayerOrb.cs b/Projectiles/Typeless/GodSlayerOrb.cs index f68f295aed..90b8184d20 100644 --- a/Projectiles/Typeless/GodSlayerOrb.cs +++ b/Projectiles/Typeless/GodSlayerOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Orb"); + } public override void SetDefaults() { @@ -25,47 +25,47 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 12f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); - } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); + } } } diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs index 0b2b3fa9db..afab61bca0 100644 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ b/Projectiles/Typeless/GodSlayerPhantom.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerPhantom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Phantom"); - Main.projFrames[projectile.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Phantom"); + Main.projFrames[projectile.type] = 3; + } public override void SetDefaults() { diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index be420a2027..08e2ad80b5 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnel : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -22,68 +22,68 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); - } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); + } + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Typeless/GodSlayerShrapnelRound.cs b/Projectiles/Typeless/GodSlayerShrapnelRound.cs index a20791b0f7..eec735a4f6 100644 --- a/Projectiles/Typeless/GodSlayerShrapnelRound.cs +++ b/Projectiles/Typeless/GodSlayerShrapnelRound.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnelRound : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } public override void SetDefaults() { @@ -23,37 +23,37 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - int num251 = Main.rand.Next(4, 7); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("GodSlayerShrapnel"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } + if (projectile.owner == Main.myPlayer) + { + int num251 = Main.rand.Next(4, 7); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("GodSlayerShrapnel"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } } } } diff --git a/Projectiles/Typeless/GoldenGun.cs b/Projectiles/Typeless/GoldenGun.cs index e8e1153735..332d255b3a 100644 --- a/Projectiles/Typeless/GoldenGun.cs +++ b/Projectiles/Typeless/GoldenGun.cs @@ -6,27 +6,27 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class GoldenGun : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golden Round"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Golden Round"); + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.extraUpdates = 2; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.extraUpdates = 2; + } - public override void AI() + public override void AI() { if (projectile.localAI[0] < 5f) { @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, 600); + target.AddBuff(BuffID.Ichor, 600); } - } + } } diff --git a/Projectiles/Typeless/GrenadeRound.cs b/Projectiles/Typeless/GrenadeRound.cs index 3c7eaca334..1bb7f588fe 100644 --- a/Projectiles/Typeless/GrenadeRound.cs +++ b/Projectiles/Typeless/GrenadeRound.cs @@ -1,18 +1,18 @@ -using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Typeless { public class GrenadeRound : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grenade Round"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grenade Round"); + } public override void SetDefaults() { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (projectile.soundDelay == 0) { projectile.soundDelay = 90; @@ -42,25 +42,25 @@ namespace CalamityMod.Projectiles.Typeless projectile.velocity.Y = 16f; } if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Typeless target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57) { damage += target.lifeMax / 20; //500 + 200 = 700 + (100000 / 20 = 5000) = 5700 * 2 (explosion) = 11400 = 11.4% of boss HP - } + } if (damage > target.lifeMax / 12 && CalamityPlayer.areThereAnyDamnBosses) damage = target.lifeMax / 12; } diff --git a/Projectiles/Typeless/HolyEruption.cs b/Projectiles/Typeless/HolyEruption.cs index 39ebc28e44..adf6336e08 100644 --- a/Projectiles/Typeless/HolyEruption.cs +++ b/Projectiles/Typeless/HolyEruption.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class HolyEruption : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eruption"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eruption"); + } public override void SetDefaults() { @@ -19,68 +19,68 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = -1; projectile.timeLeft = 360; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 2; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 16f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.8f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 16f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.8f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 300); + target.AddBuff(mod.BuffType("HolyLight"), 300); } } } diff --git a/Projectiles/Typeless/HolyExplosion.cs b/Projectiles/Typeless/HolyExplosion.cs index 5061521f98..74d8264014 100644 --- a/Projectiles/Typeless/HolyExplosion.cs +++ b/Projectiles/Typeless/HolyExplosion.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class HolyExplosion : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -24,31 +24,31 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index 05cea609f3..c5cf447b7b 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class HolyExplosionSupreme : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -21,36 +21,36 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = -1; projectile.timeLeft = 3; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 4; } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 60; + projectile.height = 60; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Typeless/HolyFlameBomb.cs b/Projectiles/Typeless/HolyFlameBomb.cs index ea025702ae..3eb6cd60b2 100644 --- a/Projectiles/Typeless/HolyFlameBomb.cs +++ b/Projectiles/Typeless/HolyFlameBomb.cs @@ -6,11 +6,11 @@ namespace CalamityMod.Projectiles.Typeless { public class HolyFlameBomb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } public override void SetDefaults() { @@ -24,57 +24,57 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.velocity.Y *= 1.005f; - projectile.alpha -= 2; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); + projectile.velocity.Y *= 1.005f; + projectile.alpha -= 2; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("HolyLight"), 300); + target.AddBuff(mod.BuffType("HolyLight"), 300); } } } diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index 5db23053ea..cec91f6388 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class LunicBeam : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } public override void SetDefaults() { @@ -26,176 +26,176 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - float num29 = 5f; - float num30 = 300f; - float scaleFactor = 6f; - Vector2 value7 = new Vector2(10f, 20f); - float num31 = 1f; - int num32 = 3 * projectile.MaxUpdates; - int num33 = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 244, - 229, - 262, - 247 - }); - int num34 = 259; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - projectile.localAI[0] = (float)(-(float)Main.rand.Next(48)); - } - else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) - { - int num35 = -1; - float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) - { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) - { - Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) - { - num36 = num38; - num35 = num37; - } - } - } - if (num36 < 8f) - { - projectile.Kill(); - return; - } - if (num35 != -1) - { - projectile.ai[1] = num29 + 1f; - projectile.ai[0] = (float)num35; - projectile.netUpdate = true; - } - } - else if (projectile.ai[1] > num29) - { - projectile.ai[1] += 1f; - int num39 = (int)projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - else - { - projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - projectile.Center; - if (vector6.Length() < 20f) - { - projectile.Kill(); - return; - } - if (vector6 != Vector2.Zero) - { - vector6.Normalize(); - vector6 *= scaleFactor; - } - float num40 = 30f; - projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; - } - } - if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] == num29) - { - projectile.ai[1] = 1f; - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) - { - projectile.localAI[0] = 0f; - } - else if (projectile.alpha == 0) - { - for (int num41 = 0; num41 < 2; num41++) - { - Vector2 value8 = Vector2.UnitX * -30f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = num31; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8 + projectile.velocity * 2f; - Main.dust[num42].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + projectile.velocity * 2f; - } - } - if (Main.rand.NextBool(12)) - { - for (int num43 = 0; num43 < 1; num43++) - { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; - Main.dust[num44].fadeIn = 0.9f; - } - } - if (Main.rand.NextBool(64)) - { - for (int num45 = 0; num45 < 1; num45++) - { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 155, default, 0.8f); - Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num46].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(4)) - { - for (int num47 = 0; num47 < 2; num47++) - { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1.2f); - Main.dust[num48].velocity *= 0.3f; - Main.dust[num48].noGravity = true; - Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num48].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(3)) - { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); - Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; - Main.dust[num50].fadeIn = 1.2f; - Main.dust[num50].scale = 1.5f; - Main.dust[num50].noGravity = true; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 259, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 259, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } + float num29 = 5f; + float num30 = 300f; + float scaleFactor = 6f; + Vector2 value7 = new Vector2(10f, 20f); + float num31 = 1f; + int num32 = 3 * projectile.MaxUpdates; + int num33 = Utils.SelectRandom(Main.rand, new int[] + { + 246, + 244, + 229, + 262, + 247 + }); + int num34 = 259; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + projectile.localAI[0] = (float)(-(float)Main.rand.Next(48)); + } + else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + { + int num35 = -1; + float num36 = num30; + for (int num37 = 0; num37 < 200; num37++) + { + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + { + Vector2 center3 = Main.npc[num37].Center; + float num38 = Vector2.Distance(center3, projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + { + num36 = num38; + num35 = num37; + } + } + } + if (num36 < 8f) + { + projectile.Kill(); + return; + } + if (num35 != -1) + { + projectile.ai[1] = num29 + 1f; + projectile.ai[0] = (float)num35; + projectile.netUpdate = true; + } + } + else if (projectile.ai[1] > num29) + { + projectile.ai[1] += 1f; + int num39 = (int)projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + else + { + projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + if (vector6.Length() < 20f) + { + projectile.Kill(); + return; + } + if (vector6 != Vector2.Zero) + { + vector6.Normalize(); + vector6 *= scaleFactor; + } + float num40 = 30f; + projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + } + } + if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] == num29) + { + projectile.ai[1] = 1f; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else if (projectile.alpha == 0) + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -30f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = num31; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8 + projectile.velocity * 2f; + Main.dust[num42].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + projectile.velocity * 2f; + } + } + if (Main.rand.NextBool(12)) + { + for (int num43 = 0; num43 < 1; num43++) + { + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[num44].velocity *= 0.1f; + Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].fadeIn = 0.9f; + } + } + if (Main.rand.NextBool(64)) + { + for (int num45 = 0; num45 < 1; num45++) + { + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 155, default, 0.8f); + Main.dust[num46].velocity *= 0.3f; + Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num46].fadeIn = 1.4f; + } + } + } + if (Main.rand.NextBool(4)) + { + for (int num47 = 0; num47 < 2; num47++) + { + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1.2f); + Main.dust[num48].velocity *= 0.3f; + Main.dust[num48].noGravity = true; + Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num48].fadeIn = 1.4f; + } + } + } + if (Main.rand.NextBool(3)) + { + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); + Main.dust[num50].velocity *= 0.3f; + Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; + Main.dust[num50].fadeIn = 1.2f; + Main.dust[num50].scale = 1.5f; + Main.dust[num50].noGravity = true; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 259, 0f, 0f, 100, default, 1.35f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 259, 0f, 0f, 100, default, 1f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].noGravity = true; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -207,76 +207,76 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("MarkedforDeath"), 300); + target.AddBuff(mod.BuffType("MarkedforDeath"), 300); } public override void Kill(int timeLeft) { int num47 = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 244, - 229, - 262, - 247 - }); - int num48 = 259; - int num49 = 259; - int height = 50; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = (projectile.height = height); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - num47 = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 244, - 229, - 262, - 247 - }); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } + { + 246, + 244, + 229, + 262, + 247 + }); + int num48 = 259; + int num49 = 259; + int height = 50; + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item14, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + num47 = Utils.SelectRandom(Main.rand, new int[] + { + 246, + 244, + 229, + 262, + 247 + }); + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } } } } diff --git a/Projectiles/Typeless/MageHammerBoom.cs b/Projectiles/Typeless/MageHammerBoom.cs index 654b24887b..7e7f15bfa5 100644 --- a/Projectiles/Typeless/MageHammerBoom.cs +++ b/Projectiles/Typeless/MageHammerBoom.cs @@ -4,10 +4,10 @@ namespace CalamityMod.Projectiles.Typeless { public class MageHammerBoom : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } public override void SetDefaults() { @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = -1; projectile.timeLeft = 5; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 1; } } } diff --git a/Projectiles/Typeless/MagnumRound.cs b/Projectiles/Typeless/MagnumRound.cs index ab1304e08a..88ab5f7a4a 100644 --- a/Projectiles/Typeless/MagnumRound.cs +++ b/Projectiles/Typeless/MagnumRound.cs @@ -1,16 +1,16 @@ -using Terraria; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Typeless { public class MagnumRound : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnum Round"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnum Round"); + } public override void SetDefaults() { @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.height = 4; projectile.light = 0.5f; projectile.alpha = 255; - projectile.extraUpdates = 10; + projectile.extraUpdates = 10; projectile.friendly = true; projectile.ignoreWater = true; projectile.aiStyle = 1; diff --git a/Projectiles/Typeless/MarkRound.cs b/Projectiles/Typeless/MarkRound.cs index 54c87390bd..2c5affb035 100644 --- a/Projectiles/Typeless/MarkRound.cs +++ b/Projectiles/Typeless/MarkRound.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class MarkRound : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } public override void SetDefaults() { @@ -26,86 +26,86 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0f, 0.7f); - float num55 = 30f; - float num56 = 2f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0f, 0.7f); + float num55 = 30f; + float num56 = 2f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 0, 250, 0); + return new Color(200, 0, 250, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 2f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 30f; + float scaleFactor = 2f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; } public override void Kill(int timeLeft) { int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("MarkedforDeath"), 300); + target.AddBuff(mod.BuffType("MarkedforDeath"), 300); } } } diff --git a/Projectiles/Typeless/NanoblackMain.cs b/Projectiles/Typeless/NanoblackMain.cs index 7729445e4a..8d9b64662e 100644 --- a/Projectiles/Typeless/NanoblackMain.cs +++ b/Projectiles/Typeless/NanoblackMain.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.Items.Weapons; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons; namespace CalamityMod.Projectiles.Typeless { @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Typeless private static int MaxBladeTimer = 18; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Reaper"); + { + DisplayName.SetDefault("Nanoblack Reaper"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; ProjectileID.Sets.TrailingMode[projectile.type] = 1; } @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Typeless // Rotate the scythe as it flies. float spin = (projectile.direction <= 0) ? -1f : 1f; - projectile.rotation += spin * RotationIncrement; + projectile.rotation += spin * RotationIncrement; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -154,13 +154,13 @@ namespace CalamityMod.Projectiles.Typeless Vector2 pos = projectile.Center + directOffset + velocityOffset; if (projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } + int proj = Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); + CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); + if (projectile.melee) + cgp.forceMelee = true; + else + cgp.forceRogue = true; + } } } } diff --git a/Projectiles/Typeless/NanoblackSplit.cs b/Projectiles/Typeless/NanoblackSplit.cs index 87220c8d19..4f422283a7 100644 --- a/Projectiles/Typeless/NanoblackSplit.cs +++ b/Projectiles/Typeless/NanoblackSplit.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Typeless private static float MaxHomingFactor = 6.6f; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Blade"); + { + DisplayName.SetDefault("Nanoblack Blade"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ai[1] -= spinReduction; // If about to disappear, shrink by 8% every frame - if(projectile.timeLeft < 15) + if (projectile.timeLeft < 15) projectile.scale *= 0.92f; // Search for and home in on nearby targets @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Typeless float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); // If the target is too far away, stop homing in on it. - if(dist > HomingBreakRange) + if (dist > HomingBreakRange) { projectile.ai[0] = 0f; return; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 newVelocity = projectile.velocity += posDiff; // Caps speed to make sure it doesn't go too fast. - if(newVelocity.Length() >= MaxSpeed) + if (newVelocity.Length() >= MaxSpeed) { newVelocity = newVelocity.SafeNormalize(Vector2.Zero); newVelocity *= MaxSpeed; diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index b592c410c1..c5c3e8d3e5 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class Nanotech : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanotech"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanotech"); + } public override void SetDefaults() { @@ -23,27 +23,27 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); - projectile.rotation += projectile.velocity.X * 0.2f; - if (projectile.velocity.X > 0f) - { - projectile.rotation += 0.08f; - } - else - { - projectile.rotation -= 0.08f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) - { - projectile.alpha += 5; - if (projectile.alpha >= 255) - { - projectile.alpha = 255; - projectile.Kill(); - return; - } - } + Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); + projectile.rotation += projectile.velocity.X * 0.2f; + if (projectile.velocity.X > 0f) + { + projectile.rotation += 0.08f; + } + else + { + projectile.rotation -= 0.08f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] > 30f) + { + projectile.alpha += 5; + if (projectile.alpha >= 255) + { + projectile.alpha = 255; + projectile.Kill(); + return; + } + } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 600f; @@ -81,28 +81,28 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { - int num3; - for (int num191 = 0; num191 < 2; num191 = num3 + 1) - { - int num192 = (int)(10f * projectile.scale); - int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default, 1f); - Dust dust20 = Main.dust[num193]; - Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); - dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; - if (num191 < 30) - { - dust20.velocity = value8 * dust20.velocity.Length(); - } - else - { - dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; - } - dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); - dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); - dust20.noGravity = true; - dust20.scale = 0.7f; - num3 = num191; - } + int num3; + for (int num191 = 0; num191 < 2; num191 = num3 + 1) + { + int num192 = (int)(10f * projectile.scale); + int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default, 1f); + Dust dust20 = Main.dust[num193]; + Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); + dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; + if (num191 < 30) + { + dust20.velocity = value8 * dust20.velocity.Length(); + } + else + { + dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; + } + dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); + dust20.noGravity = true; + dust20.scale = 0.7f; + num3 = num191; + } } } } diff --git a/Projectiles/Typeless/NebulaDust.cs b/Projectiles/Typeless/NebulaDust.cs index 80bb8e48d7..8779320765 100644 --- a/Projectiles/Typeless/NebulaDust.cs +++ b/Projectiles/Typeless/NebulaDust.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class NebulaDust : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } public override void SetDefaults() { @@ -22,45 +22,45 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 3; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) - { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; - } - else - { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; - } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } + projectile.rotation += projectile.velocity.X * 0.02f; + if (projectile.velocity.X < 0f) + { + projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + } + else + { + projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } } } } diff --git a/Projectiles/Typeless/NebulaStar.cs b/Projectiles/Typeless/NebulaStar.cs index 9aa1a33d54..82992ea5ae 100644 --- a/Projectiles/Typeless/NebulaStar.cs +++ b/Projectiles/Typeless/NebulaStar.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class NebulaStar : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } public override void SetDefaults() { @@ -27,167 +27,167 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - float num944 = 1f - (float)projectile.alpha / 255f; - num944 *= projectile.scale; - Lighting.AddLight(projectile.Center, 0.25f * num944, 0.025f * num944, 0.275f * num944); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] *= -1f; - } - if (projectile.localAI[0] >= 0f) - { - projectile.scale += 0.003f; - } - else - { - projectile.scale -= 0.003f; - } - projectile.rotation += 0.0025f * projectile.scale; - float num945 = 1f; - float num946 = 1f; - if (projectile.identity % 6 == 0) - { - num946 *= -1f; - } - if (projectile.identity % 6 == 1) - { - num945 *= -1f; - } - if (projectile.identity % 6 == 2) - { - num946 *= -1f; - num945 *= -1f; - } - if (projectile.identity % 6 == 3) - { - num946 = 0f; - } - if (projectile.identity % 6 == 4) - { - num945 = 0f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) - { - projectile.localAI[1] = -180f; - } - if (projectile.localAI[1] >= -60f) - { - projectile.velocity.X = projectile.velocity.X + 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; - } - else - { - projectile.velocity.X = projectile.velocity.X - 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) - { - projectile.damage = 0; - projectile.ai[1] = 1f; - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else - { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; - if (num947 > 4f) - { - num947 *= 1.1f; - } - if (num947 > 5f) - { - num947 *= 1.2f; - } - if (num947 > 6f) - { - num947 *= 1.3f; - } - if (num947 > 7f) - { - num947 *= 1.4f; - } - if (num947 > 8f) - { - num947 *= 1.5f; - } - if (num947 > 9f) - { - num947 *= 1.6f; - } - if (num947 > 10f) - { - num947 *= 1.7f; - } - projectile.ai[0] += num947; - if (projectile.alpha > 50) - { - projectile.alpha -= 10; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - } - } - bool flag49 = false; - Vector2 center12 = new Vector2(0f, 0f); - float num948 = 600f; - for (int num949 = 0; num949 < 200; num949++) - { - if (Main.npc[num949].CanBeChasedBy(projectile, false)) - { - float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); - float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); - float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); - if (num952 < num948) - { - num948 = num952; - center12 = Main.npc[num949].Center; - flag49 = true; - } - } - } - if (flag49) - { - Vector2 vector101 = center12 - projectile.Center; - vector101.Normalize(); - vector101 *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; - return; - } - if ((double)projectile.velocity.Length() > 0.2) - { - projectile.velocity *= 0.98f; - } + float num944 = 1f - (float)projectile.alpha / 255f; + num944 *= projectile.scale; + Lighting.AddLight(projectile.Center, 0.25f * num944, 0.025f * num944, 0.275f * num944); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] *= -1f; + } + if (projectile.localAI[0] >= 0f) + { + projectile.scale += 0.003f; + } + else + { + projectile.scale -= 0.003f; + } + projectile.rotation += 0.0025f * projectile.scale; + float num945 = 1f; + float num946 = 1f; + if (projectile.identity % 6 == 0) + { + num946 *= -1f; + } + if (projectile.identity % 6 == 1) + { + num945 *= -1f; + } + if (projectile.identity % 6 == 2) + { + num946 *= -1f; + num945 *= -1f; + } + if (projectile.identity % 6 == 3) + { + num946 = 0f; + } + if (projectile.identity % 6 == 4) + { + num945 = 0f; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 60f) + { + projectile.localAI[1] = -180f; + } + if (projectile.localAI[1] >= -60f) + { + projectile.velocity.X = projectile.velocity.X + 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; + } + else + { + projectile.velocity.X = projectile.velocity.X - 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5400f) + { + projectile.damage = 0; + projectile.ai[1] = 1f; + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else + { + float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + if (num947 > 4f) + { + num947 *= 1.1f; + } + if (num947 > 5f) + { + num947 *= 1.2f; + } + if (num947 > 6f) + { + num947 *= 1.3f; + } + if (num947 > 7f) + { + num947 *= 1.4f; + } + if (num947 > 8f) + { + num947 *= 1.5f; + } + if (num947 > 9f) + { + num947 *= 1.6f; + } + if (num947 > 10f) + { + num947 *= 1.7f; + } + projectile.ai[0] += num947; + if (projectile.alpha > 50) + { + projectile.alpha -= 10; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + } + } + bool flag49 = false; + Vector2 center12 = new Vector2(0f, 0f); + float num948 = 600f; + for (int num949 = 0; num949 < 200; num949++) + { + if (Main.npc[num949].CanBeChasedBy(projectile, false)) + { + float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); + float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); + float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); + if (num952 < num948) + { + num948 = num952; + center12 = Main.npc[num949].Center; + flag49 = true; + } + } + } + if (flag49) + { + Vector2 vector101 = center12 - projectile.Center; + vector101.Normalize(); + vector101 *= 0.75f; + projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; + return; + } + if ((double)projectile.velocity.Length() > 0.2) + { + projectile.velocity *= 0.98f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && projectile.ai[1] == 0f) - { - Vector2 value10 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value10.Normalize(); - value10 *= 0.3f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value10.X, value10.Y, mod.ProjectileType("NebulaDust"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer && projectile.ai[1] == 0f) + { + Vector2 value10 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value10.Normalize(); + value10 *= 0.3f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value10.X, value10.Y, mod.ProjectileType("NebulaDust"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(17f, 17f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/NebulaStarGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(17f, 17f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/NebulaStarGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + } } diff --git a/Projectiles/Typeless/NobodyKnows.cs b/Projectiles/Typeless/NobodyKnows.cs index 7d2b92cc36..fbade8a6d3 100644 --- a/Projectiles/Typeless/NobodyKnows.cs +++ b/Projectiles/Typeless/NobodyKnows.cs @@ -4,10 +4,10 @@ namespace CalamityMod.Projectiles.Typeless { public class NobodyKnows : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nope"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nope"); + } public override void SetDefaults() { diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 49a8854675..5dee42a1ca 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -1,11 +1,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Typeless { @@ -222,8 +221,8 @@ namespace CalamityMod.Projectiles.Typeless Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), texture2D13.Bounds, projectile.GetAlpha(lightColor), projectile.rotation, texture2D13.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.ZoomMatrix); - return false; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.ZoomMatrix); + return false; } } } diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 9402f88e46..f397b9de9c 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class PoisonousSeawater : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seawater"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seawater"); + } public override void SetDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 6; + projectile.timeLeft = 6; } public override void AI() @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 120); - target.AddBuff(BuffID.Poisoned, 120); + target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.Poisoned, 120); } } } diff --git a/Projectiles/Typeless/ReaverBlast.cs b/Projectiles/Typeless/ReaverBlast.cs index a40208b714..144f786781 100644 --- a/Projectiles/Typeless/ReaverBlast.cs +++ b/Projectiles/Typeless/ReaverBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class ReaverBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,69 +26,69 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.015f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 1f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } - return; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.015f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 1f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + return; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, 60); + target.AddBuff(BuffID.CursedInferno, 60); } } } diff --git a/Projectiles/Typeless/Seashell.cs b/Projectiles/Typeless/Seashell.cs index 1c30fceb6e..ba90585929 100644 --- a/Projectiles/Typeless/Seashell.cs +++ b/Projectiles/Typeless/Seashell.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Typeless { public class Seashell : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seashell"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seashell"); + } public override void SetDefaults() { @@ -19,9 +19,9 @@ namespace CalamityMod.Projectiles.Typeless projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = 52; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 4373ee1694..d7325d94a9 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,110 +9,110 @@ namespace CalamityMod.Projectiles.Typeless { public class SkyFlareFriendly : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 3; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[projectile.type] = 3; + } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - } + projectile.width = 42; + projectile.height = 42; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); - } + Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (projectile.height = 200); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 4; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 12; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = (projectile.height = 200); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 4; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 12; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } } } } diff --git a/Projectiles/Typeless/SparkInfernal.cs b/Projectiles/Typeless/SparkInfernal.cs index fc2bdcbdc2..18b59ae747 100644 --- a/Projectiles/Typeless/SparkInfernal.cs +++ b/Projectiles/Typeless/SparkInfernal.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Typeless { public class SparkInfernal : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spark"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spark"); + } public override void SetDefaults() { @@ -21,12 +21,12 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); } public override void Kill(int timeLeft) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoMarkFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoMarkFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index 7f1d5cca0f..27df7b36ed 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -6,10 +6,10 @@ namespace CalamityMod.Projectiles.Typeless { public class StandingFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } public override void SetDefaults() { @@ -22,68 +22,68 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); - } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); + } + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -97,8 +97,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); } } } diff --git a/Projectiles/Typeless/StellarContemptHammer.cs b/Projectiles/Typeless/StellarContemptHammer.cs index d5a13645f3..f2f5fd7b4a 100644 --- a/Projectiles/Typeless/StellarContemptHammer.cs +++ b/Projectiles/Typeless/StellarContemptHammer.cs @@ -1,10 +1,10 @@ -using System; +using CalamityMod.Items.Weapons; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons; namespace CalamityMod.Projectiles.Typeless { @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless private static float ReboundTime = 26f; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Contempt"); + { + DisplayName.SetDefault("Stellar Contempt"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; ProjectileID.Sets.TrailingMode[projectile.type] = 1; } @@ -42,76 +42,76 @@ namespace CalamityMod.Projectiles.Typeless Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0.6f); // The hammer makes sound while flying. - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); - } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); + } // ai[0] stores whether the hammer is returning. If 0, it isn't. If 1, it is. if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= ReboundTime) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; float returnSpeed = StellarContemptMelee.Speed; - float acceleration = 3.2f; + float acceleration = 3.2f; Player owner = Main.player[projectile.owner]; // Delete the hammer if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - projectile.Kill(); + float xDist = playerCenter.X - projectile.Center.X; + float yDist = playerCenter.Y - projectile.Center.Y; + float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (dist > 3000f) + projectile.Kill(); - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; - } + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + projectile.velocity.Y = projectile.velocity.Y - acceleration; + if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); - } + if (Main.myPlayer == projectile.owner) + if (projectile.Hitbox.Intersects(owner.Hitbox)) + projectile.Kill(); + } // Rotate the hammer as it flies. - projectile.rotation += RotationIncrement; + projectile.rotation += RotationIncrement; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -180,13 +180,13 @@ namespace CalamityMod.Projectiles.Typeless float AI1 = (float)Main.rand.Next(3); if (projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } + int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); + CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); + if (projectile.melee) + cgp.forceMelee = true; + else + cgp.forceRogue = true; + } } } } diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index 760e48abef..55d894afeb 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class StickyFeatherAero : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + } public override void SetDefaults() { @@ -69,30 +69,30 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/Projectiles/Typeless/StormBolt.cs b/Projectiles/Typeless/StormBolt.cs index 054c746a8b..ab58560c2b 100644 --- a/Projectiles/Typeless/StormBolt.cs +++ b/Projectiles/Typeless/StormBolt.cs @@ -5,10 +5,10 @@ namespace CalamityMod.Projectiles.Typeless { public class StormBolt : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } public override void SetDefaults() { @@ -22,15 +22,15 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f); } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMarkSummon"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMarkSummon"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } } } } diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index 0db424b092..7a9d1344d1 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -1,67 +1,67 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class TarraEnergy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() + public class TarraEnergy : ModProjectile + { + public override void SetStaticDefaults() { - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - } + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + } } diff --git a/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs index 3d5da5a6ac..41966e3485 100644 --- a/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs +++ b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class TheDeadlyMicrobeProjectile : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } public override void SetDefaults() { @@ -27,175 +27,175 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - float num944 = 1f - (float)projectile.alpha / 255f; - num944 *= projectile.scale; - Lighting.AddLight(projectile.Center, 0.25f * num944, 0.025f * num944, 0.275f * num944); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] *= -1f; - } - if (projectile.localAI[0] >= 0f) - { - projectile.scale += 0.003f; - } - else - { - projectile.scale -= 0.003f; - } - projectile.rotation += 0.0025f * projectile.scale; - float num945 = 1f; - float num946 = 1f; - if (projectile.identity % 6 == 0) - { - num946 *= -1f; - } - if (projectile.identity % 6 == 1) - { - num945 *= -1f; - } - if (projectile.identity % 6 == 2) - { - num946 *= -1f; - num945 *= -1f; - } - if (projectile.identity % 6 == 3) - { - num946 = 0f; - } - if (projectile.identity % 6 == 4) - { - num945 = 0f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) - { - projectile.localAI[1] = -180f; - } - if (projectile.localAI[1] >= -60f) - { - projectile.velocity.X = projectile.velocity.X + 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; - } - else - { - projectile.velocity.X = projectile.velocity.X - 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) - { - projectile.damage = 0; - projectile.ai[1] = 1f; - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else - { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; - if (num947 > 4f) - { - num947 *= 1.1f; - } - if (num947 > 5f) - { - num947 *= 1.2f; - } - if (num947 > 6f) - { - num947 *= 1.3f; - } - if (num947 > 7f) - { - num947 *= 1.4f; - } - if (num947 > 8f) - { - num947 *= 1.5f; - } - if (num947 > 9f) - { - num947 *= 1.6f; - } - if (num947 > 10f) - { - num947 *= 1.7f; - } - projectile.ai[0] += num947; - if (projectile.alpha > 50) - { - projectile.alpha -= 10; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - } - } - bool flag49 = false; - Vector2 center12 = new Vector2(0f, 0f); - float num948 = 600f; - for (int num949 = 0; num949 < 200; num949++) - { - if (Main.npc[num949].CanBeChasedBy(projectile, false)) - { - float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); - float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); - float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); - if (num952 < num948) - { - num948 = num952; - center12 = Main.npc[num949].Center; - flag49 = true; - } - } - } - if (flag49) - { - Vector2 vector101 = center12 - projectile.Center; - vector101.Normalize(); - vector101 *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; - return; - } - if ((double)projectile.velocity.Length() > 0.2) - { - projectile.velocity *= 0.98f; - } + float num944 = 1f - (float)projectile.alpha / 255f; + num944 *= projectile.scale; + Lighting.AddLight(projectile.Center, 0.25f * num944, 0.025f * num944, 0.275f * num944); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] *= -1f; + } + if (projectile.localAI[0] >= 0f) + { + projectile.scale += 0.003f; + } + else + { + projectile.scale -= 0.003f; + } + projectile.rotation += 0.0025f * projectile.scale; + float num945 = 1f; + float num946 = 1f; + if (projectile.identity % 6 == 0) + { + num946 *= -1f; + } + if (projectile.identity % 6 == 1) + { + num945 *= -1f; + } + if (projectile.identity % 6 == 2) + { + num946 *= -1f; + num945 *= -1f; + } + if (projectile.identity % 6 == 3) + { + num946 = 0f; + } + if (projectile.identity % 6 == 4) + { + num945 = 0f; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 60f) + { + projectile.localAI[1] = -180f; + } + if (projectile.localAI[1] >= -60f) + { + projectile.velocity.X = projectile.velocity.X + 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; + } + else + { + projectile.velocity.X = projectile.velocity.X - 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5400f) + { + projectile.damage = 0; + projectile.ai[1] = 1f; + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else + { + float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + if (num947 > 4f) + { + num947 *= 1.1f; + } + if (num947 > 5f) + { + num947 *= 1.2f; + } + if (num947 > 6f) + { + num947 *= 1.3f; + } + if (num947 > 7f) + { + num947 *= 1.4f; + } + if (num947 > 8f) + { + num947 *= 1.5f; + } + if (num947 > 9f) + { + num947 *= 1.6f; + } + if (num947 > 10f) + { + num947 *= 1.7f; + } + projectile.ai[0] += num947; + if (projectile.alpha > 50) + { + projectile.alpha -= 10; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + } + } + bool flag49 = false; + Vector2 center12 = new Vector2(0f, 0f); + float num948 = 600f; + for (int num949 = 0; num949 < 200; num949++) + { + if (Main.npc[num949].CanBeChasedBy(projectile, false)) + { + float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); + float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); + float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); + if (num952 < num948) + { + num948 = num952; + center12 = Main.npc[num949].Center; + flag49 = true; + } + } + } + if (flag49) + { + Vector2 vector101 = center12 - projectile.Center; + vector101.Normalize(); + vector101 *= 0.75f; + projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; + return; + } + if ((double)projectile.velocity.Length() > 0.2) + { + projectile.velocity *= 0.98f; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 90); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 90); + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 56); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 44, vector7.X, vector7.Y, 100, default, 0.5f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 56); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 44, vector7.X, vector7.Y, 100, default, 0.5f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Typeless/TrueBattleSpawn.cs b/Projectiles/Typeless/TrueBattleSpawn.cs index e3eea918a4..44fd3cc96a 100644 --- a/Projectiles/Typeless/TrueBattleSpawn.cs +++ b/Projectiles/Typeless/TrueBattleSpawn.cs @@ -5,34 +5,34 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class TrueBattleSpawn : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spawn"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spawn"); + } - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 1; - projectile.scale = 1f; - projectile.penetrate = 1; - projectile.timeLeft = 20; - projectile.tileCollide = false; - aiType = ProjectileID.Bullet; - } + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.aiStyle = 1; + projectile.scale = 1f; + projectile.penetrate = 1; + projectile.timeLeft = 20; + projectile.tileCollide = false; + aiType = ProjectileID.Bullet; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - projectile.ai[1]++; + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.ai[1]++; - if (projectile.ai[1] >= 0) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CalamitasRun3")); - projectile.ai[1] = -30; - } - } - } + if (projectile.ai[1] >= 0) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CalamitasRun3")); + projectile.ai[1] = -30; + } + } + } } diff --git a/Projectiles/Typeless/VanquisherArrow2.cs b/Projectiles/Typeless/VanquisherArrow2.cs index d0e056d215..0c00843240 100644 --- a/Projectiles/Typeless/VanquisherArrow2.cs +++ b/Projectiles/Typeless/VanquisherArrow2.cs @@ -1,6 +1,5 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -8,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class VanquisherArrow2 : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } public override void SetDefaults() { @@ -26,56 +25,56 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 20f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } - /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(0f, 0f); - Color color = new Color(0, 0, 0, 0); - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/VanquisherArrow2Glow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - }*/ + /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(0f, 0f); + Color color = new Color(0, 0, 0, 0); + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/VanquisherArrow2Glow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + }*/ - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { @@ -88,7 +87,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); } } } diff --git a/Projectiles/Typeless/XerocBlast.cs b/Projectiles/Typeless/XerocBlast.cs index 8c5ec65fe8..9278ba0757 100644 --- a/Projectiles/Typeless/XerocBlast.cs +++ b/Projectiles/Typeless/XerocBlast.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class XerocBlast : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } public override void SetDefaults() { @@ -26,69 +26,69 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; - } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.OnFire, 120); } } } diff --git a/Projectiles/Typeless/XerocBubble.cs b/Projectiles/Typeless/XerocBubble.cs index 8c28d0bc8f..ac3c2d816e 100644 --- a/Projectiles/Typeless/XerocBubble.cs +++ b/Projectiles/Typeless/XerocBubble.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class XerocBubble : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } public override void SetDefaults() { @@ -26,55 +26,55 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 1; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 8f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); - } + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + } } } diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index 0b8ec7b113..298e7fd0c1 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Typeless { public class XerocFire : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } public override void SetDefaults() { @@ -23,63 +23,63 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); - Dust expr_8976_cp_0 = Main.dust[num199]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool(2)) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -93,8 +93,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); } } } diff --git a/Projectiles/Typeless/XerocOrb.cs b/Projectiles/Typeless/XerocOrb.cs index 8f125a8fa0..531e688a7d 100644 --- a/Projectiles/Typeless/XerocOrb.cs +++ b/Projectiles/Typeless/XerocOrb.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +8,10 @@ namespace CalamityMod.Projectiles.Typeless { public class XerocOrb : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } public override void SetDefaults() { @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); - } + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + } } } diff --git a/Projectiles/Typeless/XerocStar.cs b/Projectiles/Typeless/XerocStar.cs index 25e48d35d4..7bd1414a30 100644 --- a/Projectiles/Typeless/XerocStar.cs +++ b/Projectiles/Typeless/XerocStar.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,10 @@ namespace CalamityMod.Projectiles.Typeless { public class XerocStar : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } public override void SetDefaults() { @@ -27,50 +27,50 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.rotation += 0.25f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 1; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.rotation += 0.25f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -82,8 +82,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); - } + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + } } } diff --git a/Skies/AstralScreenShaderData.cs b/Skies/AstralScreenShaderData.cs index d1ac444e07..fb6215b493 100644 --- a/Skies/AstralScreenShaderData.cs +++ b/Skies/AstralScreenShaderData.cs @@ -1,8 +1,6 @@ -using System; - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.Graphics.Shaders; @@ -10,7 +8,7 @@ namespace CalamityMod.Skies { public class AstralScreenShaderData : ScreenShaderData { - public AstralScreenShaderData(Ref shader, string passName) : base (shader, passName) { } + public AstralScreenShaderData(Ref shader, string passName) : base(shader, passName) { } public override void Apply() { diff --git a/Skies/AstralSky.cs b/Skies/AstralSky.cs index bf633acc1a..8838b21646 100644 --- a/Skies/AstralSky.cs +++ b/Skies/AstralSky.cs @@ -43,7 +43,8 @@ namespace CalamityMod.Skies for (int i = 0; i < Main.star.Length; i++) { Star star = Main.star[i]; - if (star == null) continue; + if (star == null) + continue; Texture2D t2D = Main.starTexture[star.type]; Vector2 origin = new Vector2(t2D.Width * 0.5f, t2D.Height * 0.5f); diff --git a/Sounds/Custom/AdrenalineBurnout1.cs b/Sounds/Custom/AdrenalineBurnout1.cs index 33c772e1d8..a4f25f8309 100644 --- a/Sounds/Custom/AdrenalineBurnout1.cs +++ b/Sounds/Custom/AdrenalineBurnout1.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class AdrenalineBurnout1 : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class AdrenalineBurnout1 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/AdrenalineBurnout2.cs b/Sounds/Custom/AdrenalineBurnout2.cs index a5c0654c83..ee7a849e46 100644 --- a/Sounds/Custom/AdrenalineBurnout2.cs +++ b/Sounds/Custom/AdrenalineBurnout2.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class AdrenalineBurnout2 : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class AdrenalineBurnout2 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/AngryDogGrowl.cs b/Sounds/Custom/AngryDogGrowl.cs index 430385477b..4a8f28053e 100644 --- a/Sounds/Custom/AngryDogGrowl.cs +++ b/Sounds/Custom/AngryDogGrowl.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class AngryDogGrowl : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class AngryDogGrowl : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/BazookaRocket.cs b/Sounds/Custom/BazookaRocket.cs index 54df22b756..dfd6cf4bdc 100644 --- a/Sounds/Custom/BazookaRocket.cs +++ b/Sounds/Custom/BazookaRocket.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class BazookaRocket : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class BazookaRocket : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/CorvinaScream.cs b/Sounds/Custom/CorvinaScream.cs index 31ee2cc0b8..5d902ec31c 100644 --- a/Sounds/Custom/CorvinaScream.cs +++ b/Sounds/Custom/CorvinaScream.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class CovirnaScream : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class CovirnaScream : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/DevilMaskBreak.cs b/Sounds/Custom/DevilMaskBreak.cs index 9f3f229ebb..ee274186df 100644 --- a/Sounds/Custom/DevilMaskBreak.cs +++ b/Sounds/Custom/DevilMaskBreak.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class DevilMaskBreak : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class DevilMaskBreak : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/EidolonWyrmRoarClose.cs b/Sounds/Custom/EidolonWyrmRoarClose.cs index 1c06bd4829..5966c55d24 100644 --- a/Sounds/Custom/EidolonWyrmRoarClose.cs +++ b/Sounds/Custom/EidolonWyrmRoarClose.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class EidolonWyrmRoarClose : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class EidolonWyrmRoarClose : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/FullAdrenaline.cs b/Sounds/Custom/FullAdrenaline.cs index 9610af74a1..6993f7794f 100644 --- a/Sounds/Custom/FullAdrenaline.cs +++ b/Sounds/Custom/FullAdrenaline.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class FullAdrenaline : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class FullAdrenaline : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/FullRage.cs b/Sounds/Custom/FullRage.cs index 832ba4ac46..0331603f79 100644 --- a/Sounds/Custom/FullRage.cs +++ b/Sounds/Custom/FullRage.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class FullRage : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class FullRage : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/GreatSandSharkRoar.cs b/Sounds/Custom/GreatSandSharkRoar.cs index 9aa101a651..7c48a96723 100644 --- a/Sounds/Custom/GreatSandSharkRoar.cs +++ b/Sounds/Custom/GreatSandSharkRoar.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class GreatSandSharkRoar : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class GreatSandSharkRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/IronHeartBigHurt.cs b/Sounds/Custom/IronHeartBigHurt.cs index 975c74ed24..b968920933 100644 --- a/Sounds/Custom/IronHeartBigHurt.cs +++ b/Sounds/Custom/IronHeartBigHurt.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class IronHeartBigHurt : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class IronHeartBigHurt : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/IronHeartHurt.cs b/Sounds/Custom/IronHeartHurt.cs index 855242a5c8..f54cf60bf0 100644 --- a/Sounds/Custom/IronHeartHurt.cs +++ b/Sounds/Custom/IronHeartHurt.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class IronHeartHurt : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class IronHeartHurt : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/LegStomp.cs b/Sounds/Custom/LegStomp.cs index 19acea3f87..03705d7d9b 100644 --- a/Sounds/Custom/LegStomp.cs +++ b/Sounds/Custom/LegStomp.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class LegStomp : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class LegStomp : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/MaulerRoar.cs b/Sounds/Custom/MaulerRoar.cs index b863e0dd94..ef6d2acbc9 100644 --- a/Sounds/Custom/MaulerRoar.cs +++ b/Sounds/Custom/MaulerRoar.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class MaulerRoar : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class MaulerRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/ReaperEnragedRoar.cs b/Sounds/Custom/ReaperEnragedRoar.cs index 3f0aefb522..9e1f547ad5 100644 --- a/Sounds/Custom/ReaperEnragedRoar.cs +++ b/Sounds/Custom/ReaperEnragedRoar.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class ReaperEnragedRoar : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class ReaperEnragedRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/ReaperSearchRoar.cs b/Sounds/Custom/ReaperSearchRoar.cs index 37ff2750eb..0b839fc7dc 100644 --- a/Sounds/Custom/ReaperSearchRoar.cs +++ b/Sounds/Custom/ReaperSearchRoar.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class ReaperSearchRoar : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class ReaperSearchRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/RogueStealth.cs b/Sounds/Custom/RogueStealth.cs index 38e8fb6923..ba5ac0f049 100644 --- a/Sounds/Custom/RogueStealth.cs +++ b/Sounds/Custom/RogueStealth.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class RogueStealth : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class RogueStealth : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/SilvaActivation.cs b/Sounds/Custom/SilvaActivation.cs index 2e4fd5829b..0340b5dfd3 100644 --- a/Sounds/Custom/SilvaActivation.cs +++ b/Sounds/Custom/SilvaActivation.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class SilvaActivation : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class SilvaActivation : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/SilvaDispel.cs b/Sounds/Custom/SilvaDispel.cs index fca2f7596f..d0d6b12a60 100644 --- a/Sounds/Custom/SilvaDispel.cs +++ b/Sounds/Custom/SilvaDispel.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class SilvaDispel : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class SilvaDispel : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/WyrmScream.cs b/Sounds/Custom/WyrmScream.cs index 5a3d9c55c2..6411ef1a0f 100644 --- a/Sounds/Custom/WyrmScream.cs +++ b/Sounds/Custom/WyrmScream.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class WyrmScream : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class WyrmScream : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/YharonRoar.cs b/Sounds/Custom/YharonRoar.cs index 111acb76e0..2b2e5cad74 100644 --- a/Sounds/Custom/YharonRoar.cs +++ b/Sounds/Custom/YharonRoar.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class YharonRoar : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class YharonRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Custom/YharonRoarShort.cs b/Sounds/Custom/YharonRoarShort.cs index fbb361c63a..35a1f4dc53 100644 --- a/Sounds/Custom/YharonRoarShort.cs +++ b/Sounds/Custom/YharonRoarShort.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Custom { - public class YharonRoarShort : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class YharonRoarShort : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/BazookaFull.cs b/Sounds/Item/BazookaFull.cs index 706b192231..c5c66590b2 100644 --- a/Sounds/Item/BazookaFull.cs +++ b/Sounds/Item/BazookaFull.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class BazookaFull : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class BazookaFull : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/ClamImpact.cs b/Sounds/Item/ClamImpact.cs index 44221d8653..17f1c95138 100644 --- a/Sounds/Item/ClamImpact.cs +++ b/Sounds/Item/ClamImpact.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class ClamImpact : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class ClamImpact : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/ELRFire.cs b/Sounds/Item/ELRFire.cs index 32f3287cd0..d57b4cb950 100644 --- a/Sounds/Item/ELRFire.cs +++ b/Sounds/Item/ELRFire.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class ELRFire : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class ELRFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/FlareSound.cs b/Sounds/Item/FlareSound.cs index ea8a8c2842..78914e1205 100644 --- a/Sounds/Item/FlareSound.cs +++ b/Sounds/Item/FlareSound.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class FlareSound : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class FlareSound : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/GatlingLaserFireEnd.cs b/Sounds/Item/GatlingLaserFireEnd.cs index e745c850be..4b6ec830aa 100644 --- a/Sounds/Item/GatlingLaserFireEnd.cs +++ b/Sounds/Item/GatlingLaserFireEnd.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class GatlingLaserFireEnd : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class GatlingLaserFireEnd : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/GatlingLaserFireLoop.cs b/Sounds/Item/GatlingLaserFireLoop.cs index 7027f800a9..1d91870dea 100644 --- a/Sounds/Item/GatlingLaserFireLoop.cs +++ b/Sounds/Item/GatlingLaserFireLoop.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class GatlingLaserFireLoop : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class GatlingLaserFireLoop : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/GatlingLaserFireStart.cs b/Sounds/Item/GatlingLaserFireStart.cs index 1e846d6cf9..71753bd430 100644 --- a/Sounds/Item/GatlingLaserFireStart.cs +++ b/Sounds/Item/GatlingLaserFireStart.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class GatlingLaserFireStart : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class GatlingLaserFireStart : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/GaussWeaponFire.cs b/Sounds/Item/GaussWeaponFire.cs index 4cced9c942..16c7d06f53 100644 --- a/Sounds/Item/GaussWeaponFire.cs +++ b/Sounds/Item/GaussWeaponFire.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class GaussWeaponFire : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class GaussWeaponFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/Hydra.cs b/Sounds/Item/Hydra.cs index 65397a6c00..2912d10a5c 100644 --- a/Sounds/Item/Hydra.cs +++ b/Sounds/Item/Hydra.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class Hydra : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class Hydra : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/IronHeartDeath.cs b/Sounds/Item/IronHeartDeath.cs index c2a03a243f..c6a9d97aaa 100644 --- a/Sounds/Item/IronHeartDeath.cs +++ b/Sounds/Item/IronHeartDeath.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class IronHeartDeath : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class IronHeartDeath : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/KendraBark.cs b/Sounds/Item/KendraBark.cs index e2316359b7..0a7ead83b3 100644 --- a/Sounds/Item/KendraBark.cs +++ b/Sounds/Item/KendraBark.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class KendraBark : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class KendraBark : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/LargeMechGaussRifle.cs b/Sounds/Item/LargeMechGaussRifle.cs index 73f8d1464f..8a38060d6e 100644 --- a/Sounds/Item/LargeMechGaussRifle.cs +++ b/Sounds/Item/LargeMechGaussRifle.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class LargeMechGaussRifle : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class LargeMechGaussRifle : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/LargeWeaponFire.cs b/Sounds/Item/LargeWeaponFire.cs index 4e37e03d2f..6200be623a 100644 --- a/Sounds/Item/LargeWeaponFire.cs +++ b/Sounds/Item/LargeWeaponFire.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class LargeWeaponFire : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class LargeWeaponFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/LaserCannon.cs b/Sounds/Item/LaserCannon.cs index a7f08b7159..55d86ffe05 100644 --- a/Sounds/Item/LaserCannon.cs +++ b/Sounds/Item/LaserCannon.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class LaserCannon : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class LaserCannon : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/LaserRifleFire.cs b/Sounds/Item/LaserRifleFire.cs index e50390b559..61cda761ac 100644 --- a/Sounds/Item/LaserRifleFire.cs +++ b/Sounds/Item/LaserRifleFire.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class LaserRifleFire : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class LaserRifleFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/Magnum.cs b/Sounds/Item/Magnum.cs index 01b9968393..fc5a188c3b 100644 --- a/Sounds/Item/Magnum.cs +++ b/Sounds/Item/Magnum.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class Magnum : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class Magnum : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/MechGaussRifle.cs b/Sounds/Item/MechGaussRifle.cs index 0664bb6277..9db467e20b 100644 --- a/Sounds/Item/MechGaussRifle.cs +++ b/Sounds/Item/MechGaussRifle.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class MechGaussRifle : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class MechGaussRifle : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/OpalStrike.cs b/Sounds/Item/OpalStrike.cs index a706d14c3a..1ff69f1a9f 100644 --- a/Sounds/Item/OpalStrike.cs +++ b/Sounds/Item/OpalStrike.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class OpalStrike : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class OpalStrike : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/PlasmaBlast.cs b/Sounds/Item/PlasmaBlast.cs index bd773fa994..1832547f76 100644 --- a/Sounds/Item/PlasmaBlast.cs +++ b/Sounds/Item/PlasmaBlast.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class PlasmaBlast : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class PlasmaBlast : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/PlasmaBolt.cs b/Sounds/Item/PlasmaBolt.cs index 64a791b559..527a3a3301 100644 --- a/Sounds/Item/PlasmaBolt.cs +++ b/Sounds/Item/PlasmaBolt.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class PlasmaBolt : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class PlasmaBolt : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/PlasmaCasterFire.cs b/Sounds/Item/PlasmaCasterFire.cs index 77cbf17307..268254c81f 100644 --- a/Sounds/Item/PlasmaCasterFire.cs +++ b/Sounds/Item/PlasmaCasterFire.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class PlasmaCasterFire : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class PlasmaCasterFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/PulseRifleFire.cs b/Sounds/Item/PulseRifleFire.cs index 64581c9600..f8668c6159 100644 --- a/Sounds/Item/PulseRifleFire.cs +++ b/Sounds/Item/PulseRifleFire.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class PulseRifleFire : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class PulseRifleFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/TankCannon.cs b/Sounds/Item/TankCannon.cs index 366b4b4367..871422338e 100644 --- a/Sounds/Item/TankCannon.cs +++ b/Sounds/Item/TankCannon.cs @@ -4,16 +4,16 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class TankCannon : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1.85f; - soundInstance.Pan = pan; - soundInstance.Pitch = (float)Main.rand.Next(-25, 26) * 0.01f; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class TankCannon : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1.85f; + soundInstance.Pan = pan; + soundInstance.Pitch = (float)Main.rand.Next(-25, 26) * 0.01f; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/Item/TeslaCannonFire.cs b/Sounds/Item/TeslaCannonFire.cs index a7194d0224..38f2549f63 100644 --- a/Sounds/Item/TeslaCannonFire.cs +++ b/Sounds/Item/TeslaCannonFire.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.Item { - public class TeslaCannonFire : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class TeslaCannonFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/NPCHit/AngryDogHit.cs b/Sounds/NPCHit/AngryDogHit.cs index e3392351a6..aab4a98254 100644 --- a/Sounds/NPCHit/AngryDogHit.cs +++ b/Sounds/NPCHit/AngryDogHit.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.NPCHit { - public class AngryDogHit : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class AngryDogHit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/NPCHit/AstrumAureusHit.cs b/Sounds/NPCHit/AstrumAureusHit.cs index b80a42e753..46a3ad03dc 100644 --- a/Sounds/NPCHit/AstrumAureusHit.cs +++ b/Sounds/NPCHit/AstrumAureusHit.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.NPCHit { - public class AstrumAureusHit : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 0.7f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class AstrumAureusHit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 0.7f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Sounds/NPCKilled/Sunskater.cs b/Sounds/NPCKilled/Sunskater.cs index 2ac1735529..cf5d7e2cd7 100644 --- a/Sounds/NPCKilled/Sunskater.cs +++ b/Sounds/NPCKilled/Sunskater.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Sounds.NPCKilled { - public class Sunskater : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 0.9f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } + public class Sunskater : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 0.9f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } diff --git a/Tiles/AbyssGravel.cs b/Tiles/AbyssGravel.cs index 7e5d9f9f7a..ec78bd896c 100644 --- a/Tiles/AbyssGravel.cs +++ b/Tiles/AbyssGravel.cs @@ -1,16 +1,16 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { - public class AbyssGravel : ModTile - { - public override void SetDefaults() - { + public class AbyssGravel : ModTile + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = true; Main.tileMergeDirt[Type] = true; TileMerge.MergeGeneralTiles(Type); @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles minPick = 65; soundType = 21; dustType = 33; - } + } public override bool CanExplode(int i, int j) { diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index 3b28560682..e038834639 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -1,21 +1,21 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { - public class AerialiteBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; + public class AerialiteBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; soundType = 21; minPick = 50; drop = mod.ItemType("AerialiteBrick"); - AddMapEntry(new Color(68, 58, 145)); + AddMapEntry(new Color(68, 58, 145)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/AerialiteOre.cs b/Tiles/AerialiteOre.cs index 6636b4b7dc..1efaeb21dc 100644 --- a/Tiles/AerialiteOre.cs +++ b/Tiles/AerialiteOre.cs @@ -1,40 +1,40 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class AerialiteOre : ModTile - { - public override void SetDefaults() - { - Main.tileValue[Type] = 450; - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileValue[Type] = 450; + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); dustType = mod.DustType("AHSparkle"); - drop = mod.ItemType("AerialiteOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Aerialite Ore"); - AddMapEntry(new Color(0, 255, 255), name); - mineResist = 2f; - minPick = 65; - soundType = 21; - Main.tileSpelunker[Type] = true; - } + drop = mod.ItemType("AerialiteOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Aerialite Ore"); + AddMapEntry(new Color(0, 255, 255), name); + mineResist = 2f; + minPick = 65; + soundType = 21; + Main.tileSpelunker[Type] = true; + } - public override bool CanExplode(int i, int j) - { - return NPC.downedBoss2; - } + public override bool CanExplode(int i, int j) + { + return NPC.downedBoss2; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index 0fbb0f4457..b277ed3186 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -5,16 +5,16 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { public class ArenaTile : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Arena"); - AddMapEntry(new Color(128, 0, 0), name); - } + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Arena"); + AddMapEntry(new Color(128, 0, 0), name); + } public override bool CanKillTile(int i, int j, ref bool blockDamaged) { @@ -22,26 +22,26 @@ namespace CalamityMod.Tiles } public override bool CanExplode(int i, int j) - { - return false; - } + { + return false; + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - WorldGen.KillTile(i, j, false, false, false); - if (!Main.tile[i, j].active() && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); - } - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + WorldGen.KillTile(i, j, false, false, false); + if (!Main.tile[i, j].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); + } + } + } + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = (float)Main.DiscoR / 255f; g = 0f; diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index c0657e412a..e93cf719d8 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -1,5 +1,6 @@ -using System; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -7,244 +8,241 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.GameInput; -using Terraria.GameContent.Achievements; -using CalamityMod.World; namespace CalamityMod.Tiles.Astral { public class AstralChestLocked : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Astral Chest"); - AddMapEntry(new Color(174, 129, 92), name, MapChestName); - name = CreateMapEntryName(Name + "_Locked"); // With multiple map entries, you need unique translation keys. - name.SetDefault("Locked Astral Chest"); - AddMapEntry(new Color(174, 129, 92), name, MapChestName); - dustType = mod.DustType("AstralBasic"); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Astral Chest"; - chestDrop = mod.ItemType("AstralChest"); - } + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Chest"); + AddMapEntry(new Color(174, 129, 92), name, MapChestName); + name = CreateMapEntryName(Name + "_Locked"); // With multiple map entries, you need unique translation keys. + name.SetDefault("Locked Astral Chest"); + AddMapEntry(new Color(174, 129, 92), name, MapChestName); + dustType = mod.DustType("AstralBasic"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Astral Chest"; + chestDrop = mod.ItemType("AstralChest"); + } - public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].frameX / 36); + public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].frameX / 36); - public override bool HasSmartInteract() => true; + public override bool HasSmartInteract() => true; - public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; + public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; - public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) - { - if (!CalamityWorld.downedAstrageldon) - return false; + public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) + { + if (!CalamityWorld.downedAstrageldon) + return false; - dustType = this.dustType; + dustType = this.dustType; - return true; - } + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - return name; - else - return name + ": " + Main.chest[chest].name; - } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + return name; + else + return name + ": " + Main.chest[chest].name; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = 1; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = 1; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; // with 0.11.5 changes this should no longer be necessary - // Main.mouseRightRelease = false; + // Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; // If the player right clicked the chest while editing a sign, finish that up if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } // If the player right clicked the chest while editing a chest, finish that up if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } // If the player right clicked the chest after changing another chest's name, finish that up if (player.editedChestName) - { - NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } - bool isLocked = IsLockedChest(left, top); + bool isLocked = IsLockedChest(left, top); // Unlocked interactions as a client (have to send messages to the server) - if (Main.netMode == NetmodeID.MultiplayerClient && !isLocked) - { + if (Main.netMode == NetmodeID.MultiplayerClient && !isLocked) + { // If you right click the opened chest, it closes itself. This couns as interaction. if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); return true; } // If you right click the closed chest, it opens. This counts as interaction. - else - { - NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; return true; } - } + } // Single player interactions, server interactions, or locked interactions - else - { - if (isLocked) - { + else + { + if (isLocked) + { // If you right click the locked chest and you can unlock it, it unlocks itself but does not open. This counts as interaction. if (Chest.Unlock(left, top)) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, (float)left, (float)top); + { + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, (float)left, (float)top); return true; } - } + } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; // If you right click the same chest you already have open, it closes. This counts as interaction. - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } // If you right click this chest when you have a different chest selected, that one closes and this one opens. This counts as interaction. - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); return true; - } - } - } + } + } + } // This only occurs when the chest is locked and cannot be unlocked. You did not interact with the chest. return false; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Astral Chest"; - if (player.showItemIconText == "Astral Chest") - { - player.showItemIcon2 = mod.ItemType("AstralChest"); - player.showItemIconText = ""; - } - } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Astral Chest"; + if (player.showItemIconText == "Astral Chest") + { + player.showItemIcon2 = mod.ItemType("AstralChest"); + player.showItemIconText = ""; + } + } - player.noThrow = 2; - player.showItemIcon = true; - } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/Astral/AstralCrate.cs b/Tiles/Astral/AstralCrate.cs index 21ca59b0be..14218480cf 100644 --- a/Tiles/Astral/AstralCrate.cs +++ b/Tiles/Astral/AstralCrate.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index bc5f6559a2..a2665ca51c 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -1,15 +1,15 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.Astral { - public class AstralDirt : ModTile - { - public override void SetDefaults() - { + public class AstralDirt : ModTile + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.Astral TileMerge.MergeOreTiles(Type); dustType = mod.DustType("AstralBasic"); - drop = mod.ItemType("AstralDirt"); + drop = mod.ItemType("AstralDirt"); AddMapEntry(new Color(65, 56, 83)); @@ -46,8 +46,8 @@ namespace CalamityMod.Tiles.Astral } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } } } diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index eb89c8f717..57604f82a5 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -1,15 +1,15 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.Astral { public class AstralGrass : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.Astral TileMerge.MergeOreTiles(Type); dustType = mod.DustType("AstralBasic"); - drop = mod.ItemType("AstralDirt"); + drop = mod.ItemType("AstralDirt"); AddMapEntry(new Color(133, 109, 140)); @@ -34,9 +34,9 @@ namespace CalamityMod.Tiles.Astral } public override void NumDust(int i, int j, bool fail, ref int Type) - { - Type = fail ? 1 : 3; - } + { + Type = fail ? 1 : 3; + } public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index 88340f7aef..8c7353bb8e 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -1,9 +1,9 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.Astral { @@ -54,7 +54,7 @@ namespace CalamityMod.Tiles.Astral Texture2D glowmask = mod.GetTexture("Tiles/Astral/AstralMonolith_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour (i, j, new Color(50, 50, 50, 50)); + Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; Texture2D texture3 = glowmask; double num6 = Main.time * 0.08; diff --git a/Tiles/Astral/AstralNormalLargePiles.cs b/Tiles/Astral/AstralNormalLargePiles.cs index 9b962ed9b4..4bb8744f6c 100644 --- a/Tiles/Astral/AstralNormalLargePiles.cs +++ b/Tiles/Astral/AstralNormalLargePiles.cs @@ -1,9 +1,8 @@  -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; - using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.Astral { diff --git a/Tiles/Astral/AstralNormalMediumPiles.cs b/Tiles/Astral/AstralNormalMediumPiles.cs index 14a13a2cac..01feef6d64 100644 --- a/Tiles/Astral/AstralNormalMediumPiles.cs +++ b/Tiles/Astral/AstralNormalMediumPiles.cs @@ -1,9 +1,8 @@  -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; - using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.Astral { diff --git a/Tiles/Astral/AstralNormalSmallPiles.cs b/Tiles/Astral/AstralNormalSmallPiles.cs index 0b51ff4bb2..efd4368bc8 100644 --- a/Tiles/Astral/AstralNormalSmallPiles.cs +++ b/Tiles/Astral/AstralNormalSmallPiles.cs @@ -1,9 +1,8 @@  +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; - namespace CalamityMod.Tiles.Astral { public class AstralNormalSmallPiles : ModTile diff --git a/Tiles/Astral/AstralNormalStalactite.cs b/Tiles/Astral/AstralNormalStalactite.cs index b5f5610a16..29dac383f4 100644 --- a/Tiles/Astral/AstralNormalStalactite.cs +++ b/Tiles/Astral/AstralNormalStalactite.cs @@ -1,9 +1,8 @@  +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; - namespace CalamityMod.Tiles.Astral { public class AstralNormalStalactite : ModTile diff --git a/Tiles/Astral/AstralOre.cs b/Tiles/Astral/AstralOre.cs index f9ac26828b..b004ff0e1b 100644 --- a/Tiles/Astral/AstralOre.cs +++ b/Tiles/Astral/AstralOre.cs @@ -1,20 +1,20 @@ -using System; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.Astral { - public class AstralOre : ModTile - { - public override void SetDefaults() - { + public class AstralOre : ModTile + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = true; Main.tileValue[Type] = 700; Main.tileSpelunker[Type] = true; Main.tileShine2[Type] = true; @@ -23,32 +23,32 @@ namespace CalamityMod.Tiles.Astral TileMerge.MergeAstralTiles(Type); minPick = 200; - dustType = 173; - drop = mod.ItemType("AstralOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Astral Ore"); - AddMapEntry(new Color(255, 153, 255), name); - mineResist = 5f; - soundType = 21; + dustType = 173; + drop = mod.ItemType("AstralOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Ore"); + AddMapEntry(new Color(255, 153, 255), name); + mineResist = 5f; + soundType = 21; TileID.Sets.Ore[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { return CalamityWorld.downedStarGod; - } + } - public override bool CanExplode(int i, int j) + public override bool CanExplode(int i, int j) { return CalamityWorld.downedStarGod; } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override void RandomUpdate(int i, int j) { diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 63513b1ddb..9774f6243e 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -1,15 +1,15 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.Astral { - public class AstralStone : ModTile - { - public override void SetDefaults() - { + public class AstralStone : ModTile + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.Astral TileMerge.MergeOreTiles(Type); dustType = mod.DustType("AstralBasic"); - drop = mod.ItemType("AstralStone"); + drop = mod.ItemType("AstralStone"); soundType = 21; @@ -37,8 +37,8 @@ namespace CalamityMod.Tiles.Astral } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } } } diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index ba355197cd..7d70b9b3d3 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; namespace CalamityMod.Tiles { diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 4db80bdf7d..c764a9ce09 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -5,10 +5,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { - public class AstralVines: ModTile - { - public override void SetDefaults() - { + public class AstralVines : ModTile + { + public override void SetDefaults() + { Main.tileCut[Type] = true; Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; diff --git a/Tiles/AstralBar.cs b/Tiles/AstralBar.cs index 78a2a1bab5..6674c1ff7d 100644 --- a/Tiles/AstralBar.cs +++ b/Tiles/AstralBar.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework; -using Terraria.ModLoader; using Terraria; +using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index b06c5cb47b..f33060353f 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -1,8 +1,8 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,13 +12,13 @@ namespace CalamityMod.Tiles private const short subsheetHeight = 90; public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; soundType = 21; minPick = 150; drop = mod.ItemType("AstralBrick"); - AddMapEntry(new Color(128, 128, 158)); + AddMapEntry(new Color(128, 128, 158)); } public override bool CreateDust(int i, int j, ref int type) @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles Texture2D glowmask = mod.GetTexture("Tiles/AstralBrick_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour (i, j, new Color(50, 50, 50, 50)); + Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) diff --git a/Tiles/AstralDesert/AstralDesertLargePiles.cs b/Tiles/AstralDesert/AstralDesertLargePiles.cs index 636bf91a7c..4508407c05 100644 --- a/Tiles/AstralDesert/AstralDesertLargePiles.cs +++ b/Tiles/AstralDesert/AstralDesertLargePiles.cs @@ -1,9 +1,8 @@  -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; - using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.AstralDesert { diff --git a/Tiles/AstralDesert/AstralDesertMediumPiles.cs b/Tiles/AstralDesert/AstralDesertMediumPiles.cs index e42d0b6e46..386ef747e8 100644 --- a/Tiles/AstralDesert/AstralDesertMediumPiles.cs +++ b/Tiles/AstralDesert/AstralDesertMediumPiles.cs @@ -1,9 +1,8 @@  -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; - using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.AstralDesert { diff --git a/Tiles/AstralDesert/AstralDesertSmallPiles.cs b/Tiles/AstralDesert/AstralDesertSmallPiles.cs index da5644336c..2efaea20c9 100644 --- a/Tiles/AstralDesert/AstralDesertSmallPiles.cs +++ b/Tiles/AstralDesert/AstralDesertSmallPiles.cs @@ -1,12 +1,11 @@  +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; - namespace CalamityMod.Tiles.AstralDesert { - public class AstralDesertSmallPiles: ModTile + public class AstralDesertSmallPiles : ModTile { public override void SetDefaults() { diff --git a/Tiles/AstralDesert/AstralDesertStalactite.cs b/Tiles/AstralDesert/AstralDesertStalactite.cs index 685b3959a1..83df713645 100644 --- a/Tiles/AstralDesert/AstralDesertStalactite.cs +++ b/Tiles/AstralDesert/AstralDesertStalactite.cs @@ -1,9 +1,8 @@  +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; - namespace CalamityMod.Tiles.AstralDesert { public class AstralDesertStalactite : ModTile diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index a75a112354..811476b238 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; namespace CalamityMod.Tiles { diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 5933801526..b8467726fa 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -1,16 +1,16 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.AstralDesert { - public class AstralSand : ModTile - { - public override void SetDefaults() - { + public class AstralSand : ModTile + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileSand[Type] = true; @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.AstralDesert TileMerge.MergeAstralTiles(Type); dustType = 108; - drop = mod.ItemType("AstralSand"); + drop = mod.ItemType("AstralSand"); AddMapEntry(new Color(149, 156, 155)); @@ -34,9 +34,9 @@ namespace CalamityMod.Tiles.AstralDesert } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index c71998870a..3485250031 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -1,15 +1,15 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.AstralDesert { - public class AstralSandstone : ModTile - { - public override void SetDefaults() - { + public class AstralSandstone : ModTile + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.AstralDesert TileMerge.MergeAstralTiles(Type); dustType = mod.DustType("AstralBasic"); - drop = mod.ItemType("AstralSandstone"); + drop = mod.ItemType("AstralSandstone"); AddMapEntry(new Color(79, 61, 97)); @@ -32,8 +32,8 @@ namespace CalamityMod.Tiles.AstralDesert } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } } } diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 85a27c2341..abfa4af7d5 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -1,15 +1,15 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.AstralDesert { - public class HardenedAstralSand : ModTile - { - public override void SetDefaults() - { + public class HardenedAstralSand : ModTile + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.AstralDesert dustType = 108; - drop = mod.ItemType("HardenedAstralSand"); + drop = mod.ItemType("HardenedAstralSand"); AddMapEntry(new Color(45, 36, 63)); @@ -33,8 +33,8 @@ namespace CalamityMod.Tiles.AstralDesert } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } } } diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index d9b9b1f278..ac52721f7e 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -1,15 +1,15 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.AstralSnow { - public class AstralIce : ModTile - { - public override void SetDefaults() - { + public class AstralIce : ModTile + { + public override void SetDefaults() + { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.AstralSnow TileMerge.MergeAstralTiles(Type); dustType = 173; - drop = mod.ItemType("AstralIce"); + drop = mod.ItemType("AstralIce"); soundType = 2; soundStyle = 50; @@ -35,9 +35,9 @@ namespace CalamityMod.Tiles.AstralSnow } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override void FloorVisuals(Player player) { diff --git a/Tiles/AstralSnow/AstralIceLargePiles.cs b/Tiles/AstralSnow/AstralIceLargePiles.cs index 96fae43edb..7549f22758 100644 --- a/Tiles/AstralSnow/AstralIceLargePiles.cs +++ b/Tiles/AstralSnow/AstralIceLargePiles.cs @@ -1,9 +1,8 @@  -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; - using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.AstralSnow { diff --git a/Tiles/AstralSnow/AstralIceMediumPiles.cs b/Tiles/AstralSnow/AstralIceMediumPiles.cs index 19913a8ca0..c96bff1053 100644 --- a/Tiles/AstralSnow/AstralIceMediumPiles.cs +++ b/Tiles/AstralSnow/AstralIceMediumPiles.cs @@ -1,9 +1,8 @@  -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; - using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.AstralSnow { diff --git a/Tiles/AstralSnow/AstralIceSmallPiles.cs b/Tiles/AstralSnow/AstralIceSmallPiles.cs index bb5ff556e9..fb54e58d94 100644 --- a/Tiles/AstralSnow/AstralIceSmallPiles.cs +++ b/Tiles/AstralSnow/AstralIceSmallPiles.cs @@ -1,9 +1,8 @@  +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; - namespace CalamityMod.Tiles.AstralSnow { public class AstralIceSmallPiles : ModTile diff --git a/Tiles/AstralSnow/AstralIceStalactite.cs b/Tiles/AstralSnow/AstralIceStalactite.cs index 21bac11ecf..5fd537d5a2 100644 --- a/Tiles/AstralSnow/AstralIceStalactite.cs +++ b/Tiles/AstralSnow/AstralIceStalactite.cs @@ -1,9 +1,8 @@  +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; - namespace CalamityMod.Tiles.AstralSnow { public class AstralIceStalactite : ModTile diff --git a/Tiles/AuricOre.cs b/Tiles/AuricOre.cs index 1f40eb2aa4..809a6f4f56 100644 --- a/Tiles/AuricOre.cs +++ b/Tiles/AuricOre.cs @@ -1,43 +1,43 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class AuricOre : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSpelunker[Type] = true; - Main.tileValue[Type] = 810; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileValue[Type] = 810; TileMerge.MergeGeneralTiles(Type); dustType = 55; - drop = mod.ItemType("AuricOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Auric Ore"); - AddMapEntry(new Color(255, 200, 0), name); - mineResist = 10f; - minPick = 275; - soundType = 21; - } + drop = mod.ItemType("AuricOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Auric Ore"); + AddMapEntry(new Color(255, 200, 0), name); + mineResist = 10f; + minPick = 275; + soundType = 21; + } - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedYharon; - } + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedYharon; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { diff --git a/Tiles/BlueCandle.cs b/Tiles/BlueCandle.cs index 0f231799ba..2125112baa 100644 --- a/Tiles/BlueCandle.cs +++ b/Tiles/BlueCandle.cs @@ -7,48 +7,48 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { public class BlueCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Weightless Candle"); + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Weightless Candle"); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 34; - } + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 34; + } - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("BlueSpeedCandle"), 20); - } + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("BlueSpeedCandle"), 20); + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.35f; - g = 0.55f; - b = 0.85f; - } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.35f; + g = 0.55f; + b = 0.85f; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BlueCandle")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BlueCandle")); + } + } } diff --git a/Tiles/BossTrophy.cs b/Tiles/BossTrophy.cs index 689571c8ae..6d0bc3ad23 100644 --- a/Tiles/BossTrophy.cs +++ b/Tiles/BossTrophy.cs @@ -5,79 +5,79 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { - public class BossTrophy : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.addTile(Type); - dustType = 7; - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Trophy"); - AddMapEntry(new Color(120, 85, 60), name); - } + public class BossTrophy : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.addTile(Type); + dustType = 7; + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Trophy"); + AddMapEntry(new Color(120, 85, 60), name); + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - int item = 0; - switch (frameX / 54) - { - case 0: - item = mod.ItemType("DesertScourgeTrophy"); - break; - case 1: - item = mod.ItemType("PerforatorTrophy"); - break; - case 2: - item = mod.ItemType("SlimeGodTrophy"); - break; - case 3: - item = mod.ItemType("CryogenTrophy"); - break; - case 4: - item = mod.ItemType("PlaguebringerGoliathTrophy"); - break; - case 5: - item = mod.ItemType("LeviathanTrophy"); - break; - case 6: - item = mod.ItemType("ProvidenceTrophy"); - break; - case 7: - item = mod.ItemType("CalamitasTrophy"); - break; - case 8: - item = mod.ItemType("HiveMindTrophy"); - break; - case 9: - item = mod.ItemType("CrabulonTrophy"); - break; - case 10: - item = mod.ItemType("YharonTrophy"); - break; - case 11: - item = mod.ItemType("SignusTrophy"); - break; - case 12: - item = mod.ItemType("WeaverTrophy"); - break; - case 13: - item = mod.ItemType("CeaselessVoidTrophy"); - break; - case 14: - item = mod.ItemType("DevourerofGodsTrophy"); - break; - case 15: - item = mod.ItemType("CatastropheTrophy"); - break; - case 16: - item = mod.ItemType("CataclysmTrophy"); - break; + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + int item = 0; + switch (frameX / 54) + { + case 0: + item = mod.ItemType("DesertScourgeTrophy"); + break; + case 1: + item = mod.ItemType("PerforatorTrophy"); + break; + case 2: + item = mod.ItemType("SlimeGodTrophy"); + break; + case 3: + item = mod.ItemType("CryogenTrophy"); + break; + case 4: + item = mod.ItemType("PlaguebringerGoliathTrophy"); + break; + case 5: + item = mod.ItemType("LeviathanTrophy"); + break; + case 6: + item = mod.ItemType("ProvidenceTrophy"); + break; + case 7: + item = mod.ItemType("CalamitasTrophy"); + break; + case 8: + item = mod.ItemType("HiveMindTrophy"); + break; + case 9: + item = mod.ItemType("CrabulonTrophy"); + break; + case 10: + item = mod.ItemType("YharonTrophy"); + break; + case 11: + item = mod.ItemType("SignusTrophy"); + break; + case 12: + item = mod.ItemType("WeaverTrophy"); + break; + case 13: + item = mod.ItemType("CeaselessVoidTrophy"); + break; + case 14: + item = mod.ItemType("DevourerofGodsTrophy"); + break; + case 15: + item = mod.ItemType("CatastropheTrophy"); + break; + case 16: + item = mod.ItemType("CataclysmTrophy"); + break; case 17: item = mod.ItemType("PolterghastTrophy"); break; @@ -97,10 +97,10 @@ namespace CalamityMod.Tiles item = mod.ItemType("RavagerTrophy"); break; } - if (item > 0) - { - Item.NewItem(i * 16, j * 16, 48, 48, item); - } - } - } + if (item > 0) + { + Item.NewItem(i * 16, j * 16, 48, 48, item); + } + } + } } diff --git a/Tiles/BrimstoneSlag.cs b/Tiles/BrimstoneSlag.cs index 4f9670aaa5..3b57834369 100644 --- a/Tiles/BrimstoneSlag.cs +++ b/Tiles/BrimstoneSlag.cs @@ -1,20 +1,20 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class BrimstoneSlag : ModTile - { + { private const short subsheetWidth = 450; private const short subsheetHeight = 198; - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeHellTiles(Type); @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles mineResist = 3f; minPick = 180; drop = mod.ItemType("BrimstoneSlag"); - AddMapEntry(new Color(53, 33, 56)); + AddMapEntry(new Color(53, 33, 56)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 398c703e7b..1ccab7c641 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -1,34 +1,29 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.IO; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class CalamityGlobalTile : GlobalTile - { - public static ushort[] PlantTypes = new ushort[] - { - TileID.Plants, - TileID.CorruptPlants, - TileID.JunglePlants, - TileID.MushroomPlants, - TileID.Plants2, - TileID.JunglePlants2, - TileID.HallowedPlants, - TileID.HallowedPlants2, - TileID.FleshWeeds, - (ushort)ModContent.GetInstance().TileType("AstralShortPlants"), - (ushort)ModContent.GetInstance().TileType("AstralTallPlants") - }; + { + public static ushort[] PlantTypes = new ushort[] + { + TileID.Plants, + TileID.CorruptPlants, + TileID.JunglePlants, + TileID.MushroomPlants, + TileID.Plants2, + TileID.JunglePlants2, + TileID.HallowedPlants, + TileID.HallowedPlants2, + TileID.FleshWeeds, + (ushort)ModContent.GetInstance().TileType("AstralShortPlants"), + (ushort)ModContent.GetInstance().TileType("AstralTallPlants") + }; public override void SetDefaults() { @@ -49,8 +44,8 @@ namespace CalamityMod.Tiles if (CalamityMod.lightList != null) { foreach (int i in CalamityMod.lightList) - { - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch, i); + { + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch, i); } } if (CalamityMod.tableList != null) @@ -63,527 +58,527 @@ namespace CalamityMod.Tiles } public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) - { - for (int k = 0; k < PlantTypes.Length; k++) - { - if (PlantTypes[k] == type) - { - CustomTileFraming.CheckPlants(i, j); - return false; - } - } - if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == mod.TileType("AstralVines")) - { - CustomTileFraming.VineFrame(i, j); - return false; - } - return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); - } + { + for (int k = 0; k < PlantTypes.Length; k++) + { + if (PlantTypes[k] == type) + { + CustomTileFraming.CheckPlants(i, j); + return false; + } + } + if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == mod.TileType("AstralVines")) + { + CustomTileFraming.VineFrame(i, j); + return false; + } + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); + } - public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) - { - Tile tile = Main.tile[i, j]; + public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; - if (type == TileID.Cactus) - { - //GRABBING VARIABLES FOR CERTAIN THINGS - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - zero = Vector2.Zero; - //TESTING STUFF - int frameX = tile.frameX; - int frameY = tile.frameY; - bool astralCactus = false; - if (!Main.canDrawColorTile(i, j)) - { - int xTile = i; - if (frameX == 36) - { - xTile--; - } - if (frameX == 54) - { - xTile++; - } - if (frameX == 108) - { - if (frameY == 18) - { - xTile--; - } - else - { - xTile++; - } - } - int yTile = j; - bool flag = false; - if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) - { - flag = true; - } - while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[(int)Main.tile[xTile, yTile].type] || !flag) - { - if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) - { - flag = true; - } - yTile++; - if (yTile > i + 20) - { - break; - } - } - //CACTUS CHECK - if (Main.tile[xTile, yTile].type == (ushort)mod.TileType("AstralSand")) - { - astralCactus = true; - } - } - //Draw Glow - if (astralCactus) - { - spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f); - } - return; - } - } + if (type == TileID.Cactus) + { + //GRABBING VARIABLES FOR CERTAIN THINGS + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + zero = Vector2.Zero; + //TESTING STUFF + int frameX = tile.frameX; + int frameY = tile.frameY; + bool astralCactus = false; + if (!Main.canDrawColorTile(i, j)) + { + int xTile = i; + if (frameX == 36) + { + xTile--; + } + if (frameX == 54) + { + xTile++; + } + if (frameX == 108) + { + if (frameY == 18) + { + xTile--; + } + else + { + xTile++; + } + } + int yTile = j; + bool flag = false; + if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) + { + flag = true; + } + while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[(int)Main.tile[xTile, yTile].type] || !flag) + { + if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) + { + flag = true; + } + yTile++; + if (yTile > i + 20) + { + break; + } + } + //CACTUS CHECK + if (Main.tile[xTile, yTile].type == (ushort)mod.TileType("AstralSand")) + { + astralCactus = true; + } + } + //Draw Glow + if (astralCactus) + { + spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f); + } + return; + } + } - public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) - { - if (Main.tile[i, j].type != mod.TileType("LumenylCrystals") && Main.tile[i, j].type != mod.TileType("SeaPrismCrystals") && Main.tileSolid[Main.tile[i, j].type]) - { - if (Main.tile[i + 1, j] != null) - { - if (Main.tile[i + 1, j].active()) - { - if (Main.tile[i + 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i + 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i + 1, j, false, false, false); - if (!Main.tile[i + 1, j].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i + 1, (float)j, 0f, 0, 0, 0); - } - } - } - } - if (Main.tile[i - 1, j] != null) - { - if (Main.tile[i - 1, j].active()) - { - if (Main.tile[i - 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i - 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i - 1, j, false, false, false); - if (!Main.tile[i - 1, j].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i - 1, (float)j, 0f, 0, 0, 0); - } - } - } - } - if (Main.tile[i, j + 1] != null) - { - if (Main.tile[i, j + 1].active()) - { - if (Main.tile[i, j + 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j + 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i, j + 1, false, false, false); - if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); - } - } - } - } - if (Main.tile[i, j - 1] != null) - { - if (Main.tile[i, j - 1].active()) - { - if (Main.tile[i, j - 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j - 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i, j - 1, false, false, false); - if (!Main.tile[i, j - 1].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j - 1, 0f, 0, 0, 0); - } - } - } - } - } - } + public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (Main.tile[i, j].type != mod.TileType("LumenylCrystals") && Main.tile[i, j].type != mod.TileType("SeaPrismCrystals") && Main.tileSolid[Main.tile[i, j].type]) + { + if (Main.tile[i + 1, j] != null) + { + if (Main.tile[i + 1, j].active()) + { + if (Main.tile[i + 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i + 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i + 1, j, false, false, false); + if (!Main.tile[i + 1, j].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i + 1, (float)j, 0f, 0, 0, 0); + } + } + } + } + if (Main.tile[i - 1, j] != null) + { + if (Main.tile[i - 1, j].active()) + { + if (Main.tile[i - 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i - 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i - 1, j, false, false, false); + if (!Main.tile[i - 1, j].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i - 1, (float)j, 0f, 0, 0, 0); + } + } + } + } + if (Main.tile[i, j + 1] != null) + { + if (Main.tile[i, j + 1].active()) + { + if (Main.tile[i, j + 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j + 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i, j + 1, false, false, false); + if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + } + } + if (Main.tile[i, j - 1] != null) + { + if (Main.tile[i, j - 1].active()) + { + if (Main.tile[i, j - 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j - 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i, j - 1, false, false, false); + if (!Main.tile[i, j - 1].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j - 1, 0f, 0, 0, 0); + } + } + } + } + } + } - public override bool Drop(int i, int j, int type) - { - if (type == 28) - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmSteps = y / 4; - int abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.055)); //132 = 1932 large - if (y < 1500) - { - abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.095)); //114 = 1014 small - } - else if (y < 2100) - { - abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.0735)); //132 = 1482 medium - } - int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); + public override bool Drop(int i, int j, int type) + { + if (type == 28) + { + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmSteps = y / 4; + int abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.055)); //132 = 1932 large + if (y < 1500) + { + abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.095)); //114 = 1014 small + } + else if (y < 2100) + { + abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.0735)); //132 = 1482 medium + } + int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); - bool abyssPosX = false; - bool sulphurPosX = false; - bool abyssPosY = (j <= abyssChasmY); - if (CalamityWorld.abyssSide) - { - if (i < 380) - { - sulphurPosX = true; - } - if (i < abyssChasmX + 80) - { - abyssPosX = true; - } - } - else - { - if (i > Main.maxTilesX - 380) - { - sulphurPosX = true; - } - if (i > abyssChasmX - 80) - { - abyssPosX = true; - } - } - if (abyssPosX && abyssPosY) - { - if (Main.rand.NextBool(10)) - { - int expr_B64 = WorldGen.genRand.Next(15); - if (expr_B64 == 0) - { - Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); - } - if (expr_B64 == 1) - { - Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); - } - if (expr_B64 == 2) - { - Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); - } - if (expr_B64 == 3) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 4) - { - Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); - } - if (expr_B64 == 5) - { - Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); - } - if (expr_B64 == 6) - { - Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); - } - if (expr_B64 == 7) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 8) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); - } - if (expr_B64 == 9) - { - Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); - } - if (expr_B64 == 10) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); - } - if (expr_B64 == 11) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); - } - if (expr_B64 == 12) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); - } - if (expr_B64 == 13) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); - } - if (expr_B64 == 14) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); - } - } - else - { - int num9 = Main.rand.Next(10); //0 to 9 - if (num9 == 0) //spelunker glowsticks - { - int num10 = Main.rand.Next(2, 6); - if (Main.expertMode) - { - num10 += Main.rand.Next(1, 7); - } - Item.NewItem(i * 16, j * 16, 16, 16, 3002, num10, false, 0, false, false); - } - else if (num9 == 1) //hellfire arrows - { - int stack = Main.rand.Next(10, 21); - Item.NewItem(i * 16, j * 16, 16, 16, 265, stack, false, 0, false, false); - } - else if (num9 == 2) //stew - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("SunkenStew"), 1, false, 0, false, false); - } - else if (num9 == 3) //sticky dynamite - { - Item.NewItem(i * 16, j * 16, 16, 16, 2896, 1, false, 0, false, false); - } - else //money - { - float num13 = (float)(5000 + WorldGen.genRand.Next(-100, 101)); - while ((int)num13 > 0) - { - if (num13 > 1000000f) - { - int num14 = (int)(num13 / 1000000f); - if (num14 > 50 && Main.rand.NextBool(2)) - { - num14 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num14 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(1000000 * num14); - Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); - } - else if (num13 > 10000f) - { - int num15 = (int)(num13 / 10000f); - if (num15 > 50 && Main.rand.NextBool(2)) - { - num15 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num15 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(10000 * num15); - Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); - } - else if (num13 > 100f) - { - int num16 = (int)(num13 / 100f); - if (num16 > 50 && Main.rand.NextBool(2)) - { - num16 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num16 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(100 * num16); - Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); - } - else - { - int num17 = (int)num13; - if (num17 > 50 && Main.rand.NextBool(2)) - { - num17 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num17 /= Main.rand.Next(4) + 1; - } - if (num17 < 1) - { - num17 = 1; - } - num13 -= (float)num17; - Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); - } - } - } - } - } - else if (sulphurPosX) - { - if (Main.rand.NextBool(15)) - { - int expr_B64 = WorldGen.genRand.Next(15); - if (expr_B64 == 0) - { - Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); - } - if (expr_B64 == 1) - { - Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); - } - if (expr_B64 == 2) - { - Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); - } - if (expr_B64 == 3) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 4) - { - Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); - } - if (expr_B64 == 5) - { - Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); - } - if (expr_B64 == 6) - { - Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); - } - if (expr_B64 == 7) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 8) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); - } - if (expr_B64 == 9) - { - Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); - } - if (expr_B64 == 10) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); - } - if (expr_B64 == 11) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); - } - if (expr_B64 == 12) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); - } - if (expr_B64 == 13) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); - } - if (expr_B64 == 14) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); - } - } - else - { - int num9 = Main.rand.Next(10); //0 to 9 - if (num9 == 0) //glowsticks - { - int num10 = Main.rand.Next(2, 6); - if (Main.expertMode) - { - num10 += Main.rand.Next(1, 7); - } - Item.NewItem(i * 16, j * 16, 16, 16, 282, num10, false, 0, false, false); - } - else if (num9 == 1) //jesters arrows - { - int stack = Main.rand.Next(10, 21); - Item.NewItem(i * 16, j * 16, 16, 16, 51, stack, false, 0, false, false); - } - else if (num9 == 2) //potion - { - Item.NewItem(i * 16, j * 16, 16, 16, 188, 1, false, 0, false, false); - } - else if (num9 == 3) //bomb - { - int stack = Main.rand.Next(5, 9); - Item.NewItem(i * 16, j * 16, 16, 16, 166, 1, false, 0, false, false); - } - else //money - { - float num13 = (float)(2500 + WorldGen.genRand.Next(-100, 101)); - while ((int)num13 > 0) - { - if (num13 > 1000000f) - { - int num14 = (int)(num13 / 1000000f); - if (num14 > 50 && Main.rand.NextBool(2)) - { - num14 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num14 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(1000000 * num14); - Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); - } - else if (num13 > 10000f) - { - int num15 = (int)(num13 / 10000f); - if (num15 > 50 && Main.rand.NextBool(2)) - { - num15 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num15 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(10000 * num15); - Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); - } - else if (num13 > 100f) - { - int num16 = (int)(num13 / 100f); - if (num16 > 50 && Main.rand.NextBool(2)) - { - num16 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num16 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(100 * num16); - Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); - } - else - { - int num17 = (int)num13; - if (num17 > 50 && Main.rand.NextBool(2)) - { - num17 /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - num17 /= Main.rand.Next(4) + 1; - } - if (num17 < 1) - { - num17 = 1; - } - num13 -= (float)num17; - Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); - } - } - } - } - } - } - return true; - } + bool abyssPosX = false; + bool sulphurPosX = false; + bool abyssPosY = (j <= abyssChasmY); + if (CalamityWorld.abyssSide) + { + if (i < 380) + { + sulphurPosX = true; + } + if (i < abyssChasmX + 80) + { + abyssPosX = true; + } + } + else + { + if (i > Main.maxTilesX - 380) + { + sulphurPosX = true; + } + if (i > abyssChasmX - 80) + { + abyssPosX = true; + } + } + if (abyssPosX && abyssPosY) + { + if (Main.rand.NextBool(10)) + { + int expr_B64 = WorldGen.genRand.Next(15); + if (expr_B64 == 0) + { + Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); + } + if (expr_B64 == 1) + { + Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); + } + if (expr_B64 == 2) + { + Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); + } + if (expr_B64 == 3) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 4) + { + Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); + } + if (expr_B64 == 5) + { + Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); + } + if (expr_B64 == 6) + { + Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); + } + if (expr_B64 == 7) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 8) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); + } + if (expr_B64 == 9) + { + Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); + } + if (expr_B64 == 10) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); + } + if (expr_B64 == 11) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); + } + if (expr_B64 == 12) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); + } + if (expr_B64 == 13) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); + } + if (expr_B64 == 14) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); + } + } + else + { + int num9 = Main.rand.Next(10); //0 to 9 + if (num9 == 0) //spelunker glowsticks + { + int num10 = Main.rand.Next(2, 6); + if (Main.expertMode) + { + num10 += Main.rand.Next(1, 7); + } + Item.NewItem(i * 16, j * 16, 16, 16, 3002, num10, false, 0, false, false); + } + else if (num9 == 1) //hellfire arrows + { + int stack = Main.rand.Next(10, 21); + Item.NewItem(i * 16, j * 16, 16, 16, 265, stack, false, 0, false, false); + } + else if (num9 == 2) //stew + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("SunkenStew"), 1, false, 0, false, false); + } + else if (num9 == 3) //sticky dynamite + { + Item.NewItem(i * 16, j * 16, 16, 16, 2896, 1, false, 0, false, false); + } + else //money + { + float num13 = (float)(5000 + WorldGen.genRand.Next(-100, 101)); + while ((int)num13 > 0) + { + if (num13 > 1000000f) + { + int num14 = (int)(num13 / 1000000f); + if (num14 > 50 && Main.rand.NextBool(2)) + { + num14 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num14 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(1000000 * num14); + Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); + } + else if (num13 > 10000f) + { + int num15 = (int)(num13 / 10000f); + if (num15 > 50 && Main.rand.NextBool(2)) + { + num15 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num15 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(10000 * num15); + Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); + } + else if (num13 > 100f) + { + int num16 = (int)(num13 / 100f); + if (num16 > 50 && Main.rand.NextBool(2)) + { + num16 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num16 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(100 * num16); + Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); + } + else + { + int num17 = (int)num13; + if (num17 > 50 && Main.rand.NextBool(2)) + { + num17 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num17 /= Main.rand.Next(4) + 1; + } + if (num17 < 1) + { + num17 = 1; + } + num13 -= (float)num17; + Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); + } + } + } + } + } + else if (sulphurPosX) + { + if (Main.rand.NextBool(15)) + { + int expr_B64 = WorldGen.genRand.Next(15); + if (expr_B64 == 0) + { + Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); + } + if (expr_B64 == 1) + { + Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); + } + if (expr_B64 == 2) + { + Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); + } + if (expr_B64 == 3) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 4) + { + Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); + } + if (expr_B64 == 5) + { + Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); + } + if (expr_B64 == 6) + { + Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); + } + if (expr_B64 == 7) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 8) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); + } + if (expr_B64 == 9) + { + Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); + } + if (expr_B64 == 10) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); + } + if (expr_B64 == 11) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); + } + if (expr_B64 == 12) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); + } + if (expr_B64 == 13) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); + } + if (expr_B64 == 14) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); + } + } + else + { + int num9 = Main.rand.Next(10); //0 to 9 + if (num9 == 0) //glowsticks + { + int num10 = Main.rand.Next(2, 6); + if (Main.expertMode) + { + num10 += Main.rand.Next(1, 7); + } + Item.NewItem(i * 16, j * 16, 16, 16, 282, num10, false, 0, false, false); + } + else if (num9 == 1) //jesters arrows + { + int stack = Main.rand.Next(10, 21); + Item.NewItem(i * 16, j * 16, 16, 16, 51, stack, false, 0, false, false); + } + else if (num9 == 2) //potion + { + Item.NewItem(i * 16, j * 16, 16, 16, 188, 1, false, 0, false, false); + } + else if (num9 == 3) //bomb + { + int stack = Main.rand.Next(5, 9); + Item.NewItem(i * 16, j * 16, 16, 16, 166, 1, false, 0, false, false); + } + else //money + { + float num13 = (float)(2500 + WorldGen.genRand.Next(-100, 101)); + while ((int)num13 > 0) + { + if (num13 > 1000000f) + { + int num14 = (int)(num13 / 1000000f); + if (num14 > 50 && Main.rand.NextBool(2)) + { + num14 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num14 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(1000000 * num14); + Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); + } + else if (num13 > 10000f) + { + int num15 = (int)(num13 / 10000f); + if (num15 > 50 && Main.rand.NextBool(2)) + { + num15 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num15 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(10000 * num15); + Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); + } + else if (num13 > 100f) + { + int num16 = (int)(num13 / 100f); + if (num16 > 50 && Main.rand.NextBool(2)) + { + num16 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num16 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(100 * num16); + Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); + } + else + { + int num17 = (int)num13; + if (num17 > 50 && Main.rand.NextBool(2)) + { + num17 /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + num17 /= Main.rand.Next(4) + 1; + } + if (num17 < 1) + { + num17 = 1; + } + num13 -= (float)num17; + Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); + } + } + } + } + } + } + return true; + } - public override bool PreHitWire(int i, int j, int type) - { - return !CalamityWorld.bossRushActive; - } - } + public override bool PreHitWire(int i, int j, int type) + { + return !CalamityWorld.bossRushActive; + } + } } diff --git a/Tiles/ChaosCandle.cs b/Tiles/ChaosCandle.cs index fb9be0d0c5..1b43671936 100644 --- a/Tiles/ChaosCandle.cs +++ b/Tiles/ChaosCandle.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); TileObjectData.addTile(Type); - drop = mod.ItemType("ChaosCandle"); + drop = mod.ItemType("ChaosCandle"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Chaos Candle"); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles animationFrameHeight = 20; } - public override void AnimateTile(ref int frame, ref int frameCounter) + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; if (frameCounter >= 4) @@ -33,32 +33,32 @@ namespace CalamityMod.Tiles } } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ChaosCandle"); - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("ChaosCandle"), 20); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + public override void MouseOver(int i, int j) { - r = 0.85f; - g = 0.25f; - b = 0.25f; + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ChaosCandle"); } - /*public override void RightClick(int i, int j) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("ChaosCandle")); - ?? KillTile( i, j); - }*/ + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("ChaosCandle"), 20); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.85f; + g = 0.25f; + b = 0.25f; + } + + /*public override void RightClick(int i, int j) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("ChaosCandle")); + ?? KillTile( i, j); + }*/ } } diff --git a/Tiles/ChaoticBrick.cs b/Tiles/ChaoticBrick.cs index 634edaaf95..6985266e4d 100644 --- a/Tiles/ChaoticBrick.cs +++ b/Tiles/ChaoticBrick.cs @@ -5,24 +5,24 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { public class ChaoticBrick : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; dustType = 105; - drop = mod.ItemType("ChaoticBrick"); + drop = mod.ItemType("ChaoticBrick"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Chaotic Brick"); AddMapEntry(new Color(255, 0, 0), name); - soundType = 21; - } + soundType = 21; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { diff --git a/Tiles/ChaoticOre.cs b/Tiles/ChaoticOre.cs index 44e6168573..64b9fcc7b8 100644 --- a/Tiles/ChaoticOre.cs +++ b/Tiles/ChaoticOre.cs @@ -1,31 +1,31 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class ChaoticOre : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileValue[Type] = 750; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 750; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeAbyssTiles(Type); dustType = 105; - drop = mod.ItemType("ChaoticOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Chaotic Ore"); - AddMapEntry(new Color(255, 0, 0), name); - mineResist = 4f; - minPick = 210; - soundType = 21; - } + drop = mod.ItemType("ChaoticOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Chaotic Ore"); + AddMapEntry(new Color(255, 0, 0), name); + mineResist = 4f; + minPick = 210; + soundType = 21; + } public override void NearbyEffects(int i, int j, bool closer) { @@ -58,14 +58,14 @@ namespace CalamityMod.Tiles } public override bool CanExplode(int i, int j) - { - return NPC.downedGolemBoss; - } + { + return NPC.downedGolemBoss; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { diff --git a/Tiles/CharredOre.cs b/Tiles/CharredOre.cs index 3c048beb99..f8c782e849 100644 --- a/Tiles/CharredOre.cs +++ b/Tiles/CharredOre.cs @@ -1,7 +1,7 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { diff --git a/Tiles/Cinderplate.cs b/Tiles/Cinderplate.cs index 84e2011624..bc599af8b9 100644 --- a/Tiles/Cinderplate.cs +++ b/Tiles/Cinderplate.cs @@ -1,18 +1,18 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class Cinderplate : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); @@ -20,7 +20,7 @@ namespace CalamityMod.Tiles mineResist = 1f; minPick = 180; drop = mod.ItemType("Cinderplate"); - AddMapEntry(new Color(173, 52, 70)); + AddMapEntry(new Color(173, 52, 70)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/CorruptionEffigy.cs b/Tiles/CorruptionEffigy.cs index fb31a3c1a3..8a3ad2780c 100644 --- a/Tiles/CorruptionEffigy.cs +++ b/Tiles/CorruptionEffigy.cs @@ -6,30 +6,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { public class CorruptionEffigy : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.newTile.Width = 2; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Corruption Effigy"); - AddMapEntry(new Color(238, 145, 105), name); - } + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Corruption Effigy"); + AddMapEntry(new Color(238, 145, 105), name); + } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("CorruptionEffigyBuff"), 20); - } + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("CorruptionEffigyBuff"), 20); + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CorruptionEffigy")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CorruptionEffigy")); + } + } } diff --git a/Tiles/CrimsonEffigy.cs b/Tiles/CrimsonEffigy.cs index db8789d0a0..57183bc393 100644 --- a/Tiles/CrimsonEffigy.cs +++ b/Tiles/CrimsonEffigy.cs @@ -6,30 +6,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { public class CrimsonEffigy : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.newTile.Width = 2; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Crimson Effigy"); - AddMapEntry(new Color(238, 145, 105), name); - } + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Crimson Effigy"); + AddMapEntry(new Color(238, 145, 105), name); + } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("CrimsonEffigyBuff"), 20); - } + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("CrimsonEffigyBuff"), 20); + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CrimsonEffigy")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CrimsonEffigy")); + } + } } diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs index ace3a65d25..e6890085d8 100644 --- a/Tiles/CryonicBrick.cs +++ b/Tiles/CryonicBrick.cs @@ -1,41 +1,41 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { - public class CryonicBrick : ModTile - { + public class CryonicBrick : ModTile + { int subsheetHeight = 90; int subsheetWidth = 234; public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDecorativeTiles(Type); soundType = 21; - minPick = 100; - drop = mod.ItemType("CryonicBrick"); - AddMapEntry(new Color(99, 131, 199)); - } + minPick = 100; + drop = mod.ItemType("CryonicBrick"); + AddMapEntry(new Color(99, 131, 199)); + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - int xPos = i % 2; - int yPos = j % 4; - frameXOffset = xPos * subsheetWidth; - frameYOffset = yPos * subsheetHeight; + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 4; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; ; } - } + } } diff --git a/Tiles/CryonicOre.cs b/Tiles/CryonicOre.cs index 8daebcffc2..40f2356116 100644 --- a/Tiles/CryonicOre.cs +++ b/Tiles/CryonicOre.cs @@ -1,44 +1,44 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class CryonicOre : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileValue[Type] = 675; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 675; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeSnowTiles(Type); dustType = mod.DustType("MSparkle"); - drop = mod.ItemType("CryonicOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cryonic Ore"); - AddMapEntry(new Color(0, 0, 150), name); - mineResist = 3f; - minPick = 180; - soundType = 21; - Main.tileSpelunker[Type] = true; - } + drop = mod.ItemType("CryonicOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cryonic Ore"); + AddMapEntry(new Color(0, 0, 150), name); + mineResist = 3f; + minPick = 180; + soundType = 21; + Main.tileSpelunker[Type] = true; + } - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedCryogen; - } + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedCryogen; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { diff --git a/Tiles/DraedonsForge.cs b/Tiles/DraedonsForge.cs index 051125f707..9cd0436e1e 100644 --- a/Tiles/DraedonsForge.cs +++ b/Tiles/DraedonsForge.cs @@ -6,49 +6,49 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { - public class DraedonsForge : ModTile - { - public override void SetDefaults() - { - animationFrameHeight = 36; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Draedon's Forge"); - AddMapEntry(new Color(0, 255, 0), name); - disableSmartCursor = true; + public class DraedonsForge : ModTile + { + public override void SetDefaults() + { + animationFrameHeight = 36; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Draedon's Forge"); + AddMapEntry(new Color(0, 255, 0), name); + disableSmartCursor = true; adjTiles = new int[] { TileID.Anvils, TileID.Furnaces, TileID.WorkBenches, TileID.LunarCraftingStation, TileID.MythrilAnvil, TileID.AdamantiteForge, TileID.Hellforge }; } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("DraedonsForge")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("DraedonsForge")); + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = (float)Main.DiscoR / 255f; - g = (float)Main.DiscoG / 255f; - b = (float)Main.DiscoB / 255f; - } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = (float)Main.DiscoR / 255f; + g = (float)Main.DiscoG / 255f; + b = (float)Main.DiscoB / 255f; + } - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter > 12) - { - frameCounter = 0; - frame++; - if (frame > 3) - { - frame = 0; - } - } - } - } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter > 12) + { + frameCounter = 0; + frame++; + if (frame > 3) + { + frame = 0; + } + } + } + } } diff --git a/Tiles/ExodiumOre.cs b/Tiles/ExodiumOre.cs index 8a04c0d9f9..9958163bc7 100644 --- a/Tiles/ExodiumOre.cs +++ b/Tiles/ExodiumOre.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Utilities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -17,10 +17,10 @@ namespace CalamityMod.Tiles ModTranslation name = CreateMapEntryName(); name.SetDefault("Exodium Ore"); AddMapEntry(new Color(51, 48, 68), name); - mineResist = 5f; - minPick = 225; - soundType = 21; - Main.tileValue[Type] = 760; + mineResist = 5f; + minPick = 225; + soundType = 21; + Main.tileValue[Type] = 760; Main.tileSpelunker[Type] = true; drop = mod.ItemType("ExodiumClusterOre"); base.SetDefaults(); diff --git a/Tiles/FurnitureAbyss/AbyssBath.cs b/Tiles/FurnitureAbyss/AbyssBath.cs index 6e22dae75e..3c7d5a8dcf 100644 --- a/Tiles/FurnitureAbyss/AbyssBath.cs +++ b/Tiles/FurnitureAbyss/AbyssBath.cs @@ -1,42 +1,41 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Bathtub"); - AddMapEntry(new Color(191, 142, 111), name); - animationFrameHeight = 54; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Bathtub"); + AddMapEntry(new Color(191, 142, 111), name); + animationFrameHeight = 54; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBath")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBath")); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index 0c8ff424fd..a6f9f8921e 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -6,77 +6,77 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Bed"); - AddMapEntry(new Color(191, 142, 111), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Beds }; - bed = true; - } + public class AbyssBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Bed"); + AddMapEntry(new Color(191, 142, 111), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AbyssBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + public override bool HasSmartInteract() + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AbyssBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AbyssBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AbyssBed"); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssBookcase.cs b/Tiles/FurnitureAbyss/AbyssBookcase.cs index e69f3aa311..837048b977 100644 --- a/Tiles/FurnitureAbyss/AbyssBookcase.cs +++ b/Tiles/FurnitureAbyss/AbyssBookcase.cs @@ -7,39 +7,39 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Bookcase"); - AddMapEntry(new Color(191, 142, 111), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Bookcase"); + AddMapEntry(new Color(191, 142, 111), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Bookcases }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBookcase")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBookcase")); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index 1065a2a256..a706f642e2 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -7,29 +7,29 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class AbyssChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Chair"); AddMapEntry(new Color(191, 142, 111), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -44,8 +44,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssChair")); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index ab9ad9f664..46690f8dcb 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 7ef42f367f..bbb6d17b01 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Chest"); + public class AbyssChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Abyss Chest"; - chestDrop = mod.ItemType("AbyssChest"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Abyss Chest"; + chestDrop = mod.ItemType("AbyssChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,156 +53,156 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override bool HasSmartInteract() - { - return true; - } - - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Abyss Chest"; - if (player.showItemIconText == "Abyss Chest") - { - player.showItemIcon2 = mod.ItemType("AbyssChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Abyss Chest"; + if (player.showItemIconText == "Abyss Chest") + { + player.showItemIcon2 = mod.ItemType("AbyssChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } + + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index 9aa15df7e5..6237b6490f 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -8,32 +8,32 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; animationFrameHeight = 90; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Clock"); AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -53,67 +53,67 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AbyssClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AbyssClock")); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs index 8bdbda57cf..41286b6c14 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs @@ -8,42 +8,42 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class AbyssDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Door"); + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("AbyssDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("AbyssDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -58,21 +58,21 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AbyssDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AbyssDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AbyssDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AbyssDoor"); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs index 03f12db579..5fd02521f0 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs @@ -8,62 +8,62 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; + public class AbyssDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Door"); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("AbyssDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("AbyssDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -78,21 +78,21 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("AbyssDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("AbyssDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AbyssDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AbyssDoor"); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssDresser.cs b/Tiles/FurnitureAbyss/AbyssDresser.cs index bb3a3f9e45..1dad2fc506 100644 --- a/Tiles/FurnitureAbyss/AbyssDresser.cs +++ b/Tiles/FurnitureAbyss/AbyssDresser.cs @@ -1,44 +1,44 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; + public class AbyssDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Dresser"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Abyss Dresser"; - dresserDrop = mod.ItemType("AbyssDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Abyss Dresser"; + dresserDrop = mod.ItemType("AbyssDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,199 +48,199 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); // with 0.11.5 changes this should no longer be necessary // Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } return true; - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); return true; - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); return true; - } + } return false; - } + } - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AbyssDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AbyssDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AbyssDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AbyssDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index 0d532b911e..6c0457dde4 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -48,7 +48,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss r = 0.8f; g = 0.9f; b = 1f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureAbyss/AbyssPiano.cs b/Tiles/FurnitureAbyss/AbyssPiano.cs index c3531d9de6..a2ff7e08de 100644 --- a/Tiles/FurnitureAbyss/AbyssPiano.cs +++ b/Tiles/FurnitureAbyss/AbyssPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAbyss/AbyssSink.cs b/Tiles/FurnitureAbyss/AbyssSink.cs index 8b581e11e6..270b4e128c 100644 --- a/Tiles/FurnitureAbyss/AbyssSink.cs +++ b/Tiles/FurnitureAbyss/AbyssSink.cs @@ -7,36 +7,36 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssSink")); + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssSofa.cs b/Tiles/FurnitureAbyss/AbyssSofa.cs index 40e55e79cb..ca1f2b2353 100644 --- a/Tiles/FurnitureAbyss/AbyssSofa.cs +++ b/Tiles/FurnitureAbyss/AbyssSofa.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/FurnitureAbyss/AbyssTorch.cs index 30728667b9..02d7260057 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/FurnitureAbyss/AbyssTorch.cs @@ -9,41 +9,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssTorch : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileNoAttach[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch); + public class AbyssTorch : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch); TileObjectData.newTile.WaterDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); TileObjectData.newAlternate.WaterDeath = false; TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); - TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 }; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.AnchorAlternateTiles = new int[] { 124 }; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); TileObjectData.newAlternate.WaterDeath = false; TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); - TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 }; - TileObjectData.addAlternate(2); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.AnchorAlternateTiles = new int[] { 124 }; + TileObjectData.addAlternate(2); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); TileObjectData.newAlternate.WaterDeath = false; TileObjectData.newAlternate.AnchorWall = true; - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Torch"); - AddMapEntry(new Color(253, 221, 3), name); - disableSmartCursor = true; + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Torch"); + AddMapEntry(new Color(253, 221, 3), name); + disableSmartCursor = true; drop = mod.ItemType("AbyssTorch"); - adjTiles = new int[]{ TileID.Torches }; - torch = true; + adjTiles = new int[] { TileID.Torches }; + torch = true; } public override bool CreateDust(int i, int j, ref int type) @@ -58,46 +58,46 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - Tile tile = Main.tile[i, j]; - if (tile.frameX < 66) - { - r = 0.9f; - g = 0.9f; - b = 0.9f; - } - } + { + Tile tile = Main.tile[i, j]; + if (tile.frameX < 66) + { + r = 0.9f; + g = 0.9f; + b = 0.9f; + } + } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) - { - offsetY = 0; - if (WorldGen.SolidTile(i, j - 1)) - { - offsetY = 2; - if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) - { - offsetY = 4; - } - } - } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - long coordCombo = (long)i << 32 | (long)j; - ulong randSeed = Main.TileFrameSeed ^ (ulong)coordCombo; - Color color = new Color(100, 100, 100, 0); - int frameX = Main.tile[i, j].frameX; - int frameY = Main.tile[i, j].frameY; - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - for (int k = 0; k < 7; k++) - { - float x = (float)Utils.RandomInt(ref randSeed, -10, 11) * 0.15f; - float y = (float)Utils.RandomInt(ref randSeed, -10, 1) * 0.35f; - } - } - } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + long coordCombo = (long)i << 32 | (long)j; + ulong randSeed = Main.TileFrameSeed ^ (ulong)coordCombo; + Color color = new Color(100, 100, 100, 0); + int frameX = Main.tile[i, j].frameX; + int frameY = Main.tile[i, j].frameY; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + for (int k = 0; k < 7; k++) + { + float x = (float)Utils.RandomInt(ref randSeed, -10, 11) * 0.15f; + float y = (float)Utils.RandomInt(ref randSeed, -10, 1) * 0.35f; + } + } + } } diff --git a/Tiles/FurnitureAbyss/AbyssWorkbench.cs b/Tiles/FurnitureAbyss/AbyssWorkbench.cs index 0a7b7c480c..c3f57514de 100644 --- a/Tiles/FurnitureAbyss/AbyssWorkbench.cs +++ b/Tiles/FurnitureAbyss/AbyssWorkbench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class AbyssWorkbench : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class AbyssWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -38,8 +38,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AbyssWorkbench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AbyssWorkbench")); + } + } } diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs index 0addde5685..7550a8a7f2 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs @@ -1,17 +1,17 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureAbyss { - public class SmoothAbyssGravel : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + public class SmoothAbyssGravel : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeSmoothTiles(Type); @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss mineResist = 2f; minPick = 65; drop = mod.ItemType("SmoothAbyssGravel"); - AddMapEntry(new Color(49, 56, 77)); + AddMapEntry(new Color(49, 56, 77)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index bce50df238..18a5ba3c01 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -6,32 +6,32 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAbyss { - public class SmoothAbyssGravelPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class SmoothAbyssGravelPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); - drop = mod.ItemType("SmoothAbyssGravelPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("SmoothAbyssGravelPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -41,13 +41,13 @@ namespace CalamityMod.Tiles.FurnitureAbyss } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } + { + Main.tileNoSunLight[Type] = false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } diff --git a/Tiles/FurnitureAncient/AncientAltar.cs b/Tiles/FurnitureAncient/AncientAltar.cs index 641c149101..0f9f7549dc 100644 --- a/Tiles/FurnitureAncient/AncientAltar.cs +++ b/Tiles/FurnitureAncient/AncientAltar.cs @@ -7,18 +7,18 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { class AncientAltar : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Altar"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Altar"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -54,8 +54,8 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientAltar")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientAltar")); + } + } } diff --git a/Tiles/FurnitureAncient/AncientBasin.cs b/Tiles/FurnitureAncient/AncientBasin.cs index 8cecbe5f5a..52da7f6736 100644 --- a/Tiles/FurnitureAncient/AncientBasin.cs +++ b/Tiles/FurnitureAncient/AncientBasin.cs @@ -7,17 +7,17 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { class AncientBasin : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Basin"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Basin"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -58,8 +58,8 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBasin")); + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBasin")); } public override void HitWire(int i, int j) diff --git a/Tiles/FurnitureAncient/AncientBath.cs b/Tiles/FurnitureAncient/AncientBath.cs index 54d0e4f358..c97ed56090 100644 --- a/Tiles/FurnitureAncient/AncientBath.cs +++ b/Tiles/FurnitureAncient/AncientBath.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index e9555f440f..731194b31e 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { - public class AncientBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; + public class AncientBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Bed"); + name.SetDefault("Ancient Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -38,46 +38,46 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AncientBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AncientBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AncientBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AncientBed"); + } + } } diff --git a/Tiles/FurnitureAncient/AncientChair.cs b/Tiles/FurnitureAncient/AncientChair.cs index 14be3a1170..07436d9669 100644 --- a/Tiles/FurnitureAncient/AncientChair.cs +++ b/Tiles/FurnitureAncient/AncientChair.cs @@ -7,30 +7,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { - public class AncientChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + public class AncientChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -41,13 +41,13 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientChair")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientChair")); + } + } } diff --git a/Tiles/FurnitureAncient/AncientChandelier.cs b/Tiles/FurnitureAncient/AncientChandelier.cs index 033793e83f..c0f848032d 100644 --- a/Tiles/FurnitureAncient/AncientChandelier.cs +++ b/Tiles/FurnitureAncient/AncientChandelier.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Tiles.FurnitureAncient { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.Width = 3; diff --git a/Tiles/FurnitureAncient/AncientDoorClosed.cs b/Tiles/FurnitureAncient/AncientDoorClosed.cs index d133c393d5..0316145924 100644 --- a/Tiles/FurnitureAncient/AncientDoorClosed.cs +++ b/Tiles/FurnitureAncient/AncientDoorClosed.cs @@ -8,41 +8,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { - public class AncientDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; + public class AncientDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - //TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + //TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 10 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Door"); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("AncientDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("AncientDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -58,21 +58,21 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AncientDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AncientDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AncientDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AncientDoor"); + } + } } diff --git a/Tiles/FurnitureAncient/AncientDoorOpen.cs b/Tiles/FurnitureAncient/AncientDoorOpen.cs index f6231fdc67..26ee03824c 100644 --- a/Tiles/FurnitureAncient/AncientDoorOpen.cs +++ b/Tiles/FurnitureAncient/AncientDoorOpen.cs @@ -8,61 +8,61 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { - public class AncientDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class AncientDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileLavaDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - //TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + //TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 10 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - //TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - //TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - //TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Door"); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + //TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + //TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + //TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("AncientDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("AncientDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -78,21 +78,21 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("AncientDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("AncientDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AncientDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AncientDoor"); + } + } } diff --git a/Tiles/FurnitureAncient/AncientDresser.cs b/Tiles/FurnitureAncient/AncientDresser.cs index 1f9067681c..21d1c6cb4a 100644 --- a/Tiles/FurnitureAncient/AncientDresser.cs +++ b/Tiles/FurnitureAncient/AncientDresser.cs @@ -1,43 +1,43 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureAncient { - public class AncientDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; + public class AncientDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Dresser"); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Ancient Dresser"; - dresserDrop = mod.ItemType("AncientDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Ancient Dresser"; + dresserDrop = mod.ItemType("AncientDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,9 +48,9 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -150,97 +150,97 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AncientDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AncientDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AncientDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AncientDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureAncient/AncientMonolith.cs b/Tiles/FurnitureAncient/AncientMonolith.cs index 69132d9e64..80643bafe1 100644 --- a/Tiles/FurnitureAncient/AncientMonolith.cs +++ b/Tiles/FurnitureAncient/AncientMonolith.cs @@ -8,33 +8,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { public class AncientMonolith : ModTile - { + { public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; + { + Main.tileFrameImportant[Type] = true; Main.tileLighted[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Monolith"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } int animationFrameWidth = 36; @@ -82,74 +82,74 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override bool NewRightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } - } + } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AncientMonolith")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AncientMonolith")); + } + } } diff --git a/Tiles/FurnitureAncient/AncientPiano.cs b/Tiles/FurnitureAncient/AncientPiano.cs index 7636e8065f..3273c8978e 100644 --- a/Tiles/FurnitureAncient/AncientPiano.cs +++ b/Tiles/FurnitureAncient/AncientPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAncient/AncientSink.cs b/Tiles/FurnitureAncient/AncientSink.cs index 040979bd6f..5c5f19cb2b 100644 --- a/Tiles/FurnitureAncient/AncientSink.cs +++ b/Tiles/FurnitureAncient/AncientSink.cs @@ -7,37 +7,37 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { class AncientSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientSink")); + } + } } diff --git a/Tiles/FurnitureAncient/AncientSofa.cs b/Tiles/FurnitureAncient/AncientSofa.cs index 29844e0d22..0a03bb81b7 100644 --- a/Tiles/FurnitureAncient/AncientSofa.cs +++ b/Tiles/FurnitureAncient/AncientSofa.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAncient/AncientWorkbench.cs b/Tiles/FurnitureAncient/AncientWorkbench.cs index c24994c6a7..cc0b71508a 100644 --- a/Tiles/FurnitureAncient/AncientWorkbench.cs +++ b/Tiles/FurnitureAncient/AncientWorkbench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAncient { - public class AncientWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; + public class AncientWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -34,13 +34,13 @@ namespace CalamityMod.Tiles.FurnitureAncient } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AncientWorkbench")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AncientWorkbench")); + } + } } diff --git a/Tiles/FurnitureAshen/AshenAltar.cs b/Tiles/FurnitureAshen/AshenAltar.cs index ed5f80ad00..782d603061 100644 --- a/Tiles/FurnitureAshen/AshenAltar.cs +++ b/Tiles/FurnitureAshen/AshenAltar.cs @@ -7,18 +7,18 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { class AshenAltar : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Altar"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Altar"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -54,8 +54,8 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenAltar")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenAltar")); + } + } } diff --git a/Tiles/FurnitureAshen/AshenBasin.cs b/Tiles/FurnitureAshen/AshenBasin.cs index 193fd73f6e..f27e9f83ff 100644 --- a/Tiles/FurnitureAshen/AshenBasin.cs +++ b/Tiles/FurnitureAshen/AshenBasin.cs @@ -7,17 +7,17 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { class AshenBasin : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Basin"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Basin"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -58,8 +58,8 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBasin")); + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBasin")); } public override void HitWire(int i, int j) diff --git a/Tiles/FurnitureAshen/AshenBath.cs b/Tiles/FurnitureAshen/AshenBath.cs index 2905b8a9f6..eef5b6e0f3 100644 --- a/Tiles/FurnitureAshen/AshenBath.cs +++ b/Tiles/FurnitureAshen/AshenBath.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index e981a1622f..c2970fd088 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { - public class AshenBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; + public class AshenBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Bed"); + name.SetDefault("Ashen Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -33,8 +33,8 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -43,41 +43,41 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AshenBed")); - } + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("AshenBed")); + } - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AshenBed"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AshenBed"); + } + } } diff --git a/Tiles/FurnitureAshen/AshenChair.cs b/Tiles/FurnitureAshen/AshenChair.cs index 731c842be4..2e506cb18e 100644 --- a/Tiles/FurnitureAshen/AshenChair.cs +++ b/Tiles/FurnitureAshen/AshenChair.cs @@ -7,30 +7,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { - public class AshenChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + public class AshenChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -41,13 +41,13 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenChair")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenChair")); + } + } } diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index 40b7d66683..1deffc15ac 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureAshen { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.LavaDeath = false; diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index db571508d9..3b0131e417 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,38 +10,38 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { - public class AshenChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; + public class AshenChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Chest"); - AddMapEntry(new Color(191, 142, 111), name, MapChestName); + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Chest"); + AddMapEntry(new Color(191, 142, 111), name, MapChestName); name = CreateMapEntryName(Name + "_Locked"); // With multiple map entries, you need unique translation keys. name.SetDefault("Locked Ashen Chest"); AddMapEntry(new Color(174, 129, 92), name, MapChestName); disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Ashen Chest"; - chestDrop = mod.ItemType("AshenChest"); + adjTiles = new int[] { TileID.Containers }; + chest = "Ashen Chest"; + chestDrop = mod.ItemType("AshenChest"); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureAshen/AshenDoorClosed.cs b/Tiles/FurnitureAshen/AshenDoorClosed.cs index 8bca30f27f..d58d3d0d46 100644 --- a/Tiles/FurnitureAshen/AshenDoorClosed.cs +++ b/Tiles/FurnitureAshen/AshenDoorClosed.cs @@ -8,42 +8,42 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { - // TODO: Smart Cursor Outlines and tModLoader support - public class AshenDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; + // TODO: Smart Cursor Outlines and tModLoader support + public class AshenDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Door"); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("AshenDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("AshenDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -54,8 +54,8 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -64,16 +64,16 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AshenDoor")); - } + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AshenDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AshenDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AshenDoor"); + } + } } diff --git a/Tiles/FurnitureAshen/AshenDoorOpen.cs b/Tiles/FurnitureAshen/AshenDoorOpen.cs index 18cbcfe2fd..6bbf4726a4 100644 --- a/Tiles/FurnitureAshen/AshenDoorOpen.cs +++ b/Tiles/FurnitureAshen/AshenDoorOpen.cs @@ -8,61 +8,61 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { - public class AshenDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class AshenDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileLavaDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Door"); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("AshenDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("AshenDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -73,8 +73,8 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -83,16 +83,16 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("AshenDoor")); - } + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("AshenDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AshenDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AshenDoor"); + } + } } diff --git a/Tiles/FurnitureAshen/AshenDresser.cs b/Tiles/FurnitureAshen/AshenDresser.cs index ebd7105d65..de94a1fe85 100644 --- a/Tiles/FurnitureAshen/AshenDresser.cs +++ b/Tiles/FurnitureAshen/AshenDresser.cs @@ -1,43 +1,43 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureAshen { - public class AshenDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; + public class AshenDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Dresser"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Ashen Dresser"; - dresserDrop = mod.ItemType("AshenDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Ashen Dresser"; + dresserDrop = mod.ItemType("AshenDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,9 +48,9 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -150,97 +150,97 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AshenDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AshenDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AshenDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AshenDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index f86283d60d..e4b6f22741 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -60,7 +60,8 @@ namespace CalamityMod.Tiles.FurnitureAshen r = 1f; g = 0.5f; b = 0.5f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 2ce77878dd..2caf814555 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -10,33 +10,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { public class AshenMonolith : ModTile - { + { public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileLighted[Type] = true; TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); AddMapEntry(new Color(191, 142, 111), name); name.SetDefault("Ashen Monolith"); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } int animationFrameWidth = 36; @@ -60,81 +60,83 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AshenMonolith")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AshenMonolith")); + } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { //This is used to draw the eye, where the frame is changed depending on the player's position relative to the eye's centre. Tile currentTile = Main.tile[i, j]; Vector2 eyeCentre = new Vector2(i * 16, j * 16); - if (currentTile.frameX == 0) { eyeCentre += new Vector2(16f, 0f); } - if (currentTile.frameY == 0) { eyeCentre += new Vector2(0f, 16f); } + if (currentTile.frameX == 0) + { eyeCentre += new Vector2(16f, 0f); } + if (currentTile.frameY == 0) + { eyeCentre += new Vector2(0f, 16f); } //The eye should track the closest player Vector2 playerPos = eyeCentre; float distanceToTarget = 9999f; @@ -152,7 +154,7 @@ namespace CalamityMod.Tiles.FurnitureAshen int frameY = 2; //horizontal and vertical range for the eye before it reaches maximum value (in tiles). Used to get the various 'magnitudes' of the eye to work int xRange = 0; - if(distanceToTarget > 250) + if (distanceToTarget > 250) { xRange = 5; } @@ -188,7 +190,8 @@ namespace CalamityMod.Tiles.FurnitureAshen eyeToPlayer.Y = (int)eyeToPlayer.Y; float factor = Math.Abs((Math.Abs(eyeToPlayer.X) >= 2 * Math.Abs(eyeToPlayer.Y)) ? eyeToPlayer.X / xRange : eyeToPlayer.Y / yRange); - if (factor != 0) { eyeToPlayer /= factor; } + if (factor != 0) + { eyeToPlayer /= factor; } frameX += (int)(eyeToPlayer.X); frameY += (int)(eyeToPlayer.Y); frameX *= animationFrameWidth; diff --git a/Tiles/FurnitureAshen/AshenPiano.cs b/Tiles/FurnitureAshen/AshenPiano.cs index 56e244bc62..a09bf2df60 100644 --- a/Tiles/FurnitureAshen/AshenPiano.cs +++ b/Tiles/FurnitureAshen/AshenPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAshen/AshenPlatform.cs b/Tiles/FurnitureAshen/AshenPlatform.cs index c7353adaa1..1acbce6d8c 100644 --- a/Tiles/FurnitureAshen/AshenPlatform.cs +++ b/Tiles/FurnitureAshen/AshenPlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { - public class AshenPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; + public class AshenPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = false; soundType = 21; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.addTile(Type); + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AshenPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("AshenPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -43,13 +43,13 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } + { + Main.tileNoSunLight[Type] = false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } diff --git a/Tiles/FurnitureAshen/AshenSink.cs b/Tiles/FurnitureAshen/AshenSink.cs index ebc631c5e4..4a5ea9d80a 100644 --- a/Tiles/FurnitureAshen/AshenSink.cs +++ b/Tiles/FurnitureAshen/AshenSink.cs @@ -7,37 +7,37 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { class AshenSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenSink")); + } + } } diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 6ecda07da7..c9c0208f37 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureAshen { diff --git a/Tiles/FurnitureAshen/AshenSofa.cs b/Tiles/FurnitureAshen/AshenSofa.cs index c9a0f0b0b5..aa15b8faec 100644 --- a/Tiles/FurnitureAshen/AshenSofa.cs +++ b/Tiles/FurnitureAshen/AshenSofa.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureAshen/AshenWorkbench.cs b/Tiles/FurnitureAshen/AshenWorkbench.cs index 3850aace4e..0948594b7a 100644 --- a/Tiles/FurnitureAshen/AshenWorkbench.cs +++ b/Tiles/FurnitureAshen/AshenWorkbench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureAshen { - public class AshenWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; + public class AshenWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -34,13 +34,13 @@ namespace CalamityMod.Tiles.FurnitureAshen } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AshenWorkbench")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AshenWorkbench")); + } + } } diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index fdc92d3bfa..31508bf3c3 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -1,18 +1,18 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureAshen { public class SmoothBrimstoneSlag : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeSmoothTiles(Type); @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.FurnitureAshen mineResist = 5f; minPick = 180; drop = mod.ItemType("SmoothBrimstoneSlag"); - AddMapEntry(new Color(61, 40, 61)); + AddMapEntry(new Color(61, 40, 61)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureBotanic/BotanicBathtub.cs b/Tiles/FurnitureBotanic/BotanicBathtub.cs index 08a4389478..0b32220919 100644 --- a/Tiles/FurnitureBotanic/BotanicBathtub.cs +++ b/Tiles/FurnitureBotanic/BotanicBathtub.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index 6d810259f2..7606af02ab 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + public class BotanicBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Bed"); + name.SetDefault("Botanic Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -38,46 +38,46 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("BotanicBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("BotanicBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("BotanicBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("BotanicBed"); + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicBench.cs b/Tiles/FurnitureBotanic/BotanicBench.cs index 7d8ae7ccdb..55949a15cf 100644 --- a/Tiles/FurnitureBotanic/BotanicBench.cs +++ b/Tiles/FurnitureBotanic/BotanicBench.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureBotanic/BotanicChair.cs b/Tiles/FurnitureBotanic/BotanicChair.cs index e827d388d2..f27f2b0759 100644 --- a/Tiles/FurnitureBotanic/BotanicChair.cs +++ b/Tiles/FurnitureBotanic/BotanicChair.cs @@ -7,30 +7,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class BotanicChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -46,8 +46,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BotanicChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BotanicChair")); + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicChandelier.cs b/Tiles/FurnitureBotanic/BotanicChandelier.cs index 9185f04d60..03418408e1 100644 --- a/Tiles/FurnitureBotanic/BotanicChandelier.cs +++ b/Tiles/FurnitureBotanic/BotanicChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; diff --git a/Tiles/FurnitureBotanic/BotanicChest.cs b/Tiles/FurnitureBotanic/BotanicChest.cs index 8ce95f96ea..35e431f848 100644 --- a/Tiles/FurnitureBotanic/BotanicChest.cs +++ b/Tiles/FurnitureBotanic/BotanicChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Chest"); + public class BotanicChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Botanic Chest"; - chestDrop = mod.ItemType("BotanicChest"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Botanic Chest"; + chestDrop = mod.ItemType("BotanicChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -54,39 +54,39 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -163,47 +163,47 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Botanic Chest"; - if (player.showItemIconText == "Botanic Chest") - { - player.showItemIcon2 = mod.ItemType("BotanicChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Botanic Chest"; + if (player.showItemIconText == "Botanic Chest") + { + player.showItemIcon2 = mod.ItemType("BotanicChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicClock.cs b/Tiles/FurnitureBotanic/BotanicClock.cs index 402354b2ff..16680a26a4 100644 --- a/Tiles/FurnitureBotanic/BotanicClock.cs +++ b/Tiles/FurnitureBotanic/BotanicClock.cs @@ -8,33 +8,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; animationFrameHeight = 90; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -55,67 +55,67 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("BotanicClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("BotanicClock")); + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs index 6ec8876198..a06c88f947 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs @@ -8,42 +8,42 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class BotanicDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Door"); + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("BotanicDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("BotanicDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -59,21 +59,21 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("BotanicDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("BotanicDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("BotanicDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("BotanicDoor"); + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs index 9f3d57d459..210b5a4687 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs @@ -8,62 +8,62 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; + public class BotanicDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Door"); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("BotanicDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("BotanicDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -79,21 +79,21 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("BotanicDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("BotanicDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("BotanicDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("BotanicDoor"); + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicDresser.cs b/Tiles/FurnitureBotanic/BotanicDresser.cs index 561ceac779..3fc9dba67f 100644 --- a/Tiles/FurnitureBotanic/BotanicDresser.cs +++ b/Tiles/FurnitureBotanic/BotanicDresser.cs @@ -1,44 +1,44 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; + public class BotanicDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Dresser"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Botanic Dresser"; - dresserDrop = mod.ItemType("BotanicDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Botanic Dresser"; + dresserDrop = mod.ItemType("BotanicDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -49,9 +49,9 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -151,97 +151,97 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("BotanicDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("BotanicDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("BotanicDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("BotanicDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicLantern.cs b/Tiles/FurnitureBotanic/BotanicLantern.cs index 17d4ae8631..53d90f3f0c 100644 --- a/Tiles/FurnitureBotanic/BotanicLantern.cs +++ b/Tiles/FurnitureBotanic/BotanicLantern.cs @@ -49,7 +49,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic r = 0.8f; g = 0.9f; b = 0.3f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureBotanic/BotanicPiano.cs b/Tiles/FurnitureBotanic/BotanicPiano.cs index f8f16b4523..171f988d5b 100644 --- a/Tiles/FurnitureBotanic/BotanicPiano.cs +++ b/Tiles/FurnitureBotanic/BotanicPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureBotanic/BotanicPlanter.cs b/Tiles/FurnitureBotanic/BotanicPlanter.cs index 7f1cce9a8f..230b02e261 100644 --- a/Tiles/FurnitureBotanic/BotanicPlanter.cs +++ b/Tiles/FurnitureBotanic/BotanicPlanter.cs @@ -7,17 +7,17 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { class BotanicPlanter : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Planter"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Planter"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -48,8 +48,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BotanicPlanter")); + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BotanicPlanter")); } public override void HitWire(int i, int j) diff --git a/Tiles/FurnitureBotanic/BotanicPlatform.cs b/Tiles/FurnitureBotanic/BotanicPlatform.cs index 12fa5bc8dc..e0111204fc 100644 --- a/Tiles/FurnitureBotanic/BotanicPlatform.cs +++ b/Tiles/FurnitureBotanic/BotanicPlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; + public class BotanicPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = false; soundType = 21; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.addTile(Type); + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("BotanicPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("BotanicPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -43,13 +43,13 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } + { + Main.tileNoSunLight[Type] = false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicSink.cs b/Tiles/FurnitureBotanic/BotanicSink.cs index d11ff43f03..e4dbd177fe 100644 --- a/Tiles/FurnitureBotanic/BotanicSink.cs +++ b/Tiles/FurnitureBotanic/BotanicSink.cs @@ -7,36 +7,36 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { class BotanicSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("BloomTileGold"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("BloomTileLeaves"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("BloomTileGold"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("BloomTileLeaves"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BotanicSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BotanicSink")); + } + } } diff --git a/Tiles/FurnitureBotanic/BotanicWorkBench.cs b/Tiles/FurnitureBotanic/BotanicWorkBench.cs index 4bd2a5a882..097ae9175f 100644 --- a/Tiles/FurnitureBotanic/BotanicWorkBench.cs +++ b/Tiles/FurnitureBotanic/BotanicWorkBench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureBotanic { - public class BotanicWorkBench : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class BotanicWorkBench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Botanic Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Botanic Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -39,8 +39,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("BotanicWorkBench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("BotanicWorkBench")); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBath.cs b/Tiles/FurnitureCosmilite/CosmiliteBath.cs index e4e38eb228..4a9f6792ad 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBath.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBath.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index b048d77334..e3a163ba6d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -6,22 +6,22 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + public class CosmiliteBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Bed"); + name.SetDefault("Cosmilite Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -37,46 +37,46 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("CosmiliteBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CosmiliteBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("CosmiliteBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CosmiliteBed"); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index 82cf818c18..91a0bfbf3f 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -1,23 +1,22 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; soundType = 21; mineResist = 5f; minPick = 275; drop = mod.ItemType("CosmiliteBrick"); - AddMapEntry(new Color(76, 79, 133)); + AddMapEntry(new Color(76, 79, 133)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index af5992f52c..7fc547c412 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -7,29 +7,29 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Chair"); + public class CosmiliteChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -45,8 +45,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteChair")); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index 5266e4225d..74bbde0410 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.Width = 3; diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index 78e35b7620..6a90069a53 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,7 +10,7 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteChest : ModTile + public class CosmiliteChest : ModTile { public override void SetDefaults() { @@ -49,8 +49,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override bool HasSmartInteract() - { - return true; + { + return true; } public string MapChestName(string name, int i, int j) @@ -83,10 +83,10 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -163,47 +163,47 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Cosmilite Chest"; - if (player.showItemIconText == "Cosmilite Chest") - { - player.showItemIcon2 = mod.ItemType("CosmiliteChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Cosmilite Chest"; + if (player.showItemIconText == "Cosmilite Chest") + { + player.showItemIcon2 = mod.ItemType("CosmiliteChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index 7af4377b63..441a1509ae 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -8,24 +8,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; animationFrameHeight = 90; TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite name.SetDefault("Cosmilite Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -49,72 +49,72 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CosmiliteClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CosmiliteClock")); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs index a9830e99a3..e6a486c6a8 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs @@ -8,41 +8,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Door"); + public class CosmiliteDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("CosmiliteDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("CosmiliteDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -58,21 +58,21 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CosmiliteDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CosmiliteDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs index 667138d575..448889526b 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs @@ -8,61 +8,61 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Door"); + public class CosmiliteDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("CosmiliteDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("CosmiliteDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -73,8 +73,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -83,16 +83,16 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("CosmiliteDoor")); - } + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("CosmiliteDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs index 9fd4b0ae27..ddfe8b8dd2 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs @@ -1,43 +1,43 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Dresser"); + public class CosmiliteDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Cosmilite Dresser"; - dresserDrop = mod.ItemType("CosmiliteDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Cosmilite Dresser"; + dresserDrop = mod.ItemType("CosmiliteDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,9 +48,9 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -150,97 +150,97 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("CosmiliteDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("CosmiliteDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("CosmiliteDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("CosmiliteDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index 97ab66f97a..5015055c18 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -48,7 +48,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite r = 1f; g = 0.6f; b = 1f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureCosmilite/CosmilitePiano.cs b/Tiles/FurnitureCosmilite/CosmilitePiano.cs index 3c6bb6362b..3919e8ac84 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePiano.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs index 8fa2182b31..098aa1bad3 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmilitePlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class CosmilitePlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("CosmilitePlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("CosmilitePlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -43,8 +43,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; + { + Main.tileNoSunLight[Type] = false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs index 2afc8ce26e..b2db5dde1c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs @@ -1,8 +1,6 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; -using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureCosmilite/CosmiliteSink.cs b/Tiles/FurnitureCosmilite/CosmiliteSink.cs index dcf4b88db4..3dd3ebfa29 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSink.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSink.cs @@ -7,36 +7,36 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { class CosmiliteSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteSink")); + } + } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs index cdbcb44222..800e496628 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs index d3459ee834..f23e97869d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureCosmilite { - public class CosmiliteWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Work Bench"); + public class CosmiliteWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -33,13 +33,13 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("CosmiliteWorkbench")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("CosmiliteWorkbench")); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs index 40348cc160..6263965dc9 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index c0b36f2f05..a2ae08297d 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + public class EutrophicBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Bed"); + name.SetDefault("Eutrophic Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -37,46 +37,46 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("EutrophicBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("EutrophicBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("EutrophicBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("EutrophicBed"); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicBench.cs b/Tiles/FurnitureEutrophic/EutrophicBench.cs index fec0e2120c..2133bbaa42 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBench.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.cs b/Tiles/FurnitureEutrophic/EutrophicChair.cs index 3141c9a77b..7069661924 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChair.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChair.cs @@ -7,30 +7,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class EutrophicChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -45,8 +45,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("EutrophicChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("EutrophicChair")); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs index 877000c5b4..b7d595e4b9 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureEutrophic/EutrophicChest.cs index 6c4e519a38..7482271613 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Chest"); + public class EutrophicChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Eutrophic Chest"; - chestDrop = mod.ItemType("EutrophicChest"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Eutrophic Chest"; + chestDrop = mod.ItemType("EutrophicChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,39 +53,39 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -162,47 +162,47 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Eutrophic Chest"; - if (player.showItemIconText == "Eutrophic Chest") - { - player.showItemIcon2 = mod.ItemType("EutrophicChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Eutrophic Chest"; + if (player.showItemIconText == "Eutrophic Chest") + { + player.showItemIcon2 = mod.ItemType("EutrophicChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.cs b/Tiles/FurnitureEutrophic/EutrophicClock.cs index 129acad337..8772bb9023 100644 --- a/Tiles/FurnitureEutrophic/EutrophicClock.cs +++ b/Tiles/FurnitureEutrophic/EutrophicClock.cs @@ -8,34 +8,34 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicClock : ModTile - { - public override void SetDefaults() + { + public override void SetDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; animationFrameHeight = 90; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -71,67 +71,67 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("EutrophicClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("EutrophicClock")); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicCrafting.cs b/Tiles/FurnitureEutrophic/EutrophicCrafting.cs index 36f36c8658..a688bf555f 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCrafting.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCrafting.cs @@ -9,11 +9,11 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { class EutrophicCrafting : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Shelf"); + name.SetDefault("Eutrophic Shelf"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -55,8 +55,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("EutrophicCrafting")); + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("EutrophicCrafting")); } } } diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs index fd92268511..c9d1bf0469 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs @@ -8,42 +8,42 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class EutrophicDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Door"); + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("EutrophicDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("EutrophicDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -58,21 +58,21 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("EutrophicDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("EutrophicDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("EutrophicDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("EutrophicDoor"); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs index af96fd133d..d86dc249b4 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs @@ -8,62 +8,62 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; + public class EutrophicDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Door"); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("EutrophicDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("EutrophicDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -78,21 +78,21 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("EutrophicDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("EutrophicDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("EutrophicDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("EutrophicDoor"); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser.cs b/Tiles/FurnitureEutrophic/EutrophicDresser.cs index 2431c65f6f..c3e45bb976 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDresser.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDresser.cs @@ -1,44 +1,44 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; + public class EutrophicDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Dresser"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Eutrophic Dresser"; - dresserDrop = mod.ItemType("EutrophicDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Eutrophic Dresser"; + dresserDrop = mod.ItemType("EutrophicDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,9 +48,9 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -150,97 +150,97 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("EutrophicDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("EutrophicDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("EutrophicDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("EutrophicDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.cs b/Tiles/FurnitureEutrophic/EutrophicLantern.cs index e7f6e012e1..9264eeff69 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLantern.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLantern.cs @@ -48,7 +48,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic r = 0.5f; g = 1f; b = 1f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureEutrophic/EutrophicPiano.cs b/Tiles/FurnitureEutrophic/EutrophicPiano.cs index eb52a1f167..b836c31f27 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPiano.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs index aac1cd4ae3..7c15075ff0 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class EutrophicPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("EutrophicPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("EutrophicPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -42,8 +42,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; + { + Main.tileNoSunLight[Type] = false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/FurnitureEutrophic/EutrophicSink.cs b/Tiles/FurnitureEutrophic/EutrophicSink.cs index 5d28de9a81..8484ad3290 100644 --- a/Tiles/FurnitureEutrophic/EutrophicSink.cs +++ b/Tiles/FurnitureEutrophic/EutrophicSink.cs @@ -7,36 +7,36 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { class EutrophicSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("EutrophicSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("EutrophicSink")); + } + } } diff --git a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs index 566bcf6344..30ac53a111 100644 --- a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class EutrophicWorkBench : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class EutrophicWorkBench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -38,8 +38,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("EutrophicWorkBench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("EutrophicWorkBench")); + } + } } diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.cs b/Tiles/FurnitureEutrophic/SmoothNavystone.cs index 0c24936498..c1040708d7 100644 --- a/Tiles/FurnitureEutrophic/SmoothNavystone.cs +++ b/Tiles/FurnitureEutrophic/SmoothNavystone.cs @@ -1,18 +1,18 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureEutrophic { - public class SmoothNavystone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + public class SmoothNavystone : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeSmoothTiles(Type); @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic soundType = 21; minPick = 55; drop = mod.ItemType("SmoothNavystone"); - AddMapEntry(new Color(39, 48, 53)); + AddMapEntry(new Color(39, 48, 53)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureOccult/OccultBathtub.cs b/Tiles/FurnitureOccult/OccultBathtub.cs index e3138f7b04..dc1ebbd89c 100644 --- a/Tiles/FurnitureOccult/OccultBathtub.cs +++ b/Tiles/FurnitureOccult/OccultBathtub.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureOccult/OccultBed.cs b/Tiles/FurnitureOccult/OccultBed.cs index 28f4dd67eb..9758789340 100644 --- a/Tiles/FurnitureOccult/OccultBed.cs +++ b/Tiles/FurnitureOccult/OccultBed.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + public class OccultBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Bed"); + name.SetDefault("Otherworldly Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -38,46 +38,46 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("OccultBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("OccultBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("OccultBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("OccultBed"); + } + } } diff --git a/Tiles/FurnitureOccult/OccultChair.cs b/Tiles/FurnitureOccult/OccultChair.cs index 9f81b48004..5992ae1019 100644 --- a/Tiles/FurnitureOccult/OccultChair.cs +++ b/Tiles/FurnitureOccult/OccultChair.cs @@ -7,30 +7,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class OccultChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Otherworldly Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -46,8 +46,8 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("OccultChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("OccultChair")); + } + } } diff --git a/Tiles/FurnitureOccult/OccultChandelier.cs b/Tiles/FurnitureOccult/OccultChandelier.cs index 23f6c37399..86e1988127 100644 --- a/Tiles/FurnitureOccult/OccultChandelier.cs +++ b/Tiles/FurnitureOccult/OccultChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; diff --git a/Tiles/FurnitureOccult/OccultChest.cs b/Tiles/FurnitureOccult/OccultChest.cs index d553c43f50..e8470acf8c 100644 --- a/Tiles/FurnitureOccult/OccultChest.cs +++ b/Tiles/FurnitureOccult/OccultChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Chest"); + public class OccultChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Otherworldly Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Otherworldly Chest"; - chestDrop = mod.ItemType("OccultChest"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Otherworldly Chest"; + chestDrop = mod.ItemType("OccultChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -54,39 +54,39 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -163,47 +163,47 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Occult Chest"; - if (player.showItemIconText == "Occult Chest") - { - player.showItemIcon2 = mod.ItemType("OccultChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Occult Chest"; + if (player.showItemIconText == "Occult Chest") + { + player.showItemIcon2 = mod.ItemType("OccultChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureOccult/OccultClock.cs b/Tiles/FurnitureOccult/OccultClock.cs index bcf281f22b..7251fefa17 100644 --- a/Tiles/FurnitureOccult/OccultClock.cs +++ b/Tiles/FurnitureOccult/OccultClock.cs @@ -8,33 +8,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { public class OccultClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; animationFrameHeight = 90; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -55,67 +55,67 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("OccultClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("OccultClock")); + } + } } diff --git a/Tiles/FurnitureOccult/OccultDoorClosed.cs b/Tiles/FurnitureOccult/OccultDoorClosed.cs index 43c25a17d4..e2755e280d 100644 --- a/Tiles/FurnitureOccult/OccultDoorClosed.cs +++ b/Tiles/FurnitureOccult/OccultDoorClosed.cs @@ -8,42 +8,42 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class OccultDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Door"); + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Otherworldly Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("OccultDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("OccultDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -59,21 +59,21 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("OccultDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("OccultDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("OccultDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("OccultDoor"); + } + } } diff --git a/Tiles/FurnitureOccult/OccultDoorOpen.cs b/Tiles/FurnitureOccult/OccultDoorOpen.cs index c479bab406..c600656ad6 100644 --- a/Tiles/FurnitureOccult/OccultDoorOpen.cs +++ b/Tiles/FurnitureOccult/OccultDoorOpen.cs @@ -8,62 +8,62 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; + public class OccultDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Door"); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Otherworldly Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("OccultDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("OccultDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -79,21 +79,21 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("OccultDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("OccultDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("OccultDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("OccultDoor"); + } + } } diff --git a/Tiles/FurnitureOccult/OccultDresser.cs b/Tiles/FurnitureOccult/OccultDresser.cs index cc2868f7b5..271e862301 100644 --- a/Tiles/FurnitureOccult/OccultDresser.cs +++ b/Tiles/FurnitureOccult/OccultDresser.cs @@ -1,44 +1,44 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; + public class OccultDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Dresser"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Otherworldly Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Otherworldly Dresser"; - dresserDrop = mod.ItemType("OccultDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Otherworldly Dresser"; + dresserDrop = mod.ItemType("OccultDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -49,9 +49,9 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -151,97 +151,97 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("OccultDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("OccultDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("OccultDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("OccultDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureOccult/OccultLantern.cs b/Tiles/FurnitureOccult/OccultLantern.cs index de6a34be79..61692bc390 100644 --- a/Tiles/FurnitureOccult/OccultLantern.cs +++ b/Tiles/FurnitureOccult/OccultLantern.cs @@ -49,7 +49,8 @@ namespace CalamityMod.Tiles.FurnitureOccult r = 0.8f; g = 0.9f; b = 1f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureOccult/OccultPiano.cs b/Tiles/FurnitureOccult/OccultPiano.cs index 55937a20d1..b2389ee3ba 100644 --- a/Tiles/FurnitureOccult/OccultPiano.cs +++ b/Tiles/FurnitureOccult/OccultPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureOccult/OccultPlatform.cs b/Tiles/FurnitureOccult/OccultPlatform.cs index 199ed3a999..468d0c2e16 100644 --- a/Tiles/FurnitureOccult/OccultPlatform.cs +++ b/Tiles/FurnitureOccult/OccultPlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class OccultPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("OccultPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("OccultPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -43,8 +43,8 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; + { + Main.tileNoSunLight[Type] = false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/FurnitureOccult/OccultSink.cs b/Tiles/FurnitureOccult/OccultSink.cs index 62000b6f83..55fe33b329 100644 --- a/Tiles/FurnitureOccult/OccultSink.cs +++ b/Tiles/FurnitureOccult/OccultSink.cs @@ -7,37 +7,37 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { class OccultSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Otherworldly Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(125, 94, 128), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("OccultTileCloth"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("OccultTileCloth"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("OccultSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("OccultSink")); + } + } } diff --git a/Tiles/FurnitureOccult/OccultSofa.cs b/Tiles/FurnitureOccult/OccultSofa.cs index c2b9f3cf4e..003b850b58 100644 --- a/Tiles/FurnitureOccult/OccultSofa.cs +++ b/Tiles/FurnitureOccult/OccultSofa.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureOccult/OccultStone.cs b/Tiles/FurnitureOccult/OccultStone.cs index 3df5ba0c33..a5c340df5e 100644 --- a/Tiles/FurnitureOccult/OccultStone.cs +++ b/Tiles/FurnitureOccult/OccultStone.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Utilities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureOccult { diff --git a/Tiles/FurnitureOccult/OccultWorkbench.cs b/Tiles/FurnitureOccult/OccultWorkbench.cs index 0b9a4ecf31..20fc9993d5 100644 --- a/Tiles/FurnitureOccult/OccultWorkbench.cs +++ b/Tiles/FurnitureOccult/OccultWorkbench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureOccult { - public class OccultWorkBench : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class OccultWorkBench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Otherworldly Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Otherworldly Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -39,8 +39,8 @@ namespace CalamityMod.Tiles.FurnitureOccult } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("OccultWorkBench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("OccultWorkBench")); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs b/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs index 5cdbe8cb5f..333a634691 100644 --- a/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs +++ b/Tiles/FurniturePlaguedPlate/PlagueInfuser.cs @@ -8,12 +8,12 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { class PlagueInfuser : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; TileObjectData.newTile.Width = 2; TileObjectData.newTile.Height = 4; @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plague Infuser"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plague Infuser"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 72; } @@ -53,89 +53,89 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate // Below is an example completely manually drawing a tile. It shows some interesting concepts that may be useful for more advanced things. /*public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - // Flips the sprite - SpriteEffects effects = SpriteEffects.None; - if (i % 2 == 1) - { - effects = SpriteEffects.FlipHorizontally; - } + { + // Flips the sprite + SpriteEffects effects = SpriteEffects.None; + if (i % 2 == 1) + { + effects = SpriteEffects.FlipHorizontally; + } - // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. - int k = Main.tileFrame[Type] + i % 6; - if (i % 2 == 0) - { - k += 3; - } - if (i % 3 == 0) - { - k += 3; - } - if (i % 4 == 0) - { - k += 3; - } - k = k % 6; + // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. + int k = Main.tileFrame[Type] + i % 6; + if (i % 2 == 0) + { + k += 3; + } + if (i % 3 == 0) + { + k += 3; + } + if (i % 4 == 0) + { + k += 3; + } + k = k % 6; - Tile tile = Main.tile[i, j]; - Texture2D texture; - if (Main.canDrawColorTile(i, j)) - { - texture = Main.tileAltTexture[Type, (int)tile.color()]; - } - else - { - texture = Main.tileTexture[Type]; - } - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - int animate = k * animationFrameWidth; + Tile tile = Main.tile[i, j]; + Texture2D texture; + if (Main.canDrawColorTile(i, j)) + { + texture = Main.tileAltTexture[Type, (int)tile.color()]; + } + else + { + texture = Main.tileTexture[Type]; + } + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int animate = k * animationFrameWidth; - Main.spriteBatch.Draw( - texture, - new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, - new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), - Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); + Main.spriteBatch.Draw( + texture, + new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, + new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), + Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); - return false; // return false to stop vanilla draw. - }*/ + return false; // return false to stop vanilla draw. + }*/ - // public override void AnimateTile(ref int frame, ref int frameCounter) - //{ - // /*frameCounter++; - // if (frameCounter > 8) - // { - // frameCounter = 0; - // frame++; - // if (frame > 5) - // { - // frame = 0; - // } - // }*/ - // // Above code works, but since we are just mimicking another tile, we can just use the same value. - // frame = Main.tileFrame[TileID.FireflyinaBottle]; - //} + // public override void AnimateTile(ref int frame, ref int frameCounter) + //{ + // /*frameCounter++; + // if (frameCounter > 8) + // { + // frameCounter = 0; + // frame++; + // if (frame > 5) + // { + // frame = 0; + // } + // }*/ + // // Above code works, but since we are just mimicking another tile, we can just use the same value. + // frame = Main.tileFrame[TileID.FireflyinaBottle]; + //} - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlagueInfuser")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlagueInfuser")); + } + } - //class ExampleAnimatedTileItem : ModItem - //{ - // public override void SetStaticDefaults() - // { - // DisplayName.SetDefault("Red Firefly in a Bottle"); - // } + //class ExampleAnimatedTileItem : ModItem + //{ + // public override void SetStaticDefaults() + // { + // DisplayName.SetDefault("Red Firefly in a Bottle"); + // } - // public override void SetDefaults() - // { - // item.CloneDefaults(ItemID.FireflyinaBottle); - // item.createTile = ModContent.TileType(); - // } - //} + // public override void SetDefaults() + // { + // item.CloneDefaults(ItemID.FireflyinaBottle); + // item.createTile = ModContent.TileType(); + // } + //} } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 6f24a63e06..2fb87fdd5d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -1,23 +1,22 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlate : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; soundType = 21; mineResist = 3f; minPick = 210; drop = mod.ItemType("PlaguedPlate"); - AddMapEntry(new Color(51, 99, 75)); + AddMapEntry(new Color(51, 99, 75)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs index d0ebb6fe61..b1637b1eda 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -7,16 +7,16 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { class PlaguedPlateBasin : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Basin"); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Basin"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -56,8 +56,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlaguedPlateBasin")); + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlaguedPlateBasin")); } public override void HitWire(int i, int j) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 4514c6c773..eceb68443c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index 4cbb87def6..d4094e736b 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -6,22 +6,22 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlateBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This bed has different dimensions to conventional beds, using bookcase dimentions instead - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 16, 16, 16 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Bed"); + public class PlaguedPlateBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This bed has different dimensions to conventional beds, using bookcase dimentions instead + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -36,46 +36,46 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("PlaguedPlateBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 54 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("PlaguedPlateBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("PlaguedPlateBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 54 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("PlaguedPlateBed"); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index 184e6b5223..56aa63ccd9 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -7,29 +7,29 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlateChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Chair"); + public class PlaguedPlateChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -44,8 +44,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlaguedPlateChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlaguedPlateChair")); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 55c169526d..7b16a1aa6d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.Width = 3; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index ef8b7d144e..f0466dc46c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlateChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Chest"); - AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Plagued Plate Chest"; - chestDrop = mod.ItemType("PlaguedPlateChest"); + public class PlaguedPlateChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Chest"); + AddMapEntry(new Color(191, 142, 111), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Plagued Plate Chest"; + chestDrop = mod.ItemType("PlaguedPlateChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,39 +53,39 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -162,47 +162,47 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Plagued Plate Chest"; - if (player.showItemIconText == "Plagued Plate Chest") - { - player.showItemIcon2 = mod.ItemType("PlaguedPlateChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Plagued Plate Chest"; + if (player.showItemIconText == "Plagued Plate Chest") + { + player.showItemIcon2 = mod.ItemType("PlaguedPlateChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index 636ac2f700..46132997f7 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -8,33 +8,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; animationFrameHeight = 90; TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } + adjTiles = new int[] { TileID.GrandfatherClocks }; + } public override bool HasSmartInteract() { @@ -42,53 +42,53 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; } @@ -104,16 +104,16 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + { + if (closer) + { + Main.clock = true; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("PlaguedPlateClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("PlaguedPlateClock")); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs index f44e51ad3c..a4f2b803f0 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs @@ -8,41 +8,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlateDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Door"); + public class PlaguedPlateDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("PlaguedPlateDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("PlaguedPlateDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -57,21 +57,21 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PlaguedPlateDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PlaguedPlateDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("PlaguedPlateDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("PlaguedPlateDoor"); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs index 9d534919a9..7dac1b0b5d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs @@ -8,61 +8,61 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlateDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Door"); + public class PlaguedPlateDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("PlaguedPlateDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("PlaguedPlateDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -77,21 +77,21 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("PlaguedPlateDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("PlaguedPlateDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("PlaguedPlateDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("PlaguedPlateDoor"); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 8ea196cfb2..1a98270154 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -1,48 +1,48 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlateDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Dresser"); + public class PlaguedPlateDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Plagued Plate Dresser"; - dresserDrop = mod.ItemType("PlaguedPlateDresser"); - } + adjTiles = new int[] { TileID.Dressers }; + dresser = "Plagued Plate Dresser"; + dresserDrop = mod.ItemType("PlaguedPlateDresser"); + } - public override bool HasSmartInteract() - { - return true; + public override bool HasSmartInteract() + { + return true; } public override bool CreateDust(int i, int j, ref int type) @@ -154,92 +154,92 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("PlaguedPlateDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("PlaguedPlateDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("PlaguedPlateDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("PlaguedPlateDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 624a488f8f..3cb1491d02 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -47,7 +47,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate r = 0.4f; g = 1f; b = 0.3f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs index 8928eda078..0ca063c218 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index 06cd6c11d5..4ffb5d4faf 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlatePlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class PlaguedPlatePlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("PlaguedPlatePlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("PlaguedPlatePlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -47,8 +47,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - } + { + Main.tileNoSunLight[Type] = false; + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs index c25ff585d6..baf9f7f754 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -7,35 +7,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { class PlaguedPlateSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlaguedPlateSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlaguedPlateSink")); + } + } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index 6380435008..0dcd65349e 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurniturePlaguedPlate { - public class PlaguedPlateWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Work Bench"); + public class PlaguedPlateWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Plagued Plate Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -37,8 +37,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("PlaguedPlateWorkbench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("PlaguedPlateWorkbench")); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedBasin.cs b/Tiles/FurnitureProfaned/ProfanedBasin.cs index 4bdf136965..c92f70c96f 100644 --- a/Tiles/FurnitureProfaned/ProfanedBasin.cs +++ b/Tiles/FurnitureProfaned/ProfanedBasin.cs @@ -7,16 +7,16 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { class ProfanedBasin : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Crucible"); + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Crucible"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -61,8 +61,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBasin")); + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBasin")); } } } diff --git a/Tiles/FurnitureProfaned/ProfanedBath.cs b/Tiles/FurnitureProfaned/ProfanedBath.cs index da74bb852c..68bae4e595 100644 --- a/Tiles/FurnitureProfaned/ProfanedBath.cs +++ b/Tiles/FurnitureProfaned/ProfanedBath.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index b8b08a3a2b..eb8efca45b 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -6,22 +6,22 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + public class ProfanedBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Bed"); + name.SetDefault("Profaned Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -37,46 +37,46 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("ProfanedBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProfanedBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("ProfanedBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProfanedBed"); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedBench.cs b/Tiles/FurnitureProfaned/ProfanedBench.cs index 1f623e4eac..dc25384abe 100644 --- a/Tiles/FurnitureProfaned/ProfanedBench.cs +++ b/Tiles/FurnitureProfaned/ProfanedBench.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index 5f6e82d742..37f0650f53 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -7,29 +7,29 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Chair"); + public class ProfanedChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -45,8 +45,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedChair")); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index f4c1e2ac81..ca21e656b2 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.Width = 3; diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index 900b4ba08d..2aebc8b7dd 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Chest"); + public class ProfanedChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Profaned Chest"; - chestDrop = mod.ItemType("ProfanedChest"); + adjTiles = new int[] { TileID.Containers }; + chest = "Profaned Chest"; + chestDrop = mod.ItemType("ProfanedChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -54,39 +54,39 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -163,47 +163,47 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Profaned Chest"; - if (player.showItemIconText == "Profaned Chest") - { - player.showItemIcon2 = mod.ItemType("ProfanedChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Profaned Chest"; + if (player.showItemIconText == "Profaned Chest") + { + player.showItemIcon2 = mod.ItemType("ProfanedChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index 89303c3cac..6d7126c839 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -8,32 +8,32 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; animationFrameHeight = 90; TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -54,67 +54,67 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("ProfanedClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("ProfanedClock")); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedCrystal.cs b/Tiles/FurnitureProfaned/ProfanedCrystal.cs index 669c628b25..0e2d51fd00 100644 --- a/Tiles/FurnitureProfaned/ProfanedCrystal.cs +++ b/Tiles/FurnitureProfaned/ProfanedCrystal.cs @@ -1,19 +1,19 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedCrystal : ModTile + public class ProfanedCrystal : ModTile { int subsheetWidth = 324; int subsheetHeight = 90; public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileBlockLight[Type] = true; + { + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDecorativeTiles(Type); @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned mineResist = 1f; minPick = 225; drop = mod.ItemType("ProfanedCrystal"); - AddMapEntry(new Color(181, 136, 177)); + AddMapEntry(new Color(181, 136, 177)); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs index c23790a1dc..25f84be84e 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs @@ -8,41 +8,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Door"); + public class ProfanedDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("ProfanedDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("ProfanedDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -58,21 +58,21 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("ProfanedDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("ProfanedDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProfanedDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProfanedDoor"); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs index 9ca417bc1a..687450a4ef 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs @@ -8,61 +8,61 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Door"); + public class ProfanedDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("ProfanedDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("ProfanedDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -78,21 +78,21 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("ProfanedDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("ProfanedDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProfanedDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProfanedDoor"); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedDresser.cs b/Tiles/FurnitureProfaned/ProfanedDresser.cs index 02f5effd58..c832ec7300 100644 --- a/Tiles/FurnitureProfaned/ProfanedDresser.cs +++ b/Tiles/FurnitureProfaned/ProfanedDresser.cs @@ -1,43 +1,43 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Dresser"); + public class ProfanedDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Profaned Dresser"; - dresserDrop = mod.ItemType("ProfanedDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Profaned Dresser"; + dresserDrop = mod.ItemType("ProfanedDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,9 +53,9 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -155,92 +155,92 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("ProfanedDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") { - player.showItemIcon2 = mod.ItemType("ProfanedDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("ProfanedDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("ProfanedDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index ed41597c7b..9239d0c055 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -48,7 +48,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned r = 1f; g = 0.85f; b = 0.7f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureProfaned/ProfanedPiano.cs b/Tiles/FurnitureProfaned/ProfanedPiano.cs index af5b9d7f9f..0cd18d4eb5 100644 --- a/Tiles/FurnitureProfaned/ProfanedPiano.cs +++ b/Tiles/FurnitureProfaned/ProfanedPiano.cs @@ -1,8 +1,5 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.DataStructures; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureProfaned/ProfanedPlatform.cs b/Tiles/FurnitureProfaned/ProfanedPlatform.cs index f385b177dd..ae9c8cf91c 100644 --- a/Tiles/FurnitureProfaned/ProfanedPlatform.cs +++ b/Tiles/FurnitureProfaned/ProfanedPlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class ProfanedPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("ProfanedPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("ProfanedPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -48,8 +48,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - } + { + Main.tileNoSunLight[Type] = false; + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 721f7dc9d7..c58c4534d5 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -1,18 +1,18 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedRock : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDecorativeTiles(Type); @@ -21,8 +21,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned soundType = 21; mineResist = 15f; minPick = 225; - drop = mod.ItemType("ProfanedRock"); - AddMapEntry(new Color(84, 38, 33)); + drop = mod.ItemType("ProfanedRock"); + AddMapEntry(new Color(84, 38, 33)); } int animationFrameWidth = 288; diff --git a/Tiles/FurnitureProfaned/ProfanedSink.cs b/Tiles/FurnitureProfaned/ProfanedSink.cs index a6142530da..d0d77bc3ba 100644 --- a/Tiles/FurnitureProfaned/ProfanedSink.cs +++ b/Tiles/FurnitureProfaned/ProfanedSink.cs @@ -7,36 +7,36 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { class ProfanedSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedSink")); + } + } } diff --git a/Tiles/FurnitureProfaned/ProfanedSlab.cs b/Tiles/FurnitureProfaned/ProfanedSlab.cs index 6cbbe9e3ca..53a1bd0ac3 100644 --- a/Tiles/FurnitureProfaned/ProfanedSlab.cs +++ b/Tiles/FurnitureProfaned/ProfanedSlab.cs @@ -1,16 +1,16 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedSlab : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + public class ProfanedSlab : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDecorativeTiles(Type); @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned mineResist = 10f; minPick = 225; drop = mod.ItemType("ProfanedSlab"); - AddMapEntry(new Color(122, 66, 59)); + AddMapEntry(new Color(122, 66, 59)); animationFrameHeight = 90; } int animationFrameWidth = 234; diff --git a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs index 8106e30da8..15998e4632 100644 --- a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureProfaned { - public class ProfanedWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Work Bench"); + public class ProfanedWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -38,8 +38,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("ProfanedWorkbench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("ProfanedWorkbench")); + } + } } diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index 06b91a8c22..848755d4e2 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -1,17 +1,17 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { public class RunicProfanedBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDecorativeTiles(Type); @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned mineResist = 10f; minPick = 225; drop = mod.ItemType("RunicProfanedBrick"); - AddMapEntry(new Color(122, 66, 59)); + AddMapEntry(new Color(122, 66, 59)); animationFrameHeight = 90; } int animationFrameWidth = 234; diff --git a/Tiles/FurnitureSilva/SilvaBasin.cs b/Tiles/FurnitureSilva/SilvaBasin.cs index d4f01a41be..08fbfaee0c 100644 --- a/Tiles/FurnitureSilva/SilvaBasin.cs +++ b/Tiles/FurnitureSilva/SilvaBasin.cs @@ -7,17 +7,17 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { class SilvaBasin : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Effulgent Manipulator"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Effulgent Manipulator"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; @@ -58,8 +58,8 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("SilvaBasin")); + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("SilvaBasin")); } } } diff --git a/Tiles/FurnitureSilva/SilvaBathtub.cs b/Tiles/FurnitureSilva/SilvaBathtub.cs index 3db0ad29c7..a3d066447d 100644 --- a/Tiles/FurnitureSilva/SilvaBathtub.cs +++ b/Tiles/FurnitureSilva/SilvaBathtub.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index 70a3b5b139..d54ea4675e 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + public class SilvaBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Bed"); + name.SetDefault("Silva Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -38,46 +38,46 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("SilvaBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("SilvaBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("SilvaBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("SilvaBed"); + } + } } diff --git a/Tiles/FurnitureSilva/SilvaBench.cs b/Tiles/FurnitureSilva/SilvaBench.cs index fea111a7de..a02707cc93 100644 --- a/Tiles/FurnitureSilva/SilvaBench.cs +++ b/Tiles/FurnitureSilva/SilvaBench.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index 41447e37c8..de7cdcfe94 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -7,30 +7,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class SilvaChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Silva Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -46,8 +46,8 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("SilvaChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("SilvaChair")); + } + } } diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index a1cac5f2dd..3105d85154 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 8755cbff2a..c1bd1fb3a2 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Chest"); + public class SilvaChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Silva Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Silva Chest"; - chestDrop = mod.ItemType("SilvaChest"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Silva Chest"; + chestDrop = mod.ItemType("SilvaChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -54,39 +54,39 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -163,47 +163,47 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Silva Chest"; - if (player.showItemIconText == "Silva Chest") - { - player.showItemIcon2 = mod.ItemType("SilvaChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Silva Chest"; + if (player.showItemIconText == "Silva Chest") + { + player.showItemIcon2 = mod.ItemType("SilvaChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index 5840b94868..6129b79731 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -8,33 +8,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; animationFrameHeight = 90; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -55,67 +55,67 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("SilvaClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("SilvaClock")); + } + } } diff --git a/Tiles/FurnitureSilva/SilvaCrystal.cs b/Tiles/FurnitureSilva/SilvaCrystal.cs index e2deec66c5..f4334872f9 100644 --- a/Tiles/FurnitureSilva/SilvaCrystal.cs +++ b/Tiles/FurnitureSilva/SilvaCrystal.cs @@ -1,23 +1,22 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaCrystal : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; + public class SilvaCrystal : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; soundType = 21; mineResist = 2f; minPick = 275; drop = mod.ItemType("SilvaCrystal"); - AddMapEntry(new Color(49, 100, 99)); + AddMapEntry(new Color(49, 100, 99)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureSilva/SilvaDoorClosed.cs b/Tiles/FurnitureSilva/SilvaDoorClosed.cs index e021c36fea..625d8197fb 100644 --- a/Tiles/FurnitureSilva/SilvaDoorClosed.cs +++ b/Tiles/FurnitureSilva/SilvaDoorClosed.cs @@ -8,42 +8,42 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class SilvaDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Door"); + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Silva Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("SilvaDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("SilvaDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -59,21 +59,21 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SilvaDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SilvaDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("SilvaDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("SilvaDoor"); + } + } } diff --git a/Tiles/FurnitureSilva/SilvaDoorOpen.cs b/Tiles/FurnitureSilva/SilvaDoorOpen.cs index fefab8e57a..74e03a86d0 100644 --- a/Tiles/FurnitureSilva/SilvaDoorOpen.cs +++ b/Tiles/FurnitureSilva/SilvaDoorOpen.cs @@ -8,62 +8,62 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; + public class SilvaDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Door"); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Silva Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("SilvaDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("SilvaDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -79,21 +79,21 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("SilvaDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("SilvaDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("SilvaDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("SilvaDoor"); + } + } } diff --git a/Tiles/FurnitureSilva/SilvaDresser.cs b/Tiles/FurnitureSilva/SilvaDresser.cs index 42b4b24fbd..21ef376f67 100644 --- a/Tiles/FurnitureSilva/SilvaDresser.cs +++ b/Tiles/FurnitureSilva/SilvaDresser.cs @@ -1,44 +1,44 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; + public class SilvaDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Dresser"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Silva Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Silva Dresser"; - dresserDrop = mod.ItemType("SilvaDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Silva Dresser"; + dresserDrop = mod.ItemType("SilvaDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -49,9 +49,9 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -151,97 +151,97 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("SilvaDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("SilvaDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("SilvaDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("SilvaDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index 6c2f6a9b63..9dabc6d0ff 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -49,7 +49,8 @@ namespace CalamityMod.Tiles.FurnitureSilva r = 0.6f; g = 1f; b = 0.8f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureSilva/SilvaPiano.cs b/Tiles/FurnitureSilva/SilvaPiano.cs index 641f903ca0..73568f58c9 100644 --- a/Tiles/FurnitureSilva/SilvaPiano.cs +++ b/Tiles/FurnitureSilva/SilvaPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureSilva/SilvaSink.cs b/Tiles/FurnitureSilva/SilvaSink.cs index 911227763e..9f19426bf3 100644 --- a/Tiles/FurnitureSilva/SilvaSink.cs +++ b/Tiles/FurnitureSilva/SilvaSink.cs @@ -7,37 +7,37 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { class SilvaSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Silva Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("SilvaTileGold"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("SilvaTileGold"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("SilvaSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("SilvaSink")); + } + } } diff --git a/Tiles/FurnitureSilva/SilvaWorkBench.cs b/Tiles/FurnitureSilva/SilvaWorkBench.cs index 0619f87b9d..56b45f4107 100644 --- a/Tiles/FurnitureSilva/SilvaWorkBench.cs +++ b/Tiles/FurnitureSilva/SilvaWorkBench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureSilva { - public class SilvaWorkBench : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class SilvaWorkBench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Silva Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Silva Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -39,8 +39,8 @@ namespace CalamityMod.Tiles.FurnitureSilva } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("SilvaWorkBench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("SilvaWorkBench")); + } + } } diff --git a/Tiles/FurnitureStatigel/StaticRefiner.cs b/Tiles/FurnitureStatigel/StaticRefiner.cs index e7425291af..a0c39fcfb9 100644 --- a/Tiles/FurnitureStatigel/StaticRefiner.cs +++ b/Tiles/FurnitureStatigel/StaticRefiner.cs @@ -6,17 +6,17 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { class StaticRefiner : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Static Refiner"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Static Refiner"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } @@ -44,89 +44,89 @@ namespace CalamityMod.Tiles.FurnitureStatigel // Below is an example completely manually drawing a tile. It shows some interesting concepts that may be useful for more advanced things. /*public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - // Flips the sprite - SpriteEffects effects = SpriteEffects.None; - if (i % 2 == 1) - { - effects = SpriteEffects.FlipHorizontally; - } + { + // Flips the sprite + SpriteEffects effects = SpriteEffects.None; + if (i % 2 == 1) + { + effects = SpriteEffects.FlipHorizontally; + } - // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. - int k = Main.tileFrame[Type] + i % 6; - if (i % 2 == 0) - { - k += 3; - } - if (i % 3 == 0) - { - k += 3; - } - if (i % 4 == 0) - { - k += 3; - } - k = k % 6; + // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. + int k = Main.tileFrame[Type] + i % 6; + if (i % 2 == 0) + { + k += 3; + } + if (i % 3 == 0) + { + k += 3; + } + if (i % 4 == 0) + { + k += 3; + } + k = k % 6; - Tile tile = Main.tile[i, j]; - Texture2D texture; - if (Main.canDrawColorTile(i, j)) - { - texture = Main.tileAltTexture[Type, (int)tile.color()]; - } - else - { - texture = Main.tileTexture[Type]; - } - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - int animate = k * animationFrameWidth; + Tile tile = Main.tile[i, j]; + Texture2D texture; + if (Main.canDrawColorTile(i, j)) + { + texture = Main.tileAltTexture[Type, (int)tile.color()]; + } + else + { + texture = Main.tileTexture[Type]; + } + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int animate = k * animationFrameWidth; - Main.spriteBatch.Draw( - texture, - new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, - new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), - Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); + Main.spriteBatch.Draw( + texture, + new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, + new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), + Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); - return false; // return false to stop vanilla draw. - }*/ + return false; // return false to stop vanilla draw. + }*/ - // public override void AnimateTile(ref int frame, ref int frameCounter) - //{ - // /*frameCounter++; - // if (frameCounter > 8) - // { - // frameCounter = 0; - // frame++; - // if (frame > 5) - // { - // frame = 0; - // } - // }*/ - // // Above code works, but since we are just mimicking another tile, we can just use the same value. - // frame = Main.tileFrame[TileID.FireflyinaBottle]; - //} + // public override void AnimateTile(ref int frame, ref int frameCounter) + //{ + // /*frameCounter++; + // if (frameCounter > 8) + // { + // frameCounter = 0; + // frame++; + // if (frame > 5) + // { + // frame = 0; + // } + // }*/ + // // Above code works, but since we are just mimicking another tile, we can just use the same value. + // frame = Main.tileFrame[TileID.FireflyinaBottle]; + //} - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StaticRefiner")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StaticRefiner")); + } + } - //class ExampleAnimatedTileItem : ModItem - //{ - // public override void SetStaticDefaults() - // { - // DisplayName.SetDefault("Red Firefly in a Bottle"); - // } + //class ExampleAnimatedTileItem : ModItem + //{ + // public override void SetStaticDefaults() + // { + // DisplayName.SetDefault("Red Firefly in a Bottle"); + // } - // public override void SetDefaults() - // { - // item.CloneDefaults(ItemID.FireflyinaBottle); - // item.createTile = ModContent.TileType(); - // } - //} + // public override void SetDefaults() + // { + // item.CloneDefaults(ItemID.FireflyinaBottle); + // item.createTile = ModContent.TileType(); + // } + //} } diff --git a/Tiles/FurnitureStatigel/StatigelBath.cs b/Tiles/FurnitureStatigel/StatigelBath.cs index b85c2f49f0..4f2670e268 100644 --- a/Tiles/FurnitureStatigel/StatigelBath.cs +++ b/Tiles/FurnitureStatigel/StatigelBath.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index 5edfa1f561..4f0a8384ec 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -6,22 +6,22 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + public class StatigelBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Bed"); + name.SetDefault("Statigel Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -36,46 +36,46 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override bool HasSmartInteract() - { - return true; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("StatigelBed")); - } - - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + { return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StatigelBed"); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("StatigelBed")); + } + + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StatigelBed"); + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelBlock.cs b/Tiles/FurnitureStatigel/StatigelBlock.cs index 3bfc83f575..9835e58db6 100644 --- a/Tiles/FurnitureStatigel/StatigelBlock.cs +++ b/Tiles/FurnitureStatigel/StatigelBlock.cs @@ -1,24 +1,24 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelBlock : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + public class StatigelBlock : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDecorativeTiles(Type); TileMerge.MergeSmoothTiles(Type); drop = mod.ItemType("StatigelBlock"); - AddMapEntry(new Color(215, 74, 121)); + AddMapEntry(new Color(215, 74, 121)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureStatigel/StatigelChair.cs b/Tiles/FurnitureStatigel/StatigelChair.cs index c5c268b552..4387ca72f6 100644 --- a/Tiles/FurnitureStatigel/StatigelChair.cs +++ b/Tiles/FurnitureStatigel/StatigelChair.cs @@ -7,29 +7,29 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Chair"); + public class StatigelChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -44,8 +44,8 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelChair")); - } - } + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelChair")); + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelChandelier.cs b/Tiles/FurnitureStatigel/StatigelChandelier.cs index fc52e957d4..85892838a4 100644 --- a/Tiles/FurnitureStatigel/StatigelChandelier.cs +++ b/Tiles/FurnitureStatigel/StatigelChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.Width = 3; TileObjectData.newTile.Height = 3; diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index dfbc45f924..f003da0948 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Chest"); + public class StatigelChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Statigel Chest"; - chestDrop = mod.ItemType("StatigelChest"); + adjTiles = new int[] { TileID.Containers }; + chest = "Statigel Chest"; + chestDrop = mod.ItemType("StatigelChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,32 +48,32 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } } public override void NumDust(int i, int j, bool fail, ref int num) @@ -82,10 +82,10 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -162,47 +162,47 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Statigel Chest"; - if (player.showItemIconText == "Statigel Chest") - { - player.showItemIcon2 = mod.ItemType("StatigelChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Statigel Chest"; + if (player.showItemIconText == "Statigel Chest") + { + player.showItemIcon2 = mod.ItemType("StatigelChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelClock.cs b/Tiles/FurnitureStatigel/StatigelClock.cs index 7947af736b..8e45285ce4 100644 --- a/Tiles/FurnitureStatigel/StatigelClock.cs +++ b/Tiles/FurnitureStatigel/StatigelClock.cs @@ -8,31 +8,31 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -47,72 +47,72 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StatigelClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StatigelClock")); + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs index 2c410204d8..a99cd1a6d4 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs @@ -8,41 +8,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Door"); + public class StatigelDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("StatigelDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("StatigelDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -57,21 +57,21 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("StatigelDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("StatigelDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StatigelDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StatigelDoor"); + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs index bac0a6b97f..1f96825da0 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs @@ -8,61 +8,61 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Door"); + public class StatigelDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("StatigelDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("StatigelDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -77,21 +77,21 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("StatigelDoor")); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("StatigelDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StatigelDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StatigelDoor"); + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelDresser.cs b/Tiles/FurnitureStatigel/StatigelDresser.cs index 0a10fd40db..05e09f64b7 100644 --- a/Tiles/FurnitureStatigel/StatigelDresser.cs +++ b/Tiles/FurnitureStatigel/StatigelDresser.cs @@ -1,43 +1,43 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Dresser"); + public class StatigelDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Statigel Dresser"; - dresserDrop = mod.ItemType("StatigelDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Statigel Dresser"; + dresserDrop = mod.ItemType("StatigelDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -47,9 +47,9 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -149,97 +149,97 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("StatigelDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("StatigelDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("StatigelDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("StatigelDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index d0b42ebf70..0d214e4d07 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -47,7 +47,8 @@ namespace CalamityMod.Tiles.FurnitureStatigel r = 0.8f; g = 0.9f; b = 1f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureStatigel/StatigelPiano.cs b/Tiles/FurnitureStatigel/StatigelPiano.cs index 63f446dbf4..e62eb97033 100644 --- a/Tiles/FurnitureStatigel/StatigelPiano.cs +++ b/Tiles/FurnitureStatigel/StatigelPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureStatigel/StatigelPlatform.cs b/Tiles/FurnitureStatigel/StatigelPlatform.cs index f91f10d545..1f0eadf8c8 100644 --- a/Tiles/FurnitureStatigel/StatigelPlatform.cs +++ b/Tiles/FurnitureStatigel/StatigelPlatform.cs @@ -6,32 +6,32 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111)); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("StatigelPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + public class StatigelPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddMapEntry(new Color(191, 142, 111)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("StatigelPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -41,13 +41,13 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } + { + Main.tileNoSunLight[Type] = false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelSink.cs b/Tiles/FurnitureStatigel/StatigelSink.cs index 63408fa983..7543ea552f 100644 --- a/Tiles/FurnitureStatigel/StatigelSink.cs +++ b/Tiles/FurnitureStatigel/StatigelSink.cs @@ -7,35 +7,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { class StatigelSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelSink")); + } + } } diff --git a/Tiles/FurnitureStatigel/StatigelSofa.cs b/Tiles/FurnitureStatigel/StatigelSofa.cs index 8bb974d2f9..a119a01303 100644 --- a/Tiles/FurnitureStatigel/StatigelSofa.cs +++ b/Tiles/FurnitureStatigel/StatigelSofa.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureStatigel/StatigelWorkbench.cs b/Tiles/FurnitureStatigel/StatigelWorkbench.cs index 22c1bfcd29..cdc23ba9ee 100644 --- a/Tiles/FurnitureStatigel/StatigelWorkbench.cs +++ b/Tiles/FurnitureStatigel/StatigelWorkbench.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStatigel { - public class StatigelWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Work Bench"); + public class StatigelWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -37,8 +37,8 @@ namespace CalamityMod.Tiles.FurnitureStatigel } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StatigelWorkbench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StatigelWorkbench")); + } + } } diff --git a/Tiles/FurnitureStratus/StratusBathtub.cs b/Tiles/FurnitureStratus/StratusBathtub.cs index d98b2b1971..c0661aea77 100644 --- a/Tiles/FurnitureStratus/StratusBathtub.cs +++ b/Tiles/FurnitureStratus/StratusBathtub.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index e5a85436be..637e503aeb 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -6,22 +6,22 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Bed"); + public class StratusBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -32,8 +32,8 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -42,41 +42,41 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("StratusBed")); - } + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("StratusBed")); + } - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StratusBed"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StratusBed"); + } + } } diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 4f4ae1b266..551e2257a8 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -1,9 +1,9 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureStratus { diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index faf4012b86..459fd34825 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -7,29 +7,29 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Chair"); + public class StratusChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -40,13 +40,13 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StratusChair")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StratusChair")); + } + } } diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index 76d0ed62e1..88315bfe18 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.Width = 3; diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 5be70f5974..30eadb0bfb 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Chest"); + public class StratusChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Stratus Chest"; - chestDrop = mod.ItemType("StratusChest"); + adjTiles = new int[] { TileID.Containers }; + chest = "Stratus Chest"; + chestDrop = mod.ItemType("StratusChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -49,32 +49,32 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } } public override void NumDust(int i, int j, bool fail, ref int num) @@ -83,10 +83,10 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -163,47 +163,47 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Stratus Chest"; - if (player.showItemIconText == "Stratus Chest") - { - player.showItemIcon2 = mod.ItemType("StratusChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Stratus Chest"; + if (player.showItemIconText == "Stratus Chest") + { + player.showItemIcon2 = mod.ItemType("StratusChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index 037e74ee4f..f0d9c220a2 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -8,31 +8,31 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { public class StratusClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; animationFrameHeight = 90; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Clock"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Clock"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -48,72 +48,72 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StratusClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StratusClock")); + } + } } diff --git a/Tiles/FurnitureStratus/StratusDoorClosed.cs b/Tiles/FurnitureStratus/StratusDoorClosed.cs index 7811c86de4..254819ddbf 100644 --- a/Tiles/FurnitureStratus/StratusDoorClosed.cs +++ b/Tiles/FurnitureStratus/StratusDoorClosed.cs @@ -8,41 +8,41 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Door"); + public class StratusDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("StratusDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("StratusDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,8 +53,8 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -63,16 +63,16 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("StratusDoor")); - } + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("StratusDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StratusDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StratusDoor"); + } + } } diff --git a/Tiles/FurnitureStratus/StratusDoorOpen.cs b/Tiles/FurnitureStratus/StratusDoorOpen.cs index 57f5cefd03..27f9aa06e8 100644 --- a/Tiles/FurnitureStratus/StratusDoorOpen.cs +++ b/Tiles/FurnitureStratus/StratusDoorOpen.cs @@ -8,61 +8,61 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Door"); + public class StratusDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("StratusDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("StratusDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -73,8 +73,8 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -83,16 +83,16 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("StratusDoor")); - } + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("StratusDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StratusDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StratusDoor"); + } + } } diff --git a/Tiles/FurnitureStratus/StratusDresser.cs b/Tiles/FurnitureStratus/StratusDresser.cs index 75e2b8fbf8..51b8c05903 100644 --- a/Tiles/FurnitureStratus/StratusDresser.cs +++ b/Tiles/FurnitureStratus/StratusDresser.cs @@ -1,43 +1,43 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Dresser"); + public class StratusDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Stratus Dresser"; - dresserDrop = mod.ItemType("StratusDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Stratus Dresser"; + dresserDrop = mod.ItemType("StratusDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,9 +48,9 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -150,97 +150,97 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("StratusDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("StratusDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("StratusDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("StratusDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index 0ffcdb6e35..1e5a4cb8ed 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -48,7 +48,8 @@ namespace CalamityMod.Tiles.FurnitureStratus r = 0.6f; g = 0.8f; b = 1f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureStratus/StratusPiano.cs b/Tiles/FurnitureStratus/StratusPiano.cs index 866966e5e7..b83240786b 100644 --- a/Tiles/FurnitureStratus/StratusPiano.cs +++ b/Tiles/FurnitureStratus/StratusPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index 6e8a2313f9..086daa87ed 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class StratusPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("StratusPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("StratusPlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -43,13 +43,13 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } + { + Main.tileNoSunLight[Type] = false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } diff --git a/Tiles/FurnitureStratus/StratusSink.cs b/Tiles/FurnitureStratus/StratusSink.cs index d3ecd0824e..a3cdbe9b98 100644 --- a/Tiles/FurnitureStratus/StratusSink.cs +++ b/Tiles/FurnitureStratus/StratusSink.cs @@ -7,36 +7,36 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { class StratusSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StratusSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StratusSink")); + } + } } diff --git a/Tiles/FurnitureStratus/StratusWorkbench.cs b/Tiles/FurnitureStratus/StratusWorkbench.cs index 4c615a5f9c..d1c7cc6715 100644 --- a/Tiles/FurnitureStratus/StratusWorkbench.cs +++ b/Tiles/FurnitureStratus/StratusWorkbench.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureStratus { - public class StratusWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Stratus Work Bench"); + public class StratusWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stratus Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -33,13 +33,13 @@ namespace CalamityMod.Tiles.FurnitureStratus } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StratusWorkbench")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StratusWorkbench")); + } + } } diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index de2a5e2a6f..e5d852625c 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -1,18 +1,18 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureVoid { public class SmoothVoidstone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeSmoothTiles(Type); @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.FurnitureVoid mineResist = 7f; minPick = 190; drop = mod.ItemType("SmoothVoidstone"); - AddMapEntry(new Color(27, 24, 31)); + AddMapEntry(new Color(27, 24, 31)); } int animationFrameWidth = 288; diff --git a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs index 89e7e74802..e9f5372567 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -6,33 +6,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { - public class SmoothVoidstonePlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class SmoothVoidstonePlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; soundType = 21; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothVoidstonePlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; + drop = mod.ItemType("SmoothVoidstonePlatform"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; } public override bool CreateDust(int i, int j, ref int type) @@ -42,13 +42,13 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } + { + Main.tileNoSunLight[Type] = false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } diff --git a/Tiles/FurnitureVoid/VoidBath.cs b/Tiles/FurnitureVoid/VoidBath.cs index c86e89612e..5608b8a999 100644 --- a/Tiles/FurnitureVoid/VoidBath.cs +++ b/Tiles/FurnitureVoid/VoidBath.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index 4fa5b5526e..c2b1c9b934 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -6,23 +6,23 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + public class VoidBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Bed"); + name.SetDefault("Void Bed"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; + adjTiles = new int[] { TileID.Beds }; + bed = true; } public override bool CreateDust(int i, int j, ref int type) @@ -32,8 +32,8 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -42,41 +42,41 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("VoidBed")); - } + { + Item.NewItem(i * 16, j * 16, 64, 32, mod.ItemType("VoidBed")); + } - public override bool NewRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } return true; - } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("VoidBed"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("VoidBed"); + } + } } diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index 3693cadc91..32aa4e9459 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -7,30 +7,30 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class VoidChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Chair"); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Chair"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; } public override bool CreateDust(int i, int j, ref int type) @@ -40,13 +40,13 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidChair")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidChair")); + } + } } diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index 013610f348..46b2e301ab 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index fb27147e37..3d508674b1 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -1,5 +1,5 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -10,35 +10,35 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidChest : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Chest"); + public class VoidChest : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Void Chest"; - chestDrop = mod.ItemType("VoidChest"); + adjTiles = new int[] { TileID.Containers }; + chest = "Void Chest"; + chestDrop = mod.ItemType("VoidChest"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,32 +48,32 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } } public override void NumDust(int i, int j, bool fail, ref int num) @@ -82,10 +82,10 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } public override bool NewRightClick(int i, int j) { @@ -162,47 +162,47 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Void Chest"; - if (player.showItemIconText == "Void Chest") - { - player.showItemIcon2 = mod.ItemType("VoidChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Void Chest"; + if (player.showItemIconText == "Void Chest") + { + player.showItemIcon2 = mod.ItemType("VoidChest"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } } diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index 4305831f43..fde543c9e2 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -8,33 +8,33 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { public class VoidClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; animationFrameHeight = 90; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; TileObjectData.newTile.Origin = new Point16(0, 4); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Obelisk"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Obelisk"); AddMapEntry(new Color(191, 142, 111), name); dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; + adjTiles = new int[] { TileID.GrandfatherClocks }; } public override bool HasSmartInteract() @@ -59,72 +59,72 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override bool NewRightClick(int x, int y) - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); return true; - } + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("VoidClock")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("VoidClock")); + } + } } diff --git a/Tiles/FurnitureVoid/VoidDoorClosed.cs b/Tiles/FurnitureVoid/VoidDoorClosed.cs index cef0ca7df0..99ec1ffe1a 100644 --- a/Tiles/FurnitureVoid/VoidDoorClosed.cs +++ b/Tiles/FurnitureVoid/VoidDoorClosed.cs @@ -8,42 +8,42 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; + public class VoidDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Door"); + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("VoidDoorOpen"); + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("VoidDoorOpen"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,8 +53,8 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -63,16 +63,16 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("VoidDoor")); - } + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("VoidDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("VoidDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("VoidDoor"); + } + } } diff --git a/Tiles/FurnitureVoid/VoidDoorOpen.cs b/Tiles/FurnitureVoid/VoidDoorOpen.cs index e39adf6378..a9c8fb7e58 100644 --- a/Tiles/FurnitureVoid/VoidDoorOpen.cs +++ b/Tiles/FurnitureVoid/VoidDoorOpen.cs @@ -8,62 +8,62 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; + public class VoidDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Door"); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("VoidDoorClosed"); + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("VoidDoorClosed"); } public override bool CreateDust(int i, int j, ref int type) @@ -73,8 +73,8 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override bool HasSmartInteract() - { - return true; + { + return true; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -83,16 +83,16 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("VoidDoor")); - } + { + Item.NewItem(i * 16, j * 16, 32, 48, mod.ItemType("VoidDoor")); + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("VoidDoor"); - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("VoidDoor"); + } + } } diff --git a/Tiles/FurnitureVoid/VoidDresser.cs b/Tiles/FurnitureVoid/VoidDresser.cs index 473e4c9b62..66b7d9cebf 100644 --- a/Tiles/FurnitureVoid/VoidDresser.cs +++ b/Tiles/FurnitureVoid/VoidDresser.cs @@ -1,44 +1,44 @@ -using System; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.ID; +using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; + public class VoidDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Dresser"); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "Void Dresser"; - dresserDrop = mod.ItemType("VoidDresser"); + adjTiles = new int[] { TileID.Dressers }; + dresser = "Void Dresser"; + dresserDrop = mod.ItemType("VoidDresser"); } public override bool CreateDust(int i, int j, ref int type) @@ -48,9 +48,9 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override bool HasSmartInteract() - { - return true; - } + { + return true; + } public override bool NewRightClick(int i, int j) { @@ -150,97 +150,97 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("VoidDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("VoidDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("VoidDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("VoidDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } } diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index 6437af3a67..81b30a4f38 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -48,7 +48,8 @@ namespace CalamityMod.Tiles.FurnitureVoid r = 0.8f; g = 0.9f; b = 1f; - } else + } + else { r = 0f; g = 0f; diff --git a/Tiles/FurnitureVoid/VoidPiano.cs b/Tiles/FurnitureVoid/VoidPiano.cs index 1a9b07309e..8594ebb83b 100644 --- a/Tiles/FurnitureVoid/VoidPiano.cs +++ b/Tiles/FurnitureVoid/VoidPiano.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureVoid/VoidSink.cs b/Tiles/FurnitureVoid/VoidSink.cs index 020b9a4590..d85e89e1e6 100644 --- a/Tiles/FurnitureVoid/VoidSink.cs +++ b/Tiles/FurnitureVoid/VoidSink.cs @@ -7,36 +7,36 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { class VoidSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Sink"); - AddMapEntry(new Color(191, 142, 111), name); - adjTiles = new int[] { TileID.Sinks }; - } + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Sink"); + AddMapEntry(new Color(191, 142, 111), name); + adjTiles = new int[] { TileID.Sinks }; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidSink")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidSink")); + } + } } diff --git a/Tiles/FurnitureVoid/VoidSofa.cs b/Tiles/FurnitureVoid/VoidSofa.cs index 9df1f71097..de33114c72 100644 --- a/Tiles/FurnitureVoid/VoidSofa.cs +++ b/Tiles/FurnitureVoid/VoidSofa.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/FurnitureVoid/VoidWorkbench.cs b/Tiles/FurnitureVoid/VoidWorkbench.cs index 8984924998..c4ec89dca1 100644 --- a/Tiles/FurnitureVoid/VoidWorkbench.cs +++ b/Tiles/FurnitureVoid/VoidWorkbench.cs @@ -6,24 +6,24 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureVoid { - public class VoidWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; + public class VoidWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Work Bench"); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; + adjTiles = new int[] { TileID.WorkBenches }; } public override bool CreateDust(int i, int j, ref int type) @@ -38,8 +38,8 @@ namespace CalamityMod.Tiles.FurnitureVoid } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("VoidWorkbench")); - } - } + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("VoidWorkbench")); + } + } } diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index 5c833b9572..9bd0d0bff8 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -2,17 +2,16 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureVoid { public class VoidstoneSlab : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; soundType = 21; mineResist = 7f; minPick = 190; diff --git a/Tiles/LumenylCrystals.cs b/Tiles/LumenylCrystals.cs index 3a4a7e837a..a055cbc6a8 100644 --- a/Tiles/LumenylCrystals.cs +++ b/Tiles/LumenylCrystals.cs @@ -1,23 +1,22 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using Terraria.ObjectData; +using Terraria.ModLoader; namespace CalamityMod.Tiles { public class LumenylCrystals : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Lumenyl"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(0, 150, 200), name); + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Lumenyl"); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(0, 150, 200), name); soundType = 2; soundStyle = 27; dustType = 67; @@ -37,38 +36,38 @@ namespace CalamityMod.Tiles b = 0.4f; } - public override bool CanPlace(int i, int j) - { - if (Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - return true; - if (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - return true; - if (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - return true; - if (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - return true; - return false; - } + public override bool CanPlace(int i, int j) + { + if (Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + return true; + if (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + return true; + if (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + return true; + if (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + return true; + return false; + } - public override void PlaceInWorld(int i, int j, Item item) - { - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - } - } + public override void PlaceInWorld(int i, int j, Item item) + { + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + } + } } diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index fba4a9648d..9b0317ad6d 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -6,715 +6,715 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { - public class MonsterBanner : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = 111; - TileObjectData.addTile(Type); - dustType = -1; - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Banner"); - AddMapEntry(new Color(13, 88, 130), name); - } + public class MonsterBanner : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 111; + TileObjectData.addTile(Type); + dustType = -1; + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Banner"); + AddMapEntry(new Color(13, 88, 130), name); + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - int style = frameX / 18; - string item; - switch (style) - { - case 0: - item = "AquaticParasiteBanner"; - break; - case 1: - item = "FlounderBanner"; - break; - case 2: - item = "GnasherBanner"; - break; - case 3: - item = "TrasherBanner"; - break; - case 4: - item = "CatfishBanner"; - break; - case 5: - item = "MaulerBanner"; - break; - case 6: - item = "AquaticSeekerBanner"; - break; - case 7: - item = "AquaticUrchinBanner"; - break; - case 8: - item = "FrogfishBanner"; - break; - case 9: - item = "MantisShrimpBanner"; - break; - case 10: - item = "AquaticAberrationBanner"; - break; - case 11: - item = "ParaseaBanner"; - break; - case 12: - item = "SeaUrchinBanner"; - break; - case 13: - item = "BoxJellyfishBanner"; - break; - case 14: - item = "MorayEelBanner"; - break; - case 15: - item = "DevilFishBanner"; - break; - case 16: - item = "CuttlefishBanner"; - break; - case 17: - item = "ToxicMinnowBanner"; - break; - case 18: - item = "ViperfishBanner"; - break; - case 19: - item = "LuminousCorvinaBanner"; - break; - case 20: - item = "GiantSquidBanner"; - break; - case 21: - item = "LaserfishBanner"; - break; - case 22: - item = "OarfishBanner"; - break; - case 23: - item = "ColossalSquidBanner"; - break; - case 24: - item = "MirageJellyBanner"; - break; - case 25: - item = "EidolistBanner"; - break; - case 26: - item = "GulperEelBanner"; - break; - case 27: - item = "EidolonWyrmJuvenileBanner"; - break; - case 28: - item = "BloatfishBanner"; - break; - case 29: - item = "BobbitWormBanner"; - break; - case 30: - item = "ChaoticPufferBanner"; - break; - case 31: - item = "AstralProbeBanner"; - break; - case 32: - item = "SmallSightseerBanner"; - break; - case 33: - item = "BigSightseerBanner"; - break; - case 34: - item = "AriesBanner"; - break; - case 35: - item = "AstralSlimeBanner"; - break; - case 36: - item = "AtlasBanner"; - break; - case 37: - item = "MantisBanner"; - break; - case 38: - item = "NovaBanner"; - break; - case 39: - item = "AstralachneaBanner"; - break; - case 40: - item = "HiveBanner"; - break; - case 41: - item = "StellarCullexBanner"; - break; - case 42: - item = "FusionFeederBanner"; - break; - case 43: - item = "HadarianBanner"; - break; - case 44: - item = "HeatSpiritBanner"; - break; - case 45: - item = "ScryllarBanner"; - break; - case 46: - item = "DespairStoneBanner"; - break; - case 47: - item = "SoulSlurperBanner"; - break; - case 48: - item = "ImpiousImmolatorBanner"; - break; - case 49: - item = "ScornEaterBanner"; - break; - case 50: - item = "ProfanedEnergyBanner"; - break; - case 51: - item = "WulfrumSlimeBanner"; - break; - case 52: - item = "WulfrumDroneBanner"; - break; - case 53: - item = "PitbullBanner"; - break; - case 54: - item = "BlightedEyeBanner"; - break; - case 55: - item = "CalamityEyeBanner"; - break; - case 56: - item = "SunskaterBanner"; - break; - case 57: - item = "ShockstormShuttleBanner"; - break; - case 58: - item = "CloudElementalBanner"; - break; - case 59: - item = "AngryDogBanner"; - break; - case 60: - item = "CryonBanner"; - break; - case 61: - item = "IceClasperBanner"; - break; - case 62: - item = "StormlionBanner"; - break; - case 63: - item = "CnidrionBanner"; - break; - case 64: - item = "SandTortoiseBanner"; - break; - case 65: - item = "GreatSandSharkBanner"; - break; - case 66: - item = "AmethystCrawlerBanner"; - break; - case 67: - item = "TopazCrawlerBanner"; - break; - case 68: - item = "SapphireCrawlerBanner"; - break; - case 69: - item = "EmeraldCrawlerBanner"; - break; - case 70: - item = "RubyCrawlerBanner"; - break; - case 71: - item = "DiamondCrawlerBanner"; - break; - case 72: - item = "AmberCrawlerBanner"; - break; - case 73: - item = "CrystalCrawlerBanner"; - break; - case 74: - item = "SunBatBanner"; - break; - case 75: - item = "CosmicElementalBanner"; - break; - case 76: - item = "EarthElementalBanner"; - break; - case 77: - item = "ArmoredDiggerBanner"; - break; - case 78: - item = "MelterBanner"; - break; - case 79: - item = "PestilentSlimeBanner"; - break; - case 80: - item = "PlagueshellBanner"; - break; - case 81: - item = "PlagueChargerBanner"; - break; - case 82: - item = "VirulingBanner"; - break; - case 83: - item = "PlaguebringerBanner"; - break; - case 84: - item = "PhantomSpiritBanner"; - break; - case 85: - item = "OverloadedSoldierBanner"; - break; - case 86: - item = "PhantomDebrisBanner"; - break; - case 87: - item = "BOHLDOHRBanner"; - break; - case 88: - item = "EbonianBlightSlimeBanner"; - break; - case 89: - item = "CrimulanBlightSlimeBanner"; - break; - case 90: - item = "AeroSlimeBanner"; - break; - case 91: - item = "CryoSlimeBanner"; - break; - case 92: - item = "PerennialSlimeBanner"; - break; - case 93: - item = "CharredSlimeBanner"; - break; - case 94: - item = "BloomSlimeBanner"; - break; - case 95: - item = "CultistAssassinBanner"; - break; - case 96: - item = "ReaperSharkBanner"; - break; - case 97: - item = "IrradiatedSlimeBanner"; - break; - case 98: - item = "PrismTurtleBanner"; - break; - case 99: - item = "ClamBanner"; - break; - case 100: - item = "EutrophicRayBanner"; - break; - case 101: - item = "GhostBellBanner"; - break; - case 102: - item = "GhostBellSmallBanner"; - break; - case 103: - item = "SeaFloatyBanner"; - break; - case 104: - item = "BlindedAnglerBanner"; - break; - case 105: - item = "SeaMinnowBanner"; - break; - case 106: - item = "SeaSerpentBanner"; - break; - case 107: - item = "GiantClamBanner"; - break; - case 108: - item = "PiggyBanner"; - break; - default: - return; - } - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType(item)); - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + int style = frameX / 18; + string item; + switch (style) + { + case 0: + item = "AquaticParasiteBanner"; + break; + case 1: + item = "FlounderBanner"; + break; + case 2: + item = "GnasherBanner"; + break; + case 3: + item = "TrasherBanner"; + break; + case 4: + item = "CatfishBanner"; + break; + case 5: + item = "MaulerBanner"; + break; + case 6: + item = "AquaticSeekerBanner"; + break; + case 7: + item = "AquaticUrchinBanner"; + break; + case 8: + item = "FrogfishBanner"; + break; + case 9: + item = "MantisShrimpBanner"; + break; + case 10: + item = "AquaticAberrationBanner"; + break; + case 11: + item = "ParaseaBanner"; + break; + case 12: + item = "SeaUrchinBanner"; + break; + case 13: + item = "BoxJellyfishBanner"; + break; + case 14: + item = "MorayEelBanner"; + break; + case 15: + item = "DevilFishBanner"; + break; + case 16: + item = "CuttlefishBanner"; + break; + case 17: + item = "ToxicMinnowBanner"; + break; + case 18: + item = "ViperfishBanner"; + break; + case 19: + item = "LuminousCorvinaBanner"; + break; + case 20: + item = "GiantSquidBanner"; + break; + case 21: + item = "LaserfishBanner"; + break; + case 22: + item = "OarfishBanner"; + break; + case 23: + item = "ColossalSquidBanner"; + break; + case 24: + item = "MirageJellyBanner"; + break; + case 25: + item = "EidolistBanner"; + break; + case 26: + item = "GulperEelBanner"; + break; + case 27: + item = "EidolonWyrmJuvenileBanner"; + break; + case 28: + item = "BloatfishBanner"; + break; + case 29: + item = "BobbitWormBanner"; + break; + case 30: + item = "ChaoticPufferBanner"; + break; + case 31: + item = "AstralProbeBanner"; + break; + case 32: + item = "SmallSightseerBanner"; + break; + case 33: + item = "BigSightseerBanner"; + break; + case 34: + item = "AriesBanner"; + break; + case 35: + item = "AstralSlimeBanner"; + break; + case 36: + item = "AtlasBanner"; + break; + case 37: + item = "MantisBanner"; + break; + case 38: + item = "NovaBanner"; + break; + case 39: + item = "AstralachneaBanner"; + break; + case 40: + item = "HiveBanner"; + break; + case 41: + item = "StellarCullexBanner"; + break; + case 42: + item = "FusionFeederBanner"; + break; + case 43: + item = "HadarianBanner"; + break; + case 44: + item = "HeatSpiritBanner"; + break; + case 45: + item = "ScryllarBanner"; + break; + case 46: + item = "DespairStoneBanner"; + break; + case 47: + item = "SoulSlurperBanner"; + break; + case 48: + item = "ImpiousImmolatorBanner"; + break; + case 49: + item = "ScornEaterBanner"; + break; + case 50: + item = "ProfanedEnergyBanner"; + break; + case 51: + item = "WulfrumSlimeBanner"; + break; + case 52: + item = "WulfrumDroneBanner"; + break; + case 53: + item = "PitbullBanner"; + break; + case 54: + item = "BlightedEyeBanner"; + break; + case 55: + item = "CalamityEyeBanner"; + break; + case 56: + item = "SunskaterBanner"; + break; + case 57: + item = "ShockstormShuttleBanner"; + break; + case 58: + item = "CloudElementalBanner"; + break; + case 59: + item = "AngryDogBanner"; + break; + case 60: + item = "CryonBanner"; + break; + case 61: + item = "IceClasperBanner"; + break; + case 62: + item = "StormlionBanner"; + break; + case 63: + item = "CnidrionBanner"; + break; + case 64: + item = "SandTortoiseBanner"; + break; + case 65: + item = "GreatSandSharkBanner"; + break; + case 66: + item = "AmethystCrawlerBanner"; + break; + case 67: + item = "TopazCrawlerBanner"; + break; + case 68: + item = "SapphireCrawlerBanner"; + break; + case 69: + item = "EmeraldCrawlerBanner"; + break; + case 70: + item = "RubyCrawlerBanner"; + break; + case 71: + item = "DiamondCrawlerBanner"; + break; + case 72: + item = "AmberCrawlerBanner"; + break; + case 73: + item = "CrystalCrawlerBanner"; + break; + case 74: + item = "SunBatBanner"; + break; + case 75: + item = "CosmicElementalBanner"; + break; + case 76: + item = "EarthElementalBanner"; + break; + case 77: + item = "ArmoredDiggerBanner"; + break; + case 78: + item = "MelterBanner"; + break; + case 79: + item = "PestilentSlimeBanner"; + break; + case 80: + item = "PlagueshellBanner"; + break; + case 81: + item = "PlagueChargerBanner"; + break; + case 82: + item = "VirulingBanner"; + break; + case 83: + item = "PlaguebringerBanner"; + break; + case 84: + item = "PhantomSpiritBanner"; + break; + case 85: + item = "OverloadedSoldierBanner"; + break; + case 86: + item = "PhantomDebrisBanner"; + break; + case 87: + item = "BOHLDOHRBanner"; + break; + case 88: + item = "EbonianBlightSlimeBanner"; + break; + case 89: + item = "CrimulanBlightSlimeBanner"; + break; + case 90: + item = "AeroSlimeBanner"; + break; + case 91: + item = "CryoSlimeBanner"; + break; + case 92: + item = "PerennialSlimeBanner"; + break; + case 93: + item = "CharredSlimeBanner"; + break; + case 94: + item = "BloomSlimeBanner"; + break; + case 95: + item = "CultistAssassinBanner"; + break; + case 96: + item = "ReaperSharkBanner"; + break; + case 97: + item = "IrradiatedSlimeBanner"; + break; + case 98: + item = "PrismTurtleBanner"; + break; + case 99: + item = "ClamBanner"; + break; + case 100: + item = "EutrophicRayBanner"; + break; + case 101: + item = "GhostBellBanner"; + break; + case 102: + item = "GhostBellSmallBanner"; + break; + case 103: + item = "SeaFloatyBanner"; + break; + case 104: + item = "BlindedAnglerBanner"; + break; + case 105: + item = "SeaMinnowBanner"; + break; + case 106: + item = "SeaSerpentBanner"; + break; + case 107: + item = "GiantClamBanner"; + break; + case 108: + item = "PiggyBanner"; + break; + default: + return; + } + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType(item)); + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Player player = Main.LocalPlayer; - int style = Main.tile[i, j].frameX / 18; - string type; - switch (style) - { - case 0: - type = "AquaticParasite"; - break; - case 1: - type = "Flounder"; - break; - case 2: - type = "Gnasher"; - break; - case 3: - type = "Trasher"; - break; - case 4: - type = "Catfish"; - break; - case 5: - type = "Mauler"; - break; - case 6: - type = "AquaticSeekerHead"; - break; - case 7: - type = "AquaticUrchin"; - break; - case 8: - type = "Frogfish"; - break; - case 9: - type = "MantisShrimp"; - break; - case 10: - type = "AquaticAberration"; - break; - case 11: - type = "Parasea"; - break; - case 12: - type = "SeaUrchin"; - break; - case 13: - type = "BoxJellyfish"; - break; - case 14: - type = "MorayEel"; - break; - case 15: - type = "DevilFish"; - break; - case 16: - type = "Cuttlefish"; - break; - case 17: - type = "ToxicMinnow"; - break; - case 18: - type = "Viperfish"; - break; - case 19: - type = "LuminousCorvina"; - break; - case 20: - type = "GiantSquid"; - break; - case 21: - type = "Laserfish"; - break; - case 22: - type = "OarfishHead"; - break; - case 23: - type = "ColossalSquid"; - break; - case 24: - type = "MirageJelly"; - break; - case 25: - type = "Eidolist"; - break; - case 26: - type = "GulperEelHead"; - break; - case 27: - type = "EidolonWyrmHead"; - break; - case 28: - type = "Bloatfish"; - break; - case 29: - type = "BobbitWormHead"; - break; - case 30: - type = "ChaoticPuffer"; - break; - case 31: - type = "AstralProbe"; - break; - case 32: - type = "SmallSightseer"; - break; - case 33: - type = "BigSightseer"; - break; - case 34: - type = "Aries"; - break; - case 35: - type = "AstralSlime"; - break; - case 36: - type = "Atlas"; - break; - case 37: - type = "Mantis"; - break; - case 38: - type = "Nova"; - break; - case 39: - type = "AstralachneaGround"; - break; - case 40: - type = "Hive"; - break; - case 41: - type = "StellarCulex"; - break; - case 42: - type = "FusionFeeder"; - break; - case 43: - type = "Hadarian"; - break; - case 44: - type = "HeatSpirit"; - break; - case 45: - type = "Scryllar"; - break; - case 46: - type = "DespairStone"; - break; - case 47: - type = "SoulSlurper"; - break; - case 48: - type = "ImpiousImmolator"; - break; - case 49: - type = "ScornEater"; - break; - case 50: - type = "ProfanedEnergyBody"; - break; - case 51: - type = "WulfrumSlime"; - break; - case 52: - type = "WulfrumDrone"; - break; - case 53: - type = "Pitbull"; - break; - case 54: - type = "BlightedEye"; - break; - case 55: - type = "CalamityEye"; - break; - case 56: - type = "Sunskater"; - break; - case 57: - type = "ShockstormShuttle"; - break; - case 58: - type = "ThiccWaifu"; - break; - case 59: - type = "AngryDog"; - break; - case 60: - type = "Cryon"; - break; - case 61: - type = "IceClasper"; - break; - case 62: - type = "StormlionCharger"; - break; - case 63: - type = "Cnidrion"; - break; - case 64: - type = "SandTortoise"; - break; - case 65: - type = "GreatSandShark"; - break; - case 66: - type = "CrawlerAmethyst"; - break; - case 67: - type = "CrawlerTopaz"; - break; - case 68: - type = "CrawlerSapphire"; - break; - case 69: - type = "CrawlerEmerald"; - break; - case 70: - type = "CrawlerRuby"; - break; - case 71: - type = "CrawlerDiamond"; - break; - case 72: - type = "CrawlerAmber"; - break; - case 73: - type = "CrawlerCrystal"; - break; - case 74: - type = "SunBat"; - break; - case 75: - type = "CosmicElemental"; - break; - case 76: - type = "Horse"; - break; - case 77: - type = "ArmoredDiggerHead"; - break; - case 78: - type = "PlaguedFlyingFox"; - break; - case 79: - type = "PlaguedJungleSlime"; - break; - case 80: - type = "PlaguedTortoise"; - break; - case 81: - type = "PlagueBee"; - break; - case 82: - type = "PlaguedDerpling"; - break; - case 83: - type = "PlaguebringerShade"; - break; - case 84: - type = "PhantomSpirit"; - break; - case 85: - type = "OverloadedSoldier"; - break; - case 86: - type = "PhantomDebris"; - break; - case 87: - type = "Bohldohr"; - break; - case 88: - type = "EbonianBlightSlime"; - break; - case 89: - type = "CrimulanBlightSlime"; - break; - case 90: - type = "AeroSlime"; - break; - case 91: - type = "CryoSlime"; - break; - case 92: - type = "PerennialSlime"; - break; - case 93: - type = "CharredSlime"; - break; - case 94: - type = "BloomSlime"; - break; - case 95: - type = "CultistAssassin"; - break; - case 96: - type = "Reaper"; - break; - case 97: - type = "IrradiatedSlime"; - break; - case 98: - type = "PrismTurtle"; - break; - case 99: - type = "Clam"; - break; - case 100: - type = "EutrophicRay"; - break; - case 101: - type = "GhostBell"; - break; - case 102: - type = "GhostBellSmall"; - break; - case 103: - type = "SeaFloaty"; - break; - case 104: - type = "BlindedAngler"; - break; - case 105: - type = "SeaMinnow"; - break; - case 106: - type = "SeaSerpent1"; - break; - case 107: - type = "GiantClam"; - break; - case 108: - type = "Piggy"; - break; - default: - return; - } - player.NPCBannerBuff[mod.NPCType(type)] = true; - player.hasBanner = true; - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Player player = Main.LocalPlayer; + int style = Main.tile[i, j].frameX / 18; + string type; + switch (style) + { + case 0: + type = "AquaticParasite"; + break; + case 1: + type = "Flounder"; + break; + case 2: + type = "Gnasher"; + break; + case 3: + type = "Trasher"; + break; + case 4: + type = "Catfish"; + break; + case 5: + type = "Mauler"; + break; + case 6: + type = "AquaticSeekerHead"; + break; + case 7: + type = "AquaticUrchin"; + break; + case 8: + type = "Frogfish"; + break; + case 9: + type = "MantisShrimp"; + break; + case 10: + type = "AquaticAberration"; + break; + case 11: + type = "Parasea"; + break; + case 12: + type = "SeaUrchin"; + break; + case 13: + type = "BoxJellyfish"; + break; + case 14: + type = "MorayEel"; + break; + case 15: + type = "DevilFish"; + break; + case 16: + type = "Cuttlefish"; + break; + case 17: + type = "ToxicMinnow"; + break; + case 18: + type = "Viperfish"; + break; + case 19: + type = "LuminousCorvina"; + break; + case 20: + type = "GiantSquid"; + break; + case 21: + type = "Laserfish"; + break; + case 22: + type = "OarfishHead"; + break; + case 23: + type = "ColossalSquid"; + break; + case 24: + type = "MirageJelly"; + break; + case 25: + type = "Eidolist"; + break; + case 26: + type = "GulperEelHead"; + break; + case 27: + type = "EidolonWyrmHead"; + break; + case 28: + type = "Bloatfish"; + break; + case 29: + type = "BobbitWormHead"; + break; + case 30: + type = "ChaoticPuffer"; + break; + case 31: + type = "AstralProbe"; + break; + case 32: + type = "SmallSightseer"; + break; + case 33: + type = "BigSightseer"; + break; + case 34: + type = "Aries"; + break; + case 35: + type = "AstralSlime"; + break; + case 36: + type = "Atlas"; + break; + case 37: + type = "Mantis"; + break; + case 38: + type = "Nova"; + break; + case 39: + type = "AstralachneaGround"; + break; + case 40: + type = "Hive"; + break; + case 41: + type = "StellarCulex"; + break; + case 42: + type = "FusionFeeder"; + break; + case 43: + type = "Hadarian"; + break; + case 44: + type = "HeatSpirit"; + break; + case 45: + type = "Scryllar"; + break; + case 46: + type = "DespairStone"; + break; + case 47: + type = "SoulSlurper"; + break; + case 48: + type = "ImpiousImmolator"; + break; + case 49: + type = "ScornEater"; + break; + case 50: + type = "ProfanedEnergyBody"; + break; + case 51: + type = "WulfrumSlime"; + break; + case 52: + type = "WulfrumDrone"; + break; + case 53: + type = "Pitbull"; + break; + case 54: + type = "BlightedEye"; + break; + case 55: + type = "CalamityEye"; + break; + case 56: + type = "Sunskater"; + break; + case 57: + type = "ShockstormShuttle"; + break; + case 58: + type = "ThiccWaifu"; + break; + case 59: + type = "AngryDog"; + break; + case 60: + type = "Cryon"; + break; + case 61: + type = "IceClasper"; + break; + case 62: + type = "StormlionCharger"; + break; + case 63: + type = "Cnidrion"; + break; + case 64: + type = "SandTortoise"; + break; + case 65: + type = "GreatSandShark"; + break; + case 66: + type = "CrawlerAmethyst"; + break; + case 67: + type = "CrawlerTopaz"; + break; + case 68: + type = "CrawlerSapphire"; + break; + case 69: + type = "CrawlerEmerald"; + break; + case 70: + type = "CrawlerRuby"; + break; + case 71: + type = "CrawlerDiamond"; + break; + case 72: + type = "CrawlerAmber"; + break; + case 73: + type = "CrawlerCrystal"; + break; + case 74: + type = "SunBat"; + break; + case 75: + type = "CosmicElemental"; + break; + case 76: + type = "Horse"; + break; + case 77: + type = "ArmoredDiggerHead"; + break; + case 78: + type = "PlaguedFlyingFox"; + break; + case 79: + type = "PlaguedJungleSlime"; + break; + case 80: + type = "PlaguedTortoise"; + break; + case 81: + type = "PlagueBee"; + break; + case 82: + type = "PlaguedDerpling"; + break; + case 83: + type = "PlaguebringerShade"; + break; + case 84: + type = "PhantomSpirit"; + break; + case 85: + type = "OverloadedSoldier"; + break; + case 86: + type = "PhantomDebris"; + break; + case 87: + type = "Bohldohr"; + break; + case 88: + type = "EbonianBlightSlime"; + break; + case 89: + type = "CrimulanBlightSlime"; + break; + case 90: + type = "AeroSlime"; + break; + case 91: + type = "CryoSlime"; + break; + case 92: + type = "PerennialSlime"; + break; + case 93: + type = "CharredSlime"; + break; + case 94: + type = "BloomSlime"; + break; + case 95: + type = "CultistAssassin"; + break; + case 96: + type = "Reaper"; + break; + case 97: + type = "IrradiatedSlime"; + break; + case 98: + type = "PrismTurtle"; + break; + case 99: + type = "Clam"; + break; + case 100: + type = "EutrophicRay"; + break; + case 101: + type = "GhostBell"; + break; + case 102: + type = "GhostBellSmall"; + break; + case 103: + type = "SeaFloaty"; + break; + case 104: + type = "BlindedAngler"; + break; + case 105: + type = "SeaMinnow"; + break; + case 106: + type = "SeaSerpent1"; + break; + case 107: + type = "GiantClam"; + break; + case 108: + type = "Piggy"; + break; + default: + return; + } + player.NPCBannerBuff[mod.NPCType(type)] = true; + player.hasBanner = true; + } + } - public override void SetSpriteEffects(int i, int j, ref SpriteEffects spriteEffects) - { - if (i % 2 == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - } - } + public override void SetSpriteEffects(int i, int j, ref SpriteEffects spriteEffects) + { + if (i % 2 == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + } + } } diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs index c2d0e6e6db..5512492589 100644 --- a/Tiles/PerennialBrick.cs +++ b/Tiles/PerennialBrick.cs @@ -1,41 +1,41 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class PerennialBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDecorativeTiles(Type); drop = mod.ItemType("PerennialBrick"); - soundType = 21; - minPick = 150; - AddMapEntry(new Color(17, 133, 46)); - animationFrameHeight = 90; - } + soundType = 21; + minPick = 150; + AddMapEntry(new Color(17, 133, 46)); + animationFrameHeight = 90; + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - int xPos = i % 4; - int yPos = j % 4; - frameXOffset = xPos * 234; - frameYOffset = yPos * animationFrameHeight; - } - } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 4; + int yPos = j % 4; + frameXOffset = xPos * 234; + frameYOffset = yPos * animationFrameHeight; + } + } } diff --git a/Tiles/PerennialOre.cs b/Tiles/PerennialOre.cs index 36e27ce0a4..a5bfccb992 100644 --- a/Tiles/PerennialOre.cs +++ b/Tiles/PerennialOre.cs @@ -1,42 +1,42 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class PerennialOre : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileValue[Type] = 690; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 690; TileMerge.MergeGeneralTiles(Type); dustType = mod.DustType("CESparkle"); - drop = mod.ItemType("PerennialOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Perennial Ore"); - AddMapEntry(new Color(200, 250, 100), name); - mineResist = 3f; - minPick = 200; - soundType = 21; - Main.tileSpelunker[Type] = true; - } + drop = mod.ItemType("PerennialOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Perennial Ore"); + AddMapEntry(new Color(200, 250, 100), name); + mineResist = 3f; + minPick = 200; + soundType = 21; + Main.tileSpelunker[Type] = true; + } - public override bool CanExplode(int i, int j) - { - return NPC.downedPlantBoss; - } + public override bool CanExplode(int i, int j) + { + return NPC.downedPlantBoss; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { diff --git a/Tiles/PinkCandle.cs b/Tiles/PinkCandle.cs index 80739847cd..353d9d0c5e 100644 --- a/Tiles/PinkCandle.cs +++ b/Tiles/PinkCandle.cs @@ -1,54 +1,54 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles { public class PinkCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Vigorous Candle"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 34; - } + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Vigorous Candle"); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 34; + } - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("PinkHealthCandle"), 20); - } + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("PinkHealthCandle"), 20); + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.75f; - g = 0.35f; - b = 0.65f; - } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.75f; + g = 0.35f; + b = 0.65f; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PinkCandle")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PinkCandle")); + } + } } diff --git a/Tiles/PlantyMush.cs b/Tiles/PlantyMush.cs index e758b230d4..bfb0f3a3a1 100644 --- a/Tiles/PlantyMush.cs +++ b/Tiles/PlantyMush.cs @@ -1,89 +1,89 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { - public class PlantyMush : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + public class PlantyMush : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeAbyssTiles(Type); dustType = 2; - drop = mod.ItemType("PlantyMush"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Planty Mush"); - AddMapEntry(new Color(0, 120, 0), name); - mineResist = 1f; - soundType = 0; - } + drop = mod.ItemType("PlantyMush"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Planty Mush"); + AddMapEntry(new Color(0, 120, 0), name); + mineResist = 1f; + soundType = 0; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - if (Main.tile[i, j].liquid <= 0) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (!closer && j < Main.maxTilesY - 205) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + } - public override void RandomUpdate(int i, int j) - { - int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); - if (Main.tile[i, j + 1] != null) - { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)mod.TileType("ViperVines")) - { - if (Main.tile[i, j + 1].liquid == 255 && - (Main.tile[i, j + 1].wall == (ushort)mod.WallType("MossyGravelWall") || - Main.tile[i, j + 1].wall == (ushort)mod.WallType("AbyssGravelWall")) && - !Main.tile[i, j + 1].lava()) - { - bool flag13 = false; - for (int num52 = num8; num52 > num8 - 10; num52--) - { - if (Main.tile[i, num52].bottomSlope()) - { - flag13 = false; - break; - } - if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) - { - flag13 = true; - break; - } - } - if (flag13) - { - int num53 = i; - int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); - Main.tile[num53, num54].active(true); - WorldGen.SquareTileFrame(num53, num54, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); - } - } - } - } - } + public override void RandomUpdate(int i, int j) + { + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); + if (Main.tile[i, j + 1] != null) + { + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)mod.TileType("ViperVines")) + { + if (Main.tile[i, j + 1].liquid == 255 && + (Main.tile[i, j + 1].wall == (ushort)mod.WallType("MossyGravelWall") || + Main.tile[i, j + 1].wall == (ushort)mod.WallType("AbyssGravelWall")) && + !Main.tile[i, j + 1].lava()) + { + bool flag13 = false; + for (int num52 = num8; num52 > num8 - 10; num52--) + { + if (Main.tile[i, num52].bottomSlope()) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); + Main.tile[num53, num54].active(true); + WorldGen.SquareTileFrame(num53, num54, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + } + } + } + } + } } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/PurpleCandle.cs b/Tiles/PurpleCandle.cs index cc2b6d587b..06bdccca79 100644 --- a/Tiles/PurpleCandle.cs +++ b/Tiles/PurpleCandle.cs @@ -7,48 +7,48 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles { public class PurpleCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Resilient Candle"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 34; - } + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Resilient Candle"); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 34; + } - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("PurpleDefenseCandle"), 20); - } + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("PurpleDefenseCandle"), 20); + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.65f; - g = 0.35f; - b = 0.85f; - } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.65f; + g = 0.35f; + b = 0.85f; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PurpleCandle")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PurpleCandle")); + } + } } diff --git a/Tiles/RoxTile.cs b/Tiles/RoxTile.cs index 7120b3f294..6485d20922 100644 --- a/Tiles/RoxTile.cs +++ b/Tiles/RoxTile.cs @@ -1,35 +1,29 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Microsoft.Xna.Framework; namespace CalamityMod.Tiles { - public class RoxTile : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileSpelunker[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Roxcalibur"); - AddMapEntry(new Color(240, 77, 7), name); - disableSmartCursor = true; - } + public class RoxTile : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSpelunker[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Roxcalibur"); + AddMapEntry(new Color(240, 77, 7), name); + disableSmartCursor = true; + } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("Roxcalibur")); - } - } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("Roxcalibur")); + } + } } diff --git a/Tiles/SulphurousSand.cs b/Tiles/SulphurousSand.cs index d4dd07bdeb..fb5a7c857a 100644 --- a/Tiles/SulphurousSand.cs +++ b/Tiles/SulphurousSand.cs @@ -1,189 +1,189 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { - public class SulphurousSand : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + public class SulphurousSand : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeAbyssTiles(Type); dustType = 32; - drop = mod.ItemType("SulphurousSand"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sulphurous Sand"); - AddMapEntry(new Color(150, 100, 50), name); - mineResist = 1f; - minPick = 55; - soundType = 0; - } + drop = mod.ItemType("SulphurousSand"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sulphurous Sand"); + AddMapEntry(new Color(150, 100, 50), name); + mineResist = 1f; + minPick = 55; + soundType = 0; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (i < 250 && i > 150) - { - if (!closer) - { - if (Main.tile[i - 1, j] != null) - { - if (!Main.tile[i - 1, j].active()) - { - if (Main.tile[i - 1, j].liquid <= 128) - { - Main.tile[i - 1, j].liquid = 255; - Main.tile[i - 1, j].lava(false); - } - } - } - if (Main.tile[i - 2, j] != null) - { - if (!Main.tile[i - 2, j].active()) - { - if (Main.tile[i - 2, j].liquid <= 128) - { - Main.tile[i - 2, j].liquid = 255; - Main.tile[i - 2, j].lava(false); - } - } - } - if (Main.tile[i - 3, j] != null) - { - if (!Main.tile[i - 3, j].active()) - { - if (Main.tile[i - 3, j].liquid <= 128) - { - Main.tile[i - 3, j].liquid = 255; - Main.tile[i - 3, j].lava(false); - } - } - } - } - } - else if (i > Main.maxTilesX - 250 && i < Main.maxTilesX - 150) - { - if (!closer) - { - if (Main.tile[i + 1, j] != null) - { - if (!Main.tile[i + 1, j].active()) - { - if (Main.tile[i + 1, j].liquid <= 128) - { - Main.tile[i + 1, j].liquid = 255; - Main.tile[i + 1, j].lava(false); - } - } - } - if (Main.tile[i + 2, j] != null) - { - if (!Main.tile[i + 2, j].active()) - { - if (Main.tile[i + 2, j].liquid <= 128) - { - Main.tile[i + 2, j].liquid = 255; - Main.tile[i + 2, j].lava(false); - } - } - } - if (Main.tile[i + 3, j] != null) - { - if (!Main.tile[i + 3, j].active()) - { - if (Main.tile[i + 3, j].liquid <= 128) - { - Main.tile[i + 3, j].liquid = 255; - Main.tile[i + 3, j].lava(false); - } - } - } - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (i < 250 && i > 150) + { + if (!closer) + { + if (Main.tile[i - 1, j] != null) + { + if (!Main.tile[i - 1, j].active()) + { + if (Main.tile[i - 1, j].liquid <= 128) + { + Main.tile[i - 1, j].liquid = 255; + Main.tile[i - 1, j].lava(false); + } + } + } + if (Main.tile[i - 2, j] != null) + { + if (!Main.tile[i - 2, j].active()) + { + if (Main.tile[i - 2, j].liquid <= 128) + { + Main.tile[i - 2, j].liquid = 255; + Main.tile[i - 2, j].lava(false); + } + } + } + if (Main.tile[i - 3, j] != null) + { + if (!Main.tile[i - 3, j].active()) + { + if (Main.tile[i - 3, j].liquid <= 128) + { + Main.tile[i - 3, j].liquid = 255; + Main.tile[i - 3, j].lava(false); + } + } + } + } + } + else if (i > Main.maxTilesX - 250 && i < Main.maxTilesX - 150) + { + if (!closer) + { + if (Main.tile[i + 1, j] != null) + { + if (!Main.tile[i + 1, j].active()) + { + if (Main.tile[i + 1, j].liquid <= 128) + { + Main.tile[i + 1, j].liquid = 255; + Main.tile[i + 1, j].lava(false); + } + } + } + if (Main.tile[i + 2, j] != null) + { + if (!Main.tile[i + 2, j].active()) + { + if (Main.tile[i + 2, j].liquid <= 128) + { + Main.tile[i + 2, j].liquid = 255; + Main.tile[i + 2, j].lava(false); + } + } + } + if (Main.tile[i + 3, j] != null) + { + if (!Main.tile[i + 3, j].active()) + { + if (Main.tile[i + 3, j].liquid <= 128) + { + Main.tile[i + 3, j].liquid = 255; + Main.tile[i + 3, j].lava(false); + } + } + } + } + } + } - public override void RandomUpdate(int i, int j) - { - int tileLocationY = j - 1; - if (Main.tile[i, tileLocationY] != null) - { - if (!Main.tile[i, tileLocationY].active()) - { - if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && - Main.tile[i, tileLocationY - 2].liquid == 255 && Main.netMode != 1) - { - Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("SulphuricAcidCannon"), 0, 2f, Main.myPlayer, 0f, 0f); - } - if (i < 250 || i > Main.maxTilesX - 250) - { - if (Main.rand.Next(400) == 0) - { - if (Main.tile[i, tileLocationY].liquid == 255) - { - int num13 = 7; - int num14 = 6; - int num15 = 0; - for (int l = i - num13; l <= i + num13; l++) - { - for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) - { - if (Main.tile[l, m].active() && Main.tile[l, m].type == 81) - { - num15++; - } - } - } - if (num15 < num14 && Main.tile[i, tileLocationY - 1].liquid == 255 && - Main.tile[i, tileLocationY - 2].liquid == 255 && Main.tile[i, tileLocationY - 3].liquid == 255 && - Main.tile[i, tileLocationY - 4].liquid == 255) - { - WorldGen.PlaceTile(i, tileLocationY, 81, true, false, -1, 0); - if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) - { - NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); - } - } - } - else if (Main.tile[i, tileLocationY].liquid == 0) - { - int num13 = 7; - int num14 = 6; - int num15 = 0; - for (int l = i - num13; l <= i + num13; l++) - { - for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) - { - if (Main.tile[l, m].active() && Main.tile[l, m].type == 324) - { - num15++; - } - } - } - if (num15 < num14) - { - WorldGen.PlaceTile(i, tileLocationY, 324, true, false, -1, Main.rand.Next(2)); - if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) - { - NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); - } - } - } - } - } - } - } + public override void RandomUpdate(int i, int j) + { + int tileLocationY = j - 1; + if (Main.tile[i, tileLocationY] != null) + { + if (!Main.tile[i, tileLocationY].active()) + { + if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && + Main.tile[i, tileLocationY - 2].liquid == 255 && Main.netMode != 1) + { + Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("SulphuricAcidCannon"), 0, 2f, Main.myPlayer, 0f, 0f); + } + if (i < 250 || i > Main.maxTilesX - 250) + { + if (Main.rand.Next(400) == 0) + { + if (Main.tile[i, tileLocationY].liquid == 255) + { + int num13 = 7; + int num14 = 6; + int num15 = 0; + for (int l = i - num13; l <= i + num13; l++) + { + for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) + { + if (Main.tile[l, m].active() && Main.tile[l, m].type == 81) + { + num15++; + } + } + } + if (num15 < num14 && Main.tile[i, tileLocationY - 1].liquid == 255 && + Main.tile[i, tileLocationY - 2].liquid == 255 && Main.tile[i, tileLocationY - 3].liquid == 255 && + Main.tile[i, tileLocationY - 4].liquid == 255) + { + WorldGen.PlaceTile(i, tileLocationY, 81, true, false, -1, 0); + if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) + { + NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); + } + } + } + else if (Main.tile[i, tileLocationY].liquid == 0) + { + int num13 = 7; + int num14 = 6; + int num15 = 0; + for (int l = i - num13; l <= i + num13; l++) + { + for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) + { + if (Main.tile[l, m].active() && Main.tile[l, m].type == 324) + { + num15++; + } + } + } + if (num15 < num14) + { + WorldGen.PlaceTile(i, tileLocationY, 324, true, false, -1, Main.rand.Next(2)); + if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) + { + NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); + } + } + } + } + } + } + } } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/BrainCoral.cs b/Tiles/SunkenSea/BrainCoral.cs index a30760ff0c..79adefd590 100644 --- a/Tiles/SunkenSea/BrainCoral.cs +++ b/Tiles/SunkenSea/BrainCoral.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -11,43 +11,43 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Brain Coral"); - AddMapEntry(new Color(0, 0, 80)); - mineResist = 3f; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + dustType = 253; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Brain Coral"); + AddMapEntry(new Color(0, 0, 80)); + mineResist = 3f; - base.SetDefaults(); + base.SetDefaults(); } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - if (Main.rand.NextBool(300)) - { - int tileLocationY = j - 1; - if (Main.tile[i, tileLocationY] != null) - { - if (!Main.tile[i, tileLocationY].active()) - { - if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubble"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + if (Main.rand.NextBool(300)) + { + int tileLocationY = j - 1; + if (Main.tile[i, tileLocationY] != null) + { + if (!Main.tile[i, tileLocationY].active()) + { + if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubble"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + } + } } diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index ff6be5514e..a43d855ae5 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -1,44 +1,44 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.SunkenSea { public class EutrophicSand : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDesertTiles(Type); TileID.Sets.ChecksForMerge[Type] = true; dustType = 108; - drop = mod.ItemType("EutrophicSand"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Sand"); - AddMapEntry(new Color(100, 100, 150), name); - mineResist = 2f; - } + drop = mod.ItemType("EutrophicSand"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Sand"); + AddMapEntry(new Color(100, 100, 150), name); + mineResist = 2f; + } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + return CalamityWorld.downedDesertScourge; + } - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/FanCoral.cs b/Tiles/SunkenSea/FanCoral.cs index e642d573ec..90575c6941 100644 --- a/Tiles/SunkenSea/FanCoral.cs +++ b/Tiles/SunkenSea/FanCoral.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -10,29 +10,29 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLighted[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Fan Coral"); - AddMapEntry(new Color(0, 0, 80)); - mineResist = 3f; + Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + dustType = 253; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Fan Coral"); + AddMapEntry(new Color(0, 0, 80)); + mineResist = 3f; - base.SetDefaults(); + base.SetDefaults(); } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.3f; - g = 0.75f; - b = 0.75f; - } - } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.3f; + g = 0.75f; + b = 0.75f; + } + } } diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 35aafeb18d..819d6a48c8 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -1,103 +1,103 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.SunkenSea { - public class Navystone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + public class Navystone : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDesertTiles(Type); TileID.Sets.ChecksForMerge[Type] = true; dustType = 96; - drop = mod.ItemType("Navystone"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Navystone"); - AddMapEntry(new Color(0, 50, 50), name); - mineResist = 2f; - minPick = 55; - soundType = 21; - } + drop = mod.ItemType("Navystone"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Navystone"); + AddMapEntry(new Color(0, 50, 50), name); + mineResist = 2f; + minPick = 55; + soundType = 21; + } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + return CalamityWorld.downedDesertScourge; + } - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void RandomUpdate(int i, int j) - { - if (Main.rand.Next(100) == 0) - { - int random = WorldGen.genRand.Next(4); - if (random == 0) - { - i++; - } - if (random == 1) - { - i--; - } - if (random == 2) - { - j++; - } - if (random == 3) - { - j--; - } - if (Main.tile[i, j] != null) - { - if (!Main.tile[i, j].active()) - { - if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) - { - Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); - Main.tile[i, j].active(true); - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - } - } - } - } + public override void RandomUpdate(int i, int j) + { + if (Main.rand.Next(100) == 0) + { + int random = WorldGen.genRand.Next(4); + if (random == 0) + { + i++; + } + if (random == 1) + { + i--; + } + if (random == 2) + { + j++; + } + if (random == 3) + { + j--; + } + if (Main.tile[i, j] != null) + { + if (!Main.tile[i, j].active()) + { + if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) + { + Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); + Main.tile[i, j].active(true); + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + WorldGen.SquareTileFrame(i, j, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + } + } + } + } } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/SeaAnemone.cs b/Tiles/SunkenSea/SeaAnemone.cs index 0135120cd9..ad390269f4 100644 --- a/Tiles/SunkenSea/SeaAnemone.cs +++ b/Tiles/SunkenSea/SeaAnemone.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -9,37 +9,37 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - animationFrameHeight = 36; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sea Anemone"); - AddMapEntry(new Color(0, 0, 80)); - mineResist = 2f; + animationFrameHeight = 36; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + dustType = 253; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Anemone"); + AddMapEntry(new Color(0, 0, 80)); + mineResist = 2f; - base.SetDefaults(); + base.SetDefaults(); } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter > 12) - { - frameCounter = 0; - frame++; - if (frame > 5) - { - frame = 0; - } - } - } - } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter > 12) + { + frameCounter = 0; + frame++; + if (frame > 5) + { + frame = 0; + } + } + } + } } diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 1e7f402493..3c02876eb9 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -1,104 +1,104 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles.SunkenSea { - public class SeaPrism : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + public class SeaPrism : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeDesertTiles(Type); TileID.Sets.ChecksForMerge[Type] = true; dustType = 33; - drop = mod.ItemType("SeaPrism"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sea Prism"); - AddMapEntry(new Color(0, 150, 200), name); - mineResist = 3f; - minPick = 55; - soundType = 21; - Main.tileSpelunker[Type] = true; - } + drop = mod.ItemType("SeaPrism"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Prism"); + AddMapEntry(new Color(0, 150, 200), name); + mineResist = 3f; + minPick = 55; + soundType = 21; + Main.tileSpelunker[Type] = true; + } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + return CalamityWorld.downedDesertScourge; + } - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void RandomUpdate(int i, int j) - { - if (Main.rand.Next(25) == 0) - { - int random = WorldGen.genRand.Next(4); - if (random == 0) - { - i++; - } - if (random == 1) - { - i--; - } - if (random == 2) - { - j++; - } - if (random == 3) - { - j--; - } - if (Main.tile[i, j] != null) - { - if (!Main.tile[i, j].active()) - { - if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) - { - Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); - Main.tile[i, j].active(true); - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - } - } - } - } + public override void RandomUpdate(int i, int j) + { + if (Main.rand.Next(25) == 0) + { + int random = WorldGen.genRand.Next(4); + if (random == 0) + { + i++; + } + if (random == 1) + { + i--; + } + if (random == 2) + { + j++; + } + if (random == 3) + { + j--; + } + if (Main.tile[i, j] != null) + { + if (!Main.tile[i, j].active()) + { + if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) + { + Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); + Main.tile[i, j].active(true); + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + WorldGen.SquareTileFrame(i, j, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + } + } + } + } } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index 35f9e9066e..0a44330fc7 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -1,23 +1,23 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Tiles.SunkenSea { public class SeaPrismCrystals : ModTile - { - public override void SetDefaults() - { + { + public override void SetDefaults() + { Main.tileLighted[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sea Prism Crystal"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(0, 150, 200), name); + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Prism Crystal"); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(0, 150, 200), name); soundType = 2; soundStyle = 27; dustType = 67; @@ -25,17 +25,17 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSpelunker[Type] = true; } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + return CalamityWorld.downedDesertScourge; + } - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } @@ -47,36 +47,36 @@ namespace CalamityMod.Tiles.SunkenSea b = 0.5f; } - public override bool CanPlace(int i, int j) - { - if ((Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick() && Main.tile[i, j + 1].active()) || - (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick() && Main.tile[i, j - 1].active()) || - (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick() && Main.tile[i + 1, j].active()) || - (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick() && Main.tile[i - 1, j].active())) - return true; + public override bool CanPlace(int i, int j) + { + if ((Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick() && Main.tile[i, j + 1].active()) || + (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick() && Main.tile[i, j - 1].active()) || + (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick() && Main.tile[i + 1, j].active()) || + (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick() && Main.tile[i - 1, j].active())) + return true; - return false; - } + return false; + } - public override void PlaceInWorld(int i, int j, Item item) - { - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - } - } + public override void PlaceInWorld(int i, int j, Item item) + { + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + } + } } diff --git a/Tiles/SunkenSea/SmallBrainCoral.cs b/Tiles/SunkenSea/SmallBrainCoral.cs index 72b4aeb69b..8474ff7441 100644 --- a/Tiles/SunkenSea/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/SmallBrainCoral.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -11,43 +11,43 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Small Brain Coral"); - AddMapEntry(new Color(0, 0, 80)); - mineResist = 3f; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + dustType = 253; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Small Brain Coral"); + AddMapEntry(new Color(0, 0, 80)); + mineResist = 3f; - base.SetDefaults(); + base.SetDefaults(); } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - if (Main.rand.NextBool(300)) - { - int tileLocationY = j - 1; - if (Main.tile[i, tileLocationY] != null) - { - if (!Main.tile[i, tileLocationY].active()) - { - if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubbleSmall"), 0, 1f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + if (Main.rand.NextBool(300)) + { + int tileLocationY = j - 1; + if (Main.tile[i, tileLocationY] != null) + { + if (!Main.tile[i, tileLocationY].active()) + { + if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubbleSmall"), 0, 1f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + } + } } diff --git a/Tiles/SunkenSea/SmallTubeCoral.cs b/Tiles/SunkenSea/SmallTubeCoral.cs index 1c60dc8761..38054a0c3a 100644 --- a/Tiles/SunkenSea/SmallTubeCoral.cs +++ b/Tiles/SunkenSea/SmallTubeCoral.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -10,19 +10,19 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Small Tube Coral"); - AddMapEntry(new Color(0, 0, 80)); - mineResist = 3f; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + dustType = 253; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Small Tube Coral"); + AddMapEntry(new Color(0, 0, 80)); + mineResist = 3f; - base.SetDefaults(); + base.SetDefaults(); } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } diff --git a/Tiles/SunkenSea/SunkenSeaStalactite.cs b/Tiles/SunkenSea/SunkenSeaStalactite.cs index 0bf74a7862..21c3912584 100644 --- a/Tiles/SunkenSea/SunkenSeaStalactite.cs +++ b/Tiles/SunkenSea/SunkenSeaStalactite.cs @@ -1,6 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Tiles.SunkenSea { diff --git a/Tiles/SunkenSea/TableCoral.cs b/Tiles/SunkenSea/TableCoral.cs index d6e7bbb109..c48902dd77 100644 --- a/Tiles/SunkenSea/TableCoral.cs +++ b/Tiles/SunkenSea/TableCoral.cs @@ -1,9 +1,9 @@ -using Terraria; -using Terraria.Enums; -using Terraria.ObjectData; -using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -12,22 +12,22 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileSolidTop[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); - TileObjectData.addAlternate(1); - TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); - TileObjectData.addTile(Type); - dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Table Coral"); - AddMapEntry(new Color(0, 0, 80)); - mineResist = 3f; + Main.tileNoAttach[Type] = true; + Main.tileSolidTop[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addAlternate(1); + TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addTile(Type); + dustType = 253; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Table Coral"); + AddMapEntry(new Color(0, 0, 80)); + mineResist = 3f; - base.SetDefaults(); + base.SetDefaults(); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/TubeCoral.cs b/Tiles/SunkenSea/TubeCoral.cs index 8db4451a31..ff2b12befa 100644 --- a/Tiles/SunkenSea/TubeCoral.cs +++ b/Tiles/SunkenSea/TubeCoral.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -10,26 +10,26 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new[] - { - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Tube Coral"); - AddMapEntry(new Color(0, 0, 80)); - mineResist = 3f; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new[] + { + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + dustType = 253; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Tube Coral"); + AddMapEntry(new Color(0, 0, 80)); + mineResist = 3f; - base.SetDefaults(); + base.SetDefaults(); } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } diff --git a/Tiles/Tenebris.cs b/Tiles/Tenebris.cs index 27f444dfaf..f7c4809bd4 100644 --- a/Tiles/Tenebris.cs +++ b/Tiles/Tenebris.cs @@ -1,32 +1,32 @@ +using CalamityMod.Utilities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { - public class Tenebris : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + public class Tenebris : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; TileMerge.MergeGeneralTiles(Type); TileMerge.MergeAbyssTiles(Type); dustType = 44; - drop = mod.ItemType("Tenebris"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Tenebris"); - AddMapEntry(new Color(0, 100, 100), name); - mineResist = 3f; - minPick = 200; - soundType = 21; - } + drop = mod.ItemType("Tenebris"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Tenebris"); + AddMapEntry(new Color(0, 100, 100), name); + mineResist = 3f; + minPick = 200; + soundType = 21; + } public override bool CanExplode(int i, int j) { @@ -34,23 +34,23 @@ namespace CalamityMod.Tiles } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - if (Main.tile[i, j].liquid <= 0) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (!closer && j < Main.maxTilesY - 205) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + } - public override void RandomUpdate(int i, int j) + public override void RandomUpdate(int i, int j) { if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) { diff --git a/Tiles/TranquilityCandle.cs b/Tiles/TranquilityCandle.cs index cb4a5042c9..3f955123f8 100644 --- a/Tiles/TranquilityCandle.cs +++ b/Tiles/TranquilityCandle.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); TileObjectData.addTile(Type); - drop = mod.ItemType("TranquilityCandle"); + drop = mod.ItemType("TranquilityCandle"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Tranquility Candle"); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles animationFrameHeight = 20; } - public override void AnimateTile(ref int frame, ref int frameCounter) + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; if (frameCounter >= 4) @@ -33,32 +33,32 @@ namespace CalamityMod.Tiles } } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("TranquilityCandle"); - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("TranquilityCandle"), 20); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + public override void MouseOver(int i, int j) { - r = 0.55f; - g = 0.055f; - b = 0.55f; + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("TranquilityCandle"); } - /*public override void RightClick(int i, int j) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("TranquilityCandle")); - ?? KillTile( i, j); - }*/ + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("TranquilityCandle"), 20); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.55f; + g = 0.055f; + b = 0.55f; + } + + /*public override void RightClick(int i, int j) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("TranquilityCandle")); + ?? KillTile( i, j); + }*/ } } diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index 495fd9dead..79a3cf6dad 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Utilities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { diff --git a/Tiles/UelibloomOre.cs b/Tiles/UelibloomOre.cs index af645d017f..5df191ae04 100644 --- a/Tiles/UelibloomOre.cs +++ b/Tiles/UelibloomOre.cs @@ -1,40 +1,40 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class UelibloomOre : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileValue[Type] = 805; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 805; TileMerge.MergeGeneralTiles(Type); dustType = mod.DustType("TCESparkle"); - drop = mod.ItemType("UelibloomOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Uelibloom Ore"); - AddMapEntry(new Color(0, 255, 0), name); - mineResist = 5f; - minPick = 250; - soundType = 21; - Main.tileSpelunker[Type] = true; - } + drop = mod.ItemType("UelibloomOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Uelibloom Ore"); + AddMapEntry(new Color(0, 255, 0), name); + mineResist = 5f; + minPick = 250; + soundType = 21; + Main.tileSpelunker[Type] = true; + } - public override bool CanExplode(int i, int j) - { - return NPC.downedMoonlord; - } + public override bool CanExplode(int i, int j) + { + return NPC.downedMoonlord; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/ViperVines.cs b/Tiles/ViperVines.cs index 97d81a243c..7078640c07 100644 --- a/Tiles/ViperVines.cs +++ b/Tiles/ViperVines.cs @@ -5,20 +5,20 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class ViperVines : ModTile - { - public override void SetDefaults() - { + public class ViperVines : ModTile + { + public override void SetDefaults() + { Main.tileCut[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileNoFail[Type] = true; ModTranslation name = CreateMapEntryName(); - name.SetDefault("Viper Vines"); - AddMapEntry(new Color(0, 50, 0), name); + name.SetDefault("Viper Vines"); + AddMapEntry(new Color(0, 50, 0), name); soundType = 6; dustType = 2; - } + } public override void NumDust(int i, int j, bool fail, ref int num) { @@ -32,21 +32,21 @@ namespace CalamityMod.Tiles { Item.NewItem(new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); } - if (Main.tile[i, j + 1] != null) - { - if (Main.tile[i, j + 1].active()) - { - if (Main.tile[i, j + 1].type == mod.TileType("ViperVines")) - { - WorldGen.KillTile(i, j + 1, false, false, false); - if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); - } - } - } - } - } + if (Main.tile[i, j + 1] != null) + { + if (Main.tile[i, j + 1].active()) + { + if (Main.tile[i, j + 1].type == mod.TileType("ViperVines")) + { + WorldGen.KillTile(i, j + 1, false, false, false); + if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + } + } + } public override void RandomUpdate(int i, int j) { @@ -75,18 +75,18 @@ namespace CalamityMod.Tiles int num53 = i; int num54 = j + 1; Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); - Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); - Main.tile[num53, num54].frameY = (short)(4 * 18); - Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); - Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); - Main.tile[num53, num54].active(true); + Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[num53, num54].frameY = (short)(4 * 18); + Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); + Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); + Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); - WorldGen.SquareTileFrame(num53, num54 - 1, true); - if (Main.netMode == NetmodeID.Server) + WorldGen.SquareTileFrame(num53, num54 - 1, true); + if (Main.netMode == NetmodeID.Server) { NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); - NetMessage.SendTileSquare(-1, num53, num54 - 1, 3, TileChangeType.None); - } + NetMessage.SendTileSquare(-1, num53, num54 - 1, 3, TileChangeType.None); + } } } } diff --git a/Tiles/Voidstone.cs b/Tiles/Voidstone.cs index a0eb2fda3c..a029f11754 100644 --- a/Tiles/Voidstone.cs +++ b/Tiles/Voidstone.cs @@ -1,18 +1,18 @@ +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class Voidstone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; TileMerge.MergeGeneralTiles(Type); @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles mineResist = 10f; minPick = 190; drop = mod.ItemType("Voidstone"); - AddMapEntry(new Color(10, 10, 10)); + AddMapEntry(new Color(10, 10, 10)); } int animationFrameWidth = 288; diff --git a/Tiles/YellowCandle.cs b/Tiles/YellowCandle.cs index 8581e86e6f..237f80d9eb 100644 --- a/Tiles/YellowCandle.cs +++ b/Tiles/YellowCandle.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles animationFrameHeight = 34; } - public override void AnimateTile(ref int frame, ref int frameCounter) + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; if (frameCounter >= 6) @@ -32,38 +32,38 @@ namespace CalamityMod.Tiles } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - { - player.AddBuff(mod.BuffType("YellowDamageCandle"), 20); - if (Main.netMode != NetmodeID.MultiplayerClient) + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + { + player.AddBuff(mod.BuffType("YellowDamageCandle"), 20); + if (Main.netMode != NetmodeID.MultiplayerClient) { for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = false; - if (Main.npc[m].type == mod.NPCType("CeaselessVoid") || Main.npc[m].type == mod.NPCType("EidolonWyrmHeadHuge")) - { - Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = true; - } - Main.npc[m].AddBuff(mod.BuffType("YellowDamageCandle"), 20, false); - } - } - } - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.75f; - g = 0.75f; - b = 0.35f; + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = false; + if (Main.npc[m].type == mod.NPCType("CeaselessVoid") || Main.npc[m].type == mod.NPCType("EidolonWyrmHeadHuge")) + { + Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = true; + } + Main.npc[m].AddBuff(mod.BuffType("YellowDamageCandle"), 20, false); + } + } + } + } } - public override void KillMultiTile(int i, int j, int frameX, int frameY) + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.75f; + g = 0.75f; + b = 0.35f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("YellowCandle")); } diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 52eae860c0..2088c25906 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -1,13 +1,10 @@  +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - using Terraria; -using Terraria.ModLoader; - -using CalamityMod.World; -using CalamityMod.CalPlayer; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.UI { @@ -74,8 +71,10 @@ namespace CalamityMod.UI { Open = true; } - else if (CalamityWorld.bossRushActive) Open = false; - if (!Open) return; + else if (CalamityWorld.bossRushActive) + Open = false; + if (!Open) + return; //Draw center circle DrawCircle(sb, CenterPoint, 0, CircleStyle.Normal); diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 2c22638c6c..8394020895 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -1,16 +1,13 @@ -using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using System; using System.Collections.Generic; using System.Linq; - -using ReLogic.Graphics; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent.Events; namespace CalamityMod.UI { @@ -43,7 +40,7 @@ namespace CalamityMod.UI public static bool SHOULD_DRAW_SMALLTEXT_HEALTH = true; - private static List Bars; + private static List Bars; private static DynamicSpriteFont HPBarFont; private static Texture2D BossMainHPBar; @@ -96,14 +93,14 @@ namespace CalamityMod.UI OneToMany[NPCID.PrimeCannon] = SkelePrime; OneToMany[NPCID.PrimeLaser] = SkelePrime; - int[] Golem = new int[] { NPCID.Golem, NPCID.GolemFistLeft, NPCID.GolemFistRight, NPCID.GolemHead, NPCID.GolemHeadFree }; - OneToMany[NPCID.Golem] = Golem; - OneToMany[NPCID.GolemFistLeft] = Golem; - OneToMany[NPCID.GolemFistRight] = Golem; - OneToMany[NPCID.GolemHead] = Golem; - OneToMany[NPCID.GolemHeadFree] = Golem; + int[] Golem = new int[] { NPCID.Golem, NPCID.GolemFistLeft, NPCID.GolemFistRight, NPCID.GolemHead, NPCID.GolemHeadFree }; + OneToMany[NPCID.Golem] = Golem; + OneToMany[NPCID.GolemFistLeft] = Golem; + OneToMany[NPCID.GolemFistRight] = Golem; + OneToMany[NPCID.GolemHead] = Golem; + OneToMany[NPCID.GolemHeadFree] = Golem; - int[] Saucer = new int[] { NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.MartianSaucerCannon }; + int[] Saucer = new int[] { NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.MartianSaucerCannon }; OneToMany[NPCID.MartianSaucerCore] = Saucer; OneToMany[NPCID.MartianSaucerTurret] = Saucer; OneToMany[NPCID.MartianSaucerCannon] = Saucer; @@ -179,8 +176,8 @@ namespace CalamityMod.UI ExclusionList.Add(calamity.NPCType("AstrumDeusTailSpectral")); ExclusionList.Add(calamity.NPCType("DesertScourgeBody")); ExclusionList.Add(calamity.NPCType("DesertScourgeTail")); - ExclusionList.Add(calamity.NPCType("StormWeaverHead")); - ExclusionList.Add(calamity.NPCType("StormWeaverBody")); + ExclusionList.Add(calamity.NPCType("StormWeaverHead")); + ExclusionList.Add(calamity.NPCType("StormWeaverBody")); ExclusionList.Add(calamity.NPCType("StormWeaverTail")); ExclusionList.Add(calamity.NPCType("StormWeaverBodyNaked")); ExclusionList.Add(calamity.NPCType("StormWeaverTailNaked")); @@ -227,11 +224,11 @@ namespace CalamityMod.UI Mod calamity = ModLoader.GetMod("CalamityMod"); if (calamity != null) { - //Prehardmode - MinibossHPBarList.Add(calamity.NPCType("GiantClam")); + //Prehardmode + MinibossHPBarList.Add(calamity.NPCType("GiantClam")); - //Hardmode - MinibossHPBarList.Add(calamity.NPCType("ThiccWaifu")); + //Hardmode + MinibossHPBarList.Add(calamity.NPCType("ThiccWaifu")); MinibossHPBarList.Add(calamity.NPCType("Horse")); MinibossHPBarList.Add(calamity.NPCType("GreatSandShark")); MinibossHPBarList.Add(calamity.NPCType("PlaguebringerShade")); @@ -246,8 +243,8 @@ namespace CalamityMod.UI MinibossHPBarList.Add(calamity.NPCType("ProvSpawnDefense")); MinibossHPBarList.Add(calamity.NPCType("ProvSpawnOffense")); MinibossHPBarList.Add(calamity.NPCType("ProvSpawnHealer")); - MinibossHPBarList.Add(calamity.NPCType("PolterPhantom")); - } + MinibossHPBarList.Add(calamity.NPCType("PolterPhantom")); + } } public static void Unload() @@ -267,7 +264,8 @@ namespace CalamityMod.UI for (int i = 0; i < Main.npc.Length; i++) { //Is NPC active - if (!Main.npc[i].active) continue; + if (!Main.npc[i].active) + continue; //Is npc in exclusion list int type = Main.npc[i].type; @@ -275,7 +273,8 @@ namespace CalamityMod.UI { AttemptAddBar(i, NPCID.MoonLordCore); } - if (ExclusionList.Contains(type)) continue; + if (ExclusionList.Contains(type)) + continue; if (Main.npc[i].type == NPCID.BrainofCthulhu) { @@ -289,11 +288,11 @@ namespace CalamityMod.UI { AttemptAddBar(i, NPCID.SkeletronPrime); } - else if (Main.npc[i].type == NPCID.Golem) - { - AttemptAddBar(i, NPCID.Golem); - } - else if (Main.npc[i].type == NPCID.MartianSaucerCore) + else if (Main.npc[i].type == NPCID.Golem) + { + AttemptAddBar(i, NPCID.Golem); + } + else if (Main.npc[i].type == NPCID.MartianSaucerCore) { AttemptAddBar(i, NPCID.MartianSaucerCore); } @@ -359,7 +358,8 @@ namespace CalamityMod.UI private static void AttemptAddBar(int index, int type = -1) { //Limit the number of bars. - if (Bars.Count >= MAX_BARS) return; + if (Bars.Count >= MAX_BARS) + return; bool hasBar = false; @@ -587,7 +587,8 @@ namespace CalamityMod.UI public void Update() { - if (_closeAnimCounter != 0) return; + if (_closeAnimCounter != 0) + return; int currentLife = _npc.life; @@ -601,7 +602,8 @@ namespace CalamityMod.UI if (Main.npc[i].active && Main.npc[i].life > 0 && _arrayOfIds.Contains(Main.npc[i].type)) { if ((Main.npc[i].type == NPCID.MoonLordHead || Main.npc[i].type == NPCID.MoonLordHand || Main.npc[i].type == NPCID.MoonLordCore) && - Main.npc[i].ai[0] == -2f) continue; + Main.npc[i].ai[0] == -2f) + continue; currentLife += Main.npc[i].life; maxLife += Main.npc[i].lifeMax; } @@ -767,7 +769,8 @@ namespace CalamityMod.UI //DRAW TEXT string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; - if (_prevLife == _maxHealth) percentHealthText = "100%"; + if (_prevLife == _maxHealth) + percentHealthText = "100%"; Vector2 textSize = HPBarFont.MeasureString(percentHealthText); DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour, OrangeBorderColour * 0.25f); @@ -1029,7 +1032,8 @@ namespace CalamityMod.UI float reversePercent = 1f - percentThroughAnim; float percentHealth = (_prevLife / _maxHealth); - if (percentHealth < 0) percentHealth = 0; + if (percentHealth < 0) + percentHealth = 0; int mainBarWidth = (int)(BarMaxWidth * MathHelper.SmoothStep(0f, 1f, reversePercent) * percentHealth); @@ -1041,8 +1045,10 @@ namespace CalamityMod.UI //DRAW TEXT string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; - if (_prevLife <= 0) percentHealthText = "0%"; - if (_prevLife == _maxHealth) percentHealthText = "100%"; + if (_prevLife <= 0) + percentHealthText = "0%"; + if (_prevLife == _maxHealth) + percentHealthText = "100%"; Vector2 textSize = HPBarFont.MeasureString(percentHealthText); DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour * reversePercent, OrangeBorderColour * 0.25f * reversePercent); @@ -1076,7 +1082,8 @@ namespace CalamityMod.UI { NPC n = Main.npc[id]; - if (!n.active || n.life <= 0) return false; + if (!n.active || n.life <= 0) + return false; return n.type == NPCID.EaterofWorldsHead || n.type == NPCID.EaterofWorldsBody || diff --git a/UI/UIBar.cs b/UI/UIBar.cs index 059c4b21b9..d01fea5bea 100644 --- a/UI/UIBar.cs +++ b/UI/UIBar.cs @@ -1,145 +1,142 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.GameContent.UI.Elements; -using Terraria.UI; using Terraria.ModLoader; - -using CalamityMod.CalPlayer; +using Terraria.UI; namespace CalamityMod.UI { public class UIBar : UIState - { - public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. - public int barWidth = 150; //the exact width of the bar texture/panel. - public Func getValue; //the func used to get the value displayed. - public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. + { + public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. + public int barWidth = 150; //the exact width of the bar texture/panel. + public Func getValue; //the func used to get the value displayed. + public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. - public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing - { - } + public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing + { + } - public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures - { - backPanel = new UIImage(imageBack); - barOffset = barOff; - barPanel = new UIImage(imageBar); - barWidth = (int)barPanel.Width.Pixels; - } + public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures + { + backPanel = new UIImage(imageBack); + barOffset = barOff; + barPanel = new UIImage(imageBar); + barWidth = (int)barPanel.Width.Pixels; + } - public UIBar() : this(10000, GetTickedValue) //for testing purposes - { - } + public UIBar() : this(10000, GetTickedValue) //for testing purposes + { + } - public UIBar(int valMax, Func gValue) : base() //uses panels for drawing instead of textures - { - valueMax = valMax; - getValue = gValue; - } + public UIBar(int valMax, Func gValue) : base() //uses panels for drawing instead of textures + { + valueMax = valMax; + getValue = gValue; + } - public static int tick; //for testing - public static int GetTickedValue() //ditto - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - tick = Main.player[Main.myPlayer].Calamity().stress; - return tick; - } + public static int tick; //for testing + public static int GetTickedValue() //ditto + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + tick = Main.player[Main.myPlayer].Calamity().stress; + return tick; + } - public override void OnInitialize() - { - float posX = (float)Config.RageMeterXPos, posY = (float)Config.RageMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! - if (backPanel == null) //if not using textures set up panels - { - backPanel = new UIPanel(); - ((UIPanel)backPanel).SetPadding(0); - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.Width.Set(barWidth + 20f, 0f); - backPanel.Height.Set(50f, 0f); - ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); + public override void OnInitialize() + { + float posX = (float)Config.RageMeterXPos, posY = (float)Config.RageMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! + if (backPanel == null) //if not using textures set up panels + { + backPanel = new UIPanel(); + ((UIPanel)backPanel).SetPadding(0); + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.Width.Set(barWidth + 20f, 0f); + backPanel.Height.Set(50f, 0f); + ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - barPanel = new UIPanel(); - ((UIPanel)barPanel).SetPadding(0); - barPanel.Left.Set(10f, 0f); - barPanel.Top.Set(10f, 0f); - barPanel.Width.Set(barWidth, 0f); - barPanel.Height.Set(30f, 0f); - ((UIPanel)barPanel).BackgroundColor = new Color(200, 0, 0); - backPanel.Append(barPanel); - } - else //otherwise using images so just move it into position - { - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + barPanel = new UIPanel(); + ((UIPanel)barPanel).SetPadding(0); + barPanel.Left.Set(10f, 0f); + barPanel.Top.Set(10f, 0f); + barPanel.Width.Set(barWidth, 0f); + barPanel.Height.Set(30f, 0f); + ((UIPanel)barPanel).BackgroundColor = new Color(200, 0, 0); + backPanel.Append(barPanel); + } + else //otherwise using images so just move it into position + { + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - barPanel.Left.Set(barOffset, 0f); - barPanel.Top.Set(0f, 0f); + barPanel.Left.Set(barOffset, 0f); + barPanel.Top.Set(0f, 0f); - backPanel.Append(barPanel); - } + backPanel.Append(barPanel); + } - base.Append(backPanel); - } + base.Append(backPanel); + } - public float GetPercentile() - { - return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); - } + public float GetPercentile() + { + return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); + } - Vector2 offset; - public bool dragging = false; - private void DragStart(UIMouseEvent evt, UIElement listeningElement) - { - offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); - dragging = true; - } + Vector2 offset; + public bool dragging = false; + private void DragStart(UIMouseEvent evt, UIElement listeningElement) + { + offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); + dragging = true; + } - private void DragEnd(UIMouseEvent evt, UIElement listeningElement) - { - Vector2 end = evt.MousePosition; - dragging = false; + private void DragEnd(UIMouseEvent evt, UIElement listeningElement) + { + Vector2 end = evt.MousePosition; + dragging = false; - backPanel.Left.Set(end.X - offset.X, 0f); - backPanel.Top.Set(end.Y - offset.Y, 0f); + backPanel.Left.Set(end.X - offset.X, 0f); + backPanel.Top.Set(end.Y - offset.Y, 0f); - Recalculate(); - } + Recalculate(); + } - public override void Update(GameTime gameTime) - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - base.Update(gameTime); - Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. - tick = Main.player[Main.myPlayer].Calamity().stress; //updates the testing tick - if (tick >= 10000) - { - tick = 10000; - } - barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. - } + public override void Update(GameTime gameTime) + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + base.Update(gameTime); + Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. + tick = Main.player[Main.myPlayer].Calamity().stress; //updates the testing tick + if (tick >= 10000) + { + tick = 10000; + } + barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. + } - protected override void DrawSelf(SpriteBatch spriteBatch) - { - Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); - if (backPanel.ContainsPoint(MousePosition)) - { - Main.LocalPlayer.mouseInterface = true; - Main.instance.MouseText("Rage: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. - } - if (dragging) - { - backPanel.Left.Set(MousePosition.X - offset.X, 0f); - backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); - Recalculate(); - } - } - } + protected override void DrawSelf(SpriteBatch spriteBatch) + { + Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); + if (backPanel.ContainsPoint(MousePosition)) + { + Main.LocalPlayer.mouseInterface = true; + Main.instance.MouseText("Rage: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. + } + if (dragging) + { + backPanel.Left.Set(MousePosition.X - offset.X, 0f); + backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); + Recalculate(); + } + } + } } diff --git a/UI/UIBar2.cs b/UI/UIBar2.cs index 2b759ee4bf..b9a48e6d81 100644 --- a/UI/UIBar2.cs +++ b/UI/UIBar2.cs @@ -1,145 +1,142 @@ -using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - +using System; using Terraria; using Terraria.GameContent.UI.Elements; -using Terraria.UI; using Terraria.ModLoader; - -using CalamityMod.CalPlayer; +using Terraria.UI; namespace CalamityMod.UI { public class UIBar2 : UIState - { - public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. - public int barWidth = 150; //the exact width of the bar texture/panel. - public Func getValue; //the func used to get the value displayed. - public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. + { + public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. + public int barWidth = 150; //the exact width of the bar texture/panel. + public Func getValue; //the func used to get the value displayed. + public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. - public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing - { - } + public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing + { + } - public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures - { - backPanel = new UIImage(imageBack); - barOffset = barOff; - barPanel = new UIImage(imageBar); - barWidth = (int)barPanel.Width.Pixels; - } + public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures + { + backPanel = new UIImage(imageBack); + barOffset = barOff; + barPanel = new UIImage(imageBar); + barWidth = (int)barPanel.Width.Pixels; + } - public UIBar2() : this(10000, GetTickedValue) //for testing purposes - { - } + public UIBar2() : this(10000, GetTickedValue) //for testing purposes + { + } - public UIBar2(int valMax, Func gValue) : base() //uses panels for drawing instead of textures - { - valueMax = valMax; - getValue = gValue; - } + public UIBar2(int valMax, Func gValue) : base() //uses panels for drawing instead of textures + { + valueMax = valMax; + getValue = gValue; + } - public static int tick; //for testing - public static int GetTickedValue() //ditto - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - tick = Main.player[Main.myPlayer].Calamity().adrenaline; - return tick; - } + public static int tick; //for testing + public static int GetTickedValue() //ditto + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + tick = Main.player[Main.myPlayer].Calamity().adrenaline; + return tick; + } - public override void OnInitialize() - { - float posX = (float)Config.AdrenalineMeterXPos, posY = (float)Config.AdrenalineMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! - if (backPanel == null) //if not using textures set up panels - { - backPanel = new UIPanel(); - ((UIPanel)backPanel).SetPadding(0); - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.Width.Set(barWidth + 20f, 0f); - backPanel.Height.Set(50f, 0f); - ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); + public override void OnInitialize() + { + float posX = (float)Config.AdrenalineMeterXPos, posY = (float)Config.AdrenalineMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! + if (backPanel == null) //if not using textures set up panels + { + backPanel = new UIPanel(); + ((UIPanel)backPanel).SetPadding(0); + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.Width.Set(barWidth + 20f, 0f); + backPanel.Height.Set(50f, 0f); + ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - barPanel = new UIPanel(); - ((UIPanel)barPanel).SetPadding(0); - barPanel.Left.Set(10f, 0f); - barPanel.Top.Set(10f, 0f); - barPanel.Width.Set(barWidth, 0f); - barPanel.Height.Set(30f, 0f); - ((UIPanel)barPanel).BackgroundColor = new Color(0, 0, 200); - backPanel.Append(barPanel); - } - else //otherwise using images so just move it into position - { - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + barPanel = new UIPanel(); + ((UIPanel)barPanel).SetPadding(0); + barPanel.Left.Set(10f, 0f); + barPanel.Top.Set(10f, 0f); + barPanel.Width.Set(barWidth, 0f); + barPanel.Height.Set(30f, 0f); + ((UIPanel)barPanel).BackgroundColor = new Color(0, 0, 200); + backPanel.Append(barPanel); + } + else //otherwise using images so just move it into position + { + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - barPanel.Left.Set(barOffset, 0f); - barPanel.Top.Set(0f, 0f); + barPanel.Left.Set(barOffset, 0f); + barPanel.Top.Set(0f, 0f); - backPanel.Append(barPanel); - } + backPanel.Append(barPanel); + } - base.Append(backPanel); - } + base.Append(backPanel); + } - public float GetPercentile() - { - return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); - } + public float GetPercentile() + { + return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); + } - Vector2 offset; - public bool dragging = false; - private void DragStart(UIMouseEvent evt, UIElement listeningElement) - { - offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); - dragging = true; - } + Vector2 offset; + public bool dragging = false; + private void DragStart(UIMouseEvent evt, UIElement listeningElement) + { + offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); + dragging = true; + } - private void DragEnd(UIMouseEvent evt, UIElement listeningElement) - { - Vector2 end = evt.MousePosition; - dragging = false; + private void DragEnd(UIMouseEvent evt, UIElement listeningElement) + { + Vector2 end = evt.MousePosition; + dragging = false; - backPanel.Left.Set(end.X - offset.X, 0f); - backPanel.Top.Set(end.Y - offset.Y, 0f); + backPanel.Left.Set(end.X - offset.X, 0f); + backPanel.Top.Set(end.Y - offset.Y, 0f); - Recalculate(); - } + Recalculate(); + } - public override void Update(GameTime gameTime) - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - base.Update(gameTime); - Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. - tick = Main.player[Main.myPlayer].Calamity().adrenaline; //updates the testing tick - if (tick >= 10000) - { - tick = 10000; - } - barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. - } + public override void Update(GameTime gameTime) + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + base.Update(gameTime); + Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. + tick = Main.player[Main.myPlayer].Calamity().adrenaline; //updates the testing tick + if (tick >= 10000) + { + tick = 10000; + } + barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. + } - protected override void DrawSelf(SpriteBatch spriteBatch) - { - Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); - if (backPanel.ContainsPoint(MousePosition)) - { - Main.LocalPlayer.mouseInterface = true; - Main.instance.MouseText("Adrenaline: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. - } - if (dragging) - { - backPanel.Left.Set(MousePosition.X - offset.X, 0f); - backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); - Recalculate(); - } - } - } + protected override void DrawSelf(SpriteBatch spriteBatch) + { + Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); + if (backPanel.ContainsPoint(MousePosition)) + { + Main.LocalPlayer.mouseInterface = true; + Main.instance.MouseText("Adrenaline: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. + } + if (dragging) + { + backPanel.Left.Set(MousePosition.X - offset.X, 0f); + backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); + Recalculate(); + } + } + } } diff --git a/UI/UIHandler.cs b/UI/UIHandler.cs index 82e88cde0a..4504cb5e24 100644 --- a/UI/UIHandler.cs +++ b/UI/UIHandler.cs @@ -1,58 +1,61 @@ -using System.Collections.Generic; using Microsoft.Xna.Framework.Graphics; - +using System.Collections.Generic; using Terraria; -using Terraria.UI; using Terraria.ModLoader; +using Terraria.UI; namespace CalamityMod.UI { public class UIHandler - { - public static UserInterface userBar; - public static UserInterface userBar2; - public static UIBar uiBar; - public static UIBar2 uiBar2; + { + public static UserInterface userBar; + public static UserInterface userBar2; + public static UIBar uiBar; + public static UIBar2 uiBar2; - //call this in mod.Load() - public static void OnLoad(Mod mod) - { - int offset = 0; // How many pixels inwards to stick the bar + //call this in mod.Load() + public static void OnLoad(Mod mod) + { + int offset = 0; // How many pixels inwards to stick the bar - Texture2D borderTex = mod.GetTexture("ExtraTextures/UI/BarStressBorder"), barTex = mod.GetTexture("ExtraTextures/UI/BarStress"); //replace 'null' with your textures. - uiBar = new UIBar(borderTex, barTex, offset); - userBar = new UserInterface(); - userBar.SetState(uiBar); + Texture2D borderTex = mod.GetTexture("ExtraTextures/UI/BarStressBorder"), barTex = mod.GetTexture("ExtraTextures/UI/BarStress"); //replace 'null' with your textures. + uiBar = new UIBar(borderTex, barTex, offset); + userBar = new UserInterface(); + userBar.SetState(uiBar); - Texture2D borderTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenalineBorder"), barTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenaline"); //replace 'null' with your textures. - uiBar2 = new UIBar2(borderTex2, barTex2, offset); - userBar2 = new UserInterface(); - userBar2.SetState(uiBar2); - } + Texture2D borderTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenalineBorder"), barTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenaline"); //replace 'null' with your textures. + uiBar2 = new UIBar2(borderTex2, barTex2, offset); + userBar2 = new UserInterface(); + userBar2.SetState(uiBar2); + } - //call this in mod.ModifyInterfaceLayers() - public static void ModifyInterfaceLayers(Mod mod, List layers) - { - AddInterfaceLayer(mod, layers, userBar, uiBar, "Calamity: Stress Bar", "Vanilla: Mouse Text", true); - AddInterfaceLayer(mod, layers, userBar2, uiBar2, "Calamity: Adrenaline Bar", "Vanilla: Mouse Text", true); - } + //call this in mod.ModifyInterfaceLayers() + public static void ModifyInterfaceLayers(Mod mod, List layers) + { + AddInterfaceLayer(mod, layers, userBar, uiBar, "Calamity: Stress Bar", "Vanilla: Mouse Text", true); + AddInterfaceLayer(mod, layers, userBar2, uiBar2, "Calamity: Adrenaline Bar", "Vanilla: Mouse Text", true); + } - public static void AddInterfaceLayer(Mod mod, List list, UserInterface uInterface, UIElement uElement, string layerName, string parent, bool first) - { - GameInterfaceLayer item = new LegacyGameInterfaceLayer(mod.Name + ":" + layerName, delegate - { - uInterface.Update(Main._drawInterfaceGameTime); - uElement.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.UI); + public static void AddInterfaceLayer(Mod mod, List list, UserInterface uInterface, UIElement uElement, string layerName, string parent, bool first) + { + GameInterfaceLayer item = new LegacyGameInterfaceLayer(mod.Name + ":" + layerName, delegate + { + uInterface.Update(Main._drawInterfaceGameTime); + uElement.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.UI); - int insertAt = -1; - for (int m = 0; m < list.Count; m++) - { - GameInterfaceLayer dl = list[m]; - if (dl.Name.Contains(parent)) { insertAt = m; break; } - } - if (insertAt == -1) list.Add(item); else list.Insert(first ? insertAt : insertAt + 1, item); - } - } + int insertAt = -1; + for (int m = 0; m < list.Count; m++) + { + GameInterfaceLayer dl = list[m]; + if (dl.Name.Contains(parent)) + { insertAt = m; break; } + } + if (insertAt == -1) + list.Add(item); + else + list.Insert(first ? insertAt : insertAt + 1, item); + } + } } diff --git a/UI/UIImage.cs b/UI/UIImage.cs index f4b43d154f..8d7c69fb46 100644 --- a/UI/UIImage.cs +++ b/UI/UIImage.cs @@ -5,23 +5,23 @@ using Terraria.UI; namespace CalamityMod.UI { public class UIImage : UIElement - { - public Texture2D texture = null; + { + public Texture2D texture = null; - public UIImage(Texture2D tex, int width = -1, int height = -1) : base() - { - texture = tex; - this.Width.Set(width == -1 ? tex.Width : width, 0f); - this.Height.Set(height == -1 ? tex.Height : height, 0f); - } + public UIImage(Texture2D tex, int width = -1, int height = -1) : base() + { + texture = tex; + this.Width.Set(width == -1 ? tex.Width : width, 0f); + this.Height.Set(height == -1 ? tex.Height : height, 0f); + } - protected override void DrawSelf(SpriteBatch spriteBatch) - { - CalculatedStyle dimensions = base.GetDimensions(); - Color color = Color.White; + protected override void DrawSelf(SpriteBatch spriteBatch) + { + CalculatedStyle dimensions = base.GetDimensions(); + Color color = Color.White; //base.IsMouseHovering ? Color.White : Color.Silver; //uncomment this to produce it getting brighter if hovered over. - int width = (int)dimensions.Width, height = (int)dimensions.Height; - spriteBatch.Draw(texture, new Rectangle((int)dimensions.X, (int)dimensions.Y, width, height), new Rectangle(0, 0, width, height), color); - } - } + int width = (int)dimensions.Width, height = (int)dimensions.Height; + spriteBatch.Draw(texture, new Rectangle((int)dimensions.X, (int)dimensions.Y, width, height), new Rectangle(0, 0, width, height), color); + } + } } diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 5d71ede9ad..ee87b50694 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -7,747 +7,747 @@ using Terraria.ModLoader; namespace CalamityMod.Utilities { internal class CalamityRecipes - { - private static ModRecipe GetNewRecipe() - { - return new ModRecipe(ModContent.GetInstance()); - } - - public static void AddRecipes() - { - EditTerraBladeRecipe(); - AddPotionRecipes(); - AddToolRecipes(); - AddProgressionRecipes(); - AddEarlyGameWeaponRecipes(); - AddEarlyGameAccessoryRecipes(); - AddAnkhShieldRecipes(); - AddAlternateHardmodeRecipes(); - - // Leather from Vertebrae, for Crimson worlds - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Vertebrae, 5); - r.AddTile(TileID.WorkBenches); - r.SetResult(ItemID.Leather); - r.AddRecipe(); - - // Black Lens - r = GetNewRecipe(); - r.AddIngredient(ItemID.Lens); - r.AddIngredient(ItemID.BlackDye); - r.AddTile(TileID.DyeVat); - r.SetResult(ItemID.BlackLens); - r.AddRecipe(); - - // Fallen Star - r = GetNewRecipe(); - r.AddIngredient(null, "Stardust", 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FallenStar); - r.AddRecipe(); - - // Ectoplasm from Ectoblood - r = GetNewRecipe(); - r.AddIngredient(null, "Ectoblood", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Ectoplasm); - r.AddRecipe(); - - // Rocket I from Empty Bullet - r = GetNewRecipe(); - r.AddIngredient(ItemID.EmptyBullet, 20); - r.AddIngredient(ItemID.ExplosivePowder, 1); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.RocketI, 20); - r.AddRecipe(); - - // Life Crystal - r = GetNewRecipe(); - r.AddIngredient(ItemID.Bone, 5); - r.AddIngredient(ItemID.PinkGel); - r.AddIngredient(ItemID.HealingPotion); - r.AddIngredient(ItemID.Ruby); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LifeCrystal); - r.AddRecipe(); - - // Life Fruit - r = GetNewRecipe(); - r.AddIngredient(null, "PlantyMush", 10); - r.AddIngredient(null, "LivingShard"); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.LifeFruit); - r.AddRecipe(); - - // Cooked Fish - r = GetNewRecipe(); - r.AddIngredient(null, "TwinklingPollox"); - r.AddTile(TileID.CookingPots); - r.SetResult(2425); - r.AddRecipe(); - - // Cooked Shrimp - r = GetNewRecipe(); - r.AddIngredient(null, "ProcyonidPrawn"); - r.AddTile(TileID.CookingPots); - r.SetResult(2426); - r.AddRecipe(); - } - - // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) - private static void EditTerraBladeRecipe() - { - List rec = Main.recipe.ToList(); - rec.Where(x => x.createItem.type == ItemID.TerraBlade).ToList().ForEach(s => - { - for (int i = 0; i < s.requiredItem.Length; i++) - { - s.requiredItem[i] = new Item(); - } - s.requiredItem[0].SetDefaults(ItemID.TrueNightsEdge, false); - s.requiredItem[0].stack = 1; - s.requiredItem[1].SetDefaults(ItemID.TrueExcalibur, false); - s.requiredItem[1].stack = 1; - s.requiredItem[2].SetDefaults(ModContent.GetInstance().ItemType("LivingShard"), false); - s.requiredItem[2].stack = 7; - - s.createItem.SetDefaults(ItemID.TerraBlade, false); - s.createItem.stack = 1; - }); - } - - #region Potions - // Equivalent Blood Orb recipes for almost all vanilla potions - private static void AddPotionRecipes() - { - short[] potions = new[] - { - ItemID.WormholePotion, - ItemID.TeleportationPotion, - ItemID.SwiftnessPotion, - ItemID.FeatherfallPotion, - ItemID.GravitationPotion, - ItemID.ShinePotion, - ItemID.InvisibilityPotion, - ItemID.NightOwlPotion, - ItemID.SpelunkerPotion, - ItemID.HunterPotion, - ItemID.TrapsightPotion, - ItemID.BattlePotion, - ItemID.CalmingPotion, - ItemID.WrathPotion, - ItemID.RagePotion, - ItemID.ThornsPotion, - ItemID.IronskinPotion, - ItemID.EndurancePotion, - ItemID.RegenerationPotion, - ItemID.LifeforcePotion, - ItemID.HeartreachPotion, - ItemID.TitanPotion, - ItemID.ArcheryPotion, - ItemID.AmmoReservationPotion, - ItemID.MagicPowerPotion, - ItemID.ManaRegenerationPotion, - ItemID.SummoningPotion, - ItemID.InfernoPotion, - ItemID.WarmthPotion, - ItemID.ObsidianSkinPotion, - ItemID.GillsPotion, - ItemID.WaterWalkingPotion, - ItemID.FlipperPotion, - ItemID.BuilderPotion, - ItemID.MiningPotion, - ItemID.FishingPotion, - ItemID.CratePotion, - ItemID.SonarPotion, - ItemID.GenderChangePotion, - ItemID.LovePotion, - ItemID.StinkPotion - }; - ModRecipe r; - - foreach (var potion in potions) - { - r = GetNewRecipe(); - r.AddIngredient(null, "BloodOrb", 10); - r.AddIngredient(ItemID.BottledWater); - r.AddTile(TileID.AlchemyTable); - r.SetResult(potion); - r.AddRecipe(); - } - } - #endregion - - #region Tools - // Essential tools such as the Magic Mirror and Rod of Discord - private static void AddToolRecipes() - { - // Magic Mirror - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar, 10); - r.AddIngredient(ItemID.Glass, 10); - r.AddIngredient(ItemID.FallenStar, 10); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.MagicMirror); - r.AddRecipe(); - - // Ice Mirror - r = GetNewRecipe(); - r.AddIngredient(ItemID.IceBlock, 20); - r.AddIngredient(ItemID.Glass, 10); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.IceMirror); - r.AddRecipe(); - - // Shadow Key - r = GetNewRecipe(); - r.AddIngredient(ItemID.GoldenKey); - r.AddIngredient(ItemID.Obsidian, 20); - r.AddIngredient(ItemID.Bone, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.ShadowKey); - r.AddRecipe(); - - // Rod of Discord - r = GetNewRecipe(); - r.AddIngredient(ItemID.SoulofLight, 30); - r.AddIngredient(ItemID.ChaosFish, 5); - r.AddIngredient(ItemID.PixieDust, 50); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.RodofDiscord); - r.AddRecipe(); - - // Sky Mill - r = GetNewRecipe(); - r.AddIngredient(ItemID.SunplateBlock, 10); - r.AddIngredient(ItemID.Cloud, 5); - r.AddIngredient(ItemID.RainCloud, 3); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.SkyMill); - r.AddRecipe(); - - // Ice Machine - r = GetNewRecipe(); - r.AddIngredient(ItemID.IceBlock, 25); - r.AddIngredient(ItemID.SnowBlock, 15); - r.AddIngredient(ItemID.IronBar, 3); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.IceMachine); - r.AddRecipe(); - } - #endregion - - #region ProgressionItems - // Boss summon and progression items - private static void AddProgressionRecipes() - { - // Guide Voodoo Doll - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 2); - r.AddIngredient(null, "FetidEssence", 2); - r.AddTile(TileID.Hellforge); - r.SetResult(ItemID.GuideVoodooDoll); - r.AddRecipe(); - - r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 2); - r.AddIngredient(null, "BloodlettingEssence", 2); - r.AddTile(TileID.Hellforge); - r.SetResult(ItemID.GuideVoodooDoll); - r.AddRecipe(); - - // Temple Key - r = GetNewRecipe(); - r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.RichMahogany, 15); - r.AddIngredient(ItemID.SoulofNight, 15); - r.AddIngredient(ItemID.SoulofLight, 15); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.TempleKey); - r.AddRecipe(); - - // Lihzahrd Power Cell (NOT Calamity's Old Power Cell) - r = GetNewRecipe(); - r.AddIngredient(ItemID.LihzahrdBrick, 15); - r.AddIngredient(null, "CoreofCinder"); - r.AddTile(TileID.LihzahrdFurnace); - r.SetResult(ItemID.LihzahrdPowerCell); - r.AddRecipe(); - - // Truffle Worm - r = GetNewRecipe(); - r.AddIngredient(ItemID.GlowingMushroom, 15); - r.AddIngredient(ItemID.Worm); - r.AddTile(TileID.Autohammer); - r.SetResult(ItemID.TruffleWorm); - r.AddRecipe(); - } - #endregion - - #region EarlyGameWeapons - // Early game weapons such as Enchanted Sword - private static void AddEarlyGameWeaponRecipes() - { - // Shuriken - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Shuriken, 50); - r.AddRecipe(); - - // Throwing Knife - r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.ThrowingKnife, 50); - r.AddRecipe(); - - // Wand of Sparking - r = GetNewRecipe(); - r.AddIngredient(ItemID.Wood, 5); - r.AddIngredient(ItemID.Torch, 3); - r.AddIngredient(ItemID.FallenStar); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.WandofSparking); - r.AddRecipe(); - - // Starfury w/ Gold Broadsword - r = GetNewRecipe(); - r.AddIngredient(ItemID.GoldBroadsword); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(null, "VictoryShard", 3); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Starfury); - r.AddRecipe(); - - // Starfury w/ Platinum Broadsword - r = GetNewRecipe(); - r.AddIngredient(ItemID.PlatinumBroadsword); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(null, "VictoryShard", 3); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Starfury); - r.AddRecipe(); - - // Enchanted Sword (requires Hardmode materials) - r = GetNewRecipe(); - r.AddIngredient(null, "VictoryShard", 10); - r.AddIngredient(ItemID.SoulofLight, 15); - r.AddIngredient(ItemID.UnicornHorn, 3); - r.AddIngredient(ItemID.LightShard); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.EnchantedSword); - r.AddRecipe(); - - // Muramasa w/ Cobalt Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.CobaltBar, 15); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Muramasa); - r.AddRecipe(); - - // Muramasa w/ Palladium Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.PalladiumBar, 15); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Muramasa); - r.AddRecipe(); - } - #endregion - - #region EarlyGameAccessories - // Early game accessories such as Cloud in a Bottle - private static void AddEarlyGameAccessoryRecipes() - { - // Cloud in a Bottle - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Feather, 2); - r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.Cloud, 25); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.CloudinaBottle); - r.AddRecipe(); - - // Hermes Boots - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 10); - r.AddTile(TileID.Loom); - r.SetResult(ItemID.HermesBoots); - r.AddRecipe(); - - // Blizzard in a Bottle - r = GetNewRecipe(); - r.AddIngredient(ItemID.Feather, 4); - r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.SnowBlock, 50); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.BlizzardinaBottle); - r.AddRecipe(); - - // Sandstorm in a Bottle - r = GetNewRecipe(); - r.AddIngredient(null, "DesertFeather", 10); - r.AddIngredient(ItemID.Feather, 6); - r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.SandBlock, 70); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.SandstorminaBottle); - r.AddRecipe(); - - // Frog Leg - r = GetNewRecipe(); - r.AddIngredient(ItemID.Frog, 10); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.FrogLeg); - r.AddRecipe(); - - // Flying Carpet - r = GetNewRecipe(); - r.AddIngredient(ItemID.AncientCloth, 10); - r.AddIngredient(ItemID.SoulofLight, 10); - r.AddIngredient(ItemID.SoulofNight, 10); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FlyingCarpet); - r.AddRecipe(); - - // Aglet - r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Aglet); - r.AddRecipe(); - - // Anklet of the Wind - r = GetNewRecipe(); - r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.Cloud, 15); - r.AddIngredient(ItemID.PinkGel, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.AnkletoftheWind); - r.AddRecipe(); - - // Water Walking Boots - r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 5); - r.AddIngredient(ItemID.WaterWalkingPotion, 8); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.WaterWalkingBoots); - r.AddRecipe(); - - // Ice Skates - r = GetNewRecipe(); - r.AddIngredient(ItemID.IceBlock, 20); - r.AddIngredient(ItemID.Leather, 5); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.IceSkates); - r.AddRecipe(); - - // Lucky Horseshoe w/ Gold Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.SunplateBlock, 10); - r.AddIngredient(ItemID.Cloud, 10); - r.AddIngredient(ItemID.GoldBar, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LuckyHorseshoe); - r.AddRecipe(); - - // Lucky Horseshoe w/ Platinum Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.SunplateBlock, 10); - r.AddIngredient(ItemID.Cloud, 10); - r.AddIngredient(ItemID.PlatinumBar, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LuckyHorseshoe); - r.AddRecipe(); - - // Shiny Red Balloon - r = GetNewRecipe(); - r.AddIngredient(ItemID.WhiteString); - r.AddIngredient(ItemID.Gel, 80); - r.AddIngredient(ItemID.Cloud, 40); - r.AddTile(TileID.Solidifier); - r.SetResult(ItemID.ShinyRedBalloon); - r.AddRecipe(); - - // Lava Charm - r = GetNewRecipe(); - r.AddIngredient(ItemID.LavaBucket, 5); - r.AddIngredient(ItemID.Obsidian, 25); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LavaCharm); - r.AddRecipe(); - - // Feral Claws - r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 10); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.FeralClaws); - r.AddRecipe(); - - // Radar - r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Radar); - r.AddRecipe(); - } - #endregion - - #region AnkhShield - // Every base component for the Ankh Shield - private static void AddAnkhShieldRecipes() - { - // Cobalt Shield w/ Cobalt - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.CobaltBar, 10); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.CobaltShield); - r.AddRecipe(); - - // Cobalt Shield w/ Palladium - r = GetNewRecipe(); - r.AddIngredient(ItemID.PalladiumBar, 10); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.CobaltShield); - r.AddRecipe(); - - // Armor Polish (broken armor) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Bone, 50); - r.AddIngredient(null, "AncientBoneDust", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.ArmorPolish); - r.AddRecipe(); - - // Adhesive Bandage (bleeding) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 10); - r.AddIngredient(ItemID.Gel, 50); - r.AddIngredient(ItemID.GreaterHealingPotion); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.AdhesiveBandage); - r.AddRecipe(); - - // Bezoar (poison) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Stinger, 15); - r.AddIngredient(null, "MurkyPaste"); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Bezoar); - r.AddRecipe(); - - // Nazar (curse) - r = GetNewRecipe(); - r.AddIngredient(ItemID.SoulofNight, 20); - r.AddIngredient(ItemID.Lens, 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Nazar); - r.AddRecipe(); - - // Vitamins (weakness) - r = GetNewRecipe(); - r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ItemID.Waterleaf, 5); - r.AddIngredient(ItemID.Blinkroot, 5); - r.AddIngredient(ItemID.Daybloom, 5); - r.AddIngredient(null, "BeetleJuice", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Vitamins); - r.AddRecipe(); - - // Blindfold (darkness) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 30); - r.AddIngredient(ItemID.SoulofNight, 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Blindfold); - r.AddRecipe(); - - // Trifold Map (confusion) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 20); - r.AddIngredient(ItemID.SoulofLight, 3); - r.AddIngredient(ItemID.SoulofNight, 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.TrifoldMap); - r.AddRecipe(); - - // Fast Clock (slow) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Timer1Second); - r.AddIngredient(ItemID.PixieDust, 15); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FastClock); - r.AddRecipe(); - - // Megaphone (silence) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Wire, 10); - r.AddIngredient(ItemID.HallowedBar, 5); - r.AddIngredient(ItemID.Ruby, 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Megaphone); - r.AddRecipe(); - } - #endregion - - #region HardmodeEquipment - // Alternate recipes for vanilla Hardmode equipment - private static void AddAlternateHardmodeRecipes() - { - // Avenger Emblem made with Rogue Emblem - ModRecipe r = GetNewRecipe(); - r.AddIngredient(null, "RogueEmblem"); - r.AddIngredient(ItemID.SoulofMight, 5); - r.AddIngredient(ItemID.SoulofSight, 5); - r.AddIngredient(ItemID.SoulofFright, 5); - r.AddTile(TileID.TinkerersWorkbench); - r.SetResult(ItemID.AvengerEmblem); - r.AddRecipe(); - - // Celestial Magnet - r = GetNewRecipe(); - r.AddIngredient(ItemID.FallenStar, 20); - r.AddIngredient(ItemID.SoulofMight, 10); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddIngredient(ItemID.SoulofNight, 5); - r.AddIngredient(null, "CryoBar", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.CelestialMagnet); - r.AddRecipe(); - - // Frozen Turtle Shell - r = GetNewRecipe(); - r.AddIngredient(ItemID.TurtleShell, 3); - r.AddIngredient(null, "EssenceofEleum", 9); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FrozenTurtleShell); - r.AddRecipe(); - - // Frost Helmet w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(null, "CryoBar", 6); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostHelmet); - r.AddRecipe(); - - // Frost Breastplate w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(null, "CryoBar", 10); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostBreastplate); - r.AddRecipe(); - - // Frost Leggings w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(null, "CryoBar", 8); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostLeggings); - r.AddRecipe(); - - // Terra Blade w/ True Bloody Edge - r = GetNewRecipe(); - r.AddIngredient(null, "TrueBloodyEdge"); - r.AddIngredient(ItemID.TrueExcalibur); - r.AddIngredient(null, "LivingShard", 7); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.TerraBlade); - r.AddRecipe(); - } - #endregion - - public static void AddRecipeGroups() - { - RecipeGroup group = new RecipeGroup(() => "Any Silt", new int[] - { - ItemID.SiltBlock, - ItemID.SlushBlock - }); - RecipeGroup.RegisterGroup("SiltGroup", group); - - group = new RecipeGroup(() => "Any Lunar Pickaxe", new int[] - { - ItemID.SolarFlarePickaxe, - ItemID.VortexPickaxe, - ItemID.NebulaPickaxe, - ItemID.StardustPickaxe - }); - RecipeGroup.RegisterGroup("LunarPickaxe", group); - - group = new RecipeGroup(() => "Any Lunar Hamaxe", new int[] - { - ItemID.LunarHamaxeSolar, - ItemID.LunarHamaxeVortex, - ItemID.LunarHamaxeNebula, - ItemID.LunarHamaxeStardust - }); - RecipeGroup.RegisterGroup("LunarHamaxe", group); - - group = new RecipeGroup(() => "Any Wings", new int[] - { - ItemID.DemonWings, - ItemID.AngelWings, - ItemID.RedsWings, - ItemID.ButterflyWings, - ItemID.FairyWings, - ItemID.HarpyWings, - ItemID.BoneWings, - ItemID.FlameWings, - ItemID.FrozenWings, - ItemID.GhostWings, - ItemID.SteampunkWings, - ItemID.LeafWings, - ItemID.BatWings, - ItemID.BeeWings, - ItemID.DTownsWings, - ItemID.WillsWings, - ItemID.CrownosWings, - ItemID.CenxsWings, - ItemID.TatteredFairyWings, - ItemID.SpookyWings, - ItemID.Hoverboard, - ItemID.FestiveWings, - ItemID.BeetleWings, - ItemID.FinWings, - ItemID.FishronWings, - ItemID.MothronWings, - ItemID.WingsSolar, - ItemID.WingsVortex, - ItemID.WingsNebula, - ItemID.WingsStardust, - ItemID.Yoraiz0rWings, - ItemID.JimsWings, - ItemID.SkiphsWings, - ItemID.LokisWings, - ItemID.BetsyWings, - ItemID.ArkhalisWings, - ItemID.LeinforsWings, - ModContent.GetInstance().ItemType("SkylineWings"), - ModContent.GetInstance().ItemType("StarlightWings"), - ModContent.GetInstance().ItemType("AureateWings"), - ModContent.GetInstance().ItemType("DiscordianWings"), - ModContent.GetInstance().ItemType("TarragonWings"), - ModContent.GetInstance().ItemType("XerocWings"), - ModContent.GetInstance().ItemType("HadarianWings") - }); - RecipeGroup.RegisterGroup("WingsGroup", group); - } - } + { + private static ModRecipe GetNewRecipe() + { + return new ModRecipe(ModContent.GetInstance()); + } + + public static void AddRecipes() + { + EditTerraBladeRecipe(); + AddPotionRecipes(); + AddToolRecipes(); + AddProgressionRecipes(); + AddEarlyGameWeaponRecipes(); + AddEarlyGameAccessoryRecipes(); + AddAnkhShieldRecipes(); + AddAlternateHardmodeRecipes(); + + // Leather from Vertebrae, for Crimson worlds + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.Vertebrae, 5); + r.AddTile(TileID.WorkBenches); + r.SetResult(ItemID.Leather); + r.AddRecipe(); + + // Black Lens + r = GetNewRecipe(); + r.AddIngredient(ItemID.Lens); + r.AddIngredient(ItemID.BlackDye); + r.AddTile(TileID.DyeVat); + r.SetResult(ItemID.BlackLens); + r.AddRecipe(); + + // Fallen Star + r = GetNewRecipe(); + r.AddIngredient(null, "Stardust", 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FallenStar); + r.AddRecipe(); + + // Ectoplasm from Ectoblood + r = GetNewRecipe(); + r.AddIngredient(null, "Ectoblood", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Ectoplasm); + r.AddRecipe(); + + // Rocket I from Empty Bullet + r = GetNewRecipe(); + r.AddIngredient(ItemID.EmptyBullet, 20); + r.AddIngredient(ItemID.ExplosivePowder, 1); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.RocketI, 20); + r.AddRecipe(); + + // Life Crystal + r = GetNewRecipe(); + r.AddIngredient(ItemID.Bone, 5); + r.AddIngredient(ItemID.PinkGel); + r.AddIngredient(ItemID.HealingPotion); + r.AddIngredient(ItemID.Ruby); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LifeCrystal); + r.AddRecipe(); + + // Life Fruit + r = GetNewRecipe(); + r.AddIngredient(null, "PlantyMush", 10); + r.AddIngredient(null, "LivingShard"); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.LifeFruit); + r.AddRecipe(); + + // Cooked Fish + r = GetNewRecipe(); + r.AddIngredient(null, "TwinklingPollox"); + r.AddTile(TileID.CookingPots); + r.SetResult(2425); + r.AddRecipe(); + + // Cooked Shrimp + r = GetNewRecipe(); + r.AddIngredient(null, "ProcyonidPrawn"); + r.AddTile(TileID.CookingPots); + r.SetResult(2426); + r.AddRecipe(); + } + + // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) + private static void EditTerraBladeRecipe() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.TerraBlade).ToList().ForEach(s => + { + for (int i = 0; i < s.requiredItem.Length; i++) + { + s.requiredItem[i] = new Item(); + } + s.requiredItem[0].SetDefaults(ItemID.TrueNightsEdge, false); + s.requiredItem[0].stack = 1; + s.requiredItem[1].SetDefaults(ItemID.TrueExcalibur, false); + s.requiredItem[1].stack = 1; + s.requiredItem[2].SetDefaults(ModContent.GetInstance().ItemType("LivingShard"), false); + s.requiredItem[2].stack = 7; + + s.createItem.SetDefaults(ItemID.TerraBlade, false); + s.createItem.stack = 1; + }); + } + + #region Potions + // Equivalent Blood Orb recipes for almost all vanilla potions + private static void AddPotionRecipes() + { + short[] potions = new[] + { + ItemID.WormholePotion, + ItemID.TeleportationPotion, + ItemID.SwiftnessPotion, + ItemID.FeatherfallPotion, + ItemID.GravitationPotion, + ItemID.ShinePotion, + ItemID.InvisibilityPotion, + ItemID.NightOwlPotion, + ItemID.SpelunkerPotion, + ItemID.HunterPotion, + ItemID.TrapsightPotion, + ItemID.BattlePotion, + ItemID.CalmingPotion, + ItemID.WrathPotion, + ItemID.RagePotion, + ItemID.ThornsPotion, + ItemID.IronskinPotion, + ItemID.EndurancePotion, + ItemID.RegenerationPotion, + ItemID.LifeforcePotion, + ItemID.HeartreachPotion, + ItemID.TitanPotion, + ItemID.ArcheryPotion, + ItemID.AmmoReservationPotion, + ItemID.MagicPowerPotion, + ItemID.ManaRegenerationPotion, + ItemID.SummoningPotion, + ItemID.InfernoPotion, + ItemID.WarmthPotion, + ItemID.ObsidianSkinPotion, + ItemID.GillsPotion, + ItemID.WaterWalkingPotion, + ItemID.FlipperPotion, + ItemID.BuilderPotion, + ItemID.MiningPotion, + ItemID.FishingPotion, + ItemID.CratePotion, + ItemID.SonarPotion, + ItemID.GenderChangePotion, + ItemID.LovePotion, + ItemID.StinkPotion + }; + ModRecipe r; + + foreach (var potion in potions) + { + r = GetNewRecipe(); + r.AddIngredient(null, "BloodOrb", 10); + r.AddIngredient(ItemID.BottledWater); + r.AddTile(TileID.AlchemyTable); + r.SetResult(potion); + r.AddRecipe(); + } + } + #endregion + + #region Tools + // Essential tools such as the Magic Mirror and Rod of Discord + private static void AddToolRecipes() + { + // Magic Mirror + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar, 10); + r.AddIngredient(ItemID.Glass, 10); + r.AddIngredient(ItemID.FallenStar, 10); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.MagicMirror); + r.AddRecipe(); + + // Ice Mirror + r = GetNewRecipe(); + r.AddIngredient(ItemID.IceBlock, 20); + r.AddIngredient(ItemID.Glass, 10); + r.AddIngredient(ItemID.FallenStar, 10); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.IceMirror); + r.AddRecipe(); + + // Shadow Key + r = GetNewRecipe(); + r.AddIngredient(ItemID.GoldenKey); + r.AddIngredient(ItemID.Obsidian, 20); + r.AddIngredient(ItemID.Bone, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.ShadowKey); + r.AddRecipe(); + + // Rod of Discord + r = GetNewRecipe(); + r.AddIngredient(ItemID.SoulofLight, 30); + r.AddIngredient(ItemID.ChaosFish, 5); + r.AddIngredient(ItemID.PixieDust, 50); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.RodofDiscord); + r.AddRecipe(); + + // Sky Mill + r = GetNewRecipe(); + r.AddIngredient(ItemID.SunplateBlock, 10); + r.AddIngredient(ItemID.Cloud, 5); + r.AddIngredient(ItemID.RainCloud, 3); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.SkyMill); + r.AddRecipe(); + + // Ice Machine + r = GetNewRecipe(); + r.AddIngredient(ItemID.IceBlock, 25); + r.AddIngredient(ItemID.SnowBlock, 15); + r.AddIngredient(ItemID.IronBar, 3); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.IceMachine); + r.AddRecipe(); + } + #endregion + + #region ProgressionItems + // Boss summon and progression items + private static void AddProgressionRecipes() + { + // Guide Voodoo Doll + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 2); + r.AddIngredient(null, "FetidEssence", 2); + r.AddTile(TileID.Hellforge); + r.SetResult(ItemID.GuideVoodooDoll); + r.AddRecipe(); + + r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 2); + r.AddIngredient(null, "BloodlettingEssence", 2); + r.AddTile(TileID.Hellforge); + r.SetResult(ItemID.GuideVoodooDoll); + r.AddRecipe(); + + // Temple Key + r = GetNewRecipe(); + r.AddIngredient(ItemID.JungleSpores, 15); + r.AddIngredient(ItemID.RichMahogany, 15); + r.AddIngredient(ItemID.SoulofNight, 15); + r.AddIngredient(ItemID.SoulofLight, 15); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.TempleKey); + r.AddRecipe(); + + // Lihzahrd Power Cell (NOT Calamity's Old Power Cell) + r = GetNewRecipe(); + r.AddIngredient(ItemID.LihzahrdBrick, 15); + r.AddIngredient(null, "CoreofCinder"); + r.AddTile(TileID.LihzahrdFurnace); + r.SetResult(ItemID.LihzahrdPowerCell); + r.AddRecipe(); + + // Truffle Worm + r = GetNewRecipe(); + r.AddIngredient(ItemID.GlowingMushroom, 15); + r.AddIngredient(ItemID.Worm); + r.AddTile(TileID.Autohammer); + r.SetResult(ItemID.TruffleWorm); + r.AddRecipe(); + } + #endregion + + #region EarlyGameWeapons + // Early game weapons such as Enchanted Sword + private static void AddEarlyGameWeaponRecipes() + { + // Shuriken + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Shuriken, 50); + r.AddRecipe(); + + // Throwing Knife + r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.ThrowingKnife, 50); + r.AddRecipe(); + + // Wand of Sparking + r = GetNewRecipe(); + r.AddIngredient(ItemID.Wood, 5); + r.AddIngredient(ItemID.Torch, 3); + r.AddIngredient(ItemID.FallenStar); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.WandofSparking); + r.AddRecipe(); + + // Starfury w/ Gold Broadsword + r = GetNewRecipe(); + r.AddIngredient(ItemID.GoldBroadsword); + r.AddIngredient(ItemID.FallenStar, 10); + r.AddIngredient(null, "VictoryShard", 3); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Starfury); + r.AddRecipe(); + + // Starfury w/ Platinum Broadsword + r = GetNewRecipe(); + r.AddIngredient(ItemID.PlatinumBroadsword); + r.AddIngredient(ItemID.FallenStar, 10); + r.AddIngredient(null, "VictoryShard", 3); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Starfury); + r.AddRecipe(); + + // Enchanted Sword (requires Hardmode materials) + r = GetNewRecipe(); + r.AddIngredient(null, "VictoryShard", 10); + r.AddIngredient(ItemID.SoulofLight, 15); + r.AddIngredient(ItemID.UnicornHorn, 3); + r.AddIngredient(ItemID.LightShard); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.EnchantedSword); + r.AddRecipe(); + + // Muramasa w/ Cobalt Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.CobaltBar, 15); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Muramasa); + r.AddRecipe(); + + // Muramasa w/ Palladium Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.PalladiumBar, 15); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Muramasa); + r.AddRecipe(); + } + #endregion + + #region EarlyGameAccessories + // Early game accessories such as Cloud in a Bottle + private static void AddEarlyGameAccessoryRecipes() + { + // Cloud in a Bottle + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.Feather, 2); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(ItemID.Cloud, 25); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.CloudinaBottle); + r.AddRecipe(); + + // Hermes Boots + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 10); + r.AddTile(TileID.Loom); + r.SetResult(ItemID.HermesBoots); + r.AddRecipe(); + + // Blizzard in a Bottle + r = GetNewRecipe(); + r.AddIngredient(ItemID.Feather, 4); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(ItemID.SnowBlock, 50); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.BlizzardinaBottle); + r.AddRecipe(); + + // Sandstorm in a Bottle + r = GetNewRecipe(); + r.AddIngredient(null, "DesertFeather", 10); + r.AddIngredient(ItemID.Feather, 6); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(ItemID.SandBlock, 70); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.SandstorminaBottle); + r.AddRecipe(); + + // Frog Leg + r = GetNewRecipe(); + r.AddIngredient(ItemID.Frog, 10); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.FrogLeg); + r.AddRecipe(); + + // Flying Carpet + r = GetNewRecipe(); + r.AddIngredient(ItemID.AncientCloth, 10); + r.AddIngredient(ItemID.SoulofLight, 10); + r.AddIngredient(ItemID.SoulofNight, 10); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FlyingCarpet); + r.AddRecipe(); + + // Aglet + r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Aglet); + r.AddRecipe(); + + // Anklet of the Wind + r = GetNewRecipe(); + r.AddIngredient(ItemID.JungleSpores, 15); + r.AddIngredient(ItemID.Cloud, 15); + r.AddIngredient(ItemID.PinkGel, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.AnkletoftheWind); + r.AddRecipe(); + + // Water Walking Boots + r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 5); + r.AddIngredient(ItemID.WaterWalkingPotion, 8); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.WaterWalkingBoots); + r.AddRecipe(); + + // Ice Skates + r = GetNewRecipe(); + r.AddIngredient(ItemID.IceBlock, 20); + r.AddIngredient(ItemID.Leather, 5); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.IceSkates); + r.AddRecipe(); + + // Lucky Horseshoe w/ Gold Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.SunplateBlock, 10); + r.AddIngredient(ItemID.Cloud, 10); + r.AddIngredient(ItemID.GoldBar, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LuckyHorseshoe); + r.AddRecipe(); + + // Lucky Horseshoe w/ Platinum Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.SunplateBlock, 10); + r.AddIngredient(ItemID.Cloud, 10); + r.AddIngredient(ItemID.PlatinumBar, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LuckyHorseshoe); + r.AddRecipe(); + + // Shiny Red Balloon + r = GetNewRecipe(); + r.AddIngredient(ItemID.WhiteString); + r.AddIngredient(ItemID.Gel, 80); + r.AddIngredient(ItemID.Cloud, 40); + r.AddTile(TileID.Solidifier); + r.SetResult(ItemID.ShinyRedBalloon); + r.AddRecipe(); + + // Lava Charm + r = GetNewRecipe(); + r.AddIngredient(ItemID.LavaBucket, 5); + r.AddIngredient(ItemID.Obsidian, 25); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LavaCharm); + r.AddRecipe(); + + // Feral Claws + r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 10); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.FeralClaws); + r.AddRecipe(); + + // Radar + r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Radar); + r.AddRecipe(); + } + #endregion + + #region AnkhShield + // Every base component for the Ankh Shield + private static void AddAnkhShieldRecipes() + { + // Cobalt Shield w/ Cobalt + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.CobaltBar, 10); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.CobaltShield); + r.AddRecipe(); + + // Cobalt Shield w/ Palladium + r = GetNewRecipe(); + r.AddIngredient(ItemID.PalladiumBar, 10); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.CobaltShield); + r.AddRecipe(); + + // Armor Polish (broken armor) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Bone, 50); + r.AddIngredient(null, "AncientBoneDust", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.ArmorPolish); + r.AddRecipe(); + + // Adhesive Bandage (bleeding) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 10); + r.AddIngredient(ItemID.Gel, 50); + r.AddIngredient(ItemID.GreaterHealingPotion); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.AdhesiveBandage); + r.AddRecipe(); + + // Bezoar (poison) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Stinger, 15); + r.AddIngredient(null, "MurkyPaste"); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Bezoar); + r.AddRecipe(); + + // Nazar (curse) + r = GetNewRecipe(); + r.AddIngredient(ItemID.SoulofNight, 20); + r.AddIngredient(ItemID.Lens, 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Nazar); + r.AddRecipe(); + + // Vitamins (weakness) + r = GetNewRecipe(); + r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(ItemID.Waterleaf, 5); + r.AddIngredient(ItemID.Blinkroot, 5); + r.AddIngredient(ItemID.Daybloom, 5); + r.AddIngredient(null, "BeetleJuice", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Vitamins); + r.AddRecipe(); + + // Blindfold (darkness) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 30); + r.AddIngredient(ItemID.SoulofNight, 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Blindfold); + r.AddRecipe(); + + // Trifold Map (confusion) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 20); + r.AddIngredient(ItemID.SoulofLight, 3); + r.AddIngredient(ItemID.SoulofNight, 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.TrifoldMap); + r.AddRecipe(); + + // Fast Clock (slow) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Timer1Second); + r.AddIngredient(ItemID.PixieDust, 15); + r.AddIngredient(ItemID.SoulofLight, 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FastClock); + r.AddRecipe(); + + // Megaphone (silence) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Wire, 10); + r.AddIngredient(ItemID.HallowedBar, 5); + r.AddIngredient(ItemID.Ruby, 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Megaphone); + r.AddRecipe(); + } + #endregion + + #region HardmodeEquipment + // Alternate recipes for vanilla Hardmode equipment + private static void AddAlternateHardmodeRecipes() + { + // Avenger Emblem made with Rogue Emblem + ModRecipe r = GetNewRecipe(); + r.AddIngredient(null, "RogueEmblem"); + r.AddIngredient(ItemID.SoulofMight, 5); + r.AddIngredient(ItemID.SoulofSight, 5); + r.AddIngredient(ItemID.SoulofFright, 5); + r.AddTile(TileID.TinkerersWorkbench); + r.SetResult(ItemID.AvengerEmblem); + r.AddRecipe(); + + // Celestial Magnet + r = GetNewRecipe(); + r.AddIngredient(ItemID.FallenStar, 20); + r.AddIngredient(ItemID.SoulofMight, 10); + r.AddIngredient(ItemID.SoulofLight, 5); + r.AddIngredient(ItemID.SoulofNight, 5); + r.AddIngredient(null, "CryoBar", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.CelestialMagnet); + r.AddRecipe(); + + // Frozen Turtle Shell + r = GetNewRecipe(); + r.AddIngredient(ItemID.TurtleShell, 3); + r.AddIngredient(null, "EssenceofEleum", 9); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FrozenTurtleShell); + r.AddRecipe(); + + // Frost Helmet w/ Frigid Bars + r = GetNewRecipe(); + r.AddIngredient(null, "CryoBar", 6); + r.AddIngredient(ItemID.FrostCore); + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.FrostHelmet); + r.AddRecipe(); + + // Frost Breastplate w/ Frigid Bars + r = GetNewRecipe(); + r.AddIngredient(null, "CryoBar", 10); + r.AddIngredient(ItemID.FrostCore); + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.FrostBreastplate); + r.AddRecipe(); + + // Frost Leggings w/ Frigid Bars + r = GetNewRecipe(); + r.AddIngredient(null, "CryoBar", 8); + r.AddIngredient(ItemID.FrostCore); + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.FrostLeggings); + r.AddRecipe(); + + // Terra Blade w/ True Bloody Edge + r = GetNewRecipe(); + r.AddIngredient(null, "TrueBloodyEdge"); + r.AddIngredient(ItemID.TrueExcalibur); + r.AddIngredient(null, "LivingShard", 7); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.TerraBlade); + r.AddRecipe(); + } + #endregion + + public static void AddRecipeGroups() + { + RecipeGroup group = new RecipeGroup(() => "Any Silt", new int[] + { + ItemID.SiltBlock, + ItemID.SlushBlock + }); + RecipeGroup.RegisterGroup("SiltGroup", group); + + group = new RecipeGroup(() => "Any Lunar Pickaxe", new int[] + { + ItemID.SolarFlarePickaxe, + ItemID.VortexPickaxe, + ItemID.NebulaPickaxe, + ItemID.StardustPickaxe + }); + RecipeGroup.RegisterGroup("LunarPickaxe", group); + + group = new RecipeGroup(() => "Any Lunar Hamaxe", new int[] + { + ItemID.LunarHamaxeSolar, + ItemID.LunarHamaxeVortex, + ItemID.LunarHamaxeNebula, + ItemID.LunarHamaxeStardust + }); + RecipeGroup.RegisterGroup("LunarHamaxe", group); + + group = new RecipeGroup(() => "Any Wings", new int[] + { + ItemID.DemonWings, + ItemID.AngelWings, + ItemID.RedsWings, + ItemID.ButterflyWings, + ItemID.FairyWings, + ItemID.HarpyWings, + ItemID.BoneWings, + ItemID.FlameWings, + ItemID.FrozenWings, + ItemID.GhostWings, + ItemID.SteampunkWings, + ItemID.LeafWings, + ItemID.BatWings, + ItemID.BeeWings, + ItemID.DTownsWings, + ItemID.WillsWings, + ItemID.CrownosWings, + ItemID.CenxsWings, + ItemID.TatteredFairyWings, + ItemID.SpookyWings, + ItemID.Hoverboard, + ItemID.FestiveWings, + ItemID.BeetleWings, + ItemID.FinWings, + ItemID.FishronWings, + ItemID.MothronWings, + ItemID.WingsSolar, + ItemID.WingsVortex, + ItemID.WingsNebula, + ItemID.WingsStardust, + ItemID.Yoraiz0rWings, + ItemID.JimsWings, + ItemID.SkiphsWings, + ItemID.LokisWings, + ItemID.BetsyWings, + ItemID.ArkhalisWings, + ItemID.LeinforsWings, + ModContent.GetInstance().ItemType("SkylineWings"), + ModContent.GetInstance().ItemType("StarlightWings"), + ModContent.GetInstance().ItemType("AureateWings"), + ModContent.GetInstance().ItemType("DiscordianWings"), + ModContent.GetInstance().ItemType("TarragonWings"), + ModContent.GetInstance().ItemType("XerocWings"), + ModContent.GetInstance().ItemType("HadarianWings") + }); + RecipeGroup.RegisterGroup("WingsGroup", group); + } + } } diff --git a/Utilities/CustomTileFraming.cs b/Utilities/CustomTileFraming.cs index 59809ddff5..75ab3a7b24 100644 --- a/Utilities/CustomTileFraming.cs +++ b/Utilities/CustomTileFraming.cs @@ -1,11 +1,10 @@ -using System.Collections.Generic; +using CalamityMod.Tiles; +using System.Collections.Generic; using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Tiles; - namespace CalamityMod.Utilities { public static class CustomTileFraming @@ -76,7 +75,8 @@ namespace CalamityMod.Utilities private static bool PlantNeedsUpdate(int plantType, int checkType) { - if (PlantCheckAgainst[plantType] == null) return false; + if (PlantCheckAgainst[plantType] == null) + return false; int size = PlantCheckAgainst[plantType].Length; for (int i = 0; i < size; i++) { @@ -101,7 +101,8 @@ namespace CalamityMod.Utilities if (y + 1 < Main.maxTilesY && below != null && below.nactive() && !below.halfBrick() && below.slope() == 0) checkType = below.type; - if (checkType == -1) return; + if (checkType == -1) + return; //Check if this plant needs an update if (PlantNeedsUpdate(plantType, checkType)) @@ -968,13 +969,17 @@ namespace CalamityMod.Utilities //CARDINAL Similarity leftSim = GetSimilarity(tileLeft, myType, mergeType); - if (forceSameLeft) leftSim = Similarity.Same; + if (forceSameLeft) + leftSim = Similarity.Same; Similarity rightSim = GetSimilarity(tileRight, myType, mergeType); - if (forceSameRight) rightSim = Similarity.Same; + if (forceSameRight) + rightSim = Similarity.Same; Similarity upSim = GetSimilarity(tileUp, myType, mergeType); - if (forceSameUp) upSim = Similarity.Same; + if (forceSameUp) + upSim = Similarity.Same; Similarity downSim = GetSimilarity(tileDown, myType, mergeType); - if (forceSameDown) downSim = Similarity.Same; + if (forceSameDown) + downSim = Similarity.Same; //DIAGONAL Similarity topLeftSim = GetSimilarity(tileTopLeft, myType, mergeType); @@ -1559,7 +1564,8 @@ namespace CalamityMod.Utilities private static Similarity GetSimilarity(Tile check, int myType, int mergeType) { - if (!check.active()) return Similarity.None; + if (!check.active()) + return Similarity.None; if (check.type == myType || Main.tileMerge[myType][check.type]) return Similarity.Same; diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 1d3a880626..ce952fbe14 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,748 +1,748 @@ -using System.Collections.Generic; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; namespace CalamityMod.Utilities { - public class DropHelper - { - #region Global Drop Chances - /// - /// The Defiled Rune boosts various low drop rates to one in this value. - /// - public static readonly int DefiledDropRateInt = 20; - - /// - /// The Defiled Rune boosts various low drop rates to this chance (decimal number out of 1.0). - /// - public static readonly float DefiledDropRateFloat = 0.05f; - - /// - /// Legendary drops have a 1 in X chance of dropping, where X is this variable. - /// - public static readonly int LegendaryDropRateInt = 100; - - /// - /// Legendary weapons have this chance to drop (decimal number out of 1.0). - /// - public static readonly float LegendaryDropRateFloat = 0.01f; - - /// - /// Rare Item Variants have a 1 in X chance of dropping, where X is this variable. - /// - public static readonly int RareVariantDropRateInt = 40; - - /// - /// Rare Item Variants have this chance to drop (decimal number out of 1.0). - /// - public static readonly float RareVariantDropRateFloat = 0.025f; - #endregion - - #region Extra Boss Bags - /// - /// The number of extra loot bags bosses drop when Revengeance Mode is active.

    - /// This is normally zero; Revengenace Mode provides no extra bags. - ///
    - public static int RevExtraBags = 0; - - /// - /// The number of extra loot bags bosses drop when Death Mode is active.

    - /// This is normally zero; Death Mode provides no extra bags. - ///
    - public static int DeathExtraBags = 0; - - /// - /// The number of extra loot bags bosses drop when the Defiled Rune is active.

    - /// This is normally zero; Defiled Rune provides no extra bags. - ///
    - public static int DefiledExtraBags = 0; - - /// - /// The number of extra loot bags bosses drop when Armageddon is active.

    - /// This is normally 5. Bosses drop 5 bags on normal, and 6 on Expert+. - ///
    - public static int ArmageddonExtraBags = 5; - #endregion - - #region Boss Bag Drop Helpers - /// - /// Automatically drops the correct number of boss bags for each difficulty based on constants kept in DropHelper. - /// - /// The NPC to drop boss bags for. - /// The number of boss bags dropped. - public static int DropBags(NPC theBoss) - { - int bagsDropped = 0; - - // Don't drop any bags for an invalid NPC. - if (theBoss is null) - return bagsDropped; - - // Armageddon's bonus bags drop even on Normal. - bagsDropped += DropArmageddonBags(theBoss); - - // If the difficulty isn't Expert+, no more bags are dropped. - if (!Main.expertMode) - return bagsDropped; - - // Drop the 1 vanilla Expert Mode boss bag. - theBoss.DropBossBags(); - bagsDropped++; - - // If Rev is active, possibly drop extra bags. - if (CalamityWorld.revenge) - { - for (int i = 0; i < RevExtraBags; ++i) - theBoss.DropBossBags(); - - bagsDropped += RevExtraBags; - } - - // If Death is active, possibly drop extra bags. - if (CalamityWorld.death) - { - for (int i = 0; i < DeathExtraBags; ++i) - theBoss.DropBossBags(); - - bagsDropped += DeathExtraBags; - } - - // If Defiled is active, possibly drop extra bags. - if (CalamityWorld.defiled) - { - for (int i = 0; i < DefiledExtraBags; ++i) - theBoss.DropBossBags(); - - bagsDropped += DefiledExtraBags; - } - - return bagsDropped; - } - - /// - /// Drops the correct number of boss bags for Armageddon. - /// - /// The NPC to drop boss bags for. - /// The number of boss bags dropped. - public static int DropArmageddonBags(NPC theBoss) - { - if (!CalamityWorld.armageddon) - return 0; - - for (int i = 0; i < ArmageddonExtraBags; ++i) - theBoss.DropBossBags(); - return ArmageddonExtraBags; - } - #endregion - - #region Specific Drop Helpers - /// - /// Finds the worm segment nearest to an NPC's target by combing the NPC array for the closest NPC that is one of the specified types.

    - /// Return the specified NPC's index if no matching worm segment was found. - ///
    - /// The NPC whose target is used for distance comparisons. - /// An array (or multiple parameters) of NPC IDs which are the worm segments to look for. - /// An index in the NPC array of the closest worm segment, or the specified NPC's index. - public static int FindClosestWormSegment(NPC wormHead, params int[] wormSegmentIDs) - { - List idsToCheck = new List(wormSegmentIDs); - Vector2 playerPos = Main.player[wormHead.target].Center; - - int r = wormHead.whoAmI; - float minDist = 1E+06f; - for (int i = 0; i < Main.npc.Length; ++i) - { - NPC n = Main.npc[i]; - if (n != null && n.active && idsToCheck.Contains(n.type)) - { - float dist = (n.Center - playerPos).Length(); - if (dist < minDist) - { - minDist = dist; - r = i; - } - } - } - return r; - } - - public static bool DropRevBagAccessories(Player p) - { - CalamityMod mod = ModContent.GetInstance(); - return DropItemFromSetCondition(p, CalamityWorld.revenge, 0.05f, mod.ItemType("StressPills"), mod.ItemType("Laudanum"), mod.ItemType("HeartofDarkness")); - } - - /// - /// Drops finite use "Resident Evil" ammunition from the given NPC, if the downed boolean isn't already true. - /// - /// The NPC to drop ammo from. - /// A downed boolean corresponding to this NPC. Use "false" to always drop ammo. - /// The number of Magnum Rounds to drop. - /// The number of Grenade Rounds to drop. - /// The number of Explosive Shells to drop. - /// - public static int DropResidentEvilAmmo(NPC theBoss, bool alreadyKilled, int magnum, int bazooka, int hydra) - { - if (alreadyKilled) - return 0; - - CalamityMod mod = ModContent.GetInstance(); - int dropped = 0; - dropped += DropItem(theBoss, mod.ItemType("MagnumRounds"), magnum); - dropped += DropItem(theBoss, mod.ItemType("GrenadeRounds"), bazooka); - dropped += DropItem(theBoss, mod.ItemType("ExplosiveShells"), hydra); - return dropped; - } - - /// - /// Randomly peppers stacks of 1 of the specified item all across the given NPC's hitbox.

    - /// Makes it appear as though the NPC "explodes" into a cloud of many identical items. Best used with floating items such as Souls. - ///
    - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items to place in each separate stack. - /// The number of items dropped. Not always equal to quantity if stack size isn't 1. - public static int DropItemSpray(NPC npc, int itemID, int minQuantity = 1, int maxQuantity = 0, int stackSize = 1) - { - int quantity; - - // If they're equal (or for some reason max is less??) then just drop the minimum amount. - if (maxQuantity <= minQuantity) - quantity = minQuantity; - - // Otherwise pick a random amount to drop, inclusive. - else - quantity = Main.rand.Next(minQuantity, maxQuantity + 1); - - int dropped = 0; - Vector2 pos = Vector2.Zero; - for (int i = 0; i < quantity; i += stackSize) - { - pos.X = Main.rand.NextFloat(npc.Hitbox.Left, npc.Hitbox.Right); - pos.Y = Main.rand.NextFloat(npc.Hitbox.Top, npc.Hitbox.Bottom); - Item.NewItem(pos, itemID, stackSize); - dropped += stackSize; - } - - return dropped; - } - #endregion - - #region NPC Item Drops 100% Chance - /// - /// Drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItem(NPC npc, int itemID, bool dropPerPlayer, int minQuantity = 1, int maxQuantity = 0) - { - int quantity; - - // If they're equal (or for some reason max is less??) then just drop the minimum amount. - if (maxQuantity <= minQuantity) - quantity = minQuantity; - - // Otherwise pick a random amount to drop, inclusive. - else - quantity = Main.rand.Next(minQuantity, maxQuantity + 1); - - // If the final quantity is 0 or less, don't bother. - if (quantity <= 0) - return 0; - - // If the drop is supposed to be instanced, drop it as such. - if (dropPerPlayer) - { - npc.DropItemInstanced(npc.position, npc.Size, itemID, quantity, true); - } - else - { - Item.NewItem(npc.Hitbox, itemID, quantity); - } - - return quantity; - } - - /// - /// Drops a stack of one or more items from the given NPC. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItem(NPC npc, int itemID, int minQuantity = 1, int maxQuantity = 0) - { - return DropItem(npc, itemID, false, minQuantity, maxQuantity); - } - #endregion - - #region NPC Item Drops Float Chance - /// - /// At a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// The chance that the items will drop. A decimal number <= 1.0. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemChance(NPC npc, int itemID, bool dropPerPlayer, float chance, int minQuantity = 1, int maxQuantity = 0) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.NextFloat() > chance) - return 0; - - return DropItem(npc, itemID, dropPerPlayer, minQuantity, maxQuantity); - } - - /// - /// At a chance, drops a stack of one or more items from the given NPC. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// The chance that the items will drop. A decimal number <= 1.0. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemChance(NPC npc, int itemID, float chance, int minQuantity = 1, int maxQuantity = 0) - { - return DropItemChance(npc, itemID, false, chance, minQuantity, maxQuantity); - } - #endregion - - #region NPC Item Drops Int Chance - /// - /// At a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemChance(NPC npc, int itemID, bool dropPerPlayer, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.Next(oneInXChance) != 0) - return 0; - - return DropItem(npc, itemID, dropPerPlayer, minQuantity, maxQuantity); - } - - /// - /// At a chance, drops a stack of one or more items from the given NPC. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemChance(NPC npc, int itemID, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - return DropItemChance(npc, itemID, false, oneInXChance, minQuantity, maxQuantity); - } - #endregion - - #region NPC Item Drops Conditional - /// - /// With a condition, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemCondition(NPC npc, int itemID, bool dropPerPlayer, bool condition, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItem(npc, itemID, dropPerPlayer, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition, drops a stack of one or more items from the given NPC. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemCondition(NPC npc, int itemID, bool condition, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItem(npc, itemID, false, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The chance that the items will drop. A decimal number <= 1.0. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemCondition(NPC npc, int itemID, bool dropPerPlayer, bool condition, float chance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(npc, itemID, dropPerPlayer, chance, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, drops a stack of one or more items from the given NPC. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The chance that the items will drop. A decimal number <= 1.0. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemCondition(NPC npc, int itemID, bool condition, float chance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(npc, itemID, false, chance, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemCondition(NPC npc, int itemID, bool dropPerPlayer, bool condition, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(npc, itemID, dropPerPlayer, oneInXChance, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, drops a stack of one or more items from the given NPC. - /// - /// The NPC which should drop the item(s). - /// The ID of the item(s) to drop. - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to drop. Defaults to 1. - /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items dropped. - public static int DropItemCondition(NPC npc, int itemID, bool condition, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(npc, itemID, false, oneInXChance, minQuantity, maxQuantity) : 0; - } - #endregion - - #region NPC Item Set Drops - /// - /// Chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - /// Whether an item was dropped. - public static bool DropItemFromSet(NPC npc, bool dropPerPlayer, params int[] itemIDs) - { - // Can't choose anything from an empty array. - if (itemIDs is null || itemIDs.Length == 0) - return false; - - // Choose which item to drop. - int itemID = Main.rand.Next(itemIDs); - - // If the drop is supposed to be instanced, drop it as such. - if (dropPerPlayer) - { - npc.DropItemInstanced(npc.position, npc.Size, itemID, 1, true); - } - else - { - Item.NewItem(npc.Hitbox, itemID); - } - - return true; - } - - /// - /// Chooses an item from an array and drops it from the given NPC. - /// - /// The NPC which should drop the item. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - /// Whether an item was dropped. - public static bool DropItemFromSet(NPC npc, params int[] itemIDs) - { - return DropItemFromSet(npc, false, itemIDs); - } - - /// - /// At a chance, chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// The chance that the item will drop. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - /// Whether an item was dropped. - public static bool DropItemFromSetChance(NPC npc, bool dropPerPlayer, float chance, params int[] itemIDs) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.NextFloat() > chance) - return false; - - return DropItemFromSet(npc, dropPerPlayer, itemIDs); - } - - /// - /// At a chance, chooses an item from an array and drops it from the given NPC. - /// - /// The NPC which should drop the item. - /// The chance that the item will drop. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - /// Whether an item was dropped. - public static bool DropItemFromSetChance(NPC npc, float chance, params int[] itemIDs) - { - return DropItemFromSetChance(npc, false, chance, itemIDs); - } - #endregion - - #region NPC Item Set Drops Conditional - /// - /// With a condition, chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - public static bool DropItemFromSetCondition(NPC npc, bool dropPerPlayer, bool condition, params int[] itemIDs) - { - return condition ? DropItemFromSet(npc, dropPerPlayer, itemIDs) : false; - } - - /// - /// With a condition, chooses an item from an array and drops it from the given NPC. - /// - /// The NPC which should drop the item. - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - public static bool DropItemFromSetCondition(NPC npc, bool condition, params int[] itemIDs) - { - return condition ? DropItemFromSet(npc, false, itemIDs) : false; - } - - /// - /// With a condition, chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. - /// - /// The NPC which should drop the item. - /// Whether the drop should be "instanced" (each player gets their own copy). - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The chance that the item will drop. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - public static bool DropItemFromSetCondition(NPC npc, bool dropPerPlayer, bool condition, float chance, params int[] itemIDs) - { - return condition ? DropItemFromSetChance(npc, dropPerPlayer, chance, itemIDs) : false; - } - - /// - /// With a condition, chooses an item from an array and drops it from the given NPC. - /// - /// The NPC which should drop the item. - /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. - /// The chance that the item will drop. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - public static bool DropItemFromSetCondition(NPC npc, bool condition, float chance, params int[] itemIDs) - { - return condition ? DropItemFromSetChance(npc, false, chance, itemIDs) : false; - } - #endregion - - #region Player Item Spawns - /// - /// Spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItem(Player p, int itemID, int minQuantity = 1, int maxQuantity = 0) - { - int quantity; - - // If they're equal (or for some reason max is less??) then just drop the minimum amount. - if (maxQuantity <= minQuantity) - quantity = minQuantity; - - // Otherwise pick a random amount to drop, inclusive. - else - quantity = Main.rand.Next(minQuantity, maxQuantity + 1); - - // If the final quantity is 0 or less, don't bother. - if (quantity <= 0) - return 0; - - p.QuickSpawnItem(itemID, quantity); - return quantity; - } - - /// - /// At a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// The chance that the items will spawn. A decimal number <= 1.0. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemChance(Player p, int itemID, float chance, int minQuantity = 1, int maxQuantity = 0) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.NextFloat() > chance) - return 0; - - return DropItem(p, itemID, minQuantity, maxQuantity); - } - - /// - /// At a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// The chance that the items will spawn is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemChance(Player p, int itemID, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.Next(oneInXChance) != 0) - return 0; - - return DropItem(p, itemID, minQuantity, maxQuantity); - } - #endregion - - #region Player Item Spawns Conditional - /// - /// With a condition, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemCondition(Player p, int itemID, bool condition, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItem(p, itemID, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The chance that the items will spawn. A decimal number <= 1.0. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemCondition(Player p, int itemID, bool condition, float chance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(p, itemID, chance, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The chance that the items will spawn is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemCondition(Player p, int itemID, bool condition, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(p, itemID, oneInXChance, minQuantity, maxQuantity) : 0; - } - #endregion - - #region Player Item Set Spawns - /// - /// Chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSet(Player p, params int[] itemIDs) - { - // Can't choose anything from an empty array. - if (itemIDs is null || itemIDs.Length == 0) - return false; - - // Choose which item to drop. - int itemID = Main.rand.Next(itemIDs); - - p.QuickSpawnItem(itemID); - return true; - } - - /// - /// At a chance, chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// The chance that the item will spawn. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSetChance(Player p, float chance, params int[] itemIDs) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.NextFloat() > chance) - return false; - - return DropItemFromSet(p, itemIDs); - } - #endregion - - #region Player Item Set Spawns Conditional - /// - /// With a condition, chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSetCondition(Player p, bool condition, params int[] itemIDs) - { - return condition ? DropItemFromSet(p, itemIDs) : false; - } - - /// - /// With a condition and at a chance, chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The chance that the items will spawn. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSetCondition(Player p, bool condition, float chance, params int[] itemIDs) - { - return condition ? DropItemFromSetChance(p, chance, itemIDs) : false; - } - #endregion - } + public class DropHelper + { + #region Global Drop Chances + /// + /// The Defiled Rune boosts various low drop rates to one in this value. + /// + public static readonly int DefiledDropRateInt = 20; + + /// + /// The Defiled Rune boosts various low drop rates to this chance (decimal number out of 1.0). + /// + public static readonly float DefiledDropRateFloat = 0.05f; + + /// + /// Legendary drops have a 1 in X chance of dropping, where X is this variable. + /// + public static readonly int LegendaryDropRateInt = 100; + + /// + /// Legendary weapons have this chance to drop (decimal number out of 1.0). + /// + public static readonly float LegendaryDropRateFloat = 0.01f; + + /// + /// Rare Item Variants have a 1 in X chance of dropping, where X is this variable. + /// + public static readonly int RareVariantDropRateInt = 40; + + /// + /// Rare Item Variants have this chance to drop (decimal number out of 1.0). + /// + public static readonly float RareVariantDropRateFloat = 0.025f; + #endregion + + #region Extra Boss Bags + /// + /// The number of extra loot bags bosses drop when Revengeance Mode is active.

    + /// This is normally zero; Revengenace Mode provides no extra bags. + ///
    + public static int RevExtraBags = 0; + + /// + /// The number of extra loot bags bosses drop when Death Mode is active.

    + /// This is normally zero; Death Mode provides no extra bags. + ///
    + public static int DeathExtraBags = 0; + + /// + /// The number of extra loot bags bosses drop when the Defiled Rune is active.

    + /// This is normally zero; Defiled Rune provides no extra bags. + ///
    + public static int DefiledExtraBags = 0; + + /// + /// The number of extra loot bags bosses drop when Armageddon is active.

    + /// This is normally 5. Bosses drop 5 bags on normal, and 6 on Expert+. + ///
    + public static int ArmageddonExtraBags = 5; + #endregion + + #region Boss Bag Drop Helpers + /// + /// Automatically drops the correct number of boss bags for each difficulty based on constants kept in DropHelper. + /// + /// The NPC to drop boss bags for. + /// The number of boss bags dropped. + public static int DropBags(NPC theBoss) + { + int bagsDropped = 0; + + // Don't drop any bags for an invalid NPC. + if (theBoss is null) + return bagsDropped; + + // Armageddon's bonus bags drop even on Normal. + bagsDropped += DropArmageddonBags(theBoss); + + // If the difficulty isn't Expert+, no more bags are dropped. + if (!Main.expertMode) + return bagsDropped; + + // Drop the 1 vanilla Expert Mode boss bag. + theBoss.DropBossBags(); + bagsDropped++; + + // If Rev is active, possibly drop extra bags. + if (CalamityWorld.revenge) + { + for (int i = 0; i < RevExtraBags; ++i) + theBoss.DropBossBags(); + + bagsDropped += RevExtraBags; + } + + // If Death is active, possibly drop extra bags. + if (CalamityWorld.death) + { + for (int i = 0; i < DeathExtraBags; ++i) + theBoss.DropBossBags(); + + bagsDropped += DeathExtraBags; + } + + // If Defiled is active, possibly drop extra bags. + if (CalamityWorld.defiled) + { + for (int i = 0; i < DefiledExtraBags; ++i) + theBoss.DropBossBags(); + + bagsDropped += DefiledExtraBags; + } + + return bagsDropped; + } + + /// + /// Drops the correct number of boss bags for Armageddon. + /// + /// The NPC to drop boss bags for. + /// The number of boss bags dropped. + public static int DropArmageddonBags(NPC theBoss) + { + if (!CalamityWorld.armageddon) + return 0; + + for (int i = 0; i < ArmageddonExtraBags; ++i) + theBoss.DropBossBags(); + return ArmageddonExtraBags; + } + #endregion + + #region Specific Drop Helpers + /// + /// Finds the worm segment nearest to an NPC's target by combing the NPC array for the closest NPC that is one of the specified types.

    + /// Return the specified NPC's index if no matching worm segment was found. + ///
    + /// The NPC whose target is used for distance comparisons. + /// An array (or multiple parameters) of NPC IDs which are the worm segments to look for. + /// An index in the NPC array of the closest worm segment, or the specified NPC's index. + public static int FindClosestWormSegment(NPC wormHead, params int[] wormSegmentIDs) + { + List idsToCheck = new List(wormSegmentIDs); + Vector2 playerPos = Main.player[wormHead.target].Center; + + int r = wormHead.whoAmI; + float minDist = 1E+06f; + for (int i = 0; i < Main.npc.Length; ++i) + { + NPC n = Main.npc[i]; + if (n != null && n.active && idsToCheck.Contains(n.type)) + { + float dist = (n.Center - playerPos).Length(); + if (dist < minDist) + { + minDist = dist; + r = i; + } + } + } + return r; + } + + public static bool DropRevBagAccessories(Player p) + { + CalamityMod mod = ModContent.GetInstance(); + return DropItemFromSetCondition(p, CalamityWorld.revenge, 0.05f, mod.ItemType("StressPills"), mod.ItemType("Laudanum"), mod.ItemType("HeartofDarkness")); + } + + /// + /// Drops finite use "Resident Evil" ammunition from the given NPC, if the downed boolean isn't already true. + /// + /// The NPC to drop ammo from. + /// A downed boolean corresponding to this NPC. Use "false" to always drop ammo. + /// The number of Magnum Rounds to drop. + /// The number of Grenade Rounds to drop. + /// The number of Explosive Shells to drop. + /// + public static int DropResidentEvilAmmo(NPC theBoss, bool alreadyKilled, int magnum, int bazooka, int hydra) + { + if (alreadyKilled) + return 0; + + CalamityMod mod = ModContent.GetInstance(); + int dropped = 0; + dropped += DropItem(theBoss, mod.ItemType("MagnumRounds"), magnum); + dropped += DropItem(theBoss, mod.ItemType("GrenadeRounds"), bazooka); + dropped += DropItem(theBoss, mod.ItemType("ExplosiveShells"), hydra); + return dropped; + } + + /// + /// Randomly peppers stacks of 1 of the specified item all across the given NPC's hitbox.

    + /// Makes it appear as though the NPC "explodes" into a cloud of many identical items. Best used with floating items such as Souls. + ///
    + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items to place in each separate stack. + /// The number of items dropped. Not always equal to quantity if stack size isn't 1. + public static int DropItemSpray(NPC npc, int itemID, int minQuantity = 1, int maxQuantity = 0, int stackSize = 1) + { + int quantity; + + // If they're equal (or for some reason max is less??) then just drop the minimum amount. + if (maxQuantity <= minQuantity) + quantity = minQuantity; + + // Otherwise pick a random amount to drop, inclusive. + else + quantity = Main.rand.Next(minQuantity, maxQuantity + 1); + + int dropped = 0; + Vector2 pos = Vector2.Zero; + for (int i = 0; i < quantity; i += stackSize) + { + pos.X = Main.rand.NextFloat(npc.Hitbox.Left, npc.Hitbox.Right); + pos.Y = Main.rand.NextFloat(npc.Hitbox.Top, npc.Hitbox.Bottom); + Item.NewItem(pos, itemID, stackSize); + dropped += stackSize; + } + + return dropped; + } + #endregion + + #region NPC Item Drops 100% Chance + /// + /// Drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItem(NPC npc, int itemID, bool dropPerPlayer, int minQuantity = 1, int maxQuantity = 0) + { + int quantity; + + // If they're equal (or for some reason max is less??) then just drop the minimum amount. + if (maxQuantity <= minQuantity) + quantity = minQuantity; + + // Otherwise pick a random amount to drop, inclusive. + else + quantity = Main.rand.Next(minQuantity, maxQuantity + 1); + + // If the final quantity is 0 or less, don't bother. + if (quantity <= 0) + return 0; + + // If the drop is supposed to be instanced, drop it as such. + if (dropPerPlayer) + { + npc.DropItemInstanced(npc.position, npc.Size, itemID, quantity, true); + } + else + { + Item.NewItem(npc.Hitbox, itemID, quantity); + } + + return quantity; + } + + /// + /// Drops a stack of one or more items from the given NPC. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItem(NPC npc, int itemID, int minQuantity = 1, int maxQuantity = 0) + { + return DropItem(npc, itemID, false, minQuantity, maxQuantity); + } + #endregion + + #region NPC Item Drops Float Chance + /// + /// At a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// The chance that the items will drop. A decimal number <= 1.0. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemChance(NPC npc, int itemID, bool dropPerPlayer, float chance, int minQuantity = 1, int maxQuantity = 0) + { + // If you fail the roll to get the drop, stop immediately. + if (Main.rand.NextFloat() > chance) + return 0; + + return DropItem(npc, itemID, dropPerPlayer, minQuantity, maxQuantity); + } + + /// + /// At a chance, drops a stack of one or more items from the given NPC. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// The chance that the items will drop. A decimal number <= 1.0. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemChance(NPC npc, int itemID, float chance, int minQuantity = 1, int maxQuantity = 0) + { + return DropItemChance(npc, itemID, false, chance, minQuantity, maxQuantity); + } + #endregion + + #region NPC Item Drops Int Chance + /// + /// At a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemChance(NPC npc, int itemID, bool dropPerPlayer, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) + { + // If you fail the roll to get the drop, stop immediately. + if (Main.rand.Next(oneInXChance) != 0) + return 0; + + return DropItem(npc, itemID, dropPerPlayer, minQuantity, maxQuantity); + } + + /// + /// At a chance, drops a stack of one or more items from the given NPC. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemChance(NPC npc, int itemID, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) + { + return DropItemChance(npc, itemID, false, oneInXChance, minQuantity, maxQuantity); + } + #endregion + + #region NPC Item Drops Conditional + /// + /// With a condition, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemCondition(NPC npc, int itemID, bool dropPerPlayer, bool condition, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItem(npc, itemID, dropPerPlayer, minQuantity, maxQuantity) : 0; + } + + /// + /// With a condition, drops a stack of one or more items from the given NPC. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemCondition(NPC npc, int itemID, bool condition, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItem(npc, itemID, false, minQuantity, maxQuantity) : 0; + } + + /// + /// With a condition and at a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The chance that the items will drop. A decimal number <= 1.0. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemCondition(NPC npc, int itemID, bool dropPerPlayer, bool condition, float chance, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItemChance(npc, itemID, dropPerPlayer, chance, minQuantity, maxQuantity) : 0; + } + + /// + /// With a condition and at a chance, drops a stack of one or more items from the given NPC. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The chance that the items will drop. A decimal number <= 1.0. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemCondition(NPC npc, int itemID, bool condition, float chance, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItemChance(npc, itemID, false, chance, minQuantity, maxQuantity) : 0; + } + + /// + /// With a condition and at a chance, drops a stack of one or more items from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemCondition(NPC npc, int itemID, bool dropPerPlayer, bool condition, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItemChance(npc, itemID, dropPerPlayer, oneInXChance, minQuantity, maxQuantity) : 0; + } + + /// + /// With a condition and at a chance, drops a stack of one or more items from the given NPC. + /// + /// The NPC which should drop the item(s). + /// The ID of the item(s) to drop. + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The chance that the items will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items dropped. + public static int DropItemCondition(NPC npc, int itemID, bool condition, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItemChance(npc, itemID, false, oneInXChance, minQuantity, maxQuantity) : 0; + } + #endregion + + #region NPC Item Set Drops + /// + /// Chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + /// Whether an item was dropped. + public static bool DropItemFromSet(NPC npc, bool dropPerPlayer, params int[] itemIDs) + { + // Can't choose anything from an empty array. + if (itemIDs is null || itemIDs.Length == 0) + return false; + + // Choose which item to drop. + int itemID = Main.rand.Next(itemIDs); + + // If the drop is supposed to be instanced, drop it as such. + if (dropPerPlayer) + { + npc.DropItemInstanced(npc.position, npc.Size, itemID, 1, true); + } + else + { + Item.NewItem(npc.Hitbox, itemID); + } + + return true; + } + + /// + /// Chooses an item from an array and drops it from the given NPC. + /// + /// The NPC which should drop the item. + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + /// Whether an item was dropped. + public static bool DropItemFromSet(NPC npc, params int[] itemIDs) + { + return DropItemFromSet(npc, false, itemIDs); + } + + /// + /// At a chance, chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// The chance that the item will drop. A decimal number <= 1.0. + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + /// Whether an item was dropped. + public static bool DropItemFromSetChance(NPC npc, bool dropPerPlayer, float chance, params int[] itemIDs) + { + // If you fail the roll to get the drop, stop immediately. + if (Main.rand.NextFloat() > chance) + return false; + + return DropItemFromSet(npc, dropPerPlayer, itemIDs); + } + + /// + /// At a chance, chooses an item from an array and drops it from the given NPC. + /// + /// The NPC which should drop the item. + /// The chance that the item will drop. A decimal number <= 1.0. + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + /// Whether an item was dropped. + public static bool DropItemFromSetChance(NPC npc, float chance, params int[] itemIDs) + { + return DropItemFromSetChance(npc, false, chance, itemIDs); + } + #endregion + + #region NPC Item Set Drops Conditional + /// + /// With a condition, chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + public static bool DropItemFromSetCondition(NPC npc, bool dropPerPlayer, bool condition, params int[] itemIDs) + { + return condition ? DropItemFromSet(npc, dropPerPlayer, itemIDs) : false; + } + + /// + /// With a condition, chooses an item from an array and drops it from the given NPC. + /// + /// The NPC which should drop the item. + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + public static bool DropItemFromSetCondition(NPC npc, bool condition, params int[] itemIDs) + { + return condition ? DropItemFromSet(npc, false, itemIDs) : false; + } + + /// + /// With a condition, chooses an item from an array and drops it from the given NPC. Optionally spawns one copy of this drop per player. + /// + /// The NPC which should drop the item. + /// Whether the drop should be "instanced" (each player gets their own copy). + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The chance that the item will drop. A decimal number <= 1.0. + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + public static bool DropItemFromSetCondition(NPC npc, bool dropPerPlayer, bool condition, float chance, params int[] itemIDs) + { + return condition ? DropItemFromSetChance(npc, dropPerPlayer, chance, itemIDs) : false; + } + + /// + /// With a condition, chooses an item from an array and drops it from the given NPC. + /// + /// The NPC which should drop the item. + /// Any arbitrary Boolean condition to gate this drop. If false, nothing is dropped. + /// The chance that the item will drop. A decimal number <= 1.0. + /// The array of items to choose from. If it's null or empty, nothing will be dropped. + public static bool DropItemFromSetCondition(NPC npc, bool condition, float chance, params int[] itemIDs) + { + return condition ? DropItemFromSetChance(npc, false, chance, itemIDs) : false; + } + #endregion + + #region Player Item Spawns + /// + /// Spawns a stack of one or more items for the given player. + /// + /// The player which should receive the item(s). + /// The ID of the item(s) to spawn. + /// The minimum number of items to spawn. Defaults to 1. + /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items spawned. + public static int DropItem(Player p, int itemID, int minQuantity = 1, int maxQuantity = 0) + { + int quantity; + + // If they're equal (or for some reason max is less??) then just drop the minimum amount. + if (maxQuantity <= minQuantity) + quantity = minQuantity; + + // Otherwise pick a random amount to drop, inclusive. + else + quantity = Main.rand.Next(minQuantity, maxQuantity + 1); + + // If the final quantity is 0 or less, don't bother. + if (quantity <= 0) + return 0; + + p.QuickSpawnItem(itemID, quantity); + return quantity; + } + + /// + /// At a chance, spawns a stack of one or more items for the given player. + /// + /// The player which should receive the item(s). + /// The ID of the item(s) to spawn. + /// The chance that the items will spawn. A decimal number <= 1.0. + /// The minimum number of items to spawn. Defaults to 1. + /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items spawned. + public static int DropItemChance(Player p, int itemID, float chance, int minQuantity = 1, int maxQuantity = 0) + { + // If you fail the roll to get the drop, stop immediately. + if (Main.rand.NextFloat() > chance) + return 0; + + return DropItem(p, itemID, minQuantity, maxQuantity); + } + + /// + /// At a chance, spawns a stack of one or more items for the given player. + /// + /// The player which should receive the item(s). + /// The ID of the item(s) to spawn. + /// The chance that the items will spawn is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to spawn. Defaults to 1. + /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items spawned. + public static int DropItemChance(Player p, int itemID, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) + { + // If you fail the roll to get the drop, stop immediately. + if (Main.rand.Next(oneInXChance) != 0) + return 0; + + return DropItem(p, itemID, minQuantity, maxQuantity); + } + #endregion + + #region Player Item Spawns Conditional + /// + /// With a condition, spawns a stack of one or more items for the given player. + /// + /// The player which should receive the item(s). + /// The ID of the item(s) to spawn. + /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. + /// The minimum number of items to spawn. Defaults to 1. + /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items spawned. + public static int DropItemCondition(Player p, int itemID, bool condition, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItem(p, itemID, minQuantity, maxQuantity) : 0; + } + + /// + /// With a condition and at a chance, spawns a stack of one or more items for the given player. + /// + /// The player which should receive the item(s). + /// The ID of the item(s) to spawn. + /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. + /// The chance that the items will spawn. A decimal number <= 1.0. + /// The minimum number of items to spawn. Defaults to 1. + /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items spawned. + public static int DropItemCondition(Player p, int itemID, bool condition, float chance, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItemChance(p, itemID, chance, minQuantity, maxQuantity) : 0; + } + + /// + /// With a condition and at a chance, spawns a stack of one or more items for the given player. + /// + /// The player which should receive the item(s). + /// The ID of the item(s) to spawn. + /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. + /// The chance that the items will spawn is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to spawn. Defaults to 1. + /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. + /// The number of items spawned. + public static int DropItemCondition(Player p, int itemID, bool condition, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) + { + return condition ? DropItemChance(p, itemID, oneInXChance, minQuantity, maxQuantity) : 0; + } + #endregion + + #region Player Item Set Spawns + /// + /// Chooses an item from an array and spawns it for the given player. + /// + /// The player which should receive the item. + /// The array of items to choose from. If it's null or empty, nothing will be spawned. + /// Whether an item was spawned. + public static bool DropItemFromSet(Player p, params int[] itemIDs) + { + // Can't choose anything from an empty array. + if (itemIDs is null || itemIDs.Length == 0) + return false; + + // Choose which item to drop. + int itemID = Main.rand.Next(itemIDs); + + p.QuickSpawnItem(itemID); + return true; + } + + /// + /// At a chance, chooses an item from an array and spawns it for the given player. + /// + /// The player which should receive the item. + /// The chance that the item will spawn. A decimal number <= 1.0. + /// The array of items to choose from. If it's null or empty, nothing will be spawned. + /// Whether an item was spawned. + public static bool DropItemFromSetChance(Player p, float chance, params int[] itemIDs) + { + // If you fail the roll to get the drop, stop immediately. + if (Main.rand.NextFloat() > chance) + return false; + + return DropItemFromSet(p, itemIDs); + } + #endregion + + #region Player Item Set Spawns Conditional + /// + /// With a condition, chooses an item from an array and spawns it for the given player. + /// + /// The player which should receive the item. + /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. + /// The array of items to choose from. If it's null or empty, nothing will be spawned. + /// Whether an item was spawned. + public static bool DropItemFromSetCondition(Player p, bool condition, params int[] itemIDs) + { + return condition ? DropItemFromSet(p, itemIDs) : false; + } + + /// + /// With a condition and at a chance, chooses an item from an array and spawns it for the given player. + /// + /// The player which should receive the item. + /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. + /// The chance that the items will spawn. A decimal number <= 1.0. + /// The array of items to choose from. If it's null or empty, nothing will be spawned. + /// Whether an item was spawned. + public static bool DropItemFromSetCondition(Player p, bool condition, float chance, params int[] itemIDs) + { + return condition ? DropItemFromSetChance(p, chance, itemIDs) : false; + } + #endregion + } } diff --git a/Walls/AerialiteBrickWall.cs b/Walls/AerialiteBrickWall.cs index 14d4d8bcfe..fe18c12e4c 100644 --- a/Walls/AerialiteBrickWall.cs +++ b/Walls/AerialiteBrickWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class AerialiteBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AerialiteBrickWall"); - AddMapEntry(new Color(51, 45, 97)); + public class AerialiteBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AerialiteBrickWall"); + AddMapEntry(new Color(51, 45, 97)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/AshenSlabWall.cs b/Walls/AshenSlabWall.cs index 3d4847512b..f9c0439661 100644 --- a/Walls/AshenSlabWall.cs +++ b/Walls/AshenSlabWall.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Walls public class AshenSlabWall : ModWall { public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AshenSlabWall"); + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AshenSlabWall"); AddMapEntry(new Color(30, 18, 36)); } @@ -23,9 +23,9 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Walls/AstralBrickWall.cs b/Walls/AstralBrickWall.cs index c6ebbc69c6..e2e7a7916a 100644 --- a/Walls/AstralBrickWall.cs +++ b/Walls/AstralBrickWall.cs @@ -4,15 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class AstralBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; + public class AstralBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; Main.wallLargeFrames[Type] = 2; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AstralBrickWall"); - AddMapEntry(new Color(74, 74, 97)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AstralBrickWall"); + AddMapEntry(new Color(74, 74, 97)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/AstralMonolithWall.cs b/Walls/AstralMonolithWall.cs index 813eb7cd59..8229f9a8ed 100644 --- a/Walls/AstralMonolithWall.cs +++ b/Walls/AstralMonolithWall.cs @@ -8,11 +8,11 @@ namespace CalamityMod.Walls public class AstralMonolithWall : ModWall { public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AstralMonolithWall"); - AddMapEntry(new Color(5, 5, 5)); + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AstralMonolithWall"); + AddMapEntry(new Color(5, 5, 5)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; + { + num = fail ? 1 : 3; } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index 802ed542ff..121210f0e1 100644 --- a/Walls/BrimstoneSlagWall.cs +++ b/Walls/BrimstoneSlagWall.cs @@ -5,14 +5,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class BrimstoneSlagWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("BrimstoneSlagWall"); - AddMapEntry(new Color(24, 16, 29)); + public class BrimstoneSlagWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("BrimstoneSlagWall"); + AddMapEntry(new Color(24, 16, 29)); } public override bool CreateDust(int i, int j, ref int type) @@ -23,9 +23,9 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Walls/CinderplateWall.cs b/Walls/CinderplateWall.cs index 7dd4dd6e61..5eeeaf07ff 100644 --- a/Walls/CinderplateWall.cs +++ b/Walls/CinderplateWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class CinderplateWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("CinderplateWall"); - AddMapEntry(new Color(97, 22, 57)); + public class CinderplateWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("CinderplateWall"); + AddMapEntry(new Color(97, 22, 57)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/CosmiliteBrickWall.cs b/Walls/CosmiliteBrickWall.cs index d6920efe2a..ac665934aa 100644 --- a/Walls/CosmiliteBrickWall.cs +++ b/Walls/CosmiliteBrickWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class CosmiliteBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("CosmiliteBrickWall"); - AddMapEntry(new Color(34, 33, 59)); + public class CosmiliteBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("CosmiliteBrickWall"); + AddMapEntry(new Color(34, 33, 59)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs index e95536de74..c9db330b63 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/EutrophicSandWall.cs @@ -10,16 +10,16 @@ namespace CalamityMod.Walls dustType = 108; } - public override void RandomUpdate(int i, int j) - { - if (Main.tile[i, j].liquid <= 0) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } diff --git a/Walls/EutrophicSandWallSafe.cs b/Walls/EutrophicSandWallSafe.cs index 508ba8bfff..79a0fd54d7 100644 --- a/Walls/EutrophicSandWallSafe.cs +++ b/Walls/EutrophicSandWallSafe.cs @@ -8,13 +8,13 @@ namespace CalamityMod.Walls { public override void SetDefaults() { - Main.wallHouse[Type] = true; - dustType = 108; - drop = mod.ItemType("EutrophicSandWallSafe"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Sand Wall Safe"); - AddMapEntry(new Color(100, 100, 150), name); - } + Main.wallHouse[Type] = true; + dustType = 108; + drop = mod.ItemType("EutrophicSandWallSafe"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Sand Wall Safe"); + AddMapEntry(new Color(100, 100, 150), name); + } public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Walls/NavystoneWall.cs b/Walls/NavystoneWall.cs index 8e9e33fc23..27363b5105 100644 --- a/Walls/NavystoneWall.cs +++ b/Walls/NavystoneWall.cs @@ -4,12 +4,12 @@ namespace CalamityMod.Walls { public class NavystoneWall : ModWall { - public override void SetDefaults() + public override void SetDefaults() { dustType = 96; } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } diff --git a/Walls/NavystoneWallSafe.cs b/Walls/NavystoneWallSafe.cs index d83b39d5f5..4efb8905ae 100644 --- a/Walls/NavystoneWallSafe.cs +++ b/Walls/NavystoneWallSafe.cs @@ -6,17 +6,17 @@ namespace CalamityMod.Walls { public class NavystoneWallSafe : ModWall { - public override void SetDefaults() + public override void SetDefaults() { - Main.wallHouse[Type] = true; - dustType = 96; - drop = mod.ItemType("NavystoneWallSafe"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Navystone Wall Safe"); - AddMapEntry(new Color(0, 50, 50), name); - } + Main.wallHouse[Type] = true; + dustType = 96; + drop = mod.ItemType("NavystoneWallSafe"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Navystone Wall Safe"); + AddMapEntry(new Color(0, 50, 50), name); + } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } diff --git a/Walls/OccultStoneWall.cs b/Walls/OccultStoneWall.cs index 6a9b42d6be..30308bcff5 100644 --- a/Walls/OccultStoneWall.cs +++ b/Walls/OccultStoneWall.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class OccultStoneWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("OccultStoneWall"); - AddMapEntry(new Color(23, 23, 26)); - } + public class OccultStoneWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("OccultStoneWall"); + AddMapEntry(new Color(23, 23, 26)); + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; } public override bool CreateDust(int i, int j, ref int type) diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index 9cef7ba2ab..d9a4cb7906 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -8,11 +8,11 @@ namespace CalamityMod.Walls public class PerennialBrickWall : ModWall { public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("PerennialBrickWall"); - AddMapEntry(new Color(64, 116, 43)); + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("PerennialBrickWall"); + AddMapEntry(new Color(64, 116, 43)); } public override bool CreateDust(int i, int j, ref int type) @@ -23,9 +23,9 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Walls/PlaguedPlateWall.cs b/Walls/PlaguedPlateWall.cs index 3ef23fd095..9f19da58f8 100644 --- a/Walls/PlaguedPlateWall.cs +++ b/Walls/PlaguedPlateWall.cs @@ -4,19 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class PlaguedPlateWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("PlaguedPlateWall"); - AddMapEntry(new Color(23, 23, 26)); - } + public class PlaguedPlateWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("PlaguedPlateWall"); + AddMapEntry(new Color(23, 23, 26)); + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; } public override bool CreateDust(int i, int j, ref int type) diff --git a/Walls/ProfanedCrystalWall.cs b/Walls/ProfanedCrystalWall.cs index bab1f8df76..d20ddf7bb8 100644 --- a/Walls/ProfanedCrystalWall.cs +++ b/Walls/ProfanedCrystalWall.cs @@ -4,16 +4,16 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ProfanedCrystalWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; + public class ProfanedCrystalWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; Main.wallLargeFrames[Type] = 2; - dustType = mod.DustType("Sparkle"); + dustType = mod.DustType("Sparkle"); soundType = 13; - drop = mod.ItemType("ProfanedCrystalWall"); - AddMapEntry(new Color(125, 97, 123)); + drop = mod.ItemType("ProfanedCrystalWall"); + AddMapEntry(new Color(125, 97, 123)); } public override bool CreateDust(int i, int j, ref int type) @@ -23,8 +23,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/ProfanedRockWall.cs b/Walls/ProfanedRockWall.cs index aa95478ef9..9ecc5d4c7a 100644 --- a/Walls/ProfanedRockWall.cs +++ b/Walls/ProfanedRockWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ProfanedRockWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("ProfanedRockWall"); - AddMapEntry(new Color(41, 25, 31)); + public class ProfanedRockWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("ProfanedRockWall"); + AddMapEntry(new Color(41, 25, 31)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs index a1b55aab15..a7db27b6f5 100644 --- a/Walls/ProfanedSlabWall.cs +++ b/Walls/ProfanedSlabWall.cs @@ -6,13 +6,13 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { public class ProfanedSlabWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("ProfanedSlabWall"); - AddMapEntry(new Color(59, 27, 23)); + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("ProfanedSlabWall"); + AddMapEntry(new Color(59, 27, 23)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,9 +22,9 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index 9276e5c763..c993a55d84 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -6,13 +6,13 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { public class RunicProfanedBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("RunicProfanedBrickWall"); - AddMapEntry(new Color(43, 22, 27)); + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("RunicProfanedBrickWall"); + AddMapEntry(new Color(43, 22, 27)); } public override bool CreateDust(int i, int j, ref int type) @@ -23,9 +23,9 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + { + num = fail ? 1 : 3; + } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Walls/SilvaWall.cs b/Walls/SilvaWall.cs index 3c113ee59f..9002264680 100644 --- a/Walls/SilvaWall.cs +++ b/Walls/SilvaWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class SilvaWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SilvaWall"); - AddMapEntry(new Color(28, 32, 44)); + public class SilvaWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SilvaWall"); + AddMapEntry(new Color(28, 32, 44)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/SmoothAbyssGravelWall.cs b/Walls/SmoothAbyssGravelWall.cs index 356e5c6233..4e975ad666 100644 --- a/Walls/SmoothAbyssGravelWall.cs +++ b/Walls/SmoothAbyssGravelWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class SmoothAbyssGravelWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothAbyssGravelWall"); - AddMapEntry(new Color(28, 32, 44)); + public class SmoothAbyssGravelWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothAbyssGravelWall"); + AddMapEntry(new Color(28, 32, 44)); } public override bool CreateDust(int i, int j, ref int type) @@ -21,8 +21,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/SmoothBrimstoneSlagWall.cs b/Walls/SmoothBrimstoneSlagWall.cs index 84a9c01485..6555e9107c 100644 --- a/Walls/SmoothBrimstoneSlagWall.cs +++ b/Walls/SmoothBrimstoneSlagWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class SmoothBrimstoneSlagWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothBrimstoneSlagWall"); - AddMapEntry(new Color(30, 18, 36)); + public class SmoothBrimstoneSlagWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothBrimstoneSlagWall"); + AddMapEntry(new Color(30, 18, 36)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/SmoothNavystoneWall.cs b/Walls/SmoothNavystoneWall.cs index 353be13fb4..ee526d6b22 100644 --- a/Walls/SmoothNavystoneWall.cs +++ b/Walls/SmoothNavystoneWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class SmoothNavystoneWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothNavystoneWall"); - AddMapEntry(new Color(27, 35, 36)); + public class SmoothNavystoneWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothNavystoneWall"); + AddMapEntry(new Color(27, 35, 36)); } public override bool CreateDust(int i, int j, ref int type) @@ -21,8 +21,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/SmoothVoidstoneWall.cs b/Walls/SmoothVoidstoneWall.cs index c3ab55143a..d0faa162da 100644 --- a/Walls/SmoothVoidstoneWall.cs +++ b/Walls/SmoothVoidstoneWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class SmoothVoidstoneWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothVoidstoneWall"); - AddMapEntry(new Color(11, 11, 13)); + public class SmoothVoidstoneWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothVoidstoneWall"); + AddMapEntry(new Color(11, 11, 13)); } public override bool CreateDust(int i, int j, ref int type) @@ -21,8 +21,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/StatigelWall.cs b/Walls/StatigelWall.cs index 45f17fd3ca..30b1546be0 100644 --- a/Walls/StatigelWall.cs +++ b/Walls/StatigelWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class StatigelWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("StatigelWall"); - AddMapEntry(new Color(162, 54, 90)); + public class StatigelWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("StatigelWall"); + AddMapEntry(new Color(162, 54, 90)); } public override bool CreateDust(int i, int j, ref int type) @@ -21,8 +21,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/StratusWall.cs b/Walls/StratusWall.cs index 0cf5e081f5..e15d34ecf6 100644 --- a/Walls/StratusWall.cs +++ b/Walls/StratusWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class StratusWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("StratusWall"); - AddMapEntry(new Color(45, 44, 55)); + public class StratusWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("StratusWall"); + AddMapEntry(new Color(45, 44, 55)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/UelibloomBrickWall.cs b/Walls/UelibloomBrickWall.cs index 305cdbff79..62237fc3a0 100644 --- a/Walls/UelibloomBrickWall.cs +++ b/Walls/UelibloomBrickWall.cs @@ -4,14 +4,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class UelibloomBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("UelibloomBrickWall"); - AddMapEntry(new Color(97, 59, 35)); + public class UelibloomBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("UelibloomBrickWall"); + AddMapEntry(new Color(97, 59, 35)); } public override bool CreateDust(int i, int j, ref int type) @@ -22,8 +22,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } + { + num = fail ? 1 : 3; + } + } } diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 3f40221c03..abc869f417 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -5,13 +5,13 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { public class VoidstoneWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("VoidstoneWall"); - AddMapEntry(new Color(5, 5, 5)); + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("VoidstoneWall"); + AddMapEntry(new Color(5, 5, 5)); } public override bool CreateDust(int i, int j, ref int type) @@ -21,8 +21,8 @@ namespace CalamityMod.Walls } public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; + { + num = fail ? 1 : 3; } } } diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index 421e803420..acf70e4ef8 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Waters { diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 47d60eacf4..61c8de3d82 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Waters { diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index b8f20d39ad..e2557dc2cd 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Waters { @@ -27,7 +26,7 @@ namespace CalamityMod.Waters return 708; } - public override Color BiomeHairColor() + public override Color BiomeHairColor() { return Color.Turquoise; } diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 21de283e6b..16f9e35348 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Waters { diff --git a/World/Abyss.cs b/World/Abyss.cs index 348bea5ee6..dfec820366 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -5,464 +5,464 @@ using Terraria.ModLoader; namespace CalamityMod.World { public class Abyss : ModWorld - { - public static void PlaceSulphurSea() - { - Mod mod = ModLoader.GetMod("CalamityMod"); + { + public static void PlaceSulphurSea() + { + Mod mod = ModLoader.GetMod("CalamityMod"); - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; - if (WorldGen.dungeonX < genLimit) - CalamityWorld.abyssSide = true; + if (WorldGen.dungeonX < genLimit) + CalamityWorld.abyssSide = true; - int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 + int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 - if (CalamityWorld.abyssSide) - { - for (int abyssIndexSand = 0; abyssIndexSand < abyssChasmX + 240; abyssIndexSand++) - { - for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) - { - Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); - if (abyssIndexSand > abyssChasmX + 225) - { - if (tile.active() && - tile.type == TileID.Sand && - WorldGen.genRand.Next(4) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == TileID.PalmTree) - { - tile.active(false); - } - } - else if (abyssIndexSand > abyssChasmX + 210) - { - if (tile.active() && - tile.type == TileID.Sand && - WorldGen.genRand.Next(2) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == TileID.PalmTree) - { - tile.active(false); - } - } - else - { - if (tile.active() && - tile.type == TileID.Sand) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == TileID.PalmTree) - { - tile.active(false); - } - } - } - } - } - else - { - for (int abyssIndexSand = abyssChasmX - 240; abyssIndexSand < x; abyssIndexSand++) - { - for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) - { - Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); - if (abyssIndexSand < abyssChasmX - 225) - { - if (tile.active() && - tile.type == TileID.Sand && - WorldGen.genRand.Next(4) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == TileID.PalmTree) - { - tile.active(false); - } - } - else if (abyssIndexSand < abyssChasmX - 210) - { - if (tile.active() && - tile.type == TileID.Sand && - WorldGen.genRand.Next(2) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == TileID.PalmTree) - { - tile.active(false); - } - } - else - { - if (tile.active() && - tile.type == TileID.Sand) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == TileID.PalmTree) - { - tile.active(false); - } - } - } - } - } - } + if (CalamityWorld.abyssSide) + { + for (int abyssIndexSand = 0; abyssIndexSand < abyssChasmX + 240; abyssIndexSand++) + { + for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) + { + Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); + if (abyssIndexSand > abyssChasmX + 225) + { + if (tile.active() && + tile.type == TileID.Sand && + WorldGen.genRand.Next(4) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == TileID.PalmTree) + { + tile.active(false); + } + } + else if (abyssIndexSand > abyssChasmX + 210) + { + if (tile.active() && + tile.type == TileID.Sand && + WorldGen.genRand.Next(2) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == TileID.PalmTree) + { + tile.active(false); + } + } + else + { + if (tile.active() && + tile.type == TileID.Sand) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == TileID.PalmTree) + { + tile.active(false); + } + } + } + } + } + else + { + for (int abyssIndexSand = abyssChasmX - 240; abyssIndexSand < x; abyssIndexSand++) + { + for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) + { + Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); + if (abyssIndexSand < abyssChasmX - 225) + { + if (tile.active() && + tile.type == TileID.Sand && + WorldGen.genRand.Next(4) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == TileID.PalmTree) + { + tile.active(false); + } + } + else if (abyssIndexSand < abyssChasmX - 210) + { + if (tile.active() && + tile.type == TileID.Sand && + WorldGen.genRand.Next(2) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == TileID.PalmTree) + { + tile.active(false); + } + } + else + { + if (tile.active() && + tile.type == TileID.Sand) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == TileID.PalmTree) + { + tile.active(false); + } + } + } + } + } + } - public static void PlaceAbyss() - { - Mod mod = ModLoader.GetMod("CalamityMod"); + public static void PlaceAbyss() + { + Mod mod = ModLoader.GetMod("CalamityMod"); - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int rockLayer = (int)Main.rockLayer; + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int rockLayer = (int)Main.rockLayer; - int abyssChasmY = y - 250; //Underworld = y - 200 - CalamityWorld.abyssChasmBottom = abyssChasmY - 100; //850 small 1450 medium 2050 large - int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 + int abyssChasmY = y - 250; //Underworld = y - 200 + CalamityWorld.abyssChasmBottom = abyssChasmY - 100; //850 small 1450 medium 2050 large + int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 - bool tenebrisSide = true; - if (abyssChasmX < genLimit) - tenebrisSide = false; + bool tenebrisSide = true; + if (abyssChasmX < genLimit) + tenebrisSide = false; - if (CalamityWorld.abyssSide) - { - for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); - bool canConvert = tile.active() && - tile.type < TileID.Count && - tile.type != TileID.DyePlants && - tile.type != TileID.Trees && - tile.type != TileID.PalmTree && - tile.type != TileID.Sand && - tile.type != TileID.Containers && - tile.type != TileID.Coral && - tile.type != TileID.BeachPiles; - if (abyssIndex > abyssChasmX + 75) - { - if (WorldGen.genRand.Next(4) == 0) - { - if (canConvert) - { - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else if (abyssIndex > abyssChasmX + 70) - { - if (WorldGen.genRand.Next(2) == 0) - { - if (canConvert) - { - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else - { - if (canConvert) - { - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.type = (ushort)mod.TileType("AbyssGravel"); - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - } - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - } - } - } - else - { - for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); - bool canConvert = tile.active() && - tile.type < TileID.Count && - tile.type != TileID.DyePlants && - tile.type != TileID.Trees && - tile.type != TileID.PalmTree && - tile.type != TileID.Sand && - tile.type != TileID.Containers && - tile.type != TileID.Coral && - tile.type != TileID.BeachPiles; - if (abyssIndex < abyssChasmX - 75) - { - if (WorldGen.genRand.Next(4) == 0) - { - if (canConvert) - { - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else if (abyssIndex < abyssChasmX - 70) - { - if (WorldGen.genRand.Next(2) == 0) - { - if (canConvert) - { - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else - { - if (canConvert) - { - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.type = (ushort)mod.TileType("AbyssGravel"); - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - } - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.wall = (ushort)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - } - } - } + if (CalamityWorld.abyssSide) + { + for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + bool canConvert = tile.active() && + tile.type < TileID.Count && + tile.type != TileID.DyePlants && + tile.type != TileID.Trees && + tile.type != TileID.PalmTree && + tile.type != TileID.Sand && + tile.type != TileID.Containers && + tile.type != TileID.Coral && + tile.type != TileID.BeachPiles; + if (abyssIndex > abyssChasmX + 75) + { + if (WorldGen.genRand.Next(4) == 0) + { + if (canConvert) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else if (abyssIndex > abyssChasmX + 70) + { + if (WorldGen.genRand.Next(2) == 0) + { + if (canConvert) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else + { + if (canConvert) + { + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.type = (ushort)mod.TileType("AbyssGravel"); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + } + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + } + } + } + else + { + for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + bool canConvert = tile.active() && + tile.type < TileID.Count && + tile.type != TileID.DyePlants && + tile.type != TileID.Trees && + tile.type != TileID.PalmTree && + tile.type != TileID.Sand && + tile.type != TileID.Containers && + tile.type != TileID.Coral && + tile.type != TileID.BeachPiles; + if (abyssIndex < abyssChasmX - 75) + { + if (WorldGen.genRand.Next(4) == 0) + { + if (canConvert) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else if (abyssIndex < abyssChasmX - 70) + { + if (WorldGen.genRand.Next(2) == 0) + { + if (canConvert) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else + { + if (canConvert) + { + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.type = (ushort)mod.TileType("AbyssGravel"); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + } + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + } + } + } - WorldGenerationMethods.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, CalamityWorld.abyssChasmBottom, true); + WorldGenerationMethods.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, CalamityWorld.abyssChasmBottom, true); - int maxAbyssIslands = 11; //Small World - if (y > 2100) - maxAbyssIslands = 20; //Large World - else if (y > 1500) - maxAbyssIslands = 16; //Medium World + int maxAbyssIslands = 11; //Small World + if (y > 2100) + maxAbyssIslands = 20; //Large World + else if (y > 1500) + maxAbyssIslands = 16; //Medium World - WorldGenerationMethods.SpecialHut((ushort)mod.TileType("SmoothVoidstone"), (ushort)mod.TileType("Voidstone"), - (ushort)mod.WallType("VoidstoneWallUnsafe"), 9, abyssChasmX, CalamityWorld.abyssChasmBottom); + WorldGenerationMethods.SpecialHut((ushort)mod.TileType("SmoothVoidstone"), (ushort)mod.TileType("Voidstone"), + (ushort)mod.WallType("VoidstoneWallUnsafe"), 9, abyssChasmX, CalamityWorld.abyssChasmBottom); - int islandLocationOffset = 30; - int islandLocationY = rockLayer; - for (int islands = 0; islands < maxAbyssIslands; islands++) - { - int islandLocationX = abyssChasmX; - int randomIsland = WorldGen.genRand.Next(5); //0 1 2 3 4 - bool hasVoidstone = islandLocationY > (rockLayer + y * 0.143); - CalamityWorld.AbyssIslandY[CalamityWorld.numAbyssIslands] = islandLocationY; - switch (randomIsland) - { - case 0: - WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - break; - case 1: - WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX += 30; - break; - case 2: - WorldGenerationMethods.AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX -= 30; - break; - case 3: - WorldGenerationMethods.AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX += 25; - break; - case 4: - WorldGenerationMethods.AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX -= 25; - break; - } - CalamityWorld.AbyssIslandX[CalamityWorld.numAbyssIslands] = islandLocationX; - CalamityWorld.numAbyssIslands++; - islandLocationY += islandLocationOffset; - } + int islandLocationOffset = 30; + int islandLocationY = rockLayer; + for (int islands = 0; islands < maxAbyssIslands; islands++) + { + int islandLocationX = abyssChasmX; + int randomIsland = WorldGen.genRand.Next(5); //0 1 2 3 4 + bool hasVoidstone = islandLocationY > (rockLayer + y * 0.143); + CalamityWorld.AbyssIslandY[CalamityWorld.numAbyssIslands] = islandLocationY; + switch (randomIsland) + { + case 0: + WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + break; + case 1: + WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX += 30; + break; + case 2: + WorldGenerationMethods.AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX -= 30; + break; + case 3: + WorldGenerationMethods.AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX += 25; + break; + case 4: + WorldGenerationMethods.AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX -= 25; + break; + } + CalamityWorld.AbyssIslandX[CalamityWorld.numAbyssIslands] = islandLocationX; + CalamityWorld.numAbyssIslands++; + islandLocationY += islandLocationOffset; + } - CalamityWorld.AbyssItemArray = WorldGenerationMethods.ShuffleArray(CalamityWorld.AbyssItemArray); - for (int abyssHouse = 0; abyssHouse < CalamityWorld.numAbyssIslands; abyssHouse++) //11 15 19 - { - if (abyssHouse != 20) - WorldGenerationMethods.AbyssIslandHouse(CalamityWorld.AbyssIslandX[abyssHouse], - CalamityWorld.AbyssIslandY[abyssHouse], - CalamityWorld.AbyssItemArray[(abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse)], //10 choices 0 to 9 - CalamityWorld.AbyssIslandY[abyssHouse] > (rockLayer + y * 0.143)); - } + CalamityWorld.AbyssItemArray = WorldGenerationMethods.ShuffleArray(CalamityWorld.AbyssItemArray); + for (int abyssHouse = 0; abyssHouse < CalamityWorld.numAbyssIslands; abyssHouse++) //11 15 19 + { + if (abyssHouse != 20) + WorldGenerationMethods.AbyssIslandHouse(CalamityWorld.AbyssIslandX[abyssHouse], + CalamityWorld.AbyssIslandY[abyssHouse], + CalamityWorld.AbyssItemArray[(abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse)], //10 choices 0 to 9 + CalamityWorld.AbyssIslandY[abyssHouse] > (rockLayer + y * 0.143)); + } - if (CalamityWorld.abyssSide) - { - for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - if (!Main.tile[abyssIndex, abyssIndex2].active()) - { - if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 > rockLayer) - { - if (WorldGen.genRand.Next(5) == 0) - { - int style = WorldGen.genRand.Next(13, 16); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 < (int)Main.worldSurface) - { - if (WorldGen.genRand.Next(3) == 0) - { - int style = WorldGen.genRand.Next(25, 28); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - } - } - } - } - else - { - for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - if (!Main.tile[abyssIndex, abyssIndex2].active()) - { - if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 > rockLayer) - { - if (WorldGen.genRand.Next(5) == 0) - { - int style = WorldGen.genRand.Next(13, 16); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 < (int)Main.worldSurface) - { - if (WorldGen.genRand.Next(3) == 0) - { - int style = WorldGen.genRand.Next(25, 28); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - } - } - } - } - } - } + if (CalamityWorld.abyssSide) + { + for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + if (!Main.tile[abyssIndex, abyssIndex2].active()) + { + if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 > rockLayer) + { + if (WorldGen.genRand.Next(5) == 0) + { + int style = WorldGen.genRand.Next(13, 16); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 < (int)Main.worldSurface) + { + if (WorldGen.genRand.Next(3) == 0) + { + int style = WorldGen.genRand.Next(25, 28); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + } + } + } + } + else + { + for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + if (!Main.tile[abyssIndex, abyssIndex2].active()) + { + if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 > rockLayer) + { + if (WorldGen.genRand.Next(5) == 0) + { + int style = WorldGen.genRand.Next(13, 16); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 < (int)Main.worldSurface) + { + if (WorldGen.genRand.Next(3) == 0) + { + int style = WorldGen.genRand.Next(25, 28); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + } + } + } + } + } + } } diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index b39d5421bd..94b57f34f6 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1,1469 +1,1510 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Terraria.Localization; -using Terraria.GameContent.Events; -using Terraria.ModLoader.IO; -using CalamityMod.NPCs; using CalamityMod.CalPlayer; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.GameContent.Generation; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using Terraria.World.Generation; namespace CalamityMod.World { public class CalamityWorld : ModWorld - { - #region Vars - public static int DoGSecondStageCountdown = 0; + { + #region Vars + public static int DoGSecondStageCountdown = 0; - private const int saveVersion = 0; + private const int saveVersion = 0; - //Boss Rush - public static bool bossRushActive = false; //Whether Boss Rush is active or not - public static bool deactivateStupidFuckingBullshit = false; //Force Boss Rush to inactive - public static int bossRushStage = 0; //Boss Rush Stage - public static int bossRushSpawnCountdown = 180; //Delay before another Boss Rush boss can spawn + //Boss Rush + public static bool bossRushActive = false; //Whether Boss Rush is active or not + public static bool deactivateStupidFuckingBullshit = false; //Force Boss Rush to inactive + public static int bossRushStage = 0; //Boss Rush Stage + public static int bossRushSpawnCountdown = 180; //Delay before another Boss Rush boss can spawn - //Death Mode natural boss spawns - public static int bossSpawnCountdown = 0; //Death Mode natural boss spawn countdown - public static int bossType = 0; //Death Mode natural boss spawn type + //Death Mode natural boss spawns + public static int bossSpawnCountdown = 0; //Death Mode natural boss spawn countdown + public static int bossType = 0; //Death Mode natural boss spawn type - //Modes - public static bool demonMode = false; //Spawn rate boost - public static bool onionMode = false; //Extra accessory from Moon Lord - public static bool revenge = false; //Revengeance Mode - public static bool death = false; //Death Mode - public static bool defiled = false; //Defiled Mode - public static bool armageddon = false; //Armageddon Mode - public static bool ironHeart = false; //Iron Heart Mode + //Modes + public static bool demonMode = false; //Spawn rate boost + public static bool onionMode = false; //Extra accessory from Moon Lord + public static bool revenge = false; //Revengeance Mode + public static bool death = false; //Death Mode + public static bool defiled = false; //Defiled Mode + public static bool armageddon = false; //Armageddon Mode + public static bool ironHeart = false; //Iron Heart Mode - //Evil Islands - public static int fehX = 0; - public static int fehY = 0; + //Evil Islands + public static int fehX = 0; + public static int fehY = 0; - //Brimstone Crag - public static int fuhX = 0; - public static int fuhY = 0; - public static int calamityTiles = 0; + //Brimstone Crag + public static int fuhX = 0; + public static int fuhY = 0; + public static int calamityTiles = 0; - //Abyss & Sulphur - public static int numAbyssIslands = 0; - public static int[] AbyssIslandX = new int[20]; - public static int[] AbyssIslandY = new int[20]; - public static int[] AbyssItemArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - public static int sulphurTiles = 0; - public static int abyssTiles = 0; - public static bool abyssSide = false; - public static int abyssChasmBottom = 0; + //Abyss & Sulphur + public static int numAbyssIslands = 0; + public static int[] AbyssIslandX = new int[20]; + public static int[] AbyssIslandY = new int[20]; + public static int[] AbyssItemArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static int sulphurTiles = 0; + public static int abyssTiles = 0; + public static bool abyssSide = false; + public static int abyssChasmBottom = 0; - //Astral - public static int astralTiles = 0; + //Astral + public static int astralTiles = 0; - //Sunken Sea - public static int sunkenSeaTiles = 0; - public static Rectangle SunkenSeaLocation = Rectangle.Empty; + //Sunken Sea + public static int sunkenSeaTiles = 0; + public static Rectangle SunkenSeaLocation = Rectangle.Empty; - //Shrines - public static int[] SChestX = new int[10]; - public static int[] SChestY = new int[10]; - public static bool roxShrinePlaced = false; + //Shrines + public static int[] SChestX = new int[10]; + public static int[] SChestY = new int[10]; + public static bool roxShrinePlaced = false; - #region Downed Bools - public static bool downedBossAny = false; //Any boss - public static bool downedDesertScourge = false; - public static bool downedCrabulon = false; - public static bool downedHiveMind = false; - public static bool downedPerforator = false; - public static bool downedSlimeGod = false; - public static bool spawnedHardBoss = false; //Hardmode boss spawned - public static bool downedCryogen = false; - public static bool downedAquaticScourge = false; - public static bool downedBrimstoneElemental = false; - public static bool downedCalamitas = false; - public static bool downedLeviathan = false; - public static bool downedAstrageldon = false; - public static bool downedStarGod = false; - public static bool downedPlaguebringer = false; - public static bool downedScavenger = false; - public static bool downedOldDuke = false; - public static bool downedGuardians = false; - public static bool downedProvidence = false; - public static bool downedSentinel1 = false; // Ceaseless Void - public static bool downedSentinel2 = false; // Storm Weaver - public static bool downedSentinel3 = false; // Signus, Envoy of the Devourer - public static bool downedPolterghast = false; - public static bool downedDoG = false; - public static bool downedBumble = false; - public static bool buffedEclipse = false; - public static bool downedBuffedMothron = false; - public static bool downedYharon = false; - public static bool downedSCal = false; - public static bool downedLORDE = false; - public static bool downedCLAM = false; - public static bool downedBetsy = false; //Betsy - #endregion + #region Downed Bools + public static bool downedBossAny = false; //Any boss + public static bool downedDesertScourge = false; + public static bool downedCrabulon = false; + public static bool downedHiveMind = false; + public static bool downedPerforator = false; + public static bool downedSlimeGod = false; + public static bool spawnedHardBoss = false; //Hardmode boss spawned + public static bool downedCryogen = false; + public static bool downedAquaticScourge = false; + public static bool downedBrimstoneElemental = false; + public static bool downedCalamitas = false; + public static bool downedLeviathan = false; + public static bool downedAstrageldon = false; + public static bool downedStarGod = false; + public static bool downedPlaguebringer = false; + public static bool downedScavenger = false; + public static bool downedOldDuke = false; + public static bool downedGuardians = false; + public static bool downedProvidence = false; + public static bool downedSentinel1 = false; // Ceaseless Void + public static bool downedSentinel2 = false; // Storm Weaver + public static bool downedSentinel3 = false; // Signus, Envoy of the Devourer + public static bool downedPolterghast = false; + public static bool downedDoG = false; + public static bool downedBumble = false; + public static bool buffedEclipse = false; + public static bool downedBuffedMothron = false; + public static bool downedYharon = false; + public static bool downedSCal = false; + public static bool downedLORDE = false; + public static bool downedCLAM = false; + public static bool downedBetsy = false; //Betsy + #endregion - #endregion + #endregion - #region Initialize - public override void Initialize() - { - if (Config.ExpertPillarEnemyKillCountReduction) - { - NPC.LunarShieldPowerExpert = 100; - } - CalamityGlobalNPC.holyBoss = -1; - CalamityGlobalNPC.doughnutBoss = -1; - CalamityGlobalNPC.voidBoss = -1; - CalamityGlobalNPC.energyFlame = -1; - CalamityGlobalNPC.hiveMind = -1; - CalamityGlobalNPC.scavenger = -1; - CalamityGlobalNPC.bobbitWormBottom = -1; - CalamityGlobalNPC.DoGHead = -1; - CalamityGlobalNPC.SCal = -1; - CalamityGlobalNPC.ghostBoss = -1; - CalamityGlobalNPC.laserEye = -1; - CalamityGlobalNPC.fireEye = -1; - CalamityGlobalNPC.brimstoneElemental = -1; - bossRushStage = 0; - DoGSecondStageCountdown = 0; - bossRushActive = false; - bossRushSpawnCountdown = 180; - bossSpawnCountdown = 0; - bossType = 0; - abyssChasmBottom = 0; - abyssSide = false; - downedDesertScourge = false; - downedAquaticScourge = false; - downedHiveMind = false; - downedPerforator = false; - downedSlimeGod = false; - downedCryogen = false; - downedBrimstoneElemental = false; - downedCalamitas = false; - downedLeviathan = false; - downedDoG = false; - downedPlaguebringer = false; - downedScavenger = false; - downedGuardians = false; - downedProvidence = false; - downedSentinel1 = false; - downedSentinel2 = false; - downedSentinel3 = false; - downedYharon = false; - buffedEclipse = false; - downedSCal = false; - downedCLAM = false; - downedBumble = false; - downedCrabulon = false; - downedBetsy = false; - downedBossAny = false; - spawnedHardBoss = false; - demonMode = false; - onionMode = false; - revenge = false; - downedStarGod = false; - downedAstrageldon = false; - downedPolterghast = false; - downedLORDE = false; - downedBuffedMothron = false; - downedOldDuke = false; - death = false; - defiled = false; - armageddon = false; - ironHeart = false; - } - #endregion + #region Initialize + public override void Initialize() + { + if (Config.ExpertPillarEnemyKillCountReduction) + { + NPC.LunarShieldPowerExpert = 100; + } + CalamityGlobalNPC.holyBoss = -1; + CalamityGlobalNPC.doughnutBoss = -1; + CalamityGlobalNPC.voidBoss = -1; + CalamityGlobalNPC.energyFlame = -1; + CalamityGlobalNPC.hiveMind = -1; + CalamityGlobalNPC.scavenger = -1; + CalamityGlobalNPC.bobbitWormBottom = -1; + CalamityGlobalNPC.DoGHead = -1; + CalamityGlobalNPC.SCal = -1; + CalamityGlobalNPC.ghostBoss = -1; + CalamityGlobalNPC.laserEye = -1; + CalamityGlobalNPC.fireEye = -1; + CalamityGlobalNPC.brimstoneElemental = -1; + bossRushStage = 0; + DoGSecondStageCountdown = 0; + bossRushActive = false; + bossRushSpawnCountdown = 180; + bossSpawnCountdown = 0; + bossType = 0; + abyssChasmBottom = 0; + abyssSide = false; + downedDesertScourge = false; + downedAquaticScourge = false; + downedHiveMind = false; + downedPerforator = false; + downedSlimeGod = false; + downedCryogen = false; + downedBrimstoneElemental = false; + downedCalamitas = false; + downedLeviathan = false; + downedDoG = false; + downedPlaguebringer = false; + downedScavenger = false; + downedGuardians = false; + downedProvidence = false; + downedSentinel1 = false; + downedSentinel2 = false; + downedSentinel3 = false; + downedYharon = false; + buffedEclipse = false; + downedSCal = false; + downedCLAM = false; + downedBumble = false; + downedCrabulon = false; + downedBetsy = false; + downedBossAny = false; + spawnedHardBoss = false; + demonMode = false; + onionMode = false; + revenge = false; + downedStarGod = false; + downedAstrageldon = false; + downedPolterghast = false; + downedLORDE = false; + downedBuffedMothron = false; + downedOldDuke = false; + death = false; + defiled = false; + armageddon = false; + ironHeart = false; + } + #endregion - #region Save - public override TagCompound Save() - { - var downed = new List(); - if (downedDesertScourge) downed.Add("desertScourge"); - if (downedAquaticScourge) downed.Add("aquaticScourge"); - if (downedHiveMind) downed.Add("hiveMind"); - if (downedPerforator) downed.Add("perforator"); - if (downedSlimeGod) downed.Add("slimeGod"); - if (downedCryogen) downed.Add("cryogen"); - if (downedBrimstoneElemental) downed.Add("brimstoneElemental"); - if (downedCalamitas) downed.Add("calamitas"); - if (downedLeviathan) downed.Add("leviathan"); - if (downedDoG) downed.Add("devourerOfGods"); - if (downedPlaguebringer) downed.Add("plaguebringerGoliath"); - if (downedGuardians) downed.Add("guardians"); - if (downedProvidence) downed.Add("providence"); - if (downedSentinel1) downed.Add("ceaselessVoid"); - if (downedSentinel2) downed.Add("stormWeaver"); - if (downedSentinel3) downed.Add("signus"); - if (downedYharon) downed.Add("yharon"); - if (buffedEclipse) downed.Add("eclipse"); - if (downedSCal) downed.Add("supremeCalamitas"); - if (downedBumble) downed.Add("bumblebirb"); - if (downedCrabulon) downed.Add("crabulon"); - if (downedBetsy) downed.Add("betsy"); - if (downedScavenger) downed.Add("scavenger"); - if (downedBossAny) downed.Add("anyBoss"); - if (demonMode) downed.Add("demonMode"); - if (onionMode) downed.Add("onionMode"); - if (revenge) downed.Add("revenge"); - if (downedStarGod) downed.Add("starGod"); - if (downedAstrageldon) downed.Add("astrageldon"); - if (spawnedHardBoss) downed.Add("hardBoss"); - if (downedPolterghast) downed.Add("polterghast"); - if (downedLORDE) downed.Add("lorde"); - if (downedBuffedMothron) downed.Add("moth"); - if (downedOldDuke) downed.Add("oldDuke"); - if (death) downed.Add("death"); - if (defiled) downed.Add("defiled"); - if (armageddon) downed.Add("armageddon"); - if (ironHeart) downed.Add("ironHeart"); - if (abyssSide) downed.Add("abyssSide"); - if (bossRushActive) downed.Add("bossRushActive"); - if (downedCLAM) downed.Add("clam"); + #region Save + public override TagCompound Save() + { + var downed = new List(); + if (downedDesertScourge) + downed.Add("desertScourge"); + if (downedAquaticScourge) + downed.Add("aquaticScourge"); + if (downedHiveMind) + downed.Add("hiveMind"); + if (downedPerforator) + downed.Add("perforator"); + if (downedSlimeGod) + downed.Add("slimeGod"); + if (downedCryogen) + downed.Add("cryogen"); + if (downedBrimstoneElemental) + downed.Add("brimstoneElemental"); + if (downedCalamitas) + downed.Add("calamitas"); + if (downedLeviathan) + downed.Add("leviathan"); + if (downedDoG) + downed.Add("devourerOfGods"); + if (downedPlaguebringer) + downed.Add("plaguebringerGoliath"); + if (downedGuardians) + downed.Add("guardians"); + if (downedProvidence) + downed.Add("providence"); + if (downedSentinel1) + downed.Add("ceaselessVoid"); + if (downedSentinel2) + downed.Add("stormWeaver"); + if (downedSentinel3) + downed.Add("signus"); + if (downedYharon) + downed.Add("yharon"); + if (buffedEclipse) + downed.Add("eclipse"); + if (downedSCal) + downed.Add("supremeCalamitas"); + if (downedBumble) + downed.Add("bumblebirb"); + if (downedCrabulon) + downed.Add("crabulon"); + if (downedBetsy) + downed.Add("betsy"); + if (downedScavenger) + downed.Add("scavenger"); + if (downedBossAny) + downed.Add("anyBoss"); + if (demonMode) + downed.Add("demonMode"); + if (onionMode) + downed.Add("onionMode"); + if (revenge) + downed.Add("revenge"); + if (downedStarGod) + downed.Add("starGod"); + if (downedAstrageldon) + downed.Add("astrageldon"); + if (spawnedHardBoss) + downed.Add("hardBoss"); + if (downedPolterghast) + downed.Add("polterghast"); + if (downedLORDE) + downed.Add("lorde"); + if (downedBuffedMothron) + downed.Add("moth"); + if (downedOldDuke) + downed.Add("oldDuke"); + if (death) + downed.Add("death"); + if (defiled) + downed.Add("defiled"); + if (armageddon) + downed.Add("armageddon"); + if (ironHeart) + downed.Add("ironHeart"); + if (abyssSide) + downed.Add("abyssSide"); + if (bossRushActive) + downed.Add("bossRushActive"); + if (downedCLAM) + downed.Add("clam"); - return new TagCompound - { - { - "downed", downed - }, - { - "abyssChasmBottom", abyssChasmBottom - } - }; - } - #endregion + return new TagCompound + { + { + "downed", downed + }, + { + "abyssChasmBottom", abyssChasmBottom + } + }; + } + #endregion - #region Load - public override void Load(TagCompound tag) - { - var downed = tag.GetList("downed"); - downedDesertScourge = downed.Contains("desertScourge"); - downedAquaticScourge = downed.Contains("aquaticScourge"); - downedHiveMind = downed.Contains("hiveMind"); - downedPerforator = downed.Contains("perforator"); - downedSlimeGod = downed.Contains("slimeGod"); - downedCryogen = downed.Contains("cryogen"); - downedBrimstoneElemental = downed.Contains("brimstoneElemental"); - downedCalamitas = downed.Contains("calamitas"); - downedLeviathan = downed.Contains("leviathan"); - downedDoG = downed.Contains("devourerOfGods"); - downedPlaguebringer = downed.Contains("plaguebringerGoliath"); - downedGuardians = downed.Contains("guardians"); - downedProvidence = downed.Contains("providence"); - downedSentinel1 = downed.Contains("ceaselessVoid"); - downedSentinel2 = downed.Contains("stormWeaver"); - downedSentinel3 = downed.Contains("signus"); - downedYharon = downed.Contains("yharon"); - buffedEclipse = downed.Contains("eclipse"); - downedSCal = downed.Contains("supremeCalamitas"); - downedBumble = downed.Contains("bumblebirb"); - downedCrabulon = downed.Contains("crabulon"); - downedBetsy = downed.Contains("betsy"); - downedScavenger = downed.Contains("scavenger"); - downedBossAny = downed.Contains("anyBoss"); - demonMode = downed.Contains("demonMode"); - onionMode = downed.Contains("onionMode"); - revenge = downed.Contains("revenge"); - downedStarGod = downed.Contains("starGod"); - downedAstrageldon = downed.Contains("astrageldon"); - spawnedHardBoss = downed.Contains("hardBoss"); - downedPolterghast = downed.Contains("polterghast"); - downedLORDE = downed.Contains("lorde"); - downedBuffedMothron = downed.Contains("moth"); - downedOldDuke = downed.Contains("oldDuke"); - death = downed.Contains("death"); - defiled = downed.Contains("defiled"); - armageddon = downed.Contains("armageddon"); - ironHeart = downed.Contains("ironHeart"); - abyssSide = downed.Contains("abyssSide"); - bossRushActive = downed.Contains("bossRushActive"); - downedCLAM = downed.Contains("clam"); + #region Load + public override void Load(TagCompound tag) + { + var downed = tag.GetList("downed"); + downedDesertScourge = downed.Contains("desertScourge"); + downedAquaticScourge = downed.Contains("aquaticScourge"); + downedHiveMind = downed.Contains("hiveMind"); + downedPerforator = downed.Contains("perforator"); + downedSlimeGod = downed.Contains("slimeGod"); + downedCryogen = downed.Contains("cryogen"); + downedBrimstoneElemental = downed.Contains("brimstoneElemental"); + downedCalamitas = downed.Contains("calamitas"); + downedLeviathan = downed.Contains("leviathan"); + downedDoG = downed.Contains("devourerOfGods"); + downedPlaguebringer = downed.Contains("plaguebringerGoliath"); + downedGuardians = downed.Contains("guardians"); + downedProvidence = downed.Contains("providence"); + downedSentinel1 = downed.Contains("ceaselessVoid"); + downedSentinel2 = downed.Contains("stormWeaver"); + downedSentinel3 = downed.Contains("signus"); + downedYharon = downed.Contains("yharon"); + buffedEclipse = downed.Contains("eclipse"); + downedSCal = downed.Contains("supremeCalamitas"); + downedBumble = downed.Contains("bumblebirb"); + downedCrabulon = downed.Contains("crabulon"); + downedBetsy = downed.Contains("betsy"); + downedScavenger = downed.Contains("scavenger"); + downedBossAny = downed.Contains("anyBoss"); + demonMode = downed.Contains("demonMode"); + onionMode = downed.Contains("onionMode"); + revenge = downed.Contains("revenge"); + downedStarGod = downed.Contains("starGod"); + downedAstrageldon = downed.Contains("astrageldon"); + spawnedHardBoss = downed.Contains("hardBoss"); + downedPolterghast = downed.Contains("polterghast"); + downedLORDE = downed.Contains("lorde"); + downedBuffedMothron = downed.Contains("moth"); + downedOldDuke = downed.Contains("oldDuke"); + death = downed.Contains("death"); + defiled = downed.Contains("defiled"); + armageddon = downed.Contains("armageddon"); + ironHeart = downed.Contains("ironHeart"); + abyssSide = downed.Contains("abyssSide"); + bossRushActive = downed.Contains("bossRushActive"); + downedCLAM = downed.Contains("clam"); - abyssChasmBottom = tag.GetInt("abyssChasmBottom"); - } - #endregion + abyssChasmBottom = tag.GetInt("abyssChasmBottom"); + } + #endregion - #region LoadLegacy - public override void LoadLegacy(BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - abyssChasmBottom = reader.ReadInt32(); + #region LoadLegacy + public override void LoadLegacy(BinaryReader reader) + { + int loadVersion = reader.ReadInt32(); + abyssChasmBottom = reader.ReadInt32(); - if (loadVersion == 0) - { - BitsByte flags = reader.ReadByte(); - downedDesertScourge = flags[0]; - downedHiveMind = flags[1]; - downedPerforator = flags[2]; - downedSlimeGod = flags[3]; - downedCryogen = flags[4]; - downedBrimstoneElemental = flags[5]; - downedCalamitas = flags[6]; - downedLeviathan = flags[7]; + if (loadVersion == 0) + { + BitsByte flags = reader.ReadByte(); + downedDesertScourge = flags[0]; + downedHiveMind = flags[1]; + downedPerforator = flags[2]; + downedSlimeGod = flags[3]; + downedCryogen = flags[4]; + downedBrimstoneElemental = flags[5]; + downedCalamitas = flags[6]; + downedLeviathan = flags[7]; - BitsByte flags2 = reader.ReadByte(); - downedDoG = flags2[0]; - downedPlaguebringer = flags2[1]; - downedGuardians = flags2[2]; - downedProvidence = flags2[3]; - downedSentinel1 = flags2[4]; - downedSentinel2 = flags2[5]; - downedSentinel3 = flags2[6]; - downedYharon = flags2[7]; + BitsByte flags2 = reader.ReadByte(); + downedDoG = flags2[0]; + downedPlaguebringer = flags2[1]; + downedGuardians = flags2[2]; + downedProvidence = flags2[3]; + downedSentinel1 = flags2[4]; + downedSentinel2 = flags2[5]; + downedSentinel3 = flags2[6]; + downedYharon = flags2[7]; - // Explicitly discard the now-unused vanilla boss booleans - BitsByte flags3 = reader.ReadByte(); - downedSCal = flags3[0]; - downedBumble = flags3[1]; - downedCrabulon = flags3[2]; - downedBetsy = flags3[3]; - downedScavenger = flags3[4]; - _ = flags3[5]; - _ = flags3[6]; - _ = flags3[7]; + // Explicitly discard the now-unused vanilla boss booleans + BitsByte flags3 = reader.ReadByte(); + downedSCal = flags3[0]; + downedBumble = flags3[1]; + downedCrabulon = flags3[2]; + downedBetsy = flags3[3]; + downedScavenger = flags3[4]; + _ = flags3[5]; + _ = flags3[6]; + _ = flags3[7]; - BitsByte flags4 = reader.ReadByte(); - _ = flags4[0]; - _ = flags4[1]; - _ = flags4[2]; - _ = flags4[3]; - downedBossAny = flags4[4]; - demonMode = flags4[5]; - onionMode = flags4[6]; - revenge = flags4[7]; + BitsByte flags4 = reader.ReadByte(); + _ = flags4[0]; + _ = flags4[1]; + _ = flags4[2]; + _ = flags4[3]; + downedBossAny = flags4[4]; + demonMode = flags4[5]; + onionMode = flags4[6]; + revenge = flags4[7]; // These 3 bits are currently unused, they used to be astral meteor drops BitsByte flags5 = reader.ReadByte(); - downedStarGod = flags5[0]; - _ = flags5[1]; - _ = flags5[2]; - _ = flags5[3]; - spawnedHardBoss = flags5[4]; - downedPolterghast = flags5[5]; - death = flags5[6]; - downedLORDE = flags5[7]; + downedStarGod = flags5[0]; + _ = flags5[1]; + _ = flags5[2]; + _ = flags5[3]; + spawnedHardBoss = flags5[4]; + downedPolterghast = flags5[5]; + death = flags5[6]; + downedLORDE = flags5[7]; - BitsByte flags6 = reader.ReadByte(); - abyssSide = flags6[0]; - downedAquaticScourge = flags6[1]; - downedAstrageldon = flags6[2]; - buffedEclipse = flags6[3]; - armageddon = flags6[4]; - defiled = flags6[5]; - downedBuffedMothron = flags6[6]; - ironHeart = flags6[7]; + BitsByte flags6 = reader.ReadByte(); + abyssSide = flags6[0]; + downedAquaticScourge = flags6[1]; + downedAstrageldon = flags6[2]; + buffedEclipse = flags6[3]; + armageddon = flags6[4]; + defiled = flags6[5]; + downedBuffedMothron = flags6[6]; + ironHeart = flags6[7]; - BitsByte flags7 = reader.ReadByte(); - bossRushActive = flags7[0]; - downedOldDuke = flags7[1]; - downedCLAM = flags7[2]; - } - else - { - ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); - } - } - #endregion + BitsByte flags7 = reader.ReadByte(); + bossRushActive = flags7[0]; + downedOldDuke = flags7[1]; + downedCLAM = flags7[2]; + } + else + { + ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); + } + } + #endregion - #region NetSend - public override void NetSend(BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = downedDesertScourge; - flags[1] = downedHiveMind; - flags[2] = downedPerforator; - flags[3] = downedSlimeGod; - flags[4] = downedCryogen; - flags[5] = downedBrimstoneElemental; - flags[6] = downedCalamitas; - flags[7] = downedLeviathan; + #region NetSend + public override void NetSend(BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = downedDesertScourge; + flags[1] = downedHiveMind; + flags[2] = downedPerforator; + flags[3] = downedSlimeGod; + flags[4] = downedCryogen; + flags[5] = downedBrimstoneElemental; + flags[6] = downedCalamitas; + flags[7] = downedLeviathan; - BitsByte flags2 = new BitsByte(); - flags2[0] = downedDoG; - flags2[1] = downedPlaguebringer; - flags2[2] = downedGuardians; - flags2[3] = downedProvidence; - flags2[4] = downedSentinel1; - flags2[5] = downedSentinel2; - flags2[6] = downedSentinel3; - flags2[7] = downedYharon; + BitsByte flags2 = new BitsByte(); + flags2[0] = downedDoG; + flags2[1] = downedPlaguebringer; + flags2[2] = downedGuardians; + flags2[3] = downedProvidence; + flags2[4] = downedSentinel1; + flags2[5] = downedSentinel2; + flags2[6] = downedSentinel3; + flags2[7] = downedYharon; - // Don't write meaningful values for the now-unused vanilla boss booleans - BitsByte flags3 = new BitsByte(); - flags3[0] = downedSCal; - flags3[1] = downedBumble; - flags3[2] = downedCrabulon; - flags3[3] = downedBetsy; - flags3[4] = downedScavenger; - flags3[5] = false; - flags3[6] = false; - flags3[7] = false; + // Don't write meaningful values for the now-unused vanilla boss booleans + BitsByte flags3 = new BitsByte(); + flags3[0] = downedSCal; + flags3[1] = downedBumble; + flags3[2] = downedCrabulon; + flags3[3] = downedBetsy; + flags3[4] = downedScavenger; + flags3[5] = false; + flags3[6] = false; + flags3[7] = false; - BitsByte flags4 = new BitsByte(); - flags4[0] = false; - flags4[1] = false; - flags4[2] = false; - flags4[3] = false; - flags4[4] = downedBossAny; - flags4[5] = demonMode; - flags4[6] = onionMode; - flags4[7] = revenge; + BitsByte flags4 = new BitsByte(); + flags4[0] = false; + flags4[1] = false; + flags4[2] = false; + flags4[3] = false; + flags4[4] = downedBossAny; + flags4[5] = demonMode; + flags4[6] = onionMode; + flags4[7] = revenge; // These 3 bits are currently unused, they used to be astral meteor drops BitsByte flags5 = new BitsByte(); - flags5[0] = downedStarGod; - flags5[1] = false; - flags5[2] = false; - flags5[3] = false; - flags5[4] = spawnedHardBoss; - flags5[5] = downedPolterghast; - flags5[6] = death; - flags5[7] = downedLORDE; + flags5[0] = downedStarGod; + flags5[1] = false; + flags5[2] = false; + flags5[3] = false; + flags5[4] = spawnedHardBoss; + flags5[5] = downedPolterghast; + flags5[6] = death; + flags5[7] = downedLORDE; - BitsByte flags6 = new BitsByte(); - flags6[0] = abyssSide; - flags6[1] = downedAquaticScourge; - flags6[2] = downedAstrageldon; - flags6[3] = buffedEclipse; - flags6[4] = armageddon; - flags6[5] = defiled; - flags6[6] = downedBuffedMothron; - flags6[7] = ironHeart; + BitsByte flags6 = new BitsByte(); + flags6[0] = abyssSide; + flags6[1] = downedAquaticScourge; + flags6[2] = downedAstrageldon; + flags6[3] = buffedEclipse; + flags6[4] = armageddon; + flags6[5] = defiled; + flags6[6] = downedBuffedMothron; + flags6[7] = ironHeart; - BitsByte flags7 = new BitsByte(); - flags7[0] = bossRushActive; - flags7[1] = downedOldDuke; - flags7[2] = downedCLAM; + BitsByte flags7 = new BitsByte(); + flags7[0] = bossRushActive; + flags7[1] = downedOldDuke; + flags7[2] = downedCLAM; - writer.Write(flags); - writer.Write(flags2); - writer.Write(flags3); - writer.Write(flags4); - writer.Write(flags5); - writer.Write(flags6); - writer.Write(flags7); - writer.Write(abyssChasmBottom); - } - #endregion + writer.Write(flags); + writer.Write(flags2); + writer.Write(flags3); + writer.Write(flags4); + writer.Write(flags5); + writer.Write(flags6); + writer.Write(flags7); + writer.Write(abyssChasmBottom); + } + #endregion - #region NetReceive - public override void NetReceive(BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - downedDesertScourge = flags[0]; - downedHiveMind = flags[1]; - downedPerforator = flags[2]; - downedSlimeGod = flags[3]; - downedCryogen = flags[4]; - downedBrimstoneElemental = flags[5]; - downedCalamitas = flags[6]; - downedLeviathan = flags[7]; + #region NetReceive + public override void NetReceive(BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + downedDesertScourge = flags[0]; + downedHiveMind = flags[1]; + downedPerforator = flags[2]; + downedSlimeGod = flags[3]; + downedCryogen = flags[4]; + downedBrimstoneElemental = flags[5]; + downedCalamitas = flags[6]; + downedLeviathan = flags[7]; - BitsByte flags2 = reader.ReadByte(); - downedDoG = flags2[0]; - downedPlaguebringer = flags2[1]; - downedGuardians = flags2[2]; - downedProvidence = flags2[3]; - downedSentinel1 = flags2[4]; - downedSentinel2 = flags2[5]; - downedSentinel3 = flags2[6]; - downedYharon = flags2[7]; + BitsByte flags2 = reader.ReadByte(); + downedDoG = flags2[0]; + downedPlaguebringer = flags2[1]; + downedGuardians = flags2[2]; + downedProvidence = flags2[3]; + downedSentinel1 = flags2[4]; + downedSentinel2 = flags2[5]; + downedSentinel3 = flags2[6]; + downedYharon = flags2[7]; - // Explicitly discard the now-unused vanilla boss booleans - BitsByte flags3 = reader.ReadByte(); - downedSCal = flags3[0]; - downedBumble = flags3[1]; - downedCrabulon = flags3[2]; - downedBetsy = flags3[3]; - downedScavenger = flags3[4]; - _ = flags3[5]; - _ = flags3[6]; - _ = flags3[7]; + // Explicitly discard the now-unused vanilla boss booleans + BitsByte flags3 = reader.ReadByte(); + downedSCal = flags3[0]; + downedBumble = flags3[1]; + downedCrabulon = flags3[2]; + downedBetsy = flags3[3]; + downedScavenger = flags3[4]; + _ = flags3[5]; + _ = flags3[6]; + _ = flags3[7]; - BitsByte flags4 = reader.ReadByte(); - _ = flags4[0]; - _ = flags4[1]; - _ = flags4[2]; - _ = flags4[3]; - downedBossAny = flags4[4]; - demonMode = flags4[5]; - onionMode = flags4[6]; - revenge = flags4[7]; + BitsByte flags4 = reader.ReadByte(); + _ = flags4[0]; + _ = flags4[1]; + _ = flags4[2]; + _ = flags4[3]; + downedBossAny = flags4[4]; + demonMode = flags4[5]; + onionMode = flags4[6]; + revenge = flags4[7]; // These 3 bits are currently unused, they used to be astral meteor drops BitsByte flags5 = reader.ReadByte(); - downedStarGod = flags5[0]; - _ = flags5[1]; - _ = flags5[2]; - _ = flags5[3]; - spawnedHardBoss = flags5[4]; - downedPolterghast = flags5[5]; - death = flags5[6]; - downedLORDE = flags5[7]; - - BitsByte flags6 = reader.ReadByte(); - abyssSide = flags6[0]; - downedAquaticScourge = flags6[1]; - downedAstrageldon = flags6[2]; - buffedEclipse = flags6[3]; - armageddon = flags6[4]; - defiled = flags6[5]; - downedBuffedMothron = flags6[6]; - ironHeart = flags6[7]; - - BitsByte flags7 = reader.ReadByte(); - bossRushActive = flags7[0]; - downedOldDuke = flags7[1]; - downedCLAM = flags7[2]; - - abyssChasmBottom = reader.ReadInt32(); - } - #endregion - - #region Tiles - public override void ResetNearbyTileEffects() - { - calamityTiles = 0; - astralTiles = 0; - sunkenSeaTiles = 0; - sulphurTiles = 0; - abyssTiles = 0; - } - - public override void TileCountsAvailable(int[] tileCounts) - { - calamityTiles = tileCounts[mod.TileType("CharredOre")] + tileCounts[mod.TileType("BrimstoneSlag")]; - sunkenSeaTiles = tileCounts[mod.TileType("EutrophicSand")] + tileCounts[mod.TileType("Navystone")] + tileCounts[mod.TileType("SeaPrism")]; - abyssTiles = tileCounts[mod.TileType("AbyssGravel")]; - sulphurTiles = tileCounts[mod.TileType("SulphurousSand")]; - - #region Astral Stuff - int astralDesertTiles = tileCounts[mod.TileType("AstralSand")] + tileCounts[mod.TileType("AstralSandstone")] + tileCounts[mod.TileType("HardenedAstralSand")]; - int astralSnowTiles = tileCounts[mod.TileType("AstralIce")]; - - Main.sandTiles += astralDesertTiles; - Main.snowTiles += astralSnowTiles; - - astralTiles = astralDesertTiles + astralSnowTiles + tileCounts[mod.TileType("AstralDirt")] + tileCounts[mod.TileType("AstralStone")] + tileCounts[mod.TileType("AstralGrass")] + tileCounts[mod.TileType("AstralOre")]; - #endregion - } - #endregion - - #region PreWorldGen - public override void PreWorldGen() - { - numAbyssIslands = 0; - roxShrinePlaced = false; - } - #endregion - - #region ModifyWorldGenTasks - public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) - { - int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies")); - if (ShiniesIndex != -1) - { - tasks.Insert(ShiniesIndex + 1, new PassLegacy("IceTomb", delegate (GenerationProgress progress) - { - progress.Message = "Ice Tomb"; - SmallBiomes.PlaceIceTomb(); - })); - - tasks.Insert(ShiniesIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress) - { - progress.Message = "Evil Island"; - SmallBiomes.PlaceEvilIsland(); - })); - } - - int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); - if (DungeonChestIndex != -1) - { - tasks.Insert(DungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", WorldGenerationMethods.GenerateBiomeChests)); - } - - int WaterFromSandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Remove Water From Sand")); - if (WaterFromSandIndex != -1) - { - tasks.Insert(WaterFromSandIndex + 1, new PassLegacy("SunkenSea", delegate (GenerationProgress progress) - { - progress.Message = "Making the world more wet"; - SunkenSea.Place(new Point(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom)); - })); - } - - int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); - if (SulphurIndex != -1) - { - tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) - { - progress.Message = "Sulphur Sea"; - Abyss.PlaceSulphurSea(); - })); - } - - int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); - if (FinalIndex != -1) - { - //Not touching this yet because the Crags will be reworked in the future - #region BrimstoneCrag - tasks.Insert(FinalIndex + 1, new PassLegacy("BrimstoneCrag", delegate (GenerationProgress progress) - { - progress.Message = "Brimstone Crag"; - - int x = Main.maxTilesX; - - int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); - int yUnderworldGen = Main.maxTilesY - 100; - - fuhX = xUnderworldGen; - fuhY = yUnderworldGen; - - WorldGenerationMethods.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); - - WorldGenerationMethods.ChasmGenerator(fuhX - 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); - WorldGenerationMethods.ChasmGenerator(fuhX + 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); - - WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); - - WorldGenerationMethods.UnderworldIslandHouse(fuhX, fuhY + 30, 1323); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 22, fuhY + 15, 1322); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 22, fuhY + 15, 535); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 50, fuhY - 30, 112); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 50, fuhY - 30, 906); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 150, fuhY - 30, 218); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 150, fuhY - 30, 3019); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 180, fuhY - 20, 274); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 180, fuhY - 20, 220); - })); - #endregion - - tasks.Insert(FinalIndex + 2, new PassLegacy("SpecialShrines", delegate (GenerationProgress progress) - { - progress.Message = "Special Shrines"; - SmallBiomes.PlaceShrines(); - })); - - tasks.Insert(FinalIndex + 3, new PassLegacy("Abyss", delegate (GenerationProgress progress) - { - progress.Message = "The Abyss"; - Abyss.PlaceAbyss(); - })); - - tasks.Insert(FinalIndex + 4, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) - { - progress.Message = "I Wanna Rock"; - WorldGenerationMethods.PlaceRoxShrine(); - })); - } - - tasks.Add(new PassLegacy("Planetoid Test", WorldGenerationMethods.Planetoids)); - } - - // An Astral Meteor always falls at the beginning of Hardmode. - public override void ModifyHardmodeTasks(List tasks) - { - // Yes, this internal identifier is misspelled in vanilla. - int announceIndex = tasks.FindIndex(match => match.Name == "Hardmode Announcment"); - - // Insert the Astral biome generation right before the final hardmode announcement. - tasks.Insert(announceIndex, new PassLegacy("AstralMeteor", delegate (GenerationProgress progress) - { - WorldGenerationMethods.PlaceAstralMeteor(); - })); - } - #endregion - - #region PostUpdate - public override void PostUpdate() - { - SunkenSeaLocation = new Rectangle(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom, - WorldGen.UndergroundDesertLocation.Width, WorldGen.UndergroundDesertLocation.Height / 2); - int closestPlayer = (int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0); - - if (!deactivateStupidFuckingBullshit) - { - deactivateStupidFuckingBullshit = true; - bossRushActive = false; - CalamityMod.UpdateServerBoolean(); - } - if (bossRushActive) - { - if (NPC.MoonLordCountdown > 0) - { - NPC.MoonLordCountdown = 0; - } - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (bossRushSpawnCountdown > 0) - { - bossRushSpawnCountdown--; - if (bossRushSpawnCountdown == 180) - { - if (bossRushStage == 28) - { - string key = "Mods.CalamityMod.BossRushTierThreeEndText2"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (bossRushStage == 36) - { - string key = "Mods.CalamityMod.BossRushTierFourEndText2"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - } - if (bossRushSpawnCountdown <= 0) - { - bossRushSpawnCountdown = 60; - if (bossRushStage > 27) - { - bossRushSpawnCountdown += 300; - } - switch (bossRushStage) - { - case 9: - bossRushSpawnCountdown = 240; - break; - case 18: - bossRushSpawnCountdown = 300; - break; - case 25: - bossRushSpawnCountdown = 360; - break; - case 32: - bossRushSpawnCountdown = 420; - break; - default: - break; - } - if (bossRushStage == 13) - { - for (int playerIndex = 0; playerIndex < 255; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player = Main.player[playerIndex]; - player.Spawn(); - } - } - } - else if (bossRushStage == 36) - { - for (int playerIndex = 0; playerIndex < 255; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player = Main.player[playerIndex]; - if (player.FindBuffIndex(mod.BuffType("ExtremeGravity")) > -1) - { - player.ClearBuff(mod.BuffType("ExtremeGravity")); - } - } - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(SoundID.Roar, Main.player[closestPlayer].position, 0); - switch (bossRushStage) - { - case 0: - NPC.SpawnOnPlayer(closestPlayer, NPCID.QueenBee); - break; - case 1: - NPC.SpawnOnPlayer(closestPlayer, NPCID.BrainofCthulhu); - break; - case 2: - NPC.SpawnOnPlayer(closestPlayer, NPCID.KingSlime); - break; - case 3: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.EyeofCthulhu); - break; - case 4: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.SkeletronPrime); - break; - case 5: - ChangeTime(true); - NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), - (int)(Main.player[closestPlayer].position.Y - 400f), - NPCID.Golem, 0, 0f, 0f, 0f, 0f, 255); - break; - case 6: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss2")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss3")); - break; - case 7: - NPC.SpawnOnPlayer(closestPlayer, NPCID.EaterofWorldsHead); - break; - case 8: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Astrageldon")); - break; - case 9: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.TheDestroyer); - break; - case 10: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.Spazmatism); - NPC.SpawnOnPlayer(closestPlayer, NPCID.Retinazer); - break; - case 11: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Bumblefuck")); - break; - case 12: - NPC.SpawnWOF(Main.player[closestPlayer].position); - break; - case 13: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("HiveMind")); - break; - case 14: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.SkeletronHead); - break; - case 15: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("StormWeaverHead")); - break; - case 16: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("AquaticScourgeHead")); - break; - case 17: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHead")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); - break; - case 18: - int num1302 = NPC.NewNPC((int)Main.player[closestPlayer].Center.X, (int)Main.player[closestPlayer].Center.Y - 400, NPCID.CultistBoss, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1302].direction = (Main.npc[num1302].spriteDirection = Math.Sign(Main.player[closestPlayer].Center.X - (float)Main.player[closestPlayer].Center.X - 90f)); - break; - case 19: - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && (Main.npc[doom].type == 493 || Main.npc[doom].type == 422 || Main.npc[doom].type == 507 || - Main.npc[doom].type == 517)) - { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), (int)(Main.player[closestPlayer].position.Y - 400f), mod.NPCType("CrabulonIdle"), 0, 0f, 0f, 0f, 0f, 255); - break; - case 20: - NPC.SpawnOnPlayer(closestPlayer, NPCID.Plantera); - break; - case 21: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CeaselessVoid")); - break; - case 22: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("PerforatorHive")); - break; - case 23: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Cryogen")); - break; - case 24: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("BrimstoneElemental")); - break; - case 25: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CosmicWraith")); - break; - case 26: - NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), (int)(Main.player[closestPlayer].position.Y - 400f), mod.NPCType("ScavengerBody"), 0, 0f, 0f, 0f, 0f, 255); - break; - case 27: - NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), (int)(Main.player[closestPlayer].position.Y - 400f), NPCID.DukeFishron, 0, 0f, 0f, 0f, 0f, 255); - break; - case 28: - NPC.SpawnOnPlayer(closestPlayer, NPCID.MoonLordCore); - break; - case 29: - ChangeTime(false); - for (int x = 0; x < 10; x++) - { - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("AstrumDeusHead")); - } - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("AstrumDeusHeadSpectral")); - break; - case 30: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Polterghast")); - break; - case 31: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("PlaguebringerGoliath")); - break; - case 32: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Calamitas")); - break; - case 33: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Siren")); - break; - case 34: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SlimeGod")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SlimeGodRun")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SlimeGodCore")); - break; - case 35: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Providence")); - break; - case 36: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SupremeCalamitas")); - break; - case 37: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Yharon")); - break; - case 38: - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DevourerofGodsHeadS")); - break; - } - } - } - } - } - else - { - bossRushSpawnCountdown = 180; - if (bossRushStage != 0) - { - bossRushStage = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(bossRushStage); - netMessage.Send(); - } - } - } - - if (DoGSecondStageCountdown > 0) - { - DoGSecondStageCountdown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(DoGSecondStageCountdown); - netMessage.Send(); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (DoGSecondStageCountdown == 21540) - { - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CeaselessVoid")); - } - if (DoGSecondStageCountdown == 14340) - { - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("StormWeaverHead")); - } - if (DoGSecondStageCountdown == 7140) - { - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CosmicWraith")); - } - if (DoGSecondStageCountdown <= 60) - { - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) - { - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DevourerofGodsHeadS")); - string key = "Mods.CalamityMod.EdgyBossText10"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - } - } - - if (Main.player[closestPlayer].ZoneDungeon && !NPC.downedBoss3) - { - if (!NPC.AnyNPCs(NPCID.DungeonGuardian) && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(closestPlayer, NPCID.DungeonGuardian); //your hell is as vast as my bonergrin, pray your life ends quickly - } - - if (Main.player[closestPlayer].ZoneRockLayerHeight && - !Main.player[closestPlayer].ZoneUnderworldHeight && - !Main.player[closestPlayer].ZoneDungeon && - !Main.player[closestPlayer].ZoneJungle && - !Main.player[closestPlayer].Calamity().ZoneSunkenSea && - !CalamityPlayer.areThereAnyDamnBosses) - { - if (NPC.downedPlantBoss && - !Main.player[closestPlayer].Calamity().ZoneAbyss && - Main.player[closestPlayer].townNPCs < 3f) - { - double spawnRate = 100000D; - - if (death) - spawnRate *= 0.75D; - else if (revenge) - spawnRate *= 0.85D; - - if (demonMode) - spawnRate *= 0.75D; - - if (Main.player[closestPlayer].Calamity().zerg && Main.player[closestPlayer].Calamity().chaosCandle) - spawnRate *= 0.005D; - else if (Main.player[closestPlayer].Calamity().zerg) - spawnRate *= 0.01D; - else if (Main.player[closestPlayer].Calamity().chaosCandle) - spawnRate *= 0.02D; - - if (Main.player[closestPlayer].Calamity().zen && Main.player[closestPlayer].Calamity().tranquilityCandle) - spawnRate *= 75D; - else if (Main.player[closestPlayer].Calamity().zen) - spawnRate *= 50D; - else if (Main.player[closestPlayer].Calamity().tranquilityCandle) - spawnRate *= 25D; - - int chance = (int)spawnRate; - if (Main.rand.Next(chance) == 0) - { - if (!NPC.AnyNPCs(mod.NPCType("ArmoredDiggerHead")) && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ArmoredDiggerHead")); - } - } - } - - if (Main.dayTime && Main.hardMode) - { - if (Main.player[closestPlayer].townNPCs >= 2f) - { - if (Main.rand.NextBool(2000)) - { - int steamGril = NPC.FindFirstNPC(NPCID.Steampunker); - if (steamGril == -1 && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(closestPlayer, NPCID.Steampunker); - } - } - } - - if (Main.player[closestPlayer].Calamity().ZoneAbyss) - { - if (Main.player[closestPlayer].chaosState) - { - if (!NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("EidolonWyrmHeadHuge")); - } - } - - /*if (Main.rand.NextBool(100000000)) - { - string key = "Mods.CalamityMod.AprilFools"; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - }*/ - - if (death && !CalamityPlayer.areThereAnyDamnBosses && Main.player[closestPlayer].statLifeMax2 >= 300) - { - if (bossSpawnCountdown <= 0) //check for countdown being 0 - { - if (Main.rand.NextBool(50000)) - { - if (!NPC.downedBoss1 && bossType == 0) //only set countdown and boss type if conditions are met - if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) - { - BossText(); - bossType = NPCID.EyeofCthulhu; - bossSpawnCountdown = 3600; //1 minute - } - - if (!NPC.downedBoss2 && bossType == 0) - if (Main.player[closestPlayer].ZoneCorrupt) - { - BossText(); - bossType = NPCID.EaterofWorldsHead; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedBoss2 && bossType == 0) - if (Main.player[closestPlayer].ZoneCrimson) - { - BossText(); - bossType = NPCID.BrainofCthulhu; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedQueenBee && bossType == 0) - if (Main.player[closestPlayer].ZoneJungle && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) - { - BossText(); - bossType = NPCID.QueenBee; - bossSpawnCountdown = 3600; - } - - if (!downedDesertScourge && bossType == 0) - if (Main.player[closestPlayer].ZoneDesert) - { - BossText(); - bossType = mod.NPCType("DesertScourgeHead"); - bossSpawnCountdown = 3600; - } - - if (!downedPerforator && bossType == 0) - if (Main.player[closestPlayer].ZoneCrimson) - { - BossText(); - bossType = mod.NPCType("PerforatorHive"); - bossSpawnCountdown = 3600; - } - - if (!downedHiveMind && bossType == 0) - if (Main.player[closestPlayer].ZoneCorrupt) - { - BossText(); - bossType = mod.NPCType("HiveMind"); - bossSpawnCountdown = 3600; - } - - if (!downedCrabulon && bossType == 0) - if (Main.player[closestPlayer].ZoneGlowshroom) - { - BossText(); - bossType = mod.NPCType("CrabulonIdle"); - bossSpawnCountdown = 3600; - } - - if (Main.hardMode) - { - if (!NPC.downedMechBoss1 && bossType == 0) - if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) - { - BossText(); - bossType = NPCID.TheDestroyer; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedMechBoss2 && bossType == 0) - if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) - { - BossText(); - bossType = NPCID.Spazmatism; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedMechBoss3 && bossType == 0) - if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) - { - BossText(); - bossType = NPCID.SkeletronPrime; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedPlantBoss && bossType == 0) - if (Main.player[closestPlayer].ZoneJungle && !Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight) - { - BossText(); - bossType = NPCID.Plantera; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedFishron && bossType == 0) - if (Main.player[closestPlayer].ZoneBeach && !Main.player[closestPlayer].Calamity().ZoneSulphur) - { - BossText(); - bossType = NPCID.DukeFishron; - bossSpawnCountdown = 3600; - } - - if (!downedCryogen && bossType == 0) - if (Main.player[closestPlayer].ZoneSnow && Main.player[closestPlayer].ZoneOverworldHeight) - { - BossText(); - bossType = mod.NPCType("Cryogen"); - bossSpawnCountdown = 3600; - } - - if (!downedCalamitas && bossType == 0) - if (!Main.dayTime && Main.player[closestPlayer].ZoneOverworldHeight) - { - BossText(); - bossType = mod.NPCType("Calamitas"); - bossSpawnCountdown = 3600; - } - - if (!downedAstrageldon && bossType == 0) - if (Main.player[closestPlayer].Calamity().ZoneAstral && - !Main.dayTime && Main.player[closestPlayer].ZoneOverworldHeight) - { - BossText(); - bossType = mod.NPCType("Astrageldon"); - bossSpawnCountdown = 3600; - } - - if (!downedPlaguebringer && bossType == 0) - if (Main.player[closestPlayer].ZoneJungle && NPC.downedGolemBoss && Main.player[closestPlayer].ZoneOverworldHeight) - { - BossText(); - bossType = mod.NPCType("PlaguebringerGoliath"); - bossSpawnCountdown = 3600; - } - - if (NPC.downedMoonlord) - { - if (!downedGuardians && bossType == 0) - if (Main.player[closestPlayer].ZoneUnderworldHeight || - (Main.player[closestPlayer].ZoneHoly && Main.player[closestPlayer].ZoneOverworldHeight)) - { - BossText(); - bossType = mod.NPCType("ProfanedGuardianBoss"); - bossSpawnCountdown = 3600; - } - - if (!downedBumble && bossType == 0) - if (Main.player[closestPlayer].ZoneJungle && Main.player[closestPlayer].ZoneOverworldHeight) - { - BossText(); - bossType = mod.NPCType("Bumblefuck"); - bossSpawnCountdown = 3600; - } - } - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); - netMessage.Write(bossSpawnCountdown); - netMessage.Send(); - var netMessage2 = mod.GetPacket(); - netMessage2.Write((byte)CalamityModMessageType.BossTypeSync); - netMessage2.Write(bossType); - netMessage2.Send(); - } - } - } - else - { - bossSpawnCountdown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); - netMessage.Write(bossSpawnCountdown); - netMessage.Send(); - } - if (bossSpawnCountdown <= 0) - { - bool canSpawn = true; - switch (bossType) - { - case NPCID.EyeofCthulhu: - if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) - canSpawn = false; - break; - case NPCID.EaterofWorldsHead: - if (!Main.player[closestPlayer].ZoneCorrupt) - canSpawn = false; - break; - case NPCID.BrainofCthulhu: - if (!Main.player[closestPlayer].ZoneCrimson) - canSpawn = false; - break; - case NPCID.QueenBee: - if (!Main.player[closestPlayer].ZoneJungle || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) - canSpawn = false; - break; - case NPCID.TheDestroyer: - if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) - canSpawn = false; - break; - case NPCID.Spazmatism: - if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) - canSpawn = false; - break; - case NPCID.SkeletronPrime: - if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) - canSpawn = false; - break; - case NPCID.Plantera: - if (!Main.player[closestPlayer].ZoneJungle || Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight) - canSpawn = false; - break; - case NPCID.DukeFishron: - if (!Main.player[closestPlayer].ZoneBeach) - canSpawn = false; - break; - } - - if (bossType == mod.NPCType("DesertScourgeHead")) - { - if (!Main.player[closestPlayer].ZoneDesert) - canSpawn = false; - } - else if (bossType == mod.NPCType("PerforatorHive")) - { - if (!Main.player[closestPlayer].ZoneCrimson) - canSpawn = false; - } - else if (bossType == mod.NPCType("HiveMind")) - { - if (!Main.player[closestPlayer].ZoneCorrupt) - canSpawn = false; - } - else if (bossType == mod.NPCType("CrabulonIdle")) - { - if (!Main.player[closestPlayer].ZoneGlowshroom) - canSpawn = false; - } - else if (bossType == mod.NPCType("Cryogen")) - { - if (!Main.player[closestPlayer].ZoneSnow || !Main.player[closestPlayer].ZoneOverworldHeight) - canSpawn = false; - } - else if (bossType == mod.NPCType("Calamitas")) - { - if (Main.dayTime || !Main.player[closestPlayer].ZoneOverworldHeight) - canSpawn = false; - } - else if (bossType == mod.NPCType("Astrageldon")) - { - if (!Main.player[closestPlayer].Calamity().ZoneAstral || - Main.dayTime || !Main.player[closestPlayer].ZoneOverworldHeight) - canSpawn = false; - } - else if (bossType == mod.NPCType("PlaguebringerGoliath")) - { - if (!Main.player[closestPlayer].ZoneJungle || !Main.player[closestPlayer].ZoneOverworldHeight) - canSpawn = false; - } - else if (bossType == mod.NPCType("ProfanedGuardianBoss")) - { - if (!Main.player[closestPlayer].ZoneUnderworldHeight && - (!Main.player[closestPlayer].ZoneHoly || !Main.player[closestPlayer].ZoneOverworldHeight)) - canSpawn = false; - } - else if (bossType == mod.NPCType("Bumblefuck")) - { - if (!Main.player[closestPlayer].ZoneJungle || !Main.player[closestPlayer].ZoneOverworldHeight) - canSpawn = false; - } - - if (canSpawn && Main.netMode != NetmodeID.MultiplayerClient) - { - if (bossType == NPCID.Spazmatism) - NPC.SpawnOnPlayer(closestPlayer, NPCID.Retinazer); - else if (bossType == mod.NPCType("ProfanedGuardianBoss")) - { - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss2")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss3")); - } - else if (bossType == mod.NPCType("DesertScourgeHead")) - { - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); - NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); - } - if (bossType == NPCID.DukeFishron) - NPC.NewNPC((int)Main.player[closestPlayer].Center.X - 300, (int)Main.player[closestPlayer].Center.Y - 300, bossType); - else - NPC.SpawnOnPlayer(closestPlayer, bossType); - } - bossType = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossTypeSync); - netMessage.Write(bossType); - netMessage.Send(); - } - } - } - } - - if (!downedDesertScourge) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Sandstorm.Happening) - { - Sandstorm.Happening = false; - Sandstorm.TimeLeft = 0; - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CultistRitual.delay -= Main.dayRate * 10; - if (CultistRitual.delay < 0) - { - CultistRitual.delay = 0; - } - CultistRitual.recheck -= Main.dayRate * 10; - if (CultistRitual.recheck < 0) - { - CultistRitual.recheck = 0; - } - } - } - #endregion - - #region ChangeTime - public static void ChangeTime(bool day) - { - Main.time = 0.0; - Main.dayTime = day; - CalamityMod.UpdateServerBoolean(); - } - #endregion - - #region BossText - public void BossText() - { - string key = "Mods.CalamityMod.BossSpawnText"; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - #endregion - } + downedStarGod = flags5[0]; + _ = flags5[1]; + _ = flags5[2]; + _ = flags5[3]; + spawnedHardBoss = flags5[4]; + downedPolterghast = flags5[5]; + death = flags5[6]; + downedLORDE = flags5[7]; + + BitsByte flags6 = reader.ReadByte(); + abyssSide = flags6[0]; + downedAquaticScourge = flags6[1]; + downedAstrageldon = flags6[2]; + buffedEclipse = flags6[3]; + armageddon = flags6[4]; + defiled = flags6[5]; + downedBuffedMothron = flags6[6]; + ironHeart = flags6[7]; + + BitsByte flags7 = reader.ReadByte(); + bossRushActive = flags7[0]; + downedOldDuke = flags7[1]; + downedCLAM = flags7[2]; + + abyssChasmBottom = reader.ReadInt32(); + } + #endregion + + #region Tiles + public override void ResetNearbyTileEffects() + { + calamityTiles = 0; + astralTiles = 0; + sunkenSeaTiles = 0; + sulphurTiles = 0; + abyssTiles = 0; + } + + public override void TileCountsAvailable(int[] tileCounts) + { + calamityTiles = tileCounts[mod.TileType("CharredOre")] + tileCounts[mod.TileType("BrimstoneSlag")]; + sunkenSeaTiles = tileCounts[mod.TileType("EutrophicSand")] + tileCounts[mod.TileType("Navystone")] + tileCounts[mod.TileType("SeaPrism")]; + abyssTiles = tileCounts[mod.TileType("AbyssGravel")]; + sulphurTiles = tileCounts[mod.TileType("SulphurousSand")]; + + #region Astral Stuff + int astralDesertTiles = tileCounts[mod.TileType("AstralSand")] + tileCounts[mod.TileType("AstralSandstone")] + tileCounts[mod.TileType("HardenedAstralSand")]; + int astralSnowTiles = tileCounts[mod.TileType("AstralIce")]; + + Main.sandTiles += astralDesertTiles; + Main.snowTiles += astralSnowTiles; + + astralTiles = astralDesertTiles + astralSnowTiles + tileCounts[mod.TileType("AstralDirt")] + tileCounts[mod.TileType("AstralStone")] + tileCounts[mod.TileType("AstralGrass")] + tileCounts[mod.TileType("AstralOre")]; + #endregion + } + #endregion + + #region PreWorldGen + public override void PreWorldGen() + { + numAbyssIslands = 0; + roxShrinePlaced = false; + } + #endregion + + #region ModifyWorldGenTasks + public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) + { + int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies")); + if (ShiniesIndex != -1) + { + tasks.Insert(ShiniesIndex + 1, new PassLegacy("IceTomb", delegate (GenerationProgress progress) + { + progress.Message = "Ice Tomb"; + SmallBiomes.PlaceIceTomb(); + })); + + tasks.Insert(ShiniesIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress) + { + progress.Message = "Evil Island"; + SmallBiomes.PlaceEvilIsland(); + })); + } + + int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); + if (DungeonChestIndex != -1) + { + tasks.Insert(DungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", WorldGenerationMethods.GenerateBiomeChests)); + } + + int WaterFromSandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Remove Water From Sand")); + if (WaterFromSandIndex != -1) + { + tasks.Insert(WaterFromSandIndex + 1, new PassLegacy("SunkenSea", delegate (GenerationProgress progress) + { + progress.Message = "Making the world more wet"; + SunkenSea.Place(new Point(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom)); + })); + } + + int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); + if (SulphurIndex != -1) + { + tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) + { + progress.Message = "Sulphur Sea"; + Abyss.PlaceSulphurSea(); + })); + } + + int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); + if (FinalIndex != -1) + { + //Not touching this yet because the Crags will be reworked in the future + #region BrimstoneCrag + tasks.Insert(FinalIndex + 1, new PassLegacy("BrimstoneCrag", delegate (GenerationProgress progress) + { + progress.Message = "Brimstone Crag"; + + int x = Main.maxTilesX; + + int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); + int yUnderworldGen = Main.maxTilesY - 100; + + fuhX = xUnderworldGen; + fuhY = yUnderworldGen; + + WorldGenerationMethods.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); + + WorldGenerationMethods.ChasmGenerator(fuhX - 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + WorldGenerationMethods.ChasmGenerator(fuhX + 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + + WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); + + WorldGenerationMethods.UnderworldIslandHouse(fuhX, fuhY + 30, 1323); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 22, fuhY + 15, 1322); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 22, fuhY + 15, 535); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 50, fuhY - 30, 112); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 50, fuhY - 30, 906); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 150, fuhY - 30, 218); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 150, fuhY - 30, 3019); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 180, fuhY - 20, 274); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 180, fuhY - 20, 220); + })); + #endregion + + tasks.Insert(FinalIndex + 2, new PassLegacy("SpecialShrines", delegate (GenerationProgress progress) + { + progress.Message = "Special Shrines"; + SmallBiomes.PlaceShrines(); + })); + + tasks.Insert(FinalIndex + 3, new PassLegacy("Abyss", delegate (GenerationProgress progress) + { + progress.Message = "The Abyss"; + Abyss.PlaceAbyss(); + })); + + tasks.Insert(FinalIndex + 4, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) + { + progress.Message = "I Wanna Rock"; + WorldGenerationMethods.PlaceRoxShrine(); + })); + } + + tasks.Add(new PassLegacy("Planetoid Test", WorldGenerationMethods.Planetoids)); + } + + // An Astral Meteor always falls at the beginning of Hardmode. + public override void ModifyHardmodeTasks(List tasks) + { + // Yes, this internal identifier is misspelled in vanilla. + int announceIndex = tasks.FindIndex(match => match.Name == "Hardmode Announcment"); + + // Insert the Astral biome generation right before the final hardmode announcement. + tasks.Insert(announceIndex, new PassLegacy("AstralMeteor", delegate (GenerationProgress progress) + { + WorldGenerationMethods.PlaceAstralMeteor(); + })); + } + #endregion + + #region PostUpdate + public override void PostUpdate() + { + SunkenSeaLocation = new Rectangle(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom, + WorldGen.UndergroundDesertLocation.Width, WorldGen.UndergroundDesertLocation.Height / 2); + int closestPlayer = (int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0); + + if (!deactivateStupidFuckingBullshit) + { + deactivateStupidFuckingBullshit = true; + bossRushActive = false; + CalamityMod.UpdateServerBoolean(); + } + if (bossRushActive) + { + if (NPC.MoonLordCountdown > 0) + { + NPC.MoonLordCountdown = 0; + } + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (bossRushSpawnCountdown > 0) + { + bossRushSpawnCountdown--; + if (bossRushSpawnCountdown == 180) + { + if (bossRushStage == 28) + { + string key = "Mods.CalamityMod.BossRushTierThreeEndText2"; + Color messageColor = Color.LightCoral; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (bossRushStage == 36) + { + string key = "Mods.CalamityMod.BossRushTierFourEndText2"; + Color messageColor = Color.LightCoral; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + } + if (bossRushSpawnCountdown <= 0) + { + bossRushSpawnCountdown = 60; + if (bossRushStage > 27) + { + bossRushSpawnCountdown += 300; + } + switch (bossRushStage) + { + case 9: + bossRushSpawnCountdown = 240; + break; + case 18: + bossRushSpawnCountdown = 300; + break; + case 25: + bossRushSpawnCountdown = 360; + break; + case 32: + bossRushSpawnCountdown = 420; + break; + default: + break; + } + if (bossRushStage == 13) + { + for (int playerIndex = 0; playerIndex < 255; playerIndex++) + { + if (Main.player[playerIndex].active) + { + Player player = Main.player[playerIndex]; + player.Spawn(); + } + } + } + else if (bossRushStage == 36) + { + for (int playerIndex = 0; playerIndex < 255; playerIndex++) + { + if (Main.player[playerIndex].active) + { + Player player = Main.player[playerIndex]; + if (player.FindBuffIndex(mod.BuffType("ExtremeGravity")) > -1) + { + player.ClearBuff(mod.BuffType("ExtremeGravity")); + } + } + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(SoundID.Roar, Main.player[closestPlayer].position, 0); + switch (bossRushStage) + { + case 0: + NPC.SpawnOnPlayer(closestPlayer, NPCID.QueenBee); + break; + case 1: + NPC.SpawnOnPlayer(closestPlayer, NPCID.BrainofCthulhu); + break; + case 2: + NPC.SpawnOnPlayer(closestPlayer, NPCID.KingSlime); + break; + case 3: + ChangeTime(false); + NPC.SpawnOnPlayer(closestPlayer, NPCID.EyeofCthulhu); + break; + case 4: + ChangeTime(false); + NPC.SpawnOnPlayer(closestPlayer, NPCID.SkeletronPrime); + break; + case 5: + ChangeTime(true); + NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), + (int)(Main.player[closestPlayer].position.Y - 400f), + NPCID.Golem, 0, 0f, 0f, 0f, 0f, 255); + break; + case 6: + ChangeTime(true); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss2")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss3")); + break; + case 7: + NPC.SpawnOnPlayer(closestPlayer, NPCID.EaterofWorldsHead); + break; + case 8: + ChangeTime(false); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Astrageldon")); + break; + case 9: + ChangeTime(false); + NPC.SpawnOnPlayer(closestPlayer, NPCID.TheDestroyer); + break; + case 10: + ChangeTime(false); + NPC.SpawnOnPlayer(closestPlayer, NPCID.Spazmatism); + NPC.SpawnOnPlayer(closestPlayer, NPCID.Retinazer); + break; + case 11: + ChangeTime(true); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Bumblefuck")); + break; + case 12: + NPC.SpawnWOF(Main.player[closestPlayer].position); + break; + case 13: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("HiveMind")); + break; + case 14: + ChangeTime(false); + NPC.SpawnOnPlayer(closestPlayer, NPCID.SkeletronHead); + break; + case 15: + ChangeTime(true); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("StormWeaverHead")); + break; + case 16: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("AquaticScourgeHead")); + break; + case 17: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHead")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); + break; + case 18: + int num1302 = NPC.NewNPC((int)Main.player[closestPlayer].Center.X, (int)Main.player[closestPlayer].Center.Y - 400, NPCID.CultistBoss, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1302].direction = (Main.npc[num1302].spriteDirection = Math.Sign(Main.player[closestPlayer].Center.X - (float)Main.player[closestPlayer].Center.X - 90f)); + break; + case 19: + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && (Main.npc[doom].type == 493 || Main.npc[doom].type == 422 || Main.npc[doom].type == 507 || + Main.npc[doom].type == 517)) + { + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), (int)(Main.player[closestPlayer].position.Y - 400f), mod.NPCType("CrabulonIdle"), 0, 0f, 0f, 0f, 0f, 255); + break; + case 20: + NPC.SpawnOnPlayer(closestPlayer, NPCID.Plantera); + break; + case 21: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CeaselessVoid")); + break; + case 22: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("PerforatorHive")); + break; + case 23: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Cryogen")); + break; + case 24: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("BrimstoneElemental")); + break; + case 25: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CosmicWraith")); + break; + case 26: + NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), (int)(Main.player[closestPlayer].position.Y - 400f), mod.NPCType("ScavengerBody"), 0, 0f, 0f, 0f, 0f, 255); + break; + case 27: + NPC.NewNPC((int)(Main.player[closestPlayer].position.X + (float)(Main.rand.Next(-100, 101))), (int)(Main.player[closestPlayer].position.Y - 400f), NPCID.DukeFishron, 0, 0f, 0f, 0f, 0f, 255); + break; + case 28: + NPC.SpawnOnPlayer(closestPlayer, NPCID.MoonLordCore); + break; + case 29: + ChangeTime(false); + for (int x = 0; x < 10; x++) + { + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("AstrumDeusHead")); + } + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("AstrumDeusHeadSpectral")); + break; + case 30: + ChangeTime(true); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Polterghast")); + break; + case 31: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("PlaguebringerGoliath")); + break; + case 32: + ChangeTime(false); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Calamitas")); + break; + case 33: + ChangeTime(true); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Siren")); + break; + case 34: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SlimeGod")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SlimeGodRun")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SlimeGodCore")); + break; + case 35: + ChangeTime(true); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Providence")); + break; + case 36: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("SupremeCalamitas")); + break; + case 37: + ChangeTime(true); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("Yharon")); + break; + case 38: + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DevourerofGodsHeadS")); + break; + } + } + } + } + } + else + { + bossRushSpawnCountdown = 180; + if (bossRushStage != 0) + { + bossRushStage = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(bossRushStage); + netMessage.Send(); + } + } + } + + if (DoGSecondStageCountdown > 0) + { + DoGSecondStageCountdown--; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(DoGSecondStageCountdown); + netMessage.Send(); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (DoGSecondStageCountdown == 21540) + { + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CeaselessVoid")); + } + if (DoGSecondStageCountdown == 14340) + { + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("StormWeaverHead")); + } + if (DoGSecondStageCountdown == 7140) + { + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("CosmicWraith")); + } + if (DoGSecondStageCountdown <= 60) + { + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) + { + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DevourerofGodsHeadS")); + string key = "Mods.CalamityMod.EdgyBossText10"; + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + } + } + + if (Main.player[closestPlayer].ZoneDungeon && !NPC.downedBoss3) + { + if (!NPC.AnyNPCs(NPCID.DungeonGuardian) && Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(closestPlayer, NPCID.DungeonGuardian); //your hell is as vast as my bonergrin, pray your life ends quickly + } + + if (Main.player[closestPlayer].ZoneRockLayerHeight && + !Main.player[closestPlayer].ZoneUnderworldHeight && + !Main.player[closestPlayer].ZoneDungeon && + !Main.player[closestPlayer].ZoneJungle && + !Main.player[closestPlayer].Calamity().ZoneSunkenSea && + !CalamityPlayer.areThereAnyDamnBosses) + { + if (NPC.downedPlantBoss && + !Main.player[closestPlayer].Calamity().ZoneAbyss && + Main.player[closestPlayer].townNPCs < 3f) + { + double spawnRate = 100000D; + + if (death) + spawnRate *= 0.75D; + else if (revenge) + spawnRate *= 0.85D; + + if (demonMode) + spawnRate *= 0.75D; + + if (Main.player[closestPlayer].Calamity().zerg && Main.player[closestPlayer].Calamity().chaosCandle) + spawnRate *= 0.005D; + else if (Main.player[closestPlayer].Calamity().zerg) + spawnRate *= 0.01D; + else if (Main.player[closestPlayer].Calamity().chaosCandle) + spawnRate *= 0.02D; + + if (Main.player[closestPlayer].Calamity().zen && Main.player[closestPlayer].Calamity().tranquilityCandle) + spawnRate *= 75D; + else if (Main.player[closestPlayer].Calamity().zen) + spawnRate *= 50D; + else if (Main.player[closestPlayer].Calamity().tranquilityCandle) + spawnRate *= 25D; + + int chance = (int)spawnRate; + if (Main.rand.Next(chance) == 0) + { + if (!NPC.AnyNPCs(mod.NPCType("ArmoredDiggerHead")) && Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ArmoredDiggerHead")); + } + } + } + + if (Main.dayTime && Main.hardMode) + { + if (Main.player[closestPlayer].townNPCs >= 2f) + { + if (Main.rand.NextBool(2000)) + { + int steamGril = NPC.FindFirstNPC(NPCID.Steampunker); + if (steamGril == -1 && Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(closestPlayer, NPCID.Steampunker); + } + } + } + + if (Main.player[closestPlayer].Calamity().ZoneAbyss) + { + if (Main.player[closestPlayer].chaosState) + { + if (!NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("EidolonWyrmHeadHuge")); + } + } + + /*if (Main.rand.NextBool(100000000)) + { + string key = "Mods.CalamityMod.AprilFools"; + Color messageColor = Color.Crimson; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + }*/ + + if (death && !CalamityPlayer.areThereAnyDamnBosses && Main.player[closestPlayer].statLifeMax2 >= 300) + { + if (bossSpawnCountdown <= 0) //check for countdown being 0 + { + if (Main.rand.NextBool(50000)) + { + if (!NPC.downedBoss1 && bossType == 0) //only set countdown and boss type if conditions are met + if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) + { + BossText(); + bossType = NPCID.EyeofCthulhu; + bossSpawnCountdown = 3600; //1 minute + } + + if (!NPC.downedBoss2 && bossType == 0) + if (Main.player[closestPlayer].ZoneCorrupt) + { + BossText(); + bossType = NPCID.EaterofWorldsHead; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedBoss2 && bossType == 0) + if (Main.player[closestPlayer].ZoneCrimson) + { + BossText(); + bossType = NPCID.BrainofCthulhu; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedQueenBee && bossType == 0) + if (Main.player[closestPlayer].ZoneJungle && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) + { + BossText(); + bossType = NPCID.QueenBee; + bossSpawnCountdown = 3600; + } + + if (!downedDesertScourge && bossType == 0) + if (Main.player[closestPlayer].ZoneDesert) + { + BossText(); + bossType = mod.NPCType("DesertScourgeHead"); + bossSpawnCountdown = 3600; + } + + if (!downedPerforator && bossType == 0) + if (Main.player[closestPlayer].ZoneCrimson) + { + BossText(); + bossType = mod.NPCType("PerforatorHive"); + bossSpawnCountdown = 3600; + } + + if (!downedHiveMind && bossType == 0) + if (Main.player[closestPlayer].ZoneCorrupt) + { + BossText(); + bossType = mod.NPCType("HiveMind"); + bossSpawnCountdown = 3600; + } + + if (!downedCrabulon && bossType == 0) + if (Main.player[closestPlayer].ZoneGlowshroom) + { + BossText(); + bossType = mod.NPCType("CrabulonIdle"); + bossSpawnCountdown = 3600; + } + + if (Main.hardMode) + { + if (!NPC.downedMechBoss1 && bossType == 0) + if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) + { + BossText(); + bossType = NPCID.TheDestroyer; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedMechBoss2 && bossType == 0) + if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) + { + BossText(); + bossType = NPCID.Spazmatism; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedMechBoss3 && bossType == 0) + if (!Main.dayTime && (Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight)) + { + BossText(); + bossType = NPCID.SkeletronPrime; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedPlantBoss && bossType == 0) + if (Main.player[closestPlayer].ZoneJungle && !Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight) + { + BossText(); + bossType = NPCID.Plantera; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedFishron && bossType == 0) + if (Main.player[closestPlayer].ZoneBeach && !Main.player[closestPlayer].Calamity().ZoneSulphur) + { + BossText(); + bossType = NPCID.DukeFishron; + bossSpawnCountdown = 3600; + } + + if (!downedCryogen && bossType == 0) + if (Main.player[closestPlayer].ZoneSnow && Main.player[closestPlayer].ZoneOverworldHeight) + { + BossText(); + bossType = mod.NPCType("Cryogen"); + bossSpawnCountdown = 3600; + } + + if (!downedCalamitas && bossType == 0) + if (!Main.dayTime && Main.player[closestPlayer].ZoneOverworldHeight) + { + BossText(); + bossType = mod.NPCType("Calamitas"); + bossSpawnCountdown = 3600; + } + + if (!downedAstrageldon && bossType == 0) + if (Main.player[closestPlayer].Calamity().ZoneAstral && + !Main.dayTime && Main.player[closestPlayer].ZoneOverworldHeight) + { + BossText(); + bossType = mod.NPCType("Astrageldon"); + bossSpawnCountdown = 3600; + } + + if (!downedPlaguebringer && bossType == 0) + if (Main.player[closestPlayer].ZoneJungle && NPC.downedGolemBoss && Main.player[closestPlayer].ZoneOverworldHeight) + { + BossText(); + bossType = mod.NPCType("PlaguebringerGoliath"); + bossSpawnCountdown = 3600; + } + + if (NPC.downedMoonlord) + { + if (!downedGuardians && bossType == 0) + if (Main.player[closestPlayer].ZoneUnderworldHeight || + (Main.player[closestPlayer].ZoneHoly && Main.player[closestPlayer].ZoneOverworldHeight)) + { + BossText(); + bossType = mod.NPCType("ProfanedGuardianBoss"); + bossSpawnCountdown = 3600; + } + + if (!downedBumble && bossType == 0) + if (Main.player[closestPlayer].ZoneJungle && Main.player[closestPlayer].ZoneOverworldHeight) + { + BossText(); + bossType = mod.NPCType("Bumblefuck"); + bossSpawnCountdown = 3600; + } + } + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); + netMessage.Write(bossSpawnCountdown); + netMessage.Send(); + var netMessage2 = mod.GetPacket(); + netMessage2.Write((byte)CalamityModMessageType.BossTypeSync); + netMessage2.Write(bossType); + netMessage2.Send(); + } + } + } + else + { + bossSpawnCountdown--; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); + netMessage.Write(bossSpawnCountdown); + netMessage.Send(); + } + if (bossSpawnCountdown <= 0) + { + bool canSpawn = true; + switch (bossType) + { + case NPCID.EyeofCthulhu: + if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) + canSpawn = false; + break; + case NPCID.EaterofWorldsHead: + if (!Main.player[closestPlayer].ZoneCorrupt) + canSpawn = false; + break; + case NPCID.BrainofCthulhu: + if (!Main.player[closestPlayer].ZoneCrimson) + canSpawn = false; + break; + case NPCID.QueenBee: + if (!Main.player[closestPlayer].ZoneJungle || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) + canSpawn = false; + break; + case NPCID.TheDestroyer: + if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) + canSpawn = false; + break; + case NPCID.Spazmatism: + if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) + canSpawn = false; + break; + case NPCID.SkeletronPrime: + if (Main.dayTime || (!Main.player[closestPlayer].ZoneOverworldHeight && !Main.player[closestPlayer].ZoneSkyHeight)) + canSpawn = false; + break; + case NPCID.Plantera: + if (!Main.player[closestPlayer].ZoneJungle || Main.player[closestPlayer].ZoneOverworldHeight || Main.player[closestPlayer].ZoneSkyHeight) + canSpawn = false; + break; + case NPCID.DukeFishron: + if (!Main.player[closestPlayer].ZoneBeach) + canSpawn = false; + break; + } + + if (bossType == mod.NPCType("DesertScourgeHead")) + { + if (!Main.player[closestPlayer].ZoneDesert) + canSpawn = false; + } + else if (bossType == mod.NPCType("PerforatorHive")) + { + if (!Main.player[closestPlayer].ZoneCrimson) + canSpawn = false; + } + else if (bossType == mod.NPCType("HiveMind")) + { + if (!Main.player[closestPlayer].ZoneCorrupt) + canSpawn = false; + } + else if (bossType == mod.NPCType("CrabulonIdle")) + { + if (!Main.player[closestPlayer].ZoneGlowshroom) + canSpawn = false; + } + else if (bossType == mod.NPCType("Cryogen")) + { + if (!Main.player[closestPlayer].ZoneSnow || !Main.player[closestPlayer].ZoneOverworldHeight) + canSpawn = false; + } + else if (bossType == mod.NPCType("Calamitas")) + { + if (Main.dayTime || !Main.player[closestPlayer].ZoneOverworldHeight) + canSpawn = false; + } + else if (bossType == mod.NPCType("Astrageldon")) + { + if (!Main.player[closestPlayer].Calamity().ZoneAstral || + Main.dayTime || !Main.player[closestPlayer].ZoneOverworldHeight) + canSpawn = false; + } + else if (bossType == mod.NPCType("PlaguebringerGoliath")) + { + if (!Main.player[closestPlayer].ZoneJungle || !Main.player[closestPlayer].ZoneOverworldHeight) + canSpawn = false; + } + else if (bossType == mod.NPCType("ProfanedGuardianBoss")) + { + if (!Main.player[closestPlayer].ZoneUnderworldHeight && + (!Main.player[closestPlayer].ZoneHoly || !Main.player[closestPlayer].ZoneOverworldHeight)) + canSpawn = false; + } + else if (bossType == mod.NPCType("Bumblefuck")) + { + if (!Main.player[closestPlayer].ZoneJungle || !Main.player[closestPlayer].ZoneOverworldHeight) + canSpawn = false; + } + + if (canSpawn && Main.netMode != NetmodeID.MultiplayerClient) + { + if (bossType == NPCID.Spazmatism) + NPC.SpawnOnPlayer(closestPlayer, NPCID.Retinazer); + else if (bossType == mod.NPCType("ProfanedGuardianBoss")) + { + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss2")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("ProfanedGuardianBoss3")); + } + else if (bossType == mod.NPCType("DesertScourgeHead")) + { + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); + NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); + } + if (bossType == NPCID.DukeFishron) + NPC.NewNPC((int)Main.player[closestPlayer].Center.X - 300, (int)Main.player[closestPlayer].Center.Y - 300, bossType); + else + NPC.SpawnOnPlayer(closestPlayer, bossType); + } + bossType = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossTypeSync); + netMessage.Write(bossType); + netMessage.Send(); + } + } + } + } + + if (!downedDesertScourge) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Sandstorm.Happening) + { + Sandstorm.Happening = false; + Sandstorm.TimeLeft = 0; + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CultistRitual.delay -= Main.dayRate * 10; + if (CultistRitual.delay < 0) + { + CultistRitual.delay = 0; + } + CultistRitual.recheck -= Main.dayRate * 10; + if (CultistRitual.recheck < 0) + { + CultistRitual.recheck = 0; + } + } + } + #endregion + + #region ChangeTime + public static void ChangeTime(bool day) + { + Main.time = 0.0; + Main.dayTime = day; + CalamityMod.UpdateServerBoolean(); + } + #endregion + + #region BossText + public void BossText() + { + string key = "Mods.CalamityMod.BossSpawnText"; + Color messageColor = Color.Crimson; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + #endregion + } } diff --git a/World/CustomActions.cs b/World/CustomActions.cs index 2fea440ed3..a2b42eb335 100644 --- a/World/CustomActions.cs +++ b/World/CustomActions.cs @@ -57,7 +57,7 @@ namespace CalamityMod.World { WorldGen.PlaceTile(x, y, _random.Next(new ushort[] { TileID.JunglePlants, TileID.JunglePlants2 }), true, false, -1, 0); } - else if (_tryMushrooms && _tiles[x, y+1].type == TileID.MushroomGrass) + else if (_tryMushrooms && _tiles[x, y + 1].type == TileID.MushroomGrass) { WorldGen.PlaceTile(x, y, TileID.MushroomPlants); } @@ -114,7 +114,7 @@ namespace CalamityMod.World { return base.UnitApply(origin, x, y, args); } - else if(distance < _distance) + else if (distance < _distance) { return base.UnitApply(origin, x, y, args); } diff --git a/World/CustomConditions.cs b/World/CustomConditions.cs index 27cd1a08e8..2fb8f97739 100644 --- a/World/CustomConditions.cs +++ b/World/CustomConditions.cs @@ -33,8 +33,10 @@ namespace CalamityMod.World { for (int j = y - 1; j <= y + 1; j++) { - if (j != y && i != x && !_useDiagonals) continue; - if (!WorldGen.InWorld(i, j)) continue; + if (j != y && i != x && !_useDiagonals) + continue; + if (!WorldGen.InWorld(i, j)) + continue; if (!_tiles[i, j].active()) { return false; diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index 0362ba9ffe..57928a489f 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -1,13 +1,11 @@ -using System; +using CalamityMod.MiscImplementation; +using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; - using Terraria; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; - -using CalamityMod.MiscImplementation; namespace CalamityMod.World.Planets { diff --git a/World/Planets/HeartPlanet.cs b/World/Planets/HeartPlanet.cs index 8108dfe144..498288fe28 100644 --- a/World/Planets/HeartPlanet.cs +++ b/World/Planets/HeartPlanet.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; -using Terraria.World.Generation; -using Terraria.ID; using Terraria; +using Terraria.ID; +using Terraria.World.Generation; namespace CalamityMod.World.Planets { diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index 158c4595ca..70ae7a3008 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -1,16 +1,14 @@ -using System; +using CalamityMod.MiscImplementation; +using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using System.Linq; - using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; - -using CalamityMod.MiscImplementation; namespace CalamityMod.World.Planets { @@ -18,8 +16,8 @@ namespace CalamityMod.World.Planets { public override bool Place(Point origin, StructureMap structures) { - float scale = (float)Main.maxTilesX / 4200f; - int radius = (int)((float)_random.Next(30, 36) * scale); //50 to 65 + float scale = (float)Main.maxTilesX / 4200f; + int radius = (int)((float)_random.Next(30, 36) * scale); //50 to 65 if (!CheckIfPlaceable(origin, radius, structures)) { @@ -151,7 +149,7 @@ namespace CalamityMod.World.Planets //PLACE BEAMS BELOW CIRCLE HashSet bottomMostTiles = bottomTiles.GetData(); - foreach(Point16 p in bottomMostTiles) + foreach (Point16 p in bottomMostTiles) { int tileX = origin.X + p.X; int tileY = origin.Y + p.Y; @@ -167,7 +165,8 @@ namespace CalamityMod.World.Planets for (int y = origin.Y - 4; y <= origin.Y + 4; y++) { int distFromOriginX = Math.Abs(origin.X - x); - if (distFromOriginX <= cinderRadius + 1) continue; + if (distFromOriginX <= cinderRadius + 1) + continue; if (x == origin.X - corridorLength || x == origin.X + corridorLength) { @@ -180,7 +179,8 @@ namespace CalamityMod.World.Planets if (distFromOriginX < cinderRadius + 9 && !_tiles[x, y].active()) { _tiles[x, y].active(false); - if (bottom) WorldGen.PlaceTile(x, y, TileID.Platforms, true); + if (bottom) + WorldGen.PlaceTile(x, y, TileID.Platforms, true); } else { diff --git a/World/Planets/MudPlanet.cs b/World/Planets/MudPlanet.cs index db0e5f1607..5ec3afd48a 100644 --- a/World/Planets/MudPlanet.cs +++ b/World/Planets/MudPlanet.cs @@ -1,9 +1,9 @@  +using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; namespace CalamityMod.World.Planets { @@ -103,7 +103,7 @@ namespace CalamityMod.World.Planets new Actions.SetLiquid(2, 255) })); bool placedSpawner = false; - while(!placedSpawner) + while (!placedSpawner) { int testX = origin.X + _random.Next(-(int)radius, (int)radius); int testY = origin.Y + _random.Next(-(int)radius, (int)radius); @@ -116,7 +116,8 @@ namespace CalamityMod.World.Planets WorldGen.SquareTileFrame(floorX, testY + 2); } bool placed = WorldGen.PlaceTile(testX, testY + 1, TileID.Larva, true, false); - if (placed) placedSpawner = true; + if (placed) + placedSpawner = true; } } } @@ -134,7 +135,7 @@ namespace CalamityMod.World.Planets })); shape.Subtract(cavernData, origin, origin); int chestY = origin.Y; - while(!_tiles[origin.X, chestY].active()) + while (!_tiles[origin.X, chestY].active()) { chestY++; } diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index a5b3ab34b1..dbda167d2c 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -1,10 +1,9 @@ -using System.Collections.Generic; - +using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.World.Generation; -using Microsoft.Xna.Framework; namespace CalamityMod.World.Planets { @@ -20,24 +19,24 @@ namespace CalamityMod.World.Planets int diameter = myRadius * 2; _area = new Rectangle(origin.X - myRadius, origin.Y - myRadius, diameter, diameter); - Mod varia = ModLoader.GetMod("Varia"); - for (int i = _area.Left; i < _area.Right; i++) - { - for (int j = _area.Top; j < _area.Bottom; j++) - { - if (Main.tile[i, j].type == TileID.Cloud || Main.tile[i, j].type == TileID.RainCloud || Main.tile[i, j].type == TileID.Sunplate) - { - return false; - } - if (varia != null) - { - if (Main.tile[i, j].type == varia.TileType("StarplateBrick") || Main.tile[i, j].type == varia.TileType("ForgottenCloud")) - { - return false; - } - } - } - } + Mod varia = ModLoader.GetMod("Varia"); + for (int i = _area.Left; i < _area.Right; i++) + { + for (int j = _area.Top; j < _area.Bottom; j++) + { + if (Main.tile[i, j].type == TileID.Cloud || Main.tile[i, j].type == TileID.RainCloud || Main.tile[i, j].type == TileID.Sunplate) + { + return false; + } + if (varia != null) + { + if (Main.tile[i, j].type == varia.TileType("StarplateBrick") || Main.tile[i, j].type == varia.TileType("ForgottenCloud")) + { + return false; + } + } + } + } if (!structures.CanPlace(_area)) { diff --git a/World/SmallBiomes.cs b/World/SmallBiomes.cs index 7d945d590a..0e50d42249 100644 --- a/World/SmallBiomes.cs +++ b/World/SmallBiomes.cs @@ -6,173 +6,173 @@ using Terraria.ModLoader; namespace CalamityMod.World { public class SmallBiomes : ModWorld - { - public static void PlaceIceTomb() - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; + { + public static void PlaceIceTomb() + { + int x = Main.maxTilesX; + int y = Main.maxTilesY; - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .5f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .5f)); - if (Main.tile[tilesX, tilesY].type == TileID.SnowBlock || Main.tile[tilesX, tilesY].type == TileID.IceBlock) - { - WorldGenerationMethods.IceTomb(tilesX, tilesY); - break; - } - } - } + if (Main.tile[tilesX, tilesY].type == TileID.SnowBlock || Main.tile[tilesX, tilesY].type == TileID.IceBlock) + { + WorldGenerationMethods.IceTomb(tilesX, tilesY); + break; + } + } + } - public static void PlaceEvilIsland() - { - int x = Main.maxTilesX; - int xIslandGen = WorldGen.crimson ? - WorldGen.genRand.Next((int)((double)x * 0.15), (int)((double)x * 0.2)) : - WorldGen.genRand.Next((int)((double)x * 0.8), (int)((double)x * 0.85)); - int yIslandGen = WorldGen.genRand.Next(90, 151); - yIslandGen = Math.Min(yIslandGen, (int)WorldGen.worldSurfaceLow - 50); + public static void PlaceEvilIsland() + { + int x = Main.maxTilesX; + int xIslandGen = WorldGen.crimson ? + WorldGen.genRand.Next((int)((double)x * 0.15), (int)((double)x * 0.2)) : + WorldGen.genRand.Next((int)((double)x * 0.8), (int)((double)x * 0.85)); + int yIslandGen = WorldGen.genRand.Next(90, 151); + yIslandGen = Math.Min(yIslandGen, (int)WorldGen.worldSurfaceLow - 50); - int tileXLookup = xIslandGen; - if (WorldGen.crimson) - { - while (Main.tile[tileXLookup, yIslandGen].active()) - tileXLookup++; - } - else - { - while (Main.tile[tileXLookup, yIslandGen].active()) - tileXLookup--; - } + int tileXLookup = xIslandGen; + if (WorldGen.crimson) + { + while (Main.tile[tileXLookup, yIslandGen].active()) + tileXLookup++; + } + else + { + while (Main.tile[tileXLookup, yIslandGen].active()) + tileXLookup--; + } - xIslandGen = tileXLookup; - CalamityWorld.fehX = xIslandGen; - CalamityWorld.fehY = yIslandGen; - WorldGenerationMethods.EvilIsland(xIslandGen, yIslandGen); - WorldGenerationMethods.EvilIslandHouse(CalamityWorld.fehX, CalamityWorld.fehY); - } + xIslandGen = tileXLookup; + CalamityWorld.fehX = xIslandGen; + CalamityWorld.fehY = yIslandGen; + WorldGenerationMethods.EvilIsland(xIslandGen, yIslandGen); + WorldGenerationMethods.EvilIslandHouse(CalamityWorld.fehX, CalamityWorld.fehY); + } - public static void PlaceShrines() - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 + public static void PlaceShrines() + { + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int generateBack = genLimit - 80; //Small = 2020 + int generateForward = genLimit + 80; //Small = 2180 - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Surface Shrine - { - int tilesX = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.7)); - int tilesY = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Surface Shrine + { + int tilesX = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); + int tilesX2 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.7)); + int tilesY = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); - if (Main.tile[tilesX, tilesY].type == TileID.Dirt || Main.tile[tilesX, tilesY].type == TileID.Stone) - { - WorldGenerationMethods.SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX, tilesY); - break; - } - if (Main.tile[tilesX2, tilesY].type == TileID.Dirt || Main.tile[tilesX2, tilesY].type == TileID.Stone) - { - WorldGenerationMethods.SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX2, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == TileID.Dirt || Main.tile[tilesX, tilesY].type == TileID.Stone) + { + WorldGenerationMethods.SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX, tilesY); + break; + } + if (Main.tile[tilesX2, tilesY].type == TileID.Dirt || Main.tile[tilesX2, tilesY].type == TileID.Stone) + { + WorldGenerationMethods.SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX2, tilesY); + break; + } + } - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Evil Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Evil Shrine + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); - if (Main.tile[tilesX, tilesY].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone)) - { - WorldGenerationMethods.SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, - WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, - WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, 1, tilesX, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone)) + { + WorldGenerationMethods.SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, + WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, + WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, 1, tilesX, tilesY); + break; + } + } - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Cavern Shrine - { - int tilesX = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.7)); - int tilesY = WorldGen.genRand.Next((int)(y * .55f), (int)(y * .8f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Cavern Shrine + { + int tilesX = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); + int tilesX2 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.7)); + int tilesY = WorldGen.genRand.Next((int)(y * .55f), (int)(y * .8f)); - if (Main.tile[tilesX, tilesY].type == TileID.Stone) - { - WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX, tilesY); - break; - } - if (Main.tile[tilesX2, tilesY].type == TileID.Stone) - { - WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX2, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == TileID.Stone) + { + WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX, tilesY); + break; + } + if (Main.tile[tilesX2, tilesY].type == TileID.Stone) + { + WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX2, tilesY); + break; + } + } - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Ice Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Ice Shrine + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); - if (Main.tile[tilesX, tilesY].type == TileID.IceBlock) - { - WorldGenerationMethods.SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, 3, tilesX, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == TileID.IceBlock) + { + WorldGenerationMethods.SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, 3, tilesX, tilesY); + break; + } + } - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Desert Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Desert Shrine + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); - if (Main.tile[tilesX, tilesY].type == TileID.DesertFossil) - { - WorldGenerationMethods.SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, 4, tilesX, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == TileID.DesertFossil) + { + WorldGenerationMethods.SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, 4, tilesX, tilesY); + break; + } + } - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Mushroom Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Mushroom Shrine + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); - if (Main.tile[tilesX, tilesY].type == TileID.MushroomGrass) - { - WorldGenerationMethods.SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, 5, tilesX, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == TileID.MushroomGrass) + { + WorldGenerationMethods.SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, 5, tilesX, tilesY); + break; + } + } - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Granite Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Granite Shrine + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); - if (Main.tile[tilesX, tilesY].type == TileID.Granite) - { - WorldGenerationMethods.SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, 6, tilesX, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == TileID.Granite) + { + WorldGenerationMethods.SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, 6, tilesX, tilesY); + break; + } + } - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Marble Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) //Marble Shrine + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); - if (Main.tile[tilesX, tilesY].type == TileID.Marble) - { - WorldGenerationMethods.SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, 7, tilesX, tilesY); - break; - } - } + if (Main.tile[tilesX, tilesY].type == TileID.Marble) + { + WorldGenerationMethods.SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, 7, tilesX, tilesY); + break; + } + } - //Murasama Shrine - WorldGenerationMethods.SpecialHut(TileID.HellstoneBrick, TileID.Hellstone, WallID.HellstoneBrick, 8, WorldGen.genRand.Next((int)((double)x * 0.97), (int)((double)x * 0.98)), y - 60); - } - } + //Murasama Shrine + WorldGenerationMethods.SpecialHut(TileID.HellstoneBrick, TileID.Hellstone, WallID.HellstoneBrick, 8, WorldGen.genRand.Next((int)((double)x * 0.97), (int)((double)x * 0.98)), y - 60); + } + } } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 3e50864db1..5d69e4571a 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -8,595 +8,595 @@ using Terraria.World.Generation; namespace CalamityMod.World { public class SunkenSea : ModWorld - { - private struct Hub - { - public Vector2 Position; + { + private struct Hub + { + public Vector2 Position; - public Hub(Vector2 position) - { - this.Position = position; - } + public Hub(Vector2 position) + { + this.Position = position; + } - public Hub(float x, float y) - { - this.Position = new Vector2(x, y); - } - } + public Hub(float x, float y) + { + this.Position = new Vector2(x, y); + } + } - private class Cluster : List - { - } + private class Cluster : List + { + } - private class ClusterGroup : List - { - public int Width; + private class ClusterGroup : List + { + public int Width; - public int Height; + public int Height; - private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) - { - pointCluster.Add(new Point(x, y)); - hubMap[x, y] = false; - level--; - if (level == -1) - { - return; - } - if (x > 0 && hubMap[x - 1, y]) - { - this.SearchForCluster(hubMap, pointCluster, x - 1, y, level); - } - if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y]) - { - this.SearchForCluster(hubMap, pointCluster, x + 1, y, level); - } - if (y > 0 && hubMap[x, y - 1]) - { - this.SearchForCluster(hubMap, pointCluster, x, y - 1, level); - } - if (y < hubMap.GetLength(1) - 1 && hubMap[x, y + 1]) - { - this.SearchForCluster(hubMap, pointCluster, x, y + 1, level); - } - } + private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) + { + pointCluster.Add(new Point(x, y)); + hubMap[x, y] = false; + level--; + if (level == -1) + { + return; + } + if (x > 0 && hubMap[x - 1, y]) + { + this.SearchForCluster(hubMap, pointCluster, x - 1, y, level); + } + if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y]) + { + this.SearchForCluster(hubMap, pointCluster, x + 1, y, level); + } + if (y > 0 && hubMap[x, y - 1]) + { + this.SearchForCluster(hubMap, pointCluster, x, y - 1, level); + } + if (y < hubMap.GetLength(1) - 1 && hubMap[x, y + 1]) + { + this.SearchForCluster(hubMap, pointCluster, x, y + 1, level); + } + } - private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster - { - int num = clusterIndexMap[x, y]; - if (num != -1 && num != index) - { - int num2 = (WorldGen.genRand.Next(2) == 0) ? -1 : index; - foreach (Point current in pointClusters[num]) - { - clusterIndexMap[current.X, current.Y] = num2; - } - } - } + private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster + { + int num = clusterIndexMap[x, y]; + if (num != -1 && num != index) + { + int num2 = (WorldGen.genRand.Next(2) == 0) ? -1 : index; + foreach (Point current in pointClusters[num]) + { + clusterIndexMap[current.X, current.Y] = num2; + } + } + } - public void Generate(int width, int height) //Creates clusters for cluster group - { - this.Width = width; - this.Height = height; - base.Clear(); - bool[,] array = new bool[width, height]; - int num = (width >> 1) - 1; - int num2 = (height >> 1) - 1; - int num3 = (num + 1) * (num + 1); - Point point = new Point(num, num2); - for (int i = point.Y - num2; i <= point.Y + num2; i++) - { - float num4 = (float)num / (float)num2 * (float)(i - point.Y); - int num5 = Math.Min(num, (int)Math.Sqrt((double)((float)num3 - num4 * num4))); - for (int j = point.X - num5; j <= point.X + num5; j++) - { - array[j, i] = (WorldGen.genRand.Next(2) == 0); - } - } - List> list = new List>(); - for (int k = 0; k < array.GetLength(0); k++) - { - for (int l = 0; l < array.GetLength(1); l++) - { - if (array[k, l] && WorldGen.genRand.Next(2) == 0) - { - List list2 = new List(); - this.SearchForCluster(array, list2, k, l, 2); - if (list2.Count > 2) - { - list.Add(list2); - } - } - } - } - int[,] array2 = new int[array.GetLength(0), array.GetLength(1)]; - for (int m = 0; m < array2.GetLength(0); m++) - { - for (int n = 0; n < array2.GetLength(1); n++) - { - array2[m, n] = -1; - } - } - for (int num6 = 0; num6 < list.Count; num6++) - { - foreach (Point current in list[num6]) - { - array2[current.X, current.Y] = num6; - } - } - for (int num7 = 0; num7 < list.Count; num7++) - { - foreach (Point expr_205 in list[num7]) - { - int x = expr_205.X; - int y = expr_205.Y; - if (array2[x, y] == -1) - { - break; - } - int index = array2[x, y]; - if (x > 0) - { - this.AttemptClaim(x - 1, y, array2, list, index); - } - if (x < array2.GetLength(0) - 1) - { - this.AttemptClaim(x + 1, y, array2, list, index); - } - if (y > 0) - { - this.AttemptClaim(x, y - 1, array2, list, index); - } - if (y < array2.GetLength(1) - 1) - { - this.AttemptClaim(x, y + 1, array2, list, index); - } - } - } - using (List>.Enumerator enumerator2 = list.GetEnumerator()) - { - while (enumerator2.MoveNext()) - { - enumerator2.Current.Clear(); - } - } - for (int num8 = 0; num8 < array2.GetLength(0); num8++) - { - for (int num9 = 0; num9 < array2.GetLength(1); num9++) - { - if (array2[num8, num9] != -1) - { - list[array2[num8, num9]].Add(new Point(num8, num9)); - } - } - } - foreach (List current2 in list) - { - if (current2.Count < 4) - { - current2.Clear(); - } - } - foreach (List current3 in list) - { - SunkenSea.Cluster cluster = new SunkenSea.Cluster(); - if (current3.Count > 0) - { - foreach (Point current4 in current3) - { - cluster.Add(new SunkenSea.Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); - } - base.Add(cluster); - } - } - } - } + public void Generate(int width, int height) //Creates clusters for cluster group + { + this.Width = width; + this.Height = height; + base.Clear(); + bool[,] array = new bool[width, height]; + int num = (width >> 1) - 1; + int num2 = (height >> 1) - 1; + int num3 = (num + 1) * (num + 1); + Point point = new Point(num, num2); + for (int i = point.Y - num2; i <= point.Y + num2; i++) + { + float num4 = (float)num / (float)num2 * (float)(i - point.Y); + int num5 = Math.Min(num, (int)Math.Sqrt((double)((float)num3 - num4 * num4))); + for (int j = point.X - num5; j <= point.X + num5; j++) + { + array[j, i] = (WorldGen.genRand.Next(2) == 0); + } + } + List> list = new List>(); + for (int k = 0; k < array.GetLength(0); k++) + { + for (int l = 0; l < array.GetLength(1); l++) + { + if (array[k, l] && WorldGen.genRand.Next(2) == 0) + { + List list2 = new List(); + this.SearchForCluster(array, list2, k, l, 2); + if (list2.Count > 2) + { + list.Add(list2); + } + } + } + } + int[,] array2 = new int[array.GetLength(0), array.GetLength(1)]; + for (int m = 0; m < array2.GetLength(0); m++) + { + for (int n = 0; n < array2.GetLength(1); n++) + { + array2[m, n] = -1; + } + } + for (int num6 = 0; num6 < list.Count; num6++) + { + foreach (Point current in list[num6]) + { + array2[current.X, current.Y] = num6; + } + } + for (int num7 = 0; num7 < list.Count; num7++) + { + foreach (Point expr_205 in list[num7]) + { + int x = expr_205.X; + int y = expr_205.Y; + if (array2[x, y] == -1) + { + break; + } + int index = array2[x, y]; + if (x > 0) + { + this.AttemptClaim(x - 1, y, array2, list, index); + } + if (x < array2.GetLength(0) - 1) + { + this.AttemptClaim(x + 1, y, array2, list, index); + } + if (y > 0) + { + this.AttemptClaim(x, y - 1, array2, list, index); + } + if (y < array2.GetLength(1) - 1) + { + this.AttemptClaim(x, y + 1, array2, list, index); + } + } + } + using (List>.Enumerator enumerator2 = list.GetEnumerator()) + { + while (enumerator2.MoveNext()) + { + enumerator2.Current.Clear(); + } + } + for (int num8 = 0; num8 < array2.GetLength(0); num8++) + { + for (int num9 = 0; num9 < array2.GetLength(1); num9++) + { + if (array2[num8, num9] != -1) + { + list[array2[num8, num9]].Add(new Point(num8, num9)); + } + } + } + foreach (List current2 in list) + { + if (current2.Count < 4) + { + current2.Clear(); + } + } + foreach (List current3 in list) + { + SunkenSea.Cluster cluster = new SunkenSea.Cluster(); + if (current3.Count > 0) + { + foreach (Point current4 in current3) + { + cluster.Add(new SunkenSea.Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); + } + base.Add(cluster); + } + } + } + } - private static void PlaceClusters(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale) //Places tile/wall clusters in Sunken Sea area - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int num = (int)(scale.X * (float)clusters.Width); - int num2 = (int)(scale.Y * (float)clusters.Height); - Vector2 value = new Vector2((float)num, (float)num2); - Vector2 value2 = new Vector2((float)clusters.Width, (float)clusters.Height); - for (int i = -20; i < num + 20; i++) - { - for (int j = -20; j < num2 + 20; j++) - { - float num3 = 0f; - int num4 = -1; - float num5 = 0f; - int num6 = i + start.X; - int num7 = j + start.Y; - Vector2 vector = new Vector2((float)i, (float)j) / value * value2; - float num8 = (new Vector2((float)i, (float)j) / value * 2f - Vector2.One).Length(); - for (int k = 0; k < clusters.Count; k++) - { - SunkenSea.Cluster cluster = clusters[k]; - if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) - { - float num9 = 0f; - foreach (SunkenSea.Hub current in cluster) - { - num9 += 1f / Vector2.DistanceSquared(current.Position, vector); - } - if (num9 > num3) - { - if (num3 > num5) - { - num5 = num3; - } - num3 = num9; - num4 = k; - } - else if (num9 > num5) - { - num5 = num9; - } - } - } - float num10 = num3 + num5; - Tile tile = Main.tile[num6, num7]; - bool flag = num8 >= 0.8f; - if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent - { - tile.ClearEverything(); - tile.wall = (ushort)mod.WallType("NavystoneWall"); - tile.liquid = 192; - if (num4 % 15 == 2) - { - tile.ResetToType((ushort)mod.TileType("Navystone")); - tile.active(true); - tile.liquid = 0; - } - Tile.SmoothSlope(num6, num7, true); - } - else if (num10 > 1.8f) - { - tile.wall = (ushort)mod.WallType("NavystoneWall"); - tile.liquid = 192; - if (!flag || tile.active()) - { - tile.ResetToType((ushort)mod.TileType("Navystone")); - tile.active(true); - Tile.SmoothSlope(num6, num7, true); - tile.liquid = 0; - } - } - else if (num10 > 0.7f || !flag) - { - tile.liquid = 192; - if (!flag || tile.active()) - { - tile.ResetToType((ushort)mod.TileType("EutrophicSand")); - tile.active(true); - Tile.SmoothSlope(num6, num7, true); - tile.liquid = 0; - } - tile.wall = (ushort)mod.WallType("EutrophicSandWall"); - } - else if (num10 > 0.25f) - { - float num11 = (num10 - 0.25f) / 0.45f; - if (WorldGen.genRand.NextFloat() < num11) - { - if (tile.active()) - { - tile.ResetToType((ushort)mod.TileType("EutrophicSand")); - tile.active(true); - Tile.SmoothSlope(num6, num7, true); - tile.wall = (ushort)mod.WallType("EutrophicSandWall"); - tile.liquid = 0; - } - else - { - tile.wall = (ushort)mod.WallType("NavystoneWall"); - tile.liquid = 192; - } - } - } - } - } - } + private static void PlaceClusters(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale) //Places tile/wall clusters in Sunken Sea area + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = (int)(scale.X * (float)clusters.Width); + int num2 = (int)(scale.Y * (float)clusters.Height); + Vector2 value = new Vector2((float)num, (float)num2); + Vector2 value2 = new Vector2((float)clusters.Width, (float)clusters.Height); + for (int i = -20; i < num + 20; i++) + { + for (int j = -20; j < num2 + 20; j++) + { + float num3 = 0f; + int num4 = -1; + float num5 = 0f; + int num6 = i + start.X; + int num7 = j + start.Y; + Vector2 vector = new Vector2((float)i, (float)j) / value * value2; + float num8 = (new Vector2((float)i, (float)j) / value * 2f - Vector2.One).Length(); + for (int k = 0; k < clusters.Count; k++) + { + SunkenSea.Cluster cluster = clusters[k]; + if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) + { + float num9 = 0f; + foreach (SunkenSea.Hub current in cluster) + { + num9 += 1f / Vector2.DistanceSquared(current.Position, vector); + } + if (num9 > num3) + { + if (num3 > num5) + { + num5 = num3; + } + num3 = num9; + num4 = k; + } + else if (num9 > num5) + { + num5 = num9; + } + } + } + float num10 = num3 + num5; + Tile tile = Main.tile[num6, num7]; + bool flag = num8 >= 0.8f; + if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent + { + tile.ClearEverything(); + tile.wall = (ushort)mod.WallType("NavystoneWall"); + tile.liquid = 192; + if (num4 % 15 == 2) + { + tile.ResetToType((ushort)mod.TileType("Navystone")); + tile.active(true); + tile.liquid = 0; + } + Tile.SmoothSlope(num6, num7, true); + } + else if (num10 > 1.8f) + { + tile.wall = (ushort)mod.WallType("NavystoneWall"); + tile.liquid = 192; + if (!flag || tile.active()) + { + tile.ResetToType((ushort)mod.TileType("Navystone")); + tile.active(true); + Tile.SmoothSlope(num6, num7, true); + tile.liquid = 0; + } + } + else if (num10 > 0.7f || !flag) + { + tile.liquid = 192; + if (!flag || tile.active()) + { + tile.ResetToType((ushort)mod.TileType("EutrophicSand")); + tile.active(true); + Tile.SmoothSlope(num6, num7, true); + tile.liquid = 0; + } + tile.wall = (ushort)mod.WallType("EutrophicSandWall"); + } + else if (num10 > 0.25f) + { + float num11 = (num10 - 0.25f) / 0.45f; + if (WorldGen.genRand.NextFloat() < num11) + { + if (tile.active()) + { + tile.ResetToType((ushort)mod.TileType("EutrophicSand")); + tile.active(true); + Tile.SmoothSlope(num6, num7, true); + tile.wall = (ushort)mod.WallType("EutrophicSandWall"); + tile.liquid = 0; + } + else + { + tile.wall = (ushort)mod.WallType("NavystoneWall"); + tile.liquid = 192; + } + } + } + } + } + } - private static void AddTileVariance(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale, float size) /*Adds tile variation to the generated tile clusters and generates open areas with sea prism ore; - Generates sea prism crystals on prism ore and occasionally on navystone*/ - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int num = (int)(scale.X * (float)clusters.Width); - int num2 = (int)(scale.Y * (float)clusters.Height); - bool genCentalHole = true; - Rectangle rectangle = default; - int radius = (int)(((float)WorldGen.genRand.Next(24, 28)) * size); //Radius of the generated hole - int diameter = radius * 2; - Point point = new Point(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2), - WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3)); //Around the center of the Sunken Sea area - ShapeData holeShape = new ShapeData(); - int radiusSmall = 0; - float outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(40, 56) * 0.01); //Small radius for ore patch to fit inside holes - int sunkenSeaBottom = WorldGen.UndergroundDesertLocation.Bottom + (int)((double)WorldGen.UndergroundDesertLocation.Height * 0.7); - int smallHoles = 0; - int amt = (int)(4f * size); //Scale amount of holes with world size - for (int i = -20; i < num + 20; i++) - { - for (int j = -20; j < num2 + 20; j++) - { - if (genCentalHole) - { - genCentalHole = false; - rectangle = new Rectangle(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2) - radius, - WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3) - radius, diameter, diameter); + private static void AddTileVariance(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale, float size) /*Adds tile variation to the generated tile clusters and generates open areas with sea prism ore; + Generates sea prism crystals on prism ore and occasionally on navystone*/ + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = (int)(scale.X * (float)clusters.Width); + int num2 = (int)(scale.Y * (float)clusters.Height); + bool genCentalHole = true; + Rectangle rectangle = default; + int radius = (int)(((float)WorldGen.genRand.Next(24, 28)) * size); //Radius of the generated hole + int diameter = radius * 2; + Point point = new Point(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2), + WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3)); //Around the center of the Sunken Sea area + ShapeData holeShape = new ShapeData(); + int radiusSmall = 0; + float outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(40, 56) * 0.01); //Small radius for ore patch to fit inside holes + int sunkenSeaBottom = WorldGen.UndergroundDesertLocation.Bottom + (int)((double)WorldGen.UndergroundDesertLocation.Height * 0.7); + int smallHoles = 0; + int amt = (int)(4f * size); //Scale amount of holes with world size + for (int i = -20; i < num + 20; i++) + { + for (int j = -20; j < num2 + 20; j++) + { + if (genCentalHole) + { + genCentalHole = false; + rectangle = new Rectangle(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2) - radius, + WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3) - radius, diameter, diameter); - WorldUtils.Gen(point, new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.6).Output(holeShape), //Adds uneven shape to the outer tiles - new Actions.ClearTile(true), //Clear all tiles - new Actions.SetLiquid(0, 192) //Leave some air pockets - })); + WorldUtils.Gen(point, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.6).Output(holeShape), //Adds uneven shape to the outer tiles + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 192) //Leave some air pockets + })); - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth the outer parts - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(4)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth the outer parts + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(4)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell - })); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell + })); - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 - { - new Modifiers.Blotches(2, 0.3), - new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism - })); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism + })); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.ClearTile(true), //Clear all tiles - new Actions.SetLiquid(0, 255) - })); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 255) + })); - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - } - point = new Point(WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Left + 30, WorldGen.UndergroundDesertLocation.Right - 30), - WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Bottom + 20, sunkenSeaBottom)); - if (smallHoles < amt && WorldGen.genRand.Next(3) == 0 && !rectangle.Contains(point)) - { - smallHoles++; - radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * size); - WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.45).Output(holeShape), - new Actions.ClearTile(true), - new Actions.SetLiquid(0, 192) - })); + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + point = new Point(WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Left + 30, WorldGen.UndergroundDesertLocation.Right - 30), + WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Bottom + 20, sunkenSeaBottom)); + if (smallHoles < amt && WorldGen.genRand.Next(3) == 0 && !rectangle.Contains(point)) + { + smallHoles++; + radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * size); + WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.45).Output(holeShape), + new Actions.ClearTile(true), + new Actions.SetLiquid(0, 192) + })); - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] - { - new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); - outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell - })); + outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell + })); - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell - { - new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 - { - new Modifiers.Blotches(2, 0.3), - new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism - })); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism + })); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.ClearTile(true), //Clear center - new Actions.SetLiquid(0, 255) - })); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear center + new Actions.SetLiquid(0, 255) + })); - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - } - int num3 = i + start.X; - int num4 = j + start.Y; - Tile tile = Main.tile[num3, num4]; - Tile testTile = Main.tile[num3, num4 + 1]; - Tile testTile2 = Main.tile[num3, num4 + 2]; - if (tile.type == mod.TileType("EutrophicSand") && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation - { - tile.type = (ushort)mod.TileType("Navystone"); - } - } - } - for (int k = -20; k < num + 20; k++) - { - for (int l = -20; l < num2 + 20; l++) - { - int num5 = k + start.X; - int num6 = l + start.Y; - Tile tile2 = Main.tile[num5, num6]; - if (tile2.active() && (tile2.type == mod.TileType("SeaPrism") || tile2.type == mod.TileType("Navystone"))) - { - bool flag = true; - for (int m = -1; m >= -3; m--) - { - if (Main.tile[num5, num6 + m].active()) - { - flag = false; - break; - } - } - bool flag2 = true; - for (int n = 1; n <= 3; n++) - { - if (Main.tile[num5, num6 + n].active()) - { - flag2 = false; - break; - } - } - bool flag3 = true; - for (int o = -1; o >= -3; o--) - { - if (Main.tile[num5 + o, num6].active()) - { - flag3 = false; - break; - } - } - bool flag4 = true; - for (int p = 1; p <= 3; p++) - { - if (Main.tile[num5 + p, num6].active()) - { - flag4 = false; - break; - } - } - if (tile2.type == mod.TileType("SeaPrism") || (tile2.type == mod.TileType("Navystone") && WorldGen.genRand.Next(8) == 0)) - { - if (flag3 ^ flag4) - { - if (tile2.slope() == 0 && !tile2.halfBrick()) - { - Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; - tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); - if (Main.tile[num5 - 1, num6].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5 - 1, num6].frameY = (short)(2 * 18); - } - else if (Main.tile[num5 + 1, num6].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5 + 1, num6].frameY = (short)(3 * 18); - } - tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); - tile3.active(true); - } - } - if (flag ^ flag2) - { - if (tile2.slope() == 0 && !tile2.halfBrick()) - { - Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; - tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); - if (Main.tile[num5, num6 - 1].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5, num6 - 1].frameY = (short)(0 * 18); - } - else if (Main.tile[num5, num6 + 1].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5, num6 + 1].frameY = (short)(1 * 18); - } - tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); - tile3.active(true); - } - } - } - } - if (!tile2.active()) - { - if (tile2.wall == mod.WallType("NavystoneWall") || tile2.wall == mod.WallType("EutrophicSandWall")) - { - if (WorldGen.genRand.Next(5) == 0) - { - WorldGenerationMethods.PlaceTit(num5, num6, (ushort)mod.TileType("SunkenSeaStalactite")); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("BrainCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallBrainCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(10) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("FanCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SeaAnemone"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TubeCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallTubeCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(4) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TableCoral"), true, false, -1, 0); - } - } - } - } - } - } + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + int num3 = i + start.X; + int num4 = j + start.Y; + Tile tile = Main.tile[num3, num4]; + Tile testTile = Main.tile[num3, num4 + 1]; + Tile testTile2 = Main.tile[num3, num4 + 2]; + if (tile.type == mod.TileType("EutrophicSand") && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation + { + tile.type = (ushort)mod.TileType("Navystone"); + } + } + } + for (int k = -20; k < num + 20; k++) + { + for (int l = -20; l < num2 + 20; l++) + { + int num5 = k + start.X; + int num6 = l + start.Y; + Tile tile2 = Main.tile[num5, num6]; + if (tile2.active() && (tile2.type == mod.TileType("SeaPrism") || tile2.type == mod.TileType("Navystone"))) + { + bool flag = true; + for (int m = -1; m >= -3; m--) + { + if (Main.tile[num5, num6 + m].active()) + { + flag = false; + break; + } + } + bool flag2 = true; + for (int n = 1; n <= 3; n++) + { + if (Main.tile[num5, num6 + n].active()) + { + flag2 = false; + break; + } + } + bool flag3 = true; + for (int o = -1; o >= -3; o--) + { + if (Main.tile[num5 + o, num6].active()) + { + flag3 = false; + break; + } + } + bool flag4 = true; + for (int p = 1; p <= 3; p++) + { + if (Main.tile[num5 + p, num6].active()) + { + flag4 = false; + break; + } + } + if (tile2.type == mod.TileType("SeaPrism") || (tile2.type == mod.TileType("Navystone") && WorldGen.genRand.Next(8) == 0)) + { + if (flag3 ^ flag4) + { + if (tile2.slope() == 0 && !tile2.halfBrick()) + { + Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; + tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); + if (Main.tile[num5 - 1, num6].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5 - 1, num6].frameY = (short)(2 * 18); + } + else if (Main.tile[num5 + 1, num6].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5 + 1, num6].frameY = (short)(3 * 18); + } + tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.active(true); + } + } + if (flag ^ flag2) + { + if (tile2.slope() == 0 && !tile2.halfBrick()) + { + Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; + tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); + if (Main.tile[num5, num6 - 1].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5, num6 - 1].frameY = (short)(0 * 18); + } + else if (Main.tile[num5, num6 + 1].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5, num6 + 1].frameY = (short)(1 * 18); + } + tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.active(true); + } + } + } + } + if (!tile2.active()) + { + if (tile2.wall == mod.WallType("NavystoneWall") || tile2.wall == mod.WallType("EutrophicSandWall")) + { + if (WorldGen.genRand.Next(5) == 0) + { + WorldGenerationMethods.PlaceTit(num5, num6, (ushort)mod.TileType("SunkenSeaStalactite")); + } + if (WorldGen.genRand.Next(8) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("BrainCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallBrainCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(10) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("FanCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SeaAnemone"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(8) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TubeCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallTubeCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(4) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TableCoral"), true, false, -1, 0); + } + } + } + } + } + } - public static bool Place(Point origin) - { - float scale = (float)Main.maxTilesX / 4200f; - int sunkenSeaAreaX = (int)(80f * scale); //80f - int sunkenSeaAreaY = (int)((WorldGen.genRand.NextFloat() + 1f) * 60f * scale); //80f - float radius = (float)WorldGen.genRand.Next(6, 10); - Vector2 vector = new Vector2(4f, 2f); //4, 2 - SunkenSea.ClusterGroup clusterGroup = new SunkenSea.ClusterGroup(); - clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); - SunkenSea.PlaceClusters(clusterGroup, origin, vector); - SunkenSea.AddTileVariance(clusterGroup, origin, vector, scale); - int num4 = (int)(vector.X * (float)clusterGroup.Width); - int num5 = (int)(vector.Y * (float)clusterGroup.Height); - for (int i = -40; i < num4 + 40; i++) //40 - { - for (int j = -40; j < num5 + 40; j++) //40 - { - if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) - { - WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); - WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); - } - } - } - return true; - } - } + public static bool Place(Point origin) + { + float scale = (float)Main.maxTilesX / 4200f; + int sunkenSeaAreaX = (int)(80f * scale); //80f + int sunkenSeaAreaY = (int)((WorldGen.genRand.NextFloat() + 1f) * 60f * scale); //80f + float radius = (float)WorldGen.genRand.Next(6, 10); + Vector2 vector = new Vector2(4f, 2f); //4, 2 + SunkenSea.ClusterGroup clusterGroup = new SunkenSea.ClusterGroup(); + clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); + SunkenSea.PlaceClusters(clusterGroup, origin, vector); + SunkenSea.AddTileVariance(clusterGroup, origin, vector, scale); + int num4 = (int)(vector.X * (float)clusterGroup.Width); + int num5 = (int)(vector.Y * (float)clusterGroup.Height); + for (int i = -40; i < num4 + 40; i++) //40 + { + for (int j = -40; j < num5 + 40; j++) //40 + { + if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) + { + WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); + WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); + } + } + } + return true; + } + } } diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index f725664c9b..e31739fa9d 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -1,658 +1,660 @@ -using System; -using System.Reflection; +using CalamityMod.Utilities; +using CalamityMod.World.Planets; using Microsoft.Xna.Framework; +using System; +using System.Reflection; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.World.Generation; -using CalamityMod.World.Planets; -using CalamityMod.Utilities; using Terraria.Utilities; +using Terraria.World.Generation; namespace CalamityMod.World { public class WorldGenerationMethods : ModWorld { - #region BiomeChests - public static void GenerateBiomeChests(GenerationProgress progress) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - // Get dungeon size field infos. These fields are private for some reason - int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) + 25; - int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; - int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; - int[] ChestTypes = new int[] { mod.TileType("AstralChestLocked") }; - int[] ItemTypes = new int[] { mod.ItemType("HeavenfallenStardisk") }; + #region BiomeChests + public static void GenerateBiomeChests(GenerationProgress progress) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + // Get dungeon size field infos. These fields are private for some reason + int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) + 25; + int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; + int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; + int[] ChestTypes = new int[] { mod.TileType("AstralChestLocked") }; + int[] ItemTypes = new int[] { mod.ItemType("HeavenfallenStardisk") }; - progress.Message = "Calamity Mod: Biome Chests"; + progress.Message = "Calamity Mod: Biome Chests"; - int rounds = 1; - for (int i = 0; i < ChestTypes.Length * rounds; i++) - { - Chest chest = null; - int attempts = 0; - while (chest == null && attempts < 1000) - { - attempts++; - int x = WorldGen.genRand.Next(MinX, MaxX); - int y = WorldGen.genRand.Next((int)Main.worldSurface, MaxY); - if (Main.wallDungeon[Main.tile[x, y].wall] && !Main.tile[x, y].active()) - { - chest = AddChestWithDefaultLoot(x, y, (ushort)ChestTypes[i % ChestTypes.Length], 1, 1); - } - } - if (chest != null) - { - chest.item[0].SetDefaults(ItemTypes[i % ChestTypes.Length]); - chest.item[0].Prefix(-1); - } - } - } + int rounds = 1; + for (int i = 0; i < ChestTypes.Length * rounds; i++) + { + Chest chest = null; + int attempts = 0; + while (chest == null && attempts < 1000) + { + attempts++; + int x = WorldGen.genRand.Next(MinX, MaxX); + int y = WorldGen.genRand.Next((int)Main.worldSurface, MaxY); + if (Main.wallDungeon[Main.tile[x, y].wall] && !Main.tile[x, y].active()) + { + chest = AddChestWithDefaultLoot(x, y, (ushort)ChestTypes[i % ChestTypes.Length], 1, 1); + } + } + if (chest != null) + { + chest.item[0].SetDefaults(ItemTypes[i % ChestTypes.Length]); + chest.item[0].Prefix(-1); + } + } + } - internal static Chest AddChestWithDefaultLoot(int i, int j, ushort type = TileID.Containers, uint emptySlots = 1, int Style = 0) - { - Chest chest = null; - while (j < Main.maxTilesY - 210) - { - if (!WorldGen.SolidTile(i, j)) - { - j++; - continue; - } - int chestIndex = WorldGen.PlaceChest(i - 1, j - 1, type, false, Style); - if (chestIndex < 0) - { - break; - } - chest = Main.chest[chestIndex]; - uint itemIndex = emptySlots; - while (itemIndex == emptySlots) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - bool AstralChest = type == mod.TileType("AstralChestLocked"); - int cItem; - cItem = WorldGen.genRand.NextBool() ? WorldGen.goldBar : WorldGen.silverBar; - int addAmount = 0; - if (AstralChest) - addAmount = 4; - chest.item[itemIndex].SetDefaults(cItem, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(3 + addAmount, 11 + addAmount * 2); - itemIndex++; - if (WorldGen.genRand.NextBool()) - { - cItem = ItemID.HolyArrow; - int addAmount2 = 0; - if (AstralChest) - addAmount2 = 25; - chest.item[itemIndex].SetDefaults(cItem, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(25 + addAmount2, 51 + addAmount2 * 2); - itemIndex++; - } - if (AstralChest) - { - chest.item[itemIndex].SetDefaults(mod.ItemType("AstralJelly"), false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(3, 6); - itemIndex++; - } - if (WorldGen.genRand.NextBool()) - { - int[] items = new int[] { - ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.NightOwlPotion, - ItemID.WaterWalkingPotion, ItemID.ArcheryPotion, ItemID.GravitationPotion - }; - if (AstralChest) - { - items[1] = mod.ItemType("RevivifyPotion"); - items[4] = ItemID.ShinePotion; - items[5] = ItemID.HunterPotion; - } - chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); - itemIndex++; - } - if (WorldGen.genRand.NextBool()) - { - int[] items = new int[] { - ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.InvisibilityPotion, - ItemID.ManaRegenerationPotion, ItemID.TeleportationPotion, ItemID.TrapsightPotion, ItemID.TrapsightPotion // yes, dangersense potions have double the chance as other potions in vanilla for some reason - }; - if (AstralChest) - { - items[1] = ItemID.MagicPowerPotion; - items[2] = mod.ItemType("ZenPotion"); - items[5] = mod.ItemType("CadencePotion"); - } - chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); - itemIndex++; - } - if (WorldGen.genRand.NextBool()) - { - cItem = ItemID.RecallPotion; - int addAmount2 = 0; - if (AstralChest) - { - cItem = ItemID.BouncyDynamite; - addAmount2 = 2; - } - chest.item[itemIndex].SetDefaults(cItem, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount2; - itemIndex++; - } - if (AstralChest) - addAmount = 2; - chest.item[itemIndex].SetDefaults(ItemID.GoldCoin, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount; - itemIndex++; - } - } - return chest; - } - #endregion + internal static Chest AddChestWithDefaultLoot(int i, int j, ushort type = TileID.Containers, uint emptySlots = 1, int Style = 0) + { + Chest chest = null; + while (j < Main.maxTilesY - 210) + { + if (!WorldGen.SolidTile(i, j)) + { + j++; + continue; + } + int chestIndex = WorldGen.PlaceChest(i - 1, j - 1, type, false, Style); + if (chestIndex < 0) + { + break; + } + chest = Main.chest[chestIndex]; + uint itemIndex = emptySlots; + while (itemIndex == emptySlots) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + bool AstralChest = type == mod.TileType("AstralChestLocked"); + int cItem; + cItem = WorldGen.genRand.NextBool() ? WorldGen.goldBar : WorldGen.silverBar; + int addAmount = 0; + if (AstralChest) + addAmount = 4; + chest.item[itemIndex].SetDefaults(cItem, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(3 + addAmount, 11 + addAmount * 2); + itemIndex++; + if (WorldGen.genRand.NextBool()) + { + cItem = ItemID.HolyArrow; + int addAmount2 = 0; + if (AstralChest) + addAmount2 = 25; + chest.item[itemIndex].SetDefaults(cItem, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(25 + addAmount2, 51 + addAmount2 * 2); + itemIndex++; + } + if (AstralChest) + { + chest.item[itemIndex].SetDefaults(mod.ItemType("AstralJelly"), false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(3, 6); + itemIndex++; + } + if (WorldGen.genRand.NextBool()) + { + int[] items = new int[] { + ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.NightOwlPotion, + ItemID.WaterWalkingPotion, ItemID.ArcheryPotion, ItemID.GravitationPotion + }; + if (AstralChest) + { + items[1] = mod.ItemType("RevivifyPotion"); + items[4] = ItemID.ShinePotion; + items[5] = ItemID.HunterPotion; + } + chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); + itemIndex++; + } + if (WorldGen.genRand.NextBool()) + { + int[] items = new int[] { + ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.InvisibilityPotion, + ItemID.ManaRegenerationPotion, ItemID.TeleportationPotion, ItemID.TrapsightPotion, ItemID.TrapsightPotion // yes, dangersense potions have double the chance as other potions in vanilla for some reason + }; + if (AstralChest) + { + items[1] = ItemID.MagicPowerPotion; + items[2] = mod.ItemType("ZenPotion"); + items[5] = mod.ItemType("CadencePotion"); + } + chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); + itemIndex++; + } + if (WorldGen.genRand.NextBool()) + { + cItem = ItemID.RecallPotion; + int addAmount2 = 0; + if (AstralChest) + { + cItem = ItemID.BouncyDynamite; + addAmount2 = 2; + } + chest.item[itemIndex].SetDefaults(cItem, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount2; + itemIndex++; + } + if (AstralChest) + addAmount = 2; + chest.item[itemIndex].SetDefaults(ItemID.GoldCoin, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount; + itemIndex++; + } + } + return chest; + } + #endregion - #region Place Rox Shrine - public static void PlaceRoxShrine() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - while (!CalamityWorld.roxShrinePlaced) - { - CalamityWorld.roxShrinePlaced = true; - for (int x = 0; x < Main.maxTilesX; x++) - { - for (int y = 0; y < Main.maxTilesY; y++) - { - if (Main.tile[x, y] != null && Main.tile[x, y].type == TileID.LargePiles) - { - if ((Main.tile[x, y].frameX == 18 && Main.tile[x, y].frameY == 0) || (Main.tile[x, y].frameX == 45 && Main.tile[x, y].frameY == 0)) - { - if (WorldGen.genRand.Next(3) == 0) - { - for (int dx = -1; dx < 2; dx++) - { - for (int dy = -1; dy < 2; dy++) - Main.tile[x + dx, y + dy].active(false); - } + #region Place Rox Shrine + public static void PlaceRoxShrine() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + while (!CalamityWorld.roxShrinePlaced) + { + CalamityWorld.roxShrinePlaced = true; + for (int x = 0; x < Main.maxTilesX; x++) + { + for (int y = 0; y < Main.maxTilesY; y++) + { + if (Main.tile[x, y] != null && Main.tile[x, y].type == TileID.LargePiles) + { + if ((Main.tile[x, y].frameX == 18 && Main.tile[x, y].frameY == 0) || (Main.tile[x, y].frameX == 45 && Main.tile[x, y].frameY == 0)) + { + if (WorldGen.genRand.Next(3) == 0) + { + for (int dx = -1; dx < 2; dx++) + { + for (int dy = -1; dy < 2; dy++) + Main.tile[x + dx, y + dy].active(false); + } - WorldGen.PlaceTile(x, y + 1, mod.TileType("RoxTile")); - return; - } - else - CalamityWorld.roxShrinePlaced = false; - } - } - } - } - } - } - #endregion + WorldGen.PlaceTile(x, y + 1, mod.TileType("RoxTile")); + return; + } + else + CalamityWorld.roxShrinePlaced = false; + } + } + } + } + } + } + #endregion - #region SafeTileFrame - public static void SafeSquareTileFrame(int i, int j, bool resetFrame = true) - { - if (Main.tile[i, j] != null) - { - for (int x = i - 1; x <= i + 1; x++) - { - for (int y = j - 1; y <= j + 1; y++) - { - if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY) continue; - if (x == i && y == j) - { - WorldGen.TileFrame(i, j, resetFrame, false); - } - else - { - WorldGen.TileFrame(x, y, false, false); - } - } - } - } - } - #endregion + #region SafeTileFrame + public static void SafeSquareTileFrame(int i, int j, bool resetFrame = true) + { + if (Main.tile[i, j] != null) + { + for (int x = i - 1; x <= i + 1; x++) + { + for (int y = j - 1; y <= j + 1; y++) + { + if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY) + continue; + if (x == i && y == j) + { + WorldGen.TileFrame(i, j, resetFrame, false); + } + else + { + WorldGen.TileFrame(x, y, false, false); + } + } + } + } + } + #endregion - #region ShuffleArray - public static int[] ShuffleArray(int[] array) - { - Random random = new Random(); - for (int index = array.Length; index > 0; index--) - { - int j = random.Next(index); - int k = array[j]; - array[j] = array[index - 1]; - array[index - 1] = k; - } - return array; - } - #endregion + #region ShuffleArray + public static int[] ShuffleArray(int[] array) + { + Random random = new Random(); + for (int index = array.Length; index > 0; index--) + { + int j = random.Next(index); + int k = array[j]; + array[j] = array[index - 1]; + array[index - 1] = k; + } + return array; + } + #endregion - #region OreSpawn - public static void SpawnOre(int type, double frequency, float depth, float depthLimit) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int x = Main.maxTilesX; - int y = Main.maxTilesY; - if (type == mod.TileType("ExodiumOre")) - { - depthLimit = 0.14f; - if (y > 1500) { depthLimit = 0.1f; if (y > 2100) { depthLimit = 0.07f; } } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = 0; k < (int)((double)(x * y) * frequency); k++) - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * depth), (int)(y * depthLimit)); - if (type == mod.TileType("AuricOre")) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); - } - else if (type == mod.TileType("UelibloomOre")) - { - if (Main.tile[tilesX, tilesY].type == 59) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == mod.TileType("PerennialOre")) - { - if (Main.tile[tilesX, tilesY].type == 0 || Main.tile[tilesX, tilesY].type == 1) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == mod.TileType("CryonicOre")) - { - if (Main.tile[tilesX, tilesY].type == 147 || Main.tile[tilesX, tilesY].type == 161 || Main.tile[tilesX, tilesY].type == 163 || Main.tile[tilesX, tilesY].type == 164 || Main.tile[tilesX, tilesY].type == 200) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - } - } - #endregion + #region OreSpawn + public static void SpawnOre(int type, double frequency, float depth, float depthLimit) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int x = Main.maxTilesX; + int y = Main.maxTilesY; + if (type == mod.TileType("ExodiumOre")) + { + depthLimit = 0.14f; + if (y > 1500) + { depthLimit = 0.1f; if (y > 2100) { depthLimit = 0.07f; } } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = 0; k < (int)((double)(x * y) * frequency); k++) + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * depth), (int)(y * depthLimit)); + if (type == mod.TileType("AuricOre")) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); + } + else if (type == mod.TileType("UelibloomOre")) + { + if (Main.tile[tilesX, tilesY].type == 59) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else if (type == mod.TileType("PerennialOre")) + { + if (Main.tile[tilesX, tilesY].type == 0 || Main.tile[tilesX, tilesY].type == 1) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else if (type == mod.TileType("CryonicOre")) + { + if (Main.tile[tilesX, tilesY].type == 147 || Main.tile[tilesX, tilesY].type == 161 || Main.tile[tilesX, tilesY].type == 163 || Main.tile[tilesX, tilesY].type == 164 || Main.tile[tilesX, tilesY].type == 200) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + } + } + #endregion - #region AstralMeteor - public static bool CanAstralMeteorSpawn() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int astralOreCount = 0; - float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 - int astralOreAllowed = (int)(200f * worldSizeFactor); // Small = 201 Medium = 305 Large = 401 - for (int x = 5; x < Main.maxTilesX - 5; x++) - { - int y = 5; - while (y < Main.worldSurface) - { - if (Main.tile[x, y].active() && Main.tile[x, y].type == mod.TileType("AstralOre")) - { - astralOreCount++; - if (astralOreCount > astralOreAllowed) - return false; - } - y++; - } - } - return true; - } + #region AstralMeteor + public static bool CanAstralMeteorSpawn() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int astralOreCount = 0; + float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 + int astralOreAllowed = (int)(200f * worldSizeFactor); // Small = 201 Medium = 305 Large = 401 + for (int x = 5; x < Main.maxTilesX - 5; x++) + { + int y = 5; + while (y < Main.worldSurface) + { + if (Main.tile[x, y].active() && Main.tile[x, y].type == mod.TileType("AstralOre")) + { + astralOreCount++; + if (astralOreCount > astralOreAllowed) + return false; + } + y++; + } + } + return true; + } - public static bool CanAstralBiomeSpawn() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int astralTileCount = 0; - float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 - int astralTilesAllowed = (int)(400f * worldSizeFactor); // Small = 401 Medium = 605 Large = 801 - for (int x = 5; x < Main.maxTilesX - 5; x++) - { - int y = 5; - while (y < Main.worldSurface) - { - if (Main.tile[x, y].active() && - (Main.tile[x, y].type == mod.TileType("AstralSand") || Main.tile[x, y].type == mod.TileType("AstralSandstone") || - Main.tile[x, y].type == mod.TileType("HardenedAstralSand") || Main.tile[x, y].type == mod.TileType("AstralIce") || - Main.tile[x, y].type == mod.TileType("AstralDirt") || Main.tile[x, y].type == mod.TileType("AstralStone") || - Main.tile[x, y].type == mod.TileType("AstralGrass"))) - { - astralTileCount++; - if (astralTileCount > astralTilesAllowed) - return false; - } - y++; - } - } - return true; - } + public static bool CanAstralBiomeSpawn() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int astralTileCount = 0; + float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 + int astralTilesAllowed = (int)(400f * worldSizeFactor); // Small = 401 Medium = 605 Large = 801 + for (int x = 5; x < Main.maxTilesX - 5; x++) + { + int y = 5; + while (y < Main.worldSurface) + { + if (Main.tile[x, y].active() && + (Main.tile[x, y].type == mod.TileType("AstralSand") || Main.tile[x, y].type == mod.TileType("AstralSandstone") || + Main.tile[x, y].type == mod.TileType("HardenedAstralSand") || Main.tile[x, y].type == mod.TileType("AstralIce") || + Main.tile[x, y].type == mod.TileType("AstralDirt") || Main.tile[x, y].type == mod.TileType("AstralStone") || + Main.tile[x, y].type == mod.TileType("AstralGrass"))) + { + astralTileCount++; + if (astralTileCount > astralTilesAllowed) + return false; + } + y++; + } + } + return true; + } - public static void AstralMeteorThreadWrapper(object context) - { - PlaceAstralMeteor(); - } + public static void AstralMeteorThreadWrapper(object context) + { + PlaceAstralMeteor(); + } - public static void PlaceAstralMeteor() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Mod ancientsAwakened = ModLoader.GetMod("AAMod"); + public static void PlaceAstralMeteor() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Mod ancientsAwakened = ModLoader.GetMod("AAMod"); - // This flag is also used to determine whether players are nearby. - bool meteorDropped = true; + // This flag is also used to determine whether players are nearby. + bool meteorDropped = true; - // Clients in multiplayer don't drop meteors. - if (Main.netMode == NetmodeID.MultiplayerClient) - return; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active) - { - meteorDropped = false; - break; - } - } + // Clients in multiplayer don't drop meteors. + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active) + { + meteorDropped = false; + break; + } + } - // Check whether there is already too much ore. - if (!CanAstralMeteorSpawn()) - return; + // Check whether there is already too much ore. + if (!CanAstralMeteorSpawn()) + return; UnifiedRandom rand = WorldGen.genRand; float solidTileRequirement = 600f; bool localAbyssSide = WorldGen.dungeonX < Main.maxTilesX / 2; while (!meteorDropped) - { + { float worldEdgeMargin = (float)Main.maxTilesX * 0.08f; - int xLimit = Main.maxTilesX / 2; + int xLimit = Main.maxTilesX / 2; int x = CalamityWorld.abyssSide ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400); while ((float)x > (float)Main.spawnTileX - worldEdgeMargin && (float)x < (float)Main.spawnTileX + worldEdgeMargin) - { - x = (CalamityWorld.abyssSide ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400)); - } - //world surface = 920 large 740 medium 560 small - int y = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336 - while (y < Main.maxTilesY) - { - if (Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type]) - { - int suitableTiles = 0; - int checkRadius = 15; - for (int l = x - checkRadius; l < x + checkRadius; l++) - { - for (int m = y - checkRadius; m < y + checkRadius; m++) - { - if (WorldGen.SolidTile(l, m)) - { - suitableTiles++; + { + x = (CalamityWorld.abyssSide ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400)); + } + //world surface = 920 large 740 medium 560 small + int y = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336 + while (y < Main.maxTilesY) + { + if (Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type]) + { + int suitableTiles = 0; + int checkRadius = 15; + for (int l = x - checkRadius; l < x + checkRadius; l++) + { + for (int m = y - checkRadius; m < y + checkRadius; m++) + { + if (WorldGen.SolidTile(l, m)) + { + suitableTiles++; - // Avoid floating islands: Clouds and Sunplate both harshly punish attempted meteor spawns - if (Main.tile[l, m].type == TileID.Cloud || Main.tile[l, m].type == TileID.Sunplate) - { - suitableTiles -= 100; - } + // Avoid floating islands: Clouds and Sunplate both harshly punish attempted meteor spawns + if (Main.tile[l, m].type == TileID.Cloud || Main.tile[l, m].type == TileID.Sunplate) + { + suitableTiles -= 100; + } - // Prevent the Astral biome from overriding or interfering with an AA biome - else if (ancientsAwakened != null) - { - if (Main.tile[l, m].type == ancientsAwakened.TileType("InfernoGrass") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchstone") || - Main.tile[l, m].type == ancientsAwakened.TileType("Torchsand") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandstone") || - Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandhardened") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchice") || - Main.tile[l, m].type == ancientsAwakened.TileType("Depthstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsand") || - Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandhardened") || - Main.tile[l, m].type == ancientsAwakened.TileType("Depthice")) - { - suitableTiles -= 100; - } - } - } + // Prevent the Astral biome from overriding or interfering with an AA biome + else if (ancientsAwakened != null) + { + if (Main.tile[l, m].type == ancientsAwakened.TileType("InfernoGrass") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchstone") || + Main.tile[l, m].type == ancientsAwakened.TileType("Torchsand") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandstone") || + Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandhardened") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchice") || + Main.tile[l, m].type == ancientsAwakened.TileType("Depthstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsand") || + Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandhardened") || + Main.tile[l, m].type == ancientsAwakened.TileType("Depthice")) + { + suitableTiles -= 100; + } + } + } - // Liquid aversion makes meteors less likely to fall in lakes - else if (Main.tile[l, m].liquid > 0) - { - suitableTiles--; - } - } - } + // Liquid aversion makes meteors less likely to fall in lakes + else if (Main.tile[l, m].liquid > 0) + { + suitableTiles--; + } + } + } - if ((float)suitableTiles < solidTileRequirement) - { - solidTileRequirement -= 0.5f; - break; - } - meteorDropped = GenerateAstralMeteor(x, y); + if ((float)suitableTiles < solidTileRequirement) + { + solidTileRequirement -= 0.5f; + break; + } + meteorDropped = GenerateAstralMeteor(x, y); - // If the meteor actually dropped, post the message stating as such. - if (meteorDropped) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; + // If the meteor actually dropped, post the message stating as such. + if (meteorDropped) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - break; - } - break; - } - else - { - y++; - } - } - if (solidTileRequirement < 100f) - { - return; - } - } - } + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + break; + } + break; + } + else + { + y++; + } + } + if (solidTileRequirement < 100f) + { + return; + } + } + } - public static bool GenerateAstralMeteor(int i, int j) - { + public static bool GenerateAstralMeteor(int i, int j) + { UnifiedRandom rand = WorldGen.genRand; Mod mod = ModLoader.GetMod("CalamityMod"); - if (i < 50 || i > Main.maxTilesX - 50) - { - return false; - } - if (j < 50 || j > Main.maxTilesY - 50) - { - return false; - } - int num = 35; - Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); - for (int k = 0; k < 255; k++) - { - if (Main.player[k].active) - { - Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); - if (rectangle.Intersects(value)) - { - return false; - } - } - } - for (int l = 0; l < 200; l++) - { - if (Main.npc[l].active) - { - Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); - if (rectangle.Intersects(value2)) - { - return false; - } - } - } - for (int m = i - num; m < i + num; m++) - { - for (int n = j - num; n < j + num; n++) - { - if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) - { - return false; - } - } - } - num = rand.Next(17, 23); - for (int num2 = i - num; num2 < i + num; num2++) - { - for (int num3 = j - num; num3 < j + num; num3++) - { - if (num3 > j + rand.Next(-2, 3) - 5) - { - float num4 = (float)Math.Abs(i - num2); - float num5 = (float)Math.Abs(j - num3); - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - if ((double)num6 < (double)num * 0.9 + (double)rand.Next(-4, 5)) - { - if (Main.tile[num2, num3] != null) - { - if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) - { - Main.tile[num2, num3].active(false); - } - Main.tile[num2, num3].type = (ushort)mod.TileType("AstralOre"); - } - } - } - } - } - num = WorldGen.genRand.Next(8, 14); - for (int num7 = i - num; num7 < i + num; num7++) - { - for (int num8 = j - num; num8 < j + num; num8++) - { - if (num8 > j + rand.Next(-2, 3) - 4) - { - float num9 = (float)Math.Abs(i - num7); - float num10 = (float)Math.Abs(j - num8); - float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); - if ((double)num11 < (double)num * 0.8 + (double)rand.Next(-3, 4)) - { - if (Main.tile[num7, num8] != null) - Main.tile[num7, num8].active(false); - } - } - } - } - num = WorldGen.genRand.Next(25, 35); - for (int num12 = i - num; num12 < i + num; num12++) - { - for (int num13 = j - num; num13 < j + num; num13++) - { - float num14 = (float)Math.Abs(i - num12); - float num15 = (float)Math.Abs(j - num13); - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.tile[num12, num13] != null) - { - if ((double)num16 < (double)num * 0.7) - { - if (Main.tile[num12, num13].type == 5 || Main.tile[num12, num13].type == 32 || Main.tile[num12, num13].type == 352) - { - WorldGen.KillTile(num12, num13, false, false, false); - } - Main.tile[num12, num13].liquid = 0; - } - if (Main.tile[num12, num13].type == (ushort)mod.TileType("AstralOre")) - { - if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - } - WorldGen.SquareTileFrame(num12, num13, true); - WorldGen.SquareWallFrame(num12, num13, true); - } - } - } - num = WorldGen.genRand.Next(23, 32); - for (int num17 = i - num; num17 < i + num; num17++) - { - for (int num18 = j - num; num18 < j + num; num18++) - { - if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && rand.NextBool(10)) - { - float num19 = (float)Math.Abs(i - num17); - float num20 = (float)Math.Abs(j - num18); - float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); - if ((double)num21 < (double)num * 0.8) - { - if (Main.tile[num17, num18] != null) - { - if (Main.tile[num17, num18].type == 5 || Main.tile[num17, num18].type == 32 || Main.tile[num17, num18].type == 352) - { - WorldGen.KillTile(num17, num18, false, false, false); - } - Main.tile[num17, num18].type = (ushort)mod.TileType("AstralOre"); - WorldGen.SquareTileFrame(num17, num18, true); - } - } - } - } - } - num = WorldGen.genRand.Next(30, 38); - for (int num22 = i - num; num22 < i + num; num22++) - { - for (int num23 = j - num; num23 < j + num; num23++) - { - if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && rand.NextBool(20)) - { - float num24 = (float)Math.Abs(i - num22); - float num25 = (float)Math.Abs(j - num23); - float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); - if ((double)num26 < (double)num * 0.85) - { - if (Main.tile[num22, num23] != null) - { - if (Main.tile[num22, num23].type == 5 || Main.tile[num22, num23].type == 32 || Main.tile[num22, num23].type == 352) - { - WorldGen.KillTile(num22, num23, false, false, false); - } - Main.tile[num22, num23].type = (ushort)mod.TileType("AstralOre"); - WorldGen.SquareTileFrame(num22, num23, true); - } - } - } - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); - if (CanAstralBiomeSpawn()) - DoAstralConversion(new Point(i, j)); - } - return true; - } + if (i < 50 || i > Main.maxTilesX - 50) + { + return false; + } + if (j < 50 || j > Main.maxTilesY - 50) + { + return false; + } + int num = 35; + Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); + for (int k = 0; k < 255; k++) + { + if (Main.player[k].active) + { + Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); + if (rectangle.Intersects(value)) + { + return false; + } + } + } + for (int l = 0; l < 200; l++) + { + if (Main.npc[l].active) + { + Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); + if (rectangle.Intersects(value2)) + { + return false; + } + } + } + for (int m = i - num; m < i + num; m++) + { + for (int n = j - num; n < j + num; n++) + { + if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) + { + return false; + } + } + } + num = rand.Next(17, 23); + for (int num2 = i - num; num2 < i + num; num2++) + { + for (int num3 = j - num; num3 < j + num; num3++) + { + if (num3 > j + rand.Next(-2, 3) - 5) + { + float num4 = (float)Math.Abs(i - num2); + float num5 = (float)Math.Abs(j - num3); + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + if ((double)num6 < (double)num * 0.9 + (double)rand.Next(-4, 5)) + { + if (Main.tile[num2, num3] != null) + { + if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) + { + Main.tile[num2, num3].active(false); + } + Main.tile[num2, num3].type = (ushort)mod.TileType("AstralOre"); + } + } + } + } + } + num = WorldGen.genRand.Next(8, 14); + for (int num7 = i - num; num7 < i + num; num7++) + { + for (int num8 = j - num; num8 < j + num; num8++) + { + if (num8 > j + rand.Next(-2, 3) - 4) + { + float num9 = (float)Math.Abs(i - num7); + float num10 = (float)Math.Abs(j - num8); + float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); + if ((double)num11 < (double)num * 0.8 + (double)rand.Next(-3, 4)) + { + if (Main.tile[num7, num8] != null) + Main.tile[num7, num8].active(false); + } + } + } + } + num = WorldGen.genRand.Next(25, 35); + for (int num12 = i - num; num12 < i + num; num12++) + { + for (int num13 = j - num; num13 < j + num; num13++) + { + float num14 = (float)Math.Abs(i - num12); + float num15 = (float)Math.Abs(j - num13); + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if (Main.tile[num12, num13] != null) + { + if ((double)num16 < (double)num * 0.7) + { + if (Main.tile[num12, num13].type == 5 || Main.tile[num12, num13].type == 32 || Main.tile[num12, num13].type == 352) + { + WorldGen.KillTile(num12, num13, false, false, false); + } + Main.tile[num12, num13].liquid = 0; + } + if (Main.tile[num12, num13].type == (ushort)mod.TileType("AstralOre")) + { + if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + } + WorldGen.SquareTileFrame(num12, num13, true); + WorldGen.SquareWallFrame(num12, num13, true); + } + } + } + num = WorldGen.genRand.Next(23, 32); + for (int num17 = i - num; num17 < i + num; num17++) + { + for (int num18 = j - num; num18 < j + num; num18++) + { + if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && rand.NextBool(10)) + { + float num19 = (float)Math.Abs(i - num17); + float num20 = (float)Math.Abs(j - num18); + float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); + if ((double)num21 < (double)num * 0.8) + { + if (Main.tile[num17, num18] != null) + { + if (Main.tile[num17, num18].type == 5 || Main.tile[num17, num18].type == 32 || Main.tile[num17, num18].type == 352) + { + WorldGen.KillTile(num17, num18, false, false, false); + } + Main.tile[num17, num18].type = (ushort)mod.TileType("AstralOre"); + WorldGen.SquareTileFrame(num17, num18, true); + } + } + } + } + } + num = WorldGen.genRand.Next(30, 38); + for (int num22 = i - num; num22 < i + num; num22++) + { + for (int num23 = j - num; num23 < j + num; num23++) + { + if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && rand.NextBool(20)) + { + float num24 = (float)Math.Abs(i - num22); + float num25 = (float)Math.Abs(j - num23); + float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); + if ((double)num26 < (double)num * 0.85) + { + if (Main.tile[num22, num23] != null) + { + if (Main.tile[num22, num23].type == 5 || Main.tile[num22, num23].type == 32 || Main.tile[num22, num23].type == 352) + { + WorldGen.KillTile(num22, num23, false, false, false); + } + Main.tile[num22, num23].type = (ushort)mod.TileType("AstralOre"); + WorldGen.SquareTileFrame(num22, num23, true); + } + } + } + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); + if (CanAstralBiomeSpawn()) + DoAstralConversion(new Point(i, j)); + } + return true; + } - public static void DoAstralConversion(object obj) - { - //Pre-calculate all variables necessary for elliptical area checking - Point origin = (Point)obj; - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + public static void DoAstralConversion(object obj) + { + //Pre-calculate all variables necessary for elliptical area checking + Point origin = (Point)obj; + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; - int distanceInTiles = 150 + ((Main.maxTilesX - 4200) / 4200) * 200; - float distance = distanceInTiles * 16f; - float constant = (distance * 2f) / (float)Math.Sin(angle); + int distanceInTiles = 150 + ((Main.maxTilesX - 4200) / 4200) * 200; + float distance = distanceInTiles * 16f; + float constant = (distance * 2f) / (float)Math.Sin(angle); - float fociSpacing = ((distance * (float)Math.Sin(otherAngle)) / (float)Math.Sin(angle)); - int verticalRadius = (int)(constant / 16f); + float fociSpacing = ((distance * (float)Math.Sin(otherAngle)) / (float)Math.Sin(angle)); + int verticalRadius = (int)(constant / 16f); - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; UnifiedRandom rand = WorldGen.genRand; for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++) - { - for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) - { + { + for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) + { if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out float dist, y < origin.Y)) { //If we're in the outer blurPercent% of the ellipse @@ -672,2643 +674,2695 @@ namespace CalamityMod.World } } } - } - } + } + } - public static void ConvertToAstral(int startX, int endX, int startY, int endY) - { - for (int x = startX; x <= endX; x++) - { - for (int y = startY; y <= endY; y++) - { - ConvertToAstral(x, y); - } - } - } + public static void ConvertToAstral(int startX, int endX, int startY, int endY) + { + for (int x = startX; x <= endX; x++) + { + for (int y = startY; y <= endY; y++) + { + ConvertToAstral(x, y); + } + } + } - public static void ConvertToAstral(int x, int y, bool tileframe = true) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (WorldGen.InWorld(x, y, 1)) - { - int type = Main.tile[x, y].type; - int wallType = Main.tile[x, y].wall; + public static void ConvertToAstral(int x, int y, bool tileframe = true) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (WorldGen.InWorld(x, y, 1)) + { + int type = Main.tile[x, y].type; + int wallType = Main.tile[x, y].wall; - if (Main.tile[x, y] != null) - { - if (WallID.Sets.Conversion.Grass[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("AstralGrassWallUnsafe"); - } - else if (WallID.Sets.Conversion.HardenedSand[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("HardenedAstralSandWallUnsafe"); - } - else if (WallID.Sets.Conversion.Sandstone[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("AstralSandstoneWallUnsafe"); - } - else if (WallID.Sets.Conversion.Stone[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("AstralStoneWallUnsafe"); - } - else - { - switch (wallType) - { - case WallID.DirtUnsafe: - case WallID.DirtUnsafe1: - case WallID.DirtUnsafe2: - case WallID.DirtUnsafe3: - case WallID.DirtUnsafe4: - case WallID.Cave6Unsafe: - case WallID.Dirt: - Main.tile[x, y].wall = (ushort)mod.WallType("AstralDirtWallUnsafe"); - break; - case WallID.IceUnsafe: - Main.tile[x, y].wall = (ushort)mod.WallType("AstralIceWallUnsafe"); - break; - } - } - if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralGrass"); - } - else if (TileID.Sets.Conversion.Stone[type] || Main.tileMoss[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralStone"); - } - else if (TileID.Sets.Conversion.Sand[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralSand"); - } - else if (TileID.Sets.Conversion.HardenedSand[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("HardenedAstralSand"); - } - else if (TileID.Sets.Conversion.Sandstone[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralSandstone"); - } - else if (TileID.Sets.Conversion.Ice[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralIce"); - } - else - { - Tile tile = Main.tile[x, y]; - switch (type) - { - case TileID.Dirt: - Main.tile[x, y].type = (ushort)mod.TileType("AstralDirt"); - break; - case TileID.Vines: - Main.tile[x, y].type = (ushort)mod.TileType("AstralVines"); - break; - case TileID.LargePiles: - if (tile.frameX <= 1170) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 0, 1170, 0, 18); - } - if (tile.frameX >= 1728) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 1728, 1872, 0, 18); - } - if (tile.frameX >= 1404 && tile.frameX <= 1710) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralIceLargePiles"), x, y, 324, 1404, 1710, 0, 18); - } - break; - case TileID.LargePiles2: - if (tile.frameX >= 1566 && tile.frameY < 36) - { - RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralDesertLargePiles"), x, y, 324, 1566, 1872, 0, 18); - } - if (tile.frameX >= 756 && tile.frameX <= 900) - { - RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 756, 900, 0, 18); - } - break; - case TileID.SmallPiles: - if (tile.frameY == 18) - { - ushort newType = 9999; - if (tile.frameX >= 1476 && tile.frameX <= 1674) - { - newType = (ushort)mod.TileType("AstralDesertMediumPiles"); - } - else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458)) - { - newType = (ushort)mod.TileType("AstralNormalMediumPiles"); - } - else if (tile.frameX >= 900 && tile.frameX <= 1098) - { - newType = (ushort)mod.TileType("AstralIceMediumPiles"); - } - else - { - break; - } - int leftMost = x; - if (tile.frameX % 36 != 0) //this means it's the right tile of the two - { - leftMost--; - } - if (Main.tile[leftMost, y] != null) - Main.tile[leftMost, y].type = newType; - if (Main.tile[leftMost + 1, y] != null) - Main.tile[leftMost + 1, y].type = newType; - while (Main.tile[leftMost, y].frameX >= 216) - { - if (Main.tile[leftMost, y] != null) - Main.tile[leftMost, y].frameX -= 216; - if (Main.tile[leftMost + 1, y] != null) - Main.tile[leftMost + 1, y].frameX -= 216; - } - } - else if (tile.frameY == 0) - { - ushort newType3 = 9999; - if (tile.frameX >= 972 && tile.frameX <= 1062) - { - newType3 = (ushort)mod.TileType("AstralDesertSmallPiles"); - } - else if (tile.frameX <= 486) - { - newType3 = (ushort)mod.TileType("AstralNormalSmallPiles"); - } - else if (tile.frameX >= 648 && tile.frameX <= 846) - { - newType3 = (ushort)mod.TileType("AstralIceSmallPiles"); - } - else - { - break; - } - Main.tile[x, y].type = newType3; - while (Main.tile[x, y].frameX >= 108) //REFRAME IT - { - Main.tile[x, y].frameX -= 108; - } - } - break; - case TileID.Stalactite: - int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; - bool twoTall = tile.frameY <= 54; - bool hanging = tile.frameY <= 18 || tile.frameY == 72; - ushort newType2 = 9999; - if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT - { - newType2 = (ushort)mod.TileType("AstralDesertStalactite"); - } - else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360)) - { - newType2 = (ushort)mod.TileType("AstralNormalStalactite"); - } - else if (tile.frameX <= 36) - { - newType2 = (ushort)mod.TileType("AstralIceStalactite"); - } - else - { - break; - } + if (Main.tile[x, y] != null) + { + if (WallID.Sets.Conversion.Grass[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("AstralGrassWallUnsafe"); + } + else if (WallID.Sets.Conversion.HardenedSand[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("HardenedAstralSandWallUnsafe"); + } + else if (WallID.Sets.Conversion.Sandstone[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("AstralSandstoneWallUnsafe"); + } + else if (WallID.Sets.Conversion.Stone[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("AstralStoneWallUnsafe"); + } + else + { + switch (wallType) + { + case WallID.DirtUnsafe: + case WallID.DirtUnsafe1: + case WallID.DirtUnsafe2: + case WallID.DirtUnsafe3: + case WallID.DirtUnsafe4: + case WallID.Cave6Unsafe: + case WallID.Dirt: + Main.tile[x, y].wall = (ushort)mod.WallType("AstralDirtWallUnsafe"); + break; + case WallID.IceUnsafe: + Main.tile[x, y].wall = (ushort)mod.WallType("AstralIceWallUnsafe"); + break; + } + } + if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralGrass"); + } + else if (TileID.Sets.Conversion.Stone[type] || Main.tileMoss[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralStone"); + } + else if (TileID.Sets.Conversion.Sand[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralSand"); + } + else if (TileID.Sets.Conversion.HardenedSand[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("HardenedAstralSand"); + } + else if (TileID.Sets.Conversion.Sandstone[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralSandstone"); + } + else if (TileID.Sets.Conversion.Ice[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralIce"); + } + else + { + Tile tile = Main.tile[x, y]; + switch (type) + { + case TileID.Dirt: + Main.tile[x, y].type = (ushort)mod.TileType("AstralDirt"); + break; + case TileID.Vines: + Main.tile[x, y].type = (ushort)mod.TileType("AstralVines"); + break; + case TileID.LargePiles: + if (tile.frameX <= 1170) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 0, 1170, 0, 18); + } + if (tile.frameX >= 1728) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 1728, 1872, 0, 18); + } + if (tile.frameX >= 1404 && tile.frameX <= 1710) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralIceLargePiles"), x, y, 324, 1404, 1710, 0, 18); + } + break; + case TileID.LargePiles2: + if (tile.frameX >= 1566 && tile.frameY < 36) + { + RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralDesertLargePiles"), x, y, 324, 1566, 1872, 0, 18); + } + if (tile.frameX >= 756 && tile.frameX <= 900) + { + RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 756, 900, 0, 18); + } + break; + case TileID.SmallPiles: + if (tile.frameY == 18) + { + ushort newType = 9999; + if (tile.frameX >= 1476 && tile.frameX <= 1674) + { + newType = (ushort)mod.TileType("AstralDesertMediumPiles"); + } + else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458)) + { + newType = (ushort)mod.TileType("AstralNormalMediumPiles"); + } + else if (tile.frameX >= 900 && tile.frameX <= 1098) + { + newType = (ushort)mod.TileType("AstralIceMediumPiles"); + } + else + { + break; + } + int leftMost = x; + if (tile.frameX % 36 != 0) //this means it's the right tile of the two + { + leftMost--; + } + if (Main.tile[leftMost, y] != null) + Main.tile[leftMost, y].type = newType; + if (Main.tile[leftMost + 1, y] != null) + Main.tile[leftMost + 1, y].type = newType; + while (Main.tile[leftMost, y].frameX >= 216) + { + if (Main.tile[leftMost, y] != null) + Main.tile[leftMost, y].frameX -= 216; + if (Main.tile[leftMost + 1, y] != null) + Main.tile[leftMost + 1, y].frameX -= 216; + } + } + else if (tile.frameY == 0) + { + ushort newType3 = 9999; + if (tile.frameX >= 972 && tile.frameX <= 1062) + { + newType3 = (ushort)mod.TileType("AstralDesertSmallPiles"); + } + else if (tile.frameX <= 486) + { + newType3 = (ushort)mod.TileType("AstralNormalSmallPiles"); + } + else if (tile.frameX >= 648 && tile.frameX <= 846) + { + newType3 = (ushort)mod.TileType("AstralIceSmallPiles"); + } + else + { + break; + } + Main.tile[x, y].type = newType3; + while (Main.tile[x, y].frameX >= 108) //REFRAME IT + { + Main.tile[x, y].frameX -= 108; + } + } + break; + case TileID.Stalactite: + int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; + bool twoTall = tile.frameY <= 54; + bool hanging = tile.frameY <= 18 || tile.frameY == 72; + ushort newType2 = 9999; + if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT + { + newType2 = (ushort)mod.TileType("AstralDesertStalactite"); + } + else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360)) + { + newType2 = (ushort)mod.TileType("AstralNormalStalactite"); + } + else if (tile.frameX <= 36) + { + newType2 = (ushort)mod.TileType("AstralIceStalactite"); + } + else + { + break; + } - //Set types - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].type = newType2; - if (twoTall) - { - if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].type = newType2; - } + //Set types + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].type = newType2; + if (twoTall) + { + if (Main.tile[x, topMost + 1] != null) + Main.tile[x, topMost + 1].type = newType2; + } - //Fix frames - while (Main.tile[x, topMost].frameX >= 54) - { - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].frameX -= 54; - if (twoTall) - { - if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].frameX -= 54; - } - } + //Fix frames + while (Main.tile[x, topMost].frameX >= 54) + { + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].frameX -= 54; + if (twoTall) + { + if (Main.tile[x, topMost + 1] != null) + Main.tile[x, topMost + 1].frameX -= 54; + } + } - if (hanging) - { - ConvertToAstral(x, topMost - 1); - break; - } - else - { - if (twoTall) - { - ConvertToAstral(x, topMost + 2); - break; - } - ConvertToAstral(x, topMost + 1); - break; - } - } - } - if (tileframe) - { - if (Main.netMode == NetmodeID.SinglePlayer) - { - WorldGen.SquareTileFrame(x, y, true); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, x, y, 1); - } - } - } - } - } + if (hanging) + { + ConvertToAstral(x, topMost - 1); + break; + } + else + { + if (twoTall) + { + ConvertToAstral(x, topMost + 2); + break; + } + ConvertToAstral(x, topMost + 1); + break; + } + } + } + if (tileframe) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + WorldGen.SquareTileFrame(x, y, true); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, x, y, 1); + } + } + } + } + } - public static void ConvertFromAstral(int x, int y, ConvertType convert) - { - Tile tile = Main.tile[x, y]; - int type = tile.type; - int wallType = tile.wall; - Mod mod = ModContent.GetInstance(); + public static void ConvertFromAstral(int x, int y, ConvertType convert) + { + Tile tile = Main.tile[x, y]; + int type = tile.type; + int wallType = tile.wall; + Mod mod = ModContent.GetInstance(); - if (WorldGen.InWorld(x, y, 1)) - { - #region WALL - if (Main.tile[x, y] != null) - { - if (wallType == mod.WallType("AstralDirtWall")) - { - Main.tile[x, y].wall = WallID.DirtUnsafe; - } - else if (wallType == mod.WallType("AstralGrassWall")) - { - switch (convert) - { - case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.CorruptGrassUnsafe; - break; - case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe; - break; - case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.HallowedGrassUnsafe; - break; - case ConvertType.Pure: - Main.tile[x, y].wall = WallID.GrassUnsafe; - break; - } - } - else if (wallType == mod.WallType("AstralIceWall")) - { - Main.tile[x, y].wall = WallID.IceUnsafe; - } - else if (wallType == mod.WallType("AstralStoneWall")) - { - switch (convert) - { - case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.EbonstoneUnsafe; - break; - case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimstoneUnsafe; - break; - case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe; - break; - case ConvertType.Pure: - Main.tile[x, y].wall = WallID.Stone; - break; - } - } - } - #endregion + if (WorldGen.InWorld(x, y, 1)) + { + #region WALL + if (Main.tile[x, y] != null) + { + if (wallType == mod.WallType("AstralDirtWall")) + { + Main.tile[x, y].wall = WallID.DirtUnsafe; + } + else if (wallType == mod.WallType("AstralGrassWall")) + { + switch (convert) + { + case ConvertType.Corrupt: + Main.tile[x, y].wall = WallID.CorruptGrassUnsafe; + break; + case ConvertType.Crimson: + Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe; + break; + case ConvertType.Hallow: + Main.tile[x, y].wall = WallID.HallowedGrassUnsafe; + break; + case ConvertType.Pure: + Main.tile[x, y].wall = WallID.GrassUnsafe; + break; + } + } + else if (wallType == mod.WallType("AstralIceWall")) + { + Main.tile[x, y].wall = WallID.IceUnsafe; + } + else if (wallType == mod.WallType("AstralStoneWall")) + { + switch (convert) + { + case ConvertType.Corrupt: + Main.tile[x, y].wall = WallID.EbonstoneUnsafe; + break; + case ConvertType.Crimson: + Main.tile[x, y].wall = WallID.CrimstoneUnsafe; + break; + case ConvertType.Hallow: + Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe; + break; + case ConvertType.Pure: + Main.tile[x, y].wall = WallID.Stone; + break; + } + } + } + #endregion - #region TILE - if (Main.tile[x, y] != null) - { - if (type == mod.TileType("AstralDirt")) - { - tile.type = TileID.Dirt; - } - else if (type == mod.TileType("AstralGrass")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass, TileID.Grass); - } - else if (type == mod.TileType("AstralStone")) - { - SetTileFromConvert(x, y, convert, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone, TileID.Stone); - } - else if (type == mod.TileType("AstralSand")) - { - SetTileFromConvert(x, y, convert, TileID.Ebonsand, TileID.Crimsand, TileID.Pearlsand, TileID.Sand); - } - else if (type == mod.TileType("AstralSandstone")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptSandstone, TileID.CrimsonSandstone, TileID.HallowSandstone, TileID.Sandstone); - } - else if (type == mod.TileType("HardenedAstralSand")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand, TileID.HallowHardenedSand, TileID.HardenedSand); - } - else if (type == mod.TileType("AstralIce")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, TileID.IceBlock); - } - else if (type == mod.TileType("AstralVines")) - { - SetTileFromConvert(x, y, convert, ushort.MaxValue, TileID.CrimsonVines, TileID.HallowedVines, TileID.Vines); - } - else if (type == mod.TileType("AstralShortPlants")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptPlants, ushort.MaxValue, TileID.HallowedPlants, TileID.Plants); - } - else if (type == mod.TileType("AstralTallPlants")) - { - SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2); - } - else if (type == mod.TileType("AstralNormalLargePiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); - } - else if (type == mod.TileType("AstralNormalMediumPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18); - } - else if (type == mod.TileType("AstralNormalSmallPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0); - } - else if (type == mod.TileType("AstralDesertLargePiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 1566, 0); - } - else if (type == mod.TileType("AstralDesertMediumPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1476, 18); - } - else if (type == mod.TileType("AstralDesertSmallPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 972, 0); - } - else if (type == mod.TileType("AstralIceLargePiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 1404, 0); - } - else if (type == mod.TileType("AstralIceMediumPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 900, 18); - } - else if (type == mod.TileType("AstralIceSmallPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0); - } - else if (type == mod.TileType("AstralNormalStalactite")) - { - ushort originType = TileID.Stone; - int frameXAdd = 54; - switch (convert) - { - case ConvertType.Corrupt: - originType = TileID.Ebonstone; - frameXAdd = 324; - break; - case ConvertType.Crimson: - originType = TileID.Crimstone; - frameXAdd = 270; - break; - case ConvertType.Hallow: - originType = TileID.Pearlstone; - frameXAdd = 216; - break; - } - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); - } - else if (type == mod.TileType("AstralDesertStalactite")) - { - ushort originType = TileID.Sandstone; - int frameXAdd = 378; - switch (convert) - { - case ConvertType.Corrupt: - originType = TileID.CorruptSandstone; - frameXAdd = 324; - break; - case ConvertType.Crimson: - originType = TileID.CrimsonSandstone; - frameXAdd = 270; - break; - case ConvertType.Hallow: - originType = TileID.HallowSandstone; - frameXAdd = 216; - break; - } - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); - } - else if (type == mod.TileType("AstralIceStalactite")) - { - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, TileID.IceBlock, x, y, 0, 0); - } - if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt) - { - WorldGen.SquareTileFrame(x, y); - } - } - #endregion - } - } + #region TILE + if (Main.tile[x, y] != null) + { + if (type == mod.TileType("AstralDirt")) + { + tile.type = TileID.Dirt; + } + else if (type == mod.TileType("AstralGrass")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass, TileID.Grass); + } + else if (type == mod.TileType("AstralStone")) + { + SetTileFromConvert(x, y, convert, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone, TileID.Stone); + } + else if (type == mod.TileType("AstralSand")) + { + SetTileFromConvert(x, y, convert, TileID.Ebonsand, TileID.Crimsand, TileID.Pearlsand, TileID.Sand); + } + else if (type == mod.TileType("AstralSandstone")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptSandstone, TileID.CrimsonSandstone, TileID.HallowSandstone, TileID.Sandstone); + } + else if (type == mod.TileType("HardenedAstralSand")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand, TileID.HallowHardenedSand, TileID.HardenedSand); + } + else if (type == mod.TileType("AstralIce")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, TileID.IceBlock); + } + else if (type == mod.TileType("AstralVines")) + { + SetTileFromConvert(x, y, convert, ushort.MaxValue, TileID.CrimsonVines, TileID.HallowedVines, TileID.Vines); + } + else if (type == mod.TileType("AstralShortPlants")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptPlants, ushort.MaxValue, TileID.HallowedPlants, TileID.Plants); + } + else if (type == mod.TileType("AstralTallPlants")) + { + SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2); + } + else if (type == mod.TileType("AstralNormalLargePiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); + } + else if (type == mod.TileType("AstralNormalMediumPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18); + } + else if (type == mod.TileType("AstralNormalSmallPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0); + } + else if (type == mod.TileType("AstralDesertLargePiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 1566, 0); + } + else if (type == mod.TileType("AstralDesertMediumPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1476, 18); + } + else if (type == mod.TileType("AstralDesertSmallPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 972, 0); + } + else if (type == mod.TileType("AstralIceLargePiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 1404, 0); + } + else if (type == mod.TileType("AstralIceMediumPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 900, 18); + } + else if (type == mod.TileType("AstralIceSmallPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0); + } + else if (type == mod.TileType("AstralNormalStalactite")) + { + ushort originType = TileID.Stone; + int frameXAdd = 54; + switch (convert) + { + case ConvertType.Corrupt: + originType = TileID.Ebonstone; + frameXAdd = 324; + break; + case ConvertType.Crimson: + originType = TileID.Crimstone; + frameXAdd = 270; + break; + case ConvertType.Hallow: + originType = TileID.Pearlstone; + frameXAdd = 216; + break; + } + ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); + } + else if (type == mod.TileType("AstralDesertStalactite")) + { + ushort originType = TileID.Sandstone; + int frameXAdd = 378; + switch (convert) + { + case ConvertType.Corrupt: + originType = TileID.CorruptSandstone; + frameXAdd = 324; + break; + case ConvertType.Crimson: + originType = TileID.CrimsonSandstone; + frameXAdd = 270; + break; + case ConvertType.Hallow: + originType = TileID.HallowSandstone; + frameXAdd = 216; + break; + } + ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); + } + else if (type == mod.TileType("AstralIceStalactite")) + { + ReplaceAstralStalactite((ushort)type, TileID.Stalactite, TileID.IceBlock, x, y, 0, 0); + } + if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt) + { + WorldGen.SquareTileFrame(x, y); + } + } + #endregion + } + } - public static void SetTileFromConvert(int x, int y, ConvertType convert, ushort corrupt, ushort crimson, ushort hallow, ushort pure) - { - switch (convert) - { - case ConvertType.Corrupt: - if (corrupt != ushort.MaxValue) - { - Main.tile[x, y].type = corrupt; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Crimson: - if (crimson != ushort.MaxValue) - { - Main.tile[x, y].type = crimson; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Hallow: - if (hallow != ushort.MaxValue) - { - Main.tile[x, y].type = hallow; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Pure: - if (pure != ushort.MaxValue) - { - Main.tile[x, y].type = pure; - WorldGen.SquareTileFrame(x, y); - } - break; - } - } + public static void SetTileFromConvert(int x, int y, ConvertType convert, ushort corrupt, ushort crimson, ushort hallow, ushort pure) + { + switch (convert) + { + case ConvertType.Corrupt: + if (corrupt != ushort.MaxValue) + { + Main.tile[x, y].type = corrupt; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Crimson: + if (crimson != ushort.MaxValue) + { + Main.tile[x, y].type = crimson; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Hallow: + if (hallow != ushort.MaxValue) + { + Main.tile[x, y].type = hallow; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Pure: + if (pure != ushort.MaxValue) + { + Main.tile[x, y].type = pure; + WorldGen.SquareTileFrame(x, y); + } + break; + } + } - public static void RecursiveReplaceToAstral(ushort checkType, ushort replaceType, int x, int y, int replaceTextureWidth, int minFrameX = 0, int maxFrameX = int.MaxValue, int minFrameY = 0, int maxFrameY = int.MaxValue) - { - Tile tile = Main.tile[x, y]; - if (tile == null || !tile.active() || tile.type != checkType || tile.frameX < minFrameX || tile.frameX > maxFrameX || tile.frameY < minFrameY || tile.frameY > maxFrameY) - return; + public static void RecursiveReplaceToAstral(ushort checkType, ushort replaceType, int x, int y, int replaceTextureWidth, int minFrameX = 0, int maxFrameX = int.MaxValue, int minFrameY = 0, int maxFrameY = int.MaxValue) + { + Tile tile = Main.tile[x, y]; + if (tile == null || !tile.active() || tile.type != checkType || tile.frameX < minFrameX || tile.frameX > maxFrameX || tile.frameY < minFrameY || tile.frameY > maxFrameY) + return; - Main.tile[x, y].type = replaceType; - while (Main.tile[x, y].frameX >= replaceTextureWidth) - { - Main.tile[x, y].frameX -= (short)replaceTextureWidth; - } + Main.tile[x, y].type = replaceType; + while (Main.tile[x, y].frameX >= replaceTextureWidth) + { + Main.tile[x, y].frameX -= (short)replaceTextureWidth; + } - if (Main.tile[x - 1, y] != null) - RecursiveReplaceToAstral(checkType, replaceType, x - 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x + 1, y] != null) - RecursiveReplaceToAstral(checkType, replaceType, x + 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x, y - 1] != null) - RecursiveReplaceToAstral(checkType, replaceType, x, y - 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x, y + 1] != null) - RecursiveReplaceToAstral(checkType, replaceType, x, y + 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - } + if (Main.tile[x - 1, y] != null) + RecursiveReplaceToAstral(checkType, replaceType, x - 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x + 1, y] != null) + RecursiveReplaceToAstral(checkType, replaceType, x + 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x, y - 1] != null) + RecursiveReplaceToAstral(checkType, replaceType, x, y - 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x, y + 1] != null) + RecursiveReplaceToAstral(checkType, replaceType, x, y + 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + } - public static void RecursiveReplaceFromAstral(ushort checkType, ushort replaceType, int x, int y, int addFrameX, int addFrameY) - { - Tile tile = Main.tile[x, y]; - if (tile == null || !tile.active() || tile.type != checkType) - return; + public static void RecursiveReplaceFromAstral(ushort checkType, ushort replaceType, int x, int y, int addFrameX, int addFrameY) + { + Tile tile = Main.tile[x, y]; + if (tile == null || !tile.active() || tile.type != checkType) + return; - Main.tile[x, y].type = replaceType; - Main.tile[x, y].frameX += (short)addFrameX; - Main.tile[x, y].frameY += (short)addFrameY; + Main.tile[x, y].type = replaceType; + Main.tile[x, y].frameX += (short)addFrameX; + Main.tile[x, y].frameY += (short)addFrameY; - if (Main.tile[x - 1, y] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY); - if (Main.tile[x + 1, y] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x + 1, y, addFrameX, addFrameY); - if (Main.tile[x, y - 1] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x, y - 1, addFrameX, addFrameY); - if (Main.tile[x, y + 1] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x, y + 1, addFrameX, addFrameY); - } + if (Main.tile[x - 1, y] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY); + if (Main.tile[x + 1, y] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x + 1, y, addFrameX, addFrameY); + if (Main.tile[x, y - 1] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x, y - 1, addFrameX, addFrameY); + if (Main.tile[x, y + 1] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x, y + 1, addFrameX, addFrameY); + } - public static void ReplaceAstralStalactite(ushort checkType, ushort replaceType, ushort replaceOriginTile, int x, int y, int addFrameX, int addFrameY) - { - Tile tile = Main.tile[x, y]; + public static void ReplaceAstralStalactite(ushort checkType, ushort replaceType, ushort replaceOriginTile, int x, int y, int addFrameX, int addFrameY) + { + Tile tile = Main.tile[x, y]; - int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; - bool twoTall = tile.frameY <= 54; - bool hanging = tile.frameY <= 18 || tile.frameY == 72; + int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; + bool twoTall = tile.frameY <= 54; + bool hanging = tile.frameY <= 18 || tile.frameY == 72; - int yOriginTile = (hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1)); + int yOriginTile = (hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1)); - if (Main.tile[x, topMost++] != null) - Main.tile[x, topMost++].type = replaceType; - if (twoTall) - { - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].type = replaceType; - } - if (Main.tile[x, yOriginTile] != null) - Main.tile[x, yOriginTile].type = replaceOriginTile; - } + if (Main.tile[x, topMost++] != null) + Main.tile[x, topMost++].type = replaceType; + if (twoTall) + { + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].type = replaceType; + } + if (Main.tile[x, yOriginTile] != null) + Main.tile[x, yOriginTile].type = replaceOriginTile; + } - public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) - { - Vector2 point = tile.ToVector2() * 16f + new Vector2(8f); - if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. - { - float distY = center.Y - point.Y; - point.Y -= distY * 8f; - } - float distance1 = Vector2.Distance(point, focus1); - float distance2 = Vector2.Distance(point, focus2); - distance = distance1 + distance2; - return distance <= distanceConstant; - } - #endregion + public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) + { + Vector2 point = tile.ToVector2() * 16f + new Vector2(8f); + if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. + { + float distY = center.Y - point.Y; + point.Y -= distY * 8f; + } + float distance1 = Vector2.Distance(point, focus1); + float distance2 = Vector2.Distance(point, focus2); + distance = distance1 + distance2; + return distance <= distanceConstant; + } + #endregion - #region EvilIsland - public static void EvilIsland(int i, int j) - { - double num = (double)WorldGen.genRand.Next(100, 150); //100 150 - float num2 = (float)WorldGen.genRand.Next(20, 30); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = (WorldGen.crimson ? 400 : 401); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = (WorldGen.crimson ? 398 : 399); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(80, 95); - num2 = (float)WorldGen.genRand.Next(10, 15); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = num5 - 1; - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; - float num19 = vector.Y + 1f; - for (int num20 = num7; num20 < num8; num20++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num19 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num19 < vector.Y) - { - num19 = vector.Y; - } - if (num19 > vector.Y + 2f) - { - num19 = vector.Y + 2f; - } - for (int num21 = num9; num21 < num10; num21++) - { - if ((float)num21 > num19) - { - float arg_69E_0 = Math.Abs((float)num20 - vector.X); - float num22 = Math.Abs((float)num21 - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 && - Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore - WorldGen.SquareTileFrame(num20, num21, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = (WorldGen.crimson ? 400 : 401); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - int num38 = WorldGen.genRand.Next(4); - for (int num39 = 0; num39 <= num38; num39++) - { - int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5); - int num41 = num5 - WorldGen.genRand.Next(20, 40); - int num42 = WorldGen.genRand.Next(4, 8); - int num43 = (WorldGen.crimson ? 400 : 401); - if (WorldGen.genRand.Next(2) == 0) - { - num43 = (WorldGen.crimson ? 398 : 399); - } - for (int num44 = num40 - num42; num44 <= num40 + num42; num44++) - { - for (int num45 = num41 - num42; num45 <= num41 + num42; num45++) - { - float arg_C74_0 = (float)Math.Abs(num44 - num40); - float num46 = (float)(Math.Abs(num45 - num41) * 2); - if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2))) - { - Main.tile[num44, num45].active(true); - Main.tile[num44, num45].type = (ushort)num43; - WorldGen.SquareTileFrame(num44, num45, true); - } - } - } - for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++) - { - int num48 = num41 - num42; - while (!Main.tile[num47, num48].active()) - { - num48++; - } - Main.tile[num47, num48].active(false); - Main.tile[num47, num48].liquid = 255; - WorldGen.SquareTileFrame(num47, num48, true); - } - } - } - #endregion + #region EvilIsland + public static void EvilIsland(int i, int j) + { + double num = (double)WorldGen.genRand.Next(100, 150); //100 150 + float num2 = (float)WorldGen.genRand.Next(20, 30); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone + WorldGen.SquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = (WorldGen.crimson ? 400 : 401); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = (WorldGen.crimson ? 398 : 399); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + WorldGen.SquareTileFrame(n, num17, true); + } + } + } + } + } + num = (double)WorldGen.genRand.Next(80, 95); + num2 = (float)WorldGen.genRand.Next(10, 15); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = num5 - 1; + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; + float num19 = vector.Y + 1f; + for (int num20 = num7; num20 < num8; num20++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num19 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num19 < vector.Y) + { + num19 = vector.Y; + } + if (num19 > vector.Y + 2f) + { + num19 = vector.Y + 2f; + } + for (int num21 = num9; num21 < num10; num21++) + { + if ((float)num21 > num19) + { + float arg_69E_0 = Math.Abs((float)num20 - vector.X); + float num22 = Math.Abs((float)num21 - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 && + Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore + WorldGen.SquareTileFrame(num20, num21, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = (WorldGen.crimson ? 400 : 401); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + WorldGen.SquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + { + for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + { + bool flag = true; + for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + { + for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + { + if (!Main.tile[num32, num33].active()) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221); + WorldGen.SquareWallFrame(num30, num31, true); + } + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + } + int num38 = WorldGen.genRand.Next(4); + for (int num39 = 0; num39 <= num38; num39++) + { + int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5); + int num41 = num5 - WorldGen.genRand.Next(20, 40); + int num42 = WorldGen.genRand.Next(4, 8); + int num43 = (WorldGen.crimson ? 400 : 401); + if (WorldGen.genRand.Next(2) == 0) + { + num43 = (WorldGen.crimson ? 398 : 399); + } + for (int num44 = num40 - num42; num44 <= num40 + num42; num44++) + { + for (int num45 = num41 - num42; num45 <= num41 + num42; num45++) + { + float arg_C74_0 = (float)Math.Abs(num44 - num40); + float num46 = (float)(Math.Abs(num45 - num41) * 2); + if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2))) + { + Main.tile[num44, num45].active(true); + Main.tile[num44, num45].type = (ushort)num43; + WorldGen.SquareTileFrame(num44, num45, true); + } + } + } + for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++) + { + int num48 = num41 - num42; + while (!Main.tile[num47, num48].active()) + { + num48++; + } + Main.tile[num47, num48].active(false); + Main.tile[num47, num48].liquid = 255; + WorldGen.SquareTileFrame(num47, num48, true); + } + } + } + #endregion - #region EvilIslandHouse - public static void EvilIslandHouse(int i, int j) - { - ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile - byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, 10, true, false, -1, (WorldGen.crimson ? 1 : 10)); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - Main.tile[num9, num12].active(true); - Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; - Main.tile[num9, num12].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - int contain = 0; - if (WorldGen.crimson) - { - contain = 1571; //scourge - } - else - { - contain = 1569; //vampire - } - WorldGen.AddBuriedChest(i, num10 - 3, contain, false, (WorldGen.crimson ? 19 : 20)); //chest - int num14 = i - num2 / 2 + 1; - int num15 = i + num2 / 2 - 1; - int num16 = 1; - if (num2 > 10) - { - num16 = 2; - } - int num17 = (num6 + num7) / 2 - 1; - for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) - { - for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) - { - Main.tile[num18, num19].wall = 21; //glass - } - } - for (int num20 = num15 - num16; num20 <= num15 + num16; num20++) - { - for (int num21 = num17 - 1; num21 <= num17 + 1; num21++) - { - Main.tile[num20, num21].wall = 21; //glass - } - } - int num22 = i + (num2 / 2 + 1) * -num; - WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, (WorldGen.crimson ? 1 : 8)); //table - WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair - Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; - expr_510.frameX += 18; - Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; - expr_531.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair - } - #endregion + #region EvilIslandHouse + public static void EvilIslandHouse(int i, int j) + { + ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile + byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].liquid = 0; + Main.tile[l, m].type = type; + Main.tile[l, m].wall = 0; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, 10, true, false, -1, (WorldGen.crimson ? 1 : 10)); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + Main.tile[num9, num12].active(true); + Main.tile[num9, num12].liquid = 0; + Main.tile[num9, num12].type = type; + Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + int contain = 0; + if (WorldGen.crimson) + { + contain = 1571; //scourge + } + else + { + contain = 1569; //vampire + } + WorldGen.AddBuriedChest(i, num10 - 3, contain, false, (WorldGen.crimson ? 19 : 20)); //chest + int num14 = i - num2 / 2 + 1; + int num15 = i + num2 / 2 - 1; + int num16 = 1; + if (num2 > 10) + { + num16 = 2; + } + int num17 = (num6 + num7) / 2 - 1; + for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) + { + for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) + { + Main.tile[num18, num19].wall = 21; //glass + } + } + for (int num20 = num15 - num16; num20 <= num15 + num16; num20++) + { + for (int num21 = num17 - 1; num21 <= num17 + 1; num21++) + { + Main.tile[num20, num21].wall = 21; //glass + } + } + int num22 = i + (num2 / 2 + 1) * -num; + WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, (WorldGen.crimson ? 1 : 8)); //table + WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair + Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; + expr_510.frameX += 18; + Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; + expr_531.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair + } + #endregion - #region UnderworldIsland - public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)mod.TileType("BrimstoneSlag"); - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = mod.TileType("BrimstoneSlag"); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = mod.TileType("CharredOre"); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = mod.TileType("BrimstoneSlag"); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - } - #endregion + #region UnderworldIsland + public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)mod.TileType("BrimstoneSlag"); + WorldGen.SquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = mod.TileType("BrimstoneSlag"); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = mod.TileType("CharredOre"); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + WorldGen.SquareTileFrame(n, num17, true); + } + } + } + } + } + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = mod.TileType("BrimstoneSlag"); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + WorldGen.SquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + } + } + #endregion - #region UnderworldIslandHouse - public static void UnderworldIslandHouse(int i, int j, int item) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - ushort type = (ushort)mod.TileType("BrimstoneSlag"); //tile - byte wall = (byte)14; //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, 10, true, false, -1, 19); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - Main.tile[num9, num12].active(true); - Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; - Main.tile[num9, num12].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest - int num22 = i + (num2 / 2 + 1) * -num; - WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, 13); //table - WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, 16); //chair - Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; - expr_510.frameX += 18; - Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; - expr_531.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, 16); //chair - } - #endregion + #region UnderworldIslandHouse + public static void UnderworldIslandHouse(int i, int j, int item) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + ushort type = (ushort)mod.TileType("BrimstoneSlag"); //tile + byte wall = (byte)14; //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].liquid = 0; + Main.tile[l, m].type = type; + Main.tile[l, m].wall = 0; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, 10, true, false, -1, 19); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + Main.tile[num9, num12].active(true); + Main.tile[num9, num12].liquid = 0; + Main.tile[num9, num12].type = type; + Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest + int num22 = i + (num2 / 2 + 1) * -num; + WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, 13); //table + WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, 16); //chair + Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; + expr_510.frameX += 18; + Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; + expr_531.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, 16); //chair + } + #endregion - #region AbyssIsland - public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int sizeMinSmall = sizeMin / 5; - int sizeMaxSmall = sizeMax / 5; - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - SafeSquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = (hasChest ? mod.TileType("ChaoticOre") : mod.TileType("PlantyMush")); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - if (hasTenebris) - { - int p = num3; - int num150; - for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) - { - int num14 = num6; - while (!Main.tile[p, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); //-3 4 - num150 = 1; //4 8 - int num16 = mod.TileType("Tenebris"); - for (int n = p - num150; n <= p + num150; n++) - { - for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - p); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - } - int sizeMinSmall2 = sizeMin2 / 8; - int sizeMaxSmall2 = sizeMax2 / 8; - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - SafeSquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - SafeSquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - SafeSquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - SafeSquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - SafeSquareTileFrame(num34, num35, true); - } - } - } - #endregion + #region AbyssIsland + public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int sizeMinSmall = sizeMin / 5; + int sizeMaxSmall = sizeMax / 5; + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + SafeSquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = (hasChest ? mod.TileType("ChaoticOre") : mod.TileType("PlantyMush")); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + if (hasTenebris) + { + int p = num3; + int num150; + for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) + { + int num14 = num6; + while (!Main.tile[p, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); //-3 4 + num150 = 1; //4 8 + int num16 = mod.TileType("Tenebris"); + for (int n = p - num150; n <= p + num150; n++) + { + for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - p); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + } + int sizeMinSmall2 = sizeMin2 / 8; + int sizeMaxSmall2 = sizeMax2 / 8; + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + SafeSquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + { + for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + { + bool flag = true; + for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + { + for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + { + if (!Main.tile[num32, num33].active()) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[num30, num31].wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); + WorldGen.SquareWallFrame(num30, num31, true); + } + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + SafeSquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + SafeSquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + SafeSquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + SafeSquareTileFrame(num34, num35, true); + } + } + } + #endregion - #region AbyssIslandHouse - public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - ushort type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); //tile - ushort wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(5, 9); - int num3 = 3; - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].type = type; - Main.tile[l, m].wall = wall; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) - { - Main.tile[n, num8].active(false); - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - switch (itemChoice) - { - case 0: itemChoice = mod.ItemType("TorrentialTear"); break; //rain item - case 1: itemChoice = mod.ItemType("IronBoots"); break; //movement acc - case 2: itemChoice = mod.ItemType("DepthCharm"); break; //regen acc - case 3: itemChoice = mod.ItemType("Archerfish"); break; //ranged - case 4: itemChoice = mod.ItemType("AnechoicPlating"); break; //defense acc - case 5: itemChoice = mod.ItemType("BallOFugu"); break; //melee - case 6: itemChoice = mod.ItemType("StrangeOrb"); break; //light pet - case 7: itemChoice = mod.ItemType("HerringStaff"); break; //summon - case 8: itemChoice = mod.ItemType("BlackAnurian"); break; //magic - case 9: itemChoice = mod.ItemType("Lionfish"); break; //throwing - default: itemChoice = 497; break; - } - WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest - } - #endregion + #region AbyssIslandHouse + public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + ushort type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); //tile + ushort wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(5, 9); + int num3 = 3; + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].type = type; + Main.tile[l, m].wall = wall; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) + { + Main.tile[n, num8].active(false); + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + switch (itemChoice) + { + case 0: + itemChoice = mod.ItemType("TorrentialTear"); + break; //rain item + case 1: + itemChoice = mod.ItemType("IronBoots"); + break; //movement acc + case 2: + itemChoice = mod.ItemType("DepthCharm"); + break; //regen acc + case 3: + itemChoice = mod.ItemType("Archerfish"); + break; //ranged + case 4: + itemChoice = mod.ItemType("AnechoicPlating"); + break; //defense acc + case 5: + itemChoice = mod.ItemType("BallOFugu"); + break; //melee + case 6: + itemChoice = mod.ItemType("StrangeOrb"); + break; //light pet + case 7: + itemChoice = mod.ItemType("HerringStaff"); + break; //summon + case 8: + itemChoice = mod.ItemType("BlackAnurian"); + break; //magic + case 9: + itemChoice = mod.ItemType("Lionfish"); + break; //throwing + default: + itemChoice = 497; + break; + } + WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest + } + #endregion - #region IceTomb - public static bool IceTomb(int i, int j) - { - ushort num = 161; - int arg_36_0 = j - WorldGen.genRand.Next(0, 7); - int num2 = WorldGen.genRand.Next(9, 13); - int num3 = 1; - int num4 = j + WorldGen.genRand.Next(75, 125); //75 125 - for (int k = arg_36_0; k < num4; k++) - { - for (int l = i - num3; l < i + num3 - 1; l++) - { - Main.tile[l, k].type = num; - Main.tile[l, k].active(true); - Main.tile[l, k].halfBrick(false); - Main.tile[l, k].slope(0); - } - num3++; - } - for (int m = i - num3 - 5; m <= i + num3 + 5; m++) - { - for (int n = j - 1; n <= num4 + 1; n++) - { - bool flag = true; - for (int num5 = m - 1; num5 <= m + 1; num5++) - { - for (int num6 = n - 1; num6 <= n + 1; num6++) - { - if (Main.tile[num5, num6].type != num) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[m, n].wall = 71; - WorldGen.SquareWallFrame(m, n, true); - } - } - } - int num7 = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num7 = -1; - } - int num8 = i - num2 * num7; - int num9 = j + num2; - int num10 = WorldGen.genRand.Next(5, 8); - bool flag2 = true; - int num11 = WorldGen.genRand.Next(20, 30); - while (flag2) - { - flag2 = false; - bool flag3 = false; - for (int num12 = num9; num12 <= num9 + num10; num12++) - { - int num13 = num8; - if (Main.tile[num13, num12 - 1].type == 161) - { - flag3 = true; - } - if (Main.tile[num13, num12].type == num) - { - Main.tile[num13, num12 + 1].wall = 71; - Main.tile[num13 + num7, num12].wall = 71; - Main.tile[num13, num12].active(false); - flag2 = true; - } - if (flag3) - { - Main.tile[num13, num12].type = 161; - Main.tile[num13, num12].active(true); - Main.tile[num13, num12].halfBrick(false); - Main.tile[num13, num12].slope(0); - } - } - num8 -= num7; - } - num8 = i - num2 * num7; - bool flag4 = true; - bool flag5 = false; - flag2 = true; - while (flag2) - { - for (int num14 = num9; num14 <= num9 + num10; num14++) - { - int num15 = num8; - Main.tile[num15, num14].active(false); - } - num8 += num7; - num9++; - num11--; - if (num9 >= num4 - num10 * 2) - { - num11 = 10; - } - if (num11 <= 0) - { - bool flag6 = false; - if (!flag4 && !flag5) - { - flag5 = true; - flag6 = true; - int num16 = WorldGen.genRand.Next(7, 13); - int num17 = WorldGen.genRand.Next(23, 28); - int num18 = num17; - int num19 = num8; - while (num17 > 0) - { - for (int num20 = num9 - num16 + num10; num20 <= num9 + num10; num20++) - { - if (num17 == num18 || num17 == 1) - { - if (num20 >= num9 - num16 + num10 + 2) - { - Main.tile[num8, num20].active(false); - } - } - else if (num17 == num18 - 1 || num17 == 2 || num17 == num18 - 2 || num17 == 3) - { - if (num20 >= num9 - num16 + num10 + 1) - { - Main.tile[num8, num20].active(false); - } - } - else - { - Main.tile[num8, num20].active(false); - } - } - num17--; - num8 += num7; - } - int num21 = num8 - num7; - int num22 = num21; - int num23 = num19; - if (num21 > num19) - { - num22 = num19; - num23 = num21; - } - int num24 = WorldGen.genRand.Next(3); - if (num24 == 0) - { - num24 = 1861; //diving gear - } - else if (num24 == 1) - { - num24 = 1163; //balloon - } - else if (num24 == 2) - { - num24 = 1253; //shell - } - WorldGen.AddBuriedChest((num22 + num23) / 2, num9, num24, false, 22); - int num25 = WorldGen.genRand.Next(1, 10); - for (int num26 = 0; num26 < num25; num26++) - { - int arg_49B_0 = WorldGen.genRand.Next(num22, num23); - int j2 = num9 + num10; - WorldGen.PlaceSmallPile(arg_49B_0, j2, WorldGen.genRand.Next(16, 19), 1, 185); - } - for (int num27 = num22; num27 <= num23; num27++) - { - WorldGen.PlacePot(num27, num9 + num10, 28, WorldGen.genRand.Next(4, 7)); - } - } - if (flag4) - { - flag4 = false; - num7 *= -1; - num11 = WorldGen.genRand.Next(15, 20); - } - else if (flag6) - { - num11 = WorldGen.genRand.Next(10, 15); - } - else - { - num7 *= -1; - num11 = WorldGen.genRand.Next(20, 40); - } - } - if (num9 >= num4 - num10) - { - flag2 = false; - } - } - int num28 = WorldGen.genRand.Next(20, 40); //100 200 - int num29 = WorldGen.genRand.Next(100, 160); //500 800 - flag2 = true; - int num30 = num10; - num11 = WorldGen.genRand.Next(10, 50); - if (num7 == 1) - { - num8 -= num30; - } - int num31 = WorldGen.genRand.Next(5, 10); - while (flag2) - { - num28--; - num29--; - num11--; - for (int num32 = num8 - num31 - WorldGen.genRand.Next(0, 2); num32 <= num8 + num30 + num31 + WorldGen.genRand.Next(0, 2); num32++) - { - int num33 = num9; - if (num32 >= num8 && num32 <= num8 + num30) - { - Main.tile[num32, num33].active(false); - } - else - { - Main.tile[num32, num33].type = num; - Main.tile[num32, num33].active(true); - Main.tile[num32, num33].halfBrick(false); - Main.tile[num32, num33].slope(0); - } - if (num32 >= num8 - 1 && num32 <= num8 + 1 + num30) - { - Main.tile[num32, num33].wall = 71; - } - } - num9++; - num8 += num7; - if (num28 <= 0) - { - flag2 = false; - for (int num34 = num8 + 1; num34 <= num8 + num30 - 1; num34++) - { - if (Main.tile[num34, num9].active()) - { - flag2 = true; - } - } - } - if (num11 < 0) - { - num11 = WorldGen.genRand.Next(10, 50); - num7 *= -1; - } - if (num29 <= 0) - { - flag2 = false; - } - } - return true; - } - #endregion + #region IceTomb + public static bool IceTomb(int i, int j) + { + ushort num = 161; + int arg_36_0 = j - WorldGen.genRand.Next(0, 7); + int num2 = WorldGen.genRand.Next(9, 13); + int num3 = 1; + int num4 = j + WorldGen.genRand.Next(75, 125); //75 125 + for (int k = arg_36_0; k < num4; k++) + { + for (int l = i - num3; l < i + num3 - 1; l++) + { + Main.tile[l, k].type = num; + Main.tile[l, k].active(true); + Main.tile[l, k].halfBrick(false); + Main.tile[l, k].slope(0); + } + num3++; + } + for (int m = i - num3 - 5; m <= i + num3 + 5; m++) + { + for (int n = j - 1; n <= num4 + 1; n++) + { + bool flag = true; + for (int num5 = m - 1; num5 <= m + 1; num5++) + { + for (int num6 = n - 1; num6 <= n + 1; num6++) + { + if (Main.tile[num5, num6].type != num) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[m, n].wall = 71; + WorldGen.SquareWallFrame(m, n, true); + } + } + } + int num7 = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num7 = -1; + } + int num8 = i - num2 * num7; + int num9 = j + num2; + int num10 = WorldGen.genRand.Next(5, 8); + bool flag2 = true; + int num11 = WorldGen.genRand.Next(20, 30); + while (flag2) + { + flag2 = false; + bool flag3 = false; + for (int num12 = num9; num12 <= num9 + num10; num12++) + { + int num13 = num8; + if (Main.tile[num13, num12 - 1].type == 161) + { + flag3 = true; + } + if (Main.tile[num13, num12].type == num) + { + Main.tile[num13, num12 + 1].wall = 71; + Main.tile[num13 + num7, num12].wall = 71; + Main.tile[num13, num12].active(false); + flag2 = true; + } + if (flag3) + { + Main.tile[num13, num12].type = 161; + Main.tile[num13, num12].active(true); + Main.tile[num13, num12].halfBrick(false); + Main.tile[num13, num12].slope(0); + } + } + num8 -= num7; + } + num8 = i - num2 * num7; + bool flag4 = true; + bool flag5 = false; + flag2 = true; + while (flag2) + { + for (int num14 = num9; num14 <= num9 + num10; num14++) + { + int num15 = num8; + Main.tile[num15, num14].active(false); + } + num8 += num7; + num9++; + num11--; + if (num9 >= num4 - num10 * 2) + { + num11 = 10; + } + if (num11 <= 0) + { + bool flag6 = false; + if (!flag4 && !flag5) + { + flag5 = true; + flag6 = true; + int num16 = WorldGen.genRand.Next(7, 13); + int num17 = WorldGen.genRand.Next(23, 28); + int num18 = num17; + int num19 = num8; + while (num17 > 0) + { + for (int num20 = num9 - num16 + num10; num20 <= num9 + num10; num20++) + { + if (num17 == num18 || num17 == 1) + { + if (num20 >= num9 - num16 + num10 + 2) + { + Main.tile[num8, num20].active(false); + } + } + else if (num17 == num18 - 1 || num17 == 2 || num17 == num18 - 2 || num17 == 3) + { + if (num20 >= num9 - num16 + num10 + 1) + { + Main.tile[num8, num20].active(false); + } + } + else + { + Main.tile[num8, num20].active(false); + } + } + num17--; + num8 += num7; + } + int num21 = num8 - num7; + int num22 = num21; + int num23 = num19; + if (num21 > num19) + { + num22 = num19; + num23 = num21; + } + int num24 = WorldGen.genRand.Next(3); + if (num24 == 0) + { + num24 = 1861; //diving gear + } + else if (num24 == 1) + { + num24 = 1163; //balloon + } + else if (num24 == 2) + { + num24 = 1253; //shell + } + WorldGen.AddBuriedChest((num22 + num23) / 2, num9, num24, false, 22); + int num25 = WorldGen.genRand.Next(1, 10); + for (int num26 = 0; num26 < num25; num26++) + { + int arg_49B_0 = WorldGen.genRand.Next(num22, num23); + int j2 = num9 + num10; + WorldGen.PlaceSmallPile(arg_49B_0, j2, WorldGen.genRand.Next(16, 19), 1, 185); + } + for (int num27 = num22; num27 <= num23; num27++) + { + WorldGen.PlacePot(num27, num9 + num10, 28, WorldGen.genRand.Next(4, 7)); + } + } + if (flag4) + { + flag4 = false; + num7 *= -1; + num11 = WorldGen.genRand.Next(15, 20); + } + else if (flag6) + { + num11 = WorldGen.genRand.Next(10, 15); + } + else + { + num7 *= -1; + num11 = WorldGen.genRand.Next(20, 40); + } + } + if (num9 >= num4 - num10) + { + flag2 = false; + } + } + int num28 = WorldGen.genRand.Next(20, 40); //100 200 + int num29 = WorldGen.genRand.Next(100, 160); //500 800 + flag2 = true; + int num30 = num10; + num11 = WorldGen.genRand.Next(10, 50); + if (num7 == 1) + { + num8 -= num30; + } + int num31 = WorldGen.genRand.Next(5, 10); + while (flag2) + { + num28--; + num29--; + num11--; + for (int num32 = num8 - num31 - WorldGen.genRand.Next(0, 2); num32 <= num8 + num30 + num31 + WorldGen.genRand.Next(0, 2); num32++) + { + int num33 = num9; + if (num32 >= num8 && num32 <= num8 + num30) + { + Main.tile[num32, num33].active(false); + } + else + { + Main.tile[num32, num33].type = num; + Main.tile[num32, num33].active(true); + Main.tile[num32, num33].halfBrick(false); + Main.tile[num32, num33].slope(0); + } + if (num32 >= num8 - 1 && num32 <= num8 + 1 + num30) + { + Main.tile[num32, num33].wall = 71; + } + } + num9++; + num8 += num7; + if (num28 <= 0) + { + flag2 = false; + for (int num34 = num8 + 1; num34 <= num8 + num30 - 1; num34++) + { + if (Main.tile[num34, num9].active()) + { + flag2 = true; + } + } + } + if (num11 < 0) + { + num11 = WorldGen.genRand.Next(10, 50); + num7 *= -1; + } + if (num29 <= 0) + { + flag2 = false; + } + } + return true; + } + #endregion - #region SpecialHut - // Special Hut: Takes arguments of tile type 1, tile type 2, wall type, hut type (useful if you use this method to generate different huts), and location of the shrine (x and y) - public static void SpecialHut(ushort tile, ushort tile2, ushort wall, int hutType, int shrineLocationX, int shrineLocationY) - { - // Random variables for shrine size - int randomX = WorldGen.genRand.Next(2, 4); - int randomY = WorldGen.genRand.Next(2, 4); + #region SpecialHut + // Special Hut: Takes arguments of tile type 1, tile type 2, wall type, hut type (useful if you use this method to generate different huts), and location of the shrine (x and y) + public static void SpecialHut(ushort tile, ushort tile2, ushort wall, int hutType, int shrineLocationX, int shrineLocationY) + { + // Random variables for shrine size + int randomX = WorldGen.genRand.Next(2, 4); + int randomY = WorldGen.genRand.Next(2, 4); - // Replace tiles in shrine area with shrine tile type 1 - for (int n = shrineLocationX - randomX - 1; n <= shrineLocationX + randomX + 1; n++) - { - for (int num8 = shrineLocationY - randomY - 1; num8 <= shrineLocationY + randomY + 1; num8++) - { - Main.tile[n, num8].active(true); - Main.tile[n, num8].type = tile; - Main.tile[n, num8].slope(0); - Main.tile[n, num8].liquid = 0; - Main.tile[n, num8].lava(false); - } - } + // Replace tiles in shrine area with shrine tile type 1 + for (int n = shrineLocationX - randomX - 1; n <= shrineLocationX + randomX + 1; n++) + { + for (int num8 = shrineLocationY - randomY - 1; num8 <= shrineLocationY + randomY + 1; num8++) + { + Main.tile[n, num8].active(true); + Main.tile[n, num8].type = tile; + Main.tile[n, num8].slope(0); + Main.tile[n, num8].liquid = 0; + Main.tile[n, num8].lava(false); + } + } - // Replace walls in shrine area with shrine wall type - for (int num9 = shrineLocationX - randomX; num9 <= shrineLocationX + randomX; num9++) - { - for (int num10 = shrineLocationY - randomY; num10 <= shrineLocationY + randomY; num10++) - { - Main.tile[num9, num10].active(false); - Main.tile[num9, num10].wall = wall; - } - } + // Replace walls in shrine area with shrine wall type + for (int num9 = shrineLocationX - randomX; num9 <= shrineLocationX + randomX; num9++) + { + for (int num10 = shrineLocationY - randomY; num10 <= shrineLocationY + randomY; num10++) + { + Main.tile[num9, num10].active(false); + Main.tile[num9, num10].wall = wall; + } + } - // Remove tiles from the inner part of the shrine area - for (int num14 = shrineLocationX - randomX - 1; num14 <= shrineLocationX + randomX + 1; num14++) - { - for (int num15 = shrineLocationY + randomY - 2; num15 <= shrineLocationY + randomY; num15++) - Main.tile[num14, num15].active(false); - } - for (int num16 = shrineLocationX - randomX - 1; num16 <= shrineLocationX + randomX + 1; num16++) - { - for (int num17 = shrineLocationY + randomY - 2; num17 <= shrineLocationY + randomY - 1; num17++) - Main.tile[num16, num17].active(false); - } + // Remove tiles from the inner part of the shrine area + for (int num14 = shrineLocationX - randomX - 1; num14 <= shrineLocationX + randomX + 1; num14++) + { + for (int num15 = shrineLocationY + randomY - 2; num15 <= shrineLocationY + randomY; num15++) + Main.tile[num14, num15].active(false); + } + for (int num16 = shrineLocationX - randomX - 1; num16 <= shrineLocationX + randomX + 1; num16++) + { + for (int num17 = shrineLocationY + randomY - 2; num17 <= shrineLocationY + randomY - 1; num17++) + Main.tile[num16, num17].active(false); + } - // Replace tiles from bottom of shrine area with shrine tile type 2 - for (int num18 = shrineLocationX - randomX - 1; num18 <= shrineLocationX + randomX + 1; num18++) - { - int num19 = 4; - int num20 = shrineLocationY + randomY + 2; - while (!Main.tile[num18, num20].active() && num20 < Main.maxTilesY && num19 > 0) - { - Main.tile[num18, num20].active(true); - Main.tile[num18, num20].type = tile2; - Main.tile[num18, num20].slope(0); - num20++; - num19--; - } - } + // Replace tiles from bottom of shrine area with shrine tile type 2 + for (int num18 = shrineLocationX - randomX - 1; num18 <= shrineLocationX + randomX + 1; num18++) + { + int num19 = 4; + int num20 = shrineLocationY + randomY + 2; + while (!Main.tile[num18, num20].active() && num20 < Main.maxTilesY && num19 > 0) + { + Main.tile[num18, num20].active(true); + Main.tile[num18, num20].type = tile2; + Main.tile[num18, num20].slope(0); + num20++; + num19--; + } + } - // Replace tiles from top of shrine with shrine tile type 1 - randomX -= WorldGen.genRand.Next(1, 3); - int num21 = shrineLocationY - randomY - 2; - while (randomX > -1) - { - for (int num22 = shrineLocationX - randomX - 1; num22 <= shrineLocationX + randomX + 1; num22++) - { - Main.tile[num22, num21].active(true); - Main.tile[num22, num21].type = tile; - } - randomX -= WorldGen.genRand.Next(1, 3); - num21--; - } + // Replace tiles from top of shrine with shrine tile type 1 + randomX -= WorldGen.genRand.Next(1, 3); + int num21 = shrineLocationY - randomY - 2; + while (randomX > -1) + { + for (int num22 = shrineLocationX - randomX - 1; num22 <= shrineLocationX + randomX + 1; num22++) + { + Main.tile[num22, num21].active(true); + Main.tile[num22, num21].type = tile; + } + randomX -= WorldGen.genRand.Next(1, 3); + num21--; + } - // Place shrine chest - CalamityWorld.SChestX[hutType] = shrineLocationX; - CalamityWorld.SChestY[hutType] = shrineLocationY; - SpecialChest(hutType); - } - #endregion + // Place shrine chest + CalamityWorld.SChestX[hutType] = shrineLocationX; + CalamityWorld.SChestY[hutType] = shrineLocationY; + SpecialChest(hutType); + } + #endregion - #region SpecialChest - // Special Chest: Used for placing shrine chests, takes argument of item choice which dictates what item will spawn in the first slot of this chest - public static void SpecialChest(int itemChoice) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int item = 0; - int chestType = 0; + #region SpecialChest + // Special Chest: Used for placing shrine chests, takes argument of item choice which dictates what item will spawn in the first slot of this chest + public static void SpecialChest(int itemChoice) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int item = 0; + int chestType = 0; - switch (itemChoice) //0 to 9 - { - case 0: item = mod.ItemType("TrinketofChi"); break; - case 1: item = (WorldGen.crimson ? mod.ItemType("CrimsonEffigy") : mod.ItemType("CorruptionEffigy")); chestType = (WorldGen.crimson ? 43 : 3); break; - case 2: item = mod.ItemType("OnyxExcavatorKey"); chestType = 44; break; - case 3: item = mod.ItemType("TundraLeash"); chestType = 47; break; - case 4: item = mod.ItemType("LuxorsGift"); chestType = 30; break; - case 5: item = mod.ItemType("FungalSymbiote"); chestType = 32; break; - case 6: item = mod.ItemType("UnstablePrism"); chestType = 50; break; - case 7: item = mod.ItemType("GladiatorsLocket"); chestType = 51; break; - case 8: item = mod.ItemType("Murasama"); chestType = 44; break; - case 9: item = mod.ItemType("BossRush"); chestType = 4; break; - } + switch (itemChoice) //0 to 9 + { + case 0: + item = mod.ItemType("TrinketofChi"); + break; + case 1: + item = (WorldGen.crimson ? mod.ItemType("CrimsonEffigy") : mod.ItemType("CorruptionEffigy")); + chestType = (WorldGen.crimson ? 43 : 3); + break; + case 2: + item = mod.ItemType("OnyxExcavatorKey"); + chestType = 44; + break; + case 3: + item = mod.ItemType("TundraLeash"); + chestType = 47; + break; + case 4: + item = mod.ItemType("LuxorsGift"); + chestType = 30; + break; + case 5: + item = mod.ItemType("FungalSymbiote"); + chestType = 32; + break; + case 6: + item = mod.ItemType("UnstablePrism"); + chestType = 50; + break; + case 7: + item = mod.ItemType("GladiatorsLocket"); + chestType = 51; + break; + case 8: + item = mod.ItemType("Murasama"); + chestType = 44; + break; + case 9: + item = mod.ItemType("BossRush"); + chestType = 4; + break; + } - // Destroy tiles in chest spawn location - for (int j = CalamityWorld.SChestX[itemChoice] - 1; j <= CalamityWorld.SChestX[itemChoice] + 1; j++) - { - for (int k = CalamityWorld.SChestY[itemChoice]; k <= CalamityWorld.SChestY[itemChoice] + 2; k++) - WorldGen.KillTile(j, k, false, false, false); - } + // Destroy tiles in chest spawn location + for (int j = CalamityWorld.SChestX[itemChoice] - 1; j <= CalamityWorld.SChestX[itemChoice] + 1; j++) + { + for (int k = CalamityWorld.SChestY[itemChoice]; k <= CalamityWorld.SChestY[itemChoice] + 2; k++) + WorldGen.KillTile(j, k, false, false, false); + } - // Attempt to fix sloped tiles under the chest to prevent the chest from killing itself (literally) - for (int l = CalamityWorld.SChestX[itemChoice] - 1; l <= CalamityWorld.SChestX[itemChoice] + 1; l++) - { - for (int m = CalamityWorld.SChestY[itemChoice]; m <= CalamityWorld.SChestY[itemChoice] + 3; m++) - { - if (m < Main.maxTilesY) - { - Main.tile[l, m].slope(0); - Main.tile[l, m].halfBrick(false); - } - } - } + // Attempt to fix sloped tiles under the chest to prevent the chest from killing itself (literally) + for (int l = CalamityWorld.SChestX[itemChoice] - 1; l <= CalamityWorld.SChestX[itemChoice] + 1; l++) + { + for (int m = CalamityWorld.SChestY[itemChoice]; m <= CalamityWorld.SChestY[itemChoice] + 3; m++) + { + if (m < Main.maxTilesY) + { + Main.tile[l, m].slope(0); + Main.tile[l, m].halfBrick(false); + } + } + } - // Place the chest, finally - WorldGen.AddBuriedChest(CalamityWorld.SChestX[itemChoice], CalamityWorld.SChestY[itemChoice], item, false, chestType); - } - #endregion + // Place the chest, finally + WorldGen.AddBuriedChest(CalamityWorld.SChestX[itemChoice], CalamityWorld.SChestY[itemChoice], item, false, chestType); + } + #endregion - #region ChasmGenerator - public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - float num = (float)steps; //850 small 1450 medium 2050 large - if (ocean) - { - int tileYLookup = j; - if (CalamityWorld.abyssSide) - { - while (!Main.tile[i + 125, tileYLookup].active()) - { - tileYLookup++; - } - } - else - { - while (!Main.tile[i - 125, tileYLookup].active()) - { - tileYLookup++; - } - } - j = tileYLookup; - } - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-1, 2) * 0.1f; - vector2.Y = (float)WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; - int num2 = 5; - double num3 = (double)(WorldGen.genRand.Next(5, 7) + 40); //start width - while (num3 > 0.0) - { - if (num > 0f) - { - num3 += (double)WorldGen.genRand.Next(2); - num3 -= (double)WorldGen.genRand.Next(2); - float smallHoleLimit = 790f; //small - if (Main.maxTilesY > 1500) { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } - if (ocean && num > smallHoleLimit) - { - if (num3 < 4.0) //min width - { - num3 = 4.0; //min width - } - if (num3 > 6.0) //max width - { - num3 = 6.0; //max width - } - } - else //dig large hole - { - if (num3 < (ocean ? 42.0 : 14.0)) //min width - { - num3 = (ocean ? 42.0 : 14.0); //min width - } - if (num3 > (ocean ? 60.0 : 40.0)) //max width - { - num3 = (ocean ? 60.0 : 40.0); //max width - } - if (num == 1f && num3 < (ocean ? 50.0 : 20.0)) - { - num3 = (ocean ? 50.0 : 20.0); - } - } - } - else - { - if ((double)vector.Y > CalamityWorld.abyssChasmBottom) - { - num3 -= (double)(WorldGen.genRand.Next(5) + 8); - } - } - if (Main.maxTilesY > 2100) - { - if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - else if (Main.maxTilesY > 1500) - { - if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - else - { - if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - num -= 1f; - int num4; - int num5; - int num6; - int num7; - if (num > (float)num2) - { - num4 = (int)((double)vector.X - num3 * 0.5); - num5 = (int)((double)vector.X + num3 * 0.5); - num6 = (int)((double)vector.Y - num3 * 0.5); - num7 = (int)((double)vector.Y + num3 * 0.5); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int k = num4; k < num5; k++) - { - for (int l = num6; l < num7; l++) - { - if ((double)(Math.Abs((float)k - vector.X) + Math.Abs((float)l - vector.Y)) < num3 * 0.5 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(false); - } - else - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(true); - } - } - } - } - } - if (num <= 2f && (double)vector.Y < (Main.rockLayer + (double)Main.maxTilesY * 0.3)) - { - num = 2f; - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-1, 2) * 0.01f; - if ((double)vector2.X > 0.02) - { - vector2.X = 0.02f; - } - if ((double)vector2.X < -0.02) - { - vector2.X = -0.02f; - } - num4 = (int)((double)vector.X - num3 * 1.1); - num5 = (int)((double)vector.X + num3 * 1.1); - num6 = (int)((double)vector.Y - num3 * 1.1); - num7 = (int)((double)vector.Y + num3 * 1.1); - if (num4 < 1) - { - num4 = 1; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int m = num4; m < num5; m++) - { - for (int n = num6; n < num7; n++) - { - if ((double)(Math.Abs((float)m - vector.X) + Math.Abs((float)n - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (n > j + WorldGen.genRand.Next(7, 16)) - { - Main.tile[m, n].active(false); - } - if (steps <= num2) - { - Main.tile[m, n].active(false); - } - if (ocean) - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(false); - } - else - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(true); - } - } - } - } - for (int num11 = num4; num11 < num5; num11++) - { - for (int num12 = num6; num12 < num7; num12++) - { - if ((double)(Math.Abs((float)num11 - vector.X) + Math.Abs((float)num12 - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(false); - } - else - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(true); - } - if (steps <= num2) - { - Main.tile[num11, num12].active(false); - } - } - } - } - } - } - #endregion + #region ChasmGenerator + public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + float num = (float)steps; //850 small 1450 medium 2050 large + if (ocean) + { + int tileYLookup = j; + if (CalamityWorld.abyssSide) + { + while (!Main.tile[i + 125, tileYLookup].active()) + { + tileYLookup++; + } + } + else + { + while (!Main.tile[i - 125, tileYLookup].active()) + { + tileYLookup++; + } + } + j = tileYLookup; + } + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-1, 2) * 0.1f; + vector2.Y = (float)WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; + int num2 = 5; + double num3 = (double)(WorldGen.genRand.Next(5, 7) + 40); //start width + while (num3 > 0.0) + { + if (num > 0f) + { + num3 += (double)WorldGen.genRand.Next(2); + num3 -= (double)WorldGen.genRand.Next(2); + float smallHoleLimit = 790f; //small + if (Main.maxTilesY > 1500) + { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } + if (ocean && num > smallHoleLimit) + { + if (num3 < 4.0) //min width + { + num3 = 4.0; //min width + } + if (num3 > 6.0) //max width + { + num3 = 6.0; //max width + } + } + else //dig large hole + { + if (num3 < (ocean ? 42.0 : 14.0)) //min width + { + num3 = (ocean ? 42.0 : 14.0); //min width + } + if (num3 > (ocean ? 60.0 : 40.0)) //max width + { + num3 = (ocean ? 60.0 : 40.0); //max width + } + if (num == 1f && num3 < (ocean ? 50.0 : 20.0)) + { + num3 = (ocean ? 50.0 : 20.0); + } + } + } + else + { + if ((double)vector.Y > CalamityWorld.abyssChasmBottom) + { + num3 -= (double)(WorldGen.genRand.Next(5) + 8); + } + } + if (Main.maxTilesY > 2100) + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else if (Main.maxTilesY > 1500) + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + num -= 1f; + int num4; + int num5; + int num6; + int num7; + if (num > (float)num2) + { + num4 = (int)((double)vector.X - num3 * 0.5); + num5 = (int)((double)vector.X + num3 * 0.5); + num6 = (int)((double)vector.Y - num3 * 0.5); + num7 = (int)((double)vector.Y + num3 * 0.5); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int k = num4; k < num5; k++) + { + for (int l = num6; l < num7; l++) + { + if ((double)(Math.Abs((float)k - vector.X) + Math.Abs((float)l - vector.Y)) < num3 * 0.5 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(false); + } + else + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(true); + } + } + } + } + } + if (num <= 2f && (double)vector.Y < (Main.rockLayer + (double)Main.maxTilesY * 0.3)) + { + num = 2f; + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-1, 2) * 0.01f; + if ((double)vector2.X > 0.02) + { + vector2.X = 0.02f; + } + if ((double)vector2.X < -0.02) + { + vector2.X = -0.02f; + } + num4 = (int)((double)vector.X - num3 * 1.1); + num5 = (int)((double)vector.X + num3 * 1.1); + num6 = (int)((double)vector.Y - num3 * 1.1); + num7 = (int)((double)vector.Y + num3 * 1.1); + if (num4 < 1) + { + num4 = 1; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int m = num4; m < num5; m++) + { + for (int n = num6; n < num7; n++) + { + if ((double)(Math.Abs((float)m - vector.X) + Math.Abs((float)n - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (n > j + WorldGen.genRand.Next(7, 16)) + { + Main.tile[m, n].active(false); + } + if (steps <= num2) + { + Main.tile[m, n].active(false); + } + if (ocean) + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(false); + } + else + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(true); + } + } + } + } + for (int num11 = num4; num11 < num5; num11++) + { + for (int num12 = num6; num12 < num7; num12++) + { + if ((double)(Math.Abs((float)num11 - vector.X) + Math.Abs((float)num12 - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(false); + } + else + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(true); + } + if (steps <= num2) + { + Main.tile[num11, num12].active(false); + } + } + } + } + } + } + #endregion - #region PlaceTits - public static void PlaceTit(int x, int y, ushort type = 165) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (Main.tile[x, y - 1] == null) - { - Main.tile[x, y - 1] = new Tile(); - } - if (Main.tile[x, y] == null) - { - Main.tile[x, y] = new Tile(); - } - if (Main.tile[x, y + 1] == null) - { - Main.tile[x, y + 1] = new Tile(); - } - if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].active() && !Main.tile[x, y + 1].active()) - { - if (Main.tile[x, y - 1].type == (ushort)mod.TileType("Navystone")) - { - if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].active()) - { - int num2 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num2; - Main.tile[x, y].frameY = 72; - } - else - { - int num3 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num3; - Main.tile[x, y].frameY = 0; - Main.tile[x, y + 1].type = type; - Main.tile[x, y + 1].active(true); - Main.tile[x, y + 1].frameX = (short)num3; - Main.tile[x, y + 1].frameY = 18; - } - } - } - else - { - if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].active() && !Main.tile[x, y - 1].active()) - { - if (Main.tile[x, y + 1].type == (ushort)mod.TileType("Navystone")) - { - if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].active()) - { - int num13 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num13; - Main.tile[x, y].frameY = 90; - } - else - { - int num14 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y - 1].type = type; - Main.tile[x, y - 1].active(true); - Main.tile[x, y - 1].frameX = (short)num14; - Main.tile[x, y - 1].frameY = 36; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num14; - Main.tile[x, y].frameY = 54; - } - } - } - } - } - #endregion + #region PlaceTits + public static void PlaceTit(int x, int y, ushort type = 165) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (Main.tile[x, y - 1] == null) + { + Main.tile[x, y - 1] = new Tile(); + } + if (Main.tile[x, y] == null) + { + Main.tile[x, y] = new Tile(); + } + if (Main.tile[x, y + 1] == null) + { + Main.tile[x, y + 1] = new Tile(); + } + if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].active() && !Main.tile[x, y + 1].active()) + { + if (Main.tile[x, y - 1].type == (ushort)mod.TileType("Navystone")) + { + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].active()) + { + int num2 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num2; + Main.tile[x, y].frameY = 72; + } + else + { + int num3 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num3; + Main.tile[x, y].frameY = 0; + Main.tile[x, y + 1].type = type; + Main.tile[x, y + 1].active(true); + Main.tile[x, y + 1].frameX = (short)num3; + Main.tile[x, y + 1].frameY = 18; + } + } + } + else + { + if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].active() && !Main.tile[x, y - 1].active()) + { + if (Main.tile[x, y + 1].type == (ushort)mod.TileType("Navystone")) + { + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].active()) + { + int num13 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num13; + Main.tile[x, y].frameY = 90; + } + else + { + int num14 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y - 1].type = type; + Main.tile[x, y - 1].active(true); + Main.tile[x, y - 1].frameX = (short)num14; + Main.tile[x, y - 1].frameY = 36; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num14; + Main.tile[x, y].frameY = 54; + } + } + } + } + } + #endregion - #region Planetoids - public static void Planetoids(GenerationProgress progress) - { - progress.Message = "Generating Planetoids..."; + #region Planetoids + public static void Planetoids(GenerationProgress progress) + { + progress.Message = "Generating Planetoids..."; - int GrassPlanetoidCount = Main.maxTilesX / 1100; - int LCPlanetoidCount = Main.maxTilesX / 800; - int MudPlanetoidCount = Main.maxTilesX / 1100; + int GrassPlanetoidCount = Main.maxTilesX / 1100; + int LCPlanetoidCount = Main.maxTilesX / 800; + int MudPlanetoidCount = Main.maxTilesX / 1100; - while (true) - { - if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 300, Main.maxTilesX / 2 + 300), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) - { - break; - } - } - while (LCPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); - int y = WorldGen.genRand.Next(70, 101); + while (true) + { + if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 300, Main.maxTilesX / 2 + 300), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) + { + break; + } + } + while (LCPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); + int y = WorldGen.genRand.Next(70, 101); - bool placed = Biomes.Place(x, y, WorldGen.structures); + bool placed = Biomes.Place(x, y, WorldGen.structures); - if (placed) - LCPlanetoidCount--; - } - while (GrassPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); - int y = WorldGen.genRand.Next(100, 131); + if (placed) + LCPlanetoidCount--; + } + while (GrassPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); + int y = WorldGen.genRand.Next(100, 131); - bool placed = Biomes.Place(x, y, WorldGen.structures); + bool placed = Biomes.Place(x, y, WorldGen.structures); - if (placed) - GrassPlanetoidCount--; - } - while (MudPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); - int y = WorldGen.genRand.Next(100, 131); + if (placed) + GrassPlanetoidCount--; + } + while (MudPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); + int y = WorldGen.genRand.Next(100, 131); - bool placed = Biomes.Place(x, y, WorldGen.structures); + bool placed = Biomes.Place(x, y, WorldGen.structures); - if (placed) - MudPlanetoidCount--; - } - } - #endregion - } + if (placed) + MudPlanetoidCount--; + } + } + #endregion + } }